diff --git a/.gitignore b/.gitignore index c22bcf0d..ad77000f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ coverage/ packages/*/dist/ node_modules package-lock.json -.idea/ +.idea diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0665342d..c3181051 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -116,5 +116,5 @@ also in the package.json paste these in: "types": "./dist/esm/index.d.ts", ``` -Thats it now start writing your logic, you must write your typescript code in +That's it. Now start writing your logic. You must write your typescript code in the `src` folder in your package. diff --git a/README.md b/README.md index d66413f0..18cc7848 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -

Aave logo

+

Aave logo

Aave Utilities

-The Aave Protocol is a decentralized non-custodial liquidity protocol -where users can participate as suppliers or borrowers. The protocol is a set of -open source smart contracts which facilitate the logic of user interactions. -These contracts, and all user transactions/balances are stored on a -public ledger called a blockchain, making them accessible to anyone +The Aave Protocol is a decentralized non-custodial liquidity protocol where +users can participate as suppliers or borrowers. The protocol is a set of open +source smart contracts which facilitate the logic of user interactions. These +contracts, and all user transactions/balances are stored on a public ledger +called a blockchain, making them accessible to anyone Aave Utilities is a JavaScript SDK for interacting with V2 and V3 of the Aave Protocol, an upgrade to the existing [aave-js](https://github.com/aave/aave-js) @@ -16,9 +16,9 @@ The `@aave/math-utils` package contains methods for formatting raw ([ethers.js](#ethers.js)) or indexed ([subgraph](#subgraph), [caching server](#caching-server)) contract data for usage on a frontend -The `@aave/contract-helpers` package contains methods for generating transactions -based on method and parameter inputs. It can be used to read and write data to the -on-chain protocol contracts. +The `@aave/contract-helpers` package contains methods for generating +transactions based on method and parameter inputs. Can be used to read and write +data on the protocol contracts.   @@ -122,7 +122,7 @@ samples below: [ethers.js](https://docs.ethers.io/v5/) is a library for interacting with Ethereum and other EVM compatible blockchains. To install: -The first step to query contract data with ethers is to inialize a `provider`, +The first step to query contract data with ethers is to initialize a `provider`, there are a [variety](https://docs.ethers.io/v5/api/providers/) to choose from, all of them requiring the an rpcURL @@ -153,7 +153,6 @@ const provider = new ethers.providers.StaticJsonRpcProvider( ); // Aave protocol contract addresses, will be different for each market and can be found at https://docs.aave.com/developers/deployed-contracts/deployed-contracts -// For V3 Testnet Release, contract addresses can be found here https://github.com/aave/aave-ui/blob/feat/arbitrum-clean/src/ui-config/markets/index.ts const uiPoolDataProviderAddress = '0xa2DC1422E0cE89E1074A6cd7e2481e8e9c4415A6'; const uiIncentiveDataProviderAddress = '0xD01ab9a6577E1D84F142e44D49380e23A340387d'; @@ -216,7 +215,7 @@ frontend interface. ### Subgraph A subgraph indexes events emitted from a smart contract and exposes a graphql -endpoing to query data from. Each network where the protocol is deployed is a +endpoint to query data from. Each network where the protocol is deployed is a corresponding subgraph. Subgraph can be queried directly using the playground (links below) and integrated into applications directly via TheGraph API. Check out these guides from @@ -487,7 +486,7 @@ All V3 market use USD based oracles, so baseCurrencyData can be hardcoded:
Incentives -Samples for incentives data coming soon. Uses `incentivesControlllers` field and +Samples for incentives data coming soon. Uses `incentivesControllers` field and maps incentives to reserves and userReserves.
@@ -500,7 +499,7 @@ maps incentives to reserves and userReserves. Given that the Aave Ui has decentralized hosting with IPFS, it makes sense to not require any API keys to run the UI, but this means only public rpc endpoints -are used which are quickly rate limited. To account for this, Aave has publushed +are used which are quickly rate limited. To account for this, Aave has published a [caching server](https://github.com/aave/aave-ui-caching-server) to perform contract queries on one server, then serve this data to all frontend users through a graphQL endpoint. @@ -793,7 +792,7 @@ const txs: EthereumTransactionTypeExtended[] = await pool.supply({ onBehalfOf, }); -// If the user has not appoved the pool contract to spend their tokens, txs will also contain two transactions: approve and supply. These approval and supply transactions can be submitted just as in V2,OR you can skip the first approval transaction with a gasless signature by using signERC20Approval -> supplyWithPermit which are documented below +// If the user has not approved the pool contract to spend their tokens, txs will also contain two transactions: approve and supply. These approval and supply transactions can be submitted just as in V2,OR you can skip the first approval transaction with a gasless signature by using signERC20Approval -> supplyWithPermit which are documented below // If there is no approval transaction, then supply() can called without the need for an approval or signature ``` @@ -837,7 +836,7 @@ const dataToSign: string = await pool.signERC20Approval({ user, reserve, amount, - deadline + deadline, }); const signature = await provider.send('eth_signTypedData_v4', [ @@ -855,7 +854,7 @@ const signature = await provider.send('eth_signTypedData_v4', [ ### supplyWithPermit Same underlying method as `supply` but uses a signature based approval passed as -a paramter. +a parameter.
Sample Code @@ -894,7 +893,7 @@ Submit transaction as shown [here](#submitting-transactions) Borrow an `amount` of `reserve` asset. -User must have a collaterised position (i.e. aTokens in their wallet) +User must have a collateralized position (i.e. aTokens in their wallet)
Sample Code @@ -908,7 +907,7 @@ const pool = new Pool(provider, { }); /* -- @param `user` The ethereum address that repays +- @param `user` The ethereum address that repays - @param `reserve` The ethereum address of the reserve on which the user borrowed - @param `amount` The amount to repay, or (-1) if the user wants to repay everything - @param `interestRateMode` // Whether the borrow will incur a stable (InterestRate.Stable) or variable (InterestRate.Variable) interest rate @@ -965,7 +964,7 @@ const txs: EthereumTransactionTypeExtended[] = await pool.repay({ onBehalfOf, }); -// If the user has not appoved the pool contract to spend their tokens, txs will also contain two transactions: approve and repay. This approval transaction can be submitted just as in V2, OR you approve with a gasless signature by using signERC20Approval -> supplyWithPermit which are documented below +// If the user has not approved the pool contract to spend their tokens, txs will also contain two transactions: approve and repay. This approval transaction can be submitted just as in V2, OR you approve with a gasless signature by using signERC20Approval -> supplyWithPermit which are documented below // If there is no approval transaction, then repay() can called without the need for an approval or signature ``` @@ -979,7 +978,7 @@ Submit transaction(s) as shown [here](#submitting-transactions) ### repayWithPermit Same underlying method as `repay` but uses a signature based approval passed as -a paramter. +a parameter.
Sample Code @@ -1215,18 +1214,18 @@ const pool = new Pool(provider, { }); /* -- @param `user` The ethereum address that will liquidate the position -- @param @optional `flash` If the transaction will be executed through a flasloan(true) or will be done directly through the adapters(false). Defaults to false -- @param `fromAsset` The ethereum address of the asset you want to swap -- @param `fromAToken` The ethereum address of the aToken of the asset you want to swap -- @param `toAsset` The ethereum address of the asset you want to swap to (get) -- @param `fromAmount` The amount you want to swap -- @param `toAmount` The amount you want to get after the swap -- @param `maxSlippage` The max slippage that the user accepts in the swap -- @param @optional `permitSignature` A permit signature of the tx. Only needed when previously signed (Not needed at the moment). -- @param `swapAll` Bool indicating if the user wants to swap all the current collateral -- @param @optional `onBehalfOf` The ethereum address for which user is swaping. It will default to the user address -- @param @optional `referralCode` Integrators are assigned a referral code and can potentially receive rewards. It defaults to 0 (no referrer) +- @param `user` The ethereum address that will liquidate the position +- @param @optional `flash` If the transaction will be executed through a flashloan(true) or will be done directly through the adapters(false). Defaults to false +- @param `fromAsset` The ethereum address of the asset you want to swap +- @param `fromAToken` The ethereum address of the aToken of the asset you want to swap +- @param `toAsset` The ethereum address of the asset you want to swap to (get) +- @param `fromAmount` The amount you want to swap +- @param `toAmount` The amount you want to get after the swap +- @param `maxSlippage` The max slippage that the user accepts in the swap +- @param @optional `permitSignature` A permit signature of the tx. Only needed when previously signed (Not needed at the moment). +- @param `swapAll` Bool indicating if the user wants to swap all the current collateral +- @param @optional `onBehalfOf` The ethereum address for which user is swapping. It will default to the user address +- @param @optional `referralCode` Integrators are assigned a referral code and can potentially receive rewards. It defaults to 0 (no referrer) - @param @optional `useEthPath` Boolean to indicate if the swap will use an ETH path. Defaults to false */ const txs: EthereumTransactionTypeExtended[] = await lendingPool.swapCollateral( @@ -1271,18 +1270,18 @@ const pool = new Pool(provider, { }); /* -- @param `user` The ethereum address that will liquidate the position -- @param `fromAsset` The ethereum address of the asset you want to repay with (collateral) -- @param `fromAToken` The ethereum address of the aToken of the asset you want to repay with (collateral) -- @param `assetToRepay` The ethereum address of the asset you want to repay +- @param `user` The ethereum address that will liquidate the position +- @param `fromAsset` The ethereum address of the asset you want to repay with (collateral) +- @param `fromAToken` The ethereum address of the aToken of the asset you want to repay with (collateral) +- @param `assetToRepay` The ethereum address of the asset you want to repay - @param `repayWithAmount` The amount of collateral you want to repay the debt with -- @param `repayAmount` The amount of debt you want to repay +- @param `repayAmount` The amount of debt you want to repay - @param `permitSignature` A permit signature of the tx. Optional - @param @optional `repayAllDebt` Bool indicating if the user wants to repay all current debt. Defaults to false - @param `rateMode` //Enum indicating the type of the interest rate of the collateral -- @param @optional `onBehalfOf` The ethereum address for which user is swaping. It will default to the user address -- @param @optional `referralCode` Integrators are assigned a referral code and can potentially receive rewards. It defaults to 0 (no referrer) -- @param @optional `flash` If the transaction will be executed through a flasloan(true) or will be done directly through the adapters(false). Defaults to false +- @param @optional `onBehalfOf` The ethereum address for which user is swapping. It will default to the user address +- @param @optional `referralCode` Integrators are assigned a referral code and can potentially receive rewards. It defaults to 0 (no referrer) +- @param @optional `flash` If the transaction will be executed through a flashloan(true) or will be done directly through the adapters(false). Defaults to false - @param @optional `useEthPath` Boolean to indicate if the swap will use an ETH path. Defaults to false */ const txs: EthereumTransactionTypeExtended[] = @@ -1314,7 +1313,7 @@ Submit transaction(s) as shown [here](#submitting-transactions) Function to enable eMode on a user account IF conditions are met: To enable, pass `categoryId` of desired eMode (1 = stablecoins), can only be -enabled if a users currently borrowed assests are ALL within this eMode category +enabled if a users currently borrowed assets are ALL within this eMode category To disable, pass `categoryId` of 0, can only be disabled if new LTV will not leave user undercollateralized @@ -1390,7 +1389,7 @@ Submit transaction(s) as shown [here](#submitting-transactions) Borrow an `amount` of `reserve` asset. -User must have a collaterised position (i.e. aTokens in their wallet) +User must have a collateralized position (i.e. aTokens in their wallet)
@@ -1406,8 +1405,8 @@ const lendingPool = new LendingPool(provider, { }); /* -- @param `user` The ethereum address that will receive the borrowed amount -- @param `reserve` The ethereum address of the reserve asset +- @param `user` The ethereum address that will receive the borrowed amount +- @param `reserve` The ethereum address of the reserve asset - @param `amount` The amount to be borrowed, in human readable units (e.g. 2.5 ETH) - @param `interestRateMode`//Whether the borrow will incur a stable (InterestRate.Stable) or variable (InterestRate.Variable) interest rate - @param @optional `debtTokenAddress` The ethereum address of the debt token of the asset you want to borrow. Only needed if the reserve is ETH mock address @@ -1451,7 +1450,7 @@ const lendingPool = new LendingPool(provider, { }); /* -- @param `user` The ethereum address that repays +- @param `user` The ethereum address that repays - @param `reserve` The ethereum address of the reserve on which the user borrowed - @param `amount` The amount to repay, or (-1) if the user wants to repay everything - @param `interestRateMode` // Whether stable (InterestRate.Stable) or variable (InterestRate.Variable) debt will be repaid @@ -1558,7 +1557,7 @@ const lendingPool = new LendingPool(provider, { /* - @param `user` The ethereum address that enables or disables the deposit as collateral -- @param `reserve` The ethereum address of the reserve +- @param `reserve` The ethereum address of the reserve - @param `useAsCollateral` Boolean, true if the user wants to use the deposit as collateral, false otherwise */ const txs: EthereumTransactionTypeExtended[] = lendingPool.setUsageAsCollateral( @@ -1594,10 +1593,10 @@ const lendingPool = new LendingPool(provider, { }); /* -- @param `liquidator` The ethereum address that will liquidate the position -- @param `liquidatedUser` The address of the borrower -- @param `debtReserve` The ethereum address of the principal reserve -- @param `collateralReserve` The address of the collateral to liquidated +- @param `liquidator` The ethereum address that will liquidate the position +- @param `liquidatedUser` The address of the borrower +- @param `debtReserve` The ethereum address of the principal reserve +- @param `collateralReserve` The address of the collateral to liquidated - @param `purchaseAmount` The amount of principal that the liquidator wants to repay - @param @optional `getAToken` Boolean to indicate if the user wants to receive the aToken instead of the asset. Defaults to false */ @@ -1638,17 +1637,17 @@ const lendingPool = new LendingPool(provider, { }); /* -- @param `user` The ethereum address that will liquidate the position -- @param @optional `flash` If the transaction will be executed through a flasloan(true) or will be done directly through the adapters(false). Defaults to false -- @param `fromAsset` The ethereum address of the asset you want to swap +- @param `user` The ethereum address that will liquidate the position +- @param @optional `flash` If the transaction will be executed through a flashloan(true) or will be done directly through the adapters(false). Defaults to false +- @param `fromAsset` The ethereum address of the asset you want to swap - @param `fromAToken` The ethereum address of the aToken of the asset you want to swap -- @param `toAsset` The ethereum address of the asset you want to swap to (get) -- @param `fromAmount` The amount you want to swap -- @param `toAmount` The amount you want to get after the swap -- @param `maxSlippage` The max slippage that the user accepts in the swap +- @param `toAsset` The ethereum address of the asset you want to swap to (get) +- @param `fromAmount` The amount you want to swap +- @param `toAmount` The amount you want to get after the swap +- @param `maxSlippage` The max slippage that the user accepts in the swap - @param @optional `permitSignature` A permit signature of the tx. Only needed when previously signed (Not needed at the moment). - @param `swapAll` Bool indicating if the user wants to swap all the current collateral -- @param @optional `onBehalfOf` The ethereum address for which user is swaping. It will default to the user address +- @param @optional `onBehalfOf` The ethereum address for which user is swapping. It will default to the user address - @param @optional `referralCode` Integrators are assigned a referral code and can potentially receive rewards. It defaults to 0 (no referrer) - @param @optional `useEthPath` Boolean to indicate if the swap will use an ETH path. Defaults to false */ @@ -1698,18 +1697,18 @@ const lendingPool = new LendingPool(provider, { }); /* -- @param `user` The ethereum address that will liquidate the position +- @param `user` The ethereum address that will liquidate the position - @param `fromAsset` The ethereum address of the asset you want to repay with (collateral) - @param `fromAToken` The ethereum address of the aToken of the asset you want to repay with (collateral) -- @param `assetToRepay` The ethereum address of the asset you want to repay +- @param `assetToRepay` The ethereum address of the asset you want to repay - @param `repayWithAmount` The amount of collateral you want to repay the debt with -- @param `repayAmount` The amount of debt you want to repay +- @param `repayAmount` The amount of debt you want to repay - @param `permitSignature` A permit signature of the tx. Optional - @param @optional `repayAllDebt` Bool indicating if the user wants to repay all current debt. Defaults to false - @param `rateMode` //Enum indicating the type of the interest rate of the collateral -- @param @optional `onBehalfOf` The ethereum address for which user is swaping. It will default to the user address +- @param @optional `onBehalfOf` The ethereum address for which user is swapping. It will default to the user address - @param @optional `referralCode` Integrators are assigned a referral code and can potentially receive rewards. It defaults to 0 (no referrer) -- @param @optional `flash` If the transaction will be executed through a flasloan(true) or will be done directly through the adapters(false). Defaults to false +- @param @optional `flash` If the transaction will be executed through a flashloan(true) or will be done directly through the adapters(false). Defaults to false - @param @optional `useEthPath` Boolean to indicate if the swap will use an ETH path. Defaults to false */ const txs: EthereumTransactionTypeExtended[] = @@ -1773,10 +1772,10 @@ const governanceService = new AaveGovernanceService(rpcProvider, { /* - @param `user` The ethereum address that will create the proposal - @param `targets` list of contracts called by proposal's associated transactions -- @param `values` list of value in wei for each propoposal's associated transaction +- @param `values` list of value in wei for each proposal's associated transaction - @param `signatures` list of function signatures (can be empty) to be used when created the callData - @param `calldatas` list of calldatas: if associated signature empty, calldata ready, else calldata is arguments -- @param `withDelegatecalls` boolean, true = transaction delegatecalls the taget, else calls the target +- @param `withDelegatecalls` boolean, true = transaction delegatecalls the target, else calls the target - @param `ipfsHash` IPFS hash of the proposal - @param `executor` The ExecutorWithTimelock contract that will execute the proposal: ExecutorType.Short or ExecutorType.Long */ @@ -1929,7 +1928,7 @@ import { GovernancePowerDelegationTokenService } from '@aave/contract-helpers'; const powerDelegation = new GovernancePowerDelegationTokenService(rpcProvider); /* -- @param `user` The ethereum address that will create the proposal +- @param `user` The ethereum address that will create the proposal - @param `delegatee` The ethereum address to which the user wants to delegate proposition power and voting power - @param `governanceToken` The ethereum address of the governance token */ @@ -1956,7 +1955,7 @@ import { GovernancePowerDelegationTokenService } from '@aave/contract-helpers'; const powerDelegation = new GovernancePowerDelegationTokenService(rpcProvider); /* -- @param `user` The ethereum address that will create the proposal +- @param `user` The ethereum address that will create the proposal - @param `delegatee` The ethereum address to which the user wants to delegate proposition power and voting power - @param `delegationType` The type of the delegation the user wants to do: voting power ('0') or proposition power ('1') - @param `governanceToken` The ethereum address of the governance token @@ -1994,7 +1993,7 @@ const faucetService = new FaucetService(provider, faucetAddress); /* - @param `userAddress` The ethereum address of the wallet the minted tokens will go -- @param `reserve` The ethereum address of the token you want to mint +- @param `reserve` The ethereum address of the token you want to mint - @param `tokenSymbol` The symbol of the token you want to mint */ const tx = faucet.mint({ userAddress, reserve, tokenSymbol }); @@ -2008,9 +2007,13 @@ Submit transaction as shown [here](#submitting-transactions) ## Credit Delegation -Credit delegation is performed on the debtToken contract through the `approveDelegation` function, which approves a spender to borrow a specified amount of that token. +Credit delegation is performed on the debtToken contract through the +`approveDelegation` function, which approves a spender to borrow a specified +amount of that token. -Accessing delegated credit is done by passing the delegator address as the `onBehalfOf` parameter when calling `borrow` on the `Pool` (V3) or `LendingPool` (V2). +Accessing delegated credit is done by passing the delegator address as the +`onBehalfOf` parameter when calling `borrow` on the `Pool` (V3) or `LendingPool` +(V2). ### approveDelegation @@ -2018,23 +2021,23 @@ Accessing delegated credit is done by passing the delegator address as the `onBe Sample Code ```ts -import { BaseDebtToken, ERC20Service } from "@aave/contract-helpers"; -import { ethers } from "ethers"; +import { BaseDebtToken, ERC20Service } from '@aave/contract-helpers'; +import { ethers } from 'ethers'; // Sample public RPC address for querying polygon mainnet const provider = new ethers.providers.JsonRpcProvider( - "https://polygon-rpc.com" + 'https://polygon-rpc.com', ); const delegationServicePolygonV2USDC = new BaseDebtToken( provider, - new ERC20Service(provider) // This parameter will be removed in future utils version + new ERC20Service(provider), // This parameter will be removed in future utils version ); const approveDelegation = delegationServicePolygonV2USDC.approveDelegation({ - user: "...", /// delegator - delegatee: "...", - debtTokenAddress: "...", // can be any V2 or V3 debt token + user: '...', /// delegator + delegatee: '...', + debtTokenAddress: '...', // can be any V2 or V3 debt token amount: 1, // in decimals of underlying token }); ``` diff --git a/jest.config.js b/jest.config.js index 10af533b..7586e402 100644 --- a/jest.config.js +++ b/jest.config.js @@ -38,7 +38,6 @@ module.exports = { 'packages/contract-helpers/src/paraswap-repayWithCollateralAdapter-contract/typechain', 'packages/contract-helpers/src/lendingPool-contract/typechain', 'packages/contract-helpers/src/v3-migration-contract/typechain', - 'packages/contract-helpers/src/v3-migration-contract/typechain/factories', 'packages/contract-helpers/src/index.ts', 'packages/math-utils/src/formatters/reserve/index.ts', // TODO: remove ], diff --git a/packages/contract-helpers/CHANGELOG.md b/packages/contract-helpers/CHANGELOG.md index cc419936..2e1b1ccb 100644 --- a/packages/contract-helpers/CHANGELOG.md +++ b/packages/contract-helpers/CHANGELOG.md @@ -3,35 +3,99 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## 1.12.2 (2023-01-12) +## 1.13.5 (2023-02-03) -**Note:** Version bump only for package @aave/contract-helpers +### Bug Fixes +- Fix typos ([#486](https://github.com/aave/aave-utilities/issues/486)) + ([db4cef5](https://github.com/aave/aave-utilities/commit/db4cef584a68f951183df25ffa2e8f2042893d21)) +## 1.13.4 (2023-02-03) +### Bug Fixes +- check for liq threshold in place of ltv for user collateral check + ([#505](https://github.com/aave/aave-utilities/issues/505)) + ([7c776d2](https://github.com/aave/aave-utilities/commit/7c776d23c50ff0d5240151a922c64e837818283d)) -## 1.12.1 (2023-01-10) +## 1.13.3 (2023-01-26) + +### Bug Fixes + +- typechain structure + ([#501](https://github.com/aave/aave-utilities/issues/501)) + ([70f3c4f](https://github.com/aave/aave-utilities/commit/70f3c4f4b066676a37636ed1be913e3056a70766)) + +## 1.13.2 (2023-01-25) + +**Note:** Version bump only for package @aave/contract-helpers + +# Change Log +All notable changes to this project will be documented in this file. See +[Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## 1.13.1 (2023-01-24) ### Bug Fixes -* change flashloan parameters to have variable debt on v3 instead of stable and variable ([#490](https://github.com/aave/aave-utilities/issues/490)) ([9b8a726](https://github.com/aave/aave-utilities/commit/9b8a7261ba9c3e123798d781312a5388271cef3b)) +<<<<<<< HEAD +- imports and file loaders + ([#477](https://github.com/aave/aave-utilities/issues/477)) + ([42e8530](https://github.com/aave/aave-utilities/commit/42e853041820a35696c1017eb2fb082aeb9e3c89)) + ======= +* apply default gas limit estimations + ([#499](https://github.com/aave/aave-utilities/issues/499)) + ([b377452](https://github.com/aave/aave-utilities/commit/b37745255194cc2f8c713bc3451a05dc8bab20a1)) +> > > > > > > master +# 1.13.0 (2023-01-23) -# 1.12.0 (2023-01-03) +<<<<<<< HEAD +# 1.10.0 (2022-12-14) ### Features -* add V3Faucet service ([#475](https://github.com/aave/aave-utilities/issues/475)) ([1608398](https://github.com/aave/aave-utilities/commit/160839863a83955d54a4a1e727bb4a22f111c13e)) +======= +### Features +- add default gas estimation for borrow and vote + ([#492](https://github.com/aave/aave-utilities/issues/492)) + ([713ad36](https://github.com/aave/aave-utilities/commit/713ad361215f0fcbaaf07f7e374489459d1874ae)) + > > > > > > > master +* add default gas estimation for permit actions + ([#461](https://github.com/aave/aave-utilities/issues/461)) + ([7342763](https://github.com/aave/aave-utilities/commit/734276326b1d6b0b2b9aa9965bbd3f310ae0ec37)) +# 1.9.0 (2022-10-14) + +## 1.12.2 (2023-01-12) + +**Note:** Version bump only for package @aave/contract-helpers + +## 1.12.1 (2023-01-10) + +### Bug Fixes + +- change flashloan parameters to have variable debt on v3 instead of stable and + variable ([#490](https://github.com/aave/aave-utilities/issues/490)) + ([9b8a726](https://github.com/aave/aave-utilities/commit/9b8a7261ba9c3e123798d781312a5388271cef3b)) + +# 1.12.0 (2023-01-03) + +### Features + +# <<<<<<< HEAD + +- add V3Faucet service + ([#475](https://github.com/aave/aave-utilities/issues/475)) + ([1608398](https://github.com/aave/aave-utilities/commit/160839863a83955d54a4a1e727bb4a22f111c13e)) ## 1.11.2 (2022-12-29) @@ -45,20 +109,12 @@ All notable changes to this project will be documented in this file. See **Note:** Version bump only for package @aave/contract-helpers -# 1.10.0 (2022-12-14) - -### Features - -- add default gas estimation for permit actions - ([#461](https://github.com/aave/aave-utilities/issues/461)) - ([7342763](https://github.com/aave/aave-utilities/commit/734276326b1d6b0b2b9aa9965bbd3f310ae0ec37)) - # 1.11.0 (2022-12-21) -# 1.9.0 (2022-10-14) - ### Features +> > > > > > > master + - v3 migration ([#465](https://github.com/aave/aave-utilities/issues/465)) ([ac9197f](https://github.com/aave/aave-utilities/commit/ac9197f6a2237b34e917d23bc79798efe3e04cb1)) diff --git a/packages/contract-helpers/package.json b/packages/contract-helpers/package.json index 5208b37f..a8828ded 100644 --- a/packages/contract-helpers/package.json +++ b/packages/contract-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@aave/contract-helpers", - "version": "1.12.2", + "version": "1.13.5", "sideEffects": false, "license": "MIT", "description": "", diff --git a/packages/contract-helpers/src/commons/BaseService.test.ts b/packages/contract-helpers/src/commons/BaseService.test.ts index a04a5ecb..0e52cc52 100644 --- a/packages/contract-helpers/src/commons/BaseService.test.ts +++ b/packages/contract-helpers/src/commons/BaseService.test.ts @@ -35,7 +35,7 @@ describe('BaseService', () => { afterEach(() => { jest.clearAllMocks(); }); - it('Expects to initalize new instance', () => { + it('Expects to initialize new instance', () => { const spy = jest.spyOn(Test__factory, 'connect'); const baseService = new BaseService(provider, Test__factory); @@ -90,7 +90,7 @@ describe('BaseService', () => { expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); expect(tx.gasLimit).toEqual(BigNumber.from(1)); }); - it('Expects a tx object with recomended gas limit', async () => { + it('Expects a tx object with recommended gas limit', async () => { const txCallback = baseService.generateTxCallback({ rawTxMethod, from, diff --git a/packages/contract-helpers/src/commons/BaseService.ts b/packages/contract-helpers/src/commons/BaseService.ts index df701625..48737923 100644 --- a/packages/contract-helpers/src/commons/BaseService.ts +++ b/packages/contract-helpers/src/commons/BaseService.ts @@ -93,7 +93,7 @@ export default class BaseService { const { gasLimit, gasPrice: gasPriceProv }: transactionType = await txCallback(); if (!gasLimit) { - // If we don't recieve the correct gas we throw a error + // If we don't receive the correct gas we throw an error throw new Error('Transaction calculation error'); } diff --git a/packages/contract-helpers/src/commons/types.ts b/packages/contract-helpers/src/commons/types.ts index 82c5cac1..b6a814c1 100644 --- a/packages/contract-helpers/src/commons/types.ts +++ b/packages/contract-helpers/src/commons/types.ts @@ -96,6 +96,7 @@ export enum eEthereumTxType { export enum ProtocolAction { default = 'default', supply = 'supply', + borrow = 'borrow', withdraw = 'withdraw', deposit = 'deposit', liquidationCall = 'liquidationCall', @@ -110,6 +111,7 @@ export enum ProtocolAction { repayWithPermit = 'repayWithPermit', stake = 'stake', stakeWithPermit = 'stakeWithPermit', + vote = 'vote', } export enum GovernanceVote { diff --git a/packages/contract-helpers/src/commons/utils.ts b/packages/contract-helpers/src/commons/utils.ts index d0b5c6ef..03ef8ab6 100644 --- a/packages/contract-helpers/src/commons/utils.ts +++ b/packages/contract-helpers/src/commons/utils.ts @@ -46,6 +46,10 @@ export const gasLimitRecommendations: GasRecommendationType = { limit: '300000', recommended: '300000', }, + [ProtocolAction.borrow]: { + limit: '400000', + recommended: '400000', + }, [ProtocolAction.withdraw]: { limit: '230000', recommended: '300000', @@ -98,6 +102,10 @@ export const gasLimitRecommendations: GasRecommendationType = { limit: '400000', recommended: '400000', }, + [ProtocolAction.vote]: { + limit: '125000', + recommended: '125000', + }, }; export const mintAmountsPerToken: Record = { diff --git a/packages/contract-helpers/src/gho/GhoDiscountRateStrategyService.ts b/packages/contract-helpers/src/gho/GhoDiscountRateStrategyService.ts deleted file mode 100644 index 0d66fbc6..00000000 --- a/packages/contract-helpers/src/gho/GhoDiscountRateStrategyService.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { BigNumber, BigNumberish, providers } from 'ethers'; -import BaseService from '../commons/BaseService'; -import { - GhoVariableDebtTokenService, - IGhoVariableDebtTokenService, -} from './GhoVariableDebtTokenService'; -import type { GhoDiscountRateStrategy } from './typechain/GhoDiscountRateStrategy'; -import { GhoDiscountRateStrategy__factory } from './typechain/GhoDiscountRateStrategy__factory'; - -interface IGhoDiscountRateStrategyService { - getGhoDiscountedPerDiscountToken: () => Promise; - getGhoDiscountRate: () => Promise; - getGhoMinDiscountTokenBalance: () => Promise; - getGhoMinDebtTokenBalance: () => Promise; - calculateDiscountRate: ( - ghoDebtTokenBalance: BigNumberish, - skAaveBalance: BigNumberish, - ) => Promise; -} - -/** - * The service for interacting with the GhoDiscountRateStrategy.sol smart contract - * https://github.com/aave/gho/blob/main/src/contracts/facilitators/aave/interestStrategy/GhoDiscountRateStrategy.sol - */ -export class GhoDiscountRateStrategyService - extends BaseService - implements IGhoDiscountRateStrategyService -{ - readonly ghoVariableDebtTokenService: IGhoVariableDebtTokenService; - - constructor( - provider: providers.Provider, - ghoVariableDebtTokenAddress: string, - ) { - super(provider, GhoDiscountRateStrategy__factory); - this.ghoVariableDebtTokenService = new GhoVariableDebtTokenService( - provider, - ghoVariableDebtTokenAddress, - ); - } - - /** - * Gets the amount of debt that is entitled to get a discount per unit of discount token - * @returns - A BigNumber representing the amount of GHO tokens per discount token that are eligible to be discounted, expressed with the number of decimals of the discount token - */ - public async getGhoDiscountedPerDiscountToken() { - const ghoDiscountRateStrategyAddress = - await this.ghoVariableDebtTokenService.getDiscountRateStrategy(); - const contract = this.getContractInstance(ghoDiscountRateStrategyAddress); - // eslint-disable-next-line new-cap - const result = await contract.GHO_DISCOUNTED_PER_DISCOUNT_TOKEN(); - return result; - } - - /** - * Gets the percentage of discount to apply to the part of the debt that is entitled to get a discount - * @returns - A BigNumber representing the current maximum discount rate, expressed in bps, a value of 2000 results in 20.00% - */ - public async getGhoDiscountRate() { - const ghoDiscountRateStrategyAddress = - await this.ghoVariableDebtTokenService.getDiscountRateStrategy(); - const contract = this.getContractInstance(ghoDiscountRateStrategyAddress); - // eslint-disable-next-line new-cap - const result = await contract.DISCOUNT_RATE(); - return result; - } - - /** - * Gets the minimum balance amount of discount token to be entitled to a discount - * @returns - A BigNumber representing the minimum amount of discount tokens needed to be eligible for a discount, expressed with the number of decimals of the discount token - */ - public async getGhoMinDiscountTokenBalance() { - const ghoDiscountRateStrategyAddress = - await this.ghoVariableDebtTokenService.getDiscountRateStrategy(); - const contract = this.getContractInstance(ghoDiscountRateStrategyAddress); - // eslint-disable-next-line new-cap - const result = await contract.MIN_DISCOUNT_TOKEN_BALANCE(); - return result; - } - - /** - * Gets the minimum balance amount of debt token to be entitled to a discount - * @returns - A BigNumber representing the minimum amount of debt tokens needed to be eligible for a discount, expressed with the number of decimals of the debt token - */ - public async getGhoMinDebtTokenBalance() { - const ghoDiscountRateStrategyAddress = - await this.ghoVariableDebtTokenService.getDiscountRateStrategy(); - const contract = this.getContractInstance(ghoDiscountRateStrategyAddress); - // eslint-disable-next-line new-cap - const result = await contract.MIN_DEBT_TOKEN_BALANCE(); - return result; - } - - /** - * Calculates the discounted interest rate charged on the borrowed native GHO token from the Aave Protocol. Currently this is set to be 20% on 100 GHO borrowed per stkAAVE held. Additionally, a user's discount rate is updated anytime they send or receive the discount token (stkAAVE). Users are entitled to this discount for a given amount of time without needing to perform any additional actions (i.e. the discount lock period). - * @param ghoDebtTokenBalance - The balance for the user's GhoVariableDebtToken, i.e. the amount they currently have borrowed from the protocol - * @param stakedAaveBalance - The balance of the user's stkAAVE token balance - * @returns - A BigNumber representing the discounted interest rate charged on the borrowed native GHO token, expresed in bps - */ - public async calculateDiscountRate( - ghoDebtTokenBalance: BigNumberish, - stakedAaveBalance: BigNumberish, - ) { - const ghoDiscountRateStrategyAddress = - await this.ghoVariableDebtTokenService.getDiscountRateStrategy(); - const contract = this.getContractInstance(ghoDiscountRateStrategyAddress); - const result = await contract.calculateDiscountRate( - ghoDebtTokenBalance, - stakedAaveBalance, - ); - return result; - } -} diff --git a/packages/contract-helpers/src/gho/GhoService.ts b/packages/contract-helpers/src/gho/GhoService.ts index e98eda8c..699b09eb 100644 --- a/packages/contract-helpers/src/gho/GhoService.ts +++ b/packages/contract-helpers/src/gho/GhoService.ts @@ -78,7 +78,7 @@ export class GhoService implements IGhoService { ); return { - userGhoDiscountRate: ghoUserData.userGhoDiscountRate.toString(), + userGhoDiscountPercent: ghoUserData.userGhoDiscountPercent.toString(), userDiscountTokenBalance: ghoUserData.userDiscountTokenBalance.toString(), userGhoScaledBorrowBalance: ghoUserData.userGhoScaledBorrowBalance.toString(), diff --git a/packages/contract-helpers/src/gho/GhoTokenService.ts b/packages/contract-helpers/src/gho/GhoTokenService.ts deleted file mode 100644 index a0f6925b..00000000 --- a/packages/contract-helpers/src/gho/GhoTokenService.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { BigNumber, providers } from 'ethers'; -import BaseService from '../commons/BaseService'; -import type { GhoToken } from './typechain/GhoToken'; -import { GhoToken__factory } from './typechain/GhoToken__factory'; -import type { IGhoToken } from './typechain/IGhoToken'; - -interface IGhoTokenService { - totalSupply: () => Promise; - getFacilitatorsList: () => Promise; - getFacilitator: ( - facilitatorAddress: string, - ) => Promise; - getFacilitatorBucket: ( - facilitatorAddress: string, - ) => Promise; -} - -/** - * The service for interacting with the GhoToken.sol smart contract. - * This contract controls operations minting & burning the native GHO token as well as facilitator management. - * https://github.com/aave/gho/blob/main/src/contracts/gho/GhoToken.sol - */ -export class GhoTokenService - extends BaseService - implements IGhoTokenService -{ - readonly ghoTokenAddress: string; - - constructor(provider: providers.Provider, ghoTokenAddress: string) { - super(provider, GhoToken__factory); - this.ghoTokenAddress = ghoTokenAddress; - } - - /** - * Gets the total supply for the GHO token. This is the sum of all facilitators' current bucket levels - * @returns - A BigNumber representing the total supply of GHO - */ - public async totalSupply() { - const contract = this.getContractInstance(this.ghoTokenAddress); - const result = await contract.totalSupply(); - return result; - } - - /** - * Gets the full list of facilitators for the GHO token - * @returns - An array of facilitator addresses as strings, which can be used for querying in more detail - */ - public async getFacilitatorsList() { - const contract = this.getContractInstance(this.ghoTokenAddress); - const result = await contract.getFacilitatorsList(); - return result; - } - - /** - * Gets the instance for a given facilitator - * @param facilitatorAddress - The address for the currently deployed contract for the facilitator being queried - * @returns - The instance of the facilitator, which contains `bucket` and `label` fields - */ - public async getFacilitator(facilitatorAddress: string) { - const contract = this.getContractInstance(this.ghoTokenAddress); - const result = await contract.getFacilitator(facilitatorAddress); - return result; - } - - /** - * Gets the bucket instance for a given facilitator - * @param facilitatorAddress - The address for the currently deployed contract for the facilitator being queried - * @returns - The instance of the facilitator bucket, which contains `maxCapacity` and `level` fields - */ - public async getFacilitatorBucket(facilitatorAddress: string) { - const contract = this.getContractInstance(this.ghoTokenAddress); - const result = await contract.getFacilitatorBucket(facilitatorAddress); - return result; - } -} diff --git a/packages/contract-helpers/src/gho/GhoVariableDebtTokenService.ts b/packages/contract-helpers/src/gho/GhoVariableDebtTokenService.ts deleted file mode 100644 index be92d289..00000000 --- a/packages/contract-helpers/src/gho/GhoVariableDebtTokenService.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { BigNumber, providers } from 'ethers'; -import BaseService from '../commons/BaseService'; -import { GhoVariableDebtToken__factory } from './typechain/GhoVariableDebtToken__factory'; -import type { IGhoVariableDebtToken } from './typechain/IGhoVariableDebtToken'; - -export interface IGhoVariableDebtTokenService { - getDiscountToken: () => Promise; - getDiscountLockPeriod: () => Promise; - getUserDiscountPercent: (userAddress: string) => Promise; - getUserRebalanceTimestamp: (userAddress: string) => Promise; - getDiscountRateStrategy: () => Promise; -} - -/** - * The service for interacting with the GhoToken.sol smart contract. - * This contract controls operations minting & burning the native GHO token as well as facilitator management. - * https://github.com/aave/gho/blob/main/src/contracts/gho/GhoToken.sol - */ -export class GhoVariableDebtTokenService - extends BaseService - implements IGhoVariableDebtTokenService -{ - readonly ghoVariableDebtTokenAddress: string; - - constructor( - provider: providers.Provider, - ghoVariableDebtTokenAddress: string, - ) { - super(provider, GhoVariableDebtToken__factory); - this.ghoVariableDebtTokenAddress = ghoVariableDebtTokenAddress; - } - - /** - * Gets the discount token address tied the variable debt token (stkAAVE currently) - * @returns - A string representing the address for the deployed smart contract of the token - */ - public async getDiscountToken() { - const contract = this.getContractInstance(this.ghoVariableDebtTokenAddress); - const result = await contract.getDiscountToken(); - return result; - } - - /** - * Gets the current discount percent lock period - * @returns - A BigNumber representing the discount percent lock period, expressed in seconds - */ - public async getDiscountLockPeriod() { - const contract = this.getContractInstance(this.ghoVariableDebtTokenAddress); - const result = await contract.getDiscountLockPeriod(); - return result; - } - - /** - * Gets the discount percent being applied to the GHO debt interest for the provided user - * @param userAddress - The address for the given user to query for - * @returns - A BigNumber representing the user's discount percentage, expressed in bps - */ - public async getUserDiscountPercent(userAddress: string) { - const contract = this.getContractInstance(this.ghoVariableDebtTokenAddress); - const result = await contract.getDiscountPercent(userAddress); - return result; - } - - /** - * Gets the timestamp at which a user's discount percent can be rebalanced - * @param userAddress - The address of the user's rebalance timestamp being requested - * @returns - A BigNumber representing the time when a users discount percent can be rebalanced, expressed in seconds - */ - public async getUserRebalanceTimestamp(userAddress: string) { - const contract = this.getContractInstance(this.ghoVariableDebtTokenAddress); - const result = await contract.getUserRebalanceTimestamp(userAddress); - return result; - } - - /** - * Gets the discount rate strategy currently in use - * @returns - Address of current GhoDiscountRateStrategy - */ - public async getDiscountRateStrategy() { - const contract = this.getContractInstance(this.ghoVariableDebtTokenAddress); - const result = await contract.getDiscountRateStrategy(); - return result; - } -} diff --git a/packages/contract-helpers/src/gho/__tests__/GhoDiscountRateStrategyService.test.ts b/packages/contract-helpers/src/gho/__tests__/GhoDiscountRateStrategyService.test.ts deleted file mode 100644 index 826dc03b..00000000 --- a/packages/contract-helpers/src/gho/__tests__/GhoDiscountRateStrategyService.test.ts +++ /dev/null @@ -1,400 +0,0 @@ -import { constants, BigNumber, BigNumberish, providers } from 'ethers'; -import { valueToWei } from '../../commons/utils'; -import { GhoDiscountRateStrategyService } from '../GhoDiscountRateStrategyService'; -import { GhoDiscountRateStrategy } from '../typechain/GhoDiscountRateStrategy'; -import { GhoDiscountRateStrategy__factory } from '../typechain/GhoDiscountRateStrategy__factory'; -import { GhoVariableDebtToken } from '../typechain/GhoVariableDebtToken'; -import { GhoVariableDebtToken__factory } from '../typechain/GhoVariableDebtToken__factory'; - -jest.mock('../../commons/gasStation', () => { - return { - __esModule: true, - estimateGasByNetwork: jest - .fn() - .mockImplementation(async () => Promise.resolve(BigNumber.from(1))), - estimateGas: jest.fn(async () => Promise.resolve(BigNumber.from(1))), - }; -}); - -// Helper for contract call arguments -const convertToBN = (n: string) => valueToWei(n, 18); - -describe('GhoDiscountRateStrategyService', () => { - const GHO_VARIABLE_DEBT_TOKEN_ADDRESS = constants.AddressZero; - const correctProvider: providers.Provider = new providers.JsonRpcProvider(); - - // Mocking - jest - .spyOn(correctProvider, 'getGasPrice') - .mockImplementation(async () => Promise.resolve(BigNumber.from(1))); - - // Mock the response of GhoVariableDebtToken.getDiscountRateStrategy() - jest.spyOn(GhoVariableDebtToken__factory, 'connect').mockReturnValue({ - getDiscountRateStrategy: async () => Promise.resolve(constants.AddressZero), - } as unknown as GhoVariableDebtToken); - - afterEach(() => jest.clearAllMocks()); - - describe('Create new GhoDiscountRateStrategyService', () => { - it('Expects to be initialized correctly', () => { - // Create instance - const instance = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Assert it - expect(instance).toBeInstanceOf(GhoDiscountRateStrategyService); - }); - }); - - describe('getGhoDiscountedPerDiscountToken', () => { - it('should return the amount of GHO eligible to be discounted per one discount token', async () => { - // Create instance - const contract = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockGhoDiscountedPerDiscountToken = convertToBN('100'); - - // Mock it - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - GHO_DISCOUNTED_PER_DISCOUNT_TOKEN: async () => - Promise.resolve(mockGhoDiscountedPerDiscountToken), - } as unknown as GhoDiscountRateStrategy); - - // Call it - const result = await contract.getGhoDiscountedPerDiscountToken(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockGhoDiscountedPerDiscountToken); - }); - }); - - describe('getGhoDiscountRate', () => { - it('should return the current maximum discount rate against borrowing GHO, expressed in bps', async () => { - // Create instance - const contract = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockDiscountRate = convertToBN('2000'); // 20.00% - - // Mock it - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - DISCOUNT_RATE: async () => Promise.resolve(mockDiscountRate), - } as unknown as GhoDiscountRateStrategy); - - // Call it - const result = await contract.getGhoDiscountRate(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockDiscountRate); - }); - }); - - describe('getGhoMinDiscountTokenBalance', () => { - it('should return the minimum amount of discount tokens needed to be eligible for a discount', async () => { - // Create instance - const contract = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockMinDiscountTokenBalance = convertToBN('100'); - - // Mock it - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - MIN_DISCOUNT_TOKEN_BALANCE: async () => - Promise.resolve(mockMinDiscountTokenBalance), - } as unknown as GhoDiscountRateStrategy); - - // Call it - const result = await contract.getGhoMinDiscountTokenBalance(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockMinDiscountTokenBalance); - }); - }); - - describe('getGhoMinDebtTokenBalance', () => { - it('should return the minimum amount of debt tokens needed to be eligible for a discount', async () => { - // Create instance - const contract = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockMinDebtTokenBalance = convertToBN('100'); - - // Mock it - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - MIN_DEBT_TOKEN_BALANCE: async () => - Promise.resolve(mockMinDebtTokenBalance), - } as unknown as GhoDiscountRateStrategy); - - // Call it - const result = await contract.getGhoMinDebtTokenBalance(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockMinDebtTokenBalance); - }); - }); - - describe('calculateDiscountRate', () => { - it('should return zero discount if discount token balance does not meet minimum requirements to gain a discount', async () => { - // Create instance - const contract = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Use case - borrowing 100 GHO owning 0 skAAVE - const ghoDebtTokenBalance: BigNumberish = convertToBN('100'); - const stakedAaveBalance: BigNumberish = convertToBN('0'); - const expected = BigNumber.from('0'); // 0% - - // Mock it - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - calculateDiscountRate: async () => Promise.resolve(expected), - } as unknown as GhoDiscountRateStrategy); - - // Call it - const result = await contract.calculateDiscountRate( - ghoDebtTokenBalance, - stakedAaveBalance, - ); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(expected); - }); - - it('should return zero discount if GHO variable debt token balance does not meet minimum requirements to gain a discount', async () => { - // Create instance - const contract = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Use case - borrowing 0 GHO owning 1 skAAVE - const ghoDebtTokenBalance: BigNumberish = convertToBN('0'); - const stakedAaveBalance: BigNumberish = convertToBN('1'); - const expected = BigNumber.from('0'); // 0% - - // Mock it - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - calculateDiscountRate: async () => Promise.resolve(expected), - } as unknown as GhoDiscountRateStrategy); - - // Call it - const result = await contract.calculateDiscountRate( - ghoDebtTokenBalance, - stakedAaveBalance, - ); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(expected); - }); - - // Discounted balance = discount token * 100 - it('should return the maximum discount rate of 20% if the calculated total discounted balance is greater or equal to the debt token balance', async () => { - // Create instance - const contract = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Use case #1 - borrowing 100 GHO owning 1 stkAAVE - const ghoDebtTokenBalance: BigNumberish = convertToBN('100'); - let stakedAaveBalance: BigNumberish = convertToBN('1'); - const expected = BigNumber.from('2000'); // 20.00% discount - - // Mock it - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - calculateDiscountRate: async () => Promise.resolve(expected), - } as unknown as GhoDiscountRateStrategy); - - // Call it - let result = await contract.calculateDiscountRate( - ghoDebtTokenBalance, - stakedAaveBalance, - ); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(expected); - - // Use case #2 - borrowing 100 GHO owning 5 stkAAVE - stakedAaveBalance = convertToBN('5'); - - // Call it - result = await contract.calculateDiscountRate( - ghoDebtTokenBalance, - stakedAaveBalance, - ); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(expected); - }); - - it('should return a sub-maximum discount if user borrows more GHO than can be discounted based off of the discount token balance', async () => { - // Create instance - const contract = new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Use case - borrowing 150 GHO owning 1 skAAVE - const ghoDebtTokenBalance: BigNumberish = convertToBN('150'); - const stakedAaveBalance: BigNumberish = convertToBN('1'); - const expected = BigNumber.from('1333'); // 13.33% discount - - // Mock it - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - calculateDiscountRate: async () => Promise.resolve(expected), - } as unknown as GhoDiscountRateStrategy); - - // Call it - const result = await contract.calculateDiscountRate( - ghoDebtTokenBalance, - stakedAaveBalance, - ); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(expected); - }); - }); - describe('ghoDiscountRateStrategy update on ghoVariableDebtToken contract', () => { - it('should return discount based on the active strategy on the ghoVariableDebtToken', async () => { - // Create different mocked return values for the two discount rate strategies when given the same input - - // Constants - const ghoDiscountRateStrategyOne = - '0x0000000000000000000000000000000000000001'; - const ghoDiscountRateStrategyTwo = - '0x0000000000000000000000000000000000000002'; - const ghoDebtTokenBalance: BigNumberish = convertToBN('150'); - const stakedAaveBalance: BigNumberish = convertToBN('1'); - const expectedOne = BigNumber.from('1333'); // 13.33% discount - const expectedTwo = BigNumber.from('2000'); // 20% discount - - // Mock services - const ghoDiscountRateStrategyServiceOne = { - calculateDiscountRate: jest.fn(), - }; - ghoDiscountRateStrategyServiceOne.calculateDiscountRate.mockReturnValue( - Promise.resolve(expectedOne), - ); - const ghoDiscountRateStrategyServiceTwo = { - calculateDiscountRate: jest.fn(), - }; - ghoDiscountRateStrategyServiceTwo.calculateDiscountRate.mockReturnValue( - Promise.resolve(expectedTwo), - ); - - // Create a spy which will conditionally return the service based on the rate strategy address - const spy = jest - .spyOn(GhoDiscountRateStrategy__factory, 'connect') - .mockReturnValue({ - calculateDiscountRate: async () => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - const rateStrategyAddress = - await mockVariableDebtTokenService.getDiscountRateStrategy(); - if (rateStrategyAddress === ghoDiscountRateStrategyOne) { - return Promise.resolve( - ghoDiscountRateStrategyServiceOne.calculateDiscountRate(), - ); - } - - return Promise.resolve( - ghoDiscountRateStrategyServiceTwo.calculateDiscountRate(), - ); - }, - } as unknown as GhoDiscountRateStrategy); - - // Mock a variable debt service to return the first discount rate strategy - const mockVariableDebtTokenService = { - getDiscountRateStrategy: jest.fn(), - }; - - jest - .mocked(mockVariableDebtTokenService) - .getDiscountRateStrategy.mockResolvedValue( - Promise.resolve(ghoDiscountRateStrategyOne), - ); - - // Create a discount service which will be spied and trigger calls to ghoVariableDebtToken.getDiscountRateStrategy() -> ghoDiscountRateService.calculateDiscountRate() - const ghoDiscountRateStrategyServiceThree = - new GhoDiscountRateStrategyService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Call calculateDiscountRate with the first rate strategy - const resultOne = - await ghoDiscountRateStrategyServiceThree.calculateDiscountRate( - ghoDebtTokenBalance, - stakedAaveBalance, - ); - - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(resultOne).toEqual(expectedOne); - - // Simulates a ghoDiscountRateStrategy update - jest - .mocked(mockVariableDebtTokenService) - .getDiscountRateStrategy.mockResolvedValue( - Promise.resolve(ghoDiscountRateStrategyTwo), - ); - - // Call calculateDiscountRate with the updated rate strategy - const resultTwo = - await ghoDiscountRateStrategyServiceThree.calculateDiscountRate( - ghoDebtTokenBalance, - stakedAaveBalance, - ); - - expect(resultTwo).toEqual(expectedTwo); - }); - }); -}); diff --git a/packages/contract-helpers/src/gho/__tests__/GhoService.test.ts b/packages/contract-helpers/src/gho/__tests__/GhoService.test.ts index 5dad4413..72786e89 100644 --- a/packages/contract-helpers/src/gho/__tests__/GhoService.test.ts +++ b/packages/contract-helpers/src/gho/__tests__/GhoService.test.ts @@ -18,7 +18,7 @@ const ghoReserveDataMock: GhoReserveData = { }; const ghoUserDataMock: GhoUserData = { - userGhoDiscountRate: '0', + userGhoDiscountPercent: '0', userDiscountTokenBalance: '0', userGhoScaledBorrowBalance: '0', userPreviousGhoBorrowIndex: '0', diff --git a/packages/contract-helpers/src/gho/__tests__/GhoTokenService.test.ts b/packages/contract-helpers/src/gho/__tests__/GhoTokenService.test.ts deleted file mode 100644 index 6fb6ddde..00000000 --- a/packages/contract-helpers/src/gho/__tests__/GhoTokenService.test.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { constants, BigNumber, providers } from 'ethers'; -import { valueToWei } from '../../commons/utils'; -import { GhoTokenService } from '../GhoTokenService'; -import { GhoToken } from '../typechain/GhoToken'; -import { GhoToken__factory } from '../typechain/GhoToken__factory'; -import { IGhoToken } from '../typechain/IGhoToken'; - -jest.mock('../../commons/gasStation', () => { - return { - __esModule: true, - estimateGasByNetwork: jest - .fn() - .mockImplementation(async () => Promise.resolve(BigNumber.from(1))), - estimateGas: jest.fn(async () => Promise.resolve(BigNumber.from(1))), - }; -}); - -// Helper for contract call arguments -const convertToBN = (n: string) => valueToWei(n, 18); - -describe('GhoTokenService', () => { - const GHO_TOKEN_ADDRESS = constants.AddressZero; - const correctProvider: providers.Provider = new providers.JsonRpcProvider(); - - // Mocking - jest - .spyOn(correctProvider, 'getGasPrice') - .mockImplementation(async () => Promise.resolve(BigNumber.from(1))); - - afterEach(() => jest.clearAllMocks()); - - describe('Create new GhoTokenService', () => { - it('Expects to be initialized correctly', () => { - // Create Instance - const instance = new GhoTokenService(correctProvider, GHO_TOKEN_ADDRESS); - - // Assert it - expect(instance).toBeInstanceOf(GhoTokenService); - }); - }); - - describe('totalSupply', () => { - it('should return the total supply of GHO tokens', async () => { - // Create Instance - const contract = new GhoTokenService(correctProvider, GHO_TOKEN_ADDRESS); - - // Setup - const mockTotalSupply = convertToBN('10000000'); // 10M - - // Mock it - const spy = jest.spyOn(GhoToken__factory, 'connect').mockReturnValue({ - totalSupply: async () => Promise.resolve(mockTotalSupply), - } as unknown as GhoToken); - - // Call it - const result = await contract.totalSupply(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockTotalSupply); - }); - }); - - describe('getFacilitatorsList', () => { - it('should return the list of facilitators as an array of addresses', async () => { - // Create instance - const contract = new GhoTokenService(correctProvider, GHO_TOKEN_ADDRESS); - - // Setup - const faciliatorAddress1: string = constants.AddressZero; - const faciliatorAddress2: string = constants.AddressZero; - const mockFacilitatorsList: string[] = [ - faciliatorAddress1, - faciliatorAddress2, - ]; - - // Mock it - const spy = jest.spyOn(GhoToken__factory, 'connect').mockReturnValue({ - getFacilitatorsList: async () => Promise.resolve(mockFacilitatorsList), - } as unknown as GhoToken); - - // Call it - const result = await contract.getFacilitatorsList(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockFacilitatorsList); - }); - }); - - describe('getFacilitator', () => { - it('should return the facilitator instance for the provided facilitator address', async () => { - // Create instance - const contract = new GhoTokenService(correctProvider, GHO_TOKEN_ADDRESS); - - // Setup - const faciliatorAddress: string = constants.AddressZero; - const mockBucket: IGhoToken.BucketStruct = { - maxCapacity: convertToBN('1000'), - level: convertToBN('500'), - }; - const mockFacilitator: IGhoToken.FacilitatorStruct = { - bucket: mockBucket, - label: 'Aave Facilitator', - }; - - // Mock it - const spy = jest.spyOn(GhoToken__factory, 'connect').mockReturnValue({ - getFacilitator: async () => Promise.resolve(mockFacilitator), - } as unknown as GhoToken); - - // Call it - const result = await contract.getFacilitator(faciliatorAddress); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockFacilitator); - }); - }); - - describe('getFacilitatorBucket', () => { - it('should return the bucket instance for the provided facilitator address', async () => { - // Create instance - const contract = new GhoTokenService(correctProvider, GHO_TOKEN_ADDRESS); - - // Setup - const faciliatorAddress: string = constants.AddressZero; - const mockBucket: IGhoToken.BucketStruct = { - maxCapacity: convertToBN('1000'), - level: convertToBN('500'), - }; - - // Mock it - const spy = jest.spyOn(GhoToken__factory, 'connect').mockReturnValue({ - getFacilitatorBucket: async () => Promise.resolve(mockBucket), - } as unknown as GhoToken); - - // Call it - const result = await contract.getFacilitatorBucket(faciliatorAddress); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockBucket); - }); - }); -}); diff --git a/packages/contract-helpers/src/gho/__tests__/GhoVariableDebtTokenService.test.ts b/packages/contract-helpers/src/gho/__tests__/GhoVariableDebtTokenService.test.ts deleted file mode 100644 index f54a1f7b..00000000 --- a/packages/contract-helpers/src/gho/__tests__/GhoVariableDebtTokenService.test.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { constants, BigNumber, providers } from 'ethers'; -import { valueToWei } from '../../commons/utils'; -import { GhoVariableDebtTokenService } from '../GhoVariableDebtTokenService'; -import { GhoVariableDebtToken } from '../typechain/GhoVariableDebtToken'; -import { GhoVariableDebtToken__factory } from '../typechain/GhoVariableDebtToken__factory'; - -jest.mock('../../commons/gasStation', () => { - return { - __esModule: true, - estimateGasByNetwork: jest - .fn() - .mockImplementation(async () => Promise.resolve(BigNumber.from(1))), - estimateGas: jest.fn(async () => Promise.resolve(BigNumber.from(1))), - }; -}); - -// Helper for contract call arguments -const convertToBN = (n: string) => valueToWei(n, 18); - -describe('GhoVariableDebtTokenService', () => { - const GHO_VARIABLE_DEBT_TOKEN_ADDRESS = constants.AddressZero; - const correctProvider: providers.Provider = new providers.JsonRpcProvider(); - - // Mocking - jest - .spyOn(correctProvider, 'getGasPrice') - .mockImplementation(async () => Promise.resolve(BigNumber.from(1))); - - afterEach(() => jest.clearAllMocks()); - - describe('Create new GhoVariableDebtTokenService', () => { - it('Expects to be initialized correctly', () => { - // Create Instance - const instance = new GhoVariableDebtTokenService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Assert it - expect(instance).toBeInstanceOf(GhoVariableDebtTokenService); - }); - }); - - describe('getDiscountToken', () => { - it('should return the address of the current discount token', async () => { - // Create Instance - const contract = new GhoVariableDebtTokenService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockDiscountTokenAddress = constants.AddressZero; - - // Mock it - const spy = jest - .spyOn(GhoVariableDebtToken__factory, 'connect') - .mockReturnValue({ - getDiscountToken: async () => - Promise.resolve(mockDiscountTokenAddress), - } as unknown as GhoVariableDebtToken); - - // Call it - const result = await contract.getDiscountToken(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockDiscountTokenAddress); - }); - }); - - describe('getDiscountLockPeriod', () => { - it('should return the current discount percent lock period', async () => { - // Create instance - const contract = new GhoVariableDebtTokenService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockDiscountLockPeriod = convertToBN('123456789'); - - // Mock it - const spy = jest - .spyOn(GhoVariableDebtToken__factory, 'connect') - .mockReturnValue({ - getDiscountLockPeriod: async () => - Promise.resolve(mockDiscountLockPeriod), - } as unknown as GhoVariableDebtToken); - - // Call it - const result = await contract.getDiscountLockPeriod(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockDiscountLockPeriod); - }); - }); - - describe('getUserDiscountPercent', () => { - it("should return the user's current discount percentage for their borrowed GHO", async () => { - // Create instance - const contract = new GhoVariableDebtTokenService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockUserAddress = constants.AddressZero; - const mockUserDiscountPercent = convertToBN('2000'); // 20.00% - - // Mock it - const spy = jest - .spyOn(GhoVariableDebtToken__factory, 'connect') - .mockReturnValue({ - getDiscountPercent: async () => - Promise.resolve(mockUserDiscountPercent), - } as unknown as GhoVariableDebtToken); - - // Call it - const result = await contract.getUserDiscountPercent(mockUserAddress); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockUserDiscountPercent); - }); - }); - - describe('getUserRebalanceTimestamp', () => { - it("should return the timestamp when a user's discount percent can be rebalanced", async () => { - // Create instance - const contract = new GhoVariableDebtTokenService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockUserAddress = constants.AddressZero; - const mockUserRebalanceTimestamp = convertToBN('123456789'); - - // Mock it - const spy = jest - .spyOn(GhoVariableDebtToken__factory, 'connect') - .mockReturnValue({ - getUserRebalanceTimestamp: async () => - Promise.resolve(mockUserRebalanceTimestamp), - } as unknown as GhoVariableDebtToken); - - // Call it - const result = await contract.getUserRebalanceTimestamp(mockUserAddress); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockUserRebalanceTimestamp); - }); - }); - - describe('getDiscountRateStrategy', () => { - it('should return the current discount rate strategy address', async () => { - // Create instance - const contract = new GhoVariableDebtTokenService( - correctProvider, - GHO_VARIABLE_DEBT_TOKEN_ADDRESS, - ); - - // Setup - const mockDiscountRateStrategy = constants.AddressZero; - - // Mock it - const spy = jest - .spyOn(GhoVariableDebtToken__factory, 'connect') - .mockReturnValue({ - getDiscountRateStrategy: async () => - Promise.resolve(mockDiscountRateStrategy), - } as unknown as GhoVariableDebtToken); - - // Call it - const result = await contract.getDiscountRateStrategy(); - - // Assert it - expect(spy).toHaveBeenCalled(); - expect(spy).toBeCalledTimes(1); - expect(result).toEqual(mockDiscountRateStrategy); - }); - }); -}); diff --git a/packages/contract-helpers/src/gho/typechain/GhoDiscountRateStrategy.d.ts b/packages/contract-helpers/src/gho/typechain/GhoDiscountRateStrategy.d.ts deleted file mode 100644 index 2c31e633..00000000 --- a/packages/contract-helpers/src/gho/typechain/GhoDiscountRateStrategy.d.ts +++ /dev/null @@ -1,224 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { FunctionFragment, Result } from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, -} from '../../../../../common'; - -export interface GhoDiscountRateStrategyInterface extends utils.Interface { - functions: { - 'DISCOUNT_RATE()': FunctionFragment; - 'DISCOUNT_TOKEN()': FunctionFragment; - 'GHO_DISCOUNTED_PER_DISCOUNT_TOKEN()': FunctionFragment; - 'MIN_DEBT_TOKEN_BALANCE()': FunctionFragment; - 'MIN_DISCOUNT_TOKEN_BALANCE()': FunctionFragment; - 'calculateDiscountRate(uint256,uint256)': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'DISCOUNT_RATE' - | 'DISCOUNT_TOKEN' - | 'GHO_DISCOUNTED_PER_DISCOUNT_TOKEN' - | 'MIN_DEBT_TOKEN_BALANCE' - | 'MIN_DISCOUNT_TOKEN_BALANCE' - | 'calculateDiscountRate', - ): FunctionFragment; - - encodeFunctionData( - functionFragment: 'DISCOUNT_RATE', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'DISCOUNT_TOKEN', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'GHO_DISCOUNTED_PER_DISCOUNT_TOKEN', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'MIN_DEBT_TOKEN_BALANCE', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'MIN_DISCOUNT_TOKEN_BALANCE', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'calculateDiscountRate', - values: [BigNumberish, BigNumberish], - ): string; - - decodeFunctionResult( - functionFragment: 'DISCOUNT_RATE', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'DISCOUNT_TOKEN', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'GHO_DISCOUNTED_PER_DISCOUNT_TOKEN', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'MIN_DEBT_TOKEN_BALANCE', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'MIN_DISCOUNT_TOKEN_BALANCE', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'calculateDiscountRate', - data: BytesLike, - ): Result; - - events: {}; -} - -export interface GhoDiscountRateStrategy extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: GhoDiscountRateStrategyInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter, - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter, - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - DISCOUNT_RATE(overrides?: CallOverrides): Promise<[BigNumber]>; - - DISCOUNT_TOKEN(overrides?: CallOverrides): Promise<[string]>; - - GHO_DISCOUNTED_PER_DISCOUNT_TOKEN( - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - MIN_DEBT_TOKEN_BALANCE(overrides?: CallOverrides): Promise<[BigNumber]>; - - MIN_DISCOUNT_TOKEN_BALANCE(overrides?: CallOverrides): Promise<[BigNumber]>; - - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - }; - - DISCOUNT_RATE(overrides?: CallOverrides): Promise; - - DISCOUNT_TOKEN(overrides?: CallOverrides): Promise; - - GHO_DISCOUNTED_PER_DISCOUNT_TOKEN( - overrides?: CallOverrides, - ): Promise; - - MIN_DEBT_TOKEN_BALANCE(overrides?: CallOverrides): Promise; - - MIN_DISCOUNT_TOKEN_BALANCE(overrides?: CallOverrides): Promise; - - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - callStatic: { - DISCOUNT_RATE(overrides?: CallOverrides): Promise; - - DISCOUNT_TOKEN(overrides?: CallOverrides): Promise; - - GHO_DISCOUNTED_PER_DISCOUNT_TOKEN( - overrides?: CallOverrides, - ): Promise; - - MIN_DEBT_TOKEN_BALANCE(overrides?: CallOverrides): Promise; - - MIN_DISCOUNT_TOKEN_BALANCE(overrides?: CallOverrides): Promise; - - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise; - }; - - filters: {}; - - estimateGas: { - DISCOUNT_RATE(overrides?: CallOverrides): Promise; - - DISCOUNT_TOKEN(overrides?: CallOverrides): Promise; - - GHO_DISCOUNTED_PER_DISCOUNT_TOKEN( - overrides?: CallOverrides, - ): Promise; - - MIN_DEBT_TOKEN_BALANCE(overrides?: CallOverrides): Promise; - - MIN_DISCOUNT_TOKEN_BALANCE(overrides?: CallOverrides): Promise; - - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise; - }; - - populateTransaction: { - DISCOUNT_RATE(overrides?: CallOverrides): Promise; - - DISCOUNT_TOKEN(overrides?: CallOverrides): Promise; - - GHO_DISCOUNTED_PER_DISCOUNT_TOKEN( - overrides?: CallOverrides, - ): Promise; - - MIN_DEBT_TOKEN_BALANCE( - overrides?: CallOverrides, - ): Promise; - - MIN_DISCOUNT_TOKEN_BALANCE( - overrides?: CallOverrides, - ): Promise; - - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/gho/typechain/GhoDiscountRateStrategy__factory.ts b/packages/contract-helpers/src/gho/typechain/GhoDiscountRateStrategy__factory.ts deleted file mode 100644 index d3f358ad..00000000 --- a/packages/contract-helpers/src/gho/typechain/GhoDiscountRateStrategy__factory.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; -import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { - GhoDiscountRateStrategy, - GhoDiscountRateStrategyInterface, -} from "./GhoDiscountRateStrategy"; - -const _abi = [ - { - inputs: [], - name: "DISCOUNT_RATE", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "DISCOUNT_TOKEN", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "GHO_DISCOUNTED_PER_DISCOUNT_TOKEN", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "MIN_DEBT_TOKEN_BALANCE", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "MIN_DISCOUNT_TOKEN_BALANCE", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "debtBalance", - type: "uint256", - }, - { - internalType: "uint256", - name: "discountTokenBalance", - type: "uint256", - }, - ], - name: "calculateDiscountRate", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -]; - -const _bytecode = - "0x608060405234801561001057600080fd5b506102c1806100206000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c806393adbec51161005057806393adbec5146100e957806398c4f438146100bc578063b510c589146100fc57600080fd5b80631fd5c9e9146100775780633454274e146100bc578063771a73af146100d9575b600080fd5b610092734da27a545c0c5b758a6ba100e3a049001de870f581565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100cb670de0b6b3a764000081565b6040519081526020016100b3565b6100cb68056bc75e2d6310000081565b6100cb6100f73660046101ca565b610105565b6100cb6107d081565b6000670de0b6b3a76400008210806101245750670de0b6b3a764000083105b1561013157506000610175565b60006101468368056bc75e2d6310000061017b565b905083811061015a576107d0915050610175565b836101676107d0836101ec565b6101719190610250565b9150505b92915050565b600081157ffffffffffffffffffffffffffffffffffffffffffffffffff90fa4a62c4dffff839004841115176101b057600080fd5b50670de0b6b3a764000091026706f05b59d3b20000010490565b600080604083850312156101dd57600080fd5b50508035926020909101359150565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561024b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500290565b600082610286577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50049056fea26469706673582212206bbf29bf6be38a8be7683b6b85fad0e89ba775122d079836285e8ed847f2d92564736f6c634300080a0033"; - -type GhoDiscountRateStrategyConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: GhoDiscountRateStrategyConstructorParams -): xs is ConstructorParameters => xs.length > 1; - -export class GhoDiscountRateStrategy__factory extends ContractFactory { - constructor(...args: GhoDiscountRateStrategyConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override deploy( - overrides?: Overrides & { from?: string | Promise } - ): Promise { - return super.deploy(overrides || {}) as Promise; - } - override getDeployTransaction( - overrides?: Overrides & { from?: string | Promise } - ): TransactionRequest { - return super.getDeployTransaction(overrides || {}); - } - override attach(address: string): GhoDiscountRateStrategy { - return super.attach(address) as GhoDiscountRateStrategy; - } - override connect(signer: Signer): GhoDiscountRateStrategy__factory { - return super.connect(signer) as GhoDiscountRateStrategy__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): GhoDiscountRateStrategyInterface { - return new utils.Interface(_abi) as GhoDiscountRateStrategyInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): GhoDiscountRateStrategy { - return new Contract( - address, - _abi, - signerOrProvider - ) as GhoDiscountRateStrategy; - } -} diff --git a/packages/contract-helpers/src/gho/typechain/GhoToken.d.ts b/packages/contract-helpers/src/gho/typechain/GhoToken.d.ts deleted file mode 100644 index 5c745b78..00000000 --- a/packages/contract-helpers/src/gho/typechain/GhoToken.d.ts +++ /dev/null @@ -1,979 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { - FunctionFragment, - Result, - EventFragment, -} from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, -} from '../../../common'; - -export declare namespace IGhoToken { - export type BucketStruct = { maxCapacity: BigNumberish; level: BigNumberish }; - - export type BucketStructOutput = [BigNumber, BigNumber] & { - maxCapacity: BigNumber; - level: BigNumber; - }; - - export type FacilitatorStruct = { - bucket: IGhoToken.BucketStruct; - label: string; - }; - - export type FacilitatorStructOutput = [ - IGhoToken.BucketStructOutput, - string, - ] & { bucket: IGhoToken.BucketStructOutput; label: string }; -} - -export interface GhoTokenInterface extends utils.Interface { - functions: { - 'DOMAIN_SEPARATOR()': FunctionFragment; - 'PERMIT_TYPEHASH()': FunctionFragment; - 'addFacilitators(address[],((uint128,uint128),string)[])': FunctionFragment; - 'allowance(address,address)': FunctionFragment; - 'approve(address,uint256)': FunctionFragment; - 'balanceOf(address)': FunctionFragment; - 'burn(uint256)': FunctionFragment; - 'decimals()': FunctionFragment; - 'getFacilitator(address)': FunctionFragment; - 'getFacilitatorBucket(address)': FunctionFragment; - 'getFacilitatorsList()': FunctionFragment; - 'mint(address,uint256)': FunctionFragment; - 'name()': FunctionFragment; - 'nonces(address)': FunctionFragment; - 'owner()': FunctionFragment; - 'permit(address,address,uint256,uint256,uint8,bytes32,bytes32)': FunctionFragment; - 'removeFacilitators(address[])': FunctionFragment; - 'renounceOwnership()': FunctionFragment; - 'setFacilitatorBucketCapacity(address,uint128)': FunctionFragment; - 'symbol()': FunctionFragment; - 'totalSupply()': FunctionFragment; - 'transfer(address,uint256)': FunctionFragment; - 'transferFrom(address,address,uint256)': FunctionFragment; - 'transferOwnership(address)': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'DOMAIN_SEPARATOR' - | 'PERMIT_TYPEHASH' - | 'addFacilitators' - | 'allowance' - | 'approve' - | 'balanceOf' - | 'burn' - | 'decimals' - | 'getFacilitator' - | 'getFacilitatorBucket' - | 'getFacilitatorsList' - | 'mint' - | 'name' - | 'nonces' - | 'owner' - | 'permit' - | 'removeFacilitators' - | 'renounceOwnership' - | 'setFacilitatorBucketCapacity' - | 'symbol' - | 'totalSupply' - | 'transfer' - | 'transferFrom' - | 'transferOwnership', - ): FunctionFragment; - - encodeFunctionData( - functionFragment: 'DOMAIN_SEPARATOR', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'PERMIT_TYPEHASH', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'addFacilitators', - values: [string[], IGhoToken.FacilitatorStruct[]], - ): string; - encodeFunctionData( - functionFragment: 'allowance', - values: [string, string], - ): string; - encodeFunctionData( - functionFragment: 'approve', - values: [string, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'balanceOf', values: [string]): string; - encodeFunctionData(functionFragment: 'burn', values: [BigNumberish]): string; - encodeFunctionData(functionFragment: 'decimals', values?: undefined): string; - encodeFunctionData( - functionFragment: 'getFacilitator', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getFacilitatorBucket', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getFacilitatorsList', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'mint', - values: [string, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'name', values?: undefined): string; - encodeFunctionData(functionFragment: 'nonces', values: [string]): string; - encodeFunctionData(functionFragment: 'owner', values?: undefined): string; - encodeFunctionData( - functionFragment: 'permit', - values: [ - string, - string, - BigNumberish, - BigNumberish, - BigNumberish, - BytesLike, - BytesLike, - ], - ): string; - encodeFunctionData( - functionFragment: 'removeFacilitators', - values: [string[]], - ): string; - encodeFunctionData( - functionFragment: 'renounceOwnership', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'setFacilitatorBucketCapacity', - values: [string, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'symbol', values?: undefined): string; - encodeFunctionData( - functionFragment: 'totalSupply', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'transfer', - values: [string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'transferFrom', - values: [string, string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'transferOwnership', - values: [string], - ): string; - - decodeFunctionResult( - functionFragment: 'DOMAIN_SEPARATOR', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'PERMIT_TYPEHASH', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'addFacilitators', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'allowance', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'approve', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'balanceOf', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'burn', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'decimals', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'getFacilitator', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getFacilitatorBucket', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getFacilitatorsList', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'mint', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'name', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'nonces', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'owner', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'permit', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'removeFacilitators', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'renounceOwnership', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'setFacilitatorBucketCapacity', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'symbol', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'totalSupply', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'transfer', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'transferFrom', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'transferOwnership', - data: BytesLike, - ): Result; - - events: { - 'Approval(address,address,uint256)': EventFragment; - 'BucketLevelChanged(address,uint256,uint256)': EventFragment; - 'FacilitatorAdded(address,string,uint256)': EventFragment; - 'FacilitatorBucketCapacityUpdated(address,uint256,uint256)': EventFragment; - 'FacilitatorRemoved(address)': EventFragment; - 'OwnershipTransferred(address,address)': EventFragment; - 'Transfer(address,address,uint256)': EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: 'Approval'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'BucketLevelChanged'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'FacilitatorAdded'): EventFragment; - getEvent( - nameOrSignatureOrTopic: 'FacilitatorBucketCapacityUpdated', - ): EventFragment; - getEvent(nameOrSignatureOrTopic: 'FacilitatorRemoved'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'OwnershipTransferred'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Transfer'): EventFragment; -} - -export interface ApprovalEventObject { - owner: string; - spender: string; - amount: BigNumber; -} -export type ApprovalEvent = TypedEvent< - [string, string, BigNumber], - ApprovalEventObject ->; - -export type ApprovalEventFilter = TypedEventFilter; - -export interface BucketLevelChangedEventObject { - facilitatorAaddress: string; - oldLevel: BigNumber; - newLevel: BigNumber; -} -export type BucketLevelChangedEvent = TypedEvent< - [string, BigNumber, BigNumber], - BucketLevelChangedEventObject ->; - -export type BucketLevelChangedEventFilter = - TypedEventFilter; - -export interface FacilitatorAddedEventObject { - facilitatorAddress: string; - label: string; - initialBucketCapacity: BigNumber; -} -export type FacilitatorAddedEvent = TypedEvent< - [string, string, BigNumber], - FacilitatorAddedEventObject ->; - -export type FacilitatorAddedEventFilter = - TypedEventFilter; - -export interface FacilitatorBucketCapacityUpdatedEventObject { - facilitatorAaddress: string; - oldCapacity: BigNumber; - newCapacity: BigNumber; -} -export type FacilitatorBucketCapacityUpdatedEvent = TypedEvent< - [string, BigNumber, BigNumber], - FacilitatorBucketCapacityUpdatedEventObject ->; - -export type FacilitatorBucketCapacityUpdatedEventFilter = - TypedEventFilter; - -export interface FacilitatorRemovedEventObject { - facilitatorAddress: string; -} -export type FacilitatorRemovedEvent = TypedEvent< - [string], - FacilitatorRemovedEventObject ->; - -export type FacilitatorRemovedEventFilter = - TypedEventFilter; - -export interface OwnershipTransferredEventObject { - previousOwner: string; - newOwner: string; -} -export type OwnershipTransferredEvent = TypedEvent< - [string, string], - OwnershipTransferredEventObject ->; - -export type OwnershipTransferredEventFilter = - TypedEventFilter; - -export interface TransferEventObject { - from: string; - to: string; - amount: BigNumber; -} -export type TransferEvent = TypedEvent< - [string, string, BigNumber], - TransferEventObject ->; - -export type TransferEventFilter = TypedEventFilter; - -export interface GhoToken extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: GhoTokenInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter, - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter, - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<[string]>; - - PERMIT_TYPEHASH(overrides?: CallOverrides): Promise<[string]>; - - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - approve( - spender: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - balanceOf(arg0: string, overrides?: CallOverrides): Promise<[BigNumber]>; - - burn( - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decimals(overrides?: CallOverrides): Promise<[number]>; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise<[IGhoToken.FacilitatorStructOutput]>; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise<[IGhoToken.BucketStructOutput]>; - - getFacilitatorsList(overrides?: CallOverrides): Promise<[string[]]>; - - mint( - account: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - name(overrides?: CallOverrides): Promise<[string]>; - - nonces(arg0: string, overrides?: CallOverrides): Promise<[BigNumber]>; - - owner(overrides?: CallOverrides): Promise<[string]>; - - permit( - owner: string, - spender: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - renounceOwnership( - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - symbol(overrides?: CallOverrides): Promise<[string]>; - - totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; - - transfer( - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferFrom( - from: string, - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; - - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise; - - PERMIT_TYPEHASH(overrides?: CallOverrides): Promise; - - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise; - - approve( - spender: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - balanceOf(arg0: string, overrides?: CallOverrides): Promise; - - burn( - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decimals(overrides?: CallOverrides): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorsList(overrides?: CallOverrides): Promise; - - mint( - account: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - name(overrides?: CallOverrides): Promise; - - nonces(arg0: string, overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - permit( - owner: string, - spender: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - renounceOwnership( - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - symbol(overrides?: CallOverrides): Promise; - - totalSupply(overrides?: CallOverrides): Promise; - - transfer( - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferFrom( - from: string, - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - callStatic: { - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise; - - PERMIT_TYPEHASH(overrides?: CallOverrides): Promise; - - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: CallOverrides, - ): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise; - - approve( - spender: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - balanceOf(arg0: string, overrides?: CallOverrides): Promise; - - burn(amount: BigNumberish, overrides?: CallOverrides): Promise; - - decimals(overrides?: CallOverrides): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorsList(overrides?: CallOverrides): Promise; - - mint( - account: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - name(overrides?: CallOverrides): Promise; - - nonces(arg0: string, overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - permit( - owner: string, - spender: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: CallOverrides, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: CallOverrides, - ): Promise; - - renounceOwnership(overrides?: CallOverrides): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - symbol(overrides?: CallOverrides): Promise; - - totalSupply(overrides?: CallOverrides): Promise; - - transfer( - to: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - transferFrom( - from: string, - to: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: CallOverrides, - ): Promise; - }; - - filters: { - 'Approval(address,address,uint256)'( - owner?: string | null, - spender?: string | null, - amount?: null, - ): ApprovalEventFilter; - Approval( - owner?: string | null, - spender?: string | null, - amount?: null, - ): ApprovalEventFilter; - - 'BucketLevelChanged(address,uint256,uint256)'( - facilitatorAaddress?: string | null, - oldLevel?: null, - newLevel?: null, - ): BucketLevelChangedEventFilter; - BucketLevelChanged( - facilitatorAaddress?: string | null, - oldLevel?: null, - newLevel?: null, - ): BucketLevelChangedEventFilter; - - 'FacilitatorAdded(address,string,uint256)'( - facilitatorAddress?: string | null, - label?: string | null, - initialBucketCapacity?: null, - ): FacilitatorAddedEventFilter; - FacilitatorAdded( - facilitatorAddress?: string | null, - label?: string | null, - initialBucketCapacity?: null, - ): FacilitatorAddedEventFilter; - - 'FacilitatorBucketCapacityUpdated(address,uint256,uint256)'( - facilitatorAaddress?: string | null, - oldCapacity?: null, - newCapacity?: null, - ): FacilitatorBucketCapacityUpdatedEventFilter; - FacilitatorBucketCapacityUpdated( - facilitatorAaddress?: string | null, - oldCapacity?: null, - newCapacity?: null, - ): FacilitatorBucketCapacityUpdatedEventFilter; - - 'FacilitatorRemoved(address)'( - facilitatorAddress?: string | null, - ): FacilitatorRemovedEventFilter; - FacilitatorRemoved( - facilitatorAddress?: string | null, - ): FacilitatorRemovedEventFilter; - - 'OwnershipTransferred(address,address)'( - previousOwner?: string | null, - newOwner?: string | null, - ): OwnershipTransferredEventFilter; - OwnershipTransferred( - previousOwner?: string | null, - newOwner?: string | null, - ): OwnershipTransferredEventFilter; - - 'Transfer(address,address,uint256)'( - from?: string | null, - to?: string | null, - amount?: null, - ): TransferEventFilter; - Transfer( - from?: string | null, - to?: string | null, - amount?: null, - ): TransferEventFilter; - }; - - estimateGas: { - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise; - - PERMIT_TYPEHASH(overrides?: CallOverrides): Promise; - - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise; - - approve( - spender: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - balanceOf(arg0: string, overrides?: CallOverrides): Promise; - - burn( - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decimals(overrides?: CallOverrides): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorsList(overrides?: CallOverrides): Promise; - - mint( - account: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - name(overrides?: CallOverrides): Promise; - - nonces(arg0: string, overrides?: CallOverrides): Promise; - - owner(overrides?: CallOverrides): Promise; - - permit( - owner: string, - spender: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - renounceOwnership( - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - symbol(overrides?: CallOverrides): Promise; - - totalSupply(overrides?: CallOverrides): Promise; - - transfer( - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferFrom( - from: string, - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; - - populateTransaction: { - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise; - - PERMIT_TYPEHASH(overrides?: CallOverrides): Promise; - - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise; - - approve( - spender: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - balanceOf( - arg0: string, - overrides?: CallOverrides, - ): Promise; - - burn( - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decimals(overrides?: CallOverrides): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorsList( - overrides?: CallOverrides, - ): Promise; - - mint( - account: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - name(overrides?: CallOverrides): Promise; - - nonces( - arg0: string, - overrides?: CallOverrides, - ): Promise; - - owner(overrides?: CallOverrides): Promise; - - permit( - owner: string, - spender: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - renounceOwnership( - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - symbol(overrides?: CallOverrides): Promise; - - totalSupply(overrides?: CallOverrides): Promise; - - transfer( - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferFrom( - from: string, - to: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferOwnership( - newOwner: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/gho/typechain/GhoToken__factory.ts b/packages/contract-helpers/src/gho/typechain/GhoToken__factory.ts deleted file mode 100644 index 773ef110..00000000 --- a/packages/contract-helpers/src/gho/typechain/GhoToken__factory.ts +++ /dev/null @@ -1,751 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import { Signer, utils, Contract, ContractFactory, Overrides } from 'ethers'; -import type { Provider, TransactionRequest } from '@ethersproject/providers'; -import type { GhoToken, GhoTokenInterface, IGhoToken } from './GhoToken'; - -const _abi = [ - { - inputs: [ - { - internalType: 'address[]', - name: 'facilitatorsAddresses', - type: 'address[]', - }, - { - components: [ - { - components: [ - { - internalType: 'uint128', - name: 'maxCapacity', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'level', - type: 'uint128', - }, - ], - internalType: 'struct IGhoToken.Bucket', - name: 'bucket', - type: 'tuple', - }, - { - internalType: 'string', - name: 'label', - type: 'string', - }, - ], - internalType: 'struct IGhoToken.Facilitator[]', - name: 'facilitatorsConfig', - type: 'tuple[]', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Approval', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'facilitatorAaddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'oldLevel', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newLevel', - type: 'uint256', - }, - ], - name: 'BucketLevelChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'facilitatorAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'string', - name: 'label', - type: 'string', - }, - { - indexed: false, - internalType: 'uint256', - name: 'initialBucketCapacity', - type: 'uint256', - }, - ], - name: 'FacilitatorAdded', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'facilitatorAaddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'oldCapacity', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newCapacity', - type: 'uint256', - }, - ], - name: 'FacilitatorBucketCapacityUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'facilitatorAddress', - type: 'address', - }, - ], - name: 'FacilitatorRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Transfer', - type: 'event', - }, - { - inputs: [], - name: 'DOMAIN_SEPARATOR', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'PERMIT_TYPEHASH', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address[]', - name: 'facilitatorsAddresses', - type: 'address[]', - }, - { - components: [ - { - components: [ - { - internalType: 'uint128', - name: 'maxCapacity', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'level', - type: 'uint128', - }, - ], - internalType: 'struct IGhoToken.Bucket', - name: 'bucket', - type: 'tuple', - }, - { - internalType: 'string', - name: 'label', - type: 'string', - }, - ], - internalType: 'struct IGhoToken.Facilitator[]', - name: 'facilitatorsConfig', - type: 'tuple[]', - }, - ], - name: 'addFacilitators', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - name: 'allowance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'approve', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'burn', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'decimals', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'facilitator', - type: 'address', - }, - ], - name: 'getFacilitator', - outputs: [ - { - components: [ - { - components: [ - { - internalType: 'uint128', - name: 'maxCapacity', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'level', - type: 'uint128', - }, - ], - internalType: 'struct IGhoToken.Bucket', - name: 'bucket', - type: 'tuple', - }, - { - internalType: 'string', - name: 'label', - type: 'string', - }, - ], - internalType: 'struct IGhoToken.Facilitator', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'facilitator', - type: 'address', - }, - ], - name: 'getFacilitatorBucket', - outputs: [ - { - components: [ - { - internalType: 'uint128', - name: 'maxCapacity', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'level', - type: 'uint128', - }, - ], - internalType: 'struct IGhoToken.Bucket', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getFacilitatorsList', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'mint', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'name', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - name: 'nonces', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'uint8', - name: 'v', - type: 'uint8', - }, - { - internalType: 'bytes32', - name: 'r', - type: 'bytes32', - }, - { - internalType: 'bytes32', - name: 's', - type: 'bytes32', - }, - ], - name: 'permit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address[]', - name: 'facilitators', - type: 'address[]', - }, - ], - name: 'removeFacilitators', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'renounceOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'facilitator', - type: 'address', - }, - { - internalType: 'uint128', - name: 'newCapacity', - type: 'uint128', - }, - ], - name: 'setFacilitatorBucketCapacity', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'symbol', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'totalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'transfer', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -]; - -const _bytecode = - '0x60e06040523480156200001157600080fd5b5060405162002fcb38038062002fcb8339810160408190526200003491620007d2565b604080518082018252600981526823b437902a37b5b2b760b91b60208083019182528351808501909452600384526247484f60e81b908401528151919291601291620000849160009190620004c0565b5081516200009a906001906020850190620004c0565b5060ff81166080524660a052620000b0620000d7565b60c05250620000c3915033905062000173565b620000cf8282620001c5565b5050620009c5565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516200010b9190620008ed565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80518251146200020c5760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d253941555609a1b60448201526064015b60405180910390fd5b60005b81518110156200026c576200026383828151811062000232576200023262000991565b60200260200101518383815181106200024f576200024f62000991565b60200260200101516200027160201b60201c565b6001016200020f565b505050565b6001600160a01b03821660009081526007602052604090206001810180546200029a90620008b0565b159050620002eb5760405162461bcd60e51b815260206004820152601a60248201527f464143494c495441544f525f414c52454144595f455849535453000000000000604482015260640162000203565b600082602001515111620003325760405162461bcd60e51b815260206004820152600d60248201526c1253959053125117d310509153609a1b604482015260640162000203565b8151602001516001600160801b031615620003905760405162461bcd60e51b815260206004820152601c60248201527f494e56414c49445f4255434b45545f434f4e46494755524154494f4e00000000604482015260640162000203565b6020808301518051620003aa9260018501920190620004c0565b50815180516020918201516001600160801b03908116600160801b029116178255620003e4906008908590620013ab6200044e821b17901c565b508160200151604051620003f99190620009a7565b6040519081900381208351516001600160801b03168252906001600160a01b038516907ff27320e83f88f912f4441ed1db7432165eab17cb2eeac6c08848b857172707ae9060200160405180910390a3505050565b600062000465836001600160a01b0384166200046e565b90505b92915050565b6000818152600183016020526040812054620004b75750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000468565b50600062000468565b828054620004ce90620008b0565b90600052602060002090601f016020900481019282620004f257600085556200053d565b82601f106200050d57805160ff19168380011785556200053d565b828001600101855582156200053d579182015b828111156200053d57825182559160200191906001019062000520565b506200054b9291506200054f565b5090565b5b808211156200054b576000815560010162000550565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715620005a157620005a162000566565b60405290565b604051601f8201601f191681016001600160401b0381118282101715620005d257620005d262000566565b604052919050565b60006001600160401b03821115620005f657620005f662000566565b5060051b60200190565b80516001600160801b03811681146200061857600080fd5b919050565b60005b838110156200063a57818101518382015260200162000620565b838111156200064a576000848401525b50505050565b6000601f83818401126200066357600080fd5b825160206200067c6200067683620005da565b620005a7565b82815260059290921b850181019181810190878411156200069c57600080fd5b8287015b84811015620007c65780516001600160401b0380821115620006c25760008081fd5b90890190601f19828c038101606080821215620006df5760008081fd5b620006e96200057c565b604080841215620006fa5760008081fd5b620007046200057c565b9350620007138b880162000600565b84526200072281880162000600565b848c01529281528582015192858411156200073f57600092508283fd5b83870196508f603f8801126200075757600093508384fd5b8a87015193508584111562000770576200077062000566565b620007818b868f87011601620005a7565b95508386528f818589010111156200079b57600094508485fd5b620007ac848c8801838a016200061d565b50808a0194909452505050845250918301918301620006a0565b50979650505050505050565b60008060408385031215620007e657600080fd5b82516001600160401b0380821115620007fe57600080fd5b818501915085601f8301126200081357600080fd5b81516020620008266200067683620005da565b82815260059290921b840181019181810190898411156200084657600080fd5b948201945b838610156200087d5785516001600160a01b03811681146200086d5760008081fd5b825294820194908201906200084b565b918801519196509093505050808211156200089757600080fd5b50620008a68582860162000650565b9150509250929050565b600181811c90821680620008c557607f821691505b60208210811415620008e757634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c9150808316806200090a57607f831692505b60208084108214156200092b57634e487b7160e01b86526022600452602486fd5b818015620009425760018114620009545762000983565b60ff1986168952848901965062000983565b60008a81526020902060005b868110156200097b5781548b82015290850190830162000960565b505084890196505b509498975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60008251620009bb8184602087016200061d565b9190910192915050565b60805160a05160c0516125d6620009f56000396000610707015260006106d70152600061024901526125d66000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c80637ecebe00116100e3578063aa02f94a1161008c578063d505accf11610066578063d505accf14610425578063dd62ed3e14610438578063f2fde38b1461046357600080fd5b8063aa02f94a1461035e578063af93df57146103f2578063d46ec0ed1461040557600080fd5b8063941b7554116100bd578063941b75541461033057806395d89b4114610343578063a9059cbb1461034b57600080fd5b80637ecebe00146102d55780638238da3d146102f55780638da5cb5b1461030857600080fd5b8063313ce5671161014557806342966c681161011f57806342966c681461029a57806370a08231146102ad578063715018a6146102cd57600080fd5b8063313ce567146102445780633644e5151461027d57806340c10f191461028557600080fd5b80631ec90f2e116101765780631ec90f2e146101f557806323b872dd1461020a57806330adf81f1461021d57600080fd5b806306fdde031461019d578063095ea7b3146101bb57806318160ddd146101de575b600080fd5b6101a5610476565b6040516101b29190611d81565b60405180910390f35b6101ce6101c9366004611dbd565b610504565b60405190151581526020016101b2565b6101e760025481565b6040519081526020016101b2565b6101fd61057e565b6040516101b29190611de7565b6101ce610218366004611e41565b61058f565b6101e77f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b61026b7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016101b2565b6101e76106d3565b610298610293366004611dbd565b610729565b005b6102986102a8366004611e7d565b610919565b6101e76102bb366004611e96565b60036020526000908152604090205481565b6102986109ec565b6101e76102e3366004611e96565b60056020526000908152604090205481565b610298610303366004612123565b610a79565b60065460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101b2565b61029861033e3660046121e3565b610b08565b6101a5610bcb565b6101ce610359366004611dbd565b610bd8565b6103e561036c366004611e96565b60408051808201909152600080825260208201525073ffffffffffffffffffffffffffffffffffffffff166000908152600760209081526040918290208251808401909352546fffffffffffffffffffffffffffffffff8082168452700100000000000000000000000000000000909104169082015290565b6040516101b29190612258565b610298610400366004612285565b610c5d565b610418610413366004611e96565b610e22565b6040516101b291906122b8565b610298610433366004612304565b610f4f565b6101e7610446366004612377565b600460209081526000928352604080842090915290825290205481565b610298610471366004611e96565b61127b565b60008054610483906123a1565b80601f01602080910402602001604051908101604052809291908181526020018280546104af906123a1565b80156104fc5780601f106104d1576101008083540402835291602001916104fc565b820191906000526020600020905b8154815290600101906020018083116104df57829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061056c9086815260200190565b60405180910390a35060015b92915050565b606061058a60086113d4565b905090565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610623576105f18382612424565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff851660009081526003602052604081208054859290610658908490612424565b909155505073ffffffffffffffffffffffffffffffffffffffff808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906106c09087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146107045761058a6113e1565b507f000000000000000000000000000000000000000000000000000000000000000090565b336000908152600760205260409020546fffffffffffffffffffffffffffffffff16806107b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e56414c49445f464143494c495441544f520000000000000000000000000060448201526064015b60405180910390fd5b3360009081526007602052604081205470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16906107f8848361243b565b905080831015610889576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f464143494c495441544f525f4255434b45545f43415041434954595f4558434560448201527f454445440000000000000000000000000000000000000000000000000000000060648201526084016107ae565b336000818152600760205260409081902080546fffffffffffffffffffffffffffffffff808616700100000000000000000000000000000000029116179055517e7c7de1f1a34712b17838a180c9c7b2cac4571e6c64cb423373b634636a61ce906109009085908590918252602082015260400190565b60405180910390a2610912858561147b565b5050505050565b3360009081526007602052604081205470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff169061095a8383612424565b336000818152600760205260409081902080546fffffffffffffffffffffffffffffffff80861670010000000000000000000000000000000002911617905551919250907e7c7de1f1a34712b17838a180c9c7b2cac4571e6c64cb423373b634636a61ce906109d59085908590918252602082015260400190565b60405180910390a26109e733846114f4565b505050565b60065473ffffffffffffffffffffffffffffffffffffffff163314610a6d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b610a776000611582565b565b60065473ffffffffffffffffffffffffffffffffffffffff163314610afa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b610b0482826115f9565b5050565b60065473ffffffffffffffffffffffffffffffffffffffff163314610b89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b60005b818110156109e757610bc3838383818110610ba957610ba9612453565b9050602002016020810190610bbe9190611e96565b6116b4565b600101610b8c565b60018054610483906123a1565b33600090815260036020526040812080548391908390610bf9908490612424565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061056c9086815260200190565b60065473ffffffffffffffffffffffffffffffffffffffff163314610cde576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b73ffffffffffffffffffffffffffffffffffffffff821660009081526007602052604081206001018054610d11906123a1565b905011610d7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f464143494c495441544f525f444f45535f4e4f545f455849535400000000000060448201526064016107ae565b73ffffffffffffffffffffffffffffffffffffffff821660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffff0000000000000000000000000000000081166fffffffffffffffffffffffffffffffff878116918217909355845192909116808352928201529092917fc795c0a4927c3b6645e4e49a5a519af936b3c1c0e4c323a3f7251063f3f4bb0e910160405180910390a2505050565b6040805160808101825260009181018281526060808301939093528152602081019190915273ffffffffffffffffffffffffffffffffffffffff8216600090815260076020908152604091829020825160808101845281546fffffffffffffffffffffffffffffffff8082169583019586527001000000000000000000000000000000009091041660608201529283526001810180549192840191610ec6906123a1565b80601f0160208091040260200160405190810160405280929190818152602001828054610ef2906123a1565b8015610f3f5780601f10610f1457610100808354040283529160200191610f3f565b820191906000526020600020905b815481529060010190602001808311610f2257829003601f168201915b5050505050815250509050919050565b42841015610fb9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064016107ae565b6000610fc36106d3565b73ffffffffffffffffffffffffffffffffffffffff89811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938c166060840152608083018b905260a083019390935260c08083018a90528151808403909101815260e0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000061010083015261010282019290925261012281019190915261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015611122573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81161580159061119d57508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611203576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e455200000000000000000000000000000000000060448201526064016107ae565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526004602090815260408083208b8516808552908352928190208a905551898152919350918a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b60065473ffffffffffffffffffffffffffffffffffffffff1633146112fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b73ffffffffffffffffffffffffffffffffffffffff811661139f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107ae565b6113a881611582565b50565b60006113cd8373ffffffffffffffffffffffffffffffffffffffff8416611816565b9392505050565b606060006113cd83611865565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516114139190612482565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b806002600082825461148d919061243b565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91015b60405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081208054839290611529908490612424565b909155505060028054829003905560405181815260009073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016114e8565b6006805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8051825114611664576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f494e56414c49445f494e5055540000000000000000000000000000000000000060448201526064016107ae565b60005b81518110156109e7576116ac83828151811061168557611685612453565b602002602001015183838151811061169f5761169f612453565b60200260200101516118c1565b600101611667565b73ffffffffffffffffffffffffffffffffffffffff811660009081526007602052604090205470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff161561178d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f464143494c495441544f525f4255434b45545f4c4556454c5f4e4f545f5a455260448201527f4f0000000000000000000000000000000000000000000000000000000000000060648201526084016107ae565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600760205260408120818155906117c36001830182611c34565b506117d19050600882611b24565b5060405173ffffffffffffffffffffffffffffffffffffffff8216907fa8fe5b89f35f2ebd6f3f95a7ef215f4bd89179e10c101073ae76cffad14734cf90600090a250565b600081815260018301602052604081205461185d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610578565b506000610578565b6060816000018054806020026020016040519081016040528092919081815260200182805480156118b557602002820191906000526020600020905b8154815260200190600101908083116118a1575b50505050509050919050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526007602052604090206001810180546118f5906123a1565b15905061195e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f464143494c495441544f525f414c52454144595f45584953545300000000000060448201526064016107ae565b6000826020015151116119cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f494e56414c49445f4c4142454c0000000000000000000000000000000000000060448201526064016107ae565b8151602001516fffffffffffffffffffffffffffffffff1615611a4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f494e56414c49445f4255434b45545f434f4e46494755524154494f4e0000000060448201526064016107ae565b6020808301518051611a649260018501920190611c6e565b50815180516020909101516fffffffffffffffffffffffffffffffff908116700100000000000000000000000000000000029116178155611aa66008846113ab565b508160200151604051611ab99190612555565b6040519081900381208351516fffffffffffffffffffffffffffffffff1682529073ffffffffffffffffffffffffffffffffffffffff8516907ff27320e83f88f912f4441ed1db7432165eab17cb2eeac6c08848b857172707ae9060200160405180910390a3505050565b60006113cd8373ffffffffffffffffffffffffffffffffffffffff841660008181526001830160205260408120548015611c2a576000611b65600183612424565b8554909150600090611b7990600190612424565b9050818114611bde576000866000018281548110611b9957611b99612453565b9060005260206000200154905080876000018481548110611bbc57611bbc612453565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611bef57611bef612571565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610578565b6000915050610578565b508054611c40906123a1565b6000825580601f10611c50575050565b601f0160209004906000526020600020908101906113a89190611cf2565b828054611c7a906123a1565b90600052602060002090601f016020900481019282611c9c5760008555611ce2565b82601f10611cb557805160ff1916838001178555611ce2565b82800160010185558215611ce2579182015b82811115611ce2578251825591602001919060010190611cc7565b50611cee929150611cf2565b5090565b5b80821115611cee5760008155600101611cf3565b60005b83811015611d22578181015183820152602001611d0a565b83811115611d31576000848401525b50505050565b60008151808452611d4f816020860160208601611d07565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006113cd6020830184611d37565b803573ffffffffffffffffffffffffffffffffffffffff81168114611db857600080fd5b919050565b60008060408385031215611dd057600080fd5b611dd983611d94565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015611e3557835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101611e03565b50909695505050505050565b600080600060608486031215611e5657600080fd5b611e5f84611d94565b9250611e6d60208501611d94565b9150604084013590509250925092565b600060208284031215611e8f57600080fd5b5035919050565b600060208284031215611ea857600080fd5b6113cd82611d94565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611f0357611f03611eb1565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611f5057611f50611eb1565b604052919050565b600067ffffffffffffffff821115611f7257611f72611eb1565b5060051b60200190565b80356fffffffffffffffffffffffffffffffff81168114611db857600080fd5b6000601f8381840112611fae57600080fd5b82356020611fc3611fbe83611f58565b611f09565b82815260059290921b85018101918181019087841115611fe257600080fd5b8287015b8481101561211757803567ffffffffffffffff808211156120075760008081fd5b908901907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828c0381016060808212156120415760008081fd5b612049611ee0565b6040808412156120595760008081fd5b612061611ee0565b935061206e8b8801611f7c565b845261207b818801611f7c565b848c015292815285820135928584111561209757600092508283fd5b83870196508f603f8801126120ae57600093508384fd5b8a8701359350858411156120c4576120c4611eb1565b6120d38b868f87011601611f09565b95508386528f818589010111156120ec57600094508485fd5b838188018c8801375060009285018a0192909252508088019290925250845250918301918301611fe6565b50979650505050505050565b6000806040838503121561213657600080fd5b823567ffffffffffffffff8082111561214e57600080fd5b818501915085601f83011261216257600080fd5b81356020612172611fbe83611f58565b82815260059290921b8401810191818101908984111561219157600080fd5b948201945b838610156121b6576121a786611d94565b82529482019490820190612196565b965050860135925050808211156121cc57600080fd5b506121d985828601611f9c565b9150509250929050565b600080602083850312156121f657600080fd5b823567ffffffffffffffff8082111561220e57600080fd5b818501915085601f83011261222257600080fd5b81358181111561223157600080fd5b8660208260051b850101111561224657600080fd5b60209290920196919550909350505050565b60408101610578828480516fffffffffffffffffffffffffffffffff908116835260209182015116910152565b6000806040838503121561229857600080fd5b6122a183611d94565b91506122af60208401611f7c565b90509250929050565b6020808252825180516fffffffffffffffffffffffffffffffff90811684840152910151166040820152600060208301516060808401526122fc6080840182611d37565b949350505050565b600080600080600080600060e0888a03121561231f57600080fd5b61232888611d94565b965061233660208901611d94565b95506040880135945060608801359350608088013560ff8116811461235a57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561238a57600080fd5b61239383611d94565b91506122af60208401611d94565b600181811c908216806123b557607f821691505b602082108114156123ef577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015612436576124366123f5565b500390565b6000821982111561244e5761244e6123f5565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080835481600182811c91508083168061249e57607f831692505b60208084108214156124d7577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b8180156124eb576001811461251a57612547565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650612547565b60008a81526020902060005b8681101561253f5781548b820152908501908301612526565b505084890196505b509498975050505050505050565b60008251612567818460208701611d07565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea26469706673582212209be0e9712b2b9fed4dd3d131949ccca437090267c44589ac784b7a86d5c3b7d164736f6c634300080a0033'; - -type GhoTokenConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: GhoTokenConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class GhoToken__factory extends ContractFactory { - constructor(...args: GhoTokenConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override deploy( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise { - return super.deploy( - facilitatorsAddresses, - facilitatorsConfig, - overrides || {}, - ) as Promise; - } - override getDeployTransaction( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): TransactionRequest { - return super.getDeployTransaction( - facilitatorsAddresses, - facilitatorsConfig, - overrides || {}, - ); - } - override attach(address: string): GhoToken { - return super.attach(address) as GhoToken; - } - override connect(signer: Signer): GhoToken__factory { - return super.connect(signer) as GhoToken__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): GhoTokenInterface { - return new utils.Interface(_abi) as GhoTokenInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider, - ): GhoToken { - return new Contract(address, _abi, signerOrProvider) as GhoToken; - } -} diff --git a/packages/contract-helpers/src/gho/typechain/GhoVariableDebtToken.d.ts b/packages/contract-helpers/src/gho/typechain/GhoVariableDebtToken.d.ts deleted file mode 100644 index a753a881..00000000 --- a/packages/contract-helpers/src/gho/typechain/GhoVariableDebtToken.d.ts +++ /dev/null @@ -1,1741 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { - FunctionFragment, - Result, - EventFragment, -} from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, -} from '../../../../../common'; - -export interface GhoVariableDebtTokenInterface extends utils.Interface { - functions: { - 'DEBT_TOKEN_REVISION()': FunctionFragment; - 'DELEGATION_WITH_SIG_TYPEHASH()': FunctionFragment; - 'DOMAIN_SEPARATOR()': FunctionFragment; - 'EIP712_REVISION()': FunctionFragment; - 'POOL()': FunctionFragment; - 'UNDERLYING_ASSET_ADDRESS()': FunctionFragment; - 'allowance(address,address)': FunctionFragment; - 'approve(address,uint256)': FunctionFragment; - 'approveDelegation(address,uint256)': FunctionFragment; - 'balanceOf(address)': FunctionFragment; - 'borrowAllowance(address,address)': FunctionFragment; - 'burn(address,uint256,uint256)': FunctionFragment; - 'decimals()': FunctionFragment; - 'decreaseAllowance(address,uint256)': FunctionFragment; - 'decreaseBalanceFromInterest(address,uint256)': FunctionFragment; - 'delegationWithSig(address,address,uint256,uint256,uint8,bytes32,bytes32)': FunctionFragment; - 'getAToken()': FunctionFragment; - 'getBalanceFromInterest(address)': FunctionFragment; - 'getDiscountLockPeriod()': FunctionFragment; - 'getDiscountPercent(address)': FunctionFragment; - 'getDiscountRateStrategy()': FunctionFragment; - 'getDiscountToken()': FunctionFragment; - 'getIncentivesController()': FunctionFragment; - 'getPreviousIndex(address)': FunctionFragment; - 'getScaledUserBalanceAndSupply(address)': FunctionFragment; - 'getUserRebalanceTimestamp(address)': FunctionFragment; - 'increaseAllowance(address,uint256)': FunctionFragment; - 'initialize(address,address,address,uint8,string,string,bytes)': FunctionFragment; - 'mint(address,address,uint256,uint256)': FunctionFragment; - 'name()': FunctionFragment; - 'nonces(address)': FunctionFragment; - 'rebalanceUserDiscountPercent(address)': FunctionFragment; - 'scaledBalanceOf(address)': FunctionFragment; - 'scaledTotalSupply()': FunctionFragment; - 'setAToken(address)': FunctionFragment; - 'setIncentivesController(address)': FunctionFragment; - 'symbol()': FunctionFragment; - 'totalSupply()': FunctionFragment; - 'transfer(address,uint256)': FunctionFragment; - 'transferFrom(address,address,uint256)': FunctionFragment; - 'updateDiscountDistribution(address,address,uint256,uint256,uint256)': FunctionFragment; - 'updateDiscountLockPeriod(uint256)': FunctionFragment; - 'updateDiscountRateStrategy(address)': FunctionFragment; - 'updateDiscountToken(address)': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'DEBT_TOKEN_REVISION' - | 'DELEGATION_WITH_SIG_TYPEHASH' - | 'DOMAIN_SEPARATOR' - | 'EIP712_REVISION' - | 'POOL' - | 'UNDERLYING_ASSET_ADDRESS' - | 'allowance' - | 'approve' - | 'approveDelegation' - | 'balanceOf' - | 'borrowAllowance' - | 'burn' - | 'decimals' - | 'decreaseAllowance' - | 'decreaseBalanceFromInterest' - | 'delegationWithSig' - | 'getAToken' - | 'getBalanceFromInterest' - | 'getDiscountLockPeriod' - | 'getDiscountPercent' - | 'getDiscountRateStrategy' - | 'getDiscountToken' - | 'getIncentivesController' - | 'getPreviousIndex' - | 'getScaledUserBalanceAndSupply' - | 'getUserRebalanceTimestamp' - | 'increaseAllowance' - | 'initialize' - | 'mint' - | 'name' - | 'nonces' - | 'rebalanceUserDiscountPercent' - | 'scaledBalanceOf' - | 'scaledTotalSupply' - | 'setAToken' - | 'setIncentivesController' - | 'symbol' - | 'totalSupply' - | 'transfer' - | 'transferFrom' - | 'updateDiscountDistribution' - | 'updateDiscountLockPeriod' - | 'updateDiscountRateStrategy' - | 'updateDiscountToken', - ): FunctionFragment; - - encodeFunctionData( - functionFragment: 'DEBT_TOKEN_REVISION', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'DELEGATION_WITH_SIG_TYPEHASH', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'DOMAIN_SEPARATOR', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'EIP712_REVISION', - values?: undefined, - ): string; - encodeFunctionData(functionFragment: 'POOL', values?: undefined): string; - encodeFunctionData( - functionFragment: 'UNDERLYING_ASSET_ADDRESS', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'allowance', - values: [string, string], - ): string; - encodeFunctionData( - functionFragment: 'approve', - values: [string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'approveDelegation', - values: [string, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'balanceOf', values: [string]): string; - encodeFunctionData( - functionFragment: 'borrowAllowance', - values: [string, string], - ): string; - encodeFunctionData( - functionFragment: 'burn', - values: [string, BigNumberish, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'decimals', values?: undefined): string; - encodeFunctionData( - functionFragment: 'decreaseAllowance', - values: [string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'decreaseBalanceFromInterest', - values: [string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'delegationWithSig', - values: [ - string, - string, - BigNumberish, - BigNumberish, - BigNumberish, - BytesLike, - BytesLike, - ], - ): string; - encodeFunctionData(functionFragment: 'getAToken', values?: undefined): string; - encodeFunctionData( - functionFragment: 'getBalanceFromInterest', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getDiscountLockPeriod', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'getDiscountPercent', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getDiscountRateStrategy', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'getDiscountToken', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'getIncentivesController', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'getPreviousIndex', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getScaledUserBalanceAndSupply', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getUserRebalanceTimestamp', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'increaseAllowance', - values: [string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'initialize', - values: [string, string, string, BigNumberish, string, string, BytesLike], - ): string; - encodeFunctionData( - functionFragment: 'mint', - values: [string, string, BigNumberish, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'name', values?: undefined): string; - encodeFunctionData(functionFragment: 'nonces', values: [string]): string; - encodeFunctionData( - functionFragment: 'rebalanceUserDiscountPercent', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'scaledBalanceOf', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'scaledTotalSupply', - values?: undefined, - ): string; - encodeFunctionData(functionFragment: 'setAToken', values: [string]): string; - encodeFunctionData( - functionFragment: 'setIncentivesController', - values: [string], - ): string; - encodeFunctionData(functionFragment: 'symbol', values?: undefined): string; - encodeFunctionData( - functionFragment: 'totalSupply', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'transfer', - values: [string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'transferFrom', - values: [string, string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'updateDiscountDistribution', - values: [string, string, BigNumberish, BigNumberish, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'updateDiscountLockPeriod', - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'updateDiscountRateStrategy', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'updateDiscountToken', - values: [string], - ): string; - - decodeFunctionResult( - functionFragment: 'DEBT_TOKEN_REVISION', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'DELEGATION_WITH_SIG_TYPEHASH', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'DOMAIN_SEPARATOR', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'EIP712_REVISION', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'POOL', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'UNDERLYING_ASSET_ADDRESS', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'allowance', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'approve', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'approveDelegation', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'balanceOf', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'borrowAllowance', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'burn', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'decimals', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'decreaseAllowance', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'decreaseBalanceFromInterest', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'delegationWithSig', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'getAToken', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'getBalanceFromInterest', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getDiscountLockPeriod', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getDiscountPercent', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getDiscountRateStrategy', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getDiscountToken', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getIncentivesController', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getPreviousIndex', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getScaledUserBalanceAndSupply', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getUserRebalanceTimestamp', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'increaseAllowance', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'initialize', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'mint', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'name', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'nonces', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'rebalanceUserDiscountPercent', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'scaledBalanceOf', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'scaledTotalSupply', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'setAToken', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'setIncentivesController', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'symbol', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'totalSupply', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'transfer', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'transferFrom', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'updateDiscountDistribution', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'updateDiscountLockPeriod', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'updateDiscountRateStrategy', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'updateDiscountToken', - data: BytesLike, - ): Result; - - events: { - 'ATokenSet(address)': EventFragment; - 'Approval(address,address,uint256)': EventFragment; - 'BorrowAllowanceDelegated(address,address,address,uint256)': EventFragment; - 'Burn(address,address,uint256,uint256,uint256)': EventFragment; - 'DiscountLockPeriodUpdated(uint256,uint256)': EventFragment; - 'DiscountPercentLocked(address,uint256,uint256)': EventFragment; - 'DiscountRateStrategyUpdated(address,address)': EventFragment; - 'DiscountTokenUpdated(address,address)': EventFragment; - 'Initialized(address,address,address,uint8,string,string,bytes)': EventFragment; - 'Mint(address,address,uint256,uint256,uint256)': EventFragment; - 'Transfer(address,address,uint256)': EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: 'ATokenSet'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Approval'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'BorrowAllowanceDelegated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Burn'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'DiscountLockPeriodUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'DiscountPercentLocked'): EventFragment; - getEvent( - nameOrSignatureOrTopic: 'DiscountRateStrategyUpdated', - ): EventFragment; - getEvent(nameOrSignatureOrTopic: 'DiscountTokenUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Initialized'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Mint'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Transfer'): EventFragment; -} - -export interface ATokenSetEventObject { - aToken: string; -} -export type ATokenSetEvent = TypedEvent<[string], ATokenSetEventObject>; - -export type ATokenSetEventFilter = TypedEventFilter; - -export interface ApprovalEventObject { - owner: string; - spender: string; - value: BigNumber; -} -export type ApprovalEvent = TypedEvent< - [string, string, BigNumber], - ApprovalEventObject ->; - -export type ApprovalEventFilter = TypedEventFilter; - -export interface BorrowAllowanceDelegatedEventObject { - fromUser: string; - toUser: string; - asset: string; - amount: BigNumber; -} -export type BorrowAllowanceDelegatedEvent = TypedEvent< - [string, string, string, BigNumber], - BorrowAllowanceDelegatedEventObject ->; - -export type BorrowAllowanceDelegatedEventFilter = - TypedEventFilter; - -export interface BurnEventObject { - from: string; - target: string; - value: BigNumber; - balanceIncrease: BigNumber; - index: BigNumber; -} -export type BurnEvent = TypedEvent< - [string, string, BigNumber, BigNumber, BigNumber], - BurnEventObject ->; - -export type BurnEventFilter = TypedEventFilter; - -export interface DiscountLockPeriodUpdatedEventObject { - oldDiscountLockPeriod: BigNumber; - newDiscountLockPeriod: BigNumber; -} -export type DiscountLockPeriodUpdatedEvent = TypedEvent< - [BigNumber, BigNumber], - DiscountLockPeriodUpdatedEventObject ->; - -export type DiscountLockPeriodUpdatedEventFilter = - TypedEventFilter; - -export interface DiscountPercentLockedEventObject { - user: string; - discountPercent: BigNumber; - rebalanceTimestamp: BigNumber; -} -export type DiscountPercentLockedEvent = TypedEvent< - [string, BigNumber, BigNumber], - DiscountPercentLockedEventObject ->; - -export type DiscountPercentLockedEventFilter = - TypedEventFilter; - -export interface DiscountRateStrategyUpdatedEventObject { - oldDiscountRateStrategy: string; - newDiscountRateStrategy: string; -} -export type DiscountRateStrategyUpdatedEvent = TypedEvent< - [string, string], - DiscountRateStrategyUpdatedEventObject ->; - -export type DiscountRateStrategyUpdatedEventFilter = - TypedEventFilter; - -export interface DiscountTokenUpdatedEventObject { - oldDiscountToken: string; - newDiscountToken: string; -} -export type DiscountTokenUpdatedEvent = TypedEvent< - [string, string], - DiscountTokenUpdatedEventObject ->; - -export type DiscountTokenUpdatedEventFilter = - TypedEventFilter; - -export interface InitializedEventObject { - underlyingAsset: string; - pool: string; - incentivesController: string; - debtTokenDecimals: number; - debtTokenName: string; - debtTokenSymbol: string; - params: string; -} -export type InitializedEvent = TypedEvent< - [string, string, string, number, string, string, string], - InitializedEventObject ->; - -export type InitializedEventFilter = TypedEventFilter; - -export interface MintEventObject { - caller: string; - onBehalfOf: string; - value: BigNumber; - balanceIncrease: BigNumber; - index: BigNumber; -} -export type MintEvent = TypedEvent< - [string, string, BigNumber, BigNumber, BigNumber], - MintEventObject ->; - -export type MintEventFilter = TypedEventFilter; - -export interface TransferEventObject { - from: string; - to: string; - value: BigNumber; -} -export type TransferEvent = TypedEvent< - [string, string, BigNumber], - TransferEventObject ->; - -export type TransferEventFilter = TypedEventFilter; - -export interface GhoVariableDebtToken extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: GhoVariableDebtTokenInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter, - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter, - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - DEBT_TOKEN_REVISION(overrides?: CallOverrides): Promise<[BigNumber]>; - - DELEGATION_WITH_SIG_TYPEHASH(overrides?: CallOverrides): Promise<[string]>; - - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<[string]>; - - EIP712_REVISION(overrides?: CallOverrides): Promise<[string]>; - - POOL(overrides?: CallOverrides): Promise<[string]>; - - UNDERLYING_ASSET_ADDRESS(overrides?: CallOverrides): Promise<[string]>; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - approve( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - approveDelegation( - delegatee: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - balanceOf(user: string, overrides?: CallOverrides): Promise<[BigNumber]>; - - borrowAllowance( - fromUser: string, - toUser: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decimals(overrides?: CallOverrides): Promise<[number]>; - - decreaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - delegationWithSig( - delegator: string, - delegatee: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise<[string]>; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - getDiscountLockPeriod(overrides?: CallOverrides): Promise<[BigNumber]>; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - getDiscountRateStrategy(overrides?: CallOverrides): Promise<[string]>; - - getDiscountToken(overrides?: CallOverrides): Promise<[string]>; - - getIncentivesController(overrides?: CallOverrides): Promise<[string]>; - - getPreviousIndex( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber, BigNumber]>; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - increaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - initialize( - initializingPool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - name(overrides?: CallOverrides): Promise<[string]>; - - nonces(owner: string, overrides?: CallOverrides): Promise<[BigNumber]>; - - rebalanceUserDiscountPercent( - user: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - scaledBalanceOf( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - scaledTotalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; - - setAToken( - ghoAToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setIncentivesController( - controller: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - symbol(overrides?: CallOverrides): Promise<[string]>; - - totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; - - transfer( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferFrom( - arg0: string, - arg1: string, - arg2: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; - - DEBT_TOKEN_REVISION(overrides?: CallOverrides): Promise; - - DELEGATION_WITH_SIG_TYPEHASH(overrides?: CallOverrides): Promise; - - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise; - - EIP712_REVISION(overrides?: CallOverrides): Promise; - - POOL(overrides?: CallOverrides): Promise; - - UNDERLYING_ASSET_ADDRESS(overrides?: CallOverrides): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise; - - approve( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - approveDelegation( - delegatee: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - balanceOf(user: string, overrides?: CallOverrides): Promise; - - borrowAllowance( - fromUser: string, - toUser: string, - overrides?: CallOverrides, - ): Promise; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decimals(overrides?: CallOverrides): Promise; - - decreaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - delegationWithSig( - delegator: string, - delegatee: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountLockPeriod(overrides?: CallOverrides): Promise; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountRateStrategy(overrides?: CallOverrides): Promise; - - getDiscountToken(overrides?: CallOverrides): Promise; - - getIncentivesController(overrides?: CallOverrides): Promise; - - getPreviousIndex(user: string, overrides?: CallOverrides): Promise; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber, BigNumber]>; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise; - - increaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - initialize( - initializingPool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - name(overrides?: CallOverrides): Promise; - - nonces(owner: string, overrides?: CallOverrides): Promise; - - rebalanceUserDiscountPercent( - user: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - scaledBalanceOf(user: string, overrides?: CallOverrides): Promise; - - scaledTotalSupply(overrides?: CallOverrides): Promise; - - setAToken( - ghoAToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setIncentivesController( - controller: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - symbol(overrides?: CallOverrides): Promise; - - totalSupply(overrides?: CallOverrides): Promise; - - transfer( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferFrom( - arg0: string, - arg1: string, - arg2: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - callStatic: { - DEBT_TOKEN_REVISION(overrides?: CallOverrides): Promise; - - DELEGATION_WITH_SIG_TYPEHASH(overrides?: CallOverrides): Promise; - - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise; - - EIP712_REVISION(overrides?: CallOverrides): Promise; - - POOL(overrides?: CallOverrides): Promise; - - UNDERLYING_ASSET_ADDRESS(overrides?: CallOverrides): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise; - - approve( - arg0: string, - arg1: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - approveDelegation( - delegatee: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - balanceOf(user: string, overrides?: CallOverrides): Promise; - - borrowAllowance( - fromUser: string, - toUser: string, - overrides?: CallOverrides, - ): Promise; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - decimals(overrides?: CallOverrides): Promise; - - decreaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - delegationWithSig( - delegator: string, - delegatee: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: CallOverrides, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountLockPeriod(overrides?: CallOverrides): Promise; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountRateStrategy(overrides?: CallOverrides): Promise; - - getDiscountToken(overrides?: CallOverrides): Promise; - - getIncentivesController(overrides?: CallOverrides): Promise; - - getPreviousIndex( - user: string, - overrides?: CallOverrides, - ): Promise; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber, BigNumber]>; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise; - - increaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - initialize( - initializingPool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: CallOverrides, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: CallOverrides, - ): Promise<[boolean, BigNumber]>; - - name(overrides?: CallOverrides): Promise; - - nonces(owner: string, overrides?: CallOverrides): Promise; - - rebalanceUserDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - scaledBalanceOf( - user: string, - overrides?: CallOverrides, - ): Promise; - - scaledTotalSupply(overrides?: CallOverrides): Promise; - - setAToken(ghoAToken: string, overrides?: CallOverrides): Promise; - - setIncentivesController( - controller: string, - overrides?: CallOverrides, - ): Promise; - - symbol(overrides?: CallOverrides): Promise; - - totalSupply(overrides?: CallOverrides): Promise; - - transfer( - arg0: string, - arg1: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - transferFrom( - arg0: string, - arg1: string, - arg2: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: CallOverrides, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: CallOverrides, - ): Promise; - }; - - filters: { - 'ATokenSet(address)'(aToken?: string | null): ATokenSetEventFilter; - ATokenSet(aToken?: string | null): ATokenSetEventFilter; - - 'Approval(address,address,uint256)'( - owner?: string | null, - spender?: string | null, - value?: null, - ): ApprovalEventFilter; - Approval( - owner?: string | null, - spender?: string | null, - value?: null, - ): ApprovalEventFilter; - - 'BorrowAllowanceDelegated(address,address,address,uint256)'( - fromUser?: string | null, - toUser?: string | null, - asset?: string | null, - amount?: null, - ): BorrowAllowanceDelegatedEventFilter; - BorrowAllowanceDelegated( - fromUser?: string | null, - toUser?: string | null, - asset?: string | null, - amount?: null, - ): BorrowAllowanceDelegatedEventFilter; - - 'Burn(address,address,uint256,uint256,uint256)'( - from?: string | null, - target?: string | null, - value?: null, - balanceIncrease?: null, - index?: null, - ): BurnEventFilter; - Burn( - from?: string | null, - target?: string | null, - value?: null, - balanceIncrease?: null, - index?: null, - ): BurnEventFilter; - - 'DiscountLockPeriodUpdated(uint256,uint256)'( - oldDiscountLockPeriod?: BigNumberish | null, - newDiscountLockPeriod?: BigNumberish | null, - ): DiscountLockPeriodUpdatedEventFilter; - DiscountLockPeriodUpdated( - oldDiscountLockPeriod?: BigNumberish | null, - newDiscountLockPeriod?: BigNumberish | null, - ): DiscountLockPeriodUpdatedEventFilter; - - 'DiscountPercentLocked(address,uint256,uint256)'( - user?: string | null, - discountPercent?: BigNumberish | null, - rebalanceTimestamp?: BigNumberish | null, - ): DiscountPercentLockedEventFilter; - DiscountPercentLocked( - user?: string | null, - discountPercent?: BigNumberish | null, - rebalanceTimestamp?: BigNumberish | null, - ): DiscountPercentLockedEventFilter; - - 'DiscountRateStrategyUpdated(address,address)'( - oldDiscountRateStrategy?: string | null, - newDiscountRateStrategy?: string | null, - ): DiscountRateStrategyUpdatedEventFilter; - DiscountRateStrategyUpdated( - oldDiscountRateStrategy?: string | null, - newDiscountRateStrategy?: string | null, - ): DiscountRateStrategyUpdatedEventFilter; - - 'DiscountTokenUpdated(address,address)'( - oldDiscountToken?: string | null, - newDiscountToken?: string | null, - ): DiscountTokenUpdatedEventFilter; - DiscountTokenUpdated( - oldDiscountToken?: string | null, - newDiscountToken?: string | null, - ): DiscountTokenUpdatedEventFilter; - - 'Initialized(address,address,address,uint8,string,string,bytes)'( - underlyingAsset?: string | null, - pool?: string | null, - incentivesController?: null, - debtTokenDecimals?: null, - debtTokenName?: null, - debtTokenSymbol?: null, - params?: null, - ): InitializedEventFilter; - Initialized( - underlyingAsset?: string | null, - pool?: string | null, - incentivesController?: null, - debtTokenDecimals?: null, - debtTokenName?: null, - debtTokenSymbol?: null, - params?: null, - ): InitializedEventFilter; - - 'Mint(address,address,uint256,uint256,uint256)'( - caller?: string | null, - onBehalfOf?: string | null, - value?: null, - balanceIncrease?: null, - index?: null, - ): MintEventFilter; - Mint( - caller?: string | null, - onBehalfOf?: string | null, - value?: null, - balanceIncrease?: null, - index?: null, - ): MintEventFilter; - - 'Transfer(address,address,uint256)'( - from?: string | null, - to?: string | null, - value?: null, - ): TransferEventFilter; - Transfer( - from?: string | null, - to?: string | null, - value?: null, - ): TransferEventFilter; - }; - - estimateGas: { - DEBT_TOKEN_REVISION(overrides?: CallOverrides): Promise; - - DELEGATION_WITH_SIG_TYPEHASH(overrides?: CallOverrides): Promise; - - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise; - - EIP712_REVISION(overrides?: CallOverrides): Promise; - - POOL(overrides?: CallOverrides): Promise; - - UNDERLYING_ASSET_ADDRESS(overrides?: CallOverrides): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise; - - approve( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - approveDelegation( - delegatee: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - balanceOf(user: string, overrides?: CallOverrides): Promise; - - borrowAllowance( - fromUser: string, - toUser: string, - overrides?: CallOverrides, - ): Promise; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decimals(overrides?: CallOverrides): Promise; - - decreaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - delegationWithSig( - delegator: string, - delegatee: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountLockPeriod(overrides?: CallOverrides): Promise; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountRateStrategy(overrides?: CallOverrides): Promise; - - getDiscountToken(overrides?: CallOverrides): Promise; - - getIncentivesController(overrides?: CallOverrides): Promise; - - getPreviousIndex( - user: string, - overrides?: CallOverrides, - ): Promise; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise; - - increaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - initialize( - initializingPool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - name(overrides?: CallOverrides): Promise; - - nonces(owner: string, overrides?: CallOverrides): Promise; - - rebalanceUserDiscountPercent( - user: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - scaledBalanceOf( - user: string, - overrides?: CallOverrides, - ): Promise; - - scaledTotalSupply(overrides?: CallOverrides): Promise; - - setAToken( - ghoAToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setIncentivesController( - controller: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - symbol(overrides?: CallOverrides): Promise; - - totalSupply(overrides?: CallOverrides): Promise; - - transfer( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferFrom( - arg0: string, - arg1: string, - arg2: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; - - populateTransaction: { - DEBT_TOKEN_REVISION( - overrides?: CallOverrides, - ): Promise; - - DELEGATION_WITH_SIG_TYPEHASH( - overrides?: CallOverrides, - ): Promise; - - DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise; - - EIP712_REVISION(overrides?: CallOverrides): Promise; - - POOL(overrides?: CallOverrides): Promise; - - UNDERLYING_ASSET_ADDRESS( - overrides?: CallOverrides, - ): Promise; - - allowance( - arg0: string, - arg1: string, - overrides?: CallOverrides, - ): Promise; - - approve( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - approveDelegation( - delegatee: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - balanceOf( - user: string, - overrides?: CallOverrides, - ): Promise; - - borrowAllowance( - fromUser: string, - toUser: string, - overrides?: CallOverrides, - ): Promise; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decimals(overrides?: CallOverrides): Promise; - - decreaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - delegationWithSig( - delegator: string, - delegatee: string, - value: BigNumberish, - deadline: BigNumberish, - v: BigNumberish, - r: BytesLike, - s: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountLockPeriod( - overrides?: CallOverrides, - ): Promise; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountRateStrategy( - overrides?: CallOverrides, - ): Promise; - - getDiscountToken(overrides?: CallOverrides): Promise; - - getIncentivesController( - overrides?: CallOverrides, - ): Promise; - - getPreviousIndex( - user: string, - overrides?: CallOverrides, - ): Promise; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise; - - increaseAllowance( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - initialize( - initializingPool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - name(overrides?: CallOverrides): Promise; - - nonces( - owner: string, - overrides?: CallOverrides, - ): Promise; - - rebalanceUserDiscountPercent( - user: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - scaledBalanceOf( - user: string, - overrides?: CallOverrides, - ): Promise; - - scaledTotalSupply(overrides?: CallOverrides): Promise; - - setAToken( - ghoAToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setIncentivesController( - controller: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - symbol(overrides?: CallOverrides): Promise; - - totalSupply(overrides?: CallOverrides): Promise; - - transfer( - arg0: string, - arg1: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - transferFrom( - arg0: string, - arg1: string, - arg2: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/gho/typechain/GhoVariableDebtToken__factory.ts b/packages/contract-helpers/src/gho/typechain/GhoVariableDebtToken__factory.ts deleted file mode 100644 index 5d4d924a..00000000 --- a/packages/contract-helpers/src/gho/typechain/GhoVariableDebtToken__factory.ts +++ /dev/null @@ -1,1216 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import { Signer, utils, Contract, ContractFactory, Overrides } from 'ethers'; -import type { Provider, TransactionRequest } from '@ethersproject/providers'; -import type { - GhoVariableDebtToken, - GhoVariableDebtTokenInterface, -} from './GhoVariableDebtToken'; - -const _abi = [ - { - inputs: [ - { - internalType: 'contract IPool', - name: 'pool', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'aToken', - type: 'address', - }, - ], - name: 'ATokenSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'Approval', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'fromUser', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'toUser', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'asset', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'BorrowAllowanceDelegated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'target', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'balanceIncrease', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'Burn', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'oldDiscountLockPeriod', - type: 'uint256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'newDiscountLockPeriod', - type: 'uint256', - }, - ], - name: 'DiscountLockPeriodUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'user', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'discountPercent', - type: 'uint256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'rebalanceTimestamp', - type: 'uint256', - }, - ], - name: 'DiscountPercentLocked', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oldDiscountRateStrategy', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newDiscountRateStrategy', - type: 'address', - }, - ], - name: 'DiscountRateStrategyUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oldDiscountToken', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newDiscountToken', - type: 'address', - }, - ], - name: 'DiscountTokenUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: false, - internalType: 'address', - name: 'incentivesController', - type: 'address', - }, - { - indexed: false, - internalType: 'uint8', - name: 'debtTokenDecimals', - type: 'uint8', - }, - { - indexed: false, - internalType: 'string', - name: 'debtTokenName', - type: 'string', - }, - { - indexed: false, - internalType: 'string', - name: 'debtTokenSymbol', - type: 'string', - }, - { - indexed: false, - internalType: 'bytes', - name: 'params', - type: 'bytes', - }, - ], - name: 'Initialized', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'caller', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'onBehalfOf', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'balanceIncrease', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'Mint', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'Transfer', - type: 'event', - }, - { - inputs: [], - name: 'DEBT_TOKEN_REVISION', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'DELEGATION_WITH_SIG_TYPEHASH', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'DOMAIN_SEPARATOR', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'EIP712_REVISION', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'POOL', - outputs: [ - { - internalType: 'contract IPool', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'UNDERLYING_ASSET_ADDRESS', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - name: 'allowance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - name: 'approve', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'delegatee', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'approveDelegation', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'fromUser', - type: 'address', - }, - { - internalType: 'address', - name: 'toUser', - type: 'address', - }, - ], - name: 'borrowAllowance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'burn', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'decimals', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - name: 'decreaseAllowance', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'decreaseBalanceFromInterest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'delegator', - type: 'address', - }, - { - internalType: 'address', - name: 'delegatee', - type: 'address', - }, - { - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'uint8', - name: 'v', - type: 'uint8', - }, - { - internalType: 'bytes32', - name: 'r', - type: 'bytes32', - }, - { - internalType: 'bytes32', - name: 's', - type: 'bytes32', - }, - ], - name: 'delegationWithSig', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'getAToken', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getBalanceFromInterest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getDiscountLockPeriod', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getDiscountPercent', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getDiscountRateStrategy', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getDiscountToken', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getIncentivesController', - outputs: [ - { - internalType: 'contract IAaveIncentivesController', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getPreviousIndex', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getScaledUserBalanceAndSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getUserRebalanceTimestamp', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - name: 'increaseAllowance', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract IPool', - name: 'initializingPool', - type: 'address', - }, - { - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - internalType: 'contract IAaveIncentivesController', - name: 'incentivesController', - type: 'address', - }, - { - internalType: 'uint8', - name: 'debtTokenDecimals', - type: 'uint8', - }, - { - internalType: 'string', - name: 'debtTokenName', - type: 'string', - }, - { - internalType: 'string', - name: 'debtTokenSymbol', - type: 'string', - }, - { - internalType: 'bytes', - name: 'params', - type: 'bytes', - }, - ], - name: 'initialize', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - { - internalType: 'address', - name: 'onBehalfOf', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'mint', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'name', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'owner', - type: 'address', - }, - ], - name: 'nonces', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'rebalanceUserDiscountPercent', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'scaledBalanceOf', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'scaledTotalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'ghoAToken', - type: 'address', - }, - ], - name: 'setAToken', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract IAaveIncentivesController', - name: 'controller', - type: 'address', - }, - ], - name: 'setIncentivesController', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'symbol', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'totalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - name: 'transfer', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'address', - name: '', - type: 'address', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - internalType: 'address', - name: 'recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: 'senderDiscountTokenBalance', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'recipientDiscountTokenBalance', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'updateDiscountDistribution', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'newLockPeriod', - type: 'uint256', - }, - ], - name: 'updateDiscountLockPeriod', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'newDiscountRateStrategy', - type: 'address', - }, - ], - name: 'updateDiscountRateStrategy', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'newDiscountToken', - type: 'address', - }, - ], - name: 'updateDiscountToken', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -]; - -const _bytecode = - '0x60e0604052600080553480156200001557600080fd5b506040516200443538038062004435833981016040819052620000389162000245565b806040518060400160405280601881526020017f5641524941424c455f444542545f544f4b454e5f494d504c00000000000000008152506040518060400160405280601881526020017f5641524941424c455f444542545f544f4b454e5f494d504c0000000000000000815250600083838383838383834660808181525050836001600160a01b0316630542975c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000f6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200011c919062000245565b6001600160a01b031660a05282516200013d90603b90602086019062000186565b5081516200015390603c90602085019062000186565b50603d805460ff191660ff9290921691909117905550506001600160a01b031660c05250620002a9975050505050505050565b82805462000194906200026c565b90600052602060002090601f016020900481019282620001b8576000855562000203565b82601f10620001d357805160ff191683800117855562000203565b8280016001018555821562000203579182015b8281111562000203578251825591602001919060010190620001e6565b506200021192915062000215565b5090565b5b8082111562000211576000815560010162000216565b6001600160a01b03811681146200024257600080fd5b50565b6000602082840312156200025857600080fd5b815162000265816200022c565b9392505050565b600181811c908216806200028157607f821691505b60208210811415620002a357634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c0516141086200032d600039600081816105a001528181610e590152818161122c01528181611ad801528181611d9e0152818161209501528181612259015281816123b4015261289a015260008181610ed9015281816115f8015281816118790152818161247f0152612686015260006110e201526141086000f3fe608060405234801561001057600080fd5b50600436106102f45760003560e01c80637816037611610191578063b9a7b622116100e3578063e075398611610097578063f3bfc73811610071578063f3bfc73814610829578063f5298aca14610850578063fe49b7941461086357600080fd5b8063e07539861461079c578063e655dbd8146107f8578063efe3de141461080b57600080fd5b8063c222ec8a116100c8578063c222ec8a14610768578063ce79f3821461077b578063dd62ed3e1461078e57600080fd5b8063b9a7b6221461074d578063c04a8a101461075557600080fd5b8063a457c2d711610145578063b1bf962d1161011f578063b1bf962d146106fd578063b29c55bc14610705578063b3f1c93d1461072357600080fd5b8063a457c2d714610317578063a9059cbb14610317578063b16a19de146106df57600080fd5b80637ecebe00116101765780637ecebe001461068e5780637f3c4a66146106c457806395d89b41146106d757600080fd5b8063781603761461060a5780637ccf1a151461064657600080fd5b80633644e5151161024a5780636bd76d24116101fe57806370a08231116101d857806370a08231146105885780637535d2461461059b57806375d26413146105e757600080fd5b80636bd76d24146104ec5780636c2c662c146105325780636c53272b1461053a57600080fd5b80635b9c4cf11161022f5780635b9c4cf1146104b35780635f09d84c146104c65780635f6d9a7b146104d957600080fd5b80633644e515146104ab578063395093511461031757600080fd5b806318160ddd116102ac5780631fb26074116102865780631fb260741461043557806323b872dd14610488578063313ce5671461049657600080fd5b806318160ddd146103c45780631c98cfb7146103da5780631da24f3e146103ed57600080fd5b80630afbcdc9116102dd5780630afbcdc91461033a5780630b52d5581461039c5780630d44dedc146103b157600080fd5b806306fdde03146102f9578063095ea7b314610317575b600080fd5b610301610881565b60405161030e91906139dd565b60405180910390f35b61032a610325366004613a2c565b610913565b604051901515815260200161030e565b610387610348366004613a58565b73ffffffffffffffffffffffffffffffffffffffff16600090815260386020526040902054603a546fffffffffffffffffffffffffffffffff90911691565b6040805192835260208301919091520161030e565b6103af6103aa366004613a86565b610983565b005b6103af6103bf366004613a2c565b610cd4565b6103cc610e0a565b60405190815260200161030e565b6103af6103e8366004613a58565b610ed5565b6103cc6103fb366004613a58565b73ffffffffffffffffffffffffffffffffffffffff166000908152603860205260409020546fffffffffffffffffffffffffffffffff1690565b6103cc610443366004613a58565b73ffffffffffffffffffffffffffffffffffffffff166000908152604160205260409020547201000000000000000000000000000000000000900464ffffffffff1690565b61032a610325366004613af4565b603d5460405160ff909116815260200161030e565b6103cc6110de565b6103af6104c1366004613b35565b611117565b6103af6104d4366004613a58565b6115f4565b6103af6104e7366004613b86565b611875565b6103cc6104fa366004613b9f565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260366020908152604080832093909416825291909152205490565b6042546103cc565b6103cc610548366004613a58565b73ffffffffffffffffffffffffffffffffffffffff16600090815260416020526040902054700100000000000000000000000000000000900461ffff1690565b6103cc610596366004613a58565b611a47565b6105c27f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161030e565b603d54610100900473ffffffffffffffffffffffffffffffffffffffff166105c2565b6103016040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b6103cc610654366004613a58565b73ffffffffffffffffffffffffffffffffffffffff166000908152604160205260409020546fffffffffffffffffffffffffffffffff1690565b6103cc61069c366004613a58565b73ffffffffffffffffffffffffffffffffffffffff1660009081526034602052604090205490565b6103af6106d2366004613a58565b611c34565b61030161203f565b60375473ffffffffffffffffffffffffffffffffffffffff166105c2565b6103cc61204e565b603e5473ffffffffffffffffffffffffffffffffffffffff166105c2565b610736610731366004613bd8565b612059565b60408051921515835260208301919091520161030e565b6103cc600181565b6103af610763366004613a2c565b612162565b6103af610776366004613d41565b612171565b6103af610789366004613a58565b61247b565b6103cc610325366004613b9f565b6103cc6107aa366004613a58565b73ffffffffffffffffffffffffffffffffffffffff1660009081526038602052604090205470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1690565b6103af610806366004613a58565b612682565b603f5473ffffffffffffffffffffffffffffffffffffffff166105c2565b6103cc7f323db0410fecc107e39e2af5908671f4c8d106123b35a51501bb805c5fa36aa081565b6103cc61085e366004613e16565b612860565b60405473ffffffffffffffffffffffffffffffffffffffff166105c2565b6060603b805461089090613e4b565b80601f01602080910402602001604051908101604052809291908181526020018280546108bc90613e4b565b80156109095780601f106108de57610100808354040283529160200191610909565b820191906000526020600020905b8154815290600101906020018083116108ec57829003601f168201915b5050505050905090565b604080518082018252600281527f3830000000000000000000000000000000000000000000000000000000000000602082015290517f08c379a000000000000000000000000000000000000000000000000000000000815260009161097a916004016139dd565b60405180910390fd5b60408051808201909152600281527f3737000000000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff8816610a05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b50834211156040518060400160405280600281526020017f373800000000000000000000000000000000000000000000000000000000000081525090610a78576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b5073ffffffffffffffffffffffffffffffffffffffff871660009081526034602052604081205490610aa86110de565b604080517f323db0410fecc107e39e2af5908671f4c8d106123b35a51501bb805c5fa36aa0602082015273ffffffffffffffffffffffffffffffffffffffff8b1691810191909152606081018990526080810184905260a0810188905260c00160405160208183030381529060405280519060200120604051602001610b609291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201206000845290830180835281905260ff8816918301919091526060820186905260808201859052915060019060a0016020604051602081039080840390855afa158015610be6573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600281526020017f373900000000000000000000000000000000000000000000000000000000000081525090610c8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b50610c98826001613ece565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260346020526040902055610cc9898989612925565b505050505050505050565b603e5473ffffffffffffffffffffffffffffffffffffffff163314610d55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f43414c4c45525f4e4f545f415f544f4b454e0000000000000000000000000000604482015260640161097a565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260416020526040902054610da190610d9c9083906fffffffffffffffffffffffffffffffff16613ee6565b61299c565b73ffffffffffffffffffffffffffffffffffffffff92909216600090815260416020526040902080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff9093169290921790915550565b6037546040517f386497fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152600091610ed0917f00000000000000000000000000000000000000000000000000000000000000009091169063386497fd90602401602060405180830381865afa158015610ea2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec69190613efd565b603a545b90612a42565b905090565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663707cd7166040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f669190613f16565b6040517f7be53ca100000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff821690637be53ca190602401602060405180830381865afa158015610fd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff79190613f33565b6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525090611065576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b50603f805473ffffffffffffffffffffffffffffffffffffffff8481167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f6b489e1dbfbe36f55c511c098bcc9d92fec7f04f74ceb75018697ab68f7d352990600090a3505050565b60007f000000000000000000000000000000000000000000000000000000000000000046141561110f575060355490565b610ed0612a99565b603f5473ffffffffffffffffffffffffffffffffffffffff163314611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f43414c4c45525f4e4f545f444953434f554e545f544f4b454e00000000000000604482015260640161097a565b73ffffffffffffffffffffffffffffffffffffffff8581166000908152603860205260408082205492871682528120546fffffffffffffffffffffffffffffffff92831692166037546040517f386497fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201529192506000917f00000000000000000000000000000000000000000000000000000000000000009091169063386497fd90602401602060405180830381865afa158015611275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112999190613efd565b905060008084156114455773ffffffffffffffffffffffffffffffffffffffff8a166000908152604160205260409020546112f0908b908790700100000000000000000000000000000000900461ffff1686612b5e565b90925090506113078a6113028361299c565b612d0a565b61139a8a61134d85610eca8e73ffffffffffffffffffffffffffffffffffffffff166000908152603860205260409020546fffffffffffffffffffffffffffffffff1690565b611357898c613ee6565b73ffffffffffffffffffffffffffffffffffffffff8e16600090815260416020526040902054700100000000000000000000000000000000900461ffff16612e86565b60405182815273ffffffffffffffffffffffffffffffffffffffff8b16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3604080518381526020810184905290810184905273ffffffffffffffffffffffffffffffffffffffff8b16906000907f458f5fa412d0f69b08dd84872b0215675cc67bc1d5b6fd93300a1c3878b861969060600160405180910390a35b83156115e85773ffffffffffffffffffffffffffffffffffffffff8916600090815260416020526040902054611497908a908690700100000000000000000000000000000000900461ffff1686612b5e565b90925090506114a9896113028361299c565b61153c896114ef85610eca8d73ffffffffffffffffffffffffffffffffffffffff166000908152603860205260409020546fffffffffffffffffffffffffffffffff1690565b6114f9898b613ece565b73ffffffffffffffffffffffffffffffffffffffff8d16600090815260416020526040902054700100000000000000000000000000000000900461ffff16612e86565b60405182815273ffffffffffffffffffffffffffffffffffffffff8a16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3604080518381526020810184905290810184905273ffffffffffffffffffffffffffffffffffffffff8a16906000907f458f5fa412d0f69b08dd84872b0215675cc67bc1d5b6fd93300a1c3878b86196906060015b60405180910390a35b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663707cd7166040518163ffffffff1660e01b8152600401602060405180830381865afa158015611661573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116859190613f16565b6040517f7be53ca100000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff821690637be53ca190602401602060405180830381865afa1580156116f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117169190613f33565b6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525090611784576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b50603e5473ffffffffffffffffffffffffffffffffffffffff1615611805576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f41544f4b454e5f414c52454144595f5345540000000000000000000000000000604482015260640161097a565b603e80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040517f07cba78d3a9bb0cf2cb0e30140558e278b50a2ba6da2e13369a0d9113034548b90600090a25050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663707cd7166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119069190613f16565b6040517f7be53ca100000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff821690637be53ca190602401602060405180830381865afa158015611973573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119979190613f33565b6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525090611a05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b506042805464ffffffffff8416909155604051839082907f64867d0decfd36e94606556e557637abfbbdf772282abaf94a20d65567e7f15b90600090a3505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152603860205260408120546fffffffffffffffffffffffffffffffff1680611a8d5750600092915050565b6037546040517f386497fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526000917f0000000000000000000000000000000000000000000000000000000000000000169063386497fd90602401602060405180830381865afa158015611b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b439190613efd565b73ffffffffffffffffffffffffffffffffffffffff85166000908152603860205260408120549192507001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff1690611b9e8484612a42565b905081831415611bb15795945050505050565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260416020526040902054700100000000000000000000000000000000900461ffff168015611c2a576000611c018685612a42565b611c0b9084613ee6565b90506000611c1982846130df565b9050611c258185613ee6565b935050505b5095945050505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526041602052604090205442720100000000000000000000000000000000000090910464ffffffffff16108015611cc7575073ffffffffffffffffffffffffffffffffffffffff81166000908152604160205260409020547201000000000000000000000000000000000000900464ffffffffff1615155b611d53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f444953434f554e545f50455243454e545f524542414c414e43455f434f4e444960448201527f54494f4e5f4e4f545f4d45540000000000000000000000000000000000000000606482015260840161097a565b6037546040517f386497fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526000917f0000000000000000000000000000000000000000000000000000000000000000169063386497fd90602401602060405180830381865afa158015611de5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e099190613efd565b90506000611e4b8373ffffffffffffffffffffffffffffffffffffffff166000908152603860205260409020546fffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff841660009081526041602052604081205491925070010000000000000000000000000000000090910461ffff169080611e9b86858588612b5e565b91509150611eac866113028361299c565b611f8d86611ef287610eca8a73ffffffffffffffffffffffffffffffffffffffff166000908152603860205260409020546fffffffffffffffffffffffffffffffff1690565b603f546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152909116906370a08231906024015b602060405180830381865afa158015611f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f879190613efd565b86612e86565b60405182815273ffffffffffffffffffffffffffffffffffffffff8716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3604080518381526020810184905290810186905273ffffffffffffffffffffffffffffffffffffffff8716906000907f458f5fa412d0f69b08dd84872b0215675cc67bc1d5b6fd93300a1c3878b861969060600160405180910390a3505050505050565b6060603c805461089090613e4b565b6000610ed0603a5490565b60408051808201909152600281527f323300000000000000000000000000000000000000000000000000000000000060208201526000908190337f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1614612102576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161461214157612141858786613122565b61214d868686866131e2565b61215561204e565b9150915094509492505050565b61216d338383612925565b5050565b6001805460ff16806121825750303b155b8061218e575060005481115b61221a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560448201527f656e20696e697469616c697a6564000000000000000000000000000000000000606482015260840161097a565b60015460ff1615801561225757600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168117905560008290555b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600281526020017f383700000000000000000000000000000000000000000000000000000000000081525090612314576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b5061231e86613486565b61232785613499565b603d80546037805473ffffffffffffffffffffffffffffffffffffffff8d81167fffffffffffffffffffffffff0000000000000000000000000000000000000000909216919091179091558a16610100027fffffffffffffffffffffff00000000000000000000000000000000000000000090911660ff8a16171790556123ac612a99565b6035819055507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f40251fbfb6656cfa65a00d7879029fec1fad21d28fdcff2f4f68f52795b74f2c8a8a8a8a8a8a60405161243996959493929190613f55565b60405180910390a380156115e857600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663707cd7166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250c9190613f16565b6040517f7be53ca100000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff821690637be53ca190602401602060405180830381865afa158015612579573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259d9190613f33565b6040518060400160405280600181526020017f31000000000000000000000000000000000000000000000000000000000000008152509061260b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b506040805473ffffffffffffffffffffffffffffffffffffffff8481167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117845592519116919082907f194bd59f47b230edccccc2be58b92dde3a5dadd835751a621af59006928bccef90600090a3505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663707cd7166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156126ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127139190613f16565b6040517f7be53ca100000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff821690637be53ca190602401602060405180830381865afa158015612780573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a49190613f33565b6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525090612812576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b5050603d805473ffffffffffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b60408051808201909152600281527f32330000000000000000000000000000000000000000000000000000000000006020820152600090337f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1614612907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b5061291584600085856134ac565b61291d61204e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526036602090815260408083208786168085529083529281902086905560375490518681529416939192917fda919360433220e13b51e8c211e490d148e61a3bd53de8c097194e458b97f3e1910160405180910390a4505050565b60006fffffffffffffffffffffffffffffffff821115612a3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f3238206269747300000000000000000000000000000000000000000000000000606482015260840161097a565b5090565b600081157ffffffffffffffffffffffffffffffffffffffffffe6268e1b017bfe18bffffff83900484111517612a7757600080fd5b506b033b2e3c9fd0803ce800000091026b019d971e4fe8401e74000000010490565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612ac46137a1565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b73ffffffffffffffffffffffffffffffffffffffff841660009081526038602052604081205481908190612bb990879070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16612a42565b612bc38786612a42565b612bcd9190613ee6565b905060008115801590612bdf57508515155b15612c23576000612bf083886130df565b905085612c096b033b2e3c9fd0803ce800000083613ff5565b612c139190614032565b9150612c1f8184613ee6565b9250505b612c2c8561299c565b73ffffffffffffffffffffffffffffffffffffffff8916600090815260386020908152604080832080546fffffffffffffffffffffffffffffffff958616700100000000000000000000000000000000029086161790556041909152902054612c9a91610d9c911684613ece565b73ffffffffffffffffffffffffffffffffffffffff98909816600090815260416020526040902080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff999099169890981790975596945050505050565b603a54612d296fffffffffffffffffffffffffffffffff831682613ee6565b603a5573ffffffffffffffffffffffffffffffffffffffff83166000908152603860205260409020546fffffffffffffffffffffffffffffffff16612d6e838261406d565b73ffffffffffffffffffffffffffffffffffffffff858116600090815260386020526040902080547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff9390931692909217909155603d546101009004168015612e7f576040517f31873e2e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152602482018590526fffffffffffffffffffffffffffffffff841660448301528216906331873e2e90606401600060405180830381600087803b158015612e6b57600080fd5b505af1158015610cc9573d6000803e3d6000fd5b5050505050565b6040805490517f93adbec5000000000000000000000000000000000000000000000000000000008152600481018590526024810184905260009173ffffffffffffffffffffffffffffffffffffffff16906393adbec590604401602060405180830381865afa158015612efd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f219190613efd565b90506000818314612fa457612f35826137ab565b73ffffffffffffffffffffffffffffffffffffffff87166000908152604160205260409020805461ffff92909216700100000000000000000000000000000000027fffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffff9092169190911790555060015b811561305b57600060425442612fba9190613ece565b73ffffffffffffffffffffffffffffffffffffffff881660008181526041602052604080822080547fffffffffffffffffff0000000000ffffffffffffffffffffffffffffffffffff16720100000000000000000000000000000000000064ffffffffff8716908102919091179091559051939450928692917e64587c5a31f27238607adbc3b89e1792f3993b55c2c0142273d9e491eac77791a4506130d7565b80156130d75773ffffffffffffffffffffffffffffffffffffffff861660008181526041602052604080822080547fffffffffffffffffff0000000000ffffffffffffffffffffffffffffffffffff16905551909184917e64587c5a31f27238607adbc3b89e1792f3993b55c2c0142273d9e491eac777908490a45b505050505050565b600081157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec778390048411151761311457600080fd5b506127109102611388010490565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152603660209081526040808320938616835292905290812054613162908390613ee6565b73ffffffffffffffffffffffffffffffffffffffff808616600081815260366020908152604080832089861680855292529182902085905560375491519495509216927fda919360433220e13b51e8c211e490d148e61a3bd53de8c097194e458b97f3e1906131d49086815260200190565b60405180910390a450505050565b6000806131ef848461383f565b60408051808201909152600281527f323400000000000000000000000000000000000000000000000000000000000060208201529091508161325e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b5073ffffffffffffffffffffffffffffffffffffffff851660009081526038602090815260408083205460419092528220546fffffffffffffffffffffffffffffffff9091169170010000000000000000000000000000000090910461ffff1690806132cc8985858a612b5e565b91509150808511156132f3576132ee896132e9610d9c8489613ee6565b61387e565b613304565b61330489611302610d9c8885613ee6565b6133a28961334a89610eca8d73ffffffffffffffffffffffffffffffffffffffff166000908152603860205260409020546fffffffffffffffffffffffffffffffff1690565b603f546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e81166004830152909116906370a0823190602401611f46565b60006133ae838a613ece565b90508973ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161341091815260200190565b60405180910390a3604080518281526020810185905290810189905273ffffffffffffffffffffffffffffffffffffffff808c1691908d16907f458f5fa412d0f69b08dd84872b0215675cc67bc1d5b6fd93300a1c3878b861969060600160405180910390a35050911598975050505050505050565b805161216d90603b9060208401906138e2565b805161216d90603c9060208401906138e2565b60006134b8838361383f565b60408051808201909152600281527f3235000000000000000000000000000000000000000000000000000000000000602082015290915081613527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a91906139dd565b5073ffffffffffffffffffffffffffffffffffffffff851660009081526038602090815260408083205460419092528220546fffffffffffffffffffffffffffffffff9091169170010000000000000000000000000000000090910461ffff16908061359589858589612b5e565b90925090506135ab89611302610d9c8489613ece565b6135f18961334a88610eca8d73ffffffffffffffffffffffffffffffffffffffff166000908152603860205260409020546fffffffffffffffffffffffffffffffff1690565b868211156136d05760006136058884613ee6565b90508973ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161366791815260200190565b60405180910390a3604080518281526020810185905290810188905273ffffffffffffffffffffffffffffffffffffffff8b169081907f458f5fa412d0f69b08dd84872b0215675cc67bc1d5b6fd93300a1c3878b861969060600160405180910390a350610cc9565b60006136dc8389613ee6565b9050600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161373e91815260200190565b60405180910390a3604080518281526020810185905290810188905273ffffffffffffffffffffffffffffffffffffffff808b1691908c16907f4cf25bc1d991c17529c25213d3cc0cda295eeaad5f13f361969b12ea48015f90906060016115df565b6060610ed0610881565b600061ffff821115612a3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f3620626974730000000000000000000000000000000000000000000000000000606482015260840161097a565b600081156b033b2e3c9fd0803ce80000006002840419048411171561386357600080fd5b506b033b2e3c9fd0803ce80000009190910260028204010490565b603a5461389d6fffffffffffffffffffffffffffffffff831682613ece565b603a5573ffffffffffffffffffffffffffffffffffffffff83166000908152603860205260409020546fffffffffffffffffffffffffffffffff16612d6e838261409e565b8280546138ee90613e4b565b90600052602060002090601f0160209004810192826139105760008555613956565b82601f1061392957805160ff1916838001178555613956565b82800160010185558215613956579182015b8281111561395657825182559160200191906001019061393b565b50612a3e9291505b80821115612a3e576000815560010161395e565b6000815180845260005b818110156139985760208185018101518683018201520161397c565b818111156139aa576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006139f06020830184613972565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff81168114613a1957600080fd5b50565b8035613a27816139f7565b919050565b60008060408385031215613a3f57600080fd5b8235613a4a816139f7565b946020939093013593505050565b600060208284031215613a6a57600080fd5b81356139f0816139f7565b803560ff81168114613a2757600080fd5b600080600080600080600060e0888a031215613aa157600080fd5b8735613aac816139f7565b96506020880135613abc816139f7565b95506040880135945060608801359350613ad860808901613a75565b925060a0880135915060c0880135905092959891949750929550565b600080600060608486031215613b0957600080fd5b8335613b14816139f7565b92506020840135613b24816139f7565b929592945050506040919091013590565b600080600080600060a08688031215613b4d57600080fd5b8535613b58816139f7565b94506020860135613b68816139f7565b94979496505050506040830135926060810135926080909101359150565b600060208284031215613b9857600080fd5b5035919050565b60008060408385031215613bb257600080fd5b8235613bbd816139f7565b91506020830135613bcd816139f7565b809150509250929050565b60008060008060808587031215613bee57600080fd5b8435613bf9816139f7565b93506020850135613c09816139f7565b93969395505050506040820135916060013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112613c5e57600080fd5b813567ffffffffffffffff80821115613c7957613c79613c1e565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715613cbf57613cbf613c1e565b81604052838152866020858801011115613cd857600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008083601f840112613d0a57600080fd5b50813567ffffffffffffffff811115613d2257600080fd5b602083019150836020828501011115613d3a57600080fd5b9250929050565b60008060008060008060008060e0898b031215613d5d57600080fd5b8835613d68816139f7565b97506020890135613d78816139f7565b9650613d8660408a01613a1c565b9550613d9460608a01613a75565b9450608089013567ffffffffffffffff80821115613db157600080fd5b613dbd8c838d01613c4d565b955060a08b0135915080821115613dd357600080fd5b613ddf8c838d01613c4d565b945060c08b0135915080821115613df557600080fd5b50613e028b828c01613cf8565b999c989b5096995094979396929594505050565b600080600060608486031215613e2b57600080fd5b8335613e36816139f7565b95602085013595506040909401359392505050565b600181811c90821680613e5f57607f821691505b60208210811415613e99577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115613ee157613ee1613e9f565b500190565b600082821015613ef857613ef8613e9f565b500390565b600060208284031215613f0f57600080fd5b5051919050565b600060208284031215613f2857600080fd5b81516139f0816139f7565b600060208284031215613f4557600080fd5b815180151581146139f057600080fd5b73ffffffffffffffffffffffffffffffffffffffff8716815260ff8616602082015260a060408201526000613f8d60a0830187613972565b8281036060840152613f9f8187613972565b905082810360808401528381528385602083013760006020858301015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f860116820101915050979650505050505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561402d5761402d613e9f565b500290565b600082614068577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006fffffffffffffffffffffffffffffffff8381169083168181101561409657614096613e9f565b039392505050565b60006fffffffffffffffffffffffffffffffff8083168185168083038211156140c9576140c9613e9f565b0194935050505056fea2646970667358221220f192fd60c94005258781df3f6ae4f05bade0cc46758b46961192a4755d4c2d1964736f6c634300080a0033'; - -type GhoVariableDebtTokenConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: GhoVariableDebtTokenConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class GhoVariableDebtToken__factory extends ContractFactory { - constructor(...args: GhoVariableDebtTokenConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override deploy( - pool: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise { - return super.deploy(pool, overrides || {}) as Promise; - } - override getDeployTransaction( - pool: string, - overrides?: Overrides & { from?: string | Promise }, - ): TransactionRequest { - return super.getDeployTransaction(pool, overrides || {}); - } - override attach(address: string): GhoVariableDebtToken { - return super.attach(address) as GhoVariableDebtToken; - } - override connect(signer: Signer): GhoVariableDebtToken__factory { - return super.connect(signer) as GhoVariableDebtToken__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): GhoVariableDebtTokenInterface { - return new utils.Interface(_abi) as GhoVariableDebtTokenInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider, - ): GhoVariableDebtToken { - return new Contract( - address, - _abi, - signerOrProvider, - ) as GhoVariableDebtToken; - } -} diff --git a/packages/contract-helpers/src/gho/typechain/IGhoDiscountRateStrategy.d.ts b/packages/contract-helpers/src/gho/typechain/IGhoDiscountRateStrategy.d.ts deleted file mode 100644 index 9065ff97..00000000 --- a/packages/contract-helpers/src/gho/typechain/IGhoDiscountRateStrategy.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { FunctionFragment, Result } from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, -} from '../../../../../../common'; - -export interface IGhoDiscountRateStrategyInterface extends utils.Interface { - functions: { - 'calculateDiscountRate(uint256,uint256)': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: 'calculateDiscountRate', - ): FunctionFragment; - - encodeFunctionData( - functionFragment: 'calculateDiscountRate', - values: [BigNumberish, BigNumberish], - ): string; - - decodeFunctionResult( - functionFragment: 'calculateDiscountRate', - data: BytesLike, - ): Result; - - events: {}; -} - -export interface IGhoDiscountRateStrategy extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: IGhoDiscountRateStrategyInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter, - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter, - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - }; - - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - callStatic: { - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise; - }; - - filters: {}; - - estimateGas: { - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise; - }; - - populateTransaction: { - calculateDiscountRate( - debtBalance: BigNumberish, - discountTokenBalance: BigNumberish, - overrides?: CallOverrides, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/gho/typechain/IGhoToken.d.ts b/packages/contract-helpers/src/gho/typechain/IGhoToken.d.ts deleted file mode 100644 index 67ec3fc1..00000000 --- a/packages/contract-helpers/src/gho/typechain/IGhoToken.d.ts +++ /dev/null @@ -1,467 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { - FunctionFragment, - Result, - EventFragment, -} from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, -} from '../../../../common'; - -export declare namespace IGhoToken { - export type BucketStruct = { maxCapacity: BigNumberish; level: BigNumberish }; - - export type BucketStructOutput = [BigNumber, BigNumber] & { - maxCapacity: BigNumber; - level: BigNumber; - }; - - export type FacilitatorStruct = { - bucket: IGhoToken.BucketStruct; - label: string; - }; - - export type FacilitatorStructOutput = [ - IGhoToken.BucketStructOutput, - string, - ] & { bucket: IGhoToken.BucketStructOutput; label: string }; -} - -export interface IGhoTokenInterface extends utils.Interface { - functions: { - 'addFacilitators(address[],((uint128,uint128),string)[])': FunctionFragment; - 'burn(uint256)': FunctionFragment; - 'getFacilitator(address)': FunctionFragment; - 'getFacilitatorBucket(address)': FunctionFragment; - 'getFacilitatorsList()': FunctionFragment; - 'mint(address,uint256)': FunctionFragment; - 'removeFacilitators(address[])': FunctionFragment; - 'setFacilitatorBucketCapacity(address,uint128)': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'addFacilitators' - | 'burn' - | 'getFacilitator' - | 'getFacilitatorBucket' - | 'getFacilitatorsList' - | 'mint' - | 'removeFacilitators' - | 'setFacilitatorBucketCapacity', - ): FunctionFragment; - - encodeFunctionData( - functionFragment: 'addFacilitators', - values: [string[], IGhoToken.FacilitatorStruct[]], - ): string; - encodeFunctionData(functionFragment: 'burn', values: [BigNumberish]): string; - encodeFunctionData( - functionFragment: 'getFacilitator', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getFacilitatorBucket', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getFacilitatorsList', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'mint', - values: [string, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'removeFacilitators', - values: [string[]], - ): string; - encodeFunctionData( - functionFragment: 'setFacilitatorBucketCapacity', - values: [string, BigNumberish], - ): string; - - decodeFunctionResult( - functionFragment: 'addFacilitators', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'burn', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'getFacilitator', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getFacilitatorBucket', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getFacilitatorsList', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'mint', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'removeFacilitators', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'setFacilitatorBucketCapacity', - data: BytesLike, - ): Result; - - events: { - 'BucketLevelChanged(address,uint256,uint256)': EventFragment; - 'FacilitatorAdded(address,string,uint256)': EventFragment; - 'FacilitatorBucketCapacityUpdated(address,uint256,uint256)': EventFragment; - 'FacilitatorRemoved(address)': EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: 'BucketLevelChanged'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'FacilitatorAdded'): EventFragment; - getEvent( - nameOrSignatureOrTopic: 'FacilitatorBucketCapacityUpdated', - ): EventFragment; - getEvent(nameOrSignatureOrTopic: 'FacilitatorRemoved'): EventFragment; -} - -export interface BucketLevelChangedEventObject { - facilitatorAaddress: string; - oldLevel: BigNumber; - newLevel: BigNumber; -} -export type BucketLevelChangedEvent = TypedEvent< - [string, BigNumber, BigNumber], - BucketLevelChangedEventObject ->; - -export type BucketLevelChangedEventFilter = - TypedEventFilter; - -export interface FacilitatorAddedEventObject { - facilitatorAddress: string; - label: string; - initialBucketCapacity: BigNumber; -} -export type FacilitatorAddedEvent = TypedEvent< - [string, string, BigNumber], - FacilitatorAddedEventObject ->; - -export type FacilitatorAddedEventFilter = - TypedEventFilter; - -export interface FacilitatorBucketCapacityUpdatedEventObject { - facilitatorAaddress: string; - oldCapacity: BigNumber; - newCapacity: BigNumber; -} -export type FacilitatorBucketCapacityUpdatedEvent = TypedEvent< - [string, BigNumber, BigNumber], - FacilitatorBucketCapacityUpdatedEventObject ->; - -export type FacilitatorBucketCapacityUpdatedEventFilter = - TypedEventFilter; - -export interface FacilitatorRemovedEventObject { - facilitatorAddress: string; -} -export type FacilitatorRemovedEvent = TypedEvent< - [string], - FacilitatorRemovedEventObject ->; - -export type FacilitatorRemovedEventFilter = - TypedEventFilter; - -export interface IGhoToken extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: IGhoTokenInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter, - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter, - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - burn( - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise<[IGhoToken.FacilitatorStructOutput]>; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise<[IGhoToken.BucketStructOutput]>; - - getFacilitatorsList(overrides?: CallOverrides): Promise<[string[]]>; - - mint( - account: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; - - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - burn( - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorsList(overrides?: CallOverrides): Promise; - - mint( - account: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - callStatic: { - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: CallOverrides, - ): Promise; - - burn(amount: BigNumberish, overrides?: CallOverrides): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorsList(overrides?: CallOverrides): Promise; - - mint( - account: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: CallOverrides, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: CallOverrides, - ): Promise; - }; - - filters: { - 'BucketLevelChanged(address,uint256,uint256)'( - facilitatorAaddress?: string | null, - oldLevel?: null, - newLevel?: null, - ): BucketLevelChangedEventFilter; - BucketLevelChanged( - facilitatorAaddress?: string | null, - oldLevel?: null, - newLevel?: null, - ): BucketLevelChangedEventFilter; - - 'FacilitatorAdded(address,string,uint256)'( - facilitatorAddress?: string | null, - label?: string | null, - initialBucketCapacity?: null, - ): FacilitatorAddedEventFilter; - FacilitatorAdded( - facilitatorAddress?: string | null, - label?: string | null, - initialBucketCapacity?: null, - ): FacilitatorAddedEventFilter; - - 'FacilitatorBucketCapacityUpdated(address,uint256,uint256)'( - facilitatorAaddress?: string | null, - oldCapacity?: null, - newCapacity?: null, - ): FacilitatorBucketCapacityUpdatedEventFilter; - FacilitatorBucketCapacityUpdated( - facilitatorAaddress?: string | null, - oldCapacity?: null, - newCapacity?: null, - ): FacilitatorBucketCapacityUpdatedEventFilter; - - 'FacilitatorRemoved(address)'( - facilitatorAddress?: string | null, - ): FacilitatorRemovedEventFilter; - FacilitatorRemoved( - facilitatorAddress?: string | null, - ): FacilitatorRemovedEventFilter; - }; - - estimateGas: { - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - burn( - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorsList(overrides?: CallOverrides): Promise; - - mint( - account: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; - - populateTransaction: { - addFacilitators( - facilitatorsAddresses: string[], - facilitatorsConfig: IGhoToken.FacilitatorStruct[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - burn( - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getFacilitator( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorBucket( - facilitator: string, - overrides?: CallOverrides, - ): Promise; - - getFacilitatorsList( - overrides?: CallOverrides, - ): Promise; - - mint( - account: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - removeFacilitators( - facilitators: string[], - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - setFacilitatorBucketCapacity( - facilitator: string, - newCapacity: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/gho/typechain/IGhoToken__factory.ts b/packages/contract-helpers/src/gho/typechain/IGhoToken__factory.ts deleted file mode 100644 index 06d34e8e..00000000 --- a/packages/contract-helpers/src/gho/typechain/IGhoToken__factory.ts +++ /dev/null @@ -1,301 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ - -import { Contract, Signer, utils } from 'ethers'; -import type { Provider } from '@ethersproject/providers'; -import type { IGhoToken, IGhoTokenInterface } from './IGhoToken'; - -const _abi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'facilitatorAaddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'oldLevel', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newLevel', - type: 'uint256', - }, - ], - name: 'BucketLevelChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'facilitatorAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'string', - name: 'label', - type: 'string', - }, - { - indexed: false, - internalType: 'uint256', - name: 'initialBucketCapacity', - type: 'uint256', - }, - ], - name: 'FacilitatorAdded', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'facilitatorAaddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'oldCapacity', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newCapacity', - type: 'uint256', - }, - ], - name: 'FacilitatorBucketCapacityUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'facilitatorAddress', - type: 'address', - }, - ], - name: 'FacilitatorRemoved', - type: 'event', - }, - { - inputs: [ - { - internalType: 'address[]', - name: 'facilitatorsAddresses', - type: 'address[]', - }, - { - components: [ - { - components: [ - { - internalType: 'uint128', - name: 'maxCapacity', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'level', - type: 'uint128', - }, - ], - internalType: 'struct IGhoToken.Bucket', - name: 'bucket', - type: 'tuple', - }, - { - internalType: 'string', - name: 'label', - type: 'string', - }, - ], - internalType: 'struct IGhoToken.Facilitator[]', - name: 'facilitatorsConfig', - type: 'tuple[]', - }, - ], - name: 'addFacilitators', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'burn', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'facilitator', - type: 'address', - }, - ], - name: 'getFacilitator', - outputs: [ - { - components: [ - { - components: [ - { - internalType: 'uint128', - name: 'maxCapacity', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'level', - type: 'uint128', - }, - ], - internalType: 'struct IGhoToken.Bucket', - name: 'bucket', - type: 'tuple', - }, - { - internalType: 'string', - name: 'label', - type: 'string', - }, - ], - internalType: 'struct IGhoToken.Facilitator', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'facilitator', - type: 'address', - }, - ], - name: 'getFacilitatorBucket', - outputs: [ - { - components: [ - { - internalType: 'uint128', - name: 'maxCapacity', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'level', - type: 'uint128', - }, - ], - internalType: 'struct IGhoToken.Bucket', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getFacilitatorsList', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'mint', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address[]', - name: 'facilitators', - type: 'address[]', - }, - ], - name: 'removeFacilitators', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'facilitator', - type: 'address', - }, - { - internalType: 'uint128', - name: 'newCapacity', - type: 'uint128', - }, - ], - name: 'setFacilitatorBucketCapacity', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -]; - -export class IGhoToken__factory { - static readonly abi = _abi; - static createInterface(): IGhoTokenInterface { - return new utils.Interface(_abi) as IGhoTokenInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider, - ): IGhoToken { - return new Contract(address, _abi, signerOrProvider) as IGhoToken; - } -} diff --git a/packages/contract-helpers/src/gho/typechain/IGhoVariableDebtToken.d.ts b/packages/contract-helpers/src/gho/typechain/IGhoVariableDebtToken.d.ts deleted file mode 100644 index 6817a3b9..00000000 --- a/packages/contract-helpers/src/gho/typechain/IGhoVariableDebtToken.d.ts +++ /dev/null @@ -1,1022 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BigNumberish, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from 'ethers'; -import type { - FunctionFragment, - Result, - EventFragment, -} from '@ethersproject/abi'; -import type { Listener, Provider } from '@ethersproject/providers'; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, -} from '../../../../../../common'; - -export interface IGhoVariableDebtTokenInterface extends utils.Interface { - functions: { - 'UNDERLYING_ASSET_ADDRESS()': FunctionFragment; - 'burn(address,uint256,uint256)': FunctionFragment; - 'decreaseBalanceFromInterest(address,uint256)': FunctionFragment; - 'getAToken()': FunctionFragment; - 'getBalanceFromInterest(address)': FunctionFragment; - 'getDiscountLockPeriod()': FunctionFragment; - 'getDiscountPercent(address)': FunctionFragment; - 'getDiscountRateStrategy()': FunctionFragment; - 'getDiscountToken()': FunctionFragment; - 'getPreviousIndex(address)': FunctionFragment; - 'getScaledUserBalanceAndSupply(address)': FunctionFragment; - 'getUserRebalanceTimestamp(address)': FunctionFragment; - 'initialize(address,address,address,uint8,string,string,bytes)': FunctionFragment; - 'mint(address,address,uint256,uint256)': FunctionFragment; - 'rebalanceUserDiscountPercent(address)': FunctionFragment; - 'scaledBalanceOf(address)': FunctionFragment; - 'scaledTotalSupply()': FunctionFragment; - 'setAToken(address)': FunctionFragment; - 'updateDiscountDistribution(address,address,uint256,uint256,uint256)': FunctionFragment; - 'updateDiscountLockPeriod(uint256)': FunctionFragment; - 'updateDiscountRateStrategy(address)': FunctionFragment; - 'updateDiscountToken(address)': FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | 'UNDERLYING_ASSET_ADDRESS' - | 'burn' - | 'decreaseBalanceFromInterest' - | 'getAToken' - | 'getBalanceFromInterest' - | 'getDiscountLockPeriod' - | 'getDiscountPercent' - | 'getDiscountRateStrategy' - | 'getDiscountToken' - | 'getPreviousIndex' - | 'getScaledUserBalanceAndSupply' - | 'getUserRebalanceTimestamp' - | 'initialize' - | 'mint' - | 'rebalanceUserDiscountPercent' - | 'scaledBalanceOf' - | 'scaledTotalSupply' - | 'setAToken' - | 'updateDiscountDistribution' - | 'updateDiscountLockPeriod' - | 'updateDiscountRateStrategy' - | 'updateDiscountToken', - ): FunctionFragment; - - encodeFunctionData( - functionFragment: 'UNDERLYING_ASSET_ADDRESS', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'burn', - values: [string, BigNumberish, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'decreaseBalanceFromInterest', - values: [string, BigNumberish], - ): string; - encodeFunctionData(functionFragment: 'getAToken', values?: undefined): string; - encodeFunctionData( - functionFragment: 'getBalanceFromInterest', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getDiscountLockPeriod', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'getDiscountPercent', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getDiscountRateStrategy', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'getDiscountToken', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'getPreviousIndex', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getScaledUserBalanceAndSupply', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getUserRebalanceTimestamp', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'initialize', - values: [string, string, string, BigNumberish, string, string, BytesLike], - ): string; - encodeFunctionData( - functionFragment: 'mint', - values: [string, string, BigNumberish, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'rebalanceUserDiscountPercent', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'scaledBalanceOf', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'scaledTotalSupply', - values?: undefined, - ): string; - encodeFunctionData(functionFragment: 'setAToken', values: [string]): string; - encodeFunctionData( - functionFragment: 'updateDiscountDistribution', - values: [string, string, BigNumberish, BigNumberish, BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'updateDiscountLockPeriod', - values: [BigNumberish], - ): string; - encodeFunctionData( - functionFragment: 'updateDiscountRateStrategy', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'updateDiscountToken', - values: [string], - ): string; - - decodeFunctionResult( - functionFragment: 'UNDERLYING_ASSET_ADDRESS', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'burn', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'decreaseBalanceFromInterest', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'getAToken', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'getBalanceFromInterest', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getDiscountLockPeriod', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getDiscountPercent', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getDiscountRateStrategy', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getDiscountToken', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getPreviousIndex', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getScaledUserBalanceAndSupply', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getUserRebalanceTimestamp', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'initialize', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'mint', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'rebalanceUserDiscountPercent', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'scaledBalanceOf', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'scaledTotalSupply', - data: BytesLike, - ): Result; - decodeFunctionResult(functionFragment: 'setAToken', data: BytesLike): Result; - decodeFunctionResult( - functionFragment: 'updateDiscountDistribution', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'updateDiscountLockPeriod', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'updateDiscountRateStrategy', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'updateDiscountToken', - data: BytesLike, - ): Result; - - events: { - 'ATokenSet(address)': EventFragment; - 'Burn(address,address,uint256,uint256,uint256)': EventFragment; - 'DiscountLockPeriodUpdated(uint256,uint256)': EventFragment; - 'DiscountPercentLocked(address,uint256,uint256)': EventFragment; - 'DiscountRateStrategyUpdated(address,address)': EventFragment; - 'DiscountTokenUpdated(address,address)': EventFragment; - 'Initialized(address,address,address,uint8,string,string,bytes)': EventFragment; - 'Mint(address,address,uint256,uint256,uint256)': EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: 'ATokenSet'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Burn'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'DiscountLockPeriodUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'DiscountPercentLocked'): EventFragment; - getEvent( - nameOrSignatureOrTopic: 'DiscountRateStrategyUpdated', - ): EventFragment; - getEvent(nameOrSignatureOrTopic: 'DiscountTokenUpdated'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Initialized'): EventFragment; - getEvent(nameOrSignatureOrTopic: 'Mint'): EventFragment; -} - -export interface ATokenSetEventObject { - aToken: string; -} -export type ATokenSetEvent = TypedEvent<[string], ATokenSetEventObject>; - -export type ATokenSetEventFilter = TypedEventFilter; - -export interface BurnEventObject { - from: string; - target: string; - value: BigNumber; - balanceIncrease: BigNumber; - index: BigNumber; -} -export type BurnEvent = TypedEvent< - [string, string, BigNumber, BigNumber, BigNumber], - BurnEventObject ->; - -export type BurnEventFilter = TypedEventFilter; - -export interface DiscountLockPeriodUpdatedEventObject { - oldDiscountLockPeriod: BigNumber; - newDiscountLockPeriod: BigNumber; -} -export type DiscountLockPeriodUpdatedEvent = TypedEvent< - [BigNumber, BigNumber], - DiscountLockPeriodUpdatedEventObject ->; - -export type DiscountLockPeriodUpdatedEventFilter = - TypedEventFilter; - -export interface DiscountPercentLockedEventObject { - user: string; - discountPercent: BigNumber; - rebalanceTimestamp: BigNumber; -} -export type DiscountPercentLockedEvent = TypedEvent< - [string, BigNumber, BigNumber], - DiscountPercentLockedEventObject ->; - -export type DiscountPercentLockedEventFilter = - TypedEventFilter; - -export interface DiscountRateStrategyUpdatedEventObject { - oldDiscountRateStrategy: string; - newDiscountRateStrategy: string; -} -export type DiscountRateStrategyUpdatedEvent = TypedEvent< - [string, string], - DiscountRateStrategyUpdatedEventObject ->; - -export type DiscountRateStrategyUpdatedEventFilter = - TypedEventFilter; - -export interface DiscountTokenUpdatedEventObject { - oldDiscountToken: string; - newDiscountToken: string; -} -export type DiscountTokenUpdatedEvent = TypedEvent< - [string, string], - DiscountTokenUpdatedEventObject ->; - -export type DiscountTokenUpdatedEventFilter = - TypedEventFilter; - -export interface InitializedEventObject { - underlyingAsset: string; - pool: string; - incentivesController: string; - debtTokenDecimals: number; - debtTokenName: string; - debtTokenSymbol: string; - params: string; -} -export type InitializedEvent = TypedEvent< - [string, string, string, number, string, string, string], - InitializedEventObject ->; - -export type InitializedEventFilter = TypedEventFilter; - -export interface MintEventObject { - caller: string; - onBehalfOf: string; - value: BigNumber; - balanceIncrease: BigNumber; - index: BigNumber; -} -export type MintEvent = TypedEvent< - [string, string, BigNumber, BigNumber, BigNumber], - MintEventObject ->; - -export type MintEventFilter = TypedEventFilter; - -export interface IGhoVariableDebtToken extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: IGhoVariableDebtTokenInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter, - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter, - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - UNDERLYING_ASSET_ADDRESS(overrides?: CallOverrides): Promise<[string]>; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise<[string]>; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - getDiscountLockPeriod(overrides?: CallOverrides): Promise<[BigNumber]>; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - getDiscountRateStrategy(overrides?: CallOverrides): Promise<[string]>; - - getDiscountToken(overrides?: CallOverrides): Promise<[string]>; - - getPreviousIndex( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber, BigNumber]>; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - initialize( - pool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - rebalanceUserDiscountPercent( - user: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - scaledBalanceOf( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber]>; - - scaledTotalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; - - setAToken( - ghoAToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; - - UNDERLYING_ASSET_ADDRESS(overrides?: CallOverrides): Promise; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountLockPeriod(overrides?: CallOverrides): Promise; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountRateStrategy(overrides?: CallOverrides): Promise; - - getDiscountToken(overrides?: CallOverrides): Promise; - - getPreviousIndex(user: string, overrides?: CallOverrides): Promise; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber, BigNumber]>; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise; - - initialize( - pool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - rebalanceUserDiscountPercent( - user: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - scaledBalanceOf(user: string, overrides?: CallOverrides): Promise; - - scaledTotalSupply(overrides?: CallOverrides): Promise; - - setAToken( - ghoAToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - callStatic: { - UNDERLYING_ASSET_ADDRESS(overrides?: CallOverrides): Promise; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountLockPeriod(overrides?: CallOverrides): Promise; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountRateStrategy(overrides?: CallOverrides): Promise; - - getDiscountToken(overrides?: CallOverrides): Promise; - - getPreviousIndex( - user: string, - overrides?: CallOverrides, - ): Promise; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise<[BigNumber, BigNumber]>; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise; - - initialize( - pool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: CallOverrides, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: CallOverrides, - ): Promise<[boolean, BigNumber]>; - - rebalanceUserDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - scaledBalanceOf( - user: string, - overrides?: CallOverrides, - ): Promise; - - scaledTotalSupply(overrides?: CallOverrides): Promise; - - setAToken(ghoAToken: string, overrides?: CallOverrides): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: CallOverrides, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: CallOverrides, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: CallOverrides, - ): Promise; - }; - - filters: { - 'ATokenSet(address)'(aToken?: string | null): ATokenSetEventFilter; - ATokenSet(aToken?: string | null): ATokenSetEventFilter; - - 'Burn(address,address,uint256,uint256,uint256)'( - from?: string | null, - target?: string | null, - value?: null, - balanceIncrease?: null, - index?: null, - ): BurnEventFilter; - Burn( - from?: string | null, - target?: string | null, - value?: null, - balanceIncrease?: null, - index?: null, - ): BurnEventFilter; - - 'DiscountLockPeriodUpdated(uint256,uint256)'( - oldDiscountLockPeriod?: BigNumberish | null, - newDiscountLockPeriod?: BigNumberish | null, - ): DiscountLockPeriodUpdatedEventFilter; - DiscountLockPeriodUpdated( - oldDiscountLockPeriod?: BigNumberish | null, - newDiscountLockPeriod?: BigNumberish | null, - ): DiscountLockPeriodUpdatedEventFilter; - - 'DiscountPercentLocked(address,uint256,uint256)'( - user?: string | null, - discountPercent?: BigNumberish | null, - rebalanceTimestamp?: BigNumberish | null, - ): DiscountPercentLockedEventFilter; - DiscountPercentLocked( - user?: string | null, - discountPercent?: BigNumberish | null, - rebalanceTimestamp?: BigNumberish | null, - ): DiscountPercentLockedEventFilter; - - 'DiscountRateStrategyUpdated(address,address)'( - oldDiscountRateStrategy?: string | null, - newDiscountRateStrategy?: string | null, - ): DiscountRateStrategyUpdatedEventFilter; - DiscountRateStrategyUpdated( - oldDiscountRateStrategy?: string | null, - newDiscountRateStrategy?: string | null, - ): DiscountRateStrategyUpdatedEventFilter; - - 'DiscountTokenUpdated(address,address)'( - oldDiscountToken?: string | null, - newDiscountToken?: string | null, - ): DiscountTokenUpdatedEventFilter; - DiscountTokenUpdated( - oldDiscountToken?: string | null, - newDiscountToken?: string | null, - ): DiscountTokenUpdatedEventFilter; - - 'Initialized(address,address,address,uint8,string,string,bytes)'( - underlyingAsset?: string | null, - pool?: string | null, - incentivesController?: null, - debtTokenDecimals?: null, - debtTokenName?: null, - debtTokenSymbol?: null, - params?: null, - ): InitializedEventFilter; - Initialized( - underlyingAsset?: string | null, - pool?: string | null, - incentivesController?: null, - debtTokenDecimals?: null, - debtTokenName?: null, - debtTokenSymbol?: null, - params?: null, - ): InitializedEventFilter; - - 'Mint(address,address,uint256,uint256,uint256)'( - caller?: string | null, - onBehalfOf?: string | null, - value?: null, - balanceIncrease?: null, - index?: null, - ): MintEventFilter; - Mint( - caller?: string | null, - onBehalfOf?: string | null, - value?: null, - balanceIncrease?: null, - index?: null, - ): MintEventFilter; - }; - - estimateGas: { - UNDERLYING_ASSET_ADDRESS(overrides?: CallOverrides): Promise; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountLockPeriod(overrides?: CallOverrides): Promise; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountRateStrategy(overrides?: CallOverrides): Promise; - - getDiscountToken(overrides?: CallOverrides): Promise; - - getPreviousIndex( - user: string, - overrides?: CallOverrides, - ): Promise; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise; - - initialize( - pool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - rebalanceUserDiscountPercent( - user: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - scaledBalanceOf( - user: string, - overrides?: CallOverrides, - ): Promise; - - scaledTotalSupply(overrides?: CallOverrides): Promise; - - setAToken( - ghoAToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; - - populateTransaction: { - UNDERLYING_ASSET_ADDRESS( - overrides?: CallOverrides, - ): Promise; - - burn( - from: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - decreaseBalanceFromInterest( - user: string, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - getAToken(overrides?: CallOverrides): Promise; - - getBalanceFromInterest( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountLockPeriod( - overrides?: CallOverrides, - ): Promise; - - getDiscountPercent( - user: string, - overrides?: CallOverrides, - ): Promise; - - getDiscountRateStrategy( - overrides?: CallOverrides, - ): Promise; - - getDiscountToken(overrides?: CallOverrides): Promise; - - getPreviousIndex( - user: string, - overrides?: CallOverrides, - ): Promise; - - getScaledUserBalanceAndSupply( - user: string, - overrides?: CallOverrides, - ): Promise; - - getUserRebalanceTimestamp( - user: string, - overrides?: CallOverrides, - ): Promise; - - initialize( - pool: string, - underlyingAsset: string, - incentivesController: string, - debtTokenDecimals: BigNumberish, - debtTokenName: string, - debtTokenSymbol: string, - params: BytesLike, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - mint( - user: string, - onBehalfOf: string, - amount: BigNumberish, - index: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - rebalanceUserDiscountPercent( - user: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - scaledBalanceOf( - user: string, - overrides?: CallOverrides, - ): Promise; - - scaledTotalSupply(overrides?: CallOverrides): Promise; - - setAToken( - ghoAToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountDistribution( - sender: string, - recipient: string, - senderDiscountTokenBalance: BigNumberish, - recipientDiscountTokenBalance: BigNumberish, - amount: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountLockPeriod( - newLockPeriod: BigNumberish, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountRateStrategy( - newDiscountRateStrategy: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - - updateDiscountToken( - newDiscountToken: string, - overrides?: Overrides & { from?: string | Promise }, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/gho/typechain/IGhoVariableDebtToken__factory.ts b/packages/contract-helpers/src/gho/typechain/IGhoVariableDebtToken__factory.ts deleted file mode 100644 index 79038f66..00000000 --- a/packages/contract-helpers/src/gho/typechain/IGhoVariableDebtToken__factory.ts +++ /dev/null @@ -1,671 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ - -import { Contract, Signer, utils } from 'ethers'; -import type { Provider } from '@ethersproject/providers'; -import type { - IGhoVariableDebtToken, - IGhoVariableDebtTokenInterface, -} from './IGhoVariableDebtToken'; - -const _abi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'aToken', - type: 'address', - }, - ], - name: 'ATokenSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'target', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'balanceIncrease', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'Burn', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'oldDiscountLockPeriod', - type: 'uint256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'newDiscountLockPeriod', - type: 'uint256', - }, - ], - name: 'DiscountLockPeriodUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'user', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'discountPercent', - type: 'uint256', - }, - { - indexed: true, - internalType: 'uint256', - name: 'rebalanceTimestamp', - type: 'uint256', - }, - ], - name: 'DiscountPercentLocked', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oldDiscountRateStrategy', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newDiscountRateStrategy', - type: 'address', - }, - ], - name: 'DiscountRateStrategyUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'oldDiscountToken', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newDiscountToken', - type: 'address', - }, - ], - name: 'DiscountTokenUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: false, - internalType: 'address', - name: 'incentivesController', - type: 'address', - }, - { - indexed: false, - internalType: 'uint8', - name: 'debtTokenDecimals', - type: 'uint8', - }, - { - indexed: false, - internalType: 'string', - name: 'debtTokenName', - type: 'string', - }, - { - indexed: false, - internalType: 'string', - name: 'debtTokenSymbol', - type: 'string', - }, - { - indexed: false, - internalType: 'bytes', - name: 'params', - type: 'bytes', - }, - ], - name: 'Initialized', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'caller', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'onBehalfOf', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'balanceIncrease', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'Mint', - type: 'event', - }, - { - inputs: [], - name: 'UNDERLYING_ASSET_ADDRESS', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'burn', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'decreaseBalanceFromInterest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'getAToken', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getBalanceFromInterest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getDiscountLockPeriod', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getDiscountPercent', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getDiscountRateStrategy', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getDiscountToken', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getPreviousIndex', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getScaledUserBalanceAndSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getUserRebalanceTimestamp', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract IPool', - name: 'pool', - type: 'address', - }, - { - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - internalType: 'contract IAaveIncentivesController', - name: 'incentivesController', - type: 'address', - }, - { - internalType: 'uint8', - name: 'debtTokenDecimals', - type: 'uint8', - }, - { - internalType: 'string', - name: 'debtTokenName', - type: 'string', - }, - { - internalType: 'string', - name: 'debtTokenSymbol', - type: 'string', - }, - { - internalType: 'bytes', - name: 'params', - type: 'bytes', - }, - ], - name: 'initialize', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - { - internalType: 'address', - name: 'onBehalfOf', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'mint', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'rebalanceUserDiscountPercent', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'scaledBalanceOf', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'scaledTotalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'ghoAToken', - type: 'address', - }, - ], - name: 'setAToken', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - internalType: 'address', - name: 'recipient', - type: 'address', - }, - { - internalType: 'uint256', - name: 'senderDiscountTokenBalance', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'recipientDiscountTokenBalance', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'updateDiscountDistribution', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'newLockPeriod', - type: 'uint256', - }, - ], - name: 'updateDiscountLockPeriod', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'newDiscountRateStrategy', - type: 'address', - }, - ], - name: 'updateDiscountRateStrategy', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'newDiscountToken', - type: 'address', - }, - ], - name: 'updateDiscountToken', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -]; - -export class IGhoVariableDebtToken__factory { - static readonly abi = _abi; - static createInterface(): IGhoVariableDebtTokenInterface { - return new utils.Interface(_abi) as IGhoVariableDebtTokenInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider, - ): IGhoVariableDebtToken { - return new Contract( - address, - _abi, - signerOrProvider, - ) as IGhoVariableDebtToken; - } -} diff --git a/packages/contract-helpers/src/gho/typechain/IUiGhoDataProvider.d.ts b/packages/contract-helpers/src/gho/typechain/IUiGhoDataProvider.d.ts index 88a8752b..0ddb11f0 100644 --- a/packages/contract-helpers/src/gho/typechain/IUiGhoDataProvider.d.ts +++ b/packages/contract-helpers/src/gho/typechain/IUiGhoDataProvider.d.ts @@ -17,20 +17,21 @@ import type { TypedEvent, TypedListener, OnEvent, -} from '../../../../common'; + PromiseOrValue, +} from '../../../../../../common'; export declare namespace IUiGhoDataProvider { export type GhoReserveDataStruct = { - ghoBaseVariableBorrowRate: BigNumberish; - ghoDiscountedPerToken: BigNumberish; - ghoDiscountRate: BigNumberish; - ghoDiscountLockPeriod: BigNumberish; - ghoMinDebtTokenBalanceForDiscount: BigNumberish; - ghoMinDiscountTokenBalanceForDiscount: BigNumberish; - ghoReserveLastUpdateTimestamp: BigNumberish; - ghoCurrentBorrowIndex: BigNumberish; - aaveFacilitatorBucketLevel: BigNumberish; - aaveFacilitatorBucketMaxCapacity: BigNumberish; + ghoBaseVariableBorrowRate: PromiseOrValue; + ghoDiscountedPerToken: PromiseOrValue; + ghoDiscountRate: PromiseOrValue; + ghoDiscountLockPeriod: PromiseOrValue; + ghoMinDebtTokenBalanceForDiscount: PromiseOrValue; + ghoMinDiscountTokenBalanceForDiscount: PromiseOrValue; + ghoReserveLastUpdateTimestamp: PromiseOrValue; + ghoCurrentBorrowIndex: PromiseOrValue; + aaveFacilitatorBucketLevel: PromiseOrValue; + aaveFacilitatorBucketMaxCapacity: PromiseOrValue; }; export type GhoReserveDataStructOutput = [ @@ -58,11 +59,11 @@ export declare namespace IUiGhoDataProvider { }; export type GhoUserDataStruct = { - userGhoDiscountRate: BigNumberish; - userDiscountTokenBalance: BigNumberish; - userPreviousGhoBorrowIndex: BigNumberish; - userGhoScaledBorrowBalance: BigNumberish; - userDiscountLockPeriodEndTimestamp: BigNumberish; + userGhoDiscountPercent: PromiseOrValue; + userDiscountTokenBalance: PromiseOrValue; + userPreviousGhoBorrowIndex: PromiseOrValue; + userGhoScaledBorrowBalance: PromiseOrValue; + userDiscountLockPeriodEndTimestamp: PromiseOrValue; }; export type GhoUserDataStructOutput = [ @@ -72,7 +73,7 @@ export declare namespace IUiGhoDataProvider { BigNumber, BigNumber, ] & { - userGhoDiscountRate: BigNumber; + userGhoDiscountPercent: BigNumber; userDiscountTokenBalance: BigNumber; userPreviousGhoBorrowIndex: BigNumber; userGhoScaledBorrowBalance: BigNumber; @@ -96,7 +97,7 @@ export interface IUiGhoDataProviderInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: 'getGhoUserData', - values: [string], + values: [PromiseOrValue], ): string; decodeFunctionResult( @@ -143,7 +144,7 @@ export interface IUiGhoDataProvider extends BaseContract { ): Promise<[IUiGhoDataProvider.GhoReserveDataStructOutput]>; getGhoUserData( - user: string, + user: PromiseOrValue, overrides?: CallOverrides, ): Promise<[IUiGhoDataProvider.GhoUserDataStructOutput]>; }; @@ -153,7 +154,7 @@ export interface IUiGhoDataProvider extends BaseContract { ): Promise; getGhoUserData( - user: string, + user: PromiseOrValue, overrides?: CallOverrides, ): Promise; @@ -163,7 +164,7 @@ export interface IUiGhoDataProvider extends BaseContract { ): Promise; getGhoUserData( - user: string, + user: PromiseOrValue, overrides?: CallOverrides, ): Promise; }; @@ -173,14 +174,17 @@ export interface IUiGhoDataProvider extends BaseContract { estimateGas: { getGhoReserveData(overrides?: CallOverrides): Promise; - getGhoUserData(user: string, overrides?: CallOverrides): Promise; + getGhoUserData( + user: PromiseOrValue, + overrides?: CallOverrides, + ): Promise; }; populateTransaction: { getGhoReserveData(overrides?: CallOverrides): Promise; getGhoUserData( - user: string, + user: PromiseOrValue, overrides?: CallOverrides, ): Promise; }; diff --git a/packages/contract-helpers/src/gho/typechain/IUiGhoDataProvider__factory.ts b/packages/contract-helpers/src/gho/typechain/IUiGhoDataProvider__factory.ts index 40616f58..93b1ef94 100644 --- a/packages/contract-helpers/src/gho/typechain/IUiGhoDataProvider__factory.ts +++ b/packages/contract-helpers/src/gho/typechain/IUiGhoDataProvider__factory.ts @@ -56,14 +56,14 @@ const _abi = [ type: 'uint128', }, { - internalType: 'uint128', + internalType: 'uint256', name: 'aaveFacilitatorBucketLevel', - type: 'uint128', + type: 'uint256', }, { - internalType: 'uint128', + internalType: 'uint256', name: 'aaveFacilitatorBucketMaxCapacity', - type: 'uint128', + type: 'uint256', }, ], internalType: 'struct IUiGhoDataProvider.GhoReserveData', @@ -88,7 +88,7 @@ const _abi = [ components: [ { internalType: 'uint256', - name: 'userGhoDiscountRate', + name: 'userGhoDiscountPercent', type: 'uint256', }, { @@ -120,7 +120,7 @@ const _abi = [ stateMutability: 'view', type: 'function', }, -]; +] as const; export class IUiGhoDataProvider__factory { static readonly abi = _abi; diff --git a/packages/contract-helpers/src/gho/types.ts b/packages/contract-helpers/src/gho/types.ts index e07d31be..d21c604b 100644 --- a/packages/contract-helpers/src/gho/types.ts +++ b/packages/contract-helpers/src/gho/types.ts @@ -12,7 +12,7 @@ export interface GhoReserveData { } export interface GhoUserData { - userGhoDiscountRate: string; + userGhoDiscountPercent: string; userDiscountTokenBalance: string; userPreviousGhoBorrowIndex: string; userGhoScaledBorrowBalance: string; diff --git a/packages/contract-helpers/src/governance-contract/governance.test.ts b/packages/contract-helpers/src/governance-contract/governance.test.ts index c7642a00..d7583da3 100644 --- a/packages/contract-helpers/src/governance-contract/governance.test.ts +++ b/packages/contract-helpers/src/governance-contract/governance.test.ts @@ -1,5 +1,11 @@ import { BigNumber, providers, utils } from 'ethers'; -import { eEthereumTxType, GasType, transactionType } from '../commons/types'; +import { + eEthereumTxType, + GasType, + ProtocolAction, + transactionType, +} from '../commons/types'; +import { gasLimitRecommendations } from '../commons/utils'; import { IAaveGovernanceV2 } from './typechain/IAaveGovernanceV2'; import { IAaveGovernanceV2__factory } from './typechain/IAaveGovernanceV2__factory'; import { IGovernanceStrategy } from './typechain/IGovernanceStrategy'; @@ -153,7 +159,11 @@ describe('GovernanceService', () => { const tx: transactionType = await voteTxObj[0].tx(); expect(tx.to).toEqual(GOVERNANCE_ADDRESS); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.vote].recommended, + ), + ); const decoded = utils.defaultAbiCoder.decode( ['uint256', 'bool'], @@ -166,7 +176,9 @@ describe('GovernanceService', () => { // gas price const gasPrice: GasType | null = await voteTxObj[0].gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.vote].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects to fail when gov address not eth address', () => { diff --git a/packages/contract-helpers/src/governance-contract/index.ts b/packages/contract-helpers/src/governance-contract/index.ts index 6dec20f8..97fdb1c2 100644 --- a/packages/contract-helpers/src/governance-contract/index.ts +++ b/packages/contract-helpers/src/governance-contract/index.ts @@ -4,6 +4,7 @@ import BaseService from '../commons/BaseService'; import { eEthereumTxType, EthereumTransactionTypeExtended, + ProtocolAction, transactionType, } from '../commons/types'; import { @@ -114,12 +115,13 @@ export class AaveGovernanceService rawTxMethod: async () => govContract.populateTransaction.submitVote(proposalId, support), from: user, + action: ProtocolAction.vote, }); txs.push({ tx: txCallback, txType: eEthereumTxType.GOVERNANCE_ACTION, - gas: this.generateTxPriceEstimation(txs, txCallback), + gas: this.generateTxPriceEstimation(txs, txCallback, ProtocolAction.vote), }); return txs; } diff --git a/packages/contract-helpers/src/lendingPool-contract/index.ts b/packages/contract-helpers/src/lendingPool-contract/index.ts index 6885b2f6..5fb47163 100644 --- a/packages/contract-helpers/src/lendingPool-contract/index.ts +++ b/packages/contract-helpers/src/lendingPool-contract/index.ts @@ -261,6 +261,7 @@ export class LendingPool ), from: user, value: getTxValue(reserve, convertedAmount), + action: ProtocolAction.deposit, }); txs.push({ @@ -391,13 +392,18 @@ export class LendingPool onBehalfOf ?? user, ), from: user, + action: ProtocolAction.borrow, }); return [ { tx: txCallback, txType: eEthereumTxType.DLP_ACTION, - gas: this.generateTxPriceEstimation([], txCallback), + gas: this.generateTxPriceEstimation( + [], + txCallback, + ProtocolAction.borrow, + ), }, ]; } @@ -475,6 +481,7 @@ export class LendingPool ), from: user, value: getTxValue(reserve, convertedAmount), + action: ProtocolAction.repay, }); txs.push({ @@ -731,6 +738,7 @@ export class LendingPool referralCode ?? '0', ), from: user, + action: ProtocolAction.swapCollateral, }); txs.push({ @@ -881,6 +889,7 @@ export class LendingPool referralCode ?? '0', ), from: user, + action: ProtocolAction.repayCollateral, }); txs.push({ @@ -1045,6 +1054,7 @@ export class LendingPool referralCode ?? '0', ), from: user, + action: ProtocolAction.repayCollateral, }); txs.push({ diff --git a/packages/contract-helpers/src/lendingPool-contract/lendingPool.test.ts b/packages/contract-helpers/src/lendingPool-contract/lendingPool.test.ts index b4ccd469..eb411847 100644 --- a/packages/contract-helpers/src/lendingPool-contract/lendingPool.test.ts +++ b/packages/contract-helpers/src/lendingPool-contract/lendingPool.test.ts @@ -115,7 +115,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.deposit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -131,8 +135,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.deposit].recommended, + ); }); it('Expects the tx object passing all parameters but not onBehalfOf', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -164,7 +170,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.deposit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -180,8 +190,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.deposit].recommended, + ); }); it('Expects the tx object passing all parameters but not referral', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -213,7 +225,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.deposit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -229,8 +245,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.deposit].recommended, + ); }); it('Expects the tx object passing all parameters and needing approval', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -274,7 +292,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.deposit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -291,7 +313,9 @@ describe('LendingPool', () => { const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); expect(gasPrice?.gasLimit).toEqual('300000'); - expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.deposit].recommended, + ); }); it('Expects to fail when passing all params and depositing Synthetix but amount not valid', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -470,7 +494,9 @@ describe('LendingPool', () => { expect(gasPrice?.gasLimit).toEqual( gasLimitRecommendations[ProtocolAction.withdraw].recommended, ); - expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.withdraw].recommended, + ); }); it('Expects the tx object passing all params and -1 amount', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -516,7 +542,9 @@ describe('LendingPool', () => { expect(gasPrice?.gasLimit).toEqual( gasLimitRecommendations[ProtocolAction.withdraw].recommended, ); - expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.withdraw].recommended, + ); }); it('Expects to fail for eth withdraw if not aTokenAddress is passed', async () => { const reserve = API_ETH_MOCK_ADDRESS; @@ -687,7 +715,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ), + ); const decoded = utils.defaultAbiCoder.decode( ['address', 'uint256', 'uint256', 'uint16', 'address'], @@ -703,8 +735,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ); }); it('Expects the tx object passing all parameters but not referralCode and rate stable', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -731,7 +765,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ), + ); const decoded = utils.defaultAbiCoder.decode( ['address', 'uint256', 'uint256', 'uint16', 'address'], @@ -747,8 +785,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ); }); it('Expects the tx object passing all parameters with Interest rate Variable', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -775,7 +815,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ), + ); const decoded = utils.defaultAbiCoder.decode( ['address', 'uint256', 'uint256', 'uint16', 'address'], @@ -791,8 +835,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ); }); it('Expects to fail when borrowing eth and not passing debtTokenAddress', async () => { const reserve = API_ETH_MOCK_ADDRESS; @@ -982,7 +1028,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -998,10 +1048,12 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ); }); - it('Expects the tx object passing all params with amount -1 with approve needed and reate stable', async () => { + it('Expects the tx object passing all params with amount -1 with approve needed and rate stable', async () => { const lendingPoolInstance = new LendingPool(provider, config); const isApprovedSpy = jest .spyOn(lendingPoolInstance.erc20Service, 'isApproved') @@ -1045,7 +1097,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1064,7 +1120,9 @@ describe('LendingPool', () => { expect(gasPrice?.gasLimit).toEqual( gasLimitRecommendations[ProtocolAction.repay].limit, ); - expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ); }); it('Expects the tx object passing all params with with specific amount and synthetix repayment with valid amount and rate variable', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -1109,7 +1167,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1128,7 +1190,9 @@ describe('LendingPool', () => { expect(gasPrice?.gasLimit).toEqual( gasLimitRecommendations[ProtocolAction.repay].limit, ); - expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ); }); it('Expects to fail passing all params with with specific amount and synthetix repayment but not valid amount', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -1246,7 +1310,7 @@ describe('LendingPool', () => { afterEach(() => { jest.clearAllMocks(); }); - it('Expects the tx object passing all params with Inerest rate None', async () => { + it('Expects the tx object passing all params with Interest rate None', async () => { const lendingPoolInstance = new LendingPool(provider, config); const swapBorrowRateModeTxObj = lendingPoolInstance.swapBorrowRateMode({ @@ -1279,7 +1343,7 @@ describe('LendingPool', () => { expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); }); - it('Expects the tx object passing all params with Inerest rate Stable', async () => { + it('Expects the tx object passing all params with Interest rate Stable', async () => { const lendingPoolInstance = new LendingPool(provider, config); const interestRateMode = InterestRate.Stable; const swapBorrowRateModeTxObj = lendingPoolInstance.swapBorrowRateMode({ @@ -1312,7 +1376,7 @@ describe('LendingPool', () => { expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); }); - it('Expects the tx object passing all params with Inerest rate Variable', async () => { + it('Expects the tx object passing all params with Interest rate Variable', async () => { const lendingPoolInstance = new LendingPool(provider, config); const interestRateMode = InterestRate.Variable; const swapBorrowRateModeTxObj = lendingPoolInstance.swapBorrowRateMode({ @@ -1849,7 +1913,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1906,7 +1974,9 @@ describe('LendingPool', () => { expect(gasPrice?.gasLimit).toEqual( gasLimitRecommendations[ProtocolAction.swapCollateral].limit, ); - expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ); }); it('Expects the tx object passing all params without onBehalf and no approval needed for flash', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -1943,7 +2013,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1997,8 +2071,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ); }); it('Expects the tx object passing all params without referralCode and no approval needed for flash', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -2035,7 +2111,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2089,8 +2169,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ); }); it('Expects the tx object passing all params and no approval needed with flash and no swapAll', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -2128,7 +2210,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2182,8 +2268,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ); }); it('Expects the tx object passing all params without permitSignature and no approval needed without flash', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -2571,7 +2659,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2628,7 +2720,9 @@ describe('LendingPool', () => { expect(gasPrice?.gasLimit).toEqual( gasLimitRecommendations[ProtocolAction.repayCollateral].limit, ); - expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no approval needed for flash with rate mode Stable', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -2667,7 +2761,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2721,8 +2819,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no approval needed for flash with rate mode Variable', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -2761,7 +2861,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2815,8 +2919,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no approval needed for flash without onBehalfOf', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -2854,7 +2960,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2908,8 +3018,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no approval needed for flash without referralCode', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -2947,7 +3059,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -3001,8 +3117,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no approval needed for flash without useEthPath', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -3040,7 +3158,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -3094,8 +3216,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no approval needed without flash and not repayAllDebt', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -3133,7 +3257,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -3187,8 +3315,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no permitSignature, and no flash', async () => { const lendingPoolInstance = new LendingPool(provider, config); @@ -3916,7 +4046,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4015,7 +4149,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4071,7 +4209,9 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no approval needed for flash with rate mode Variable', async () => { @@ -4112,7 +4252,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4168,7 +4312,9 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no approval needed for flash without onBehalfOf', async () => { @@ -4208,7 +4354,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4264,7 +4414,9 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no approval needed for flash without referralCode', async () => { @@ -4304,7 +4456,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4360,8 +4516,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no approval needed without flash and not repayAllDebt', async () => { const poolInstance = new LendingPool(provider, config); @@ -4400,7 +4558,11 @@ describe('LendingPool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(LENDING_POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4456,8 +4618,10 @@ describe('LendingPool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); }); it('Expects the tx object passing all params and no permitSignature, and no flash', async () => { const poolInstance = new LendingPool(provider, config); diff --git a/packages/contract-helpers/src/v3-migration-contract/index.ts b/packages/contract-helpers/src/v3-migration-contract/index.ts index f50ffa99..3d1b06b4 100644 --- a/packages/contract-helpers/src/v3-migration-contract/index.ts +++ b/packages/contract-helpers/src/v3-migration-contract/index.ts @@ -1,4 +1,8 @@ import { constants, providers, utils } from 'ethers'; +import { + BaseDebtToken, + BaseDebtTokenInterface, +} from '../baseDebtToken-contract'; import BaseService from '../commons/BaseService'; import { eEthereumTxType, @@ -8,37 +12,32 @@ import { tEthereumAddress, transactionType, } from '../commons/types'; -import { valueToWei } from '../commons/utils'; import { V3MigratorValidator } from '../commons/validators/methodValidators'; import { isEthAddress } from '../commons/validators/paramValidators'; import { ERC20Service } from '../erc20-contract'; import { Pool } from '../v3-pool-contract'; -import { MigrationHelper__factory, MigrationHelper } from './typechain'; -import { IMigrationHelper } from './typechain/MigrationHelper'; +import { IMigrationHelper } from './typechain/IMigrationHelper'; +import { IMigrationHelper__factory } from './typechain/IMigrationHelper__factory'; import { - V3MigrateWithBorrowType, + MigrationDelegationApproval, + V3MigrationHelperSignedCreditDelegationPermit, V3MigrationHelperSignedPermit, - V3MigrationNoBorrowType, - V3MigrationNoBorrowWithPermitsType, - V3SupplyAsset, + V3MigrationType, + MigrationSupplyAsset, + V3GetMigrationSupplyType, } from './v3MigrationTypes'; export interface V3MigrationHelperInterface { - migrateNoBorrowWithPermits: ( - params: V3MigrationNoBorrowWithPermitsType, - ) => EthereumTransactionTypeExtended[]; - migrateNoBorrow: ( - params: V3MigrationNoBorrowType, - ) => Promise; - migrateWithBorrow: ( - params: V3MigrateWithBorrowType, + migrate: ( + params: V3MigrationType, ) => Promise; } export class V3MigrationHelperService - extends BaseService + extends BaseService implements V3MigrationHelperInterface { + readonly baseDebtTokenService: BaseDebtTokenInterface; readonly provider: providers.Provider; readonly MIGRATOR_ADDRESS: tEthereumAddress; readonly erc20Service: ERC20Service; @@ -48,94 +47,78 @@ export class V3MigrationHelperService MIGRATOR_ADDRESS: tEthereumAddress, pool: Pool, ) { - super(provider, MigrationHelper__factory); + super(provider, IMigrationHelper__factory); this.MIGRATOR_ADDRESS = MIGRATOR_ADDRESS; this.erc20Service = new ERC20Service(provider); + this.baseDebtTokenService = new BaseDebtToken(provider, this.erc20Service); this.pool = pool; } @V3MigratorValidator - public async migrateNoBorrow( - // @isEthAddressArray('assets') how to check for assets name - @isEthAddress('user') - { assets, user }: V3MigrationNoBorrowType, - ): Promise { - const txs = await this.approveSupplyAssets(user, assets); - + public async getMigrationSupply( + @isEthAddress('asset') { asset, amount }: V3GetMigrationSupplyType, + ) { const migrator = this.getContractInstance(this.MIGRATOR_ADDRESS); - const assetsAddresses = assets.map(asset => asset.underlyingAsset); - const txCallback: () => Promise = this.generateTxCallback({ - rawTxMethod: async () => - migrator.populateTransaction.migrationNoBorrow( - user, - assetsAddresses, - [], - ), - from: user, - }); - - txs.push({ - tx: txCallback, - txType: eEthereumTxType.V3_MIGRATION_ACTION, - gas: this.generateTxPriceEstimation( - txs, - txCallback, - ProtocolAction.migrateV3, - ), - }); - - return txs; + return migrator.getMigrationSupply(asset, amount); } @V3MigratorValidator - public async migrateWithBorrow( + public async migrate( @isEthAddress('user') { + supplyAssets, user, - borrowedPositions, - suppliedPositions, - signedPermits, - }: V3MigrateWithBorrowType, + repayAssets, + signedSupplyPermits, + signedCreditDelegationPermits, + creditDelegationApprovals, + }: V3MigrationType, ): Promise { let txs: EthereumTransactionTypeExtended[] = []; - const permits = this.splitSignedPermits(signedPermits); - if (signedPermits.length === 0) { - txs = await this.approveSupplyAssets(user, suppliedPositions); + let permits: IMigrationHelper.PermitInputStruct[] = []; + + if (signedSupplyPermits && signedSupplyPermits.length > 0) { + permits = this.splitSignedPermits(signedSupplyPermits); + } else { + txs = await this.approveSupplyAssets(user, supplyAssets); } - const mappedBorrowPositions = await Promise.all( - borrowedPositions.map(async ({ interestRate, amount, ...borrow }) => { - const { decimals } = await this.erc20Service.getTokenData( - borrow.address, - ); - const convertedAmount = valueToWei(amount, decimals); - return { - ...borrow, - rateMode: interestRate === InterestRate.Variable ? 2 : 1, - amount: convertedAmount, - }; - }), - ); + let creditDelegationPermits: IMigrationHelper.CreditDelegationInputStruct[] = + []; + if ( + signedCreditDelegationPermits && + signedCreditDelegationPermits.length > 0 + ) { + creditDelegationPermits = this.splitSignedCreditDelegationPermits( + signedCreditDelegationPermits, + ); + } else { + const delegationApprovals = await this.approveDelegationTokens( + user, + creditDelegationApprovals, + ); + txs.push(...delegationApprovals); + } - const borrowedAssets = mappedBorrowPositions.map(borrow => borrow.address); - const borrowedAmounts = mappedBorrowPositions.map(borrow => borrow.amount); - const interestRatesModes = mappedBorrowPositions.map(() => 2); - const suppliedPositionsAddresses = suppliedPositions.map( - suppply => suppply.underlyingAsset, + const assetsToMigrate = supplyAssets.map( + supplyAsset => supplyAsset.underlyingAsset, ); + const assetsToRepay = repayAssets.map(repayAsset => { + return { + asset: repayAsset.underlyingAsset, + rateMode: repayAsset.rateMode === InterestRate.Stable ? 1 : 2, + }; + }); + const migrator = this.getContractInstance(this.MIGRATOR_ADDRESS); const txCallback: () => Promise = this.generateTxCallback({ rawTxMethod: async () => - this.pool.migrateV3({ - migrator: this.MIGRATOR_ADDRESS, - borrowedAssets, - borrowedAmounts, - interestRatesModes, - user, - suppliedPositions: suppliedPositionsAddresses, - borrowedPositions: mappedBorrowPositions, + migrator.populateTransaction.migrate( + assetsToMigrate, + assetsToRepay, permits, - }), + creditDelegationPermits, + ), from: user, }); @@ -143,7 +126,7 @@ export class V3MigrationHelperService tx: txCallback, txType: eEthereumTxType.V3_MIGRATION_ACTION, gas: this.generateTxPriceEstimation( - txs, + permits.length > 0 ? [] : txs, txCallback, ProtocolAction.migrateV3, ), @@ -152,35 +135,42 @@ export class V3MigrationHelperService return txs; } - @V3MigratorValidator - public migrateNoBorrowWithPermits( - @isEthAddress('user') - { user, assets, signedPermits }: V3MigrationNoBorrowWithPermitsType, - ): EthereumTransactionTypeExtended[] { - const migrator = this.getContractInstance(this.MIGRATOR_ADDRESS); - const permits = this.splitSignedPermits(signedPermits); + private async approveDelegationTokens( + user: string, + assets: MigrationDelegationApproval[], + ): Promise { + console.log(assets, 'assets'); + const assetsApproved = await Promise.all( + assets.map(async ({ amount, debtTokenAddress }) => { + return this.baseDebtTokenService.isDelegationApproved({ + debtTokenAddress, + allowanceGiver: user, + allowanceReceiver: this.MIGRATOR_ADDRESS, + amount, + }); + }), + ); + console.log(assetsApproved, 'assetsApproved'); + return assetsApproved + .map((approved, index) => { + if (approved) { + return; + } - const txCallback: () => Promise = this.generateTxCallback({ - rawTxMethod: async () => - migrator.populateTransaction.migrationNoBorrow(user, assets, permits), - from: user, - }); - return [ - { - tx: txCallback, - txType: eEthereumTxType.V3_MIGRATION_ACTION, - gas: this.generateTxPriceEstimation( - [], - txCallback, - ProtocolAction.migrateV3, - ), - }, - ]; + const asset = assets[index]; + return this.baseDebtTokenService.approveDelegation({ + user, + delegatee: this.MIGRATOR_ADDRESS, + debtTokenAddress: asset.debtTokenAddress, + amount: asset.amount, + }); + }) + .filter((tx): tx is EthereumTransactionTypeExtended => Boolean(tx)); } private async approveSupplyAssets( user: string, - assets: V3SupplyAsset[], + assets: MigrationSupplyAsset[], ): Promise { const assetsApproved = await Promise.all( assets.map(async ({ amount, aToken }) => { @@ -223,4 +213,23 @@ export class V3MigrationHelperService }; }); } + + private splitSignedCreditDelegationPermits( + signedPermits: V3MigrationHelperSignedCreditDelegationPermit[], + ) { + return signedPermits.map( + (permit): IMigrationHelper.CreditDelegationInputStruct => { + const { debtToken, deadline, value, signedPermit } = permit; + const signature = utils.splitSignature(signedPermit); + return { + debtToken, + deadline, + value, + v: signature.v, + r: signature.r, + s: signature.s, + }; + }, + ); + } } diff --git a/packages/contract-helpers/src/v3-migration-contract/typechain/MigrationHelper.ts b/packages/contract-helpers/src/v3-migration-contract/typechain/IMigrationHelper.ts similarity index 55% rename from packages/contract-helpers/src/v3-migration-contract/typechain/MigrationHelper.ts rename to packages/contract-helpers/src/v3-migration-contract/typechain/IMigrationHelper.ts index e06e3b89..71983c51 100644 --- a/packages/contract-helpers/src/v3-migration-contract/typechain/MigrationHelper.ts +++ b/packages/contract-helpers/src/v3-migration-contract/typechain/IMigrationHelper.ts @@ -23,6 +23,16 @@ import type { } from './common'; export declare namespace IMigrationHelper { + export type RepaySimpleInputStruct = { + asset: PromiseOrValue; + rateMode: PromiseOrValue; + }; + + export type RepaySimpleInputStructOutput = [string, BigNumber] & { + asset: string; + rateMode: BigNumber; + }; + export type PermitInputStruct = { aToken: PromiseOrValue; value: PromiseOrValue; @@ -47,17 +57,55 @@ export declare namespace IMigrationHelper { r: string; s: string; }; + + export type CreditDelegationInputStruct = { + debtToken: PromiseOrValue; + value: PromiseOrValue; + deadline: PromiseOrValue; + v: PromiseOrValue; + r: PromiseOrValue; + s: PromiseOrValue; + }; + + export type CreditDelegationInputStructOutput = [ + string, + BigNumber, + BigNumber, + number, + string, + string, + ] & { + debtToken: string; + value: BigNumber; + deadline: BigNumber; + v: number; + r: string; + s: string; + }; + + export type EmergencyTransferInputStruct = { + asset: PromiseOrValue; + amount: PromiseOrValue; + to: PromiseOrValue; + }; + + export type EmergencyTransferInputStructOutput = [ + string, + BigNumber, + string, + ] & { asset: string; amount: BigNumber; to: string }; } -export interface MigrationHelperInterface extends utils.Interface { +export interface IMigrationHelperInterface extends utils.Interface { functions: { 'ADDRESSES_PROVIDER()': FunctionFragment; 'POOL()': FunctionFragment; 'V2_POOL()': FunctionFragment; - 'aTokens(address)': FunctionFragment; 'cacheATokens()': FunctionFragment; 'executeOperation(address[],uint256[],uint256[],address,bytes)': FunctionFragment; - 'migrationNoBorrow(address,address[],(address,uint256,uint256,uint8,bytes32,bytes32)[])': FunctionFragment; + 'getMigrationSupply(address,uint256)': FunctionFragment; + 'migrate(address[],(address,uint256)[],(address,uint256,uint256,uint8,bytes32,bytes32)[],(address,uint256,uint256,uint8,bytes32,bytes32)[])': FunctionFragment; + 'rescueFunds((address,uint256,address)[])': FunctionFragment; }; getFunction( @@ -65,10 +113,11 @@ export interface MigrationHelperInterface extends utils.Interface { | 'ADDRESSES_PROVIDER' | 'POOL' | 'V2_POOL' - | 'aTokens' | 'cacheATokens' | 'executeOperation' - | 'migrationNoBorrow', + | 'getMigrationSupply' + | 'migrate' + | 'rescueFunds', ): FunctionFragment; encodeFunctionData( @@ -77,10 +126,6 @@ export interface MigrationHelperInterface extends utils.Interface { ): string; encodeFunctionData(functionFragment: 'POOL', values?: undefined): string; encodeFunctionData(functionFragment: 'V2_POOL', values?: undefined): string; - encodeFunctionData( - functionFragment: 'aTokens', - values: [PromiseOrValue], - ): string; encodeFunctionData( functionFragment: 'cacheATokens', values?: undefined, @@ -96,13 +141,22 @@ export interface MigrationHelperInterface extends utils.Interface { ], ): string; encodeFunctionData( - functionFragment: 'migrationNoBorrow', + functionFragment: 'getMigrationSupply', + values: [PromiseOrValue, PromiseOrValue], + ): string; + encodeFunctionData( + functionFragment: 'migrate', values: [ - PromiseOrValue, PromiseOrValue[], + IMigrationHelper.RepaySimpleInputStruct[], IMigrationHelper.PermitInputStruct[], + IMigrationHelper.CreditDelegationInputStruct[], ], ): string; + encodeFunctionData( + functionFragment: 'rescueFunds', + values: [IMigrationHelper.EmergencyTransferInputStruct[]], + ): string; decodeFunctionResult( functionFragment: 'ADDRESSES_PROVIDER', @@ -110,7 +164,6 @@ export interface MigrationHelperInterface extends utils.Interface { ): Result; decodeFunctionResult(functionFragment: 'POOL', data: BytesLike): Result; decodeFunctionResult(functionFragment: 'V2_POOL', data: BytesLike): Result; - decodeFunctionResult(functionFragment: 'aTokens', data: BytesLike): Result; decodeFunctionResult( functionFragment: 'cacheATokens', data: BytesLike, @@ -120,19 +173,24 @@ export interface MigrationHelperInterface extends utils.Interface { data: BytesLike, ): Result; decodeFunctionResult( - functionFragment: 'migrationNoBorrow', + functionFragment: 'getMigrationSupply', + data: BytesLike, + ): Result; + decodeFunctionResult(functionFragment: 'migrate', data: BytesLike): Result; + decodeFunctionResult( + functionFragment: 'rescueFunds', data: BytesLike, ): Result; events: {}; } -export interface MigrationHelper extends BaseContract { +export interface IMigrationHelper extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MigrationHelperInterface; + interface: IMigrationHelperInterface; queryFilter( event: TypedEventFilter, @@ -158,30 +216,39 @@ export interface MigrationHelper extends BaseContract { POOL(overrides?: CallOverrides): Promise<[string]>; - V2_POOL(overrides?: CallOverrides): Promise<[string]>; - - aTokens( - arg0: PromiseOrValue, - overrides?: CallOverrides, - ): Promise<[string]>; + V2_POOL( + overrides?: Overrides & { from?: PromiseOrValue }, + ): Promise; cacheATokens( overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; executeOperation( - arg0: PromiseOrValue[], - arg1: PromiseOrValue[], - arg2: PromiseOrValue[], + assets: PromiseOrValue[], + amounts: PromiseOrValue[], + premiums: PromiseOrValue[], initiator: PromiseOrValue, params: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; - migrationNoBorrow( - user: PromiseOrValue, - assets: PromiseOrValue[], + getMigrationSupply( + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides, + ): Promise<[string, BigNumber]>; + + migrate( + assetsToMigrate: PromiseOrValue[], + positionsToRepay: IMigrationHelper.RepaySimpleInputStruct[], permits: IMigrationHelper.PermitInputStruct[], + creditDelegationPermits: IMigrationHelper.CreditDelegationInputStruct[], + overrides?: Overrides & { from?: PromiseOrValue }, + ): Promise; + + rescueFunds( + emergencyInput: IMigrationHelper.EmergencyTransferInputStruct[], overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; }; @@ -190,30 +257,39 @@ export interface MigrationHelper extends BaseContract { POOL(overrides?: CallOverrides): Promise; - V2_POOL(overrides?: CallOverrides): Promise; - - aTokens( - arg0: PromiseOrValue, - overrides?: CallOverrides, - ): Promise; + V2_POOL( + overrides?: Overrides & { from?: PromiseOrValue }, + ): Promise; cacheATokens( overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; executeOperation( - arg0: PromiseOrValue[], - arg1: PromiseOrValue[], - arg2: PromiseOrValue[], + assets: PromiseOrValue[], + amounts: PromiseOrValue[], + premiums: PromiseOrValue[], initiator: PromiseOrValue, params: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; - migrationNoBorrow( - user: PromiseOrValue, - assets: PromiseOrValue[], + getMigrationSupply( + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides, + ): Promise<[string, BigNumber]>; + + migrate( + assetsToMigrate: PromiseOrValue[], + positionsToRepay: IMigrationHelper.RepaySimpleInputStruct[], permits: IMigrationHelper.PermitInputStruct[], + creditDelegationPermits: IMigrationHelper.CreditDelegationInputStruct[], + overrides?: Overrides & { from?: PromiseOrValue }, + ): Promise; + + rescueFunds( + emergencyInput: IMigrationHelper.EmergencyTransferInputStruct[], overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; @@ -224,26 +300,33 @@ export interface MigrationHelper extends BaseContract { V2_POOL(overrides?: CallOverrides): Promise; - aTokens( - arg0: PromiseOrValue, - overrides?: CallOverrides, - ): Promise; - cacheATokens(overrides?: CallOverrides): Promise; executeOperation( - arg0: PromiseOrValue[], - arg1: PromiseOrValue[], - arg2: PromiseOrValue[], + assets: PromiseOrValue[], + amounts: PromiseOrValue[], + premiums: PromiseOrValue[], initiator: PromiseOrValue, params: PromiseOrValue, overrides?: CallOverrides, ): Promise; - migrationNoBorrow( - user: PromiseOrValue, - assets: PromiseOrValue[], + getMigrationSupply( + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides, + ): Promise<[string, BigNumber]>; + + migrate( + assetsToMigrate: PromiseOrValue[], + positionsToRepay: IMigrationHelper.RepaySimpleInputStruct[], permits: IMigrationHelper.PermitInputStruct[], + creditDelegationPermits: IMigrationHelper.CreditDelegationInputStruct[], + overrides?: CallOverrides, + ): Promise; + + rescueFunds( + emergencyInput: IMigrationHelper.EmergencyTransferInputStruct[], overrides?: CallOverrides, ): Promise; }; @@ -255,11 +338,8 @@ export interface MigrationHelper extends BaseContract { POOL(overrides?: CallOverrides): Promise; - V2_POOL(overrides?: CallOverrides): Promise; - - aTokens( - arg0: PromiseOrValue, - overrides?: CallOverrides, + V2_POOL( + overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; cacheATokens( @@ -267,18 +347,30 @@ export interface MigrationHelper extends BaseContract { ): Promise; executeOperation( - arg0: PromiseOrValue[], - arg1: PromiseOrValue[], - arg2: PromiseOrValue[], + assets: PromiseOrValue[], + amounts: PromiseOrValue[], + premiums: PromiseOrValue[], initiator: PromiseOrValue, params: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; - migrationNoBorrow( - user: PromiseOrValue, - assets: PromiseOrValue[], + getMigrationSupply( + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides, + ): Promise; + + migrate( + assetsToMigrate: PromiseOrValue[], + positionsToRepay: IMigrationHelper.RepaySimpleInputStruct[], permits: IMigrationHelper.PermitInputStruct[], + creditDelegationPermits: IMigrationHelper.CreditDelegationInputStruct[], + overrides?: Overrides & { from?: PromiseOrValue }, + ): Promise; + + rescueFunds( + emergencyInput: IMigrationHelper.EmergencyTransferInputStruct[], overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; }; @@ -290,11 +382,8 @@ export interface MigrationHelper extends BaseContract { POOL(overrides?: CallOverrides): Promise; - V2_POOL(overrides?: CallOverrides): Promise; - - aTokens( - arg0: PromiseOrValue, - overrides?: CallOverrides, + V2_POOL( + overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; cacheATokens( @@ -302,18 +391,30 @@ export interface MigrationHelper extends BaseContract { ): Promise; executeOperation( - arg0: PromiseOrValue[], - arg1: PromiseOrValue[], - arg2: PromiseOrValue[], + assets: PromiseOrValue[], + amounts: PromiseOrValue[], + premiums: PromiseOrValue[], initiator: PromiseOrValue, params: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; - migrationNoBorrow( - user: PromiseOrValue, - assets: PromiseOrValue[], + getMigrationSupply( + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides, + ): Promise; + + migrate( + assetsToMigrate: PromiseOrValue[], + positionsToRepay: IMigrationHelper.RepaySimpleInputStruct[], permits: IMigrationHelper.PermitInputStruct[], + creditDelegationPermits: IMigrationHelper.CreditDelegationInputStruct[], + overrides?: Overrides & { from?: PromiseOrValue }, + ): Promise; + + rescueFunds( + emergencyInput: IMigrationHelper.EmergencyTransferInputStruct[], overrides?: Overrides & { from?: PromiseOrValue }, ): Promise; }; diff --git a/packages/contract-helpers/src/v3-migration-contract/typechain/IMigrationHelper__factory.ts b/packages/contract-helpers/src/v3-migration-contract/typechain/IMigrationHelper__factory.ts new file mode 100644 index 00000000..5190bc6d --- /dev/null +++ b/packages/contract-helpers/src/v3-migration-contract/typechain/IMigrationHelper__factory.ts @@ -0,0 +1,273 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { + IMigrationHelper, + IMigrationHelperInterface, +} from './IMigrationHelper'; + +const _abi = [ + { + inputs: [], + name: 'ADDRESSES_PROVIDER', + outputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'POOL', + outputs: [ + { + internalType: 'contract IPool', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'V2_POOL', + outputs: [ + { + internalType: 'contract ILendingPool', + name: '', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'cacheATokens', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address[]', + name: 'assets', + type: 'address[]', + }, + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + { + internalType: 'uint256[]', + name: 'premiums', + type: 'uint256[]', + }, + { + internalType: 'address', + name: 'initiator', + type: 'address', + }, + { + internalType: 'bytes', + name: 'params', + type: 'bytes', + }, + ], + name: 'executeOperation', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'asset', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'getMigrationSupply', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address[]', + name: 'assetsToMigrate', + type: 'address[]', + }, + { + components: [ + { + internalType: 'address', + name: 'asset', + type: 'address', + }, + { + internalType: 'uint256', + name: 'rateMode', + type: 'uint256', + }, + ], + internalType: 'struct IMigrationHelper.RepaySimpleInput[]', + name: 'positionsToRepay', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'contract IERC20WithPermit', + name: 'aToken', + type: 'address', + }, + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + internalType: 'struct IMigrationHelper.PermitInput[]', + name: 'permits', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'contract ICreditDelegationToken', + name: 'debtToken', + type: 'address', + }, + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + internalType: 'struct IMigrationHelper.CreditDelegationInput[]', + name: 'creditDelegationPermits', + type: 'tuple[]', + }, + ], + name: 'migrate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'contract IERC20WithPermit', + name: 'asset', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + ], + internalType: 'struct IMigrationHelper.EmergencyTransferInput[]', + name: 'emergencyInput', + type: 'tuple[]', + }, + ], + name: 'rescueFunds', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +]; + +export class IMigrationHelper__factory { + static readonly abi = _abi; + static createInterface(): IMigrationHelperInterface { + return new utils.Interface(_abi) as IMigrationHelperInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider, + ): IMigrationHelper { + return new Contract(address, _abi, signerOrProvider) as IMigrationHelper; + } +} diff --git a/packages/contract-helpers/src/v3-migration-contract/typechain/MigrationHelper__factory.ts b/packages/contract-helpers/src/v3-migration-contract/typechain/MigrationHelper__factory.ts deleted file mode 100644 index a4786897..00000000 --- a/packages/contract-helpers/src/v3-migration-contract/typechain/MigrationHelper__factory.ts +++ /dev/null @@ -1,249 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ -import { Signer, utils, Contract, ContractFactory, Overrides } from 'ethers'; -import type { Provider, TransactionRequest } from '@ethersproject/providers'; -import type { PromiseOrValue } from './common'; -import type { - MigrationHelper, - MigrationHelperInterface, -} from './MigrationHelper'; - -const _abi = [ - { - inputs: [ - { - internalType: 'contract IPoolAddressesProvider', - name: 'v3AddressesProvider', - type: 'address', - }, - { - internalType: 'contract ILendingPool', - name: 'v2Pool', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [], - name: 'ADDRESSES_PROVIDER', - outputs: [ - { - internalType: 'contract IPoolAddressesProvider', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'POOL', - outputs: [ - { - internalType: 'contract IPool', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'V2_POOL', - outputs: [ - { - internalType: 'contract ILendingPool', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - name: 'aTokens', - outputs: [ - { - internalType: 'contract IERC20WithPermit', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'cacheATokens', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - { - internalType: 'uint256[]', - name: '', - type: 'uint256[]', - }, - { - internalType: 'uint256[]', - name: '', - type: 'uint256[]', - }, - { - internalType: 'address', - name: 'initiator', - type: 'address', - }, - { - internalType: 'bytes', - name: 'params', - type: 'bytes', - }, - ], - name: 'executeOperation', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - { - internalType: 'address[]', - name: 'assets', - type: 'address[]', - }, - { - components: [ - { - internalType: 'contract IERC20WithPermit', - name: 'aToken', - type: 'address', - }, - { - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'uint8', - name: 'v', - type: 'uint8', - }, - { - internalType: 'bytes32', - name: 'r', - type: 'bytes32', - }, - { - internalType: 'bytes32', - name: 's', - type: 'bytes32', - }, - ], - internalType: 'struct IMigrationHelper.PermitInput[]', - name: 'permits', - type: 'tuple[]', - }, - ], - name: 'migrationNoBorrow', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -]; - -const _bytecode = - '0x60e06040523480156200001157600080fd5b5060405162001b8238038062001b82833981016040819052620000349162000473565b6001600160a01b03821660a08190526040805163026b1d5f60e01b8152905163026b1d5f916004808201926020929091908290030181865afa1580156200007f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000a59190620004c4565b6001600160a01b0390811660c0528116608052620000c2620000ca565b50506200080d565b604080516101a08101825260006101808201818152825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810182905261016081019190915260006080516001600160a01b031663d1946dbc6040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000175573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200019f919081019062000560565b905060005b8151811015620004555760006001600160a01b0316600080848481518110620001d157620001d16200061e565b6020908102919091018101516001600160a01b0390811683529082019290925260400160002054160362000440576080516001600160a01b03166335ea6a758383815181106200022557620002256200061e565b60200260200101516040518263ffffffff1660e01b81526004016200025991906001600160a01b0391909116815260200190565b61018060405180830381865afa15801562000278573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029e9190620006b9565b92508260e00151600080848481518110620002bd57620002bd6200061e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508181815181106200031e576200031e6200061e565b602090810291909101015160805160405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af11580156200037d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003a39190620007c1565b50818181518110620003b957620003b96200061e565b602090810291909101015160c05160405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af115801562000418573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200043e9190620007c1565b505b806200044c81620007e5565b915050620001a4565b505050565b6001600160a01b03811681146200047057600080fd5b50565b600080604083850312156200048757600080fd5b825162000494816200045a565b6020840151909250620004a7816200045a565b809150509250929050565b8051620004bf816200045a565b919050565b600060208284031215620004d757600080fd5b8151620004e4816200045a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161018081016001600160401b0381118282101715620005275762000527620004eb565b60405290565b604051601f8201601f191681016001600160401b0381118282101715620005585762000558620004eb565b604052919050565b600060208083850312156200057457600080fd5b82516001600160401b03808211156200058c57600080fd5b818501915085601f830112620005a157600080fd5b815181811115620005b657620005b6620004eb565b8060051b9150620005c98483016200052d565b8181529183018401918481019088841115620005e457600080fd5b938501935b8385101562000612578451925062000601836200045a565b8282529385019390850190620005e9565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156200064757600080fd5b604051602081016001600160401b03811182821017156200066c576200066c620004eb565b6040529151825250919050565b80516001600160801b0381168114620004bf57600080fd5b805164ffffffffff81168114620004bf57600080fd5b805160ff81168114620004bf57600080fd5b60006101808284031215620006cd57600080fd5b620006d762000501565b620006e3848462000634565b8152620006f36020840162000679565b6020820152620007066040840162000679565b6040820152620007196060840162000679565b60608201526200072c6080840162000679565b60808201526200073f60a0840162000679565b60a08201526200075260c0840162000691565b60c08201526200076560e08401620004b2565b60e08201526101006200077a818501620004b2565b908201526101206200078e848201620004b2565b90820152610140620007a2848201620004b2565b90820152610160620007b6848201620006a7565b908201529392505050565b600060208284031215620007d457600080fd5b81518015158114620004e457600080fd5b6000600182016200080657634e487b7160e01b600052601160045260246000fd5b5060010190565b60805160a05160c0516113156200086d60003960008181610109015281816105610152610a8c015260006087015260008181610130015281816104ba01528181610600015281816107a80152818161088901526109d901526113156000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637535d2461161005b5780637535d24614610104578063880f2a221461012b578063920f5c8414610152578063e0bd7a9f1461017557600080fd5b80630542975c146100825780630970352a146100c65780633e108ad9146100db575b600080fd5b6100a97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d96100d4366004610d5d565b61017d565b005b6100a96100e9366004610dd3565b6000602081905290815260409020546001600160a01b031681565b6100a97f000000000000000000000000000000000000000000000000000000000000000081565b6100a97f000000000000000000000000000000000000000000000000000000000000000081565b610165610160366004610e43565b6105db565b60405190151581526020016100bd565b6100d961073c565b60008060005b83518110156102ea5783818151811061019e5761019e610f48565b6020026020010151600001516001600160a01b031663d505accf87308785815181106101cc576101cc610f48565b6020026020010151602001518886815181106101ea576101ea610f48565b60200260200101516040015189878151811061020857610208610f48565b6020026020010151606001518a888151811061022657610226610f48565b6020026020010151608001518b898151811061024457610244610f48565b602090810291909101015160a001516040516001600160e01b031960e08a901b1681526001600160a01b0397881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156102bf57600080fd5b505af11580156102d3573d6000803e3d6000fd5b5050505080806102e290610f5e565b915050610183565b5060005b84518110156105d35784818151811061030957610309610f48565b6020908102919091018101516001600160a01b038082166000818152938490526040909320549195501692501580159061034b57506001600160a01b03821615155b61039b5760405162461bcd60e51b815260206004820152601b60248201527f494e56414c49445f4f525f4e4f545f4341434845445f41535345540000000000604482015260640160405180910390fd5b6040516370a0823160e01b81526001600160a01b0387811660048301528316906323b872dd908890309084906370a0823190602401602060405180830381865afa1580156103ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104119190610f85565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015610465573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104899190610f9e565b50604051631a4ca37b60e21b81526001600160a01b03848116600483015260001960248301523060448301526000917f0000000000000000000000000000000000000000000000000000000000000000909116906369328dec906064016020604051808303816000875af1158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f85565b60405163617ba03760e01b81526001600160a01b038681166004830152602482018390528981166044830152600060648301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063617ba03790608401600060405180830381600087803b1580156105a757600080fd5b505af11580156105bb573d6000803e3d6000fd5b505050505080806105cb90610f5e565b9150506102ee565b505050505050565b60008080806105ec85870187610fc0565b92509250925060005b825181101561071d577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663573ade8184838151811061063f5761063f610f48565b60200260200101516000015185848151811061065d5761065d610f48565b60200260200101516020015186858151811061067b5761067b610f48565b602090810291909101015160409081015190516001600160e01b031960e086901b1681526001600160a01b03938416600482015260248101929092526044820152908b1660648201526084016020604051808303816000875af11580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a9190610f85565b508061071581610f5e565b9150506105f5565b5061072987848361017d565b5060019c9b505050505050505050505050565b604080516101a08101825260006101808201818152825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810182905261016081019190915260007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d1946dbc6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610804573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261082c91908101906110d6565b905060005b8151811015610b1e5760006001600160a01b031660008084848151811061085a5761085a610f48565b6020908102919091018101516001600160a01b03908116835290820192909252604001600020541603610b0c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166335ea6a758383815181106108c8576108c8610f48565b60200260200101516040518263ffffffff1660e01b81526004016108fb91906001600160a01b0391909116815260200190565b61018060405180830381865afa158015610919573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093d91906111f2565b92508260e0015160008084848151811061095957610959610f48565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508181815181106109b7576109b7610f48565b602090810291909101015160405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260001960248301529091169063095ea7b3906044016020604051808303816000875af1158015610a33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a579190610f9e565b50818181518110610a6a57610a6a610f48565b602090810291909101015160405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260001960248301529091169063095ea7b3906044016020604051808303816000875af1158015610ae6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0a9190610f9e565b505b80610b1681610f5e565b915050610831565b505050565b6001600160a01b0381168114610b3857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715610b7457610b74610b3b565b60405290565b6040516060810167ffffffffffffffff81118282101715610b7457610b74610b3b565b604051610180810167ffffffffffffffff81118282101715610b7457610b74610b3b565b604051601f8201601f1916810167ffffffffffffffff81118282101715610bea57610bea610b3b565b604052919050565b600067ffffffffffffffff821115610c0c57610c0c610b3b565b5060051b60200190565b600082601f830112610c2757600080fd5b81356020610c3c610c3783610bf2565b610bc1565b82815260059290921b84018101918181019086841115610c5b57600080fd5b8286015b84811015610c7f578035610c7281610b23565b8352918301918301610c5f565b509695505050505050565b60ff81168114610b3857600080fd5b600082601f830112610caa57600080fd5b81356020610cba610c3783610bf2565b82815260c09283028501820192828201919087851115610cd957600080fd5b8387015b85811015610d505781818a031215610cf55760008081fd5b610cfd610b51565b8135610d0881610b23565b8152818601358682015260408083013590820152606080830135610d2b81610c8a565b908201526080828101359082015260a080830135908201528452928401928101610cdd565b5090979650505050505050565b600080600060608486031215610d7257600080fd5b8335610d7d81610b23565b9250602084013567ffffffffffffffff80821115610d9a57600080fd5b610da687838801610c16565b93506040860135915080821115610dbc57600080fd5b50610dc986828701610c99565b9150509250925092565b600060208284031215610de557600080fd5b8135610df081610b23565b9392505050565b60008083601f840112610e0957600080fd5b50813567ffffffffffffffff811115610e2157600080fd5b6020830191508360208260051b8501011115610e3c57600080fd5b9250929050565b600080600080600080600080600060a08a8c031215610e6157600080fd5b893567ffffffffffffffff80821115610e7957600080fd5b610e858d838e01610df7565b909b50995060208c0135915080821115610e9e57600080fd5b610eaa8d838e01610df7565b909950975060408c0135915080821115610ec357600080fd5b610ecf8d838e01610df7565b909750955060608c01359150610ee482610b23565b90935060808b01359080821115610efa57600080fd5b818c0191508c601f830112610f0e57600080fd5b813581811115610f1d57600080fd5b8d6020828501011115610f2f57600080fd5b6020830194508093505050509295985092959850929598565b634e487b7160e01b600052603260045260246000fd5b600060018201610f7e57634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215610f9757600080fd5b5051919050565b600060208284031215610fb057600080fd5b81518015158114610df057600080fd5b60008060006060808587031215610fd657600080fd5b843567ffffffffffffffff80821115610fee57600080fd5b610ffa88838901610c16565b955060209150818701358181111561101157600080fd5b8701601f8101891361102257600080fd5b8035611030610c3782610bf2565b8181529085028201840190848101908b83111561104c57600080fd5b928501925b8284101561109f5786848d0312156110695760008081fd5b611071610b7a565b843561107c81610b23565b815284870135878201526040808601359082015282529286019290850190611051565b975050505060408701359250808311156110b857600080fd5b5050610dc986828701610c99565b80516110d181610b23565b919050565b600060208083850312156110e957600080fd5b825167ffffffffffffffff81111561110057600080fd5b8301601f8101851361111157600080fd5b805161111f610c3782610bf2565b81815260059190911b8201830190838101908783111561113e57600080fd5b928401925b8284101561116557835161115681610b23565b82529284019290840190611143565b979650505050505050565b60006020828403121561118257600080fd5b6040516020810181811067ffffffffffffffff821117156111a5576111a5610b3b565b6040529151825250919050565b80516fffffffffffffffffffffffffffffffff811681146110d157600080fd5b805164ffffffffff811681146110d157600080fd5b80516110d181610c8a565b6000610180828403121561120557600080fd5b61120d610b9d565b6112178484611170565b8152611225602084016111b2565b6020820152611236604084016111b2565b6040820152611247606084016111b2565b6060820152611258608084016111b2565b608082015261126960a084016111b2565b60a082015261127a60c084016111d2565b60c082015261128b60e084016110c6565b60e082015261010061129e8185016110c6565b908201526101206112b08482016110c6565b908201526101406112c28482016110c6565b908201526101606112d48482016111e7565b90820152939250505056fea26469706673582212201f462dd8b81ef9ee38b791ed50f6aeaccb7a3732366bd9cf34c282862e50af1764736f6c63430008100033'; - -type MigrationHelperConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: MigrationHelperConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class MigrationHelper__factory extends ContractFactory { - constructor(...args: MigrationHelperConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override deploy( - v3AddressesProvider: PromiseOrValue, - v2Pool: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue }, - ): Promise { - return super.deploy( - v3AddressesProvider, - v2Pool, - overrides || {}, - ) as Promise; - } - override getDeployTransaction( - v3AddressesProvider: PromiseOrValue, - v2Pool: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue }, - ): TransactionRequest { - return super.getDeployTransaction( - v3AddressesProvider, - v2Pool, - overrides || {}, - ); - } - override attach(address: string): MigrationHelper { - return super.attach(address) as MigrationHelper; - } - override connect(signer: Signer): MigrationHelper__factory { - return super.connect(signer) as MigrationHelper__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): MigrationHelperInterface { - return new utils.Interface(_abi) as MigrationHelperInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider, - ): MigrationHelper { - return new Contract(address, _abi, signerOrProvider) as MigrationHelper; - } -} diff --git a/packages/contract-helpers/src/v3-migration-contract/typechain/index.ts b/packages/contract-helpers/src/v3-migration-contract/typechain/index.ts deleted file mode 100644 index cdab5afd..00000000 --- a/packages/contract-helpers/src/v3-migration-contract/typechain/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -export type { MigrationHelper } from './MigrationHelper'; -export { MigrationHelper__factory } from './MigrationHelper__factory'; diff --git a/packages/contract-helpers/src/v3-migration-contract/v3MigrationTypes.ts b/packages/contract-helpers/src/v3-migration-contract/v3MigrationTypes.ts index af17ee33..c059ca4c 100644 --- a/packages/contract-helpers/src/v3-migration-contract/v3MigrationTypes.ts +++ b/packages/contract-helpers/src/v3-migration-contract/v3MigrationTypes.ts @@ -9,32 +9,43 @@ export type V3MigrationHelperSignedPermit = { signedPermit: SignatureLike; }; -export type V3MigrationNoBorrowWithPermitsType = { - user: tEthereumAddress; - assets: tEthereumAddress[]; +export type V3MigrationHelperSignedCreditDelegationPermit = { deadline: BigNumberish; - signedPermits: V3MigrationHelperSignedPermit[]; + debtToken: tEthereumAddress; + value: BigNumberish; + signedPermit: SignatureLike; }; -export type V3SupplyAsset = { +export type MigrationSupplyAsset = { aToken: tEthereumAddress; underlyingAsset: tEthereumAddress; deadline: number; amount: string; }; -export type V3MigrationNoBorrowType = { +export type MigrationRepayAsset = { + debtToken: tEthereumAddress; + underlyingAsset: tEthereumAddress; + rateMode: InterestRate; + deadline: number; + amount: string; +}; + +export type MigrationDelegationApproval = { + debtTokenAddress: tEthereumAddress; + amount: string; +}; + +export type V3MigrationType = { + creditDelegationApprovals: MigrationDelegationApproval[]; user: tEthereumAddress; - assets: V3SupplyAsset[]; + supplyAssets: MigrationSupplyAsset[]; + repayAssets: MigrationRepayAsset[]; + signedSupplyPermits?: V3MigrationHelperSignedPermit[]; + signedCreditDelegationPermits: V3MigrationHelperSignedCreditDelegationPermit[]; }; -export type V3MigrateWithBorrowType = { - borrowedPositions: Array<{ - amount: string; - address: string; - interestRate: InterestRate; - }>; - user: string; - suppliedPositions: V3SupplyAsset[]; - signedPermits: V3MigrationHelperSignedPermit[]; +export type V3GetMigrationSupplyType = { + asset: tEthereumAddress; + amount: string; }; diff --git a/packages/contract-helpers/src/v3-migration-contract/v3migration.test.ts b/packages/contract-helpers/src/v3-migration-contract/v3migration.test.ts index 8f6ae91e..340eb2e1 100644 --- a/packages/contract-helpers/src/v3-migration-contract/v3migration.test.ts +++ b/packages/contract-helpers/src/v3-migration-contract/v3migration.test.ts @@ -7,6 +7,8 @@ import { } from '../commons/types'; import { DEFAULT_NULL_VALUE_ON_TX } from '../commons/utils'; import { Pool } from '../v3-pool-contract'; +import { IMigrationHelper } from './typechain/IMigrationHelper'; +import { IMigrationHelper__factory } from './typechain/IMigrationHelper__factory'; import { V3MigrationHelperService } from './index'; const getPool = (provider: providers.Provider) => { @@ -68,8 +70,8 @@ describe('V3MigrationService', () => { expect(instance instanceof V3MigrationHelperService).toEqual(true); }); }); - describe('migrateNoBorrow', () => { - const assets = [ + describe('migrate', () => { + const supplyAssets = [ { aToken: '0x0000000000000000000000000000000000000003', underlyingAsset: '0x0000000000000000000000000000000000000004', @@ -77,7 +79,49 @@ describe('V3MigrationService', () => { amount: '123400000000', }, ]; - it('Expects to work with correct params without approvals', async () => { + const repayAssetsStable = [ + { + debtToken: '0x0000000000000000000000000000000000000003', + rateMode: InterestRate.Stable, + underlyingAsset: '0x0000000000000000000000000000000000000004', + deadline: 123, + amount: '123400000000', + }, + ]; + const repayAssetsVariable = [ + { + debtToken: '0x0000000000000000000000000000000000000003', + rateMode: InterestRate.Variable, + underlyingAsset: '0x0000000000000000000000000000000000000004', + deadline: 123, + amount: '123400000000', + }, + ]; + const signedSupplyPermits = [ + { + deadline: 1234, + aToken: '0x0000000000000000000000000000000000000003', + value: '112300000', + signedPermit: + '0x532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb41c', + }, + ]; + const signedCreditDelegationPermits = [ + { + deadline: 1234, + debtToken: '0x0000000000000000000000000000000000000003', + value: '112300000', + signedPermit: + '0x532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb41c', + }, + ]; + const creditDelegationApprovals = [ + { + debtTokenAddress: '0x0000000000000000000000000000000000000003', + amount: '13451', + }, + ]; + it('Exepects to work with params no sig no approvals and variable', async () => { const instance = new V3MigrationHelperService( provider, MIGRATOR_ADDRESS, @@ -86,17 +130,24 @@ describe('V3MigrationService', () => { const isApprovedSpy = jest .spyOn(instance.erc20Service, 'isApproved') .mockImplementationOnce(async () => Promise.resolve(true)); + const isApprovedDelegationSpy = jest + .spyOn(instance.baseDebtTokenService, 'isDelegationApproved') + .mockImplementationOnce(async () => Promise.resolve(true)); - const migrateNoBorrowTxs = await instance.migrateNoBorrow({ - assets, + const migrateTxs = await instance.migrate({ user, + supplyAssets, + repayAssets: repayAssetsVariable, + signedSupplyPermits: [], + signedCreditDelegationPermits: [], + creditDelegationApprovals, }); - expect(isApprovedSpy).toHaveBeenCalled(); + expect(isApprovedDelegationSpy).toHaveBeenCalled(); - expect(migrateNoBorrowTxs.length).toEqual(1); + expect(migrateTxs.length).toEqual(1); - const txObj = migrateNoBorrowTxs[0]; + const txObj = migrateTxs[0]; expect(txObj.txType).toEqual(eEthereumTxType.V3_MIGRATION_ACTION); const tx: transactionType = await txObj.tx(); @@ -107,16 +158,15 @@ describe('V3MigrationService', () => { const decoded = utils.defaultAbiCoder.decode( [ - 'address', 'address[]', + '(address,uint256)[]', + '(address,uint256,uint256,uint256,bytes32,bytes32)[]', '(address,uint256,uint256,uint256,bytes32,bytes32)[]', ], utils.hexDataSlice(tx.data ?? '', 4), ); - expect(decoded[0]).toEqual(user); - expect(decoded[1]).toEqual([assets[0].underlyingAsset]); - expect(decoded[2]).toEqual([]); + expect(decoded.length).toEqual(4); // gas price const gasPrice: GasType | null = await txObj.gas(); @@ -124,7 +174,7 @@ describe('V3MigrationService', () => { expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); }); - it('Expects to work with correct params with approvals', async () => { + it('Exepects to work with params no sig no approvals and stable', async () => { const instance = new V3MigrationHelperService( provider, MIGRATOR_ADDRESS, @@ -132,29 +182,26 @@ describe('V3MigrationService', () => { ); const isApprovedSpy = jest .spyOn(instance.erc20Service, 'isApproved') - .mockImplementationOnce(async () => Promise.resolve(false)); - const approveSpy = jest - .spyOn(instance.erc20Service, 'approve') - .mockReturnValueOnce({ - txType: eEthereumTxType.ERC20_APPROVAL, - tx: async () => ({}), - gas: async () => ({ - gasLimit: '1', - gasPrice: '1', - }), - }); + .mockImplementationOnce(async () => Promise.resolve(true)); - const migrateNoBorrowTxs = await instance.migrateNoBorrow({ - assets, + const isApprovedDelegationSpy = jest + .spyOn(instance.baseDebtTokenService, 'isDelegationApproved') + .mockImplementationOnce(async () => Promise.resolve(true)); + + const migrateTxs = await instance.migrate({ user, + supplyAssets, + repayAssets: repayAssetsStable, + signedSupplyPermits: [], + signedCreditDelegationPermits: [], + creditDelegationApprovals, }); - - expect(approveSpy).toHaveBeenCalled(); expect(isApprovedSpy).toHaveBeenCalled(); + expect(isApprovedDelegationSpy).toHaveBeenCalled(); - expect(migrateNoBorrowTxs.length).toEqual(2); - const txObj = migrateNoBorrowTxs[1]; + expect(migrateTxs.length).toEqual(1); + const txObj = migrateTxs[0]; expect(txObj.txType).toEqual(eEthereumTxType.V3_MIGRATION_ACTION); const tx: transactionType = await txObj.tx(); @@ -165,253 +212,91 @@ describe('V3MigrationService', () => { const decoded = utils.defaultAbiCoder.decode( [ - 'address', 'address[]', + '(address,uint256)[]', + '(address,uint256,uint256,uint256,bytes32,bytes32)[]', '(address,uint256,uint256,uint256,bytes32,bytes32)[]', ], utils.hexDataSlice(tx.data ?? '', 4), ); - expect(decoded[0]).toEqual(user); - expect(decoded[1]).toEqual([assets[0].underlyingAsset]); - expect(decoded[2]).toEqual([]); - - // gas price - const gasPrice: GasType | null = await txObj.gas(); - expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('700000'); - expect(gasPrice?.gasPrice).toEqual('1'); - }); - it('Expects to fails when user not address', async () => { - const instance = new V3MigrationHelperService( - provider, - MIGRATOR_ADDRESS, - pool, - ); - const user = 'asdf'; - await expect(async () => - instance.migrateNoBorrow({ - assets, - user, - }), - ).rejects.toThrowError( - `Address: ${user} is not a valid ethereum Address`, - ); - }); - }); - describe('migrateWithBorrow', () => { - const borrowedPositions = [ - { - amount: '100000000000', - address: '0x0000000000000000000000000000000000000004', - interestRate: InterestRate.Variable, - }, - ]; - const borrowedPositionsStable = [ - { - amount: '100000000000', - address: '0x0000000000000000000000000000000000000004', - interestRate: InterestRate.Stable, - }, - ]; - const suppliedPositions = [ - { - aToken: '0x0000000000000000000000000000000000000003', - underlyingAsset: '0x0000000000000000000000000000000000000004', - deadline: 123, - amount: '123400000000', - }, - ]; - const signedPermits = [ - { - deadline: 1234, - aToken: '0x0000000000000000000000000000000000000003', - value: '112300000', - signedPermit: - '0x532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb41c', - }, - ]; - - const decimals = 18; - - it('Expects to work with correct params with permits', async () => { - const instance = new V3MigrationHelperService( - provider, - MIGRATOR_ADDRESS, - pool, - ); - - jest.spyOn(instance.erc20Service, 'getTokenData').mockReturnValue( - Promise.resolve({ - name: 'mockToken', - decimals, - symbol: 'MT', - address: '0x0000000000000000000000000000000000000006', - }), - ); - - jest - .spyOn(instance.pool, 'migrateV3') - .mockReturnValue(Promise.resolve({})); - - const migrateWithBorrowTxs = await instance.migrateWithBorrow({ - user, - borrowedPositions, - suppliedPositions, - signedPermits, - }); - - expect(migrateWithBorrowTxs.length).toEqual(1); - - const txObj = migrateWithBorrowTxs[0]; - expect(txObj.txType).toEqual(eEthereumTxType.V3_MIGRATION_ACTION); - - const tx: transactionType = await txObj.tx(); - expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); - expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); - + expect(decoded.length).toEqual(4); // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); }); - it('Expects to work with correct params with permits with stable', async () => { + it('Expects to work with params no sig and approvals', async () => { const instance = new V3MigrationHelperService( provider, MIGRATOR_ADDRESS, pool, ); + const isApprovedSpy = jest + .spyOn(instance.erc20Service, 'isApproved') + .mockImplementationOnce(async () => Promise.resolve(false)); + const approveSpy = jest + .spyOn(instance.erc20Service, 'approve') + .mockReturnValueOnce({ + txType: eEthereumTxType.ERC20_APPROVAL, + tx: async () => ({}), + gas: async () => ({ + gasLimit: '1', + gasPrice: '1', + }), + }); + const isApprovedDelegationSpy = jest + .spyOn(instance.baseDebtTokenService, 'isDelegationApproved') + .mockImplementationOnce(async () => Promise.resolve(false)); + const approveDelegationSpy = jest + .spyOn(instance.baseDebtTokenService, 'approveDelegation') + .mockReturnValueOnce({ + txType: eEthereumTxType.ERC20_APPROVAL, + tx: async () => ({}), + gas: async () => ({ + gasLimit: '1', + gasPrice: '1', + }), + }); - jest.spyOn(instance.erc20Service, 'getTokenData').mockReturnValue( - Promise.resolve({ - name: 'mockToken', - decimals, - symbol: 'MT', - address: '0x0000000000000000000000000000000000000006', - }), - ); - - jest - .spyOn(instance.pool, 'migrateV3') - .mockReturnValue(Promise.resolve({})); - - const migrateWithBorrowTxs = await instance.migrateWithBorrow({ + const migrateTxs = await instance.migrate({ user, - borrowedPositions: borrowedPositionsStable, - suppliedPositions, - signedPermits, + supplyAssets, + repayAssets: repayAssetsStable, + signedSupplyPermits: [], + signedCreditDelegationPermits: [], + creditDelegationApprovals, }); - expect(migrateWithBorrowTxs.length).toEqual(1); - - const txObj = migrateWithBorrowTxs[0]; - expect(txObj.txType).toEqual(eEthereumTxType.V3_MIGRATION_ACTION); - - const tx: transactionType = await txObj.tx(); - expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); - expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); - - // gas price - const gasPrice: GasType | null = await txObj.gas(); - expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); - expect(gasPrice?.gasPrice).toEqual('1'); - }); - it('Expects to work with correct params without permits and no approvals', async () => { - const instance = new V3MigrationHelperService( - provider, - MIGRATOR_ADDRESS, - pool, - ); - - jest.spyOn(instance.erc20Service, 'getTokenData').mockReturnValue( - Promise.resolve({ - name: 'mockToken', - decimals, - symbol: 'MT', - address: '0x0000000000000000000000000000000000000006', - }), - ); - jest - .spyOn(instance.erc20Service, 'isApproved') - .mockImplementationOnce(async () => Promise.resolve(true)); - - jest - .spyOn(instance.pool, 'migrateV3') - .mockReturnValue(Promise.resolve({})); + expect(approveSpy).toHaveBeenCalled(); + expect(isApprovedSpy).toHaveBeenCalled(); + expect(isApprovedDelegationSpy).toHaveBeenCalled(); + expect(approveDelegationSpy).toHaveBeenCalled(); - const migrateWithBorrowTxs = await instance.migrateWithBorrow({ - user, - borrowedPositions, - suppliedPositions, - signedPermits: [], - }); + expect(migrateTxs.length).toEqual(3); - expect(migrateWithBorrowTxs.length).toEqual(1); + const txObj = migrateTxs[2]; - const txObj = migrateWithBorrowTxs[0]; expect(txObj.txType).toEqual(eEthereumTxType.V3_MIGRATION_ACTION); const tx: transactionType = await txObj.tx(); + expect(tx.to).toEqual(MIGRATOR_ADDRESS); expect(tx.from).toEqual(user); expect(tx.gasLimit).toEqual(BigNumber.from(1)); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); - // gas price - const gasPrice: GasType | null = await txObj.gas(); - expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); - expect(gasPrice?.gasPrice).toEqual('1'); - }); - it('Expects to work with correct params without permits and approvals', async () => { - const instance = new V3MigrationHelperService( - provider, - MIGRATOR_ADDRESS, - pool, - ); - - jest.spyOn(instance.erc20Service, 'getTokenData').mockReturnValue( - Promise.resolve({ - name: 'mockToken', - decimals, - symbol: 'MT', - address: '0x0000000000000000000000000000000000000006', - }), + const decoded = utils.defaultAbiCoder.decode( + [ + 'address[]', + '(address,uint256)[]', + '(address,uint256,uint256,uint256,bytes32,bytes32)[]', + '(address,uint256,uint256,uint256,bytes32,bytes32)[]', + ], + utils.hexDataSlice(tx.data ?? '', 4), ); - jest - .spyOn(instance.erc20Service, 'isApproved') - .mockImplementationOnce(async () => Promise.resolve(false)); - jest.spyOn(instance.erc20Service, 'approve').mockReturnValueOnce({ - txType: eEthereumTxType.ERC20_APPROVAL, - tx: async () => ({}), - gas: async () => ({ - gasLimit: '1', - gasPrice: '1', - }), - }); - jest - .spyOn(instance.pool, 'migrateV3') - .mockReturnValue(Promise.resolve({})); - - const migrateWithBorrowTxs = await instance.migrateWithBorrow({ - user, - borrowedPositions, - suppliedPositions, - signedPermits: [], - }); - - expect(migrateWithBorrowTxs.length).toEqual(2); - - const txObj = migrateWithBorrowTxs[1]; - expect(txObj.txType).toEqual(eEthereumTxType.V3_MIGRATION_ACTION); - const tx: transactionType = await txObj.tx(); - expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); - expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); + expect(decoded.length).toEqual(4); // gas price const gasPrice: GasType | null = await txObj.gas(); @@ -419,52 +304,22 @@ describe('V3MigrationService', () => { expect(gasPrice?.gasLimit).toEqual('700000'); expect(gasPrice?.gasPrice).toEqual('1'); }); - it('Expects to fails when user not address', async () => { + it('Expects to work with params and sig', async () => { const instance = new V3MigrationHelperService( provider, MIGRATOR_ADDRESS, pool, ); - const user = 'asdf'; - await expect(async () => - instance.migrateWithBorrow({ - user, - borrowedPositions, - suppliedPositions, - signedPermits, - }), - ).rejects.toThrowError( - `Address: ${user} is not a valid ethereum Address`, - ); - }); - }); - describe('migrateNoBorrowWithPermits', () => { - const assets = ['0x0000000000000000000000000000000000000003']; - const deadline = 2341; - const signedPermits = [ - { - deadline: 1234, - aToken: '0x0000000000000000000000000000000000000003', - value: '112300000', - signedPermit: - '0x532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb41c', - }, - ]; - it('Expects to work with correct params', async () => { - const instance = new V3MigrationHelperService( - provider, - MIGRATOR_ADDRESS, - pool, - ); - - const mNoBorrowsPermit = instance.migrateNoBorrowWithPermits({ + const migrateTxs = await instance.migrate({ user, - assets, - deadline, - signedPermits, + supplyAssets, + repayAssets: repayAssetsStable, + signedSupplyPermits, + signedCreditDelegationPermits, + creditDelegationApprovals, }); - const txObj = mNoBorrowsPermit[0]; + const txObj = migrateTxs[0]; expect(txObj.txType).toEqual(eEthereumTxType.V3_MIGRATION_ACTION); const tx: transactionType = await txObj.tx(); @@ -475,15 +330,15 @@ describe('V3MigrationService', () => { const decoded = utils.defaultAbiCoder.decode( [ - 'address', 'address[]', + '(address,uint256)[]', + '(address,uint256,uint256,uint256,bytes32,bytes32)[]', '(address,uint256,uint256,uint256,bytes32,bytes32)[]', ], utils.hexDataSlice(tx.data ?? '', 4), ); - expect(decoded[0]).toEqual(user); - expect(decoded[1]).toEqual(assets); + expect(decoded.length).toEqual(4); // gas price const gasPrice: GasType | null = await txObj.gas(); @@ -491,23 +346,25 @@ describe('V3MigrationService', () => { expect(gasPrice?.gasLimit).toEqual('1'); expect(gasPrice?.gasPrice).toEqual('1'); }); - it('Expects to fails when user not address', async () => { - const instance = new V3MigrationHelperService( + it('Expects to fail when user not eth address', async () => { + const spy = jest + .spyOn(IMigrationHelper__factory, 'connect') + .mockReturnValue({ + getMigrationSupply: async () => + Promise.resolve(['sdasd', BigNumber.from('1111')]), + } as unknown as IMigrationHelper); + + const migrationHelper = new V3MigrationHelperService( provider, MIGRATOR_ADDRESS, pool, ); - const user = 'asdf'; - await expect(async () => - instance.migrateNoBorrowWithPermits({ - user, - assets, - deadline, - signedPermits, - }), - ).rejects.toThrowError( - `Address: ${user} is not a valid ethereum Address`, - ); + + await migrationHelper.getMigrationSupply({ + asset: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', + amount: '1', + }); + expect(spy).toBeCalled(); }); }); }); diff --git a/packages/contract-helpers/src/v3-pool-contract/index.ts b/packages/contract-helpers/src/v3-pool-contract/index.ts index 5cce8fd0..4e4e025b 100644 --- a/packages/contract-helpers/src/v3-pool-contract/index.ts +++ b/packages/contract-helpers/src/v3-pool-contract/index.ts @@ -48,6 +48,7 @@ import { ParaswapRepayWithCollateralInterface, } from '../paraswap-repayWithCollateralAdapter-contract'; import { SynthetixInterface, SynthetixService } from '../synthetix-contract'; +import { IMigrationHelper } from '../v3-migration-contract/typechain/IMigrationHelper'; import { L2Pool, L2PoolInterface } from '../v3-pool-rollups'; import { WETHGatewayInterface, @@ -312,6 +313,7 @@ export class Pool extends BaseService implements PoolInterface { ), from: user, value: getTxValue(reserve, convertedAmount), + action: ProtocolAction.supply, }); txs.push({ @@ -407,6 +409,7 @@ export class Pool extends BaseService implements PoolInterface { ), from: user, value: getTxValue(reserve, convertedAmount), + action: ProtocolAction.supply, }); txs.push({ @@ -558,12 +561,17 @@ export class Pool extends BaseService implements PoolInterface { sig.s, ), from: user, + action: ProtocolAction.supplyWithPermit, }); txs.push({ tx: txCallback, txType: eEthereumTxType.DLP_ACTION, - gas: this.generateTxPriceEstimation(txs, txCallback), + gas: this.generateTxPriceEstimation( + txs, + txCallback, + ProtocolAction.supplyWithPermit, + ), }); return txs; @@ -706,13 +714,18 @@ export class Pool extends BaseService implements PoolInterface { onBehalfOf ?? user, ), from: user, + action: ProtocolAction.borrow, }); return [ { tx: txCallback, txType: eEthereumTxType.DLP_ACTION, - gas: this.generateTxPriceEstimation([], txCallback), + gas: this.generateTxPriceEstimation( + [], + txCallback, + ProtocolAction.borrow, + ), }, ]; } @@ -807,6 +820,7 @@ export class Pool extends BaseService implements PoolInterface { ), from: user, value: getTxValue(reserve, convertedAmount), + action: ProtocolAction.repay, }); txs.push({ @@ -895,6 +909,7 @@ export class Pool extends BaseService implements PoolInterface { ), from: user, value: getTxValue(reserve, convertedAmount), + action: ProtocolAction.repayWithPermit, }); txs.push({ @@ -903,7 +918,7 @@ export class Pool extends BaseService implements PoolInterface { gas: this.generateTxPriceEstimation( txs, txCallback, - ProtocolAction.repay, + ProtocolAction.repayWithPermit, ), }); @@ -1175,6 +1190,7 @@ export class Pool extends BaseService implements PoolInterface { referralCode ?? '0', ), from: user, + action: ProtocolAction.swapCollateral, }); txs.push({ @@ -1335,6 +1351,7 @@ export class Pool extends BaseService implements PoolInterface { referralCode ?? '0', ), from: user, + action: ProtocolAction.repayCollateral, }); txs.push({ @@ -1567,14 +1584,16 @@ export class Pool extends BaseService implements PoolInterface { borrowPosition.rateMode.toString(), ]); - const mappedPermits = permits.map(permit => [ - permit.aToken, - permit.value, - permit.deadline, - permit.v, - permit.r, - permit.s, - ]); + const mappedPermits = permits.map( + (permit: IMigrationHelper.PermitInputStruct) => [ + permit.aToken, + permit.value, + permit.deadline, + permit.v, + permit.r, + permit.s, + ], + ); const params: string = utils.defaultAbiCoder.encode( [ diff --git a/packages/contract-helpers/src/v3-pool-contract/lendingPoolTypes.ts b/packages/contract-helpers/src/v3-pool-contract/lendingPoolTypes.ts index 804e852d..4ae292d8 100644 --- a/packages/contract-helpers/src/v3-pool-contract/lendingPoolTypes.ts +++ b/packages/contract-helpers/src/v3-pool-contract/lendingPoolTypes.ts @@ -5,7 +5,7 @@ import { InterestRate, PermitSignature, } from '../commons/types'; -import { IMigrationHelper } from '../v3-migration-contract/typechain/MigrationHelper'; +import { IMigrationHelper } from '../v3-migration-contract/typechain/IMigrationHelper'; export type LPSupplyParamsType = { user: tEthereumAddress; diff --git a/packages/contract-helpers/src/v3-pool-contract/pool.test.ts b/packages/contract-helpers/src/v3-pool-contract/pool.test.ts index 3f40dee5..f51d96fd 100644 --- a/packages/contract-helpers/src/v3-pool-contract/pool.test.ts +++ b/packages/contract-helpers/src/v3-pool-contract/pool.test.ts @@ -121,7 +121,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -137,7 +141,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all parameters but not onBehalfOf', async () => { @@ -170,7 +176,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -186,7 +196,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all parameters but not referral', async () => { @@ -219,7 +231,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -235,7 +251,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all parameters and needing approval', async () => { @@ -280,7 +298,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -463,7 +485,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -479,7 +505,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all parameters with optimal path enabled', async () => { @@ -543,7 +571,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -559,7 +591,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all parameters but not referral', async () => { @@ -592,7 +626,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -608,7 +646,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all parameters and needing approval', async () => { @@ -653,7 +693,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supply].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1009,7 +1053,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supplyWithPermit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1042,7 +1090,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supplyWithPermit].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object if all params ok and optimal path chosen', async () => { @@ -1088,7 +1138,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supplyWithPermit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1121,7 +1175,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supplyWithPermit].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object if all params ok, without referralCode', async () => { @@ -1145,7 +1201,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.supplyWithPermit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1178,7 +1238,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.supplyWithPermit].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects to fail when sythetix is not validated', async () => { @@ -1632,7 +1694,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ), + ); const decoded = utils.defaultAbiCoder.decode( ['address', 'uint256', 'uint256', 'uint16', 'address'], @@ -1648,7 +1714,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all parameters with optimal path selected', async () => { @@ -1700,7 +1768,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ), + ); const decoded = utils.defaultAbiCoder.decode( ['address', 'uint256', 'uint256', 'uint16', 'address'], @@ -1716,7 +1788,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all parameters with Interest rate Variable', async () => { @@ -1744,7 +1818,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ), + ); const decoded = utils.defaultAbiCoder.decode( ['address', 'uint256', 'uint256', 'uint16', 'address'], @@ -1760,7 +1838,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.borrow].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects to fail when borrowing eth and not passing debtTokenAddress', async () => { @@ -1951,7 +2031,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -1967,7 +2051,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params without onBehalfOf and no approval', async () => { @@ -2000,7 +2086,7 @@ describe('Pool', () => { expect(depositTxObj.length).toEqual(0); }); - it('Expects the tx object passing all params with amount -1 with approve needed and reate stable', async () => { + it('Expects the tx object passing all params with amount -1 with approve needed and rate stable', async () => { const poolInstance = new Pool(provider, config); const isApprovedSpy = jest .spyOn(poolInstance.erc20Service, 'isApproved') @@ -2044,7 +2130,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2108,7 +2198,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repay].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2280,7 +2374,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayWithPermit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2313,7 +2411,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayWithPermit].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params with optimal path', async () => { @@ -2344,7 +2444,7 @@ describe('Pool', () => { expect(depositTxObj.length).toEqual(0); }); - it('Expects the tx object passing all params with amount -1 and reate stable', async () => { + it('Expects the tx object passing all params with amount -1 and rate stable', async () => { const poolInstance = new Pool(provider, config); const decimalsSpy = jest .spyOn(poolInstance.erc20Service, 'decimalsOf') @@ -2376,7 +2476,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayWithPermit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2409,7 +2513,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayWithPermit].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params with with specific amount and synthetix repayment with valid amount and rate variable', async () => { @@ -2442,7 +2548,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayWithPermit].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -2475,7 +2585,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayWithPermit].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects to fail passing all params with with specific amount and synthetix repayment but not valid amount', async () => { @@ -3278,7 +3390,12 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -3362,7 +3479,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -3406,7 +3527,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params without referralCode and no approval needed for flash', async () => { @@ -3443,7 +3566,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -3487,7 +3614,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no approval needed with flash and no swapAll', async () => { @@ -3525,7 +3654,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -3569,7 +3702,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.swapCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params without permitSignature and no approval needed without flash', async () => { @@ -3926,7 +4061,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4014,7 +4153,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4060,7 +4203,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no approval needed for flash with rate mode Variable', async () => { @@ -4100,7 +4245,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4146,7 +4295,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no approval needed for flash without onBehalfOf', async () => { @@ -4185,7 +4336,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4231,7 +4386,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no approval needed for flash without referralCode', async () => { @@ -4270,7 +4427,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4316,7 +4477,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no approval needed without flash and not repayAllDebt', async () => { @@ -4355,7 +4518,11 @@ describe('Pool', () => { const tx: transactionType = await txObj.tx(); expect(tx.to).toEqual(POOL); expect(tx.from).toEqual(user); - expect(tx.gasLimit).toEqual(BigNumber.from(1)); + expect(tx.gasLimit).toEqual( + BigNumber.from( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ), + ); expect(tx.value).toEqual(DEFAULT_NULL_VALUE_ON_TX); const decoded = utils.defaultAbiCoder.decode( @@ -4401,7 +4568,9 @@ describe('Pool', () => { // gas price const gasPrice: GasType | null = await txObj.gas(); expect(gasPrice).not.toBeNull(); - expect(gasPrice?.gasLimit).toEqual('1'); + expect(gasPrice?.gasLimit).toEqual( + gasLimitRecommendations[ProtocolAction.repayCollateral].recommended, + ); expect(gasPrice?.gasPrice).toEqual('1'); }); it('Expects the tx object passing all params and no permitSignature, and no flash', async () => { @@ -5075,7 +5244,7 @@ describe('Pool', () => { 'Can not repay with aTokens with eth. Should be WETH instead', ); }); - it('Expects the tx object passing all params with amount -1 with reate stable', async () => { + it('Expects the tx object passing all params with amount -1 with rate stable', async () => { const poolInstance = new Pool(provider, config); const decimalsSpy = jest .spyOn(poolInstance.erc20Service, 'decimalsOf') diff --git a/packages/math-utils/CHANGELOG.md b/packages/math-utils/CHANGELOG.md index f4583da0..22fa0605 100644 --- a/packages/math-utils/CHANGELOG.md +++ b/packages/math-utils/CHANGELOG.md @@ -3,35 +3,79 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## 1.12.2 (2023-01-12) - -**Note:** Version bump only for package @aave/math-utils +## 1.13.5 (2023-02-03) +### Bug Fixes +- Fix typos ([#486](https://github.com/aave/aave-utilities/issues/486)) + ([db4cef5](https://github.com/aave/aave-utilities/commit/db4cef584a68f951183df25ffa2e8f2042893d21)) +## 1.13.4 (2023-02-03) +### Bug Fixes -## 1.12.1 (2023-01-10) +- check for liq threshold in place of ltv for user collateral check + ([#505](https://github.com/aave/aave-utilities/issues/505)) + ([7c776d2](https://github.com/aave/aave-utilities/commit/7c776d23c50ff0d5240151a922c64e837818283d)) +## 1.13.3 (2023-01-26) ### Bug Fixes -* change flashloan parameters to have variable debt on v3 instead of stable and variable ([#490](https://github.com/aave/aave-utilities/issues/490)) ([9b8a726](https://github.com/aave/aave-utilities/commit/9b8a7261ba9c3e123798d781312a5388271cef3b)) +- typechain structure + ([#501](https://github.com/aave/aave-utilities/issues/501)) + ([70f3c4f](https://github.com/aave/aave-utilities/commit/70f3c4f4b066676a37636ed1be913e3056a70766)) + +## 1.13.2 (2023-01-25) +**Note:** Version bump only for package @aave/math-utils + +# Change Log +All notable changes to this project will be documented in this file. See +[Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 1.13.1 (2023-01-24) +### Bug Fixes -# 1.12.0 (2023-01-03) +- apply default gas limit estimations + ([#499](https://github.com/aave/aave-utilities/issues/499)) + ([b377452](https://github.com/aave/aave-utilities/commit/b37745255194cc2f8c713bc3451a05dc8bab20a1)) +# 1.13.0 (2023-01-23) ### Features -* add V3Faucet service ([#475](https://github.com/aave/aave-utilities/issues/475)) ([1608398](https://github.com/aave/aave-utilities/commit/160839863a83955d54a4a1e727bb4a22f111c13e)) +- add default gas estimation for borrow and vote + ([#492](https://github.com/aave/aave-utilities/issues/492)) + ([713ad36](https://github.com/aave/aave-utilities/commit/713ad361215f0fcbaaf07f7e374489459d1874ae)) +* add default gas estimation for permit actions + ([#461](https://github.com/aave/aave-utilities/issues/461)) + ([7342763](https://github.com/aave/aave-utilities/commit/734276326b1d6b0b2b9aa9965bbd3f310ae0ec37)) +# 1.9.0 (2022-10-14) +## 1.12.2 (2023-01-12) +**Note:** Version bump only for package @aave/math-utils + +## 1.12.1 (2023-01-10) + +### Bug Fixes + +- change flashloan parameters to have variable debt on v3 instead of stable and + variable ([#490](https://github.com/aave/aave-utilities/issues/490)) + ([9b8a726](https://github.com/aave/aave-utilities/commit/9b8a7261ba9c3e123798d781312a5388271cef3b)) + +# 1.12.0 (2023-01-03) + +### Features + +- add V3Faucet service + ([#475](https://github.com/aave/aave-utilities/issues/475)) + ([1608398](https://github.com/aave/aave-utilities/commit/160839863a83955d54a4a1e727bb4a22f111c13e)) ## 1.11.2 (2022-12-29) @@ -45,18 +89,8 @@ All notable changes to this project will be documented in this file. See **Note:** Version bump only for package @aave/math-utils -# 1.10.0 (2022-12-14) - -### Features - -- add default gas estimation for permit actions - ([#461](https://github.com/aave/aave-utilities/issues/461)) - ([7342763](https://github.com/aave/aave-utilities/commit/734276326b1d6b0b2b9aa9965bbd3f310ae0ec37)) - # 1.11.0 (2022-12-21) -# 1.9.0 (2022-10-14) - ### Features - v3 migration ([#465](https://github.com/aave/aave-utilities/issues/465)) diff --git a/packages/math-utils/package.json b/packages/math-utils/package.json index eec6c339..7249ceed 100644 --- a/packages/math-utils/package.json +++ b/packages/math-utils/package.json @@ -1,6 +1,6 @@ { "name": "@aave/math-utils", - "version": "1.12.2", + "version": "1.13.5", "license": "MIT", "description": "", "scripts": { diff --git a/packages/math-utils/src/formatters/gho/index.test.ts b/packages/math-utils/src/formatters/gho/index.test.ts index e3dff212..4032f6a4 100644 --- a/packages/math-utils/src/formatters/gho/index.test.ts +++ b/packages/math-utils/src/formatters/gho/index.test.ts @@ -34,7 +34,7 @@ describe('formatGhoData', () => { currentTimestamp: 2, }); - expect(result.userGhoDiscountRate).toEqual(0.1); + expect(result.userGhoDiscountPercent).toEqual(0.1); expect(result.userGhoAvailableToBorrowAtDiscount).toEqual(10000); expect(result.userDiscountTokenBalance).toEqual(100); expect(result.userDiscountLockPeriodEndTimestamp).toEqual(1); diff --git a/packages/math-utils/src/formatters/gho/index.ts b/packages/math-utils/src/formatters/gho/index.ts index c330126d..15b3af88 100644 --- a/packages/math-utils/src/formatters/gho/index.ts +++ b/packages/math-utils/src/formatters/gho/index.ts @@ -18,7 +18,7 @@ export interface GhoReserveData { } export interface GhoUserData { - userGhoDiscountRate: string; + userGhoDiscountPercent: string; userDiscountTokenBalance: string; userPreviousGhoBorrowIndex: string; userGhoScaledBorrowBalance: string; @@ -41,7 +41,7 @@ export interface FormattedGhoReserveData { } export interface FormattedGhoUserData { - userGhoDiscountRate: number; + userGhoDiscountPercent: number; userDiscountTokenBalance: number; userGhoBorrowBalance: number; userDiscountedGhoInterest: number; @@ -126,11 +126,13 @@ export function formatGhoUserData({ ), ); const discount = accruedInterest.multipliedBy( - 1 - Number(normalize(ghoUserData.userGhoDiscountRate, 4)), + 1 - Number(normalize(ghoUserData.userGhoDiscountPercent, 4)), ); const userBorrowBalance = userBalancePreDiscount.minus(discount); return { - userGhoDiscountRate: Number(normalize(ghoUserData.userGhoDiscountRate, 4)), + userGhoDiscountPercent: Number( + normalize(ghoUserData.userGhoDiscountPercent, 4), + ), userDiscountTokenBalance: formattedUserDiscountTokenBalance, userGhoBorrowBalance: Number(normalize(userBorrowBalance, 18)), userDiscountLockPeriodEndTimestamp: Number( diff --git a/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.ts b/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.ts index 4650772e..861d2a05 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.ts @@ -13,7 +13,7 @@ export interface CalculateAccruedIncentivesRequest { } // Calculate incentives earned by user since reserveIndexTimestamp -// Incentives earned before reserveIndexTimestamp are tracked seperately (userUnclaimedRewards from UiIncentiveDataProvider) +// Incentives earned before reserveIndexTimestamp are tracked separately (userUnclaimedRewards from UiIncentiveDataProvider) // This function is used for deposit, variableDebt, and stableDebt incentives export function calculateAccruedIncentives({ principalUserBalance, diff --git a/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.ts b/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.ts index a52f4d04..0447786f 100644 --- a/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.ts +++ b/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.ts @@ -40,7 +40,8 @@ export function calculateUserReserveTotals({ .plus(userReserveSummary.stableBorrowsMarketReferenceCurrency); if ( - userReserveSummary.userReserve.reserve.usageAsCollateralEnabled && + userReserveSummary.userReserve.reserve.reserveLiquidationThreshold !== + '0' && userReserveSummary.userReserve.usageAsCollateralEnabledOnUser ) { if (userReserveSummary.userReserve.reserve.debtCeiling !== '0') { diff --git a/packages/math-utils/src/mocks.ts b/packages/math-utils/src/mocks.ts index f176ad31..839dc57a 100644 --- a/packages/math-utils/src/mocks.ts +++ b/packages/math-utils/src/mocks.ts @@ -343,7 +343,7 @@ export class GhoMock { }; this.ghoUserData = { - userGhoDiscountRate: '1000', // 10% + userGhoDiscountPercent: '1000', // 10% userDiscountTokenBalance: (10 ** 20).toString(), // 100 userPreviousGhoBorrowIndex: RAY.toString(), userGhoScaledBorrowBalance: (10 ** 18).toString(), // 1