Skip to content

Commit

Permalink
Merge branch 'master' into feat/repay-bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem committed Sep 6, 2023
2 parents 4545849 + 8e41d0e commit 28189af
Show file tree
Hide file tree
Showing 12 changed files with 1,276 additions and 166 deletions.
123 changes: 43 additions & 80 deletions packages/contract-helpers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,154 +1,121 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 1.18.2 (2023-07-14)

All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

### Bug Fixes
# 1.20.0 (2023-08-22)

* remove commented imports ([#552](https://github.com/aave/aave-utilities/issues/552)) ([91a2772](https://github.com/aave/aave-utilities/commit/91a2772477ce2d9a809114dcbe2535c234603c38))
### Features

- withdraw and swap ([#555](https://github.com/aave/aave-utilities/issues/555))
([ca6c230](https://github.com/aave/aave-utilities/commit/ca6c230f39536ba34313ba5ec8295267742216a3))

# 1.19.0 (2023-08-21)

### Features

- add Scroll Sepolia and Scroll chainIds
([#554](https://github.com/aave/aave-utilities/issues/554))
([7510d22](https://github.com/aave/aave-utilities/commit/7510d227dd358f3420d7788a9feaaa72f09e8e9e))

## 1.18.1 (2023-07-12)
## 1.18.3 (2023-08-18)

**Note:** Version bump only for package @aave/contract-helpers

## 1.18.2 (2023-07-14)

### Bug Fixes

- remove commented imports
([#552](https://github.com/aave/aave-utilities/issues/552))
([91a2772](https://github.com/aave/aave-utilities/commit/91a2772477ce2d9a809114dcbe2535c234603c38))

## 1.18.1 (2023-07-12)

**Note:** Version bump only for package @aave/contract-helpers

# 1.18.0 (2023-07-12)


### Features

* debt switch ([#548](https://github.com/aave/aave-utilities/issues/548)) ([8c943d7](https://github.com/aave/aave-utilities/commit/8c943d78eda94f6e330e343d3cded9286ac2079c))




- debt switch ([#548](https://github.com/aave/aave-utilities/issues/548))
([8c943d7](https://github.com/aave/aave-utilities/commit/8c943d78eda94f6e330e343d3cded9286ac2079c))

## 1.17.8 (2023-06-22)

**Note:** Version bump only for package @aave/contract-helpers





## 1.17.7 (2023-06-16)

**Note:** Version bump only for package @aave/contract-helpers





## 1.17.6 (2023-06-01)


### Bug Fixes

* gas limits ([#543](https://github.com/aave/aave-utilities/issues/543)) ([cd4e533](https://github.com/aave/aave-utilities/commit/cd4e533c8c469306abaf4a9c1b0a1066b59cf875))




- gas limits ([#543](https://github.com/aave/aave-utilities/issues/543))
([cd4e533](https://github.com/aave/aave-utilities/commit/cd4e533c8c469306abaf4a9c1b0a1066b59cf875))

## 1.17.5 (2023-05-23)

**Note:** Version bump only for package @aave/contract-helpers





## 1.17.4 (2023-05-05)

**Note:** Version bump only for package @aave/contract-helpers





## 1.17.3 (2023-05-02)


### Bug Fixes

* decimal formatting in credit delegation approval checks ([#538](https://github.com/aave/aave-utilities/issues/538)) ([27eef6b](https://github.com/aave/aave-utilities/commit/27eef6b182f671fc9b4eb13cbd3712be17949c5c))




- decimal formatting in credit delegation approval checks
([#538](https://github.com/aave/aave-utilities/issues/538))
([27eef6b](https://github.com/aave/aave-utilities/commit/27eef6b182f671fc9b4eb13cbd3712be17949c5c))

## 1.17.2 (2023-05-01)


### Bug Fixes

* integer rounding for migration credit delegation approval buffer ([#537](https://github.com/aave/aave-utilities/issues/537)) ([3eef29e](https://github.com/aave/aave-utilities/commit/3eef29eb2e79bce2e1289c951fa00628bc5d4868))




- integer rounding for migration credit delegation approval buffer
([#537](https://github.com/aave/aave-utilities/issues/537))
([3eef29e](https://github.com/aave/aave-utilities/commit/3eef29eb2e79bce2e1289c951fa00628bc5d4868))

## 1.17.1 (2023-05-01)

**Note:** Version bump only for package @aave/contract-helpers





# 1.17.0 (2023-04-27)


### Features

* fixed available debt in isolated reserve in case that debt > ma… ([#532](https://github.com/aave/aave-utilities/issues/532)) ([7a2ea1e](https://github.com/aave/aave-utilities/commit/7a2ea1e94a26008247b4c4c045641291ff20261b))




- fixed available debt in isolated reserve in case that debt > ma…
([#532](https://github.com/aave/aave-utilities/issues/532))
([7a2ea1e](https://github.com/aave/aave-utilities/commit/7a2ea1e94a26008247b4c4c045641291ff20261b))

# 1.16.0 (2023-04-17)


### Features

* update borrow methods SDK ([#527](https://github.com/aave/aave-utilities/issues/527)) ([da31b83](https://github.com/aave/aave-utilities/commit/da31b836dd7a85da0dbfe664b67612b1f261c7a7))




- update borrow methods SDK
([#527](https://github.com/aave/aave-utilities/issues/527))
([da31b83](https://github.com/aave/aave-utilities/commit/da31b836dd7a85da0dbfe664b67612b1f261c7a7))

# 1.15.0 (2023-04-12)


### Features

* add Scroll Alpha chainId ([#528](https://github.com/aave/aave-utilities/issues/528)) ([3418c70](https://github.com/aave/aave-utilities/commit/3418c7087796397ed535fc7a3522445fb44f94c5))




- add Scroll Alpha chainId
([#528](https://github.com/aave/aave-utilities/issues/528))
([3418c70](https://github.com/aave/aave-utilities/commit/3418c7087796397ed535fc7a3522445fb44f94c5))

# 1.14.0 (2023-04-05)


### Features

* tx bundle refactor ([#514](https://github.com/aave/aave-utilities/issues/514)) ([fc5c937](https://github.com/aave/aave-utilities/commit/fc5c9378b48a14a31df9fdbe435095a3e81390a2)), closes [#524](https://github.com/aave/aave-utilities/issues/524) [#504](https://github.com/aave/aave-utilities/issues/504)




- tx bundle refactor ([#514](https://github.com/aave/aave-utilities/issues/514))
([fc5c937](https://github.com/aave/aave-utilities/commit/fc5c9378b48a14a31df9fdbe435095a3e81390a2)),
closes [#524](https://github.com/aave/aave-utilities/issues/524)
[#504](https://github.com/aave/aave-utilities/issues/504)

# Change Log

Expand All @@ -159,10 +126,6 @@ All notable changes to this project will be documented in this file. See

**Note:** Version bump only for package @aave/contract-helpers





## 1.13.6 (2023-03-03)

**Note:** Version bump only for package @aave/contract-helpers
Expand Down
3 changes: 2 additions & 1 deletion packages/contract-helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aave/contract-helpers",
"version": "1.18.2",
"version": "1.20.0",
"sideEffects": false,
"license": "MIT",
"description": "",
Expand All @@ -11,6 +11,7 @@
"prebuild": "npm run clean",
"build": "cd ../.. && tsc -p packages/contract-helpers/tsconfig.json && tsc -p packages/contract-helpers/tsconfig.json --module commonjs --outDir ./packages/contract-helpers/dist/cjs",
"test": "cd ../.. && yarn test packages/contract-helpers",
"test:watch": "cd ../.. && yarn test --watch packages/contract-helpers",
"cover": "cd ../.. && yarn cover packages/contract-helpers",
"commit": "cd ../.. && yarn commit",
"prepublishOnly": "yarn build"
Expand Down
7 changes: 7 additions & 0 deletions packages/contract-helpers/src/commons/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export const ChainIdToNetwork: Record<number, string> = {
1666700000: 'harmony_testnet',
11155111: 'sepolia',
534353: 'scroll_alpha',
534351: 'scroll_sepolia',
534352: 'scroll',
1088: 'metis_andromeda',
8453: 'base',
};

export enum ChainId {
Expand All @@ -66,7 +69,10 @@ export enum ChainId {
zkevm_testnet = 1402,
sepolia = 11155111,
scroll_alpha = 534353,
scroll_sepolia = 534351,
scroll = 534352,
metis_andromeda = 1088,
base = 8453,
}
export type ConstantAddressesByNetwork = Record<
string,
Expand Down Expand Up @@ -136,6 +142,7 @@ export enum ProtocolAction {
claimRewards = 'claimRewards',
claimRewardsAndStake = 'claimRewardsAndStake',
setUsageAsCollateral = 'setUsageAsCollateral',
withdrawAndSwitch = 'withdrawAndSwitch',
}

export enum GovernanceVote {
Expand Down
8 changes: 4 additions & 4 deletions packages/contract-helpers/src/commons/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ export const gasLimitRecommendations: GasRecommendationType = {
limit: '350000',
recommended: '350000',
},
[ProtocolAction.stake]: {
limit: '350000',
recommended: '350000',
},
[ProtocolAction.stakeWithPermit]: {
limit: '400000',
recommended: '400000',
Expand All @@ -134,6 +130,10 @@ export const gasLimitRecommendations: GasRecommendationType = {
limit: '300000',
recommended: '300000',
},
[ProtocolAction.withdrawAndSwitch]: {
limit: '1000000',
recommended: '1000000',
},
};

export const mintAmountsPerToken: Record<string, string> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,31 @@ export function LiquiditySwapValidator(
};
}

export function WithdrawAndSwitchValidator(
target: any,
propertyName: string,
descriptor: TypedPropertyDescriptor<any>,
): any {
const method = descriptor.value;
descriptor.value = function () {
// @ts-expect-error todo: check why this ignore is needed
if (!utils.isAddress(this.withdrawAndSwitchAdapterAddress)) {
console.error(
`[WithdrawAndSwitchValidator] You need to pass valid addresses`,
);
return [];
}

isEthAddressValidator(target, propertyName, arguments);

amountGtThan0Validator(target, propertyName, arguments);

amountGtThan0OrMinus1(target, propertyName, arguments);

return method.apply(this, arguments);
};
}

export function RepayWithCollateralValidator(
target: any,
propertyName: string,
Expand Down
1 change: 1 addition & 0 deletions packages/contract-helpers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export * from './gho';
export * from './v3-migration-contract';
export * from './erc20-2612';
export * from './paraswap-debtSwitch-contract';
export * from './paraswap-withdrawAndSwitchAdapter-contract';

// commons
export * from './commons/types';
Expand Down
Loading

0 comments on commit 28189af

Please sign in to comment.