impermax-sdk 1.2.112 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/abis/ImpermaxABI.d.ts +2 -2
- package/lib/abis/ImpermaxABI.js +3 -3
- package/lib/abis/contracts/ClaimAggregator.json +2015 -2015
- package/lib/abis/contracts/IAllowanceTransfer.json +3772 -0
- package/lib/abis/contracts/IBorrowable.json +13207 -13207
- package/lib/abis/contracts/IClaimable.json +406 -406
- package/lib/abis/contracts/ICollateral.json +9052 -9052
- package/lib/abis/contracts/IERC20.json +2376 -2376
- package/lib/abis/contracts/IERC721.json +3515 -0
- package/lib/abis/contracts/IFactory.json +3660 -3660
- package/lib/abis/contracts/IFarmingPool.json +3584 -3584
- package/lib/abis/contracts/ILendingVaultV1.json +8358 -8358
- package/lib/abis/contracts/IMerkleDistributor.json +1134 -1134
- package/lib/abis/contracts/IRouter02.json +7283 -7283
- package/lib/abis/contracts/ISimpleUniswapOracle.json +1469 -1469
- package/lib/abis/contracts/IStakedLPToken.json +7309 -7309
- package/lib/abis/contracts/IStakingRewards.json +1036 -1036
- package/lib/abis/contracts/ITokenizedUniswapV2Position.json +4167 -0
- package/lib/abis/contracts/ITokenizedUniswapV3Position.json +5539 -0
- package/lib/abis/contracts/IUniswapV2Factory.json +1690 -1690
- package/lib/abis/contracts/IUniswapV2Pair.json +6761 -6761
- package/lib/abis/contracts/IUniswapV3Pool.json +6606 -0
- package/lib/abis/contracts/ImpermaxChef.json +20945 -20945
- package/lib/abis/contracts/ImpermaxConfigManager.json +31595 -31595
- package/lib/abis/contracts/ImpermaxV3Borrowable.json +22131 -0
- package/lib/abis/contracts/ImpermaxV3Collateral.json +22988 -0
- package/lib/abis/contracts/ImpermaxV3Factory.json +17645 -0
- package/lib/abis/contracts/ImpermaxV3UniV2Router01.json +32488 -0
- package/lib/abis/contracts/ImpermaxV3UniV3Router01.json +37742 -0
- package/lib/abis/contracts/LendingVaultWatcher01.json +4076 -4076
- package/lib/abis/contracts/PoolTokenRouter01.json +9058 -0
- package/lib/config/amms.d.ts +102 -104
- package/lib/config/amms.js +433 -436
- package/lib/config/chainId.d.ts +2 -0
- package/lib/config/chainId.js +26 -0
- package/lib/config/contracts/claim-aggregators.d.ts +2 -2
- package/lib/config/contracts/claim-aggregators.js +26 -26
- package/lib/config/contracts/impermax-chef.d.ts +2 -2
- package/lib/config/contracts/impermax-chef.js +27 -27
- package/lib/config/contracts/impermax-config-manager.d.ts +2 -2
- package/lib/config/contracts/impermax-config-manager.js +26 -26
- package/lib/config/contracts/impermax-factories.d.ts +4 -4
- package/lib/config/contracts/impermax-factories.js +87 -87
- package/lib/config/contracts/imxes.d.ts +2 -2
- package/lib/config/contracts/imxes.js +26 -26
- package/lib/config/contracts/lending-vault-watcher.d.ts +2 -2
- package/lib/config/contracts/lending-vault-watcher.js +26 -26
- package/lib/config/contracts/merkle-distributors.d.ts +4 -4
- package/lib/config/contracts/merkle-distributors.js +70 -70
- package/lib/config/contracts/routers.d.ts +4 -3
- package/lib/config/contracts/routers.js +118 -94
- package/lib/config/contracts/simple-uniswap-oracles.d.ts +2 -2
- package/lib/config/contracts/simple-uniswap-oracles.js +49 -49
- package/lib/config/contracts/weths.d.ts +2 -2
- package/lib/config/contracts/weths.js +27 -27
- package/lib/config/debank-ids.d.ts +2 -2
- package/lib/config/debank-ids.js +26 -26
- package/lib/config/endpoints/merkle-distributors.d.ts +4 -4
- package/lib/config/endpoints/merkle-distributors.js +70 -70
- package/lib/config/eth.d.ts +3 -3
- package/lib/config/eth.js +48 -48
- package/lib/config/factories.d.ts +7 -7
- package/lib/config/factories.js +31 -30
- package/lib/config/farms.d.ts +109 -111
- package/lib/config/farms.js +207 -210
- package/lib/config/general.d.ts +5 -5
- package/lib/config/general.js +8 -8
- package/lib/config/subgraphs.d.ts +45 -45
- package/lib/config/subgraphs.js +187 -187
- package/lib/config/types.d.ts +85 -72
- package/lib/config/types.js +72 -58
- package/lib/index.d.ts +36 -35
- package/lib/index.js +159 -152
- package/lib/offchain/account/index.d.ts +9 -7
- package/lib/offchain/account/index.js +43 -39
- package/lib/offchain/account/lendingPool/borrowable.d.ts +14 -0
- package/lib/offchain/account/lendingPool/borrowable.js +73 -0
- package/lib/offchain/account/lendingPool/collateral.d.ts +12 -0
- package/lib/offchain/account/lendingPool/collateral.js +42 -0
- package/lib/offchain/account/lendingPool/index.d.ts +6 -5
- package/lib/offchain/account/lendingPool/index.js +14 -12
- package/lib/offchain/account/lendingPool/offchainAccountBorrowable.d.ts +14 -17
- package/lib/offchain/account/lendingPool/offchainAccountBorrowable.js +45 -71
- package/lib/offchain/account/lendingPool/offchainAccountCollateral.d.ts +11 -13
- package/lib/offchain/account/lendingPool/offchainAccountCollateral.js +31 -43
- package/lib/offchain/account/lendingPool/offchainAccountLendingPool.d.ts +28 -21
- package/lib/offchain/account/lendingPool/offchainAccountLendingPool.js +69 -68
- package/lib/offchain/account/lendingPool/offchainLeveragedPosition.d.ts +25 -0
- package/lib/offchain/account/lendingPool/offchainLeveragedPosition.js +116 -0
- package/lib/offchain/account/lendingVault.d.ts +11 -0
- package/lib/offchain/account/lendingVault.js +38 -0
- package/lib/offchain/account/offchainAccount.d.ts +25 -25
- package/lib/offchain/account/offchainAccount.js +129 -129
- package/lib/offchain/account/offchainAccountLendingVault.d.ts +16 -16
- package/lib/offchain/account/offchainAccountLendingVault.js +64 -64
- package/lib/offchain/account/offchainAccountPoolToken.d.ts +7 -7
- package/lib/offchain/account/offchainAccountPoolToken.js +24 -24
- package/lib/offchain/account/offchainMultichainAccount.d.ts +34 -0
- package/lib/offchain/account/offchainMultichainAccount.js +66 -0
- package/lib/offchain/account/poolToken.d.ts +6 -0
- package/lib/offchain/account/poolToken.js +21 -0
- package/lib/offchain/account/vault/index.d.ts +3 -0
- package/lib/offchain/account/vault/index.js +7 -0
- package/lib/offchain/account/vault/offchainAccountVault.d.ts +16 -0
- package/lib/offchain/account/vault/offchainAccountVault.js +64 -0
- package/lib/offchain/configManager/index.d.ts +5 -5
- package/lib/offchain/configManager/index.js +12 -12
- package/lib/offchain/configManager/offchainConfigManager.d.ts +25 -25
- package/lib/offchain/configManager/offchainConfigManager.js +76 -76
- package/lib/offchain/configManager/offchainConfigManagerInitializer.d.ts +6 -6
- package/lib/offchain/configManager/offchainConfigManagerInitializer.js +53 -53
- package/lib/offchain/configManager/offchainPairConfig.d.ts +40 -40
- package/lib/offchain/configManager/offchainPairConfig.js +86 -86
- package/lib/offchain/configManager/offchainProposal.d.ts +17 -17
- package/lib/offchain/configManager/offchainProposal.js +53 -53
- package/lib/offchain/index.d.ts +15 -14
- package/lib/offchain/index.js +55 -53
- package/lib/offchain/initializer.d.ts +32 -0
- package/lib/offchain/initializer.js +627 -0
- package/lib/offchain/lendingPool/borrowable.d.ts +55 -0
- package/lib/offchain/lendingPool/borrowable.js +351 -0
- package/lib/offchain/lendingPool/collateral.d.ts +17 -0
- package/lib/offchain/lendingPool/collateral.js +72 -0
- package/lib/offchain/lendingPool/index.d.ts +5 -5
- package/lib/offchain/lendingPool/index.js +12 -12
- package/lib/offchain/lendingPool/offchainBorrowable.d.ts +59 -59
- package/lib/offchain/lendingPool/offchainBorrowable.js +366 -366
- package/lib/offchain/lendingPool/offchainCollateral.d.ts +20 -19
- package/lib/offchain/lendingPool/offchainCollateral.js +81 -75
- package/lib/offchain/lendingPool/offchainLendingPool.d.ts +60 -47
- package/lib/offchain/lendingPool/offchainLendingPool.js +277 -230
- package/lib/offchain/lendingVault.d.ts +22 -0
- package/lib/offchain/lendingVault.js +115 -0
- package/lib/offchain/offchain.d.ts +106 -113
- package/lib/offchain/offchain.js +248 -251
- package/lib/offchain/offchainAPRHelper.d.ts +45 -45
- package/lib/offchain/offchainAPRHelper.js +239 -239
- package/lib/offchain/offchainEndpointManager.d.ts +25 -25
- package/lib/offchain/offchainEndpointManager.js +126 -126
- package/lib/offchain/offchainInitializer.d.ts +52 -52
- package/lib/offchain/offchainInitializer.js +792 -792
- package/lib/offchain/offchainLendingVault.d.ts +25 -25
- package/lib/offchain/offchainLendingVault.js +114 -114
- package/lib/offchain/offchainMultichain.d.ts +50 -0
- package/lib/offchain/offchainMultichain.js +75 -0
- package/lib/offchain/offchainPoolToken.d.ts +21 -21
- package/lib/offchain/offchainPoolToken.js +128 -128
- package/lib/offchain/offchainPriceHelper.d.ts +22 -22
- package/lib/offchain/offchainPriceHelper.js +364 -364
- package/lib/offchain/offchainSolidexHelper.d.ts +16 -16
- package/lib/offchain/offchainSolidexHelper.js +58 -58
- package/lib/offchain/offchainTypes.d.ts +212 -212
- package/lib/offchain/offchainTypes.js +3 -3
- package/lib/offchain/poolToken.d.ts +20 -0
- package/lib/offchain/poolToken.js +120 -0
- package/lib/offchain/priceHelper.d.ts +21 -0
- package/lib/offchain/priceHelper.js +195 -0
- package/lib/offchain/queries/apis/ponder/index.d.ts +14 -14
- package/lib/offchain/queries/apis/ponder/index.js +281 -281
- package/lib/offchain/queries/apis/thegraph/index.d.ts +19 -19
- package/lib/offchain/queries/apis/thegraph/index.js +355 -355
- package/lib/offchain/queries/index.d.ts +20 -20
- package/lib/offchain/queries/index.js +51 -51
- package/lib/offchain/queries/interfaces/query-builder.d.ts +19 -19
- package/lib/offchain/queries/interfaces/query-builder.js +2 -2
- package/lib/offchain/queries/interfaces/transformers.js +9 -9
- package/lib/offchain/query.d.ts +15 -0
- package/lib/offchain/query.js +323 -0
- package/lib/offchain/solidexHelper.d.ts +16 -0
- package/lib/offchain/solidexHelper.js +58 -0
- package/lib/offchain/types.d.ts +150 -0
- package/lib/offchain/types.js +3 -0
- package/lib/offchain/vault/index.d.ts +6 -0
- package/lib/offchain/vault/index.js +14 -0
- package/lib/offchain/vault/offchainHedgedVault.d.ts +9 -0
- package/lib/offchain/vault/offchainHedgedVault.js +57 -0
- package/lib/offchain/vault/offchainLendingVault.d.ts +16 -0
- package/lib/offchain/vault/offchainLendingVault.js +73 -0
- package/lib/offchain/vault/offchainLeveragedVault.d.ts +9 -0
- package/lib/offchain/vault/offchainLeveragedVault.js +57 -0
- package/lib/offchain/vault/offchainVault.d.ts +34 -0
- package/lib/offchain/vault/offchainVault.js +130 -0
- package/lib/onchain/account/index.d.ts +6 -6
- package/lib/onchain/account/index.js +38 -38
- package/lib/onchain/account/interactions/index.d.ts +28 -0
- package/lib/onchain/account/interactions/index.js +158 -0
- package/lib/onchain/account/interactions/lendingPool/borrowable.d.ts +16 -0
- package/lib/onchain/account/interactions/lendingPool/borrowable.js +49 -0
- package/lib/onchain/account/interactions/lendingPool/collateral.d.ts +15 -0
- package/lib/onchain/account/interactions/lendingPool/collateral.js +33 -0
- package/lib/onchain/account/interactions/lendingPool/index.d.ts +41 -0
- package/lib/onchain/account/interactions/lendingPool/index.js +120 -0
- package/lib/onchain/account/interactions/lendingVault.d.ts +10 -0
- package/lib/onchain/account/interactions/lendingVault.js +12 -0
- package/lib/onchain/account/interactions/poolToken.d.ts +33 -0
- package/lib/onchain/account/interactions/poolToken.js +180 -0
- package/lib/onchain/account/lendingPool/borrowable.d.ts +29 -0
- package/lib/onchain/account/lendingPool/borrowable.js +135 -0
- package/lib/onchain/account/lendingPool/collateral.d.ts +15 -0
- package/lib/onchain/account/lendingPool/collateral.js +66 -0
- package/lib/onchain/account/lendingPool/index.d.ts +12 -5
- package/lib/onchain/account/lendingPool/index.js +49 -12
- package/lib/onchain/account/lendingPool/nftlp/index.d.ts +4 -0
- package/lib/onchain/account/lendingPool/nftlp/index.js +11 -0
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlp.d.ts +7 -0
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlp.js +12 -0
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpUniswapV3.d.ts +4 -0
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpUniswapV3.js +13 -0
- package/lib/onchain/account/lendingPool/onchainAccountBorrowable.d.ts +39 -34
- package/lib/onchain/account/lendingPool/onchainAccountBorrowable.js +131 -176
- package/lib/onchain/account/lendingPool/onchainAccountBorrowableV2.d.ts +10 -0
- package/lib/onchain/account/lendingPool/onchainAccountBorrowableV2.js +55 -0
- package/lib/onchain/account/lendingPool/onchainAccountBorrowableV3.d.ts +10 -0
- package/lib/onchain/account/lendingPool/onchainAccountBorrowableV3.js +28 -0
- package/lib/onchain/account/lendingPool/onchainAccountCollateral.d.ts +10 -23
- package/lib/onchain/account/lendingPool/onchainAccountCollateral.js +26 -109
- package/lib/onchain/account/lendingPool/onchainAccountCollateralV2.d.ts +25 -0
- package/lib/onchain/account/lendingPool/onchainAccountCollateralV2.js +99 -0
- package/lib/onchain/account/lendingPool/onchainAccountCollateralV3.d.ts +18 -0
- package/lib/onchain/account/lendingPool/onchainAccountCollateralV3.js +44 -0
- package/lib/onchain/account/lendingPool/onchainAccountLendingPool.d.ts +42 -57
- package/lib/onchain/account/lendingPool/onchainAccountLendingPool.js +142 -352
- package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV2.d.ts +44 -0
- package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV2.js +285 -0
- package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV3.d.ts +27 -0
- package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV3.js +32 -0
- package/lib/onchain/account/lendingVault.d.ts +10 -0
- package/lib/onchain/account/lendingVault.js +35 -0
- package/lib/onchain/account/onchainAccount.d.ts +32 -32
- package/lib/onchain/account/onchainAccount.js +166 -167
- package/lib/onchain/account/onchainAccountLendingVault.d.ts +19 -19
- package/lib/onchain/account/onchainAccountLendingVault.js +48 -48
- package/lib/onchain/account/onchainAccountPoolToken.d.ts +30 -30
- package/lib/onchain/account/onchainAccountPoolToken.js +86 -86
- package/lib/onchain/account/poolToken.d.ts +24 -0
- package/lib/onchain/account/poolToken.js +84 -0
- package/lib/onchain/configManager/index.d.ts +5 -5
- package/lib/onchain/configManager/index.js +12 -12
- package/lib/onchain/configManager/onchainConfigManager.d.ts +12 -12
- package/lib/onchain/configManager/onchainConfigManager.js +38 -38
- package/lib/onchain/configManager/onchainPairConfig.d.ts +38 -38
- package/lib/onchain/configManager/onchainPairConfig.js +85 -85
- package/lib/onchain/configManager/onchainProposal.d.ts +17 -17
- package/lib/onchain/configManager/onchainProposal.js +55 -55
- package/lib/onchain/contractsHelper.d.ts +29 -0
- package/lib/onchain/contractsHelper.js +52 -0
- package/lib/onchain/impermaxFactory/index.d.ts +7 -5
- package/lib/onchain/impermaxFactory/index.js +39 -35
- package/lib/onchain/impermaxFactory/lendingPool/borrowable.d.ts +36 -0
- package/lib/onchain/impermaxFactory/lendingPool/borrowable.js +153 -0
- package/lib/onchain/impermaxFactory/lendingPool/collateral.d.ts +17 -0
- package/lib/onchain/impermaxFactory/lendingPool/collateral.js +59 -0
- package/lib/onchain/impermaxFactory/lendingPool/index.d.ts +12 -5
- package/lib/onchain/impermaxFactory/lendingPool/index.js +50 -12
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/index.d.ts +4 -0
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/index.js +11 -0
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlp.d.ts +22 -0
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlp.js +19 -0
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpUniswapV3.d.ts +24 -0
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpUniswapV3.js +90 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowable.d.ts +38 -34
- package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowable.js +137 -156
- package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowableV2.d.ts +9 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowableV2.js +36 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowableV3.d.ts +7 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowableV3.js +23 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainCollateral.d.ts +8 -19
- package/lib/onchain/impermaxFactory/lendingPool/onchainCollateral.js +24 -61
- package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV2.d.ts +20 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV2.js +58 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV3.d.ts +13 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV3.js +36 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPool.d.ts +43 -58
- package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPool.js +81 -367
- package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV2.d.ts +76 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV2.js +338 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV3.d.ts +42 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV3.js +39 -0
- package/lib/onchain/impermaxFactory/onchainImpermaxFactory.d.ts +26 -16
- package/lib/onchain/impermaxFactory/onchainImpermaxFactory.js +42 -52
- package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV2.d.ts +16 -0
- package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV2.js +81 -0
- package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV3.d.ts +16 -0
- package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV3.js +88 -0
- package/lib/onchain/index.d.ts +10 -10
- package/lib/onchain/index.js +49 -49
- package/lib/onchain/interactions/index.d.ts +8 -8
- package/lib/onchain/interactions/index.js +41 -41
- package/lib/onchain/interactions/lendingPool/borrowable.d.ts +14 -0
- package/lib/onchain/interactions/lendingPool/borrowable.js +47 -0
- package/lib/onchain/interactions/lendingPool/collateral.d.ts +13 -0
- package/lib/onchain/interactions/lendingPool/collateral.js +31 -0
- package/lib/onchain/interactions/lendingPool/index.d.ts +12 -5
- package/lib/onchain/interactions/lendingPool/index.js +49 -12
- package/lib/onchain/interactions/lendingPool/nftlp/index.d.ts +4 -0
- package/lib/onchain/interactions/lendingPool/nftlp/index.js +11 -0
- package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlp.d.ts +7 -0
- package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlp.js +12 -0
- package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlpUniswapV3.d.ts +4 -0
- package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlpUniswapV3.js +13 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowable.d.ts +17 -21
- package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowable.js +24 -56
- package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowableV2.d.ts +15 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowableV2.js +63 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowableV3.d.ts +9 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowableV3.js +14 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateral.d.ts +7 -19
- package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateral.js +11 -43
- package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV2.d.ts +20 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV2.js +48 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV3.d.ts +13 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV3.js +20 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPool.d.ts +31 -46
- package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPool.js +53 -135
- package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV2.d.ts +42 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV2.js +114 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV3.d.ts +27 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV3.js +32 -0
- package/lib/onchain/interactions/lendingVault.d.ts +8 -0
- package/lib/onchain/interactions/lendingVault.js +15 -0
- package/lib/onchain/interactions/onchainInteractions.d.ts +31 -31
- package/lib/onchain/interactions/onchainInteractions.js +136 -137
- package/lib/onchain/interactions/onchainInteractionsConfigManager.d.ts +17 -17
- package/lib/onchain/interactions/onchainInteractionsConfigManager.js +44 -44
- package/lib/onchain/interactions/onchainInteractionsLendingVault.d.ts +14 -14
- package/lib/onchain/interactions/onchainInteractionsLendingVault.js +21 -21
- package/lib/onchain/interactions/onchainInteractionsPoolToken.d.ts +35 -35
- package/lib/onchain/interactions/onchainInteractionsPoolToken.js +134 -186
- package/lib/onchain/interactions/poolToken.d.ts +31 -0
- package/lib/onchain/interactions/poolToken.js +181 -0
- package/lib/onchain/lendingVault.d.ts +17 -0
- package/lib/onchain/lendingVault.js +56 -0
- package/lib/onchain/onchain.d.ts +38 -35
- package/lib/onchain/onchain.js +78 -70
- package/lib/onchain/onchainContractsHelper.d.ts +42 -31
- package/lib/onchain/onchainContractsHelper.js +90 -56
- package/lib/onchain/onchainLendingVault.d.ts +22 -22
- package/lib/onchain/onchainLendingVault.js +69 -69
- package/lib/onchain/onchainPermitHelper.d.ts +21 -0
- package/lib/onchain/onchainPermitHelper.js +198 -0
- package/lib/onchain/onchainPoolToken.d.ts +35 -35
- package/lib/onchain/onchainPoolToken.js +129 -129
- package/lib/onchain/onchainTypes.d.ts +70 -64
- package/lib/onchain/onchainTypes.js +14 -14
- package/lib/onchain/poolToken.d.ts +32 -0
- package/lib/onchain/poolToken.js +121 -0
- package/lib/onchain/types.d.ts +45 -0
- package/lib/onchain/types.js +14 -0
- package/lib/utils/ether-utils.d.ts +5 -5
- package/lib/utils/ether-utils.js +26 -26
- package/lib/utils/index.d.ts +3 -3
- package/lib/utils/index.js +16 -16
- package/lib/utils/lliquidity-math.d.ts +30 -30
- package/lib/utils/lliquidity-math.js +139 -139
- package/lib/utils/price-from-reserves.d.ts +2 -0
- package/lib/utils/price-from-reserves.js +19 -0
- package/package.json +36 -36
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { Address, PoolTokenType } from '../config/types';
|
|
2
|
+
export interface PoolTokenData {
|
|
3
|
+
id: Address;
|
|
4
|
+
totalBalance: string;
|
|
5
|
+
exchangeRate: string;
|
|
6
|
+
totalBalanceUSD: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BorrowableData extends PoolTokenData {
|
|
9
|
+
underlying: TokenData;
|
|
10
|
+
totalBorrows: string;
|
|
11
|
+
borrowRate: string;
|
|
12
|
+
reserveFactor: string;
|
|
13
|
+
kinkBorrowRate: string;
|
|
14
|
+
kinkUtilizationRate: string;
|
|
15
|
+
borrowIndex: string;
|
|
16
|
+
accrualTimestamp: string;
|
|
17
|
+
farmingPool: FarmingPoolData;
|
|
18
|
+
rewards?: Array<{
|
|
19
|
+
rewardToken: Address;
|
|
20
|
+
rewardRate: number;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
export interface CollateralData extends PoolTokenData {
|
|
24
|
+
safetyMargin: string;
|
|
25
|
+
liquidationIncentive: string;
|
|
26
|
+
liquidationFee: string;
|
|
27
|
+
}
|
|
28
|
+
export interface BorrowablePastData {
|
|
29
|
+
borrowIndex: string;
|
|
30
|
+
accrualTimestamp: string;
|
|
31
|
+
exchangeRate: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TokenData {
|
|
34
|
+
id: Address;
|
|
35
|
+
symbol: string;
|
|
36
|
+
name: string;
|
|
37
|
+
decimals: string;
|
|
38
|
+
derivedUSD: string;
|
|
39
|
+
}
|
|
40
|
+
export interface RewardData {
|
|
41
|
+
id: Address;
|
|
42
|
+
rewardRate: string;
|
|
43
|
+
rewardsToken: TokenData;
|
|
44
|
+
periodFinish: string;
|
|
45
|
+
}
|
|
46
|
+
export interface PairData {
|
|
47
|
+
id: Address;
|
|
48
|
+
factory: string;
|
|
49
|
+
reserve0: string;
|
|
50
|
+
reserve1: string;
|
|
51
|
+
totalSupply: string;
|
|
52
|
+
reserveUSD: string;
|
|
53
|
+
token0Price: string;
|
|
54
|
+
token1Price: string;
|
|
55
|
+
derivedUSD: string;
|
|
56
|
+
uniswapV2PairAddress: string;
|
|
57
|
+
uniswapV2Factory: string;
|
|
58
|
+
isStakedLPToken: boolean;
|
|
59
|
+
exchangeRate: string;
|
|
60
|
+
stakingRewards: string;
|
|
61
|
+
masterChef: string;
|
|
62
|
+
pid: string;
|
|
63
|
+
stakedTotalSupply: string;
|
|
64
|
+
rewards: Array<RewardData>;
|
|
65
|
+
uniswapAPR: number;
|
|
66
|
+
}
|
|
67
|
+
export interface FarmingPoolData {
|
|
68
|
+
epochAmount: string;
|
|
69
|
+
epochBegin: string;
|
|
70
|
+
segmentLength: string;
|
|
71
|
+
vestingBegin: string;
|
|
72
|
+
sharePercentage: string;
|
|
73
|
+
}
|
|
74
|
+
export interface LendingPoolPastData {
|
|
75
|
+
[PoolTokenType.Collateral]: undefined;
|
|
76
|
+
[PoolTokenType.BorrowableA]: BorrowablePastData;
|
|
77
|
+
[PoolTokenType.BorrowableB]: BorrowablePastData;
|
|
78
|
+
}
|
|
79
|
+
export interface LendingPoolData {
|
|
80
|
+
id: Address;
|
|
81
|
+
[PoolTokenType.Collateral]: CollateralData;
|
|
82
|
+
[PoolTokenType.BorrowableA]: BorrowableData;
|
|
83
|
+
[PoolTokenType.BorrowableB]: BorrowableData;
|
|
84
|
+
pair: PairData;
|
|
85
|
+
past24h?: LendingPoolPastData;
|
|
86
|
+
past7d?: LendingPoolPastData;
|
|
87
|
+
}
|
|
88
|
+
export interface CollateralPosition {
|
|
89
|
+
balance: string;
|
|
90
|
+
collateral: {
|
|
91
|
+
lendingPool: {
|
|
92
|
+
id: Address;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface SupplyPosition {
|
|
97
|
+
balance: string;
|
|
98
|
+
borrowable: {
|
|
99
|
+
underlying: {
|
|
100
|
+
id: Address;
|
|
101
|
+
};
|
|
102
|
+
lendingPool: {
|
|
103
|
+
id: Address;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export interface BorrowPosition {
|
|
108
|
+
borrowBalance: string;
|
|
109
|
+
borrowIndex: string;
|
|
110
|
+
borrowable: {
|
|
111
|
+
underlying: {
|
|
112
|
+
id: Address;
|
|
113
|
+
};
|
|
114
|
+
lendingPool: {
|
|
115
|
+
id: Address;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export interface RawUserData {
|
|
120
|
+
collateralPositions: CollateralPosition[];
|
|
121
|
+
supplyPositions: SupplyPosition[];
|
|
122
|
+
borrowPositions: BorrowPosition[];
|
|
123
|
+
}
|
|
124
|
+
export interface UserData {
|
|
125
|
+
collateralPositions: {
|
|
126
|
+
[key in Address]: CollateralPosition;
|
|
127
|
+
};
|
|
128
|
+
supplyPositions: {
|
|
129
|
+
[key in Address]: {
|
|
130
|
+
[key in PoolTokenType]?: SupplyPosition;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
borrowPositions: {
|
|
134
|
+
[key in Address]: {
|
|
135
|
+
[key in PoolTokenType]?: BorrowPosition;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface TvlData {
|
|
140
|
+
crossChainTVLUSD: number;
|
|
141
|
+
totalBalanceUSD: number;
|
|
142
|
+
totalBorrowsUSD: number;
|
|
143
|
+
totalSupplyUSD: number;
|
|
144
|
+
}
|
|
145
|
+
export interface XimxData {
|
|
146
|
+
totalSupply: string;
|
|
147
|
+
totalBalance: string;
|
|
148
|
+
exchangeRate: string;
|
|
149
|
+
dailyAPR: string;
|
|
150
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import OffchainLeveragedVault from './offchainLeveragedVault';
|
|
2
|
+
import OffchainLendingVault from './offchainLendingVault';
|
|
3
|
+
import OffchainHedgedVault from './offchainHedgedVault';
|
|
4
|
+
import OffchainVault from './offchainVault';
|
|
5
|
+
export { OffchainLeveragedVault, OffchainLendingVault, OffchainHedgedVault, };
|
|
6
|
+
export default OffchainVault;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.OffchainHedgedVault = exports.OffchainLendingVault = exports.OffchainLeveragedVault = void 0;
|
|
7
|
+
const offchainLeveragedVault_1 = __importDefault(require("./offchainLeveragedVault"));
|
|
8
|
+
exports.OffchainLeveragedVault = offchainLeveragedVault_1.default;
|
|
9
|
+
const offchainLendingVault_1 = __importDefault(require("./offchainLendingVault"));
|
|
10
|
+
exports.OffchainLendingVault = offchainLendingVault_1.default;
|
|
11
|
+
const offchainHedgedVault_1 = __importDefault(require("./offchainHedgedVault"));
|
|
12
|
+
exports.OffchainHedgedVault = offchainHedgedVault_1.default;
|
|
13
|
+
const offchainVault_1 = __importDefault(require("./offchainVault"));
|
|
14
|
+
exports.default = offchainVault_1.default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Offchain from "../index";
|
|
2
|
+
import { Address } from '../../config/types';
|
|
3
|
+
import OffchainVault from "./offchainVault";
|
|
4
|
+
import OffchainLendingPool from "../lendingPool";
|
|
5
|
+
export default class OffchainHedgedVaultVault extends OffchainVault {
|
|
6
|
+
constructor(offchain: Offchain, vaultAddress: Address);
|
|
7
|
+
getLeverage(): Promise<number>;
|
|
8
|
+
getPair(): Promise<OffchainLendingPool>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const types_1 = require("../../config/types");
|
|
39
|
+
const offchainVault_1 = __importStar(require("./offchainVault"));
|
|
40
|
+
const lendingPool_1 = __importDefault(require("../lendingPool"));
|
|
41
|
+
class OffchainHedgedVaultVault extends offchainVault_1.default {
|
|
42
|
+
constructor(offchain, vaultAddress) {
|
|
43
|
+
super(offchain, vaultAddress);
|
|
44
|
+
this.vaultType = offchainVault_1.VaultType.HEDGED;
|
|
45
|
+
}
|
|
46
|
+
getLeverage() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return 1;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
getPair() {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
return new lendingPool_1.default(this.getOffchain(), types_1.Factory.V2V2, "0x");
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = OffchainHedgedVaultVault;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Offchain from "../index";
|
|
2
|
+
import { Address } from '../../config/types';
|
|
3
|
+
import OffchainVault from "./offchainVault";
|
|
4
|
+
import { OffchainBorrowable } from "../lendingPool";
|
|
5
|
+
export declare enum RiskLevel {
|
|
6
|
+
LOW = 0,
|
|
7
|
+
MEDIUM = 1,
|
|
8
|
+
HIGH = 2
|
|
9
|
+
}
|
|
10
|
+
export default class OffchainLendingVault extends OffchainVault {
|
|
11
|
+
constructor(offchain: Offchain, vaultAddress: Address);
|
|
12
|
+
getRiskLevel(): Promise<RiskLevel>;
|
|
13
|
+
getAvailableLiquidity(): Promise<number>;
|
|
14
|
+
getAvailableLiquidityUSD(): Promise<number>;
|
|
15
|
+
getBorrowables(): Promise<Array<OffchainBorrowable>>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.RiskLevel = void 0;
|
|
36
|
+
const offchainVault_1 = __importStar(require("./offchainVault"));
|
|
37
|
+
var RiskLevel;
|
|
38
|
+
(function (RiskLevel) {
|
|
39
|
+
RiskLevel[RiskLevel["LOW"] = 0] = "LOW";
|
|
40
|
+
RiskLevel[RiskLevel["MEDIUM"] = 1] = "MEDIUM";
|
|
41
|
+
RiskLevel[RiskLevel["HIGH"] = 2] = "HIGH";
|
|
42
|
+
})(RiskLevel = exports.RiskLevel || (exports.RiskLevel = {}));
|
|
43
|
+
class OffchainLendingVault extends offchainVault_1.default {
|
|
44
|
+
constructor(offchain, vaultAddress) {
|
|
45
|
+
super(offchain, vaultAddress);
|
|
46
|
+
this.vaultType = offchainVault_1.VaultType.LENDING;
|
|
47
|
+
}
|
|
48
|
+
getRiskLevel() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
return RiskLevel.MEDIUM;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Available Liquidity
|
|
54
|
+
getAvailableLiquidity() {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
return Math.min(yield this.getPoolTokenParamFloat("availableLiquidity"), yield this.getVaultSupply());
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
getAvailableLiquidityUSD() {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const availableLiquidity = yield this.getAvailableLiquidity();
|
|
62
|
+
const tokenPrice = yield this.getTokenPriceFast();
|
|
63
|
+
return availableLiquidity * tokenPrice;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Borrowables
|
|
67
|
+
getBorrowables() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
return [];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.default = OffchainLendingVault;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Offchain from "../index";
|
|
2
|
+
import { Address } from '../../config/types';
|
|
3
|
+
import OffchainVault from "./offchainVault";
|
|
4
|
+
import OffchainLendingPool from "../lendingPool";
|
|
5
|
+
export default class OffchainLeveragedVault extends OffchainVault {
|
|
6
|
+
constructor(offchain: Offchain, vaultAddress: Address);
|
|
7
|
+
getLeverage(): Promise<number>;
|
|
8
|
+
getPair(): Promise<OffchainLendingPool>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const types_1 = require("../../config/types");
|
|
39
|
+
const offchainVault_1 = __importStar(require("./offchainVault"));
|
|
40
|
+
const lendingPool_1 = __importDefault(require("../lendingPool"));
|
|
41
|
+
class OffchainLeveragedVault extends offchainVault_1.default {
|
|
42
|
+
constructor(offchain, vaultAddress) {
|
|
43
|
+
super(offchain, vaultAddress);
|
|
44
|
+
this.vaultType = offchainVault_1.VaultType.LEVERAGED;
|
|
45
|
+
}
|
|
46
|
+
getLeverage() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return 1;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
getPair() {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
return new lendingPool_1.default(this.getOffchain(), types_1.Factory.V2V2, "0x");
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = OffchainLeveragedVault;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Offchain from "../index";
|
|
2
|
+
import { Address } from '../../config/types';
|
|
3
|
+
import OffchainPoolToken from '../offchainPoolToken';
|
|
4
|
+
import { PoolTokenData } from '../offchainTypes';
|
|
5
|
+
export declare enum VaultType {
|
|
6
|
+
LENDING = 0,
|
|
7
|
+
HEDGED = 1,
|
|
8
|
+
LEVERAGED = 2
|
|
9
|
+
}
|
|
10
|
+
export default class OffchainVault extends OffchainPoolToken {
|
|
11
|
+
private readonly offchain;
|
|
12
|
+
private readonly vaultAddress;
|
|
13
|
+
protected vaultType: VaultType;
|
|
14
|
+
constructor(offchain: Offchain, vaultAddress: Address);
|
|
15
|
+
getOffchain: () => Offchain;
|
|
16
|
+
getVaultAddress: () => string;
|
|
17
|
+
getVaultType: () => VaultType;
|
|
18
|
+
getPoolTokenData(): Promise<PoolTokenData>;
|
|
19
|
+
private getTotalSupply;
|
|
20
|
+
private getLastUpdate;
|
|
21
|
+
private getAccrueFactor;
|
|
22
|
+
getCurrentExchangeRate(): Promise<number>;
|
|
23
|
+
getVaultSupply(): Promise<number>;
|
|
24
|
+
getVaultSupplyUSD(): Promise<number>;
|
|
25
|
+
getReserveFactor(): Promise<number>;
|
|
26
|
+
getSupplyRate(): Promise<number>;
|
|
27
|
+
getSupplyAPR(): Promise<number>;
|
|
28
|
+
getTokenPriceFast(fallback?: boolean): Promise<number>;
|
|
29
|
+
getTokenPriceAccurate(): Promise<number>;
|
|
30
|
+
isDeprecated(): Promise<boolean>;
|
|
31
|
+
isBlacklisted(): Promise<boolean>;
|
|
32
|
+
isStable(): Promise<boolean>;
|
|
33
|
+
isHighTVL(): Promise<boolean>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.VaultType = void 0;
|
|
16
|
+
const offchainPoolToken_1 = __importDefault(require("../offchainPoolToken"));
|
|
17
|
+
const utils_1 = require("../../utils");
|
|
18
|
+
var VaultType;
|
|
19
|
+
(function (VaultType) {
|
|
20
|
+
VaultType[VaultType["LENDING"] = 0] = "LENDING";
|
|
21
|
+
VaultType[VaultType["HEDGED"] = 1] = "HEDGED";
|
|
22
|
+
VaultType[VaultType["LEVERAGED"] = 2] = "LEVERAGED";
|
|
23
|
+
})(VaultType = exports.VaultType || (exports.VaultType = {}));
|
|
24
|
+
class OffchainVault extends offchainPoolToken_1.default {
|
|
25
|
+
constructor(offchain, vaultAddress) {
|
|
26
|
+
super();
|
|
27
|
+
this.getOffchain = () => this.offchain;
|
|
28
|
+
this.getVaultAddress = () => this.vaultAddress;
|
|
29
|
+
this.getVaultType = () => this.vaultType;
|
|
30
|
+
this.offchain = offchain;
|
|
31
|
+
this.vaultAddress = vaultAddress;
|
|
32
|
+
}
|
|
33
|
+
getPoolTokenData() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return this.offchain.getLendingVaultData(this.vaultAddress);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
getTotalSupply() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return this.getPoolTokenParamFloat("totalSupply");
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
getLastUpdate() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
return this.getPoolTokenParamInt("lastUpdate");
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getAccrueFactor() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const now = Date.now() / 1000;
|
|
51
|
+
const timeElapsed = now - (yield this.getLastUpdate());
|
|
52
|
+
const supplyRate = yield this.getSupplyRate();
|
|
53
|
+
return 1 + timeElapsed * supplyRate;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
getCurrentExchangeRate() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const lastExchangeRate = yield this.getExchangeRate();
|
|
59
|
+
const accrueFactor = yield this.getAccrueFactor();
|
|
60
|
+
return lastExchangeRate * accrueFactor;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Vault Supply
|
|
64
|
+
getVaultSupply() {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const totalSupply = yield this.getTotalSupply();
|
|
67
|
+
const exchageRate = yield this.getCurrentExchangeRate();
|
|
68
|
+
return totalSupply * exchageRate;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
getVaultSupplyUSD() {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const vaultSupply = yield this.getVaultSupply();
|
|
74
|
+
const tokenPrice = yield this.getTokenPriceFast();
|
|
75
|
+
return vaultSupply * tokenPrice;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
// Reserve Factor
|
|
79
|
+
getReserveFactor() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
return this.getPoolTokenParamFloat("reserveFactor");
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
// Supply Rate
|
|
85
|
+
getSupplyRate() {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
return this.getPoolTokenParamFloat("supplyRate");
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
getSupplyAPR() {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
const supplyRate = yield this.getSupplyRate();
|
|
93
|
+
return (0, utils_1.toAPR)(supplyRate);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// Token price getters
|
|
97
|
+
getTokenPriceFast(fallback = true) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
return this.getTokenPriceAccurate();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
getTokenPriceAccurate() {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
let tokenAddress = yield this.getUnderlyingAddress();
|
|
105
|
+
return this.getOffchain().getPriceHelper().getDebankTokenPrice(tokenAddress);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// Flags
|
|
109
|
+
isDeprecated() {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
return false;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
isBlacklisted() {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
return false;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
isStable() {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
return false;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
isHighTVL() {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
return false;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.default = OffchainVault;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import OnchainAccountLendingPool, * as lendingPool from './lendingPool';
|
|
2
|
-
import OnchainAccountLendingVault from './onchainAccountLendingVault';
|
|
3
|
-
import OnchainAccountPoolToken from './onchainAccountPoolToken';
|
|
4
|
-
import OnchainAccount from './onchainAccount';
|
|
5
|
-
export { lendingPool, OnchainAccountLendingPool, OnchainAccountPoolToken, OnchainAccountLendingVault, };
|
|
6
|
-
export default OnchainAccount;
|
|
1
|
+
import OnchainAccountLendingPool, * as lendingPool from './lendingPool';
|
|
2
|
+
import OnchainAccountLendingVault from './onchainAccountLendingVault';
|
|
3
|
+
import OnchainAccountPoolToken from './onchainAccountPoolToken';
|
|
4
|
+
import OnchainAccount from './onchainAccount';
|
|
5
|
+
export { lendingPool, OnchainAccountLendingPool, OnchainAccountPoolToken, OnchainAccountLendingVault, };
|
|
6
|
+
export default OnchainAccount;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.OnchainAccountLendingVault = exports.OnchainAccountPoolToken = exports.OnchainAccountLendingPool = exports.lendingPool = void 0;
|
|
30
|
-
const lendingPool_1 = __importStar(require("./lendingPool")), lendingPool = lendingPool_1;
|
|
31
|
-
exports.OnchainAccountLendingPool = lendingPool_1.default;
|
|
32
|
-
exports.lendingPool = lendingPool;
|
|
33
|
-
const onchainAccountLendingVault_1 = __importDefault(require("./onchainAccountLendingVault"));
|
|
34
|
-
exports.OnchainAccountLendingVault = onchainAccountLendingVault_1.default;
|
|
35
|
-
const onchainAccountPoolToken_1 = __importDefault(require("./onchainAccountPoolToken"));
|
|
36
|
-
exports.OnchainAccountPoolToken = onchainAccountPoolToken_1.default;
|
|
37
|
-
const onchainAccount_1 = __importDefault(require("./onchainAccount"));
|
|
38
|
-
exports.default = onchainAccount_1.default;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.OnchainAccountLendingVault = exports.OnchainAccountPoolToken = exports.OnchainAccountLendingPool = exports.lendingPool = void 0;
|
|
30
|
+
const lendingPool_1 = __importStar(require("./lendingPool")), lendingPool = lendingPool_1;
|
|
31
|
+
exports.OnchainAccountLendingPool = lendingPool_1.default;
|
|
32
|
+
exports.lendingPool = lendingPool;
|
|
33
|
+
const onchainAccountLendingVault_1 = __importDefault(require("./onchainAccountLendingVault"));
|
|
34
|
+
exports.OnchainAccountLendingVault = onchainAccountLendingVault_1.default;
|
|
35
|
+
const onchainAccountPoolToken_1 = __importDefault(require("./onchainAccountPoolToken"));
|
|
36
|
+
exports.OnchainAccountPoolToken = onchainAccountPoolToken_1.default;
|
|
37
|
+
const onchainAccount_1 = __importDefault(require("./onchainAccount"));
|
|
38
|
+
exports.default = onchainAccount_1.default;
|