diff --git a/package.json b/package.json index 304eca4c3..842aa74c3 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "dependencies": { "@0x/utils": "^4.5.2", "@balancer-labs/sor": "4.1.1-beta.4", - "@bgd-labs/aave-address-book": "2.21.1", + "@bgd-labs/aave-address-book": "4.7.0", "@ethersproject/abi": "^5.7.0", "@hashflow/sdk": "^2.2.7", "@hashflow/taker-js": "^0.3.7", diff --git a/src/abi/aavev3statav2/Factory.json b/src/abi/aavev3statav2/Factory.json new file mode 100644 index 000000000..37ca17618 --- /dev/null +++ b/src/abi/aavev3statav2/Factory.json @@ -0,0 +1,131 @@ +[ + { + "inputs": [ + { "internalType": "contract IPool", "name": "pool", "type": "address" }, + { "internalType": "address", "name": "proxyAdmin", "type": "address" }, + { + "internalType": "contract ITransparentProxyFactory", + "name": "transparentProxyFactory", + "type": "address" + }, + { "internalType": "address", "name": "stataTokenImpl", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "address", "name": "underlying", "type": "address" } + ], + "name": "NotListedUnderlying", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stataToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "underlying", + "type": "address" + } + ], + "name": "StataTokenCreated", + "type": "event" + }, + { + "inputs": [], + "name": "POOL", + "outputs": [ + { "internalType": "contract IPool", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PROXY_ADMIN", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STATA_TOKEN_IMPL", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRANSPARENT_PROXY_FACTORY", + "outputs": [ + { + "internalType": "contract ITransparentProxyFactory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "underlyings", + "type": "address[]" + } + ], + "name": "createStataTokens", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "underlying", "type": "address" } + ], + "name": "getStataToken", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStataTokens", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/abi/aavev3statav2/Pool.json b/src/abi/aavev3statav2/Pool.json new file mode 100644 index 000000000..0b8c77c2c --- /dev/null +++ b/src/abi/aavev3statav2/Pool.json @@ -0,0 +1,1459 @@ +[ + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "backer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "BackUnbacked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum DataTypes.InterestRateMode", + "name": "interestRateMode", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "initiator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum DataTypes.InterestRateMode", + "name": "interestRateMode", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + } + ], + "name": "FlashLoan", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalDebt", + "type": "uint256" + } + ], + "name": "IsolationModeTotalDebtUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateralAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "debtAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "debtToCover", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidatedCollateralAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "receiveAToken", + "type": "bool" + } + ], + "name": "LiquidationCall", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + } + ], + "name": "MintUnbacked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountMinted", + "type": "uint256" + } + ], + "name": "MintedToTreasury", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "repayer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "useATokens", + "type": "bool" + } + ], + "name": "Repay", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidityRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stableBorrowRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "variableBorrowRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidityIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "variableBorrowIndex", + "type": "uint256" + } + ], + "name": "ReserveDataUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidityRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stableBorrowRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "variableBorrowRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidityIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "variableBorrowIndex", + "type": "uint256" + } + ], + "name": "ReserveDataUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "ReserveUsedAsCollateralDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "ReserveUsedAsCollateralEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + } + ], + "name": "Supply", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "categoryId", + "type": "uint8" + } + ], + "name": "UserEModeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "ADDRESSES_PROVIDER", + "outputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BRIDGE_PROTOCOL_FEE", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FLASHLOAN_PREMIUM_TOTAL", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FLASHLOAN_PREMIUM_TO_PROTOCOL", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_NUMBER_RESERVES", + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POOL_REVISION", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint256", "name": "fee", "type": "uint256" } + ], + "name": "backUnbacked", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "interestRateMode", + "type": "uint256" + }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" } + ], + "name": "borrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint8", "name": "id", "type": "uint8" }, + { + "components": [ + { "internalType": "uint16", "name": "ltv", "type": "uint16" }, + { + "internalType": "uint16", + "name": "liquidationThreshold", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationBonus", + "type": "uint16" + }, + { "internalType": "string", "name": "label", "type": "string" } + ], + "internalType": "struct DataTypes.EModeCategoryBaseConfiguration", + "name": "category", + "type": "tuple" + } + ], + "name": "configureEModeCategory", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint8", "name": "id", "type": "uint8" }, + { + "internalType": "uint128", + "name": "borrowableBitmap", + "type": "uint128" + } + ], + "name": "configureEModeCategoryBorrowableBitmap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint8", "name": "id", "type": "uint8" }, + { + "internalType": "uint128", + "name": "collateralBitmap", + "type": "uint128" + } + ], + "name": "configureEModeCategoryCollateralBitmap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "dropReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "balanceFromBefore", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceToBefore", + "type": "uint256" + } + ], + "name": "finalizeTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiverAddress", + "type": "address" + }, + { "internalType": "address[]", "name": "assets", "type": "address[]" }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }, + { + "internalType": "uint256[]", + "name": "interestRateModes", + "type": "uint256[]" + }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "bytes", "name": "params", "type": "bytes" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "flashLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiverAddress", + "type": "address" + }, + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bytes", "name": "params", "type": "bytes" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "flashLoanSimple", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getBorrowLogic", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getBridgeLogic", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getConfiguration", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "data", "type": "uint256" } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint8", "name": "id", "type": "uint8" }], + "name": "getEModeCategoryBorrowableBitmap", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint8", "name": "id", "type": "uint8" }], + "name": "getEModeCategoryCollateralBitmap", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint8", "name": "id", "type": "uint8" }], + "name": "getEModeCategoryCollateralConfig", + "outputs": [ + { + "components": [ + { "internalType": "uint16", "name": "ltv", "type": "uint16" }, + { + "internalType": "uint16", + "name": "liquidationThreshold", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationBonus", + "type": "uint16" + } + ], + "internalType": "struct DataTypes.CollateralConfig", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint8", "name": "id", "type": "uint8" }], + "name": "getEModeCategoryData", + "outputs": [ + { + "components": [ + { "internalType": "uint16", "name": "ltv", "type": "uint16" }, + { + "internalType": "uint16", + "name": "liquidationThreshold", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationBonus", + "type": "uint16" + }, + { + "internalType": "address", + "name": "priceSource", + "type": "address" + }, + { "internalType": "string", "name": "label", "type": "string" } + ], + "internalType": "struct DataTypes.EModeCategoryLegacy", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint8", "name": "id", "type": "uint8" }], + "name": "getEModeCategoryLabel", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEModeLogic", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getFlashLoanLogic", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getLiquidationGracePeriod", + "outputs": [{ "internalType": "uint40", "name": "", "type": "uint40" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getLiquidationLogic", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolLogic", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "id", "type": "uint16" }], + "name": "getReserveAddressById", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getReserveData", + "outputs": [ + { + "components": [ + { + "components": [ + { "internalType": "uint256", "name": "data", "type": "uint256" } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "configuration", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "liquidityIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentLiquidityRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "variableBorrowIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentVariableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentStableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + }, + { "internalType": "uint16", "name": "id", "type": "uint16" }, + { + "internalType": "address", + "name": "aTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "variableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + }, + { + "internalType": "uint128", + "name": "accruedToTreasury", + "type": "uint128" + }, + { "internalType": "uint128", "name": "unbacked", "type": "uint128" }, + { + "internalType": "uint128", + "name": "isolationModeTotalDebt", + "type": "uint128" + } + ], + "internalType": "struct DataTypes.ReserveDataLegacy", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getReserveDataExtended", + "outputs": [ + { + "components": [ + { + "components": [ + { "internalType": "uint256", "name": "data", "type": "uint256" } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "configuration", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "liquidityIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentLiquidityRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "variableBorrowIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentVariableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "__deprecatedStableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + }, + { "internalType": "uint16", "name": "id", "type": "uint16" }, + { + "internalType": "uint40", + "name": "liquidationGracePeriodUntil", + "type": "uint40" + }, + { + "internalType": "address", + "name": "aTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "__deprecatedStableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "variableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + }, + { + "internalType": "uint128", + "name": "accruedToTreasury", + "type": "uint128" + }, + { "internalType": "uint128", "name": "unbacked", "type": "uint128" }, + { + "internalType": "uint128", + "name": "isolationModeTotalDebt", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "virtualUnderlyingBalance", + "type": "uint128" + } + ], + "internalType": "struct DataTypes.ReserveData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getReserveNormalizedIncome", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getReserveNormalizedVariableDebt", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReservesCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReservesList", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSupplyLogic", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getUserAccountData", + "outputs": [ + { + "internalType": "uint256", + "name": "totalCollateralBase", + "type": "uint256" + }, + { "internalType": "uint256", "name": "totalDebtBase", "type": "uint256" }, + { + "internalType": "uint256", + "name": "availableBorrowsBase", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentLiquidationThreshold", + "type": "uint256" + }, + { "internalType": "uint256", "name": "ltv", "type": "uint256" }, + { "internalType": "uint256", "name": "healthFactor", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getUserConfiguration", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "data", "type": "uint256" } + ], + "internalType": "struct DataTypes.UserConfigurationMap", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getUserEMode", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getVirtualUnderlyingBalance", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "aTokenAddress", "type": "address" }, + { + "internalType": "address", + "name": "variableDebtAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + } + ], + "name": "initReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "collateralAsset", + "type": "address" + }, + { "internalType": "address", "name": "debtAsset", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "debtToCover", "type": "uint256" }, + { "internalType": "bool", "name": "receiveAToken", "type": "bool" } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "assets", "type": "address[]" } + ], + "name": "mintToTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "mintUnbacked", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "interestRateMode", + "type": "uint256" + }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" } + ], + "name": "repay", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "interestRateMode", + "type": "uint256" + } + ], + "name": "repayWithATokens", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "interestRateMode", + "type": "uint256" + }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "permitV", "type": "uint8" }, + { "internalType": "bytes32", "name": "permitR", "type": "bytes32" }, + { "internalType": "bytes32", "name": "permitS", "type": "bytes32" } + ], + "name": "repayWithPermit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "rescueTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "resetIsolationModeTotalDebt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { + "components": [ + { "internalType": "uint256", "name": "data", "type": "uint256" } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "configuration", + "type": "tuple" + } + ], + "name": "setConfiguration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint40", "name": "until", "type": "uint40" } + ], + "name": "setLiquidationGracePeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { + "internalType": "address", + "name": "rateStrategyAddress", + "type": "address" + } + ], + "name": "setReserveInterestRateStrategyAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint8", "name": "categoryId", "type": "uint8" } + ], + "name": "setUserEMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "bool", "name": "useAsCollateral", "type": "bool" } + ], + "name": "setUserUseReserveAsCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "supply", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "permitV", "type": "uint8" }, + { "internalType": "bytes32", "name": "permitR", "type": "bytes32" }, + { "internalType": "bytes32", "name": "permitS", "type": "bytes32" } + ], + "name": "supplyWithPermit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "syncIndexesState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "syncRatesState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "protocolFee", "type": "uint256" } + ], + "name": "updateBridgeProtocolFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "flashLoanPremiumTotal", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "flashLoanPremiumToProtocol", + "type": "uint128" + } + ], + "name": "updateFlashloanPremiums", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "withdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/abi/aavev3statav2/Token.json b/src/abi/aavev3statav2/Token.json new file mode 100644 index 000000000..b2942316b --- /dev/null +++ b/src/abi/aavev3statav2/Token.json @@ -0,0 +1,997 @@ +[ + { + "inputs": [ + { "internalType": "contract IPool", "name": "pool", "type": "address" }, + { + "internalType": "contract IRewardsController", + "name": "rewardsController", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "address", "name": "target", "type": "address" } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "length", "type": "uint256" } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "allowance", "type": "uint256" }, + { "internalType": "uint256", "name": "needed", "type": "uint256" } + ], + "name": "ERC20InsufficientAllowance", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "uint256", "name": "balance", "type": "uint256" }, + { "internalType": "uint256", "name": "needed", "type": "uint256" } + ], + "name": "ERC20InsufficientBalance", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "approver", "type": "address" } + ], + "name": "ERC20InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "ERC20InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "ERC20InvalidSender", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "ERC20InvalidSpender", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "ERC2612ExpiredSignature", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "signer", "type": "address" }, + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "ERC2612InvalidSigner", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "uint256", "name": "max", "type": "uint256" } + ], + "name": "ERC4626ExceededMaxDeposit", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "uint256", "name": "max", "type": "uint256" } + ], + "name": "ERC4626ExceededMaxMint", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "uint256", "name": "max", "type": "uint256" } + ], + "name": "ERC4626ExceededMaxRedeem", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "uint256", "name": "max", "type": "uint256" } + ], + "name": "ERC4626ExceededMaxWithdraw", + "type": "error" + }, + { "inputs": [], "name": "EnforcedPause", "type": "error" }, + { "inputs": [], "name": "EthTransferFailed", "type": "error" }, + { "inputs": [], "name": "ExpectedPause", "type": "error" }, + { "inputs": [], "name": "FailedInnerCall", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "currentNonce", "type": "uint256" } + ], + "name": "InvalidAccountNonce", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "claimer", "type": "address" } + ], + "name": "InvalidClaimer", + "type": "error" + }, + { "inputs": [], "name": "InvalidInitialization", "type": "error" }, + { "inputs": [], "name": "MathOverflowedMulDiv", "type": "error" }, + { "inputs": [], "name": "NotInitializing", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "caller", "type": "address" } + ], + "name": "OnlyPauseGuardian", + "type": "error" + }, + { "inputs": [], "name": "OnlyRescueGuardian", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "pool", "type": "address" } + ], + "name": "PoolAddressMismatch", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "reward", "type": "address" } + ], + "name": "RewardNotInitialized", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { "inputs": [], "name": "StaticATokenInvalidZeroShares", "type": "error" }, + { + "inputs": [], + "name": "ZeroIncentivesControllerIsForbidden", + "type": "error" + }, + { + "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": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ERC20Rescued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "NativeTokensRescued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reward", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startIndex", + "type": "uint256" + } + ], + "name": "RewardTokenRegistered", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INCENTIVES_CONTROLLER", + "outputs": [ + { + "internalType": "contract IRewardsController", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POOL", + "outputs": [ + { "internalType": "contract IPool", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POOL_ADDRESSES_PROVIDER", + "outputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RAY", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "aToken", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "asset", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "actor", "type": "address" } + ], + "name": "canPause", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "address[]", "name": "rewards", "type": "address[]" } + ], + "name": "claimRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "address[]", "name": "rewards", "type": "address[]" } + ], + "name": "claimRewardsOnBehalf", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "rewards", "type": "address[]" } + ], + "name": "claimRewardsToSelf", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "reward", "type": "address" } + ], + "name": "collectAndUpdateRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "convertToAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "name": "convertToShares", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "deposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "depositATokens", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { + "components": [ + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct IERC4626StataToken.SignatureParams", + "name": "sig", + "type": "tuple" + }, + { "internalType": "bool", "name": "depositToAave", "type": "bool" } + ], + "name": "depositWithPermit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { "internalType": "bytes1", "name": "fields", "type": "bytes1" }, + { "internalType": "string", "name": "name", "type": "string" }, + { "internalType": "string", "name": "version", "type": "string" }, + { "internalType": "uint256", "name": "chainId", "type": "uint256" }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { "internalType": "bytes32", "name": "salt", "type": "bytes32" }, + { "internalType": "uint256[]", "name": "extensions", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "emergencyEtherTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "erc20Token", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "emergencyTokenTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "address", "name": "reward", "type": "address" } + ], + "name": "getClaimableRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "reward", "type": "address" } + ], + "name": "getCurrentRewardsIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReferenceAsset", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "reward", "type": "address" } + ], + "name": "getTotalClaimableRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "address", "name": "reward", "type": "address" } + ], + "name": "getUnclaimedRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "aToken", "type": "address" }, + { + "internalType": "string", + "name": "staticATokenName", + "type": "string" + }, + { + "internalType": "string", + "name": "staticATokenSymbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "reward", "type": "address" } + ], + "name": "isRegisteredRewardToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestAnswer", + "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "maxDeposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "maxMint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "maxRedeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "maxRescue", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "maxWithdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "mint", + "outputs": [{ "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": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "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": "uint256", "name": "assets", "type": "uint256" } + ], + "name": "previewDeposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "previewMint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "previewRedeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "name": "previewWithdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "redeemATokens", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "refreshRewardTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardTokens", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bool", "name": "paused", "type": "bool" }], + "name": "setPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "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": "value", "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": "value", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "whoCanRescue", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "withdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/dex/aave-gsm/config.ts b/src/dex/aave-gsm/config.ts index 51e3323d4..c0819f1b4 100644 --- a/src/dex/aave-gsm/config.ts +++ b/src/dex/aave-gsm/config.ts @@ -1,13 +1,13 @@ import { DexParams } from './types'; import { DexConfigMap } from '../../types'; import { Network } from '../../constants'; -import { AaveV3Ethereum, MiscEthereum } from '@bgd-labs/aave-address-book'; +import { AaveV3Ethereum, GhoEthereum } from '@bgd-labs/aave-address-book'; export const AaveGsmConfig: DexConfigMap = { AaveGsm: { [Network.MAINNET]: { - GSM_USDT: MiscEthereum.GSM_USDT, - GSM_USDC: MiscEthereum.GSM_USDC, + GSM_USDT: GhoEthereum.GSM_USDT, + GSM_USDC: GhoEthereum.GSM_USDC, USDT: AaveV3Ethereum.ASSETS.USDT.UNDERLYING, USDC: AaveV3Ethereum.ASSETS.USDC.UNDERLYING, GHO: AaveV3Ethereum.ASSETS.GHO.UNDERLYING, diff --git a/src/dex/aave-v2/tokenlist.json b/src/dex/aave-v2/tokenlist.json new file mode 100644 index 000000000..f8cc44060 --- /dev/null +++ b/src/dex/aave-v2/tokenlist.json @@ -0,0 +1,904 @@ +[ + { + "chainId": 1, + "address": "0xf9Fb4AD91812b704Ba883B11d2B576E890a6730A", + "name": "Aave AMM Market WETH", + "decimals": 18, + "symbol": "aAmmWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + } + }, + { + "chainId": 1, + "address": "0x79bE75FFC64DD58e66787E4Eae470c8a1FD08ba4", + "name": "Aave AMM Market DAI", + "decimals": 18, + "symbol": "aAmmDAI", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x6B175474E89094C44Da98b954EedeAC495271d0F" + } + }, + { + "chainId": 1, + "address": "0xd24946147829DEaA935bE2aD85A3291dbf109c80", + "name": "Aave AMM Market USDC", + "decimals": 6, + "symbol": "aAmmUSDC", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + } + }, + { + "chainId": 1, + "address": "0x17a79792Fe6fE5C95dFE95Fe3fCEE3CAf4fE4Cb7", + "name": "Aave AMM Market USDT", + "decimals": 6, + "symbol": "aAmmUSDT", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xdAC17F958D2ee523a2206206994597C13D831ec7" + } + }, + { + "chainId": 1, + "address": "0x13B2f6928D7204328b0E8E4BCd0379aA06EA21FA", + "name": "Aave AMM Market WBTC", + "decimals": 8, + "symbol": "aAmmWBTC", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" + } + }, + { + "chainId": 1, + "address": "0x9303EabC860a743aABcc3A1629014CaBcc3F8D36", + "name": "Aave AMM Market UniDAIWETH", + "decimals": 18, + "symbol": "aAmmUniDAIWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11" + } + }, + { + "chainId": 1, + "address": "0xc58F53A8adff2fB4eb16ED56635772075E2EE123", + "name": "Aave AMM Market UniWBTCWETH", + "decimals": 18, + "symbol": "aAmmUniWBTCWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xBb2b8038a1640196FbE3e38816F3e67Cba72D940" + } + }, + { + "chainId": 1, + "address": "0xe59d2FF6995a926A574390824a657eEd36801E55", + "name": "Aave AMM Market UniAAVEWETH", + "decimals": 18, + "symbol": "aAmmUniAAVEWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xDFC14d2Af169B0D36C4EFF567Ada9b2E0CAE044f" + } + }, + { + "chainId": 1, + "address": "0xA1B0edF4460CC4d8bFAA18Ed871bFF15E5b57Eb4", + "name": "Aave AMM Market UniBATWETH", + "decimals": 18, + "symbol": "aAmmUniBATWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xB6909B960DbbE7392D405429eB2b3649752b4838" + } + }, + { + "chainId": 1, + "address": "0xE340B25fE32B1011616bb8EC495A4d503e322177", + "name": "Aave AMM Market UniDAIUSDC", + "decimals": 18, + "symbol": "aAmmUniDAIUSDC", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5" + } + }, + { + "chainId": 1, + "address": "0x0ea20e7fFB006d4Cfe84df2F72d8c7bD89247DB0", + "name": "Aave AMM Market UniCRVWETH", + "decimals": 18, + "symbol": "aAmmUniCRVWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x3dA1313aE46132A397D90d95B1424A9A7e3e0fCE" + } + }, + { + "chainId": 1, + "address": "0xb8db81B84d30E2387de0FF330420A4AAA6688134", + "name": "Aave AMM Market UniLINKWETH", + "decimals": 18, + "symbol": "aAmmUniLINKWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xa2107FA5B38d9bbd2C461D6EDf11B11A50F6b974" + } + }, + { + "chainId": 1, + "address": "0x370adc71f67f581158Dc56f539dF5F399128Ddf9", + "name": "Aave AMM Market UniMKRWETH", + "decimals": 18, + "symbol": "aAmmUniMKRWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xC2aDdA861F89bBB333c90c492cB837741916A225" + } + }, + { + "chainId": 1, + "address": "0xA9e201A4e269d6cd5E9F0FcbcB78520cf815878B", + "name": "Aave AMM Market UniRENWETH", + "decimals": 18, + "symbol": "aAmmUniRENWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x8Bd1661Da98EBDd3BD080F0bE4e6d9bE8cE9858c" + } + }, + { + "chainId": 1, + "address": "0x38E491A71291CD43E8DE63b7253E482622184894", + "name": "Aave AMM Market UniSNXWETH", + "decimals": 18, + "symbol": "aAmmUniSNXWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x43AE24960e5534731Fc831386c07755A2dc33D47" + } + }, + { + "chainId": 1, + "address": "0x3D26dcd840fCC8e4B2193AcE8A092e4a65832F9f", + "name": "Aave AMM Market UniUNIWETH", + "decimals": 18, + "symbol": "aAmmUniUNIWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xd3d2E2692501A5c9Ca623199D38826e513033a17" + } + }, + { + "chainId": 1, + "address": "0x391E86e2C002C70dEe155eAceB88F7A3c38f5976", + "name": "Aave AMM Market UniUSDCWETH", + "decimals": 18, + "symbol": "aAmmUniUSDCWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc" + } + }, + { + "chainId": 1, + "address": "0x2365a4890eD8965E564B7E2D27C38Ba67Fec4C6F", + "name": "Aave AMM Market UniWBTCUSDC", + "decimals": 18, + "symbol": "aAmmUniWBTCUSDC", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x004375Dff511095CC5A197A54140a24eFEF3A416" + } + }, + { + "chainId": 1, + "address": "0x5394794Be8b6eD5572FCd6b27103F46b5F390E8f", + "name": "Aave AMM Market UniYFIWETH", + "decimals": 18, + "symbol": "aAmmUniYFIWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x2fDbAdf3C4D5A8666Bc06645B8358ab803996E28" + } + }, + { + "chainId": 1, + "address": "0x358bD0d980E031E23ebA9AA793926857703783BD", + "name": "Aave AMM Market BptWBTCWETH", + "decimals": 18, + "symbol": "aAmmBptWBTCWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x1efF8aF5D577060BA4ac8A29A13525bb0Ee2A3D5" + } + }, + { + "chainId": 1, + "address": "0xd109b2A304587569c84308c55465cd9fF0317bFB", + "name": "Aave AMM Market BptBALWETH", + "decimals": 18, + "symbol": "aAmmBptBALWETH", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x59A19D8c652FA0284f44113D0ff9aBa70bd46fB4" + } + }, + { + "chainId": 1, + "address": "0xd145c6ae8931ed5Bca9b5f5B7dA5991F5aB63B5c", + "name": "Aave AMM Market GUniDAIUSDC", + "decimals": 18, + "symbol": "aAmmGUniDAIUSDC", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0x50379f632ca68D36E50cfBC8F78fe16bd1499d1e" + } + }, + { + "chainId": 1, + "address": "0xCa5DFDABBfFD58cfD49A9f78Ca52eC8e0591a3C5", + "name": "Aave AMM Market GUniUSDCUSDT", + "decimals": 18, + "symbol": "aAmmGUniUSDCUSDT", + "extensions": { + "pool": "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB", + "underlying": "0xD2eeC91055F07fE24C9cCB25828ecfEFd4be0c41" + } + }, + { + "chainId": 1, + "address": "0xd35f648C3C7f17cd1Ba92e5eac991E3EfcD4566d", + "name": "Aave Arc market USDC", + "decimals": 6, + "symbol": "aUSDC", + "extensions": { + "pool": "0x37D7306019a38Af123e4b245Eb6C28AF552e0bB0", + "underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + } + }, + { + "chainId": 1, + "address": "0xe6d6E7dA65A2C18109Ff56B7CBBdc7B706Fc13F8", + "name": "Aave Arc market WBTC", + "decimals": 8, + "symbol": "aWBTC", + "extensions": { + "pool": "0x37D7306019a38Af123e4b245Eb6C28AF552e0bB0", + "underlying": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" + } + }, + { + "chainId": 1, + "address": "0x319190E3Bbc595602A9E63B2bCfB61c6634355b1", + "name": "Aave Arc market WETH", + "decimals": 18, + "symbol": "aWETH", + "extensions": { + "pool": "0x37D7306019a38Af123e4b245Eb6C28AF552e0bB0", + "underlying": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + } + }, + { + "chainId": 1, + "address": "0x89eFaC495C65d43619c661df654ec64fc10C0A75", + "name": "Aave Arc market AAVE", + "decimals": 18, + "symbol": "aAAVE", + "extensions": { + "pool": "0x37D7306019a38Af123e4b245Eb6C28AF552e0bB0", + "underlying": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9" + } + }, + { + "chainId": 1, + "address": "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811", + "name": "Aave interest bearing USDT", + "decimals": 6, + "symbol": "aUSDT", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xdAC17F958D2ee523a2206206994597C13D831ec7" + } + }, + { + "chainId": 1, + "address": "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656", + "name": "Aave interest bearing WBTC", + "decimals": 8, + "symbol": "aWBTC", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" + } + }, + { + "chainId": 1, + "address": "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e", + "name": "Aave interest bearing WETH", + "decimals": 18, + "symbol": "aWETH", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + } + }, + { + "chainId": 1, + "address": "0x5165d24277cD063F5ac44Efd447B27025e888f37", + "name": "Aave interest bearing YFI", + "decimals": 18, + "symbol": "aYFI", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e" + } + }, + { + "chainId": 1, + "address": "0xDf7FF54aAcAcbFf42dfe29DD6144A69b629f8C9e", + "name": "Aave interest bearing ZRX", + "decimals": 18, + "symbol": "aZRX", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xE41d2489571d322189246DaFA5ebDe1F4699F498" + } + }, + { + "chainId": 1, + "address": "0xB9D7CB55f463405CDfBe4E90a6D2Df01C2B92BF1", + "name": "Aave interest bearing UNI", + "decimals": 18, + "symbol": "aUNI", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984" + } + }, + { + "chainId": 1, + "address": "0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B", + "name": "Aave interest bearing AAVE", + "decimals": 18, + "symbol": "aAAVE", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9" + } + }, + { + "chainId": 1, + "address": "0x05Ec93c0365baAeAbF7AefFb0972ea7ECdD39CF1", + "name": "Aave interest bearing BAT", + "decimals": 18, + "symbol": "aBAT", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x0D8775F648430679A709E98d2b0Cb6250d2887EF" + } + }, + { + "chainId": 1, + "address": "0xA361718326c15715591c299427c62086F69923D9", + "name": "Aave interest bearing BUSD", + "decimals": 18, + "symbol": "aBUSD", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x4Fabb145d64652a948d72533023f6E7A623C7C53" + } + }, + { + "chainId": 1, + "address": "0x028171bCA77440897B824Ca71D1c56caC55b68A3", + "name": "Aave interest bearing DAI", + "decimals": 18, + "symbol": "aDAI", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x6B175474E89094C44Da98b954EedeAC495271d0F" + } + }, + { + "chainId": 1, + "address": "0xaC6Df26a590F08dcC95D5a4705ae8abbc88509Ef", + "name": "Aave interest bearing ENJ", + "decimals": 18, + "symbol": "aENJ", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c" + } + }, + { + "chainId": 1, + "address": "0x39C6b3e42d6A679d7D776778Fe880BC9487C2EDA", + "name": "Aave interest bearing KNC", + "decimals": 18, + "symbol": "aKNC", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xdd974D5C2e2928deA5F71b9825b8b646686BD200" + } + }, + { + "chainId": 1, + "address": "0xa06bC25B5805d5F8d82847D191Cb4Af5A3e873E0", + "name": "Aave interest bearing LINK", + "decimals": 18, + "symbol": "aLINK", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x514910771AF9Ca656af840dff83E8264EcF986CA" + } + }, + { + "chainId": 1, + "address": "0xa685a61171bb30d4072B338c80Cb7b2c865c873E", + "name": "Aave interest bearing MANA", + "decimals": 18, + "symbol": "aMANA", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942" + } + }, + { + "chainId": 1, + "address": "0xc713e5E149D5D0715DcD1c156a020976e7E56B88", + "name": "Aave interest bearing MKR", + "decimals": 18, + "symbol": "aMKR", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2" + } + }, + { + "chainId": 1, + "address": "0xCC12AbE4ff81c9378D670De1b57F8e0Dd228D77a", + "name": "Aave interest bearing REN", + "decimals": 18, + "symbol": "aREN", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x408e41876cCCDC0F92210600ef50372656052a38" + } + }, + { + "chainId": 1, + "address": "0x35f6B052C598d933D69A4EEC4D04c73A191fE6c2", + "name": "Aave interest bearing SNX", + "decimals": 18, + "symbol": "aSNX", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F" + } + }, + { + "chainId": 1, + "address": "0x6C5024Cd4F8A59110119C56f8933403A539555EB", + "name": "Aave interest bearing SUSD", + "decimals": 18, + "symbol": "aSUSD", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51" + } + }, + { + "chainId": 1, + "address": "0x101cc05f4A51C0319f570d5E146a8C625198e636", + "name": "Aave interest bearing TUSD", + "decimals": 18, + "symbol": "aTUSD", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x0000000000085d4780B73119b644AE5ecd22b376" + } + }, + { + "chainId": 1, + "address": "0xBcca60bB61934080951369a648Fb03DF4F96263C", + "name": "Aave interest bearing USDC", + "decimals": 6, + "symbol": "aUSDC", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + } + }, + { + "chainId": 1, + "address": "0x8dAE6Cb04688C62d939ed9B68d32Bc62e49970b1", + "name": "Aave interest bearing CRV", + "decimals": 18, + "symbol": "aCRV", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xD533a949740bb3306d119CC777fa900bA034cd52" + } + }, + { + "chainId": 1, + "address": "0xD37EE7e4f452C6638c96536e68090De8cBcdb583", + "name": "Aave interest bearing GUSD", + "decimals": 2, + "symbol": "aGUSD", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd" + } + }, + { + "chainId": 1, + "address": "0x272F97b7a56a387aE942350bBC7Df5700f8a4576", + "name": "Aave interest bearing BAL", + "decimals": 18, + "symbol": "aBAL", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xba100000625a3754423978a60c9317c58a424e3D" + } + }, + { + "chainId": 1, + "address": "0xF256CC7847E919FAc9B808cC216cAc87CCF2f47a", + "name": "Aave interest bearing XSUSHI", + "decimals": 18, + "symbol": "aXSUSHI", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272" + } + }, + { + "chainId": 1, + "address": "0x514cd6756CCBe28772d4Cb81bC3156BA9d1744aa", + "name": "Aave interest bearing RENFIL", + "decimals": 18, + "symbol": "aRENFIL", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xD5147bc8e386d91Cc5DBE72099DAC6C9b99276F5" + } + }, + { + "chainId": 1, + "address": "0xc9BC48c72154ef3e5425641a3c747242112a46AF", + "name": "Aave interest bearing RAI", + "decimals": 18, + "symbol": "aRAI", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919" + } + }, + { + "chainId": 1, + "address": "0x2e8F4bdbE3d47d7d7DE490437AeA9915D930F1A3", + "name": "Aave interest bearing USDP", + "decimals": 18, + "symbol": "aUSDP", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x8E870D67F660D95d5be530380D0eC0bd388289E1" + } + }, + { + "chainId": 1, + "address": "0x6F634c6135D2EBD550000ac92F494F9CB8183dAe", + "name": "Aave interest bearing DPI", + "decimals": 18, + "symbol": "aDPI", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b" + } + }, + { + "chainId": 1, + "address": "0xd4937682df3C8aEF4FE912A96A74121C0829E664", + "name": "Aave interest bearing FRAX", + "decimals": 18, + "symbol": "aFRAX", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x853d955aCEf822Db058eb8505911ED77F175b99e" + } + }, + { + "chainId": 1, + "address": "0x1982b2F5814301d4e9a8b0201555376e62F82428", + "name": "Aave interest bearing STETH", + "decimals": 18, + "symbol": "aSTETH", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84" + } + }, + { + "chainId": 1, + "address": "0x9a14e23A58edf4EFDcB360f68cd1b95ce2081a2F", + "name": "Aave interest bearing ENS", + "decimals": 18, + "symbol": "aENS", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72" + } + }, + { + "chainId": 1, + "address": "0xc2e2152647F4C26028482Efaf64b2Aa28779EFC4", + "name": "Aave interest bearing UST", + "decimals": 6, + "symbol": "aUST", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0xa693B19d2931d498c5B318dF961919BB4aee87a5" + } + }, + { + "chainId": 1, + "address": "0x952749E07d7157bb9644A894dFAF3Bad5eF6D918", + "name": "Aave interest bearing CVX", + "decimals": 18, + "symbol": "aCVX", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B" + } + }, + { + "chainId": 1, + "address": "0xB29130CBcC3F791f077eAdE0266168E808E5151e", + "name": "Aave interest bearing 1INCH", + "decimals": 18, + "symbol": "aONE_INCH", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x111111111117dC0aa78b770fA6A738034120C302" + } + }, + { + "chainId": 1, + "address": "0xce1871f791548600cb59efbefFC9c38719142079", + "name": "Aave interest bearing LUSD", + "decimals": 18, + "symbol": "aLUSD", + "extensions": { + "pool": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9", + "underlying": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0" + } + }, + { + "chainId": 137, + "address": "0x27F8D03b3a2196956ED754baDc28D73be8830A6e", + "name": "Aave Matic Market DAI", + "decimals": 18, + "symbol": "amDAI", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063" + } + }, + { + "chainId": 137, + "address": "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", + "name": "Aave Matic Market USDC", + "decimals": 6, + "symbol": "amUSDC", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" + } + }, + { + "chainId": 137, + "address": "0x60D55F02A771d515e077c9C2403a1ef324885CeC", + "name": "Aave Matic Market USDT", + "decimals": 6, + "symbol": "amUSDT", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" + } + }, + { + "chainId": 137, + "address": "0x5c2ed810328349100A66B82b78a1791B101C9D61", + "name": "Aave Matic Market WBTC", + "decimals": 8, + "symbol": "amWBTC", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6" + } + }, + { + "chainId": 137, + "address": "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390", + "name": "Aave Matic Market WETH", + "decimals": 18, + "symbol": "amWETH", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" + } + }, + { + "chainId": 137, + "address": "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", + "name": "Aave Matic Market WMATIC", + "decimals": 18, + "symbol": "amWMATIC", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270" + } + }, + { + "chainId": 137, + "address": "0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360", + "name": "Aave Matic Market AAVE", + "decimals": 18, + "symbol": "amAAVE", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0xD6DF932A45C0f255f85145f286eA0b292B21C90B" + } + }, + { + "chainId": 137, + "address": "0x080b5BF8f360F624628E0fb961F4e67c9e3c7CF1", + "name": "Aave Matic Market GHST", + "decimals": 18, + "symbol": "amGHST", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x385Eeac5cB85A38A9a07A70c73e0a3271CfB54A7" + } + }, + { + "chainId": 137, + "address": "0xc4195D4060DaEac44058Ed668AA5EfEc50D77ff6", + "name": "Aave Matic Market BAL", + "decimals": 18, + "symbol": "amBAL", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x9a71012B13CA4d3D0Cdc72A177DF3ef03b0E76A3" + } + }, + { + "chainId": 137, + "address": "0x81fB82aAcB4aBE262fc57F06fD4c1d2De347D7B1", + "name": "Aave Matic Market DPI", + "decimals": 18, + "symbol": "amDPI", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x85955046DF4668e1DD369D2DE9f3AEB98DD2A369" + } + }, + { + "chainId": 137, + "address": "0x3Df8f92b7E798820ddcCA2EBEA7BAbda2c90c4aD", + "name": "Aave Matic Market CRV", + "decimals": 18, + "symbol": "amCRV", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x172370d5Cd63279eFa6d502DAB29171933a610AF" + } + }, + { + "chainId": 137, + "address": "0x21eC9431B5B55c5339Eb1AE7582763087F98FAc2", + "name": "Aave Matic Market SUSHI", + "decimals": 18, + "symbol": "amSUSHI", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x0b3F868E0BE5597D5DB7fEB59E1CADBb0fdDa50a" + } + }, + { + "chainId": 137, + "address": "0x0Ca2e42e8c21954af73Bc9af1213E4e81D6a669A", + "name": "Aave Matic Market LINK", + "decimals": 18, + "symbol": "amLINK", + "extensions": { + "pool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", + "underlying": "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39" + } + }, + { + "chainId": 43114, + "address": "0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21", + "name": "Aave Avalanche Market WETH", + "decimals": 18, + "symbol": "avWETH", + "extensions": { + "pool": "0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C", + "underlying": "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB" + } + }, + { + "chainId": 43114, + "address": "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a", + "name": "Aave Avalanche Market DAI", + "decimals": 18, + "symbol": "avDAI", + "extensions": { + "pool": "0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C", + "underlying": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70" + } + }, + { + "chainId": 43114, + "address": "0x532E6537FEA298397212F09A61e03311686f548e", + "name": "Aave Avalanche Market USDT", + "decimals": 6, + "symbol": "avUSDT", + "extensions": { + "pool": "0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C", + "underlying": "0xc7198437980c041c805A1EDcbA50c1Ce5db95118" + } + }, + { + "chainId": 43114, + "address": "0x46A51127C3ce23fb7AB1DE06226147F446e4a857", + "name": "Aave Avalanche Market USDC", + "decimals": 6, + "symbol": "avUSDC", + "extensions": { + "pool": "0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C", + "underlying": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664" + } + }, + { + "chainId": 43114, + "address": "0xD45B7c061016102f9FA220502908f2c0f1add1D7", + "name": "Aave Avalanche Market AAVE", + "decimals": 18, + "symbol": "avAAVE", + "extensions": { + "pool": "0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C", + "underlying": "0x63a72806098Bd3D9520cC43356dD78afe5D386D9" + } + }, + { + "chainId": 43114, + "address": "0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D", + "name": "Aave Avalanche Market WBTC", + "decimals": 8, + "symbol": "avWBTC", + "extensions": { + "pool": "0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C", + "underlying": "0x50b7545627a5162F82A992c33b87aDc75187B218" + } + }, + { + "chainId": 43114, + "address": "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B", + "name": "Aave Avalanche Market WAVAX", + "decimals": 18, + "symbol": "avWAVAX", + "extensions": { + "pool": "0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C", + "underlying": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" + } + } +] diff --git a/src/dex/aave-v2/tokens.ts b/src/dex/aave-v2/tokens.ts index 095a3aac1..91a374e50 100644 --- a/src/dex/aave-v2/tokens.ts +++ b/src/dex/aave-v2/tokens.ts @@ -1,15 +1,14 @@ import { aToken, Token } from '../../types'; import { Network } from '../../constants'; -import { tokenlist } from '@bgd-labs/aave-address-book'; +import tokens from './tokenlist.json'; import { aaveLendingPool } from './config'; function getTokensForPool(pool: string): aToken[] { - return tokenlist.tokens + return tokens .filter( token => token.extensions?.pool && - token.extensions?.pool.toLowerCase() === pool.toLowerCase() && - token.tags.includes('aTokenV2'), + token.extensions?.pool.toLowerCase() === pool.toLowerCase(), ) .map(token => ({ aSymbol: token.symbol, diff --git a/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-e2e.test.ts b/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-e2e.test.ts new file mode 100644 index 000000000..e75f37b02 --- /dev/null +++ b/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-e2e.test.ts @@ -0,0 +1,356 @@ +/* eslint-disable no-console */ +import dotenv from 'dotenv'; +dotenv.config(); + +import { testE2E } from '../../../tests/utils-e2e'; +import { Tokens, Holders } from '../../../tests/constants-e2e'; +import { Network, ContractMethod, SwapSide } from '../../constants'; +import { StaticJsonRpcProvider } from '@ethersproject/providers'; +import { generateConfig } from '../../config'; + +function testForNetwork( + network: Network, + dexKey: string, + tokenASymbol: string, + tokenBSymbol: string, + tokenAAmount: string, + tokenBAmount: string, + skipBuy: boolean = false, // BUY is not supported for aToken <-> stataToken +) { + const provider = new StaticJsonRpcProvider( + generateConfig(network).privateHttpProvider, + network, + ); + const tokens = Tokens[network]; + const holders = Holders[network]; + + const sideToContractMethods = new Map([ + [SwapSide.SELL, [ContractMethod.swapExactAmountIn]], + [SwapSide.BUY, [ContractMethod.swapExactAmountOut]], + ]); + + sideToContractMethods.forEach((contractMethods, side) => + describe(`${side}`, () => { + contractMethods.forEach((contractMethod: ContractMethod) => { + if (contractMethod === ContractMethod.swapExactAmountOut && skipBuy) { + return; + } + describe(`${contractMethod}`, () => { + it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => { + await testE2E( + tokens[tokenASymbol], + tokens[tokenBSymbol], + holders[tokenASymbol], + side === SwapSide.SELL ? tokenAAmount : tokenBAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => { + await testE2E( + tokens[tokenBSymbol], + tokens[tokenASymbol], + holders[tokenBSymbol], + side === SwapSide.SELL ? tokenBAmount : tokenAAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + }); + }); + }), + ); +} + +describe('AaveV3Stata E2E', () => { + const dexKey = 'AaveV3StataV2'; + + // polygon is not yet live + describe.skip('Polygon', () => { + const network = Network.POLYGON; + + const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [ + [ + { + name: 'USDCn', + amount: '100000', + }, + { + name: 'stataUSDCn', + amount: '100000', + }, + ], + [ + { + name: 'aaveUSDCn', + amount: '100000', + skipBuy: true, + }, + { + name: 'stataUSDCn', + amount: '100000', + }, + ], + ]; + + pairs.forEach(pair => { + testForNetwork( + network, + dexKey, + pair[0].name, + pair[1].name, + pair[0].amount, + pair[1].amount, + pair[0].skipBuy, + ); + }); + }); + + describe('Mainnet', () => { + const network = Network.MAINNET; + + const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [ + [ + { + name: 'USDT', + amount: '100000', + }, + { + name: 'waEthUSDT', + amount: '100000', + }, + ], + [ + { + name: 'aaveUSDT', + amount: '100000', + skipBuy: true, + }, + { + name: 'waEthUSDT', + amount: '100000', + }, + ], + ]; + + pairs.forEach(pair => { + testForNetwork( + network, + dexKey, + pair[0].name, + pair[1].name, + pair[0].amount, + pair[1].amount, + pair[0].skipBuy, + ); + }); + }); + + // TODO: No holders yet + // describe('Avalanche', () => { + // const network = Network.AVALANCHE; + + // const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [ + // [ + // { + // name: 'USDT', + // amount: '100000', + // }, + // { + // name: 'stataUSDT', + // amount: '100000', + // }, + // ], + // [ + // { + // name: 'aaveUSDT', + // amount: '100000', + // skipBuy: true, + // }, + // { + // name: 'stataUSDT', + // amount: '100000', + // }, + // ], + // ]; + + // pairs.forEach(pair => { + // testForNetwork( + // network, + // dexKey, + // pair[0].name, + // pair[1].name, + // pair[0].amount, + // pair[1].amount, + // pair[0].skipBuy, + // ); + // }); + // }); + + describe.skip('Arbitrum', () => { + const network = Network.ARBITRUM; + + const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [ + [ + { + name: 'USDT', + amount: '100000', + }, + { + name: 'stataUSDT', + amount: '100000', + }, + ], + [ + { + name: 'aaveUSDT', + amount: '100000', + skipBuy: true, + }, + { + name: 'stataUSDT', + amount: '100000', + }, + ], + ]; + + pairs.forEach(pair => { + testForNetwork( + network, + dexKey, + pair[0].name, + pair[1].name, + pair[0].amount, + pair[1].amount, + pair[0].skipBuy, + ); + }); + }); + + describe.skip('Optimism', () => { + const network = Network.OPTIMISM; + + const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [ + [ + { + name: 'USDT', + amount: '100000', + }, + { + name: 'stataUSDT', + amount: '100000', + }, + ], + [ + { + name: 'aaveUSDT', + amount: '100000', + skipBuy: true, + }, + { + name: 'stataUSDT', + amount: '100000', + }, + ], + ]; + + pairs.forEach(pair => { + testForNetwork( + network, + dexKey, + pair[0].name, + pair[1].name, + pair[0].amount, + pair[1].amount, + pair[0].skipBuy, + ); + }); + }); + + describe.skip('Base', () => { + const network = Network.BASE; + + const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [ + [ + { + name: 'USDC', + amount: '100000', + }, + { + name: 'stataUSDC', + amount: '100000', + }, + ], + [ + { + name: 'aaveUSDC', + amount: '100000', + skipBuy: true, + }, + { + name: 'stataUSDC', + amount: '100000', + }, + ], + ]; + + pairs.forEach(pair => { + testForNetwork( + network, + dexKey, + pair[0].name, + pair[1].name, + pair[0].amount, + pair[1].amount, + pair[0].skipBuy, + ); + }); + }); + + // TODO: No holders yet + // describe('Bsc', () => { + // const network = Network.BSC; + + // const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [ + // [ + // { + // name: 'USDT', + // amount: '100000', + // }, + // { + // name: 'stataUSDT', + // amount: '100000', + // }, + // ], + // [ + // { + // name: 'aaveUSDT', + // amount: '100000', + // skipBuy: true, + // }, + // { + // name: 'stataUSDT', + // amount: '100000', + // }, + // ], + // ]; + + // pairs.forEach(pair => { + // testForNetwork( + // network, + // dexKey, + // pair[0].name, + // pair[1].name, + // pair[0].amount, + // pair[1].amount, + // pair[0].skipBuy, + // ); + // }); + // }); +}); diff --git a/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-integration.test.ts b/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-integration.test.ts new file mode 100644 index 000000000..c0c8f8d27 --- /dev/null +++ b/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-integration.test.ts @@ -0,0 +1,283 @@ +/* eslint-disable no-console */ +import dotenv from 'dotenv'; +dotenv.config(); + +import { Interface, Result } from '@ethersproject/abi'; +import { DummyDexHelper } from '../../dex-helper/index'; +import { Network, SwapSide } from '../../constants'; +import { BI_POWS } from '../../bigint-constants'; +import { AaveV3StataV2 } from './aave-v3-stata-v2'; +import { + checkPoolPrices, + checkPoolsLiquidity, + checkConstantPoolPrices, +} from '../../../tests/utils'; +import { Tokens } from '../../../tests/constants-e2e'; + +function getReaderCalldata( + exchangeAddress: string, + readerIface: Interface, + amounts: bigint[], + funcName: string, +) { + return amounts.map(amount => ({ + target: exchangeAddress, + callData: readerIface.encodeFunctionData(funcName, [amount]), + })); +} + +function decodeReaderResult( + results: Result, + readerIface: Interface, + funcName: string, +) { + return results.map(result => { + const parsed = readerIface.decodeFunctionResult(funcName, result); + return BigInt(parsed[0]._hex); + }); +} + +async function checkOnChainPricing( + aaveV3Statav2: AaveV3StataV2, + funcName: string, + blockNumber: number, + prices: bigint[], + amounts: bigint[], +) { + const exchangeAddress = '0x2dca80061632f3f87c9ca28364d1d0c30cd79a19'; // stataUSDCn + + const readerIface = AaveV3StataV2.stata; + + const readerCallData = getReaderCalldata( + exchangeAddress, + readerIface, + amounts.slice(1), + funcName, + ); + const readerResult = ( + await aaveV3Statav2.dexHelper.multiContract.methods + .aggregate(readerCallData) + .call({}, blockNumber) + ).returnData; + + const expectedPrices = [0n].concat( + decodeReaderResult(readerResult, readerIface, funcName), + ); + + expect(prices).toEqual(expectedPrices); +} + +async function testPricingOnNetwork( + aaveV3Statav2: AaveV3StataV2, + network: Network, + dexKey: string, + blockNumber: number, + srcTokenSymbol: string, + destTokenSymbol: string, + side: SwapSide, + amounts: bigint[], + funcNameToCheck: string, +) { + const networkTokens = Tokens[network]; + + const pools = await aaveV3Statav2.getPoolIdentifiers( + networkTokens[srcTokenSymbol], + networkTokens[destTokenSymbol], + side, + blockNumber, + ); + console.log( + `${srcTokenSymbol} <> ${destTokenSymbol} Pool Identifiers: `, + pools, + ); + + expect(pools.length).toBeGreaterThan(0); + + const poolPrices = await aaveV3Statav2.getPricesVolume( + networkTokens[srcTokenSymbol], + networkTokens[destTokenSymbol], + amounts, + side, + blockNumber, + pools, + ); + console.log( + `${srcTokenSymbol} <> ${destTokenSymbol} Pool Prices: `, + poolPrices, + ); + + expect(poolPrices).not.toBeNull(); + if (aaveV3Statav2.hasConstantPriceLargeAmounts) { + checkConstantPoolPrices(poolPrices!, amounts, dexKey); + } else { + checkPoolPrices(poolPrices!, amounts, side, dexKey); + } + + // Check if onchain pricing equals to calculated ones + await checkOnChainPricing( + aaveV3Statav2, + funcNameToCheck, + blockNumber, + poolPrices![0].prices, + amounts, + ); +} + +describe('AaveV3Stata', function () { + const dexKey = 'AaveV3Stata'; + let blockNumber: number; + let aaveV3Statav2: AaveV3StataV2; + + // polygon is not yet live + describe.skip('Polygon', () => { + const network = Network.POLYGON; + const dexHelper = new DummyDexHelper(network); + + const tokens = Tokens[network]; + + const srcTokenSymbol = 'USDCn'; + const destTokenSymbol = 'stataUSDCn'; + + const amountsForSell = [ + 0n, + 1n * BI_POWS[tokens[srcTokenSymbol].decimals], + 2n * BI_POWS[tokens[srcTokenSymbol].decimals], + 3n * BI_POWS[tokens[srcTokenSymbol].decimals], + 4n * BI_POWS[tokens[srcTokenSymbol].decimals], + 5n * BI_POWS[tokens[srcTokenSymbol].decimals], + 6n * BI_POWS[tokens[srcTokenSymbol].decimals], + 7n * BI_POWS[tokens[srcTokenSymbol].decimals], + 8n * BI_POWS[tokens[srcTokenSymbol].decimals], + 9n * BI_POWS[tokens[srcTokenSymbol].decimals], + 10n * BI_POWS[tokens[srcTokenSymbol].decimals], + ]; + + const amountsForBuy = [ + 0n, + 1n * BI_POWS[tokens[destTokenSymbol].decimals], + 2n * BI_POWS[tokens[destTokenSymbol].decimals], + 3n * BI_POWS[tokens[destTokenSymbol].decimals], + 4n * BI_POWS[tokens[destTokenSymbol].decimals], + 5n * BI_POWS[tokens[destTokenSymbol].decimals], + 6n * BI_POWS[tokens[destTokenSymbol].decimals], + 7n * BI_POWS[tokens[destTokenSymbol].decimals], + 8n * BI_POWS[tokens[destTokenSymbol].decimals], + 9n * BI_POWS[tokens[destTokenSymbol].decimals], + 10n * BI_POWS[tokens[destTokenSymbol].decimals], + ]; + + beforeAll(async () => { + blockNumber = await dexHelper.web3Provider.eth.getBlockNumber(); + aaveV3Statav2 = new AaveV3StataV2(network, dexKey, dexHelper); + if (aaveV3Statav2.initializePricing) { + await aaveV3Statav2.initializePricing(blockNumber); + } + }); + + it('getPoolIdentifiers and getPricesVolume SELL USDCn -> stataUSDCn', async function () { + await testPricingOnNetwork( + aaveV3Statav2, + network, + dexKey, + blockNumber, + srcTokenSymbol, + destTokenSymbol, + SwapSide.SELL, + amountsForSell, + 'previewDeposit', + ); + }); + + it('getPoolIdentifiers and getPricesVolume SELL stataUSDCn -> USDCn ', async function () { + await testPricingOnNetwork( + aaveV3Statav2, + network, + dexKey, + blockNumber, + destTokenSymbol, + srcTokenSymbol, + SwapSide.SELL, + amountsForSell, + 'previewRedeem', + ); + }); + + it('getPoolIdentifiers and getPricesVolume BUY USDC -> stataUSDCn', async function () { + await testPricingOnNetwork( + aaveV3Statav2, + network, + dexKey, + blockNumber, + srcTokenSymbol, + destTokenSymbol, + SwapSide.BUY, + amountsForBuy, + 'previewMint', + ); + }); + + it('getPoolIdentifiers and getPricesVolume BUY stataUSDCn -> USDC', async function () { + await testPricingOnNetwork( + aaveV3Statav2, + network, + dexKey, + blockNumber, + destTokenSymbol, + srcTokenSymbol, + SwapSide.BUY, + amountsForBuy, + 'previewWithdraw', + ); + }); + + it(`getTopPoolsForToken - ${srcTokenSymbol}`, async function () { + // We have to check without calling initializePricing, because + // pool-tracker is not calling that function + const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper); + if (newAaveV3Stata.updatePoolState) { + await newAaveV3Stata.updatePoolState(); + } + const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken( + tokens[srcTokenSymbol].address, + 10, + ); + console.log( + `${srcTokenSymbol} Top Pools:`, + JSON.stringify(poolLiquidity, null, 2), + ); + + if (!newAaveV3Stata.hasConstantPriceLargeAmounts) { + checkPoolsLiquidity( + poolLiquidity, + Tokens[network][srcTokenSymbol].address, + dexKey, + ); + } + }); + + it(`getTopPoolsForToken - ${destTokenSymbol}`, async function () { + // We have to check without calling initializePricing, because + // pool-tracker is not calling that function + const newAaveV3Stata = new AaveV3StataV2(network, dexKey, dexHelper); + if (newAaveV3Stata.updatePoolState) { + await newAaveV3Stata.updatePoolState(); + } + const poolLiquidity = await newAaveV3Stata.getTopPoolsForToken( + tokens[destTokenSymbol].address, + 10, + ); + console.log( + `${destTokenSymbol} Top Pools:`, + JSON.stringify(poolLiquidity, null, 2), + ); + + if (!newAaveV3Stata.hasConstantPriceLargeAmounts) { + checkPoolsLiquidity( + poolLiquidity, + Tokens[network][destTokenSymbol].address, + dexKey, + ); + } + }); + }); +}); diff --git a/src/dex/aave-v3-stata-v2/aave-v3-stata-v2.ts b/src/dex/aave-v3-stata-v2/aave-v3-stata-v2.ts new file mode 100644 index 000000000..bde522f80 --- /dev/null +++ b/src/dex/aave-v3-stata-v2/aave-v3-stata-v2.ts @@ -0,0 +1,561 @@ +import { AsyncOrSync } from 'ts-essentials'; +import { + Token, + Address, + ExchangePrices, + PoolPrices, + AdapterExchangeParam, + PoolLiquidity, + Logger, + NumberAsString, + DexExchangeParam, +} from '../../types'; +import { SwapSide, Network } from '../../constants'; +import * as CALLDATA_GAS_COST from '../../calldata-gas-cost'; +import { Utils, getBigIntPow, getDexKeysWithNetwork } from '../../utils'; +import { Context, IDex } from '../../dex/idex'; +import { IDexHelper } from '../../dex-helper/idex-helper'; +import { + AaveV3StataV2Data, + Rounding, + StataFunctions, + StataToken, + TokenType, +} from './types'; +import { SimpleExchange } from '../simple-exchange'; +import { AaveV3StataConfig, Adapters } from './config'; +import { Interface } from '@ethersproject/abi'; +import { fetchTokenList } from './utils'; +import { + Tokens, + getTokenFromAddress, + getTokenType, + setTokensOnNetwork, +} from './tokens'; +import { uint256ToBigInt } from '../../lib/decoders'; +import TokenABI from '../../abi/aavev3statav2/Token.json'; +import PoolABI from '../../abi/aavev3statav2/Pool.json'; +import { extractReturnAmountPosition } from '../../executor/utils'; +import { RETURN_AMOUNT_POS_32 } from '../../executor/constants'; +// import { IStaticATokenLM_ABI } from '@bgd-labs/aave-address-book'; +// slimmed down version of @bgd-labs/aave-address-book +// required as version of web3-utils used is buggy +//import IStaticATokenFactory_ABI from '../../abi/aave-v3-stata/StaticATokenFactory.json'; + +export const TOKEN_LIST_CACHE_KEY = 'stata-v2-token-list'; +const TOKEN_LIST_TTL_SECONDS = 24 * 60 * 60; // 1 day +const RAY = BigInt(`1${'0'.repeat(27)}`); + +export class AaveV3StataV2 + extends SimpleExchange + implements IDex +{ + readonly hasConstantPriceLargeAmounts = false; + + readonly isFeeOnTransferSupported = false; + + public static dexKeysWithNetwork: { key: string; networks: Network[] }[] = + getDexKeysWithNetwork(AaveV3StataConfig); + + logger: Logger; + + // static readonly stata = new Interface(IStaticATokenLM_ABI); + static readonly stata = new Interface(TokenABI); + static readonly pool = new Interface(PoolABI); + + private state: Record = {}; + + constructor( + readonly network: Network, + readonly dexKey: string, + readonly dexHelper: IDexHelper, + protected config = AaveV3StataConfig[dexKey][network], + protected adapters = Adapters[network], + ) { + super(dexHelper, dexKey); + this.logger = dexHelper.getLogger(dexKey); + } + + async initializePricing(blockNumber: number): Promise { + await this.initializeTokens(blockNumber); + } + + async initializeTokens(blockNumber?: number) { + let cachedTokenList = await this.dexHelper.cache.getAndCacheLocally( + this.dexKey, + this.network, + TOKEN_LIST_CACHE_KEY, + TOKEN_LIST_TTL_SECONDS, + ); + + if (cachedTokenList !== null) { + if (Object.keys(Tokens[this.network] ?? {}).length !== 0) return; + + const tokenListParsed = JSON.parse(cachedTokenList); + setTokensOnNetwork(this.network, tokenListParsed); + + tokenListParsed.forEach((token: StataToken) => { + this.state[token.address] = { + blockNumber: 0, + rate: 0n, + }; + }); + return; + } + + let tokenList = await fetchTokenList( + this.dexHelper.web3Provider, + this.config.factoryAddresses, + this.dexHelper.multiWrapper, + blockNumber, + ); + + await this.dexHelper.cache.setexAndCacheLocally( + this.dexKey, + this.network, + TOKEN_LIST_CACHE_KEY, + TOKEN_LIST_TTL_SECONDS, + JSON.stringify(tokenList), + ); + + setTokensOnNetwork(this.network, tokenList); + + // init state for all tokens as empty + tokenList.forEach(token => { + this.state[token.address] = { + blockNumber: 0, + rate: 0n, + }; + }); + } + + // Returns the list of contract adapters (name and index) + // for a buy/sell. Return null if there are no adapters. + getAdapters(side: SwapSide): { name: string; index: number }[] | null { + return null; + } + + private _getPoolIdentifier(srcToken: Token, destToken: Token): string { + return ( + this.dexKey + + '-' + + [srcToken.address.toLowerCase(), destToken.address.toLowerCase()] + .sort((a, b) => (a > b ? 1 : -1)) + .join('_') + ); + } + + // Returns list of pool identifiers that can be used + // for a given swap. poolIdentifiers must be unique + // across DEXes. It is recommended to use + // ${dexKey}_${poolAddress} as a poolIdentifier + async getPoolIdentifiers( + srcToken: Token, + destToken: Token, + side: SwapSide, + blockNumber: number, + ): Promise { + return [this._getPoolIdentifier(srcToken, destToken)]; + } + + // Returns pool prices for amounts. + // If limitPools is defined only pools in limitPools + // should be used. If limitPools is undefined then + // any pools can be used. + async getPricesVolume( + srcToken: Token, + destToken: Token, + amounts: bigint[], + side: SwapSide, + blockNumber: number, + limitPools?: string[], + ): Promise> { + const src = getTokenType(this.network, srcToken.address); + const dest = getTokenType(this.network, destToken.address); + + // one of the tokens must be stata + if (![src, dest].includes(TokenType.STATA_TOKEN) || src === dest) { + return null; + } + + const isSrcStata = src === TokenType.STATA_TOKEN; + + const [stataToken, otherAddressLower] = isSrcStata + ? [ + getTokenFromAddress(this.network, srcToken.address), + destToken.address.toLowerCase(), + ] + : [ + getTokenFromAddress(this.network, destToken.address), + srcToken.address.toLowerCase(), + ]; + + // the token itself can only swap from/to underlying and aToken, so + // - at least one must be stata + // - maximum one can be stata + // - second one must be underlying or aUnderlying + // on the buy side (mint, withdraw) we only support the underlying<->stata conversion, not the aUnderlying + if (side === SwapSide.SELL) { + if ( + otherAddressLower !== stataToken.underlying.toLowerCase() && + otherAddressLower !== stataToken.underlyingAToken.toLowerCase() + ) { + return null; + } + } else { + if (otherAddressLower !== stataToken.underlying.toLowerCase()) { + return null; + } + } + + const stataAddressLower = stataToken.address.toLowerCase(); + + if ( + !this.state[stataAddressLower]?.blockNumber || + blockNumber > this.state[stataAddressLower].blockNumber + ) { + const cached = await this.dexHelper.cache.get( + this.dexKey, + this.network, + `state_${stataAddressLower}`, + ); + if (cached) { + this.state[stataAddressLower] = Utils.Parse(cached); + } else { + const results = await this.dexHelper.multiWrapper.tryAggregate( + true, + [ + { + target: this.config.pool, + callData: AaveV3StataV2.pool.encodeFunctionData( + 'getReserveNormalizedIncome', + [stataToken.underlying], + ), + decodeFunction: uint256ToBigInt, + }, + ], + blockNumber, + ); + this.state[stataAddressLower] = { + blockNumber, + rate: results[0].returnData, + }; + this.dexHelper.cache.setex( + this.dexKey, + this.network, + `state_${stataAddressLower}`, + 60, + Utils.Serialize(this.state[stataAddressLower]), + ); + } + } + + return [ + { + prices: amounts.map(amount => { + const rate = this.state[stataAddressLower].rate; + if (side === SwapSide.SELL) { + if (isSrcStata) { + return this.previewRedeem(amount, rate); + } else { + return this.previewDeposit(amount, rate); + } + } else { + if (isSrcStata) { + return this.previewWithdraw(amount, rate); + } else { + return this.previewMint(amount, rate); + } + } + }), + unit: getBigIntPow( + (side === SwapSide.SELL ? destToken : srcToken).decimals, + ), + gasCost: 270000, // 250_000 from underlying, far less from aToken + exchange: this.dexKey, + data: { + srcType: src, + destType: dest, + exchange: stataToken.address, + }, + poolAddresses: [stataAddressLower], + }, + ]; + } + + getCalldataGasCost( + poolPrices: PoolPrices, + ): number | number[] { + return CALLDATA_GAS_COST.DEX_NO_PAYLOAD; + } + + // Not used for V6 + getAdapterParam(): AdapterExchangeParam { + return { + targetExchange: '0x', + payload: '0x', + networkFee: '0', + }; + } + + // Encode call data used by simpleSwap like routers + // Used for simpleSwap & simpleBuy + // Hint: this.buildSimpleParamWithoutWETHConversion + // could be useful + // async getSimpleParam( + // srcToken: string, + // destToken: string, + // srcAmount: string, + // destAmount: string, + // data: AaveV3StataV2Data, + // side: SwapSide, + // ): Promise { + // const { exchange, srcType, destType } = data; + // let swapData; + // + // if (side === SwapSide.SELL) { + // if (srcType === TokenType.STATA_TOKEN) { + // // e.g. sell srcAmount 100 srcToken stataUSDC for destToken USDC + // swapData = AaveV3Stata.stata.encodeFunctionData(StataFunctions.redeem, [ + // srcAmount, + // this.augustusAddress, // receiver + // this.augustusAddress, // owner + // destType === TokenType.UNDERLYING, // withdraw from aToken + // ]); + // } else { + // // sell srcAmount 100 srcToken USDC for destToken stataUSDC + // swapData = AaveV3Stata.stata.encodeFunctionData( + // StataFunctions.deposit, + // [ + // srcAmount, + // this.augustusAddress, // receiver + // 0, // referrer (noop) + // srcType === TokenType.UNDERLYING, // deposit to aave + // ], + // ); + // } + // } else { + // if (srcType === TokenType.STATA_TOKEN) { + // // e.g. buy destAmount 100 destToken USDC for srcToken stataUSDC + // swapData = AaveV3Stata.stata.encodeFunctionData( + // StataFunctions.withdraw, + // [ + // destAmount, + // this.augustusAddress, // receiver + // this.augustusAddress, // owner + // ], + // ); + // } else { + // // e.g. buy destAmount 100 destToken stataUSDC for srcToken USDC + // swapData = AaveV3Stata.stata.encodeFunctionData(StataFunctions.mint, [ + // destAmount, + // this.augustusAddress, + // ]); + // } + // } + // + // return this.buildSimpleParamWithoutWETHConversion( + // srcToken, + // srcAmount, + // destToken, + // destAmount, + // swapData, + // exchange, + // ); + // } + + getDexParam( + srcToken: Address, + destToken: Address, + srcAmount: NumberAsString, + destAmount: NumberAsString, + recipient: Address, + data: AaveV3StataV2Data, + side: SwapSide, + _: Context, + executorAddress: Address, + ): DexExchangeParam { + const { exchange, srcType, destType } = data; + let swapData; + let returnAmountPos = undefined; + + if (side === SwapSide.SELL) { + if (srcType === TokenType.STATA_TOKEN) { + // e.g. sell srcAmount 100 srcToken stataUSDC for destToken USDC + if (destType === TokenType.UNDERLYING) { + swapData = AaveV3StataV2.stata.encodeFunctionData( + StataFunctions.redeem, + [ + srcAmount, + recipient, // receiver + executorAddress, // owner + ], + ); + } else { + swapData = AaveV3StataV2.stata.encodeFunctionData( + StataFunctions.redeemATokens, + [ + srcAmount, + recipient, // receiver + executorAddress, // owner + ], + ); + } + + returnAmountPos = RETURN_AMOUNT_POS_32; + } else { + if (srcType === TokenType.UNDERLYING) { + // sell srcAmount 100 srcToken USDC for destToken stataUSDC + swapData = AaveV3StataV2.stata.encodeFunctionData( + StataFunctions.deposit, + [ + srcAmount, + recipient, // receiver + ], + ); + returnAmountPos = extractReturnAmountPosition( + AaveV3StataV2.stata, + StataFunctions.deposit, + ); + } else { + // sell srcAmount 100 srcToken USDC for destToken stataUSDC + swapData = AaveV3StataV2.stata.encodeFunctionData( + StataFunctions.depositATokens, + [ + srcAmount, + recipient, // receiver + ], + ); + returnAmountPos = extractReturnAmountPosition( + AaveV3StataV2.stata, + StataFunctions.depositATokens, + ); + } + } + } else { + if (srcType === TokenType.STATA_TOKEN) { + // e.g. buy destAmount 100 destToken USDC for srcToken stataUSDC + swapData = AaveV3StataV2.stata.encodeFunctionData( + StataFunctions.withdraw, + [ + destAmount, + recipient, // receiver + executorAddress, // owner + ], + ); + } else { + // e.g. buy destAmount 100 destToken stataUSDC for srcToken USDC + swapData = AaveV3StataV2.stata.encodeFunctionData(StataFunctions.mint, [ + destAmount, + recipient, + ]); + } + } + + return { + needWrapNative: this.needWrapNative, + dexFuncHasRecipient: true, + exchangeData: swapData, + targetExchange: exchange, + returnAmountPos, + skipApproval: srcType === TokenType.STATA_TOKEN, + }; + } + + async updatePoolState(): Promise {} + + async getTopPoolsForToken( + tokenAddress: Address, + limit: number, + ): Promise { + await this.initializeTokens(); + + const tokenType = getTokenType(this.network, tokenAddress); + + if (tokenType === TokenType.UNKNOWN) { + return []; + } + + const stata = getTokenFromAddress(this.network, tokenAddress); + + if (tokenType === TokenType.STATA_TOKEN) { + return [ + { + liquidityUSD: 1e11, + exchange: this.dexKey, + address: stata.address, + connectorTokens: [ + { address: stata.underlying, decimals: stata.decimals }, + { address: stata.underlyingAToken, decimals: stata.decimals }, + ], + }, + ]; + } else { + return [ + { + liquidityUSD: 1e11, + exchange: this.dexKey, + address: stata.address, + connectorTokens: [ + { address: stata.address, decimals: stata.decimals }, + { + address: + tokenType === TokenType.UNDERLYING + ? stata.underlyingAToken + : stata.underlying, + decimals: stata.decimals, + }, + ], + }, + ]; + } + } + + // TODO: Move to pool implementation when migrating to event based + previewRedeem(shares: bigint, rate: bigint) { + return this._convertToAssets(shares, rate, Rounding.DOWN); + } + + previewMint(shares: bigint, rate: bigint) { + return this._convertToAssets(shares, rate, Rounding.UP); + } + + previewWithdraw(assets: bigint, rate: bigint) { + return this._convertToShares(assets, rate, Rounding.UP); + } + + previewDeposit(assets: bigint, rate: bigint) { + return this._convertToShares(assets, rate, Rounding.DOWN); + } + + _convertToAssets(shares: bigint, rate: bigint, rounding: Rounding): bigint { + if (rounding == Rounding.UP) return this.rayMulRoundUp(shares, rate); + return this.rayMulRoundDown(shares, rate); + } + _convertToShares(assets: bigint, rate: bigint, rounding: Rounding): bigint { + if (rounding == Rounding.UP) return this.rayDivRoundUp(assets, rate); + return this.rayDivRoundDown(assets, rate); + } + + rayMulRoundDown(a: bigint, b: bigint): bigint { + if (a === 0n || b === 0n) { + return 0n; + } + return (a * b) / RAY; + } + + rayMulRoundUp(a: bigint, b: bigint) { + if (a === 0n || b === 0n) { + return 0n; + } + return (a * b + RAY - 1n) / RAY; + } + + rayDivRoundDown(a: bigint, b: bigint) { + return (a * RAY) / b; + } + + rayDivRoundUp(a: bigint, b: bigint) { + return (a * RAY + b - 1n) / b; + } +} diff --git a/src/dex/aave-v3-stata-v2/config.ts b/src/dex/aave-v3-stata-v2/config.ts new file mode 100644 index 000000000..729200583 --- /dev/null +++ b/src/dex/aave-v3-stata-v2/config.ts @@ -0,0 +1,30 @@ +import { DexParams } from './types'; +import { DexConfigMap, AdapterMappings } from '../../types'; +import { Network, SwapSide } from '../../constants'; +import { + AaveV3Ethereum, + AaveV3EthereumLido, + AaveV3Gnosis, +} from '@bgd-labs/aave-address-book'; + +export const AaveV3StataConfig: DexConfigMap = { + AaveV3StataV2: { + [Network.MAINNET]: { + factoryAddresses: [ + AaveV3Ethereum.STATA_FACTORY, + AaveV3EthereumLido.STATA_FACTORY, + ], + pool: AaveV3Ethereum.POOL, + }, + [Network.GNOSIS]: { + factoryAddresses: [AaveV3Gnosis.STATA_FACTORY], + pool: AaveV3Gnosis.POOL, + }, + }, +}; + +export const Adapters: Record = { + // TODO: add adapters for each chain for V5 support + [Network.MAINNET]: { [SwapSide.SELL]: [{ name: '', index: 0 }] }, + [Network.GNOSIS]: { [SwapSide.SELL]: [{ name: '', index: 0 }] }, +}; diff --git a/src/dex/aave-v3-stata-v2/tokens.ts b/src/dex/aave-v3-stata-v2/tokens.ts new file mode 100644 index 000000000..f54d14da3 --- /dev/null +++ b/src/dex/aave-v3-stata-v2/tokens.ts @@ -0,0 +1,48 @@ +import { Network } from '../../constants'; +import { StataToken, TokenType } from './types'; + +export const Tokens: { [network: number]: { [symbol: string]: StataToken } } = + {}; + +const TokensByAddress: { + [network: number]: { [address: string]: StataToken }; +} = {}; + +export function setTokensOnNetwork(network: Network, tokens: StataToken[]) { + if (Tokens[network] === undefined) { + Tokens[network] = {}; + } + + if (TokensByAddress[network] === undefined) { + TokensByAddress[network] = {}; + } + + for (let token of tokens) { + token.address = token.address.toLowerCase(); + token.underlying = token.underlying.toLowerCase(); + token.underlyingAToken = token.underlyingAToken.toLowerCase(); + + Tokens[network][token.stataSymbol] = token; + TokensByAddress[network][token.address] = token; + TokensByAddress[network][token.underlying] = token; + TokensByAddress[network][token.underlyingAToken] = token; + } +} + +export function getTokenType(network: Network, address: string): TokenType { + const addressLower = address.toLowerCase(); + const token = TokensByAddress[network]?.[addressLower]; + + if (!token) return TokenType.UNKNOWN; + if (token.address === addressLower) return TokenType.STATA_TOKEN; + if (token.underlying === addressLower) return TokenType.UNDERLYING; + if (token.underlyingAToken === addressLower) return TokenType.A_TOKEN; + return TokenType.UNKNOWN; +} + +export function getTokenFromAddress( + network: Network, + address: string, +): StataToken { + return TokensByAddress[network]?.[address.toLowerCase()]; +} diff --git a/src/dex/aave-v3-stata-v2/types.ts b/src/dex/aave-v3-stata-v2/types.ts new file mode 100644 index 000000000..dda89bfb8 --- /dev/null +++ b/src/dex/aave-v3-stata-v2/types.ts @@ -0,0 +1,72 @@ +import { Address } from '../../types'; + +export type PoolState = { + // TODO: poolState is the state of event + // subscriber. This should be the minimum + // set of parameters required to compute + // pool prices. Complete me! +}; + +export enum TokenType { + UNDERLYING, + A_TOKEN, + STATA_TOKEN, + UNKNOWN, +} + +export type AaveV3StataV2Data = { + // TODO: AaveV3StataData is the dex data that is + // returned by the API that can be used for + // tx building. The data structure should be minimal. + // Complete me! + exchange: Address; + srcType: TokenType; + destType: TokenType; +}; + +export type DexParams = { + factoryAddresses: string[]; + pool: string; +}; + +export type StataToken = { + address: string; + underlying: string; + underlyingAToken: string; + stataSymbol: string; + decimals: number; +}; + +export type DepositParams = [ + // amount of assets to deposit + assets: string, + receiver: string, + referralCode: number, + // true if depositing the underlying, false if depositing the aToken + depositToAave: boolean, +]; + +export type RedeemParams = [ + // amount of shares to redeem + shares: string, + receiver: string, + owner: string, + // true if redeeming the underlying, false if redeeming the aToken + withdrawFromAave: string, +]; + +export type Param = DepositParams | RedeemParams; + +export enum StataFunctions { + deposit = 'deposit', + depositATokens = 'depositATokens', + redeem = 'redeem', + redeemATokens = 'redeemATokens', + mint = 'mint', + withdraw = 'withdraw', +} + +export enum Rounding { + UP = 'UP', + DOWN = 'DOWN', +} diff --git a/src/dex/aave-v3-stata-v2/utils.ts b/src/dex/aave-v3-stata-v2/utils.ts new file mode 100644 index 000000000..f25ae3c78 --- /dev/null +++ b/src/dex/aave-v3-stata-v2/utils.ts @@ -0,0 +1,88 @@ +// import { +// IStaticATokenFactory_ABI, +// IStaticATokenLM_ABI, +// } from '@bgd-labs/aave-address-book'; +import { Interface } from '@ethersproject/abi'; +import Web3 from 'web3'; +import { MultiCallParams, MultiWrapper } from '../../lib/multi-wrapper'; +import { stringDecode, uint8ToNumber, addressDecode } from '../../lib/decoders'; +import { StataToken } from './types'; +import FactoryABI from '../../abi/aavev3statav2/Factory.json'; +import TokenABI from '../../abi/aavev3statav2/Token.json'; +import { AbiItem } from 'web3-utils'; + +// const stataInterface = new Interface(IStaticATokenLM_ABI); +const statav2Interface = new Interface(TokenABI); + +async function getTokenMetaData( + stataTokens: string[], + multiWrapper: MultiWrapper, + blockNumber?: number, +): Promise { + const calls: MultiCallParams[] = stataTokens + .map(token => { + return [ + { + target: token, + callData: statav2Interface.encodeFunctionData('symbol'), + decodeFunction: stringDecode, + }, + { + target: token, + callData: statav2Interface.encodeFunctionData('decimals'), + decodeFunction: uint8ToNumber, + }, + { + target: token, + callData: statav2Interface.encodeFunctionData('asset'), + decodeFunction: addressDecode, + }, + { + target: token, + callData: statav2Interface.encodeFunctionData('aToken'), + decodeFunction: addressDecode, + }, + ]; + }) + .flat(); + + const results = await multiWrapper.aggregate( + calls, + blockNumber, + ); + + let tokenList: StataToken[] = []; + for (let i = 0, x = 0; i < stataTokens.length; ++i, x += 4) { + tokenList.push({ + address: stataTokens[i].toLowerCase(), + stataSymbol: results[x] as string, + decimals: results[x + 1] as number, + underlying: (results[x + 2] as string).toLowerCase(), + underlyingAToken: (results[x + 3] as string).toLowerCase(), + }); + } + return tokenList; +} + +export const fetchTokenList = async ( + web3Provider: Web3, + factoryAddresses: string[], + multiWrapper: MultiWrapper, + blockNumber?: number, +): Promise => { + let stataList: string[] = ( + (await Promise.all( + factoryAddresses.map(async factoryAddress => { + let factoryContract = new web3Provider.eth.Contract( + FactoryABI as AbiItem[], + // IStaticATokenFactory_ABI as any, + factoryAddress, + ); + + return await factoryContract.methods.getStataTokens().call(); + }), + )) as string[][] + ).flat(); + + return getTokenMetaData(stataList, multiWrapper, blockNumber); +}; diff --git a/src/dex/aave-v3/config.ts b/src/dex/aave-v3/config.ts index 046c8d7ed..c212e8587 100644 --- a/src/dex/aave-v3/config.ts +++ b/src/dex/aave-v3/config.ts @@ -10,7 +10,6 @@ import { AaveV3Fantom, AaveV3Optimism, AaveV3Polygon, - AaveV3PolygonZkEvm, AaveV3Gnosis, } from '@bgd-labs/aave-address-book'; @@ -65,12 +64,12 @@ export const Config: DexConfigMap = { poolAddress: AaveV3BNB.POOL, wethGatewayAddress: AaveV3BNB.WETH_GATEWAY, }, - [Network.ZKEVM]: { - ethGasCost: 246 * 100, - lendingGasCost: 328 * 1000, - poolAddress: AaveV3PolygonZkEvm.POOL, - wethGatewayAddress: AaveV3PolygonZkEvm.WETH_GATEWAY, - }, + // [Network.ZKEVM]: { + // ethGasCost: 246 * 100, + // lendingGasCost: 328 * 1000, + // poolAddress: AaveV3PolygonZkEvm.POOL, + // wethGatewayAddress: AaveV3PolygonZkEvm.WETH_GATEWAY, + // }, [Network.GNOSIS]: { ethGasCost: 246 * 100, lendingGasCost: 328 * 1000, diff --git a/src/dex/index.ts b/src/dex/index.ts index 131f52b51..f982e5bb6 100644 --- a/src/dex/index.ts +++ b/src/dex/index.ts @@ -85,6 +85,7 @@ import { EtherFi } from './etherfi'; import { Spark } from './spark/spark'; import { VelodromeSlipstream } from './uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream'; import { AaveV3Stata } from './aave-v3-stata/aave-v3-stata'; +import { AaveV3StataV2 } from './aave-v3-stata-v2/aave-v3-stata-v2'; import { OSwap } from './oswap/oswap'; import { FluidDex } from './fluid-dex/fluid-dex'; import { ConcentratorArusd } from './concentrator-arusd/concentrator-arusd'; @@ -176,6 +177,7 @@ const Dexes = [ PharaohV1, Spark, AaveV3Stata, + AaveV3StataV2, OSwap, ConcentratorArusd, FxProtocolRusd, diff --git a/src/dex/stkgho/config.ts b/src/dex/stkgho/config.ts index fcfc832d0..d1c6b5b38 100644 --- a/src/dex/stkgho/config.ts +++ b/src/dex/stkgho/config.ts @@ -2,13 +2,13 @@ import { DexParams } from './types'; import { DexConfigMap } from '../../types'; import { Network } from '../../constants'; -import { MiscEthereum } from '@bgd-labs/aave-address-book'; +import { GhoEthereum, AaveSafetyModule } from '@bgd-labs/aave-address-book'; export const StkGHOConfig: DexConfigMap = { StkGHO: { [Network.MAINNET]: { - stkGHO: '0x1a88Df1cFe15Af22B3c4c783D4e6F7F9e0C1885d', - GHO: MiscEthereum.GHO_TOKEN, + stkGHO: AaveSafetyModule.STK_GHO, + GHO: GhoEthereum.GHO_TOKEN, }, }, }; diff --git a/tests/constants-e2e.ts b/tests/constants-e2e.ts index 29e337000..1b0b6b326 100644 --- a/tests/constants-e2e.ts +++ b/tests/constants-e2e.ts @@ -528,6 +528,10 @@ export const Tokens: { address: '0x862c57d48becb45583aeba3f489696d22466ca1b', decimals: 6, }, + waEthUSDT: { + address: '0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8', + decimals: 6, + }, aaveUSDT: { address: '0x23878914efe38d27c4d67ab83ed1b93a74d4086a', decimals: 6, @@ -1729,7 +1733,8 @@ export const Holders: { USDe: '0x74e6c48e667d698a4cf90665b6960a5bae39e603', eETH: '0x0f1DfeF1a40557d279d0de6E49aB306891A638b8', stataUSDT: '0x6803364AceD5181877abC11E865FB27cB654a426', - aaveUSDT: '0x32c98a981Fe7C333Bd4e8E7630E8e0CF5ce20987', + aaveUSDT: '0x464C71f6c2F760DdA6093dCB91C24c39e5d6e18c', + waEthUSDT: '0xbA1333333333a1BA1108E8412f11850A5C319bA9', weETH: '0x267ed5f71EE47D3E45Bb1569Aa37889a2d10f91e', rUSD: '0xEC2eda1C4F981E468ABF62424a10B69B738b498E', arUSD: '0xeFc24206053a452e2299BF3b8f964512b041Db4C', diff --git a/yarn.lock b/yarn.lock index f47dec85f..e0a05a043 100644 --- a/yarn.lock +++ b/yarn.lock @@ -360,10 +360,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bgd-labs/aave-address-book@2.21.1": - version "2.21.1" - resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.21.1.tgz#004aa244d715d785079029f6b61d5ece6bcff563" - integrity sha512-q22AThlSRgEgRkwWiK1ts13oO3epZkARmdJzhezv6Fv3PNa5M95uoqABjNldWmpUyadhy2UtujGzXdOQ6MSS9Q== +"@bgd-labs/aave-address-book@4.7.0": + version "4.7.0" + resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-4.7.0.tgz#4d64ff67dd83f32fcff71ffe7498bf9477c8586f" + integrity sha512-oxLDYy36woE1AuW97aXI7bk+v+/my0YAqaWbGokLJGc+An7/ABfF89cbn9aJqAx3fyT8DDRojGyrcGIeocnNBg== "@cspotcode/source-map-support@^0.8.0": version "0.8.1"