diff --git a/jest.config.js b/jest.config.js index 90fff5617..ce6e89abf 100644 --- a/jest.config.js +++ b/jest.config.js @@ -12,6 +12,7 @@ module.exports = { }, }, coveragePathIgnorePatterns: [ + 'packages/contract-types/*', 'packages/contract-helpers/src/permissions-manager/typechain', 'packages/contract-helpers/src/ui-incentive-data-provider/typechain', 'packages/contract-helpers/src/wallet-balance-provider/typechain', diff --git a/packages/contract-helpers/src/ui-incentive-data-provider/_mocks.ts b/packages/contract-helpers/src/ui-incentive-data-provider/_mocks.ts deleted file mode 100644 index 49d8c8335..000000000 --- a/packages/contract-helpers/src/ui-incentive-data-provider/_mocks.ts +++ /dev/null @@ -1,575 +0,0 @@ -import { BigNumber } from 'ethers'; -import { - ReserveIncentiveDataResponse, - UserReserveIncentiveDataResponse, -} from './types/UiIncentiveDataProviderTypes'; - -export const getReservesIncentivesDataMock: ReserveIncentiveDataResponse[] = [ - { - underlyingAsset: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - 0: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - 1: { - emissionPerSecond: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - tokenIncentivesIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - emissionEndTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - precision: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - 2: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 3: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 4: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 5: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 6: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 7: 18, - 8: 18, - }, - aIncentiveData: { - emissionPerSecond: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - tokenIncentivesIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - emissionEndTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - precision: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - 2: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 3: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 4: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 5: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 6: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 7: 18, - 8: 18, - }, - 2: { - emissionPerSecond: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - tokenIncentivesIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x2ff3b9d55851dfb7971709', - }), - emissionEndTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - precision: 18, - 0: BigNumber.from({ type: 'BigNumber', hex: '0x06ae90db3da1ed' }), - 1: BigNumber.from({ type: 'BigNumber', hex: '0x615847b6' }), - 2: BigNumber.from({ type: 'BigNumber', hex: '0x2ff3b9d55851dfb7971709' }), - 3: BigNumber.from({ type: 'BigNumber', hex: '0x619b6334' }), - 4: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - 5: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - 6: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 7: 18, - 8: 18, - }, - vIncentiveData: { - emissionPerSecond: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - tokenIncentivesIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x2ff3b9d55851dfb7971709', - }), - emissionEndTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - precision: 18, - 0: BigNumber.from({ type: 'BigNumber', hex: '0x06ae90db3da1ed' }), - 1: BigNumber.from({ type: 'BigNumber', hex: '0x615847b6' }), - 2: BigNumber.from({ type: 'BigNumber', hex: '0x2ff3b9d55851dfb7971709' }), - 3: BigNumber.from({ type: 'BigNumber', hex: '0x619b6334' }), - 4: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - 5: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - 6: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 7: 18, - 8: 18, - }, - 3: { - emissionPerSecond: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x00', - }), - tokenIncentivesIndex: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - emissionEndTimestamp: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - tokenAddress: '0x0000000000000000000000000000000000000000', - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - precision: 0, - 0: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 1: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 2: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 3: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 4: '0x0000000000000000000000000000000000000000', - 5: '0x0000000000000000000000000000000000000000', - 6: '0x0000000000000000000000000000000000000000', - 7: 0, - 8: 0, - }, - sIncentiveData: { - emissionPerSecond: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x00', - }), - tokenIncentivesIndex: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - emissionEndTimestamp: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - tokenAddress: '0x0000000000000000000000000000000000000000', - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - precision: 0, - 0: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 1: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 2: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 3: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 4: '0x0000000000000000000000000000000000000000', - 5: '0x0000000000000000000000000000000000000000', - 6: '0x0000000000000000000000000000000000000000', - 7: 0, - 8: 0, - }, - }, - { - underlyingAsset: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - 0: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - 1: { - emissionPerSecond: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - tokenIncentivesIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - emissionEndTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - precision: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - 2: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 3: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 4: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 5: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 6: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 7: 18, - 8: 18, - }, - aIncentiveData: { - emissionPerSecond: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - tokenIncentivesIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - emissionEndTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - precision: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - 2: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 3: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 4: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 5: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 6: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 7: 18, - 8: 18, - }, - 2: { - emissionPerSecond: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - tokenIncentivesIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x2ff3b9d55851dfb7971709', - }), - emissionEndTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - precision: 18, - 0: BigNumber.from({ type: 'BigNumber', hex: '0x06ae90db3da1ed' }), - 1: BigNumber.from({ type: 'BigNumber', hex: '0x615847b6' }), - 2: BigNumber.from({ type: 'BigNumber', hex: '0x2ff3b9d55851dfb7971709' }), - 3: BigNumber.from({ type: 'BigNumber', hex: '0x619b6334' }), - 4: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - 5: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - 6: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 7: 18, - 8: 18, - }, - vIncentiveData: { - emissionPerSecond: BigNumber.from({ - type: 'BigNumber', - hex: '0x06ae90db3da1ed', - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x615847b6', - }), - tokenIncentivesIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x2ff3b9d55851dfb7971709', - }), - emissionEndTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - precision: 18, - 0: BigNumber.from({ type: 'BigNumber', hex: '0x06ae90db3da1ed' }), - 1: BigNumber.from({ type: 'BigNumber', hex: '0x615847b6' }), - 2: BigNumber.from({ type: 'BigNumber', hex: '0x2ff3b9d55851dfb7971709' }), - 3: BigNumber.from({ type: 'BigNumber', hex: '0x619b6334' }), - 4: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - 5: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - 6: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 7: 18, - 8: 18, - }, - 3: { - emissionPerSecond: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x00', - }), - tokenIncentivesIndex: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - emissionEndTimestamp: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - tokenAddress: '0x0000000000000000000000000000000000000000', - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - precision: 0, - 0: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 1: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 2: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 3: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 4: '0x0000000000000000000000000000000000000000', - 5: '0x0000000000000000000000000000000000000000', - 6: '0x0000000000000000000000000000000000000000', - 7: 0, - 8: 0, - }, - sIncentiveData: { - emissionPerSecond: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - incentivesLastUpdateTimestamp: BigNumber.from({ - type: 'BigNumber', - hex: '0x00', - }), - tokenIncentivesIndex: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - emissionEndTimestamp: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - tokenAddress: '0x0000000000000000000000000000000000000000', - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - precision: 0, - 0: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 1: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 2: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 3: BigNumber.from({ type: 'BigNumber', hex: '0x00' }), - 4: '0x0000000000000000000000000000000000000000', - 5: '0x0000000000000000000000000000000000000000', - 6: '0x0000000000000000000000000000000000000000', - 7: 0, - 8: 0, - }, - }, -]; - -export const getUserIncentivesDataMock: UserReserveIncentiveDataResponse[] = [ - { - underlyingAsset: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - userUnclaimedRewards: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 2: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 3: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 4: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 5: 18, - }, - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - userUnclaimedRewards: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 2: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 3: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 4: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 5: 18, - }, - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - userUnclaimedRewards: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 2: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 3: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 4: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 5: 18, - }, - 0: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - 1: { - tokenincentivesUserIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - userUnclaimedRewards: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 2: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 3: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 4: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 5: 18, - }, - 2: { - tokenincentivesUserIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - userUnclaimedRewards: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 2: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 3: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 4: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 5: 18, - }, - 3: { - tokenincentivesUserIndex: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - userUnclaimedRewards: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - 0: BigNumber.from({ - type: 'BigNumber', - hex: '0x24094726ecb06549c3afce', - }), - 1: BigNumber.from({ - type: 'BigNumber', - hex: '0x619b6334', - }), - 2: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - 3: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - 4: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - 5: 18, - }, - }, -]; diff --git a/packages/contract-helpers/src/ui-incentive-data-provider/index.ts b/packages/contract-helpers/src/ui-incentive-data-provider/index.ts deleted file mode 100644 index 86222e6e6..000000000 --- a/packages/contract-helpers/src/ui-incentive-data-provider/index.ts +++ /dev/null @@ -1,335 +0,0 @@ -import { providers } from 'ethers'; -import { isAddress } from 'ethers/lib/utils'; -import { - ChainlinkFeedsRegistry, - ChainlinkFeedsRegistryInterface, - PriceFeed, -} from '../cl-feed-registry/index'; -import { Denominations } from '../cl-feed-registry/types/ChainlinkFeedsRegistryTypes'; -import { UiIncentiveDataProvider as UiIncentiveDataProviderContract } from './typechain/UiIncentiveDataProvider'; -import { UiIncentiveDataProviderFactory } from './typechain/UiIncentiveDataProviderFactory'; -import { - FullReservesIncentiveDataResponse, - IncentiveData, - IncentiveDataHumanized, - IncentiveUserData, - IncentiveUserDataHumanized, - ReserveIncentiveDataHumanizedResponse, - ReserveIncentiveDataResponse, - ReserveIncentiveWithFeedsResponse, - UserReserveIncentiveDataHumanizedResponse, - UserReserveIncentiveDataResponse, -} from './types/UiIncentiveDataProviderTypes'; -export * from './types/UiIncentiveDataProviderTypes'; - -export interface UiIncentiveDataProviderInterface { - getFullReservesIncentiveData: ( - user: string, - incentiveDataProviderAddress: string, - lendingPoolAddressProvider: string, - ) => Promise; - getReservesIncentivesData: ( - lendingPoolAddressProvider: string, - ) => Promise; - getUserReservesIncentivesData: ( - user: string, - lendingPoolAddressProvider: string, - ) => Promise; - getReservesIncentivesDataHumanized: ( - lendingPoolAddressProvider: string, - ) => Promise; - getUserReservesIncentivesDataHumanized: ( - user: string, - lendingPoolAddressProvider: string, - ) => Promise; - getIncentivesDataWithPrice: ( - args: GetIncentivesDataWithPriceType, - ) => Promise; -} -export interface UiIncentiveDataProviderContext { - incentiveDataProviderAddress: string; - provider: providers.Provider; - chainId: number; -} - -export interface FeedResultSuccessful { - rewardTokenAddress: string; - answer: string; - updatedAt: number; - decimals: number; -} - -export interface GetIncentivesDataWithPriceType { - lendingPoolAddressProvider: string; - chainlinkFeedsRegistry?: string; - quote?: Denominations; -} - -export class UiIncentiveDataProvider - implements UiIncentiveDataProviderInterface -{ - public readonly _contract: UiIncentiveDataProviderContract; - - private readonly _chainlinkFeedsRegistries: Record< - string, - ChainlinkFeedsRegistryInterface - >; - - private readonly _context: UiIncentiveDataProviderContext; - - private readonly chainId: number; - - /** - * Constructor - * @param context The ui incentive data provider context - */ - public constructor(context: UiIncentiveDataProviderContext) { - if (!isAddress(context.incentiveDataProviderAddress)) { - throw new Error('contract address is not valid'); - } - - this._context = context; - - this._chainlinkFeedsRegistries = {}; - - this._contract = UiIncentiveDataProviderFactory.connect( - context.incentiveDataProviderAddress, - context.provider, - ); - - this.chainId = context.chainId; - } - - /** - * Get the full reserve incentive data for the lending pool and the user - * @param user The user address - */ - public async getFullReservesIncentiveData( - user: string, - lendingPoolAddressProvider: string, - ): Promise { - if (!isAddress(lendingPoolAddressProvider)) { - throw new Error('Lending pool address provider is not valid'); - } - - if (!isAddress(user)) { - throw new Error('User address is not a valid ethereum address'); - } - - return this._contract.getFullReservesIncentiveData( - lendingPoolAddressProvider, - user, - ); - } - - /** - * Get the reserve incentive data for the lending pool - */ - public async getReservesIncentivesData( - lendingPoolAddressProvider: string, - ): Promise { - if (!isAddress(lendingPoolAddressProvider)) { - throw new Error('Lending pool address provider is not valid'); - } - - return this._contract.getReservesIncentivesData(lendingPoolAddressProvider); - } - - public async getReservesIncentivesDataHumanized( - lendingPoolAddressProvider: string, - ): Promise { - const response = await this.getReservesIncentivesData( - lendingPoolAddressProvider, - ); - - return response.map(r => ({ - id: `${this.chainId}-${r.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(), - underlyingAsset: r.underlyingAsset.toLowerCase(), - aIncentiveData: this._formatIncentiveData(r.aIncentiveData), - vIncentiveData: this._formatIncentiveData(r.vIncentiveData), - sIncentiveData: this._formatIncentiveData(r.sIncentiveData), - })); - } - - public async getUserReservesIncentivesDataHumanized( - user: string, - lendingPoolAddressProvider: string, - ): Promise { - const response = await this.getUserReservesIncentivesData( - user, - lendingPoolAddressProvider, - ); - - return response.map(r => ({ - id: `${this.chainId}-${user}-${r.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(), - underlyingAsset: r.underlyingAsset.toLowerCase(), - aTokenIncentivesUserData: this._formatUserIncentiveData( - r.aTokenIncentivesUserData, - ), - vTokenIncentivesUserData: this._formatUserIncentiveData( - r.vTokenIncentivesUserData, - ), - sTokenIncentivesUserData: this._formatUserIncentiveData( - r.sTokenIncentivesUserData, - ), - })); - } - - /** - * Get the reserve incentive data for the user - * @param user The user address - */ - public async getUserReservesIncentivesData( - user: string, - lendingPoolAddressProvider: string, - ): Promise { - if (!isAddress(lendingPoolAddressProvider)) { - throw new Error('Lending pool address provider is not valid'); - } - - if (!isAddress(user)) { - throw new Error('User address is not a valid ethereum address'); - } - - return this._contract.getUserReservesIncentivesData( - lendingPoolAddressProvider, - user, - ); - } - - public async getIncentivesDataWithPrice({ - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - quote = Denominations.eth, - }: GetIncentivesDataWithPriceType): Promise< - ReserveIncentiveWithFeedsResponse[] - > { - const incentives: ReserveIncentiveDataHumanizedResponse[] = - await this.getReservesIncentivesDataHumanized(lendingPoolAddressProvider); - const feeds: FeedResultSuccessful[] = []; - - if (chainlinkFeedsRegistry && isAddress(chainlinkFeedsRegistry)) { - if (!this._chainlinkFeedsRegistries[chainlinkFeedsRegistry]) { - this._chainlinkFeedsRegistries[chainlinkFeedsRegistry] = - new ChainlinkFeedsRegistry({ - provider: this._context.provider, - chainlinkFeedsRegistry, - }); - } - - const allIncentiveRewardTokens: Set = new Set(); - - incentives.forEach(incentive => { - allIncentiveRewardTokens.add( - incentive.aIncentiveData.rewardTokenAddress, - ); - allIncentiveRewardTokens.add( - incentive.vIncentiveData.rewardTokenAddress, - ); - allIncentiveRewardTokens.add( - incentive.sIncentiveData.rewardTokenAddress, - ); - }); - - const incentiveRewardTokens: string[] = Array.from( - allIncentiveRewardTokens, - ); - - // eslint-disable-next-line @typescript-eslint/promise-function-async - const rewardFeedPromises = incentiveRewardTokens.map(rewardToken => - this._getFeed(rewardToken, chainlinkFeedsRegistry, quote), - ); - - const feedResults = await Promise.allSettled(rewardFeedPromises); - - feedResults.forEach(feedResult => { - if (feedResult.status === 'fulfilled') feeds.push(feedResult.value); - }); - } - - return incentives.map( - (incentive: ReserveIncentiveDataHumanizedResponse) => { - const aFeed = feeds.find( - feed => - feed.rewardTokenAddress === - incentive.aIncentiveData.rewardTokenAddress, - ); - const vFeed = feeds.find( - feed => - feed.rewardTokenAddress === - incentive.vIncentiveData.rewardTokenAddress, - ); - const sFeed = feeds.find( - feed => - feed.rewardTokenAddress === - incentive.sIncentiveData.rewardTokenAddress, - ); - - return { - underlyingAsset: incentive.underlyingAsset, - aIncentiveData: { - ...incentive.aIncentiveData, - priceFeed: aFeed ? aFeed.answer : '0', - priceFeedTimestamp: aFeed ? aFeed.updatedAt : 0, - priceFeedDecimals: aFeed ? aFeed.decimals : 0, - }, - vIncentiveData: { - ...incentive.vIncentiveData, - priceFeed: vFeed ? vFeed.answer : '0', - priceFeedTimestamp: vFeed ? vFeed.updatedAt : 0, - priceFeedDecimals: vFeed ? vFeed.decimals : 0, - }, - sIncentiveData: { - ...incentive.sIncentiveData, - priceFeed: sFeed ? sFeed.answer : '0', - priceFeedTimestamp: sFeed ? sFeed.updatedAt : 0, - priceFeedDecimals: sFeed ? sFeed.decimals : 0, - }, - }; - }, - ); - } - - private readonly _getFeed = async ( - rewardToken: string, - chainlinkFeedsRegistry: string, - quote: Denominations, - ): Promise => { - const feed: PriceFeed = await this._chainlinkFeedsRegistries[ - chainlinkFeedsRegistry - ].getPriceFeed(rewardToken, quote); - - return { - ...feed, - rewardTokenAddress: rewardToken, - }; - }; - - private _formatIncentiveData(data: IncentiveData): IncentiveDataHumanized { - return { - tokenAddress: data.tokenAddress, - precision: data.precision, - rewardTokenAddress: data.rewardTokenAddress, - incentiveControllerAddress: data.incentiveControllerAddress, - rewardTokenDecimals: data.rewardTokenDecimals, - emissionPerSecond: data.emissionPerSecond.toString(), - incentivesLastUpdateTimestamp: - data.incentivesLastUpdateTimestamp.toNumber(), - tokenIncentivesIndex: data.tokenIncentivesIndex.toString(), - emissionEndTimestamp: data.emissionEndTimestamp.toNumber(), - }; - } - - private _formatUserIncentiveData( - data: IncentiveUserData, - ): IncentiveUserDataHumanized { - return { - tokenAddress: data.tokenAddress, - rewardTokenAddress: data.rewardTokenAddress, - incentiveControllerAddress: data.incentiveControllerAddress, - rewardTokenDecimals: data.rewardTokenDecimals, - tokenIncentivesUserIndex: data.tokenincentivesUserIndex.toString(), - userUnclaimedRewards: data.userUnclaimedRewards.toString(), - }; - } -} diff --git a/packages/contract-helpers/src/ui-incentive-data-provider/typechain/UiIncentiveDataProvider.d.ts b/packages/contract-helpers/src/ui-incentive-data-provider/typechain/UiIncentiveDataProvider.d.ts deleted file mode 100644 index 8dffe6662..000000000 --- a/packages/contract-helpers/src/ui-incentive-data-provider/typechain/UiIncentiveDataProvider.d.ts +++ /dev/null @@ -1,2812 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from 'ethers'; -import { - Contract, - ContractTransaction, - CallOverrides, -} from '@ethersproject/contracts'; -import { BytesLike } from '@ethersproject/bytes'; -import { Listener, Provider } from '@ethersproject/providers'; -import { FunctionFragment, EventFragment, Result } from '@ethersproject/abi'; - -interface UiIncentiveDataProviderInterface extends ethers.utils.Interface { - functions: { - 'getFullReservesIncentiveData(address,address)': FunctionFragment; - 'getReservesIncentivesData(address)': FunctionFragment; - 'getUserReservesIncentivesData(address,address)': FunctionFragment; - }; - - encodeFunctionData( - functionFragment: 'getFullReservesIncentiveData', - values: [string, string], - ): string; - encodeFunctionData( - functionFragment: 'getReservesIncentivesData', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getUserReservesIncentivesData', - values: [string, string], - ): string; - - decodeFunctionResult( - functionFragment: 'getFullReservesIncentiveData', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getReservesIncentivesData', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getUserReservesIncentivesData', - data: BytesLike, - ): Result; - - events: {}; -} - -export class UiIncentiveDataProvider extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: UiIncentiveDataProviderInterface; - - functions: { - getFullReservesIncentiveData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[]; - 1: { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[]; - }>; - - 'getFullReservesIncentiveData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[]; - 1: { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[]; - }>; - - getReservesIncentivesData( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[]; - }>; - - 'getReservesIncentivesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[]; - }>; - - getUserReservesIncentivesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[]; - }>; - - 'getUserReservesIncentivesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[]; - }>; - }; - - getFullReservesIncentiveData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[]; - 1: { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[]; - }>; - - 'getFullReservesIncentiveData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[]; - 1: { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[]; - }>; - - getReservesIncentivesData( - provider: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[] - >; - - 'getReservesIncentivesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[] - >; - - getUserReservesIncentivesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[] - >; - - 'getUserReservesIncentivesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[] - >; - - callStatic: { - getFullReservesIncentiveData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[]; - 1: { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[]; - }>; - - 'getFullReservesIncentiveData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[]; - 1: { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[]; - }>; - - getReservesIncentivesData( - provider: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[] - >; - - 'getReservesIncentivesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - aIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - vIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - sIncentiveData: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 0: string; - 1: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 2: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - 3: { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; - }; - }[] - >; - - getUserReservesIncentivesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[] - >; - - 'getUserReservesIncentivesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - aTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - vTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - sTokenIncentivesUserData: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 0: string; - 1: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 2: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - 3: { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; - }; - }[] - >; - }; - - filters: {}; - - estimateGas: { - getFullReservesIncentiveData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - 'getFullReservesIncentiveData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - getReservesIncentivesData( - provider: string, - overrides?: CallOverrides, - ): Promise; - - 'getReservesIncentivesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise; - - getUserReservesIncentivesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - 'getUserReservesIncentivesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - }; - - populateTransaction: { - getFullReservesIncentiveData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - 'getFullReservesIncentiveData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - getReservesIncentivesData( - provider: string, - overrides?: CallOverrides, - ): Promise; - - 'getReservesIncentivesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise; - - getUserReservesIncentivesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - 'getUserReservesIncentivesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/ui-incentive-data-provider/typechain/UiIncentiveDataProviderFactory.ts b/packages/contract-helpers/src/ui-incentive-data-provider/typechain/UiIncentiveDataProviderFactory.ts deleted file mode 100644 index 1e686df57..000000000 --- a/packages/contract-helpers/src/ui-incentive-data-provider/typechain/UiIncentiveDataProviderFactory.ts +++ /dev/null @@ -1,674 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer } from '@ethersproject/abstract-signer'; -import { Provider } from '@ethersproject/providers'; -import { Contract, ContractFactory } from '@ethersproject/contracts'; - -import { UiIncentiveDataProvider } from './UiIncentiveDataProvider'; - -export class UiIncentiveDataProviderFactory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - static connect( - address: string, - signerOrProvider: Signer | Provider, - ): UiIncentiveDataProvider { - return (new Contract( - address, - _abi, - signerOrProvider, - ) as unknown) as UiIncentiveDataProvider; - } -} - -const _abi = [ - { - inputs: [], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [ - { - internalType: 'contract ILendingPoolAddressesProvider', - name: 'provider', - type: 'address', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getFullReservesIncentiveData', - outputs: [ - { - components: [ - { - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'emissionPerSecond', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'incentivesLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'emissionEndTimestamp', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'precision', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.IncentiveData', - name: 'aIncentiveData', - type: 'tuple', - }, - { - components: [ - { - internalType: 'uint256', - name: 'emissionPerSecond', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'incentivesLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'emissionEndTimestamp', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'precision', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.IncentiveData', - name: 'vIncentiveData', - type: 'tuple', - }, - { - components: [ - { - internalType: 'uint256', - name: 'emissionPerSecond', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'incentivesLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'emissionEndTimestamp', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'precision', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.IncentiveData', - name: 'sIncentiveData', - type: 'tuple', - }, - ], - internalType: - 'struct IUiIncentiveDataProvider.AggregatedReserveIncentiveData[]', - name: '', - type: 'tuple[]', - }, - { - components: [ - { - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'tokenincentivesUserIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'userUnclaimedRewards', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.UserIncentiveData', - name: 'aTokenIncentivesUserData', - type: 'tuple', - }, - { - components: [ - { - internalType: 'uint256', - name: 'tokenincentivesUserIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'userUnclaimedRewards', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.UserIncentiveData', - name: 'vTokenIncentivesUserData', - type: 'tuple', - }, - { - components: [ - { - internalType: 'uint256', - name: 'tokenincentivesUserIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'userUnclaimedRewards', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.UserIncentiveData', - name: 'sTokenIncentivesUserData', - type: 'tuple', - }, - ], - internalType: - 'struct IUiIncentiveDataProvider.UserReserveIncentiveData[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract ILendingPoolAddressesProvider', - name: 'provider', - type: 'address', - }, - ], - name: 'getReservesIncentivesData', - outputs: [ - { - components: [ - { - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'emissionPerSecond', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'incentivesLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'emissionEndTimestamp', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'precision', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.IncentiveData', - name: 'aIncentiveData', - type: 'tuple', - }, - { - components: [ - { - internalType: 'uint256', - name: 'emissionPerSecond', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'incentivesLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'emissionEndTimestamp', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'precision', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.IncentiveData', - name: 'vIncentiveData', - type: 'tuple', - }, - { - components: [ - { - internalType: 'uint256', - name: 'emissionPerSecond', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'incentivesLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'emissionEndTimestamp', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'precision', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.IncentiveData', - name: 'sIncentiveData', - type: 'tuple', - }, - ], - internalType: - 'struct IUiIncentiveDataProvider.AggregatedReserveIncentiveData[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract ILendingPoolAddressesProvider', - name: 'provider', - type: 'address', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getUserReservesIncentivesData', - outputs: [ - { - components: [ - { - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'tokenincentivesUserIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'userUnclaimedRewards', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.UserIncentiveData', - name: 'aTokenIncentivesUserData', - type: 'tuple', - }, - { - components: [ - { - internalType: 'uint256', - name: 'tokenincentivesUserIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'userUnclaimedRewards', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.UserIncentiveData', - name: 'vTokenIncentivesUserData', - type: 'tuple', - }, - { - components: [ - { - internalType: 'uint256', - name: 'tokenincentivesUserIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'userUnclaimedRewards', - type: 'uint256', - }, - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProvider.UserIncentiveData', - name: 'sTokenIncentivesUserData', - type: 'tuple', - }, - ], - internalType: - 'struct IUiIncentiveDataProvider.UserReserveIncentiveData[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -const _bytecode = - '0x608060405234801561001057600080fd5b50611ef2806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80634763753614610046578063799bdcf514610070578063976fafc514610090575b600080fd5b610059610054366004611aa2565b6100b0565b604051610067929190611e3c565b60405180910390f35b61008361007e366004611aa2565b6100d1565b6040516100679190611e6a565b6100a361009e366004611a86565b6100e6565b6040516100679190611e29565b6060806100bc846100ed565b6100c68585610d0c565b915091509250929050565b60606100dd8383610d0c565b90505b92915050565b60606100e0825b60606000826001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561012a57600080fd5b505afa15801561013e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061016291906119b8565b90506060816001600160a01b031663d1946dbc6040518163ffffffff1660e01b815260040160006040518083038186803b15801561019f57600080fd5b505afa1580156101b3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101db91908101906119db565b90506060815167ffffffffffffffff811180156101f757600080fd5b5060405190808252806020026020018201604052801561023157816020015b61021e6117c8565b8152602001906001900390816102165790505b50905060005b8251811015610d03576102486117c8565b82828151811061025457fe5b6020026020010151905083828151811061026a57fe5b60209081029190910101516001600160a01b0316815261028861180a565b856001600160a01b03166335ea6a758685815181106102a357fe5b60200260200101516040518263ffffffff1660e01b81526004016102c79190611dfb565b6101806040518083038186803b1580156102e057600080fd5b505afa1580156102f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103189190611ada565b905060008160e001516001600160a01b03166375d264136040518163ffffffff1660e01b815260040160206040518083038186803b15801561035957600080fd5b505afa15801561036d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061039191906119b8565b90506001600160a01b03811615610660576000806000836001600160a01b0316631652e7b78660e001516040518263ffffffff1660e01b81526004016103d79190611dfb565b60606040518083038186803b1580156103ef57600080fd5b505afa158015610403573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104279190611bed565b9250925092506000846001600160a01b03166399248ea76040518163ffffffff1660e01b815260040160206040518083038186803b15801561046857600080fd5b505afa15801561047c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a091906119b8565b9050604051806101200160405280848152602001838152602001858152602001866001600160a01b031663919cd40f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104f957600080fd5b505afa15801561050d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105319190611bd5565b81526020018760e001516001600160a01b03168152602001826001600160a01b03168152602001866001600160a01b03168152602001826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a057600080fd5b505afa1580156105b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d89190611c1a565b60ff168152602001866001600160a01b031663aaf5eb686040518163ffffffff1660e01b815260040160206040518083038186803b15801561061957600080fd5b505afa15801561062d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106519190611c1a565b60ff1690526020880152505050505b60008261010001516001600160a01b03166375d264136040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a057600080fd5b505afa1580156106b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d891906119b8565b90506001600160a01b038116156109a9576000806000836001600160a01b0316631652e7b78761010001516040518263ffffffff1660e01b815260040161071f9190611dfb565b60606040518083038186803b15801561073757600080fd5b505afa15801561074b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076f9190611bed565b9250925092506000846001600160a01b03166399248ea76040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b057600080fd5b505afa1580156107c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e891906119b8565b9050604051806101200160405280848152602001838152602001858152602001866001600160a01b031663919cd40f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561084157600080fd5b505afa158015610855573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108799190611bd5565b81526020018861010001516001600160a01b03168152602001826001600160a01b03168152602001866001600160a01b03168152602001826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156108e957600080fd5b505afa1580156108fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109219190611c1a565b60ff168152602001866001600160a01b031663aaf5eb686040518163ffffffff1660e01b815260040160206040518083038186803b15801561096257600080fd5b505afa158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099a9190611c1a565b60ff1690526060890152505050505b60008361012001516001600160a01b03166375d264136040518163ffffffff1660e01b815260040160206040518083038186803b1580156109e957600080fd5b505afa1580156109fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2191906119b8565b90506001600160a01b03811615610cf2576000806000836001600160a01b0316631652e7b78861012001516040518263ffffffff1660e01b8152600401610a689190611dfb565b60606040518083038186803b158015610a8057600080fd5b505afa158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab89190611bed565b9250925092506000846001600160a01b03166399248ea76040518163ffffffff1660e01b815260040160206040518083038186803b158015610af957600080fd5b505afa158015610b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3191906119b8565b9050604051806101200160405280848152602001838152602001858152602001866001600160a01b031663919cd40f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8a57600080fd5b505afa158015610b9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc29190611bd5565b81526020018961012001516001600160a01b03168152602001826001600160a01b03168152602001866001600160a01b03168152602001826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610c3257600080fd5b505afa158015610c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6a9190611c1a565b60ff168152602001866001600160a01b031663aaf5eb686040518163ffffffff1660e01b815260040160206040518083038186803b158015610cab57600080fd5b505afa158015610cbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce39190611c1a565b60ff16905260408a0152505050505b505060019093019250610237915050565b50949350505050565b60606000836001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d4957600080fd5b505afa158015610d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8191906119b8565b90506060816001600160a01b031663d1946dbc6040518163ffffffff1660e01b815260040160006040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dfa91908101906119db565b905060606001600160a01b038516610e13576000610e16565b81515b67ffffffffffffffff81118015610e2c57600080fd5b50604051908082528060200260200182016040528015610e6657816020015b610e53611875565b815260200190600190039081610e4b5790505b50905060005b82518110156117be57610e7d61180a565b846001600160a01b03166335ea6a75858481518110610e9857fe5b60200260200101516040518263ffffffff1660e01b8152600401610ebc9190611dfb565b6101806040518083038186803b158015610ed557600080fd5b505afa158015610ee9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0d9190611ada565b9050838281518110610f1b57fe5b6020026020010151838381518110610f2f57fe5b60209081029190910101516001600160a01b039091169052610f4f6118ae565b60008260e001516001600160a01b03166375d264136040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8e57600080fd5b505afa158015610fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc691906119b8565b90506001600160a01b038116156111f3576000816001600160a01b03166399248ea76040518163ffffffff1660e01b815260040160206040518083038186803b15801561101257600080fd5b505afa158015611026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104a91906119b8565b60e0850151604051630cdcfb9360e21b81529192506001600160a01b03841691633373ee4c9161107f918e9190600401611e0f565b60206040518083038186803b15801561109757600080fd5b505afa1580156110ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cf9190611bd5565b8352604051630cc7d40f60e11b81526001600160a01b0383169063198fa81e906110fd908d90600401611dfb565b60206040518083038186803b15801561111557600080fd5b505afa158015611129573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114d9190611bd5565b60208085019190915260e08501516001600160a01b03908116604080870191909152838216606087018190529185166080870152805163313ce56760e01b81529051919263313ce56792600480840193829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e99190611c1a565b60ff1660a0840152505b8185858151811061120057fe5b6020026020010151602001819052506112176118ae565b60008461012001516001600160a01b03166375d264136040518163ffffffff1660e01b815260040160206040518083038186803b15801561125757600080fd5b505afa15801561126b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128f91906119b8565b90506001600160a01b038116156114bd576000816001600160a01b03166399248ea76040518163ffffffff1660e01b815260040160206040518083038186803b1580156112db57600080fd5b505afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131391906119b8565b9050816001600160a01b0316633373ee4c8d8861012001516040518363ffffffff1660e01b8152600401611348929190611e0f565b60206040518083038186803b15801561136057600080fd5b505afa158015611374573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113989190611bd5565b8352604051630cc7d40f60e11b81526001600160a01b0383169063198fa81e906113c6908f90600401611dfb565b60206040518083038186803b1580156113de57600080fd5b505afa1580156113f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114169190611bd5565b6020808501919091526101208701516001600160a01b03908116604080870191909152838216606087018190529185166080870152805163313ce56760e01b81529051919263313ce56792600480840193829003018186803b15801561147b57600080fd5b505afa15801561148f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b39190611c1a565b60ff1660a0840152505b818787815181106114ca57fe5b6020026020010151604001819052506114e16118ae565b60008661010001516001600160a01b03166375d264136040518163ffffffff1660e01b815260040160206040518083038186803b15801561152157600080fd5b505afa158015611535573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155991906119b8565b90506001600160a01b0381161561178e576000816001600160a01b03166399248ea76040518163ffffffff1660e01b815260040160206040518083038186803b1580156115a557600080fd5b505afa1580156115b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115dd91906119b8565b9050816001600160a01b0316633373ee4c8f8a61010001516040518363ffffffff1660e01b8152600401611612929190611e0f565b60206040518083038186803b15801561162a57600080fd5b505afa15801561163e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116629190611bd5565b836000018181525050816001600160a01b031663198fa81e8f6040518263ffffffff1660e01b81526004016116979190611dfb565b60206040518083038186803b1580156116af57600080fd5b505afa1580156116c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e79190611bd5565b6020808501919091526101008901516001600160a01b03908116604080870191909152838216606087018190529185166080870152805163313ce56760e01b81529051919263313ce56792600480840193829003018186803b15801561174c57600080fd5b505afa158015611760573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117849190611c1a565b60ff1660a0840152505b8189898151811061179b57fe5b602002602001015160600181905250505050505050508080600101915050610e6c565b5095945050505050565b604051806080016040528060006001600160a01b031681526020016117eb6118e3565b81526020016117f86118e3565b81526020016118056118e3565b905290565b60405180610180016040528061181e61192f565b815260006020820181905260408201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101609091015290565b604051806080016040528060006001600160a01b031681526020016118986118ae565b81526020016118a56118ae565b81526020016118055b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915290565b6040518060200160405280600081525090565b80516100e081611ea4565b60006020828403121561195e578081fd5b6119686020611e7d565b9151825250919050565b80516fffffffffffffffffffffffffffffffff811681146100e057600080fd5b805164ffffffffff811681146100e057600080fd5b805160ff811681146100e057600080fd5b6000602082840312156119c9578081fd5b81516119d481611ea4565b9392505050565b600060208083850312156119ed578182fd5b825167ffffffffffffffff80821115611a04578384fd5b818501915085601f830112611a17578384fd5b815181811115611a25578485fd5b8381029150611a35848301611e7d565b8181528481019084860184860187018a1015611a4f578788fd5b8795505b83861015611a7957611a658a82611942565b835260019590950194918601918601611a53565b5098975050505050505050565b600060208284031215611a97578081fd5b81356119d481611ea4565b60008060408385031215611ab4578081fd5b8235611abf81611ea4565b91506020830135611acf81611ea4565b809150509250929050565b6000610180808385031215611aed578182fd5b611af681611e7d565b9050611b02848461194d565b8152611b118460208501611972565b6020820152611b238460408501611972565b6040820152611b358460608501611972565b6060820152611b478460808501611972565b6080820152611b598460a08501611972565b60a0820152611b6b8460c08501611992565b60c0820152611b7d8460e08501611942565b60e0820152610100611b9185828601611942565b90820152610120611ba485858301611942565b90820152610140611bb785858301611942565b90820152610160611bca858583016119a7565b908201529392505050565b600060208284031215611be6578081fd5b5051919050565b600080600060608486031215611c01578081fd5b8351925060208401519150604084015190509250925092565b600060208284031215611c2b578081fd5b6100dd83836119a7565b6000815180845260208085019450808401835b83811015611cab57815180516001600160a01b0316885283810151611c6f858a0182611d2b565b506040810151611c836101408a0182611d2b565b5060600151611c96610260890182611d2b565b50610380969096019590820190600101611c48565b509495945050505050565b6000815180845260208085019450808401835b83811015611cab57815180516001600160a01b0316885283810151611cf0858a0182611da7565b506040810151611d0360e08a0182611da7565b5060600151611d166101a0890182611da7565b50610260969096019590820190600101611cc9565b80518252602081015160208301526040810151604083015260608101516060830152608081015160018060a01b0380821660808501528060a08401511660a08501528060c08401511660c0850152505060e0810151611d8d60e0840182611df4565b5061010080820151611da182850182611df4565b50505050565b8051825260208101516020830152604081015160018060a01b038082166040850152806060840151166060850152806080840151166080850152505060ff60a08201511660a08301525050565b60ff169052565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6000602082526100dd6020830184611c35565b600060408252611e4f6040830185611c35565b8281036020840152611e618185611cb6565b95945050505050565b6000602082526100dd6020830184611cb6565b60405181810167ffffffffffffffff81118282101715611e9c57600080fd5b604052919050565b6001600160a01b0381168114611eb957600080fd5b5056fea2646970667358221220fb68eb81a46dec111565c49d090f6d2044c2c1d9ed091363b04290b593c3699464736f6c634300060c0033'; diff --git a/packages/contract-helpers/src/ui-incentive-data-provider/types/UiIncentiveDataProviderTypes.ts b/packages/contract-helpers/src/ui-incentive-data-provider/types/UiIncentiveDataProviderTypes.ts deleted file mode 100644 index a31f237a5..000000000 --- a/packages/contract-helpers/src/ui-incentive-data-provider/types/UiIncentiveDataProviderTypes.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { BigNumber } from 'ethers'; - -export interface IncentiveData { - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: BigNumber; - 4: string; - 5: string; - 6: string; - 7: number; - 8: number; -} - -export interface IncentiveDataHumanized { - emissionPerSecond: string; - incentivesLastUpdateTimestamp: number; - tokenIncentivesIndex: string; - emissionEndTimestamp: number; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - precision: number; -} - -export interface IncentivesWithFeeds extends IncentiveDataHumanized { - priceFeed: string; - priceFeedTimestamp: number; - priceFeedDecimals: number; -} - -export interface IncentiveUserData { - tokenincentivesUserIndex: BigNumber; - userUnclaimedRewards: BigNumber; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: string; - 3: string; - 4: string; - 5: number; -} - -export interface IncentiveUserDataHumanized { - tokenIncentivesUserIndex: string; - userUnclaimedRewards: string; - tokenAddress: string; - rewardTokenAddress: string; - incentiveControllerAddress: string; - rewardTokenDecimals: number; -} - -export interface ReserveIncentiveDataResponse { - underlyingAsset: string; - aIncentiveData: IncentiveData; - vIncentiveData: IncentiveData; - sIncentiveData: IncentiveData; - 0: string; - 1: IncentiveData; - 2: IncentiveData; - 3: IncentiveData; -} - -export interface ReserveIncentiveDataHumanizedResponse { - id: string; - underlyingAsset: string; - aIncentiveData: IncentiveDataHumanized; - vIncentiveData: IncentiveDataHumanized; - sIncentiveData: IncentiveDataHumanized; -} - -export interface ReserveIncentiveWithFeedsResponse { - underlyingAsset: string; - aIncentiveData: IncentivesWithFeeds; - vIncentiveData: IncentivesWithFeeds; - sIncentiveData: IncentivesWithFeeds; -} - -export interface UserReserveIncentiveDataResponse { - underlyingAsset: string; - aTokenIncentivesUserData: IncentiveUserData; - vTokenIncentivesUserData: IncentiveUserData; - sTokenIncentivesUserData: IncentiveUserData; - 0: string; - 1: IncentiveUserData; - 2: IncentiveUserData; - 3: IncentiveUserData; -} - -export interface UserReserveIncentiveDataHumanizedResponse { - id: string; - underlyingAsset: string; - aTokenIncentivesUserData: IncentiveUserDataHumanized; - vTokenIncentivesUserData: IncentiveUserDataHumanized; - sTokenIncentivesUserData: IncentiveUserDataHumanized; -} - -export interface FullReservesIncentiveDataResponse { - 0: ReserveIncentiveDataResponse[]; - 1: UserReserveIncentiveDataResponse[]; -} diff --git a/packages/contract-helpers/src/ui-incentive-data-provider/ui-incentive-data-provider.test.ts b/packages/contract-helpers/src/ui-incentive-data-provider/ui-incentive-data-provider.test.ts deleted file mode 100644 index 763ac9320..000000000 --- a/packages/contract-helpers/src/ui-incentive-data-provider/ui-incentive-data-provider.test.ts +++ /dev/null @@ -1,1259 +0,0 @@ -import { providers } from 'ethers'; -import { ChainlinkFeedsRegistry } from '../cl-feed-registry/index'; -import { Denominations } from '../cl-feed-registry/types/ChainlinkFeedsRegistryTypes'; -import { - getReservesIncentivesDataMock, - getUserIncentivesDataMock, -} from './_mocks'; -import { ReserveIncentiveWithFeedsResponse } from './types/UiIncentiveDataProviderTypes'; -import { UiIncentiveDataProvider } from './index'; - -jest.mock('../cl-feed-registry/index', () => { - const clInstance = { getPriceFeed: jest.fn() }; - const cl = jest.fn(() => clInstance); - return { ChainlinkFeedsRegistry: cl }; -}); - -describe('UiIncentiveDataProvider', () => { - const mockValidEthereumAddress = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'; - const mockInvalidEthereumAddress = '0x0'; - - const createValidInstance = () => { - const instance = new UiIncentiveDataProvider({ - incentiveDataProviderAddress: mockValidEthereumAddress, - provider: new providers.JsonRpcProvider(), - chainId: 137, - }); - - const mockGetReservesIncentivesData = jest.fn(); - const mockGetUserIncentivesData = jest.fn(); - - mockGetReservesIncentivesData.mockResolvedValue( - getReservesIncentivesDataMock, - ); - - mockGetUserIncentivesData.mockResolvedValue(getUserIncentivesDataMock); - - // @ts-expect-error readonly - instance._contract = { - getFullReservesIncentiveData: jest.fn(), - getReservesIncentivesData: mockGetReservesIncentivesData, - getUserReservesIncentivesData: mockGetUserIncentivesData, - }; - - return instance; - }; - - describe('creating', () => { - it('should throw an error if the contractAddress is not valid', () => { - expect( - () => - new UiIncentiveDataProvider({ - incentiveDataProviderAddress: mockInvalidEthereumAddress, - provider: new providers.JsonRpcProvider(), - chainId: 137, - }), - ).toThrowError('contract address is not valid'); - }); - - // it('should throw an error if the lendingPoolAddress is not valid', () => { - // expect( - // () => - // new UiIncentiveDataProvider({ - // incentiveDataProviderAddress: mockValidEthereumAddress, - // provider: new providers.JsonRpcProvider(), - // }), - // ).toThrowError('Lending pool address is not valid'); - // }); - }); - - describe('getFullReservesIncentiveData', () => { - it('should throw if user is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getFullReservesIncentiveData( - mockInvalidEthereumAddress, - mockValidEthereumAddress, - ), - ).rejects.toThrow('User address is not a valid ethereum address'); - }); - - it('should throw if lending pool address is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getFullReservesIncentiveData( - mockValidEthereumAddress, - mockInvalidEthereumAddress, - ), - ).rejects.toThrow('Lending pool address provider is not valid'); - }); - - it('should not throw if user and lending pool address provider is a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getFullReservesIncentiveData( - mockValidEthereumAddress, - mockValidEthereumAddress, - ), - ).resolves.not.toThrow(); - }); - }); - - describe('getReservesIncentivesData - to get 100% in coverage :( pointless test', () => { - it('should throw if lending pool address is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesIncentivesData(mockInvalidEthereumAddress), - ).rejects.toThrow('Lending pool address provider is not valid'); - }); - it('should not throw', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesIncentivesData(mockValidEthereumAddress), - ).resolves.not.toThrow(); - }); - }); - - describe('getReservesIncentivesDataHumanized', () => { - it('Should throw error if token address is wrong', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesIncentivesDataHumanized(mockInvalidEthereumAddress), - ).rejects.toThrow('Lending pool address provider is not valid'); - }); - }); - - describe('getUserReservesIncentivesDataHumanized', () => { - it('Should throw error if token address is wrong', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesIncentivesDataHumanized( - mockInvalidEthereumAddress, - mockInvalidEthereumAddress, - ), - ).rejects.toThrow('Lending pool address provider is not valid'); - }); - it('should work with finding only', async () => { - const instance = createValidInstance(); - const response = await instance.getUserReservesIncentivesDataHumanized( - mockValidEthereumAddress, - mockValidEthereumAddress, - ); - - expect(response).toEqual([ - { - id: '137-0x1f9840a85d5af5bf1d1762f925bdaddc4201f984-0xdac17f958d2ee523a2206206994597c13d831ec7-0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aTokenIncentivesUserData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - tokenIncentivesUserIndex: '43565143328112327495233486', - userUnclaimedRewards: '1637573428', - }, - vTokenIncentivesUserData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - tokenIncentivesUserIndex: '43565143328112327495233486', - userUnclaimedRewards: '1637573428', - }, - sTokenIncentivesUserData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - tokenIncentivesUserIndex: '43565143328112327495233486', - userUnclaimedRewards: '1637573428', - }, - }, - ]); - }); - }); - - describe('getIncentivesDataWithPrice', () => { - it('Should throw error if token address is wrong', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesIncentivesDataHumanized(mockInvalidEthereumAddress), - ).rejects.toThrow('Lending pool address provider is not valid'); - }); - it('should work with one feed', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry: mockValidEthereumAddress, - provider: new providers.JsonRpcProvider(), - }); - const instance = createValidInstance(); - - jest - .mocked(clInstance) - .getPriceFeed.mockReturnValueOnce(Promise.reject()); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue( - Promise.resolve({ - answer: '2', - updatedAt: 4, - decimals: 1, - }), - ); - - const result: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - chainlinkFeedsRegistry: mockValidEthereumAddress, - quote: Denominations.eth, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - expect(typeof result[0].aIncentiveData.emissionEndTimestamp).toEqual( - typeof 1, - ); - expect(result).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - }, - ]); - }); - it('should work with all feeds', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry: mockValidEthereumAddress, - provider: new providers.JsonRpcProvider(), - }); - const instance = createValidInstance(); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue( - Promise.resolve({ - answer: '2', - updatedAt: 4, - decimals: 1, - }), - ); - - const result: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - chainlinkFeedsRegistry: mockValidEthereumAddress, - quote: Denominations.eth, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - expect(typeof result[0].aIncentiveData.emissionEndTimestamp).toEqual( - typeof 1, - ); - expect(result).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - }, - ]); - }); - it('should work with all feeds and no quote', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry: mockValidEthereumAddress, - provider: new providers.JsonRpcProvider(), - }); - const instance = createValidInstance(); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue( - Promise.resolve({ - answer: '2', - updatedAt: 4, - decimals: 1, - }), - ); - - const result: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - chainlinkFeedsRegistry: mockValidEthereumAddress, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - expect(typeof result[0].aIncentiveData.emissionEndTimestamp).toEqual( - typeof 1, - ); - expect(result).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '2', - priceFeedTimestamp: 4, - priceFeedDecimals: 1, - }, - }, - ]); - }); - it('should work with no feed', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry: mockValidEthereumAddress, - provider: new providers.JsonRpcProvider(), - }); - const instance = createValidInstance(); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue(Promise.reject()); - - const result: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - chainlinkFeedsRegistry: mockValidEthereumAddress, - quote: Denominations.eth, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - expect(typeof result[0].aIncentiveData.emissionEndTimestamp).toEqual( - typeof 1, - ); - expect(result).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - ]); - }); - it('should work with no feed twice', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry: mockValidEthereumAddress, - provider: new providers.JsonRpcProvider(), - }); - const instance = createValidInstance(); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue(Promise.reject()); - - const result: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - chainlinkFeedsRegistry: mockValidEthereumAddress, - quote: Denominations.eth, - }); - const result2: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - chainlinkFeedsRegistry: mockValidEthereumAddress, - quote: Denominations.eth, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - expect(typeof result[0].aIncentiveData.emissionEndTimestamp).toEqual( - typeof 1, - ); - expect(result).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - ]); - expect(result2).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - ]); - }); - it('should work with chainlinkRegistry address incorrect', async () => { - const instance = createValidInstance(); - const result: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - chainlinkFeedsRegistry: mockInvalidEthereumAddress, - quote: Denominations.usd, - }); - - expect(result).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - ]); - }); - it('should work with no chainlinkRegistry address no quote ', async () => { - const instance = createValidInstance(); - const result: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - }); - - expect(result).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - ]); - }); - it('should work with no chainlinkregistry address and quote ', async () => { - const instance = createValidInstance(); - const result: ReserveIncentiveWithFeedsResponse[] = - await instance.getIncentivesDataWithPrice({ - lendingPoolAddressProvider: mockValidEthereumAddress, - quote: Denominations.usd, - }); - - expect(result).toEqual([ - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - { - underlyingAsset: '0xdac17f958d2ee523a2206206994597c13d831ec7', - aIncentiveData: { - tokenAddress: '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '43565143328112327495233486', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - vIncentiveData: { - tokenAddress: '0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec', - precision: 18, - rewardTokenAddress: '0x4da27a545c0c5B758a6BA100e3a049001de870f4', - incentiveControllerAddress: - '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - rewardTokenDecimals: 18, - emissionPerSecond: '1880787037037037', - incentivesLastUpdateTimestamp: 1633175478, - tokenIncentivesIndex: '57970476598005880594044681', - emissionEndTimestamp: 1637573428, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - precision: 0, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 0, - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 0, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 0, - priceFeed: '0', - priceFeedTimestamp: 0, - priceFeedDecimals: 0, - }, - }, - ]); - }); - }); - - describe('getUserReserves', () => { - it('should throw if lending pool address is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesIncentivesData( - mockValidEthereumAddress, - mockInvalidEthereumAddress, - ), - ).rejects.toThrow('Lending pool address provider is not valid'); - }); - it('should throw if user is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesIncentivesData( - mockInvalidEthereumAddress, - mockValidEthereumAddress, - ), - ).rejects.toThrow('User address is not a valid ethereum address'); - }); - - it('should not throw if user is a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesIncentivesData( - mockValidEthereumAddress, - mockValidEthereumAddress, - ), - ).resolves.not.toThrow(); - }); - }); -}); diff --git a/packages/contract-helpers/src/ui-pool-data-provider/_mocks.ts b/packages/contract-helpers/src/ui-pool-data-provider/_mocks.ts deleted file mode 100644 index 26958833a..000000000 --- a/packages/contract-helpers/src/ui-pool-data-provider/_mocks.ts +++ /dev/null @@ -1,452 +0,0 @@ -import { BigNumber } from 'ethers'; -import { ReservesData, UserReserveData } from './types/UiPoolDataProviderTypes'; - -export const reservesMock: ReservesData = { - 0: [ - { - underlyingAsset: '0x3E0437898a5667a4769B1Ca5A34aAB1ae7E81377', - name: '', - symbol: 'AMPL', - decimals: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - baseLTVasCollateral: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - reserveLiquidationThreshold: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - reserveLiquidationBonus: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - reserveFactor: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - usageAsCollateralEnabled: false, - borrowingEnabled: true, - stableBorrowRateEnabled: false, - isActive: true, - isFrozen: false, - liquidityIndex: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - variableBorrowIndex: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - liquidityRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - variableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - lastUpdateTimestamp: 1631772892, - aTokenAddress: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - stableDebtTokenAddress: '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', - variableDebtTokenAddress: '0xb7b7AF565495670713C92B8848fC8A650a968F81', - interestRateStrategyAddress: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', - availableLiquidity: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - totalPrincipalStableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - averageStableRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableDebtLastUpdateTimestamp: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - totalScaledVariableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - priceInMarketReferenceCurrency: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - variableRateSlope1: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - variableRateSlope2: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableRateSlope1: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableRateSlope2: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 0: '0x3E0437898a5667a4769B1Ca5A34aAB1ae7E81377', - 1: '', - 2: 'AMPL', - 3: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 4: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 5: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 6: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 7: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 8: false, - 9: true, - 10: false, - 11: true, - 12: false, - 13: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 14: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 15: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 16: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 17: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 18: 1631772892, - 19: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - 20: '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', - 21: '0xb7b7AF565495670713C92B8848fC8A650a968F81', - 22: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', - 23: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 24: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 25: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 26: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 27: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 28: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 29: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 30: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 31: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 32: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - }, - { - underlyingAsset: '0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11', - name: '', - symbol: 'UNI-V2', - decimals: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - baseLTVasCollateral: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - reserveLiquidationThreshold: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - reserveLiquidationBonus: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - reserveFactor: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - usageAsCollateralEnabled: false, - borrowingEnabled: true, - stableBorrowRateEnabled: false, - isActive: true, - isFrozen: false, - liquidityIndex: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - variableBorrowIndex: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - liquidityRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - variableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - lastUpdateTimestamp: 1631772892, - aTokenAddress: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - stableDebtTokenAddress: '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', - variableDebtTokenAddress: '0xb7b7AF565495670713C92B8848fC8A650a968F81', - interestRateStrategyAddress: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', - availableLiquidity: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - totalPrincipalStableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - averageStableRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableDebtLastUpdateTimestamp: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - totalScaledVariableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - priceInMarketReferenceCurrency: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - variableRateSlope1: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - variableRateSlope2: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableRateSlope1: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableRateSlope2: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 0: '0x3E0437898a5667a4769B1Ca5A34aAB1ae7E81377', - 1: '', - 2: 'AMPL', - 3: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 4: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 5: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 6: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 7: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 8: false, - 9: true, - 10: false, - 11: true, - 12: false, - 13: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 14: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 15: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 16: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 17: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 18: 1631772892, - 19: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - 20: '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', - 21: '0xb7b7AF565495670713C92B8848fC8A650a968F81', - 22: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', - 23: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 24: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 25: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 26: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 27: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 28: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 29: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 30: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 31: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 32: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - }, - ], - 1: { - marketReferenceCurrencyUnit: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - marketReferenceCurrencyPriceInUsd: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - - networkBaseTokenPriceInUsd: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - networkBaseTokenPriceDecimals: 0, - 0: BigNumber.from({ _hex: '0x0', _isBigNumber: true }), - 1: BigNumber.from({ _hex: '0x0', _isBigNumber: true }), - 2: BigNumber.from({ _hex: '0x0', _isBigNumber: true }), - 3: 0, - }, -}; - -export const userReservesMock: UserReserveData[] = [ - { - 0: '0xB597cd8D3217ea6477232F9217fa70837ff667Af', - 1: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 2: false, - 3: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 4: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 5: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - 6: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - underlyingAsset: '0xB597cd8D3217ea6477232F9217fa70837ff667Af', - scaledATokenBalance: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - usageAsCollateralEnabledOnUser: false, - stableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - scaledVariableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - principalStableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableBorrowLastUpdateTimestamp: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - }, -]; diff --git a/packages/contract-helpers/src/ui-pool-data-provider/index.ts b/packages/contract-helpers/src/ui-pool-data-provider/index.ts deleted file mode 100644 index 2fe8ee49f..000000000 --- a/packages/contract-helpers/src/ui-pool-data-provider/index.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { providers } from 'ethers'; -import { isAddress } from 'ethers/lib/utils'; -import { UiPoolDataProvider as UiPoolDataProviderContract } from './typechain/UiPoolDataProvider'; -import { UiPoolDataProviderFactory } from './typechain/UiPoolDataProviderFactory'; -import { - ReservesData, - UserReserveData, - PoolBaseCurrencyHumanized, - ReserveDataHumanized, - ReservesDataHumanized, - UserReserveDataHumanized, -} from './types/UiPoolDataProviderTypes'; - -export * from './types/UiPoolDataProviderTypes'; - -const ammSymbolMap: Record = { - '0xae461ca67b15dc8dc81ce7615e0320da1a9ab8d5': 'UNIDAIUSDC', - '0x004375dff511095cc5a197a54140a24efef3a416': 'UNIWBTCUSDC', - '0xa478c2975ab1ea89e8196811f51a7b7ade33eb11': 'UNIDAIWETH', - '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc': 'UNIUSDCWETH', - '0xdfc14d2af169b0d36c4eff567ada9b2e0cae044f': 'UNIAAVEWETH', - '0xb6909b960dbbe7392d405429eb2b3649752b4838': 'UNIBATWETH', - '0x3da1313ae46132a397d90d95b1424a9a7e3e0fce': 'UNICRVWETH', - '0xa2107fa5b38d9bbd2c461d6edf11b11a50f6b974': 'UNILINKWETH', - '0xc2adda861f89bbb333c90c492cb837741916a225': 'UNIMKRWETH', - '0x8bd1661da98ebdd3bd080f0be4e6d9be8ce9858c': 'UNIRENWETH', - '0x43ae24960e5534731fc831386c07755a2dc33d47': 'UNISNXWETH', - '0xd3d2e2692501a5c9ca623199d38826e513033a17': 'UNIUNIWETH', - '0xbb2b8038a1640196fbe3e38816f3e67cba72d940': 'UNIWBTCWETH', - '0x2fdbadf3c4d5a8666bc06645b8358ab803996e28': 'UNIYFIWETH', - '0x1eff8af5d577060ba4ac8a29a13525bb0ee2a3d5': 'BPTWBTCWETH', - '0x59a19d8c652fa0284f44113d0ff9aba70bd46fb4': 'BPTBALWETH', -}; - -export interface UiPoolDataProviderContext { - uiPoolDataProviderAddress: string; - provider: providers.Provider; - chainId: number; -} - -export interface UiPoolDataProviderInterface { - getReservesList: (lendingPoolAddressProvider: string) => Promise; - getReservesData: ( - lendingPoolAddressProvider: string, - ) => Promise; - getUserReservesData: ( - lendingPoolAddressProvider: string, - user: string, - ) => Promise; - getReservesHumanized: ( - lendingPoolAddressProvider: string, - ) => Promise; - getUserReservesHumanized: ( - lendingPoolAddressProvider: string, - user: string, - ) => Promise; -} - -export class UiPoolDataProvider implements UiPoolDataProviderInterface { - private readonly _contract: UiPoolDataProviderContract; - - private readonly chainId: number; - /** - * Constructor - * @param context The ui pool data provider context - */ - public constructor(context: UiPoolDataProviderContext) { - if (!isAddress(context.uiPoolDataProviderAddress)) { - throw new Error('contract address is not valid'); - } - - this._contract = UiPoolDataProviderFactory.connect( - context.uiPoolDataProviderAddress, - context.provider, - ); - this.chainId = context.chainId; - } - - /** - * Get the underlying asset address for each lending pool reserve - */ - public async getReservesList( - lendingPoolAddressProvider: string, - ): Promise { - if (!isAddress(lendingPoolAddressProvider)) { - throw new Error('Lending pool address is not valid'); - } - - return this._contract.getReservesList(lendingPoolAddressProvider); - } - - /** - * Get data for each lending pool reserve - */ - public async getReservesData( - lendingPoolAddressProvider: string, - ): Promise { - if (!isAddress(lendingPoolAddressProvider)) { - throw new Error('Lending pool address is not valid'); - } - - return this._contract.getReservesData(lendingPoolAddressProvider); - } - - /** - * Get data for each user reserve on the lending pool - */ - public async getUserReservesData( - lendingPoolAddressProvider: string, - user: string, - ): Promise { - if (!isAddress(lendingPoolAddressProvider)) { - throw new Error('Lending pool address is not valid'); - } - - if (!isAddress(user)) { - throw new Error('User address is not a valid ethereum address'); - } - - return this._contract.getUserReservesData(lendingPoolAddressProvider, user); - } - - public async getReservesHumanized( - lendingPoolAddressProvider: string, - ): Promise { - const { 0: reservesRaw, 1: poolBaseCurrencyRaw }: ReservesData = - await this.getReservesData(lendingPoolAddressProvider); - - const reservesData: ReserveDataHumanized[] = reservesRaw.map( - reserveRaw => ({ - id: `${this.chainId}-${reserveRaw.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(), - underlyingAsset: reserveRaw.underlyingAsset.toLowerCase(), - name: reserveRaw.name, - symbol: ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] - ? ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] - : reserveRaw.symbol, - decimals: reserveRaw.decimals.toNumber(), - baseLTVasCollateral: reserveRaw.baseLTVasCollateral.toString(), - reserveLiquidationThreshold: - reserveRaw.reserveLiquidationThreshold.toString(), - reserveLiquidationBonus: reserveRaw.reserveLiquidationBonus.toString(), - reserveFactor: reserveRaw.reserveFactor.toString(), - usageAsCollateralEnabled: reserveRaw.usageAsCollateralEnabled, - borrowingEnabled: reserveRaw.borrowingEnabled, - stableBorrowRateEnabled: reserveRaw.stableBorrowRateEnabled, - isActive: reserveRaw.isActive, - isFrozen: reserveRaw.isFrozen, - liquidityIndex: reserveRaw.liquidityIndex.toString(), - variableBorrowIndex: reserveRaw.variableBorrowIndex.toString(), - liquidityRate: reserveRaw.liquidityRate.toString(), - variableBorrowRate: reserveRaw.variableBorrowRate.toString(), - stableBorrowRate: reserveRaw.stableBorrowRate.toString(), - lastUpdateTimestamp: reserveRaw.lastUpdateTimestamp, - aTokenAddress: reserveRaw.aTokenAddress.toString(), - stableDebtTokenAddress: reserveRaw.stableDebtTokenAddress.toString(), - variableDebtTokenAddress: - reserveRaw.variableDebtTokenAddress.toString(), - interestRateStrategyAddress: - reserveRaw.interestRateStrategyAddress.toString(), - availableLiquidity: reserveRaw.availableLiquidity.toString(), - totalPrincipalStableDebt: - reserveRaw.totalPrincipalStableDebt.toString(), - averageStableRate: reserveRaw.averageStableRate.toString(), - stableDebtLastUpdateTimestamp: - reserveRaw.stableDebtLastUpdateTimestamp.toNumber(), - totalScaledVariableDebt: reserveRaw.totalScaledVariableDebt.toString(), - priceInMarketReferenceCurrency: - reserveRaw.priceInMarketReferenceCurrency.toString(), - variableRateSlope1: reserveRaw.variableRateSlope1.toString(), - variableRateSlope2: reserveRaw.variableRateSlope2.toString(), - stableRateSlope1: reserveRaw.stableRateSlope1.toString(), - stableRateSlope2: reserveRaw.stableRateSlope2.toString(), - }), - ); - - const baseCurrencyData: PoolBaseCurrencyHumanized = { - // this is to get the decimals from the unit so 1e18 = string length of 19 - 1 to get the number of 0 - marketReferenceCurrencyDecimals: - poolBaseCurrencyRaw.marketReferenceCurrencyUnit.toString().length - 1, - marketReferenceCurrencyPriceInUsd: - poolBaseCurrencyRaw.marketReferenceCurrencyPriceInUsd.toString(), - networkBaseTokenPriceInUsd: - poolBaseCurrencyRaw.networkBaseTokenPriceInUsd.toString(), - networkBaseTokenPriceDecimals: - poolBaseCurrencyRaw.networkBaseTokenPriceDecimals, - }; - - return { - reservesData, - baseCurrencyData, - }; - } - - public async getUserReservesHumanized( - lendingPoolAddressProvider: string, - user: string, - ): Promise { - const userReservesRaw: UserReserveData[] = await this.getUserReservesData( - lendingPoolAddressProvider, - user, - ); - - return userReservesRaw.map((userReserveRaw: UserReserveData) => ({ - id: `${this.chainId}-${user}-${userReserveRaw.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(), - underlyingAsset: userReserveRaw.underlyingAsset.toLowerCase(), - scaledATokenBalance: userReserveRaw.scaledATokenBalance.toString(), - usageAsCollateralEnabledOnUser: - userReserveRaw.usageAsCollateralEnabledOnUser, - stableBorrowRate: userReserveRaw.stableBorrowRate.toString(), - scaledVariableDebt: userReserveRaw.scaledVariableDebt.toString(), - principalStableDebt: userReserveRaw.principalStableDebt.toString(), - stableBorrowLastUpdateTimestamp: - userReserveRaw.stableBorrowLastUpdateTimestamp.toNumber(), - })); - } -} diff --git a/packages/contract-helpers/src/ui-pool-data-provider/typechain/UiPoolDataProvider.d.ts b/packages/contract-helpers/src/ui-pool-data-provider/typechain/UiPoolDataProvider.d.ts deleted file mode 100644 index 1ef04892c..000000000 --- a/packages/contract-helpers/src/ui-pool-data-provider/typechain/UiPoolDataProvider.d.ts +++ /dev/null @@ -1,960 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from 'ethers'; -import { - Contract, - ContractTransaction, - CallOverrides, -} from '@ethersproject/contracts'; -import { BytesLike } from '@ethersproject/bytes'; -import { Listener, Provider } from '@ethersproject/providers'; -import { FunctionFragment, EventFragment, Result } from '@ethersproject/abi'; - -interface UiPoolDataProviderInterface extends ethers.utils.Interface { - functions: { - 'ETH_CURRENCY_UNIT()': FunctionFragment; - 'getReservesData(address)': FunctionFragment; - 'getReservesList(address)': FunctionFragment; - 'getUserReservesData(address,address)': FunctionFragment; - 'marketReferenceCurrencyPriceInUsdProxyAggregator()': FunctionFragment; - 'networkBaseTokenPriceInUsdProxyAggregator()': FunctionFragment; - }; - - encodeFunctionData( - functionFragment: 'ETH_CURRENCY_UNIT', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'getReservesData', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getReservesList', - values: [string], - ): string; - encodeFunctionData( - functionFragment: 'getUserReservesData', - values: [string, string], - ): string; - encodeFunctionData( - functionFragment: 'marketReferenceCurrencyPriceInUsdProxyAggregator', - values?: undefined, - ): string; - encodeFunctionData( - functionFragment: 'networkBaseTokenPriceInUsdProxyAggregator', - values?: undefined, - ): string; - - decodeFunctionResult( - functionFragment: 'ETH_CURRENCY_UNIT', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getReservesData', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getReservesList', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'getUserReservesData', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'marketReferenceCurrencyPriceInUsdProxyAggregator', - data: BytesLike, - ): Result; - decodeFunctionResult( - functionFragment: 'networkBaseTokenPriceInUsdProxyAggregator', - data: BytesLike, - ): Result; - - events: {}; -} - -export class UiPoolDataProvider extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: UiPoolDataProviderInterface; - - functions: { - ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise<{ - 0: BigNumber; - }>; - - 'ETH_CURRENCY_UNIT()'(overrides?: CallOverrides): Promise<{ - 0: BigNumber; - }>; - - getReservesData( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - 0: string; - 1: string; - 2: string; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - 7: BigNumber; - 8: boolean; - 9: boolean; - 10: boolean; - 11: boolean; - 12: boolean; - 13: BigNumber; - 14: BigNumber; - 15: BigNumber; - 16: BigNumber; - 17: BigNumber; - 18: number; - 19: string; - 20: string; - 21: string; - 22: string; - 23: BigNumber; - 24: BigNumber; - 25: BigNumber; - 26: BigNumber; - 27: BigNumber; - 28: BigNumber; - 29: BigNumber; - 30: BigNumber; - 31: BigNumber; - 32: BigNumber; - }[]; - 1: { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: number; - }; - }>; - - 'getReservesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - 0: string; - 1: string; - 2: string; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - 7: BigNumber; - 8: boolean; - 9: boolean; - 10: boolean; - 11: boolean; - 12: boolean; - 13: BigNumber; - 14: BigNumber; - 15: BigNumber; - 16: BigNumber; - 17: BigNumber; - 18: number; - 19: string; - 20: string; - 21: string; - 22: string; - 23: BigNumber; - 24: BigNumber; - 25: BigNumber; - 26: BigNumber; - 27: BigNumber; - 28: BigNumber; - 29: BigNumber; - 30: BigNumber; - 31: BigNumber; - 32: BigNumber; - }[]; - 1: { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: number; - }; - }>; - - getReservesList( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: string[]; - }>; - - 'getReservesList(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: string[]; - }>; - - getUserReservesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - 0: string; - 1: BigNumber; - 2: boolean; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - }[]; - }>; - - 'getUserReservesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - 0: string; - 1: BigNumber; - 2: boolean; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - }[]; - }>; - - marketReferenceCurrencyPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise<{ - 0: string; - }>; - - 'marketReferenceCurrencyPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise<{ - 0: string; - }>; - - networkBaseTokenPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise<{ - 0: string; - }>; - - 'networkBaseTokenPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise<{ - 0: string; - }>; - }; - - ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; - - 'ETH_CURRENCY_UNIT()'(overrides?: CallOverrides): Promise; - - getReservesData( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - 0: string; - 1: string; - 2: string; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - 7: BigNumber; - 8: boolean; - 9: boolean; - 10: boolean; - 11: boolean; - 12: boolean; - 13: BigNumber; - 14: BigNumber; - 15: BigNumber; - 16: BigNumber; - 17: BigNumber; - 18: number; - 19: string; - 20: string; - 21: string; - 22: string; - 23: BigNumber; - 24: BigNumber; - 25: BigNumber; - 26: BigNumber; - 27: BigNumber; - 28: BigNumber; - 29: BigNumber; - 30: BigNumber; - 31: BigNumber; - 32: BigNumber; - }[]; - 1: { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: number; - }; - }>; - - 'getReservesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - 0: string; - 1: string; - 2: string; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - 7: BigNumber; - 8: boolean; - 9: boolean; - 10: boolean; - 11: boolean; - 12: boolean; - 13: BigNumber; - 14: BigNumber; - 15: BigNumber; - 16: BigNumber; - 17: BigNumber; - 18: number; - 19: string; - 20: string; - 21: string; - 22: string; - 23: BigNumber; - 24: BigNumber; - 25: BigNumber; - 26: BigNumber; - 27: BigNumber; - 28: BigNumber; - 29: BigNumber; - 30: BigNumber; - 31: BigNumber; - 32: BigNumber; - }[]; - 1: { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: number; - }; - }>; - - getReservesList( - provider: string, - overrides?: CallOverrides, - ): Promise; - - 'getReservesList(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise; - - getUserReservesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - 0: string; - 1: BigNumber; - 2: boolean; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - }[] - >; - - 'getUserReservesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - 0: string; - 1: BigNumber; - 2: boolean; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - }[] - >; - - marketReferenceCurrencyPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise; - - 'marketReferenceCurrencyPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise; - - networkBaseTokenPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise; - - 'networkBaseTokenPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise; - - callStatic: { - ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; - - 'ETH_CURRENCY_UNIT()'(overrides?: CallOverrides): Promise; - - getReservesData( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - 0: string; - 1: string; - 2: string; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - 7: BigNumber; - 8: boolean; - 9: boolean; - 10: boolean; - 11: boolean; - 12: boolean; - 13: BigNumber; - 14: BigNumber; - 15: BigNumber; - 16: BigNumber; - 17: BigNumber; - 18: number; - 19: string; - 20: string; - 21: string; - 22: string; - 23: BigNumber; - 24: BigNumber; - 25: BigNumber; - 26: BigNumber; - 27: BigNumber; - 28: BigNumber; - 29: BigNumber; - 30: BigNumber; - 31: BigNumber; - 32: BigNumber; - }[]; - 1: { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: number; - }; - }>; - - 'getReservesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise<{ - 0: { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - 0: string; - 1: string; - 2: string; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - 7: BigNumber; - 8: boolean; - 9: boolean; - 10: boolean; - 11: boolean; - 12: boolean; - 13: BigNumber; - 14: BigNumber; - 15: BigNumber; - 16: BigNumber; - 17: BigNumber; - 18: number; - 19: string; - 20: string; - 21: string; - 22: string; - 23: BigNumber; - 24: BigNumber; - 25: BigNumber; - 26: BigNumber; - 27: BigNumber; - 28: BigNumber; - 29: BigNumber; - 30: BigNumber; - 31: BigNumber; - 32: BigNumber; - }[]; - 1: { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: number; - }; - }>; - - getReservesList( - provider: string, - overrides?: CallOverrides, - ): Promise; - - 'getReservesList(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise; - - getUserReservesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - 0: string; - 1: BigNumber; - 2: boolean; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - }[] - >; - - 'getUserReservesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise< - { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - 0: string; - 1: BigNumber; - 2: boolean; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - }[] - >; - - marketReferenceCurrencyPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise; - - 'marketReferenceCurrencyPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise; - - networkBaseTokenPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise; - - 'networkBaseTokenPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise; - }; - - filters: {}; - - estimateGas: { - ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; - - 'ETH_CURRENCY_UNIT()'(overrides?: CallOverrides): Promise; - - getReservesData( - provider: string, - overrides?: CallOverrides, - ): Promise; - - 'getReservesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise; - - getReservesList( - provider: string, - overrides?: CallOverrides, - ): Promise; - - 'getReservesList(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise; - - getUserReservesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - 'getUserReservesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - marketReferenceCurrencyPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise; - - 'marketReferenceCurrencyPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise; - - networkBaseTokenPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise; - - 'networkBaseTokenPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise; - }; - - populateTransaction: { - ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; - - 'ETH_CURRENCY_UNIT()'( - overrides?: CallOverrides, - ): Promise; - - getReservesData( - provider: string, - overrides?: CallOverrides, - ): Promise; - - 'getReservesData(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise; - - getReservesList( - provider: string, - overrides?: CallOverrides, - ): Promise; - - 'getReservesList(address)'( - provider: string, - overrides?: CallOverrides, - ): Promise; - - getUserReservesData( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - 'getUserReservesData(address,address)'( - provider: string, - user: string, - overrides?: CallOverrides, - ): Promise; - - marketReferenceCurrencyPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise; - - 'marketReferenceCurrencyPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise; - - networkBaseTokenPriceInUsdProxyAggregator( - overrides?: CallOverrides, - ): Promise; - - 'networkBaseTokenPriceInUsdProxyAggregator()'( - overrides?: CallOverrides, - ): Promise; - }; -} diff --git a/packages/contract-helpers/src/ui-pool-data-provider/typechain/UiPoolDataProviderFactory.ts b/packages/contract-helpers/src/ui-pool-data-provider/typechain/UiPoolDataProviderFactory.ts deleted file mode 100644 index 6aac9f7cf..000000000 --- a/packages/contract-helpers/src/ui-pool-data-provider/typechain/UiPoolDataProviderFactory.ts +++ /dev/null @@ -1,379 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* eslint-disable */ - -import { Signer } from '@ethersproject/abstract-signer'; -import { Provider } from '@ethersproject/providers'; -import { Contract, ContractFactory } from '@ethersproject/contracts'; - -import { UiPoolDataProvider } from './UiPoolDataProvider'; - -export class UiPoolDataProviderFactory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - static connect( - address: string, - signerOrProvider: Signer | Provider, - ): UiPoolDataProvider { - return new Contract( - address, - _abi, - signerOrProvider, - ) as unknown as UiPoolDataProvider; - } -} - -const _abi = [ - { - inputs: [ - { - internalType: 'contract IChainlinkAggregator', - name: '_networkBaseTokenPriceInUsdProxyAggregator', - type: 'address', - }, - { - internalType: 'contract IChainlinkAggregator', - name: '_marketReferenceCurrencyPriceInUsdProxyAggregator', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [], - name: 'ETH_CURRENCY_UNIT', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract ILendingPoolAddressesProvider', - name: 'provider', - type: 'address', - }, - ], - name: 'getReservesData', - outputs: [ - { - components: [ - { - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - internalType: 'string', - name: 'name', - type: 'string', - }, - { - internalType: 'string', - name: 'symbol', - type: 'string', - }, - { - internalType: 'uint256', - name: 'decimals', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'baseLTVasCollateral', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'reserveLiquidationThreshold', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'reserveLiquidationBonus', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'reserveFactor', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'usageAsCollateralEnabled', - type: 'bool', - }, - { - internalType: 'bool', - name: 'borrowingEnabled', - type: 'bool', - }, - { - internalType: 'bool', - name: 'stableBorrowRateEnabled', - type: 'bool', - }, - { - internalType: 'bool', - name: 'isActive', - type: 'bool', - }, - { - internalType: 'bool', - name: 'isFrozen', - type: 'bool', - }, - { - internalType: 'uint128', - name: 'liquidityIndex', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'variableBorrowIndex', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'liquidityRate', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'variableBorrowRate', - type: 'uint128', - }, - { - internalType: 'uint128', - name: 'stableBorrowRate', - type: 'uint128', - }, - { - internalType: 'uint40', - name: 'lastUpdateTimestamp', - type: 'uint40', - }, - { - 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: 'uint256', - name: 'availableLiquidity', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'totalPrincipalStableDebt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'averageStableRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'stableDebtLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'totalScaledVariableDebt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'priceInMarketReferenceCurrency', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'variableRateSlope1', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'variableRateSlope2', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'stableRateSlope1', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'stableRateSlope2', - type: 'uint256', - }, - ], - internalType: 'struct IUiPoolDataProvider.AggregatedReserveData[]', - name: '', - type: 'tuple[]', - }, - { - components: [ - { - internalType: 'uint256', - name: 'marketReferenceCurrencyUnit', - type: 'uint256', - }, - { - internalType: 'int256', - name: 'marketReferenceCurrencyPriceInUsd', - type: 'int256', - }, - { - internalType: 'int256', - name: 'networkBaseTokenPriceInUsd', - type: 'int256', - }, - { - internalType: 'uint8', - name: 'networkBaseTokenPriceDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiPoolDataProvider.BaseCurrencyInfo', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract ILendingPoolAddressesProvider', - name: 'provider', - type: 'address', - }, - ], - name: 'getReservesList', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract ILendingPoolAddressesProvider', - name: 'provider', - type: 'address', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'getUserReservesData', - outputs: [ - { - components: [ - { - internalType: 'address', - name: 'underlyingAsset', - type: 'address', - }, - { - internalType: 'uint256', - name: 'scaledATokenBalance', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'usageAsCollateralEnabledOnUser', - type: 'bool', - }, - { - internalType: 'uint256', - name: 'stableBorrowRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'scaledVariableDebt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'principalStableDebt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'stableBorrowLastUpdateTimestamp', - type: 'uint256', - }, - ], - internalType: 'struct IUiPoolDataProvider.UserReserveData[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'marketReferenceCurrencyPriceInUsdProxyAggregator', - outputs: [ - { - internalType: 'contract IChainlinkAggregator', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'networkBaseTokenPriceInUsdProxyAggregator', - outputs: [ - { - internalType: 'contract IChainlinkAggregator', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -const _bytecode = - '0x60c06040523480156200001157600080fd5b506040516200206238038062002062833981016040819052620000349162000053565b6001600160601b0319606092831b8116608052911b1660a052620000aa565b6000806040838503121562000066578182fd5b8251620000738162000091565b6020840151909250620000868162000091565b809150509250929050565b6001600160a01b0381168114620000a757600080fd5b50565b60805160601c60a05160601c611f7f620000e36000398061086652806110f75250806101115280610f0e5280610fa85250611f7f6000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80630496f53a146100675780633c1740ed1461008557806351974cc01461009a578063586c1442146100ba578063d22cf68a146100da578063ec489c21146100e2575b600080fd5b61006f610103565b60405161007c9190611ebe565b60405180910390f35b61008d61010f565b60405161007c9190611d27565b6100ad6100a8366004611839565b610133565b60405161007c9190611e19565b6100cd6100c836600461181d565b610771565b60405161007c9190611d3b565b61008d610864565b6100f56100f036600461181d565b610888565b60405161007c929190611d88565b670de0b6b3a764000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60606000836001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561017057600080fd5b505afa158015610184573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a89190611756565b90506060816001600160a01b031663d1946dbc6040518163ffffffff1660e01b815260040160006040518083038186803b1580156101e557600080fd5b505afa1580156101f9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102219190810190611772565b905061022b611499565b604051634417a58360e01b81526001600160a01b03841690634417a58390610257908890600401611d27565b60206040518083038186803b15801561026f57600080fd5b505afa158015610283573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a79190611a10565b905060606001600160a01b0386166102c05760006102c3565b82515b67ffffffffffffffff811180156102d957600080fd5b5060405190808252806020026020018201604052801561031357816020015b6103006114ac565b8152602001906001900390816102f85790505b50905060005b83518110156107645761032a6114f4565b856001600160a01b03166335ea6a7586848151811061034557fe5b60200260200101516040518263ffffffff1660e01b81526004016103699190611d27565b6101806040518083038186803b15801561038257600080fd5b505afa158015610396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ba9190611915565b90508482815181106103c857fe5b60200260200101518383815181106103dc57fe5b60209081029190910101516001600160a01b03918216905260e0820151604051630ed1279f60e11b8152911690631da24f3e9061041d908b90600401611d27565b60206040518083038186803b15801561043557600080fd5b505afa158015610449573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046d9190611871565b83838151811061047957fe5b602090810291909101810151015261049184836111a7565b83838151811061049d57fe5b60209081029190910101519015156040909101526104bb8483611208565b1561075b578061012001516001600160a01b0316631da24f3e896040518263ffffffff1660e01b81526004016104f19190611d27565b60206040518083038186803b15801561050957600080fd5b505afa15801561051d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105419190611871565b83838151811061054d57fe5b602002602001015160800181815250508061010001516001600160a01b031663c634dfaa896040518263ffffffff1660e01b815260040161058e9190611d27565b60206040518083038186803b1580156105a657600080fd5b505afa1580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de9190611871565b8383815181106105ea57fe5b602002602001015160a001818152505082828151811061060657fe5b602002602001015160a0015160001461075b578061010001516001600160a01b031663e78c9b3b896040518263ffffffff1660e01b815260040161064a9190611d27565b60206040518083038186803b15801561066257600080fd5b505afa158015610676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069a9190611871565b8383815181106106a657fe5b602002602001015160600181815250508061010001516001600160a01b03166379ce6b8c896040518263ffffffff1660e01b81526004016106e79190611d27565b60206040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107379190611a6b565b64ffffffffff1683838151811061074a57fe5b602002602001015160c00181815250505b50600101610319565b5093505050505b92915050565b60606000826001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ae57600080fd5b505afa1580156107c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e69190611756565b9050806001600160a01b031663d1946dbc6040518163ffffffff1660e01b815260040160006040518083038186803b15801561082157600080fd5b505afa158015610835573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261085d9190810190611772565b9392505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b606061089261155f565b6000836001600160a01b031663fca513a86040518163ffffffff1660e01b815260040160206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109059190611756565b90506000846001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561094257600080fd5b505afa158015610956573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097a9190611756565b90506060816001600160a01b031663d1946dbc6040518163ffffffff1660e01b815260040160006040518083038186803b1580156109b757600080fd5b505afa1580156109cb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109f39190810190611772565b90506060815167ffffffffffffffff81118015610a0f57600080fd5b50604051908082528060200260200182016040528015610a4957816020015b610a3661158a565b815260200190600190039081610a2e5790505b50905060005b8251811015610f0357610a6061158a565b828281518110610a6c57fe5b60200260200101519050838281518110610a8257fe5b60209081029190910101516001600160a01b03168152610aa06114f4565b81516040516335ea6a7560e01b81526001600160a01b038816916335ea6a7591610acd9190600401611d27565b6101806040518083038186803b158015610ae657600080fd5b505afa158015610afa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1e9190611915565b60208101516001600160801b039081166101a085015260408083015182166101c0860152606083015182166101e08601526080830151821661020086015260a083015190911661022085015260c082015164ffffffffff1661024085015260e08201516001600160a01b03908116610260860152610100830151811661028086015261012083015181166102a086015261014083015181166102c08601528451915163b3596f0760e01b815292935089169163b3596f0791610be291600401611d27565b60206040518083038186803b158015610bfa57600080fd5b505afa158015610c0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c329190611871565b61038083015281516102608301516040516370a0823160e01b81526001600160a01b03909216916370a0823191610c6b91600401611d27565b60206040518083038186803b158015610c8357600080fd5b505afa158015610c97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbb9190611871565b826102e00181815250508161028001516001600160a01b031663797743386040518163ffffffff1660e01b815260040160806040518083038186803b158015610d0357600080fd5b505afa158015610d17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3b9190611a2b565b64ffffffffff16610340860152610320850152506103008301526102a08201516040805163b1bf962d60e01b815290516001600160a01b039092169163b1bf962d91600480820192602092909190829003018186803b158015610d9d57600080fd5b505afa158015610db1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd59190611871565b8261036001818152505081600001516001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015610e1c57600080fd5b505afa158015610e30573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e589190810190611889565b6040808401919091528051602080820190925260008152908301528051610e7e90611259565b60e0870152606086015260c085015260a084015260808301528051610ea290611284565b1515610140860152151561012085015215156101808401521515610160830152608082015115156101008301526102c0820151610ede906112c0565b6104008601526103e08501526103c08401526103a09092019190915250600101610a4f565b50610f0c61155f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6557600080fd5b505afa158015610f79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9d9190611871565b8160400181815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610fff57600080fd5b505afa158015611013573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110379190611a87565b60ff16606082015260408051638c89b64f60e01b815290516001600160a01b03871691638c89b64f916004808301926020929190829003018186803b15801561107f57600080fd5b505afa9250505080156110af575060408051601f3d908101601f191682019092526110ac91810190611871565b60015b611191573d8080156110dd576040519150601f19603f3d011682016040523d82523d6000602084013e6110e2565b606091505b50670de0b6b3a76400008260000181815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561114e57600080fd5b505afa158015611162573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111869190611871565b60208301525061119a565b80825260208201525b9095509350505050915091565b60006080821060405180604001604052806002815260200161373760f01b815250906111ef5760405162461bcd60e51b81526004016111e69190611eab565b60405180910390fd5b5050815160016002830281019190911c16151592915050565b60006080821060405180604001604052806002815260200161373760f01b815250906112475760405162461bcd60e51b81526004016111e69190611eab565b50509051600160029092021c16151590565b5161ffff80821692601083901c821692602081901c831692603082901c60ff169260409290921c1690565b51670100000000000000811615159167020000000000000082161515916704000000000000008116151591670800000000000000909116151590565b600080600080846001600160a01b0316637b832f586040518163ffffffff1660e01b815260040160206040518083038186803b1580156112ff57600080fd5b505afa158015611313573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113379190611871565b856001600160a01b03166365614f816040518163ffffffff1660e01b815260040160206040518083038186803b15801561137057600080fd5b505afa158015611384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a89190611871565b866001600160a01b0316630bdf953f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156113e157600080fd5b505afa1580156113f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114199190611871565b876001600160a01b031663ccab01a36040518163ffffffff1660e01b815260040160206040518083038186803b15801561145257600080fd5b505afa158015611466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148a9190611871565b93509350935093509193509193565b6040518060200160405280600081525090565b6040518060e0016040528060006001600160a01b0316815260200160008152602001600015158152602001600081526020016000815260200160008152602001600081525090565b604051806101800160405280611508611499565b815260006020820181905260408201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101609091015290565b6040518060800160405280600081526020016000815260200160008152602001600060ff1681525090565b60405180610420016040528060006001600160a01b031681526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000815260200160001515815260200160001515815260200160001515815260200160001515815260200160001515815260200160006001600160801b0316815260200160006001600160801b0316815260200160006001600160801b0316815260200160006001600160801b0316815260200160006001600160801b03168152602001600064ffffffffff16815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b805161076b81611f1e565b600060208284031215611705578081fd5b61170f6020611ec7565b9151825250919050565b80516001600160801b038116811461076b57600080fd5b805164ffffffffff8116811461076b57600080fd5b805160ff8116811461076b57600080fd5b600060208284031215611767578081fd5b815161085d81611f1e565b60006020808385031215611784578182fd5b825167ffffffffffffffff8082111561179b578384fd5b818501915085601f8301126117ae578384fd5b8151818111156117bc578485fd5b83810291506117cc848301611ec7565b8181528481019084860184860187018a10156117e6578788fd5b8795505b83861015611810576117fc8a826116e9565b8352600195909501949186019186016117ea565b5098975050505050505050565b60006020828403121561182e578081fd5b813561085d81611f1e565b6000806040838503121561184b578081fd5b823561185681611f1e565b9150602083013561186681611f1e565b809150509250929050565b600060208284031215611882578081fd5b5051919050565b60006020828403121561189a578081fd5b815167ffffffffffffffff808211156118b1578283fd5b818401915084601f8301126118c4578283fd5b8151818111156118d2578384fd5b6118e5601f8201601f1916602001611ec7565b91508082528560208285010111156118fb578384fd5b61190c816020840160208601611eee565b50949350505050565b6000610180808385031215611928578182fd5b61193181611ec7565b905061193d84846116f4565b815261194c8460208501611719565b602082015261195e8460408501611719565b60408201526119708460608501611719565b60608201526119828460808501611719565b60808201526119948460a08501611719565b60a08201526119a68460c08501611730565b60c08201526119b88460e085016116e9565b60e08201526101006119cc858286016116e9565b908201526101206119df858583016116e9565b908201526101406119f2858583016116e9565b90820152610160611a0585858301611745565b908201529392505050565b600060208284031215611a21578081fd5b61085d83836116f4565b60008060008060808587031215611a40578182fd5b8451935060208501519250604085015191506060850151611a6081611f36565b939692955090935050565b600060208284031215611a7c578081fd5b815161085d81611f36565b600060208284031215611a98578081fd5b61085d8383611745565b6001600160a01b03169052565b15159052565b60008151808452611acd816020860160208601611eee565b601f01601f19169290920160200192915050565b6000610420611af1848451611aa2565b6020830151816020860152611b0882860182611ab5565b91505060408301518482036040860152611b228282611ab5565b915050606083015160608501526080830151608085015260a083015160a085015260c083015160c085015260e083015160e085015261010080840151611b6a82870182611aaf565b505061012080840151611b7f82870182611aaf565b505061014080840151611b9482870182611aaf565b505061016080840151611ba982870182611aaf565b505061018080840151611bbe82870182611aaf565b50506101a080840151611bd382870182611d08565b50506101c080840151611be882870182611d08565b50506101e080840151611bfd82870182611d08565b505061020080840151611c1282870182611d08565b505061022080840151611c2782870182611d08565b505061024080840151611c3c82870182611d15565b505061026080840151611c5182870182611aa2565b505061028080840151611c6682870182611aa2565b50506102a080840151611c7b82870182611aa2565b50506102c080840151611c9082870182611aa2565b50506102e08381015190850152610300808401519085015261032080840151908501526103408084015190850152610360808401519085015261038080840151908501526103a080840151908501526103c080840151908501526103e080840151908501526104009283015192909301919091525090565b6001600160801b03169052565b64ffffffffff169052565b60ff169052565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b81811015611d7c5783516001600160a01b031683529284019291840191600101611d57565b50909695505050505050565b600060a0820160a0835280855180835260c0850191506020925060c0838202860101838801855b83811015611ddd5760bf19888403018552611dcb838351611ae1565b94860194925090850190600101611daf565b505080945050505083518184015280840151604084015250604083015160608301526060830151611e116080840182611d20565b509392505050565b602080825282518282018190526000919060409081850190868401855b82811015611e9e578151611e4b858251611aa2565b868101518786015285810151611e6387870182611aaf565b50606081810151908601526080808201519086015260a0808201519086015260c0908101519085015260e09093019290850190600101611e36565b5091979650505050505050565b60006020825261085d6020830184611ab5565b90815260200190565b60405181810167ffffffffffffffff81118282101715611ee657600080fd5b604052919050565b60005b83811015611f09578181015183820152602001611ef1565b83811115611f18576000848401525b50505050565b6001600160a01b0381168114611f3357600080fd5b50565b64ffffffffff81168114611f3357600080fdfea2646970667358221220303646524228e2cf8cf8110c5a348d4bc7c05b3fcf1995071f8aad42d5822b2864736f6c634300060c0033'; diff --git a/packages/contract-helpers/src/ui-pool-data-provider/types/UiPoolDataProviderTypes.ts b/packages/contract-helpers/src/ui-pool-data-provider/types/UiPoolDataProviderTypes.ts deleted file mode 100644 index 104353d78..000000000 --- a/packages/contract-helpers/src/ui-pool-data-provider/types/UiPoolDataProviderTypes.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { BigNumber } from 'ethers'; - -export interface ReservesData { - 0: Array<{ - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - 0: string; - 1: string; - 2: string; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; - 7: BigNumber; - 8: boolean; - 9: boolean; - 10: boolean; - 11: boolean; - 12: boolean; - 13: BigNumber; - 14: BigNumber; - 15: BigNumber; - 16: BigNumber; - 17: BigNumber; - 18: number; - 19: string; - 20: string; - 21: string; - 22: string; - 23: BigNumber; - 24: BigNumber; - 25: BigNumber; - 26: BigNumber; - 27: BigNumber; - 28: BigNumber; - 29: BigNumber; - 30: BigNumber; - 31: BigNumber; - 32: BigNumber; - }>; - 1: { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - 0: BigNumber; - 1: BigNumber; - 2: BigNumber; - 3: number; - }; -} - -export interface UserReserveData { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - 0: string; - 1: BigNumber; - 2: boolean; - 3: BigNumber; - 4: BigNumber; - 5: BigNumber; - 6: BigNumber; -} - -export interface PoolBaseCurrencyHumanized { - marketReferenceCurrencyDecimals: number; - marketReferenceCurrencyPriceInUsd: string; - networkBaseTokenPriceInUsd: string; - networkBaseTokenPriceDecimals: number; -} -export interface ReserveDataHumanized { - id: string; - underlyingAsset: string; - name: string; - symbol: string; - decimals: number; - baseLTVasCollateral: string; - reserveLiquidationThreshold: string; - reserveLiquidationBonus: string; - reserveFactor: string; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: string; - variableBorrowIndex: string; - liquidityRate: string; - variableBorrowRate: string; - stableBorrowRate: string; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: string; - totalPrincipalStableDebt: string; - averageStableRate: string; - stableDebtLastUpdateTimestamp: number; - totalScaledVariableDebt: string; - priceInMarketReferenceCurrency: string; - variableRateSlope1: string; - variableRateSlope2: string; - stableRateSlope1: string; - stableRateSlope2: string; -} - -export interface ReservesDataHumanized { - reservesData: ReserveDataHumanized[]; - baseCurrencyData: PoolBaseCurrencyHumanized; -} - -export interface UserReserveDataHumanized { - id: string; - underlyingAsset: string; - scaledATokenBalance: string; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: string; - scaledVariableDebt: string; - principalStableDebt: string; - stableBorrowLastUpdateTimestamp: number; -} diff --git a/packages/contract-helpers/src/ui-pool-data-provider/ui-pool-data-provider.test.ts b/packages/contract-helpers/src/ui-pool-data-provider/ui-pool-data-provider.test.ts deleted file mode 100644 index 604a0362c..000000000 --- a/packages/contract-helpers/src/ui-pool-data-provider/ui-pool-data-provider.test.ts +++ /dev/null @@ -1,257 +0,0 @@ -import { providers } from 'ethers'; -import { reservesMock, userReservesMock } from './_mocks'; -import { UiPoolDataProvider } from './index'; - -describe('UiPoolDataProvider', () => { - const mockValidEthereumAddress = '0x88757f2f99175387ab4c6a4b3067c77a695b0349'; - const mockInvalidEthereumAddress = '0x0'; - - const createValidInstance = () => { - const instance = new UiPoolDataProvider({ - uiPoolDataProviderAddress: mockValidEthereumAddress, - provider: new providers.JsonRpcProvider(), - chainId: 137, - }); - - const mockGetReservesData = jest.fn(); - const mockGetUserReservesData = jest.fn(); - - mockGetReservesData.mockResolvedValue(reservesMock); - mockGetUserReservesData.mockResolvedValue(userReservesMock); - - // @ts-expect-error readonly - instance._contract = { - getReservesList: jest.fn(), - getReservesData: mockGetReservesData, - getUserReservesData: mockGetUserReservesData, - }; - - return instance; - }; - - describe('creating', () => { - it('should throw an error if the contractAddress is not valid', () => { - expect( - () => - new UiPoolDataProvider({ - uiPoolDataProviderAddress: mockInvalidEthereumAddress, - provider: new providers.JsonRpcProvider(), - chainId: 137, - }), - ).toThrowError('contract address is not valid'); - }); - it('should work if all info is correct', () => { - const instance = new UiPoolDataProvider({ - uiPoolDataProviderAddress: mockValidEthereumAddress, - provider: new providers.JsonRpcProvider(), - chainId: 137, - }); - - expect(instance instanceof UiPoolDataProvider).toEqual(true); - }); - }); - - describe('getReservesList - to get 100% in coverage :( pointless test', () => { - it('should not throw', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesList(mockValidEthereumAddress), - ).resolves.not.toThrow(); - }); - it('should throw when lendingPoolAddressProvider is not valid address', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesList(mockInvalidEthereumAddress), - ).rejects.toThrow('Lending pool address is not valid'); - }); - }); - - describe('getReservesData', () => { - it('should throw when lendingPoolAddressProvider is not valid address', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesData(mockInvalidEthereumAddress), - ).rejects.toThrow('Lending pool address is not valid'); - }); - it('should not throw', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesData(mockValidEthereumAddress), - ).resolves.not.toThrow(); - }); - }); - - describe('getUserReservesData', () => { - it('should throw when lendingPoolAddressProvider is not valid address', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesData( - mockInvalidEthereumAddress, - mockValidEthereumAddress, - ), - ).rejects.toThrow('Lending pool address is not valid'); - }); - it('should throw if user is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesData( - mockValidEthereumAddress, - mockInvalidEthereumAddress, - ), - ).rejects.toThrow('User address is not a valid ethereum address'); - }); - - it('should not throw if user is a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesData( - mockValidEthereumAddress, - mockValidEthereumAddress, - ), - ).resolves.not.toThrow(); - }); - }); - - describe('getReservesHumanized', () => { - it('should throw if lendingPoolAddressProvider is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getReservesHumanized(mockInvalidEthereumAddress), - ).rejects.toThrow('Lending pool address is not valid'); - }); - it('should not throw', async () => { - const instance = createValidInstance(); - const result = await instance.getReservesHumanized( - mockValidEthereumAddress, - ); - expect(result).toEqual({ - reservesData: [ - { - id: '137-0x3e0437898a5667a4769b1ca5a34aab1ae7e81377-0x88757f2f99175387ab4c6a4b3067c77a695b0349', - underlyingAsset: '0x3e0437898a5667a4769b1ca5a34aab1ae7e81377', - name: '', - symbol: 'AMPL', - decimals: 0, - baseLTVasCollateral: '0', - reserveLiquidationThreshold: '0', - reserveLiquidationBonus: '0', - reserveFactor: '0', - usageAsCollateralEnabled: false, - borrowingEnabled: true, - stableBorrowRateEnabled: false, - isActive: true, - isFrozen: false, - liquidityIndex: '0', - variableBorrowIndex: '0', - liquidityRate: '0', - variableBorrowRate: '0', - stableBorrowRate: '0', - lastUpdateTimestamp: 1631772892, - aTokenAddress: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - stableDebtTokenAddress: - '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', - variableDebtTokenAddress: - '0xb7b7AF565495670713C92B8848fC8A650a968F81', - interestRateStrategyAddress: - '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', - availableLiquidity: '0', - totalPrincipalStableDebt: '0', - averageStableRate: '0', - stableDebtLastUpdateTimestamp: 0, - totalScaledVariableDebt: '0', - priceInMarketReferenceCurrency: '0', - variableRateSlope1: '0', - variableRateSlope2: '0', - stableRateSlope1: '0', - stableRateSlope2: '0', - }, - { - id: '137-0xa478c2975ab1ea89e8196811f51a7b7ade33eb11-0x88757f2f99175387ab4c6a4b3067c77a695b0349', - underlyingAsset: '0xa478c2975ab1ea89e8196811f51a7b7ade33eb11', - name: '', - symbol: 'UNIDAIWETH', - decimals: 0, - baseLTVasCollateral: '0', - reserveLiquidationThreshold: '0', - reserveLiquidationBonus: '0', - reserveFactor: '0', - usageAsCollateralEnabled: false, - borrowingEnabled: true, - stableBorrowRateEnabled: false, - isActive: true, - isFrozen: false, - liquidityIndex: '0', - variableBorrowIndex: '0', - liquidityRate: '0', - variableBorrowRate: '0', - stableBorrowRate: '0', - lastUpdateTimestamp: 1631772892, - aTokenAddress: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - stableDebtTokenAddress: - '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', - variableDebtTokenAddress: - '0xb7b7AF565495670713C92B8848fC8A650a968F81', - interestRateStrategyAddress: - '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', - availableLiquidity: '0', - totalPrincipalStableDebt: '0', - averageStableRate: '0', - stableDebtLastUpdateTimestamp: 0, - totalScaledVariableDebt: '0', - priceInMarketReferenceCurrency: '0', - variableRateSlope1: '0', - variableRateSlope2: '0', - stableRateSlope1: '0', - stableRateSlope2: '0', - }, - ], - baseCurrencyData: { - marketReferenceCurrencyDecimals: 0, - marketReferenceCurrencyPriceInUsd: '0', - networkBaseTokenPriceInUsd: '0', - networkBaseTokenPriceDecimals: 0, - }, - }); - }); - }); - describe('getUserReservesHumanized', () => { - it('should throw if lendingPoolAddressProvider is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesHumanized( - mockInvalidEthereumAddress, - mockValidEthereumAddress, - ), - ).rejects.toThrow('Lending pool address is not valid'); - }); - it('should throw if user is not a valid ethereum address', async () => { - const instance = createValidInstance(); - await expect( - instance.getUserReservesHumanized( - mockValidEthereumAddress, - mockInvalidEthereumAddress, - ), - ).rejects.toThrow('User address is not a valid ethereum address'); - }); - it('should be ok', async () => { - const instance = createValidInstance(); - const result = await instance.getUserReservesHumanized( - mockValidEthereumAddress, - mockValidEthereumAddress, - ); - - expect(result).toEqual([ - { - id: '137-0x88757f2f99175387ab4c6a4b3067c77a695b0349-0xb597cd8d3217ea6477232f9217fa70837ff667af-0x88757f2f99175387ab4c6a4b3067c77a695b0349', - principalStableDebt: '0', - scaledATokenBalance: '0', - scaledVariableDebt: '0', - stableBorrowLastUpdateTimestamp: 0, - stableBorrowRate: '0', - underlyingAsset: '0xb597cd8d3217ea6477232f9217fa70837ff667af', - usageAsCollateralEnabledOnUser: false, - }, - ]); - }); - }); -}); diff --git a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/_mocks.ts b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/_mocks.ts index 458874a24..a572a8147 100644 --- a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/_mocks.ts +++ b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/_mocks.ts @@ -72,40 +72,6 @@ export const getReservesIncentivesDataMock: ReservesIncentiveData[] = [ }, ], }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, }, ]; @@ -162,10 +128,5 @@ export const getUserIncentivesDataMock: UserReservesIncentivesData[] = [ }, ], }, - sTokenIncentivesUserData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - userRewardsInformation: [], - }, }, ]; diff --git a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/index.ts b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/index.ts index c34d4ea35..3480c892b 100644 --- a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/index.ts +++ b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/index.ts @@ -1,17 +1,10 @@ import { providers } from 'ethers'; -import { isAddress } from 'ethers/lib/utils'; -import { - ChainlinkFeedsRegistry, - ChainlinkFeedsRegistryInterface, - PriceFeed, -} from '../cl-feed-registry/index'; -import { Denominations } from '../cl-feed-registry/types/ChainlinkFeedsRegistryTypes'; import BaseService from '../commons/BaseService'; import { UiIncentiveDataProviderValidator } from '../commons/validators/methodValidators'; import { isEthAddress } from '../commons/validators/paramValidators'; import { ReservesHelperInput, UserReservesHelperInput } from '../index'; -import { IUiIncentiveDataProviderV3 } from './typechain/IUiIncentiveDataProviderV3'; -import { IUiIncentiveDataProviderV3__factory } from './typechain/IUiIncentiveDataProviderV3__factory'; +import { UiIncentiveDataProviderV3 } from './typechain/IUiIncentiveDataProviderV3'; +import { UiIncentiveDataProviderV3__factory } from './typechain/IUiIncentiveDataProviderV3__factory'; import { FullReservesIncentiveDataResponse, IncentiveData, @@ -43,9 +36,6 @@ export interface UiIncentiveDataProviderInterface { getUserReservesIncentivesDataHumanized: ( args: UserReservesHelperInput, ) => Promise; - getIncentivesDataWithPriceLegacy: ( - args: GetIncentivesDataWithPriceType, - ) => Promise; } export interface FeedResultSuccessful { rewardTokenAddress: string; @@ -54,11 +44,6 @@ export interface FeedResultSuccessful { decimals: number; } -export interface GetIncentivesDataWithPriceType { - lendingPoolAddressProvider: string; - chainlinkFeedsRegistry?: string; - quote?: Denominations; -} export interface UiIncentiveDataProviderContext { uiIncentiveDataProviderAddress: string; provider: providers.Provider; @@ -66,18 +51,13 @@ export interface UiIncentiveDataProviderContext { } export class UiIncentiveDataProvider - extends BaseService + extends BaseService implements UiIncentiveDataProviderInterface { readonly uiIncentiveDataProviderAddress: string; readonly chainId: number; - private readonly _chainlinkFeedsRegistries: Record< - string, - ChainlinkFeedsRegistryInterface - >; - /** * Constructor * @param context The ui incentive data provider context @@ -87,9 +67,8 @@ export class UiIncentiveDataProvider uiIncentiveDataProviderAddress, chainId, }: UiIncentiveDataProviderContext) { - super(provider, IUiIncentiveDataProviderV3__factory); + super(provider, UiIncentiveDataProviderV3__factory); this.uiIncentiveDataProviderAddress = uiIncentiveDataProviderAddress; - this._chainlinkFeedsRegistries = {}; this.chainId = chainId; } @@ -163,7 +142,6 @@ export class UiIncentiveDataProvider underlyingAsset: r.underlyingAsset.toLowerCase(), aIncentiveData: this._formatIncentiveData(r.aIncentiveData), vIncentiveData: this._formatIncentiveData(r.vIncentiveData), - sIncentiveData: this._formatIncentiveData(r.sIncentiveData), })); } @@ -188,156 +166,9 @@ export class UiIncentiveDataProvider vTokenIncentivesUserData: this._formatUserIncentiveData( r.vTokenIncentivesUserData, ), - sTokenIncentivesUserData: this._formatUserIncentiveData( - r.sTokenIncentivesUserData, - ), })); } - @UiIncentiveDataProviderValidator - public async getIncentivesDataWithPriceLegacy( - @isEthAddress('lendingPoolAddressProvider') - @isEthAddress('chainlinkFeedsRegistry') - { - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - quote = Denominations.eth, - }: GetIncentivesDataWithPriceType, - ): Promise { - const incentives: ReservesIncentiveDataHumanized[] = - await this.getReservesIncentivesDataHumanized({ - lendingPoolAddressProvider, - }); - const feeds: FeedResultSuccessful[] = []; - - if (chainlinkFeedsRegistry && isAddress(chainlinkFeedsRegistry)) { - if (!this._chainlinkFeedsRegistries[chainlinkFeedsRegistry]) { - this._chainlinkFeedsRegistries[chainlinkFeedsRegistry] = - new ChainlinkFeedsRegistry({ - provider: this.provider, - chainlinkFeedsRegistry, - }); - } - - const allIncentiveRewardTokens: Set = new Set(); - - incentives.forEach(incentive => { - incentive.aIncentiveData.rewardsTokenInformation.map(rewardInfo => - allIncentiveRewardTokens.add(rewardInfo.rewardTokenAddress), - ); - incentive.vIncentiveData.rewardsTokenInformation.map(rewardInfo => - allIncentiveRewardTokens.add(rewardInfo.rewardTokenAddress), - ); - incentive.sIncentiveData.rewardsTokenInformation.map(rewardInfo => - allIncentiveRewardTokens.add(rewardInfo.rewardTokenAddress), - ); - }); - - const incentiveRewardTokens: string[] = Array.from( - allIncentiveRewardTokens, - ); - - // eslint-disable-next-line @typescript-eslint/promise-function-async - const rewardFeedPromises = incentiveRewardTokens.map(rewardToken => - this._getFeed(rewardToken, chainlinkFeedsRegistry, quote), - ); - - const feedResults = await Promise.allSettled(rewardFeedPromises); - - feedResults.forEach(feedResult => { - if (feedResult.status === 'fulfilled') feeds.push(feedResult.value); - }); - } - - return incentives.map((incentive: ReservesIncentiveDataHumanized) => { - return { - id: `${this.chainId}-${incentive.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(), - underlyingAsset: incentive.underlyingAsset, - aIncentiveData: { - ...incentive.aIncentiveData, - rewardsTokenInformation: - incentive.aIncentiveData.rewardsTokenInformation.map( - rewardTokenInfo => { - const feed = feeds.find( - feed => - feed.rewardTokenAddress === - rewardTokenInfo.rewardTokenAddress, - ); - return { - ...rewardTokenInfo, - rewardPriceFeed: feed?.answer - ? feed.answer - : rewardTokenInfo.rewardPriceFeed, - priceFeedDecimals: feed?.decimals - ? feed.decimals - : rewardTokenInfo.priceFeedDecimals, - }; - }, - ), - }, - vIncentiveData: { - ...incentive.vIncentiveData, - rewardsTokenInformation: - incentive.vIncentiveData.rewardsTokenInformation.map( - rewardTokenInfo => { - const feed = feeds.find( - feed => - feed.rewardTokenAddress === - rewardTokenInfo.rewardTokenAddress, - ); - return { - ...rewardTokenInfo, - rewardPriceFeed: feed?.answer - ? feed.answer - : rewardTokenInfo.rewardPriceFeed, - priceFeedDecimals: feed?.decimals - ? feed.decimals - : rewardTokenInfo.priceFeedDecimals, - }; - }, - ), - }, - sIncentiveData: { - ...incentive.sIncentiveData, - rewardsTokenInformation: - incentive.sIncentiveData.rewardsTokenInformation.map( - rewardTokenInfo => { - const feed = feeds.find( - feed => - feed.rewardTokenAddress === - rewardTokenInfo.rewardTokenAddress, - ); - return { - ...rewardTokenInfo, - rewardPriceFeed: feed?.answer - ? feed.answer - : rewardTokenInfo.rewardPriceFeed, - priceFeedDecimals: feed?.decimals - ? feed.decimals - : rewardTokenInfo.priceFeedDecimals, - }; - }, - ), - }, - }; - }); - } - - private readonly _getFeed = async ( - rewardToken: string, - chainlinkFeedsRegistry: string, - quote: Denominations, - ): Promise => { - const feed: PriceFeed = await this._chainlinkFeedsRegistries[ - chainlinkFeedsRegistry - ].getPriceFeed(rewardToken, quote); - - return { - ...feed, - rewardTokenAddress: rewardToken, - }; - }; - private _formatIncentiveData(data: IncentiveData): IncentiveDataHumanized { return { tokenAddress: data.tokenAddress, diff --git a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/typechain/IUiIncentiveDataProviderV3.d.ts b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/typechain/IUiIncentiveDataProviderV3.d.ts index 9238ff082..ce572d7e7 100644 --- a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/typechain/IUiIncentiveDataProviderV3.d.ts +++ b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/typechain/IUiIncentiveDataProviderV3.d.ts @@ -1,29 +1,175 @@ /* Autogenerated file. Do not edit manually. */ /* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, +import type { + BaseContract, BigNumber, BigNumberish, - PopulatedTransaction, - BaseContract, - ContractTransaction, + BytesLike, CallOverrides, + PopulatedTransaction, + Signer, + utils, } from 'ethers'; -import { BytesLike } from '@ethersproject/bytes'; -import { Listener, Provider } from '@ethersproject/providers'; -import { FunctionFragment, EventFragment, Result } from '@ethersproject/abi'; -import type { TypedEventFilter, TypedEvent, TypedListener } from './common'; +import type { FunctionFragment, Result } from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from './common'; + +export declare namespace IUiIncentiveDataProviderV3 { + export type RewardInfoStruct = { + rewardTokenSymbol: string; + rewardTokenAddress: string; + rewardOracleAddress: string; + emissionPerSecond: BigNumberish; + incentivesLastUpdateTimestamp: BigNumberish; + tokenIncentivesIndex: BigNumberish; + emissionEndTimestamp: BigNumberish; + rewardPriceFeed: BigNumberish; + rewardTokenDecimals: BigNumberish; + precision: BigNumberish; + priceFeedDecimals: BigNumberish; + }; + + export type RewardInfoStructOutput = [ + string, + string, + string, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + number, + number, + number, + ] & { + rewardTokenSymbol: string; + rewardTokenAddress: string; + rewardOracleAddress: string; + emissionPerSecond: BigNumber; + incentivesLastUpdateTimestamp: BigNumber; + tokenIncentivesIndex: BigNumber; + emissionEndTimestamp: BigNumber; + rewardPriceFeed: BigNumber; + rewardTokenDecimals: number; + precision: number; + priceFeedDecimals: number; + }; + + export type IncentiveDataStruct = { + tokenAddress: string; + incentiveControllerAddress: string; + rewardsTokenInformation: IUiIncentiveDataProviderV3.RewardInfoStruct[]; + }; + + export type IncentiveDataStructOutput = [ + string, + string, + IUiIncentiveDataProviderV3.RewardInfoStructOutput[], + ] & { + tokenAddress: string; + incentiveControllerAddress: string; + rewardsTokenInformation: IUiIncentiveDataProviderV3.RewardInfoStructOutput[]; + }; + + export type AggregatedReserveIncentiveDataStruct = { + underlyingAsset: string; + aIncentiveData: IUiIncentiveDataProviderV3.IncentiveDataStruct; + vIncentiveData: IUiIncentiveDataProviderV3.IncentiveDataStruct; + }; + + export type AggregatedReserveIncentiveDataStructOutput = [ + string, + IUiIncentiveDataProviderV3.IncentiveDataStructOutput, + IUiIncentiveDataProviderV3.IncentiveDataStructOutput, + ] & { + underlyingAsset: string; + aIncentiveData: IUiIncentiveDataProviderV3.IncentiveDataStructOutput; + vIncentiveData: IUiIncentiveDataProviderV3.IncentiveDataStructOutput; + }; + + export type UserRewardInfoStruct = { + rewardTokenSymbol: string; + rewardOracleAddress: string; + rewardTokenAddress: string; + userUnclaimedRewards: BigNumberish; + tokenIncentivesUserIndex: BigNumberish; + rewardPriceFeed: BigNumberish; + priceFeedDecimals: BigNumberish; + rewardTokenDecimals: BigNumberish; + }; + + export type UserRewardInfoStructOutput = [ + string, + string, + string, + BigNumber, + BigNumber, + BigNumber, + number, + number, + ] & { + rewardTokenSymbol: string; + rewardOracleAddress: string; + rewardTokenAddress: string; + userUnclaimedRewards: BigNumber; + tokenIncentivesUserIndex: BigNumber; + rewardPriceFeed: BigNumber; + priceFeedDecimals: number; + rewardTokenDecimals: number; + }; + + export type UserIncentiveDataStruct = { + tokenAddress: string; + incentiveControllerAddress: string; + userRewardsInformation: IUiIncentiveDataProviderV3.UserRewardInfoStruct[]; + }; + + export type UserIncentiveDataStructOutput = [ + string, + string, + IUiIncentiveDataProviderV3.UserRewardInfoStructOutput[], + ] & { + tokenAddress: string; + incentiveControllerAddress: string; + userRewardsInformation: IUiIncentiveDataProviderV3.UserRewardInfoStructOutput[]; + }; + + export type UserReserveIncentiveDataStruct = { + underlyingAsset: string; + aTokenIncentivesUserData: IUiIncentiveDataProviderV3.UserIncentiveDataStruct; + vTokenIncentivesUserData: IUiIncentiveDataProviderV3.UserIncentiveDataStruct; + }; + + export type UserReserveIncentiveDataStructOutput = [ + string, + IUiIncentiveDataProviderV3.UserIncentiveDataStructOutput, + IUiIncentiveDataProviderV3.UserIncentiveDataStructOutput, + ] & { + underlyingAsset: string; + aTokenIncentivesUserData: IUiIncentiveDataProviderV3.UserIncentiveDataStructOutput; + vTokenIncentivesUserData: IUiIncentiveDataProviderV3.UserIncentiveDataStructOutput; + }; +} -interface IUiIncentiveDataProviderV3Interface extends ethers.utils.Interface { +export interface UiIncentiveDataProviderV3Interface extends utils.Interface { functions: { 'getFullReservesIncentiveData(address,address)': FunctionFragment; 'getReservesIncentivesData(address)': FunctionFragment; 'getUserReservesIncentivesData(address,address)': FunctionFragment; }; + getFunction( + nameOrSignatureOrTopic: + | 'getFullReservesIncentiveData' + | 'getReservesIncentivesData' + | 'getUserReservesIncentivesData', + ): FunctionFragment; + encodeFunctionData( functionFragment: 'getFullReservesIncentiveData', values: [string, string], @@ -53,48 +199,31 @@ interface IUiIncentiveDataProviderV3Interface extends ethers.utils.Interface { events: {}; } -export class IUiIncentiveDataProviderV3 extends BaseContract { +export interface UiIncentiveDataProviderV3 extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - listeners, EventArgsObject>( - eventFilter?: TypedEventFilter, - ): Array>; - off, EventArgsObject>( - eventFilter: TypedEventFilter, - listener: TypedListener, - ): this; - on, EventArgsObject>( - eventFilter: TypedEventFilter, - listener: TypedListener, - ): this; - once, EventArgsObject>( - eventFilter: TypedEventFilter, - listener: TypedListener, - ): this; - removeListener, EventArgsObject>( - eventFilter: TypedEventFilter, - listener: TypedListener, - ): this; - removeAllListeners, EventArgsObject>( - eventFilter: TypedEventFilter, - ): this; - - listeners(eventName?: string): Array; - off(eventName: string, listener: Listener): this; - on(eventName: string, listener: Listener): this; - once(eventName: string, listener: Listener): this; - removeListener(eventName: string, listener: Listener): this; - removeAllListeners(eventName?: string): this; + interface: UiIncentiveDataProviderV3Interface; - queryFilter, EventArgsObject>( - event: TypedEventFilter, + queryFilter( + event: TypedEventFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined, - ): Promise>>; + ): Promise>; - interface: IUiIncentiveDataProviderV3Interface; + listeners( + eventFilter?: TypedEventFilter, + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter, + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; functions: { getFullReservesIncentiveData( @@ -103,628 +232,8 @@ export class IUiIncentiveDataProviderV3 extends BaseContract { overrides?: CallOverrides, ): Promise< [ - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - vIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - sIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - })[], - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - vTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - sTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - })[], + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[], + IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[], ] >; @@ -732,355 +241,7 @@ export class IUiIncentiveDataProviderV3 extends BaseContract { provider: string, overrides?: CallOverrides, ): Promise< - [ - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - vIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - sIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - })[], - ] + [IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[]] >; getUserReservesIncentivesData( @@ -1088,283 +249,7 @@ export class IUiIncentiveDataProviderV3 extends BaseContract { user: string, overrides?: CallOverrides, ): Promise< - [ - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - vTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - sTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - })[], - ] + [IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[]] >; }; @@ -1374,628 +259,8 @@ export class IUiIncentiveDataProviderV3 extends BaseContract { overrides?: CallOverrides, ): Promise< [ - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - vIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - sIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - })[], - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - vTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - sTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - })[], + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[], + IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[], ] >; @@ -2003,636 +268,14 @@ export class IUiIncentiveDataProviderV3 extends BaseContract { provider: string, overrides?: CallOverrides, ): Promise< - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - vIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - sIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - })[] + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[] >; getUserReservesIncentivesData( provider: string, user: string, overrides?: CallOverrides, - ): Promise< - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - vTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - sTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - })[] - >; + ): Promise; callStatic: { getFullReservesIncentiveData( @@ -2641,628 +284,8 @@ export class IUiIncentiveDataProviderV3 extends BaseContract { overrides?: CallOverrides, ): Promise< [ - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - vIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - sIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - })[], - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - vTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - sTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - })[], + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[], + IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[], ] >; @@ -3270,353 +293,7 @@ export class IUiIncentiveDataProviderV3 extends BaseContract { provider: string, overrides?: CallOverrides, ): Promise< - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - vIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - sIncentiveData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: BigNumber; - incentivesLastUpdateTimestamp: BigNumber; - tokenIncentivesIndex: BigNumber; - emissionEndTimestamp: BigNumber; - rewardPriceFeed: BigNumber; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; - })[]; - }; - })[] + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[] >; getUserReservesIncentivesData( @@ -3624,281 +301,7 @@ export class IUiIncentiveDataProviderV3 extends BaseContract { user: string, overrides?: CallOverrides, ): Promise< - ([ - string, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }, - ] & { - underlyingAsset: string; - aTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - vTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - sTokenIncentivesUserData: [ - string, - string, - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[], - ] & { - tokenAddress: string; - incentiveControllerAddress: string; - userRewardsInformation: ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - number, - number, - ] & { - rewardTokenSymbol: string; - rewardOracleAddress: string; - rewardTokenAddress: string; - userUnclaimedRewards: BigNumber; - tokenIncentivesUserIndex: BigNumber; - rewardPriceFeed: BigNumber; - priceFeedDecimals: number; - rewardTokenDecimals: number; - })[]; - }; - })[] + IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[] >; }; diff --git a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/typechain/IUiIncentiveDataProviderV3__factory.ts b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/typechain/IUiIncentiveDataProviderV3__factory.ts index c2c40337f..8b86f52df 100644 --- a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/typechain/IUiIncentiveDataProviderV3__factory.ts +++ b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/typechain/IUiIncentiveDataProviderV3__factory.ts @@ -2,10 +2,10 @@ /* eslint-disable */ import { Contract, Signer, utils } from 'ethers'; -import { Provider } from '@ethersproject/providers'; +import type { Provider } from '@ethersproject/providers'; import type { - IUiIncentiveDataProviderV3, - IUiIncentiveDataProviderV3Interface, + UiIncentiveDataProviderV3, + UiIncentiveDataProviderV3Interface, } from './IUiIncentiveDataProviderV3'; const _abi = [ @@ -189,85 +189,6 @@ const _abi = [ name: 'vIncentiveData', type: 'tuple', }, - { - components: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'string', - name: 'rewardTokenSymbol', - type: 'string', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardOracleAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'emissionPerSecond', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'incentivesLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'emissionEndTimestamp', - type: 'uint256', - }, - { - internalType: 'int256', - name: 'rewardPriceFeed', - type: 'int256', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'precision', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'priceFeedDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProviderV3.RewardInfo[]', - name: 'rewardsTokenInformation', - type: 'tuple[]', - }, - ], - internalType: 'struct IUiIncentiveDataProviderV3.IncentiveData', - name: 'sIncentiveData', - type: 'tuple', - }, ], internalType: 'struct IUiIncentiveDataProviderV3.AggregatedReserveIncentiveData[]', @@ -411,71 +332,6 @@ const _abi = [ name: 'vTokenIncentivesUserData', type: 'tuple', }, - { - components: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'string', - name: 'rewardTokenSymbol', - type: 'string', - }, - { - internalType: 'address', - name: 'rewardOracleAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'userUnclaimedRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesUserIndex', - type: 'uint256', - }, - { - internalType: 'int256', - name: 'rewardPriceFeed', - type: 'int256', - }, - { - internalType: 'uint8', - name: 'priceFeedDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - ], - internalType: - 'struct IUiIncentiveDataProviderV3.UserRewardInfo[]', - name: 'userRewardsInformation', - type: 'tuple[]', - }, - ], - internalType: 'struct IUiIncentiveDataProviderV3.UserIncentiveData', - name: 'sTokenIncentivesUserData', - type: 'tuple', - }, ], internalType: 'struct IUiIncentiveDataProviderV3.UserReserveIncentiveData[]', @@ -661,85 +517,6 @@ const _abi = [ name: 'vIncentiveData', type: 'tuple', }, - { - components: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'string', - name: 'rewardTokenSymbol', - type: 'string', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardOracleAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'emissionPerSecond', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'incentivesLastUpdateTimestamp', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesIndex', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'emissionEndTimestamp', - type: 'uint256', - }, - { - internalType: 'int256', - name: 'rewardPriceFeed', - type: 'int256', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'precision', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'priceFeedDecimals', - type: 'uint8', - }, - ], - internalType: 'struct IUiIncentiveDataProviderV3.RewardInfo[]', - name: 'rewardsTokenInformation', - type: 'tuple[]', - }, - ], - internalType: 'struct IUiIncentiveDataProviderV3.IncentiveData', - name: 'sIncentiveData', - type: 'tuple', - }, ], internalType: 'struct IUiIncentiveDataProviderV3.AggregatedReserveIncentiveData[]', @@ -902,71 +679,6 @@ const _abi = [ name: 'vTokenIncentivesUserData', type: 'tuple', }, - { - components: [ - { - internalType: 'address', - name: 'tokenAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'incentiveControllerAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'string', - name: 'rewardTokenSymbol', - type: 'string', - }, - { - internalType: 'address', - name: 'rewardOracleAddress', - type: 'address', - }, - { - internalType: 'address', - name: 'rewardTokenAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'userUnclaimedRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'tokenIncentivesUserIndex', - type: 'uint256', - }, - { - internalType: 'int256', - name: 'rewardPriceFeed', - type: 'int256', - }, - { - internalType: 'uint8', - name: 'priceFeedDecimals', - type: 'uint8', - }, - { - internalType: 'uint8', - name: 'rewardTokenDecimals', - type: 'uint8', - }, - ], - internalType: - 'struct IUiIncentiveDataProviderV3.UserRewardInfo[]', - name: 'userRewardsInformation', - type: 'tuple[]', - }, - ], - internalType: 'struct IUiIncentiveDataProviderV3.UserIncentiveData', - name: 'sTokenIncentivesUserData', - type: 'tuple', - }, ], internalType: 'struct IUiIncentiveDataProviderV3.UserReserveIncentiveData[]', @@ -977,21 +689,21 @@ const _abi = [ stateMutability: 'view', type: 'function', }, -]; +] as const; -export class IUiIncentiveDataProviderV3__factory { +export class UiIncentiveDataProviderV3__factory { static readonly abi = _abi; - static createInterface(): IUiIncentiveDataProviderV3Interface { - return new utils.Interface(_abi) as IUiIncentiveDataProviderV3Interface; + static createInterface(): UiIncentiveDataProviderV3Interface { + return new utils.Interface(_abi) as UiIncentiveDataProviderV3Interface; } static connect( address: string, signerOrProvider: Signer | Provider, - ): IUiIncentiveDataProviderV3 { + ): UiIncentiveDataProviderV3 { return new Contract( address, _abi, signerOrProvider, - ) as IUiIncentiveDataProviderV3; + ) as UiIncentiveDataProviderV3; } } diff --git a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/types.ts b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/types.ts index 618700a60..6bdd50cce 100644 --- a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/types.ts +++ b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/types.ts @@ -26,7 +26,6 @@ export interface ReservesIncentiveData { underlyingAsset: string; aIncentiveData: IncentiveData; vIncentiveData: IncentiveData; - sIncentiveData: IncentiveData; } export interface UserRewardInfo { @@ -48,7 +47,6 @@ export interface UserReservesIncentivesData { underlyingAsset: string; aTokenIncentivesUserData: UserIncentiveData; vTokenIncentivesUserData: UserIncentiveData; - sTokenIncentivesUserData: UserIncentiveData; } export interface FullReservesIncentiveDataResponse { @@ -83,7 +81,6 @@ export interface ReservesIncentiveDataHumanized { underlyingAsset: string; aIncentiveData: IncentiveDataHumanized; vIncentiveData: IncentiveDataHumanized; - sIncentiveData: IncentiveDataHumanized; } export interface UserRewardInfoHumanized { @@ -108,5 +105,4 @@ export interface UserReservesIncentivesDataHumanized { underlyingAsset: string; aTokenIncentivesUserData: UserIncentiveDataHumanized; vTokenIncentivesUserData: UserIncentiveDataHumanized; - sTokenIncentivesUserData: UserIncentiveDataHumanized; } diff --git a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/uiIncentiveDataProviderV3.test.ts b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/uiIncentiveDataProviderV3.test.ts index d64aa3e86..af1062506 100644 --- a/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/uiIncentiveDataProviderV3.test.ts +++ b/packages/contract-helpers/src/v3-UiIncentiveDataProvider-contract/uiIncentiveDataProviderV3.test.ts @@ -1,12 +1,10 @@ import { BigNumber, providers } from 'ethers'; -import { ChainlinkFeedsRegistry } from '../cl-feed-registry/index'; -import { Denominations } from '../cl-feed-registry/types/ChainlinkFeedsRegistryTypes'; import { getReservesIncentivesDataMock, getUserIncentivesDataMock, } from './_mocks'; -import { IUiIncentiveDataProviderV3 } from './typechain/IUiIncentiveDataProviderV3'; -import { IUiIncentiveDataProviderV3__factory } from './typechain/IUiIncentiveDataProviderV3__factory'; +import { UiIncentiveDataProviderV3 } from './typechain/IUiIncentiveDataProviderV3'; +import { UiIncentiveDataProviderV3__factory } from './typechain/IUiIncentiveDataProviderV3__factory'; import { UiIncentiveDataProvider } from './index'; jest.mock('../cl-feed-registry/index', () => { @@ -81,10 +79,10 @@ describe('UiIncentiveDataProvider', () => { }); it('should not throw if user and lending pool address provider is a valid ethereum address', async () => { const spy = jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') + .spyOn(UiIncentiveDataProviderV3__factory, 'connect') .mockReturnValue({ getFullReservesIncentiveData: async () => Promise.resolve({}), - } as unknown as IUiIncentiveDataProviderV3); + } as unknown as UiIncentiveDataProviderV3); await instance.getFullReservesIncentiveData({ user, lendingPoolAddressProvider, @@ -125,11 +123,11 @@ describe('UiIncentiveDataProvider', () => { }); it('should not throw', async () => { const spy = jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') + .spyOn(UiIncentiveDataProviderV3__factory, 'connect') .mockReturnValue({ getReservesIncentivesData: async () => Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); + } as unknown as UiIncentiveDataProviderV3); await instance.getReservesIncentivesData({ lendingPoolAddressProvider }); expect(spy).toHaveBeenCalled(); }); @@ -181,11 +179,11 @@ describe('UiIncentiveDataProvider', () => { }); it('should not throw if user is a valid ethereum address', async () => { const spy = jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') + .spyOn(UiIncentiveDataProviderV3__factory, 'connect') .mockReturnValue({ getUserReservesIncentivesData: async () => Promise.resolve(getUserIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); + } as unknown as UiIncentiveDataProviderV3); await instance.getUserReservesIncentivesData({ lendingPoolAddressProvider, user, @@ -229,11 +227,11 @@ describe('UiIncentiveDataProvider', () => { }); it('Expects to parse the incentives response to a human readable object', async () => { const spy = jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') + .spyOn(UiIncentiveDataProviderV3__factory, 'connect') .mockReturnValue({ getReservesIncentivesData: async () => Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); + } as unknown as UiIncentiveDataProviderV3); const data = await instance.getReservesIncentivesDataHumanized({ lendingPoolAddressProvider, }); @@ -317,43 +315,6 @@ describe('UiIncentiveDataProvider', () => { }, ], }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, }, ]); }); @@ -405,11 +366,11 @@ describe('UiIncentiveDataProvider', () => { }); it('should work with finding only', async () => { const spy = jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') + .spyOn(UiIncentiveDataProviderV3__factory, 'connect') .mockReturnValue({ getUserReservesIncentivesData: async () => Promise.resolve(getUserIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); + } as unknown as UiIncentiveDataProviderV3); const response = await instance.getUserReservesIncentivesDataHumanized({ lendingPoolAddressProvider, user, @@ -476,1272 +437,6 @@ describe('UiIncentiveDataProvider', () => { }, ], }, - sTokenIncentivesUserData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - userRewardsInformation: [], - }, - }, - ]); - }); - }); - - describe('getIncentivesDataWithPrice', () => { - const instance = new UiIncentiveDataProvider({ - uiIncentiveDataProviderAddress, - provider, - chainId: 137, - }); - const chainlinkFeedsRegistry = '0x0000000000000000000000000000000000000004'; - - afterEach(() => { - jest.clearAllMocks(); - }); - it('should throw if uiIncentiveDataProvider is not a valid ethereum address', async () => { - const instance = new UiIncentiveDataProvider({ - uiIncentiveDataProviderAddress: 'asdf', - provider, - chainId: 137, - }); - await expect(async () => - instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - }), - ).rejects.toThrowError( - 'UiIncentiveDataProviderAddress must be an eth valid address', - ); - }); - it('Expects to fail if lendingPoolAddressProvider not an eth address', async () => { - const lendingPoolAddressProvider = 'asdf'; - await expect(async () => - instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - }), - ).rejects.toThrow( - `Address: ${lendingPoolAddressProvider} is not a valid ethereum Address`, - ); - }); - it('should work with no feed', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry, - provider, - }); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue(Promise.reject()); - - const spy = jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') - .mockReturnValue({ - getReservesIncentivesData: async () => - Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); - - const result = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - quote: Denominations.eth, - }); - - expect(spy).toBeCalled(); - expect(clInstance.getPriceFeed).toBeCalled(); - expect(result).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - }, - ]); - }); - it('should work with one feed', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry, - provider, - }); - - jest - .mocked(clInstance) - .getPriceFeed.mockReturnValueOnce(Promise.reject()); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue( - Promise.resolve({ - answer: '2', - updatedAt: 4, - decimals: 1, - }), - ); - - jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') - .mockReturnValue({ - getReservesIncentivesData: async () => - Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); - - const result = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - quote: Denominations.eth, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - expect(result).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - }, - ]); - }); - it('should work with all feeds', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry, - provider: new providers.JsonRpcProvider(), - }); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue( - Promise.resolve({ - answer: '2', - updatedAt: 4, - decimals: 1, - }), - ); - - jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') - .mockReturnValue({ - getReservesIncentivesData: async () => - Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); - - const result = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - quote: Denominations.eth, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - expect(result).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: '2', - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 1, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: '2', - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 1, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: '2', - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 1, - }, - ], - }, - }, - ]); - }); - it('should work with all feeds and no quote', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry, - provider: new providers.JsonRpcProvider(), - }); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue( - Promise.resolve({ - answer: '2', - updatedAt: 4, - decimals: 1, - }), - ); - jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') - .mockReturnValue({ - getReservesIncentivesData: async () => - Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); - const result = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - - expect(result).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: '2', - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 1, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: '2', - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 1, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: '2', - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 1, - }, - ], - }, - }, - ]); - }); - it('should work with no feed twice', async () => { - const clInstance = new ChainlinkFeedsRegistry({ - chainlinkFeedsRegistry, - provider: new providers.JsonRpcProvider(), - }); - - jest.mocked(clInstance).getPriceFeed.mockReturnValue(Promise.reject()); - jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') - .mockReturnValue({ - getReservesIncentivesData: async () => - Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); - const result = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - quote: Denominations.eth, - }); - const result2 = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - quote: Denominations.eth, - }); - - expect(clInstance.getPriceFeed).toBeCalled(); - - expect(result).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - }, - ]); - expect(result2).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - }, - ]); - }); - it('should work with chainlinkRegistry address incorrect', async () => { - jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') - .mockReturnValue({ - getReservesIncentivesData: async () => - Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); - const result = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - chainlinkFeedsRegistry, - quote: Denominations.usd, - }); - - expect(result).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - }, - ]); - }); - it('should work with no chainlinkRegistry address no quote ', async () => { - jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') - .mockReturnValue({ - getReservesIncentivesData: async () => - Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); - const result = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - }); - - expect(result).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - }, - ]); - }); - it('should work with no chainlinkregistry address and quote ', async () => { - jest - .spyOn(IUiIncentiveDataProviderV3__factory, 'connect') - .mockReturnValue({ - getReservesIncentivesData: async () => - Promise.resolve(getReservesIncentivesDataMock), - } as unknown as IUiIncentiveDataProviderV3); - const result = await instance.getIncentivesDataWithPriceLegacy({ - lendingPoolAddressProvider, - quote: Denominations.usd, - }); - - expect(result).toEqual([ - { - id: '137-0xb04aaa2a73ff3d88950bdf19eb4ac029630a2367-0x0000000000000000000000000000000000000002', - underlyingAsset: - '0xb04Aaa2A73ff3D88950BdF19Eb4AC029630a2367'.toLowerCase(), - aIncentiveData: { - tokenAddress: '0x6d0eeb7b37BF26E182EB9a8631DCF79e4EF43DDd', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - vIncentiveData: { - tokenAddress: '0xaD99ef885623E8520f631625b2675d6dAd3aaDC1', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, - sIncentiveData: { - tokenAddress: '0xb2007801F8c9dB4241E12C81E9d83741d14d7227', - incentiveControllerAddress: - '0x5465485D7b15CaBc9196E73A0b1cc457262079e3', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'REW', - rewardTokenAddress: - '0x1f689325CBdF44B24DBE2ecC2b1fFD4130861b4E', - rewardOracleAddress: - '0xca8e9B5F9e36EbF74096223fc48810861b4FA642', - emissionPerSecond: BigNumber.from({ - _hex: '0x04464ecbc45ffe', - _isBigNumber: true, - }).toString(), - incentivesLastUpdateTimestamp: BigNumber.from({ - _hex: '0x61a5167a', - _isBigNumber: true, - }).toNumber(), - tokenIncentivesIndex: BigNumber.from({ - _hex: '0x00', - _isBigNumber: true, - }).toString(), - emissionEndTimestamp: BigNumber.from({ - _hex: '0x638649fa', - _isBigNumber: true, - }).toNumber(), - rewardPriceFeed: BigNumber.from({ - _hex: '0x05f5e100', - _isBigNumber: true, - }).toString(), - rewardTokenDecimals: 18, - precision: 18, - priceFeedDecimals: 0, - }, - ], - }, }, ]); }); diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/_mocks.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/_mocks.ts index 4ec8bbe49..86b8ded29 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/_mocks.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/_mocks.ts @@ -1,5 +1,5 @@ import { BigNumber } from 'ethers'; -import { ReservesData, UserReserveData } from './types'; +import { EModeData, ReservesData, UserReserveData } from './types'; export const reservesMock: ReservesData = { 0: [ @@ -29,7 +29,6 @@ export const reservesMock: ReservesData = { }), usageAsCollateralEnabled: false, borrowingEnabled: true, - stableBorrowRateEnabled: false, isActive: true, isFrozen: false, isPaused: false, @@ -50,31 +49,14 @@ export const reservesMock: ReservesData = { _hex: '0x0', _isBigNumber: true, }), - stableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), lastUpdateTimestamp: 1631772892, aTokenAddress: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - stableDebtTokenAddress: '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', variableDebtTokenAddress: '0xb7b7AF565495670713C92B8848fC8A650a968F81', interestRateStrategyAddress: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', availableLiquidity: BigNumber.from({ _hex: '0x0', _isBigNumber: true, }), - totalPrincipalStableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - averageStableRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableDebtLastUpdateTimestamp: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), totalScaledVariableDebt: BigNumber.from({ _hex: '0x0', _isBigNumber: true, @@ -92,18 +74,6 @@ export const reservesMock: ReservesData = { _hex: '0x0', _isBigNumber: true, }), - stableRateSlope1: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableRateSlope2: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - baseStableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), baseVariableBorrowRate: BigNumber.from({ _hex: '0x0', _isBigNumber: true, @@ -117,7 +87,6 @@ export const reservesMock: ReservesData = { _hex: '0x0', _isBigNumber: true, }), - eModeCategoryId: 1, borrowCap: BigNumber.from({ _hex: '0x0', _isBigNumber: true, @@ -126,11 +95,6 @@ export const reservesMock: ReservesData = { _hex: '0x0', _isBigNumber: true, }), - eModeLtv: 1, - eModeLiquidationThreshold: 1, - eModeLiquidationBonus: 1, - eModePriceSource: '0x3E0437898a5667a4769B1Ca5A34aAB1ae7E81377', - eModeLabel: 'test label', borrowableInIsolation: false, flashLoanEnabled: false, accruedToTreasury: BigNumber.from({ @@ -181,7 +145,6 @@ export const reservesMock: ReservesData = { }), usageAsCollateralEnabled: false, borrowingEnabled: true, - stableBorrowRateEnabled: false, isActive: true, isFrozen: false, isPaused: false, @@ -202,31 +165,14 @@ export const reservesMock: ReservesData = { _hex: '0x0', _isBigNumber: true, }), - stableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), lastUpdateTimestamp: 1631772892, aTokenAddress: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - stableDebtTokenAddress: '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', variableDebtTokenAddress: '0xb7b7AF565495670713C92B8848fC8A650a968F81', interestRateStrategyAddress: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', availableLiquidity: BigNumber.from({ _hex: '0x0', _isBigNumber: true, }), - totalPrincipalStableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - averageStableRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableDebtLastUpdateTimestamp: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), totalScaledVariableDebt: BigNumber.from({ _hex: '0x0', _isBigNumber: true, @@ -244,18 +190,6 @@ export const reservesMock: ReservesData = { _hex: '0x0', _isBigNumber: true, }), - stableRateSlope1: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableRateSlope2: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - baseStableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), baseVariableBorrowRate: BigNumber.from({ _hex: '0x0', _isBigNumber: true, @@ -269,7 +203,6 @@ export const reservesMock: ReservesData = { _hex: '0x0', _isBigNumber: true, }), - eModeCategoryId: 1, borrowCap: BigNumber.from({ _hex: '0x0', _isBigNumber: true, @@ -278,11 +211,6 @@ export const reservesMock: ReservesData = { _hex: '0x0', _isBigNumber: true, }), - eModeLtv: 1, - eModeLiquidationThreshold: 1, - eModeLiquidationBonus: 1, - eModePriceSource: '0x3E0437898a5667a4769B1Ca5A34aAB1ae7E81377', - eModeLabel: 'test label', borrowableInIsolation: false, flashLoanEnabled: false, accruedToTreasury: BigNumber.from({ @@ -335,23 +263,31 @@ export const userReservesMock: UserReserveData = { _isBigNumber: true, }), usageAsCollateralEnabledOnUser: false, - stableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), scaledVariableDebt: BigNumber.from({ _hex: '0x0', _isBigNumber: true, }), - principalStableDebt: BigNumber.from({ + }, + ], + 1: 1, +}; + +export const eModesMock: EModeData[] = [ + { + id: 1, + eMode: { + ltv: 1, + liquidationThreshold: 1, + liquidationBonus: 1, + label: 'test label', + collateralBitmap: BigNumber.from({ _hex: '0x0', _isBigNumber: true, }), - stableBorrowLastUpdateTimestamp: BigNumber.from({ + borrowableBitmap: BigNumber.from({ _hex: '0x0', _isBigNumber: true, }), }, - ], - 1: 1, -}; + }, +]; diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/index.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/index.ts index 5708ce5d7..3f87369e7 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/index.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/index.ts @@ -1,8 +1,8 @@ import { providers } from 'ethers'; import { isAddress } from 'ethers/lib/utils'; import { ReservesHelperInput, UserReservesHelperInput } from '../index'; -import { IUiPoolDataProviderV3 as UiPoolDataProviderContract } from './typechain/IUiPoolDataProviderV3'; -import { IUiPoolDataProviderV3__factory } from './typechain/IUiPoolDataProviderV3__factory'; +import { UiPoolDataProviderV3 } from './typechain/IUiPoolDataProviderV3'; +import { UiPoolDataProviderV3__factory } from './typechain/IUiPoolDataProviderV3__factory'; import { ReservesData, UserReserveData, @@ -10,6 +10,8 @@ import { ReserveDataHumanized, ReservesDataHumanized, UserReserveDataHumanized, + EModeData, + EmodeDataHumanized, } from './types'; export * from './types'; @@ -45,6 +47,10 @@ export interface UiPoolDataProviderInterface { getUserReservesData: ( args: UserReservesHelperInput, ) => Promise; + getEModes: (args: ReservesHelperInput) => Promise; + getEModesHumanized: ( + args: ReservesHelperInput, + ) => Promise; getReservesHumanized: ( args: ReservesHelperInput, ) => Promise; @@ -55,7 +61,7 @@ export interface UiPoolDataProviderInterface { } export class UiPoolDataProvider implements UiPoolDataProviderInterface { - private readonly _contract: UiPoolDataProviderContract; + private readonly _contract: UiPoolDataProviderV3; private readonly chainId: number; @@ -68,7 +74,7 @@ export class UiPoolDataProvider implements UiPoolDataProviderInterface { throw new Error('contract address is not valid'); } - this._contract = IUiPoolDataProviderV3__factory.connect( + this._contract = UiPoolDataProviderV3__factory.connect( context.uiPoolDataProviderAddress, context.provider, ); @@ -125,79 +131,67 @@ export class UiPoolDataProvider implements UiPoolDataProviderInterface { const { 0: reservesRaw, 1: poolBaseCurrencyRaw }: ReservesData = await this.getReservesData({ lendingPoolAddressProvider }); - const reservesData: ReserveDataHumanized[] = reservesRaw.map(reserveRaw => { - const virtualUnderlyingBalance = - reserveRaw.virtualUnderlyingBalance.toString(); - const { virtualAccActive } = reserveRaw; - return { - id: `${this.chainId}-${reserveRaw.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(), - underlyingAsset: reserveRaw.underlyingAsset.toLowerCase(), - name: reserveRaw.name, - symbol: ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] - ? ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] - : reserveRaw.symbol, - decimals: reserveRaw.decimals.toNumber(), - baseLTVasCollateral: reserveRaw.baseLTVasCollateral.toString(), - reserveLiquidationThreshold: - reserveRaw.reserveLiquidationThreshold.toString(), - reserveLiquidationBonus: reserveRaw.reserveLiquidationBonus.toString(), - reserveFactor: reserveRaw.reserveFactor.toString(), - usageAsCollateralEnabled: reserveRaw.usageAsCollateralEnabled, - borrowingEnabled: reserveRaw.borrowingEnabled, - stableBorrowRateEnabled: reserveRaw.stableBorrowRateEnabled, - isActive: reserveRaw.isActive, - isFrozen: reserveRaw.isFrozen, - liquidityIndex: reserveRaw.liquidityIndex.toString(), - variableBorrowIndex: reserveRaw.variableBorrowIndex.toString(), - liquidityRate: reserveRaw.liquidityRate.toString(), - variableBorrowRate: reserveRaw.variableBorrowRate.toString(), - stableBorrowRate: reserveRaw.stableBorrowRate.toString(), - lastUpdateTimestamp: reserveRaw.lastUpdateTimestamp, - aTokenAddress: reserveRaw.aTokenAddress.toString(), - stableDebtTokenAddress: reserveRaw.stableDebtTokenAddress.toString(), - variableDebtTokenAddress: - reserveRaw.variableDebtTokenAddress.toString(), - interestRateStrategyAddress: - reserveRaw.interestRateStrategyAddress.toString(), - availableLiquidity: reserveRaw.availableLiquidity.toString(), - totalPrincipalStableDebt: - reserveRaw.totalPrincipalStableDebt.toString(), - averageStableRate: reserveRaw.averageStableRate.toString(), - stableDebtLastUpdateTimestamp: - reserveRaw.stableDebtLastUpdateTimestamp.toNumber(), - totalScaledVariableDebt: reserveRaw.totalScaledVariableDebt.toString(), - priceInMarketReferenceCurrency: - reserveRaw.priceInMarketReferenceCurrency.toString(), - priceOracle: reserveRaw.priceOracle, - variableRateSlope1: reserveRaw.variableRateSlope1.toString(), - variableRateSlope2: reserveRaw.variableRateSlope2.toString(), - stableRateSlope1: reserveRaw.stableRateSlope1.toString(), - stableRateSlope2: reserveRaw.stableRateSlope2.toString(), - baseStableBorrowRate: reserveRaw.baseStableBorrowRate.toString(), - baseVariableBorrowRate: reserveRaw.baseVariableBorrowRate.toString(), - optimalUsageRatio: reserveRaw.optimalUsageRatio.toString(), - // new fields - isPaused: reserveRaw.isPaused, - debtCeiling: reserveRaw.debtCeiling.toString(), - eModeCategoryId: reserveRaw.eModeCategoryId, - borrowCap: reserveRaw.borrowCap.toString(), - supplyCap: reserveRaw.supplyCap.toString(), - eModeLtv: reserveRaw.eModeLtv, - eModeLiquidationThreshold: reserveRaw.eModeLiquidationThreshold, - eModeLiquidationBonus: reserveRaw.eModeLiquidationBonus, - eModePriceSource: reserveRaw.eModePriceSource.toString(), - eModeLabel: reserveRaw.eModeLabel.toString(), - borrowableInIsolation: reserveRaw.borrowableInIsolation, - accruedToTreasury: reserveRaw.accruedToTreasury.toString(), - unbacked: reserveRaw.unbacked.toString(), - isolationModeTotalDebt: reserveRaw.isolationModeTotalDebt.toString(), - debtCeilingDecimals: reserveRaw.debtCeilingDecimals.toNumber(), - isSiloedBorrowing: reserveRaw.isSiloedBorrowing, - flashLoanEnabled: reserveRaw.flashLoanEnabled, - virtualAccActive, - virtualUnderlyingBalance, - }; - }); + const reservesData: ReserveDataHumanized[] = reservesRaw.map( + (reserveRaw, index) => { + const virtualUnderlyingBalance = + reserveRaw.virtualUnderlyingBalance.toString(); + const { virtualAccActive } = reserveRaw; + return { + originalId: index, + id: `${this.chainId}-${reserveRaw.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(), + underlyingAsset: reserveRaw.underlyingAsset.toLowerCase(), + name: reserveRaw.name, + symbol: ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] + ? ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] + : reserveRaw.symbol, + decimals: reserveRaw.decimals.toNumber(), + baseLTVasCollateral: reserveRaw.baseLTVasCollateral.toString(), + reserveLiquidationThreshold: + reserveRaw.reserveLiquidationThreshold.toString(), + reserveLiquidationBonus: + reserveRaw.reserveLiquidationBonus.toString(), + reserveFactor: reserveRaw.reserveFactor.toString(), + usageAsCollateralEnabled: reserveRaw.usageAsCollateralEnabled, + borrowingEnabled: reserveRaw.borrowingEnabled, + isActive: reserveRaw.isActive, + isFrozen: reserveRaw.isFrozen, + liquidityIndex: reserveRaw.liquidityIndex.toString(), + variableBorrowIndex: reserveRaw.variableBorrowIndex.toString(), + liquidityRate: reserveRaw.liquidityRate.toString(), + variableBorrowRate: reserveRaw.variableBorrowRate.toString(), + lastUpdateTimestamp: reserveRaw.lastUpdateTimestamp, + aTokenAddress: reserveRaw.aTokenAddress.toString(), + variableDebtTokenAddress: + reserveRaw.variableDebtTokenAddress.toString(), + interestRateStrategyAddress: + reserveRaw.interestRateStrategyAddress.toString(), + availableLiquidity: reserveRaw.availableLiquidity.toString(), + totalScaledVariableDebt: + reserveRaw.totalScaledVariableDebt.toString(), + priceInMarketReferenceCurrency: + reserveRaw.priceInMarketReferenceCurrency.toString(), + priceOracle: reserveRaw.priceOracle, + variableRateSlope1: reserveRaw.variableRateSlope1.toString(), + variableRateSlope2: reserveRaw.variableRateSlope2.toString(), + baseVariableBorrowRate: reserveRaw.baseVariableBorrowRate.toString(), + optimalUsageRatio: reserveRaw.optimalUsageRatio.toString(), + // new fields + isPaused: reserveRaw.isPaused, + debtCeiling: reserveRaw.debtCeiling.toString(), + borrowCap: reserveRaw.borrowCap.toString(), + supplyCap: reserveRaw.supplyCap.toString(), + borrowableInIsolation: reserveRaw.borrowableInIsolation, + accruedToTreasury: reserveRaw.accruedToTreasury.toString(), + unbacked: reserveRaw.unbacked.toString(), + isolationModeTotalDebt: reserveRaw.isolationModeTotalDebt.toString(), + debtCeilingDecimals: reserveRaw.debtCeilingDecimals.toNumber(), + isSiloedBorrowing: reserveRaw.isSiloedBorrowing, + flashLoanEnabled: reserveRaw.flashLoanEnabled, + virtualAccActive, + virtualUnderlyingBalance, + }; + }, + ); const baseCurrencyData: PoolBaseCurrencyHumanized = { // this is to get the decimals from the unit so 1e18 = string length of 19 - 1 to get the number of 0 @@ -234,13 +228,47 @@ export class UiPoolDataProvider implements UiPoolDataProviderInterface { scaledATokenBalance: userReserveRaw.scaledATokenBalance.toString(), usageAsCollateralEnabledOnUser: userReserveRaw.usageAsCollateralEnabledOnUser, - stableBorrowRate: userReserveRaw.stableBorrowRate.toString(), scaledVariableDebt: userReserveRaw.scaledVariableDebt.toString(), - principalStableDebt: userReserveRaw.principalStableDebt.toString(), - stableBorrowLastUpdateTimestamp: - userReserveRaw.stableBorrowLastUpdateTimestamp.toNumber(), })), userEmodeCategoryId, }; } + + public async getEModes({ + lendingPoolAddressProvider, + }: ReservesHelperInput): Promise { + if (!isAddress(lendingPoolAddressProvider)) { + throw new Error('Lending pool address is not valid'); + } + + return this._contract.getEModes(lendingPoolAddressProvider); + } + + public async getEModesHumanized({ + lendingPoolAddressProvider, + }: ReservesHelperInput): Promise { + if (!isAddress(lendingPoolAddressProvider)) { + throw new Error('Lending pool address is not valid'); + } + + const eModeData = await this.getEModes({ lendingPoolAddressProvider }); + + return eModeData.map(eMode => ({ + id: eMode.id, + eMode: { + ltv: eMode.eMode.ltv.toString(), + liquidationThreshold: eMode.eMode.liquidationThreshold.toString(), + liquidationBonus: eMode.eMode.liquidationBonus.toString(), + collateralBitmap: eMode.eMode.collateralBitmap + .toBigInt() + .toString(2) + .padStart(256, '0'), + label: eMode.eMode.label, + borrowableBitmap: eMode.eMode.borrowableBitmap + .toBigInt() + .toString(2) + .padStart(256, '0'), + }, + })); + } } diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/typechain/IUiPoolDataProviderV3.d.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/typechain/IUiPoolDataProviderV3.d.ts index 24a2497bb..ead93d408 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/typechain/IUiPoolDataProviderV3.d.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/typechain/IUiPoolDataProviderV3.d.ts @@ -1,29 +1,270 @@ /* Autogenerated file. Do not edit manually. */ /* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, +import type { + BaseContract, BigNumber, BigNumberish, - PopulatedTransaction, - BaseContract, - ContractTransaction, + BytesLike, CallOverrides, + PopulatedTransaction, + Signer, + utils, } from 'ethers'; -import { BytesLike } from '@ethersproject/bytes'; -import { Listener, Provider } from '@ethersproject/providers'; -import { FunctionFragment, EventFragment, Result } from '@ethersproject/abi'; -import type { TypedEventFilter, TypedEvent, TypedListener } from './common'; +import type { FunctionFragment, Result } from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from './common'; + +export declare namespace DataTypes { + export type EModeCategoryStruct = { + ltv: BigNumberish; + liquidationThreshold: BigNumberish; + liquidationBonus: BigNumberish; + collateralBitmap: BigNumberish; + label: string; + borrowableBitmap: BigNumberish; + }; -interface IUiPoolDataProviderV3Interface extends ethers.utils.Interface { + export type EModeCategoryStructOutput = [ + number, + number, + number, + BigNumber, + string, + BigNumber, + ] & { + ltv: number; + liquidationThreshold: number; + liquidationBonus: number; + collateralBitmap: BigNumber; + label: string; + borrowableBitmap: BigNumber; + }; +} + +export declare namespace IUiPoolDataProviderV3 { + export type EmodeStruct = { + id: BigNumberish; + eMode: DataTypes.EModeCategoryStruct; + }; + + export type EmodeStructOutput = [ + number, + DataTypes.EModeCategoryStructOutput, + ] & { id: number; eMode: DataTypes.EModeCategoryStructOutput }; + + export type AggregatedReserveDataStruct = { + underlyingAsset: string; + name: string; + symbol: string; + decimals: BigNumberish; + baseLTVasCollateral: BigNumberish; + reserveLiquidationThreshold: BigNumberish; + reserveLiquidationBonus: BigNumberish; + reserveFactor: BigNumberish; + usageAsCollateralEnabled: boolean; + borrowingEnabled: boolean; + isActive: boolean; + isFrozen: boolean; + liquidityIndex: BigNumberish; + variableBorrowIndex: BigNumberish; + liquidityRate: BigNumberish; + variableBorrowRate: BigNumberish; + lastUpdateTimestamp: BigNumberish; + aTokenAddress: string; + variableDebtTokenAddress: string; + interestRateStrategyAddress: string; + availableLiquidity: BigNumberish; + totalScaledVariableDebt: BigNumberish; + priceInMarketReferenceCurrency: BigNumberish; + priceOracle: string; + variableRateSlope1: BigNumberish; + variableRateSlope2: BigNumberish; + baseVariableBorrowRate: BigNumberish; + optimalUsageRatio: BigNumberish; + isPaused: boolean; + isSiloedBorrowing: boolean; + accruedToTreasury: BigNumberish; + unbacked: BigNumberish; + isolationModeTotalDebt: BigNumberish; + flashLoanEnabled: boolean; + debtCeiling: BigNumberish; + debtCeilingDecimals: BigNumberish; + borrowCap: BigNumberish; + supplyCap: BigNumberish; + borrowableInIsolation: boolean; + virtualAccActive: boolean; + virtualUnderlyingBalance: BigNumberish; + }; + + export type AggregatedReserveDataStructOutput = [ + string, + string, + string, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + boolean, + boolean, + boolean, + boolean, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + number, + string, + string, + string, + BigNumber, + BigNumber, + BigNumber, + string, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + boolean, + boolean, + BigNumber, + BigNumber, + BigNumber, + boolean, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + boolean, + boolean, + BigNumber, + ] & { + underlyingAsset: string; + name: string; + symbol: string; + decimals: BigNumber; + baseLTVasCollateral: BigNumber; + reserveLiquidationThreshold: BigNumber; + reserveLiquidationBonus: BigNumber; + reserveFactor: BigNumber; + usageAsCollateralEnabled: boolean; + borrowingEnabled: boolean; + isActive: boolean; + isFrozen: boolean; + liquidityIndex: BigNumber; + variableBorrowIndex: BigNumber; + liquidityRate: BigNumber; + variableBorrowRate: BigNumber; + lastUpdateTimestamp: number; + aTokenAddress: string; + variableDebtTokenAddress: string; + interestRateStrategyAddress: string; + availableLiquidity: BigNumber; + totalScaledVariableDebt: BigNumber; + priceInMarketReferenceCurrency: BigNumber; + priceOracle: string; + variableRateSlope1: BigNumber; + variableRateSlope2: BigNumber; + baseVariableBorrowRate: BigNumber; + optimalUsageRatio: BigNumber; + isPaused: boolean; + isSiloedBorrowing: boolean; + accruedToTreasury: BigNumber; + unbacked: BigNumber; + isolationModeTotalDebt: BigNumber; + flashLoanEnabled: boolean; + debtCeiling: BigNumber; + debtCeilingDecimals: BigNumber; + borrowCap: BigNumber; + supplyCap: BigNumber; + borrowableInIsolation: boolean; + virtualAccActive: boolean; + virtualUnderlyingBalance: BigNumber; + }; + + export type BaseCurrencyInfoStruct = { + marketReferenceCurrencyUnit: BigNumberish; + marketReferenceCurrencyPriceInUsd: BigNumberish; + networkBaseTokenPriceInUsd: BigNumberish; + networkBaseTokenPriceDecimals: BigNumberish; + }; + + export type BaseCurrencyInfoStructOutput = [ + BigNumber, + BigNumber, + BigNumber, + number, + ] & { + marketReferenceCurrencyUnit: BigNumber; + marketReferenceCurrencyPriceInUsd: BigNumber; + networkBaseTokenPriceInUsd: BigNumber; + networkBaseTokenPriceDecimals: number; + }; + + export type UserReserveDataStruct = { + underlyingAsset: string; + scaledATokenBalance: BigNumberish; + usageAsCollateralEnabledOnUser: boolean; + scaledVariableDebt: BigNumberish; + }; + + export type UserReserveDataStructOutput = [ + string, + BigNumber, + boolean, + BigNumber, + ] & { + underlyingAsset: string; + scaledATokenBalance: BigNumber; + usageAsCollateralEnabledOnUser: boolean; + scaledVariableDebt: BigNumber; + }; +} + +export interface UiPoolDataProviderV3Interface extends utils.Interface { functions: { + 'ETH_CURRENCY_UNIT()': FunctionFragment; + 'MKR_ADDRESS()': FunctionFragment; + 'bytes32ToString(bytes32)': FunctionFragment; + 'getEModes(address)': FunctionFragment; 'getReservesData(address)': FunctionFragment; 'getReservesList(address)': FunctionFragment; 'getUserReservesData(address,address)': FunctionFragment; + 'marketReferenceCurrencyPriceInUsdProxyAggregator()': FunctionFragment; + 'networkBaseTokenPriceInUsdProxyAggregator()': FunctionFragment; }; + getFunction( + nameOrSignatureOrTopic: + | 'ETH_CURRENCY_UNIT' + | 'MKR_ADDRESS' + | 'bytes32ToString' + | 'getEModes' + | 'getReservesData' + | 'getReservesList' + | 'getUserReservesData' + | 'marketReferenceCurrencyPriceInUsdProxyAggregator' + | 'networkBaseTokenPriceInUsdProxyAggregator', + ): FunctionFragment; + + encodeFunctionData( + functionFragment: 'ETH_CURRENCY_UNIT', + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: 'MKR_ADDRESS', + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: 'bytes32ToString', + values: [BytesLike], + ): string; + encodeFunctionData(functionFragment: 'getEModes', values: [string]): string; encodeFunctionData( functionFragment: 'getReservesData', values: [string], @@ -36,7 +277,28 @@ interface IUiPoolDataProviderV3Interface extends ethers.utils.Interface { functionFragment: 'getUserReservesData', values: [string, string], ): string; + encodeFunctionData( + functionFragment: 'marketReferenceCurrencyPriceInUsdProxyAggregator', + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: 'networkBaseTokenPriceInUsdProxyAggregator', + values?: undefined, + ): string; + decodeFunctionResult( + functionFragment: 'ETH_CURRENCY_UNIT', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'MKR_ADDRESS', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'bytes32ToString', + data: BytesLike, + ): Result; + decodeFunctionResult(functionFragment: 'getEModes', data: BytesLike): Result; decodeFunctionResult( functionFragment: 'getReservesData', data: BytesLike, @@ -49,180 +311,66 @@ interface IUiPoolDataProviderV3Interface extends ethers.utils.Interface { functionFragment: 'getUserReservesData', data: BytesLike, ): Result; + decodeFunctionResult( + functionFragment: 'marketReferenceCurrencyPriceInUsdProxyAggregator', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'networkBaseTokenPriceInUsdProxyAggregator', + data: BytesLike, + ): Result; events: {}; } -export class IUiPoolDataProviderV3 extends BaseContract { +export interface UiPoolDataProviderV3 extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - listeners, EventArgsObject>( - eventFilter?: TypedEventFilter, - ): Array>; - off, EventArgsObject>( - eventFilter: TypedEventFilter, - listener: TypedListener, - ): this; - on, EventArgsObject>( - eventFilter: TypedEventFilter, - listener: TypedListener, - ): this; - once, EventArgsObject>( - eventFilter: TypedEventFilter, - listener: TypedListener, - ): this; - removeListener, EventArgsObject>( - eventFilter: TypedEventFilter, - listener: TypedListener, - ): this; - removeAllListeners, EventArgsObject>( - eventFilter: TypedEventFilter, - ): this; + interface: UiPoolDataProviderV3Interface; - listeners(eventName?: string): Array; - off(eventName: string, listener: Listener): this; - on(eventName: string, listener: Listener): this; - once(eventName: string, listener: Listener): this; - removeListener(eventName: string, listener: Listener): this; - removeAllListeners(eventName?: string): this; - - queryFilter, EventArgsObject>( - event: TypedEventFilter, + queryFilter( + event: TypedEventFilter, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined, - ): Promise>>; + ): Promise>; - interface: IUiPoolDataProviderV3Interface; + listeners( + eventFilter?: TypedEventFilter, + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter, + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; functions: { + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise<[BigNumber]>; + + MKR_ADDRESS(overrides?: CallOverrides): Promise<[string]>; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise<[string]>; + + getEModes( + provider: string, + overrides?: CallOverrides, + ): Promise<[IUiPoolDataProviderV3.EmodeStructOutput[]]>; + getReservesData( provider: string, overrides?: CallOverrides, ): Promise< [ - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - boolean, - boolean, - boolean, - boolean, - boolean, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - string, - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - boolean, - boolean, - BigNumber, - BigNumber, - BigNumber, - boolean, - BigNumber, - BigNumber, - number, - BigNumber, - BigNumber, - number, - number, - number, - string, - string, - boolean, - boolean?, - BigNumber?, - ] & { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - priceOracle: string; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - baseStableBorrowRate: BigNumber; - baseVariableBorrowRate: BigNumber; - optimalUsageRatio: BigNumber; - isPaused: boolean; - isSiloedBorrowing: boolean; - accruedToTreasury: BigNumber; - unbacked: BigNumber; - isolationModeTotalDebt: BigNumber; - flashLoanEnabled: boolean; - debtCeiling: BigNumber; - debtCeilingDecimals: BigNumber; - eModeCategoryId: number; - borrowCap: BigNumber; - supplyCap: BigNumber; - eModeLtv: number; - eModeLiquidationThreshold: number; - eModeLiquidationBonus: number; - eModePriceSource: string; - eModeLabel: string; - borrowableInIsolation: boolean; - virtualAccActive?: boolean; - virtualUnderlyingBalance?: BigNumber; - })[], - [BigNumber, BigNumber, BigNumber, number] & { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - }, + IUiPoolDataProviderV3.AggregatedReserveDataStructOutput[], + IUiPoolDataProviderV3.BaseCurrencyInfoStructOutput, ] >; @@ -235,156 +383,38 @@ export class IUiPoolDataProviderV3 extends BaseContract { provider: string, user: string, overrides?: CallOverrides, - ): Promise< - [ - ([ - string, - BigNumber, - boolean, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - ] & { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - })[], - number, - ] - >; + ): Promise<[IUiPoolDataProviderV3.UserReserveDataStructOutput[], number]>; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise<[string]>; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise<[string]>; }; + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; + + MKR_ADDRESS(overrides?: CallOverrides): Promise; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise; + + getEModes( + provider: string, + overrides?: CallOverrides, + ): Promise; + getReservesData( provider: string, overrides?: CallOverrides, ): Promise< [ - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - boolean, - boolean, - boolean, - boolean, - boolean, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - string, - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - boolean, - boolean, - BigNumber, - BigNumber, - BigNumber, - boolean, - BigNumber, - BigNumber, - number, - BigNumber, - BigNumber, - number, - number, - number, - string, - string, - boolean, - boolean, - BigNumber, - ] & { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - priceOracle: string; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - baseStableBorrowRate: BigNumber; - baseVariableBorrowRate: BigNumber; - optimalUsageRatio: BigNumber; - isPaused: boolean; - isSiloedBorrowing: boolean; - accruedToTreasury: BigNumber; - unbacked: BigNumber; - isolationModeTotalDebt: BigNumber; - flashLoanEnabled: boolean; - debtCeiling: BigNumber; - debtCeilingDecimals: BigNumber; - eModeCategoryId: number; - borrowCap: BigNumber; - supplyCap: BigNumber; - eModeLtv: number; - eModeLiquidationThreshold: number; - eModeLiquidationBonus: number; - eModePriceSource: string; - eModeLabel: string; - borrowableInIsolation: boolean; - virtualAccActive: boolean; - virtualUnderlyingBalance: BigNumber; - })[], - [BigNumber, BigNumber, BigNumber, number] & { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - }, + IUiPoolDataProviderV3.AggregatedReserveDataStructOutput[], + IUiPoolDataProviderV3.BaseCurrencyInfoStructOutput, ] >; @@ -397,156 +427,38 @@ export class IUiPoolDataProviderV3 extends BaseContract { provider: string, user: string, overrides?: CallOverrides, - ): Promise< - [ - ([ - string, - BigNumber, - boolean, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - ] & { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - })[], - number, - ] - >; + ): Promise<[IUiPoolDataProviderV3.UserReserveDataStructOutput[], number]>; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; callStatic: { + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; + + MKR_ADDRESS(overrides?: CallOverrides): Promise; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise; + + getEModes( + provider: string, + overrides?: CallOverrides, + ): Promise; + getReservesData( provider: string, overrides?: CallOverrides, ): Promise< [ - ([ - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - boolean, - boolean, - boolean, - boolean, - boolean, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - number, - string, - string, - string, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - string, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - boolean, - boolean, - BigNumber, - BigNumber, - BigNumber, - boolean, - BigNumber, - BigNumber, - number, - BigNumber, - BigNumber, - number, - number, - number, - string, - string, - boolean, - boolean, - BigNumber, - ] & { - underlyingAsset: string; - name: string; - symbol: string; - decimals: BigNumber; - baseLTVasCollateral: BigNumber; - reserveLiquidationThreshold: BigNumber; - reserveLiquidationBonus: BigNumber; - reserveFactor: BigNumber; - usageAsCollateralEnabled: boolean; - borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; - isActive: boolean; - isFrozen: boolean; - liquidityIndex: BigNumber; - variableBorrowIndex: BigNumber; - liquidityRate: BigNumber; - variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; - lastUpdateTimestamp: number; - aTokenAddress: string; - stableDebtTokenAddress: string; - variableDebtTokenAddress: string; - interestRateStrategyAddress: string; - availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; - totalScaledVariableDebt: BigNumber; - priceInMarketReferenceCurrency: BigNumber; - priceOracle: string; - variableRateSlope1: BigNumber; - variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - baseStableBorrowRate: BigNumber; - baseVariableBorrowRate: BigNumber; - optimalUsageRatio: BigNumber; - isPaused: boolean; - isSiloedBorrowing: boolean; - accruedToTreasury: BigNumber; - unbacked: BigNumber; - isolationModeTotalDebt: BigNumber; - flashLoanEnabled: boolean; - debtCeiling: BigNumber; - debtCeilingDecimals: BigNumber; - eModeCategoryId: number; - borrowCap: BigNumber; - supplyCap: BigNumber; - eModeLtv: number; - eModeLiquidationThreshold: number; - eModeLiquidationBonus: number; - eModePriceSource: string; - eModeLabel: string; - borrowableInIsolation: boolean; - virtualAccActive: boolean; - virtualUnderlyingBalance: BigNumber; - })[], - [BigNumber, BigNumber, BigNumber, number] & { - marketReferenceCurrencyUnit: BigNumber; - marketReferenceCurrencyPriceInUsd: BigNumber; - networkBaseTokenPriceInUsd: BigNumber; - networkBaseTokenPriceDecimals: number; - }, + IUiPoolDataProviderV3.AggregatedReserveDataStructOutput[], + IUiPoolDataProviderV3.BaseCurrencyInfoStructOutput, ] >; @@ -559,33 +471,31 @@ export class IUiPoolDataProviderV3 extends BaseContract { provider: string, user: string, overrides?: CallOverrides, - ): Promise< - [ - ([ - string, - BigNumber, - boolean, - BigNumber, - BigNumber, - BigNumber, - BigNumber, - ] & { - underlyingAsset: string; - scaledATokenBalance: BigNumber; - usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; - scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; - })[], - number, - ] - >; + ): Promise<[IUiPoolDataProviderV3.UserReserveDataStructOutput[], number]>; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; }; filters: {}; estimateGas: { + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; + + MKR_ADDRESS(overrides?: CallOverrides): Promise; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise; + + getEModes(provider: string, overrides?: CallOverrides): Promise; + getReservesData( provider: string, overrides?: CallOverrides, @@ -601,9 +511,31 @@ export class IUiPoolDataProviderV3 extends BaseContract { user: string, overrides?: CallOverrides, ): Promise; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; }; populateTransaction: { + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; + + MKR_ADDRESS(overrides?: CallOverrides): Promise; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise; + + getEModes( + provider: string, + overrides?: CallOverrides, + ): Promise; + getReservesData( provider: string, overrides?: CallOverrides, @@ -619,5 +551,13 @@ export class IUiPoolDataProviderV3 extends BaseContract { user: string, overrides?: CallOverrides, ): Promise; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; }; } diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/typechain/IUiPoolDataProviderV3__factory.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/typechain/IUiPoolDataProviderV3__factory.ts index 8a3b84235..65ec2b341 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/typechain/IUiPoolDataProviderV3__factory.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/typechain/IUiPoolDataProviderV3__factory.ts @@ -2,13 +2,137 @@ /* eslint-disable */ import { Contract, Signer, utils } from 'ethers'; -import { Provider } from '@ethersproject/providers'; +import type { Provider } from '@ethersproject/providers'; import type { - IUiPoolDataProviderV3, - IUiPoolDataProviderV3Interface, + UiPoolDataProviderV3, + UiPoolDataProviderV3Interface, } from './IUiPoolDataProviderV3'; const _abi = [ + { + inputs: [ + { + internalType: 'contract IEACAggregatorProxy', + name: '_networkBaseTokenPriceInUsdProxyAggregator', + type: 'address', + }, + { + internalType: 'contract IEACAggregatorProxy', + name: '_marketReferenceCurrencyPriceInUsdProxyAggregator', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [], + name: 'ETH_CURRENCY_UNIT', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'MKR_ADDRESS', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_bytes32', + type: 'bytes32', + }, + ], + name: 'bytes32ToString', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: 'provider', + type: 'address', + }, + ], + name: 'getEModes', + outputs: [ + { + components: [ + { + 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: 'uint128', + name: 'collateralBitmap', + type: 'uint128', + }, + { + internalType: 'string', + name: 'label', + type: 'string', + }, + { + internalType: 'uint128', + name: 'borrowableBitmap', + type: 'uint128', + }, + ], + internalType: 'struct DataTypes.EModeCategory', + name: 'eMode', + type: 'tuple', + }, + ], + internalType: 'struct IUiPoolDataProviderV3.Emode[]', + name: '', + type: 'tuple[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, { inputs: [ { @@ -71,11 +195,6 @@ const _abi = [ name: 'borrowingEnabled', type: 'bool', }, - { - internalType: 'bool', - name: 'stableBorrowRateEnabled', - type: 'bool', - }, { internalType: 'bool', name: 'isActive', @@ -106,11 +225,6 @@ const _abi = [ name: 'variableBorrowRate', type: 'uint128', }, - { - internalType: 'uint128', - name: 'stableBorrowRate', - type: 'uint128', - }, { internalType: 'uint40', name: 'lastUpdateTimestamp', @@ -121,11 +235,6 @@ const _abi = [ name: 'aTokenAddress', type: 'address', }, - { - internalType: 'address', - name: 'stableDebtTokenAddress', - type: 'address', - }, { internalType: 'address', name: 'variableDebtTokenAddress', @@ -141,21 +250,6 @@ const _abi = [ name: 'availableLiquidity', type: 'uint256', }, - { - internalType: 'uint256', - name: 'totalPrincipalStableDebt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'averageStableRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'stableDebtLastUpdateTimestamp', - type: 'uint256', - }, { internalType: 'uint256', name: 'totalScaledVariableDebt', @@ -181,21 +275,6 @@ const _abi = [ name: 'variableRateSlope2', type: 'uint256', }, - { - internalType: 'uint256', - name: 'stableRateSlope1', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'stableRateSlope2', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'baseStableBorrowRate', - type: 'uint256', - }, { internalType: 'uint256', name: 'baseVariableBorrowRate', @@ -246,11 +325,6 @@ const _abi = [ name: 'debtCeilingDecimals', type: 'uint256', }, - { - internalType: 'uint8', - name: 'eModeCategoryId', - type: 'uint8', - }, { internalType: 'uint256', name: 'borrowCap', @@ -261,31 +335,6 @@ const _abi = [ name: 'supplyCap', type: 'uint256', }, - { - internalType: 'uint16', - name: 'eModeLtv', - type: 'uint16', - }, - { - internalType: 'uint16', - name: 'eModeLiquidationThreshold', - type: 'uint16', - }, - { - internalType: 'uint16', - name: 'eModeLiquidationBonus', - type: 'uint16', - }, - { - internalType: 'address', - name: 'eModePriceSource', - type: 'address', - }, - { - internalType: 'string', - name: 'eModeLabel', - type: 'string', - }, { internalType: 'bool', name: 'borrowableInIsolation', @@ -388,26 +437,11 @@ const _abi = [ name: 'usageAsCollateralEnabledOnUser', type: 'bool', }, - { - internalType: 'uint256', - name: 'stableBorrowRate', - type: 'uint256', - }, { internalType: 'uint256', name: 'scaledVariableDebt', type: 'uint256', }, - { - internalType: 'uint256', - name: 'principalStableDebt', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'stableBorrowLastUpdateTimestamp', - type: 'uint256', - }, ], internalType: 'struct IUiPoolDataProviderV3.UserReserveData[]', name: '', @@ -450,19 +484,19 @@ const _abi = [ }, ] as const; -export class IUiPoolDataProviderV3__factory { +export class UiPoolDataProviderV3__factory { static readonly abi = _abi; - static createInterface(): IUiPoolDataProviderV3Interface { - return new utils.Interface(_abi) as IUiPoolDataProviderV3Interface; + static createInterface(): UiPoolDataProviderV3Interface { + return new utils.Interface(_abi) as UiPoolDataProviderV3Interface; } static connect( address: string, signerOrProvider: Signer | Provider, - ): IUiPoolDataProviderV3 { + ): UiPoolDataProviderV3 { return new Contract( address, _abi, signerOrProvider, - ) as IUiPoolDataProviderV3; + ) as UiPoolDataProviderV3; } } diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/types.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/types.ts index 0515eab3f..eaafe9d79 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/types.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/types.ts @@ -1,5 +1,33 @@ import { BigNumber } from 'ethers'; +export interface EModeCategoryHumanized { + ltv: string; + liquidationThreshold: string; + liquidationBonus: string; + collateralBitmap: string; + label: string; + borrowableBitmap: string; +} + +export interface EModeCategory { + ltv: number; + liquidationThreshold: number; + liquidationBonus: number; + collateralBitmap: BigNumber; + label: string; + borrowableBitmap: BigNumber; +} + +export interface EmodeDataHumanized { + id: number; + eMode: EModeCategoryHumanized; +} + +export interface EModeData { + id: number; + eMode: EModeCategory; +} + export interface ReservesData { 0: Array<{ underlyingAsset: string; @@ -12,31 +40,22 @@ export interface ReservesData { reserveFactor: BigNumber; usageAsCollateralEnabled: boolean; borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; isActive: boolean; isFrozen: boolean; liquidityIndex: BigNumber; variableBorrowIndex: BigNumber; liquidityRate: BigNumber; variableBorrowRate: BigNumber; - stableBorrowRate: BigNumber; lastUpdateTimestamp: number; aTokenAddress: string; - stableDebtTokenAddress: string; variableDebtTokenAddress: string; interestRateStrategyAddress: string; availableLiquidity: BigNumber; - totalPrincipalStableDebt: BigNumber; - averageStableRate: BigNumber; - stableDebtLastUpdateTimestamp: BigNumber; totalScaledVariableDebt: BigNumber; priceInMarketReferenceCurrency: BigNumber; priceOracle: string; variableRateSlope1: BigNumber; variableRateSlope2: BigNumber; - stableRateSlope1: BigNumber; - stableRateSlope2: BigNumber; - baseStableBorrowRate: BigNumber; baseVariableBorrowRate: BigNumber; optimalUsageRatio: BigNumber; isPaused: boolean; @@ -44,18 +63,12 @@ export interface ReservesData { accruedToTreasury: BigNumber; unbacked: BigNumber; isolationModeTotalDebt: BigNumber; + flashLoanEnabled: boolean; debtCeiling: BigNumber; debtCeilingDecimals: BigNumber; - eModeCategoryId: number; borrowCap: BigNumber; supplyCap: BigNumber; - eModeLtv: number; - eModeLiquidationThreshold: number; - eModeLiquidationBonus: number; - eModePriceSource: string; - eModeLabel: string; borrowableInIsolation: boolean; - flashLoanEnabled: boolean; virtualAccActive: boolean; virtualUnderlyingBalance: BigNumber; }>; @@ -72,10 +85,7 @@ export interface UserReserveData { underlyingAsset: string; scaledATokenBalance: BigNumber; usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: BigNumber; scaledVariableDebt: BigNumber; - principalStableDebt: BigNumber; - stableBorrowLastUpdateTimestamp: BigNumber; }>; 1: number; } @@ -86,7 +96,9 @@ export interface PoolBaseCurrencyHumanized { networkBaseTokenPriceInUsd: string; networkBaseTokenPriceDecimals: number; } + export interface ReserveDataHumanized { + originalId: number; id: string; underlyingAsset: string; name: string; @@ -98,31 +110,22 @@ export interface ReserveDataHumanized { reserveFactor: string; usageAsCollateralEnabled: boolean; borrowingEnabled: boolean; - stableBorrowRateEnabled: boolean; isActive: boolean; isFrozen: boolean; liquidityIndex: string; variableBorrowIndex: string; liquidityRate: string; variableBorrowRate: string; - stableBorrowRate: string; lastUpdateTimestamp: number; aTokenAddress: string; - stableDebtTokenAddress: string; variableDebtTokenAddress: string; interestRateStrategyAddress: string; availableLiquidity: string; - totalPrincipalStableDebt: string; - averageStableRate: string; - stableDebtLastUpdateTimestamp: number; totalScaledVariableDebt: string; priceInMarketReferenceCurrency: string; priceOracle: string; variableRateSlope1: string; variableRateSlope2: string; - stableRateSlope1: string; - stableRateSlope2: string; - baseStableBorrowRate: string; baseVariableBorrowRate: string; optimalUsageRatio: string; // v3 only @@ -131,18 +134,12 @@ export interface ReserveDataHumanized { accruedToTreasury: string; unbacked: string; isolationModeTotalDebt: string; + flashLoanEnabled: boolean; debtCeiling: string; debtCeilingDecimals: number; - eModeCategoryId: number; borrowCap: string; supplyCap: string; - eModeLtv: number; - eModeLiquidationThreshold: number; - eModeLiquidationBonus: number; - eModePriceSource: string; - eModeLabel: string; borrowableInIsolation: boolean; - flashLoanEnabled: boolean; virtualAccActive: boolean; virtualUnderlyingBalance: string; } @@ -157,8 +154,5 @@ export interface UserReserveDataHumanized { underlyingAsset: string; scaledATokenBalance: string; usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: string; scaledVariableDebt: string; - principalStableDebt: string; - stableBorrowLastUpdateTimestamp: number; } diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/uiPoolDataProvider.test.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/uiPoolDataProvider.test.ts index c18287125..c609653b2 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/uiPoolDataProvider.test.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-contract/uiPoolDataProvider.test.ts @@ -1,5 +1,5 @@ import { providers } from 'ethers'; -import { reservesMock, userReservesMock } from './_mocks'; +import { eModesMock, reservesMock, userReservesMock } from './_mocks'; import { UiPoolDataProvider } from './index'; describe('UiPoolDataProvider', () => { @@ -15,15 +15,18 @@ describe('UiPoolDataProvider', () => { const mockGetReservesData = jest.fn(); const mockGetUserReservesData = jest.fn(); + const mockGetEModes = jest.fn(); mockGetReservesData.mockResolvedValue(reservesMock); mockGetUserReservesData.mockResolvedValue(userReservesMock); + mockGetEModes.mockResolvedValue(eModesMock); // @ts-expect-error readonly instance._contract = { getReservesList: jest.fn(), getReservesData: mockGetReservesData, getUserReservesData: mockGetUserReservesData, + getEModes: mockGetEModes, }; return instance; @@ -89,32 +92,58 @@ describe('UiPoolDataProvider', () => { }); }); - describe('getUserReservesData', () => { + describe('getReservesData', () => { it('should throw when lendingPoolAddressProvider is not valid address', async () => { const instance = createValidInstance(); await expect( - instance.getUserReservesData({ + instance.getReservesData({ lendingPoolAddressProvider: mockInvalidEthereumAddress, - user: mockValidEthereumAddress, }), ).rejects.toThrow('Lending pool address is not valid'); }); - it('should throw if user is not a valid ethereum address', async () => { + it('should not throw', async () => { const instance = createValidInstance(); await expect( - instance.getUserReservesData({ + instance.getReservesData({ lendingPoolAddressProvider: mockValidEthereumAddress, - user: mockInvalidEthereumAddress, }), - ).rejects.toThrow('User address is not a valid ethereum address'); + ).resolves.not.toThrow(); }); + }); - it('should not throw if user is a valid ethereum address', async () => { + describe('getEModes', () => { + it('should throw when lendingPoolAddressProvider is not valid address', async () => { + const instance = createValidInstance(); + await expect( + instance.getEModes({ + lendingPoolAddressProvider: mockInvalidEthereumAddress, + }), + ).rejects.toThrow('Lending pool address is not valid'); + }); + it('should not throw', async () => { const instance = createValidInstance(); await expect( - instance.getUserReservesData({ + instance.getEModes({ + lendingPoolAddressProvider: mockValidEthereumAddress, + }), + ).resolves.not.toThrow(); + }); + }); + + describe('getEModesHumanized', () => { + it('should throw when lendingPoolAddressProvider is not valid address', async () => { + const instance = createValidInstance(); + await expect( + instance.getEModesHumanized({ + lendingPoolAddressProvider: mockInvalidEthereumAddress, + }), + ).rejects.toThrow('Lending pool address is not valid'); + }); + it('should not throw', async () => { + const instance = createValidInstance(); + await expect( + instance.getEModesHumanized({ lendingPoolAddressProvider: mockValidEthereumAddress, - user: mockValidEthereumAddress, }), ).resolves.not.toThrow(); }); @@ -137,6 +166,7 @@ describe('UiPoolDataProvider', () => { expect(result).toEqual({ reservesData: [ { + originalId: 0, id: '137-0x3e0437898a5667a4769b1ca5a34aab1ae7e81377-0x88757f2f99175387ab4c6a4b3067c77a695b0349', underlyingAsset: '0x3e0437898a5667a4769b1ca5a34aab1ae7e81377', name: '', @@ -148,7 +178,6 @@ describe('UiPoolDataProvider', () => { reserveFactor: '0', usageAsCollateralEnabled: false, borrowingEnabled: true, - stableBorrowRateEnabled: false, isActive: true, isFrozen: false, isPaused: false, @@ -157,39 +186,24 @@ describe('UiPoolDataProvider', () => { variableBorrowIndex: '0', liquidityRate: '0', variableBorrowRate: '0', - stableBorrowRate: '0', lastUpdateTimestamp: 1631772892, aTokenAddress: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - stableDebtTokenAddress: - '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', variableDebtTokenAddress: '0xb7b7AF565495670713C92B8848fC8A650a968F81', interestRateStrategyAddress: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', availableLiquidity: '0', - totalPrincipalStableDebt: '0', - averageStableRate: '0', - stableDebtLastUpdateTimestamp: 0, totalScaledVariableDebt: '0', priceInMarketReferenceCurrency: '0', priceOracle: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', variableRateSlope1: '0', variableRateSlope2: '0', - stableRateSlope1: '0', - stableRateSlope2: '0', - baseStableBorrowRate: '0', baseVariableBorrowRate: '0', optimalUsageRatio: '0', // new debtCeiling: '0', - eModeCategoryId: 1, borrowCap: '0', supplyCap: '0', - eModeLtv: 1, - eModeLiquidationThreshold: 1, - eModeLiquidationBonus: 1, - eModePriceSource: '0x3E0437898a5667a4769B1Ca5A34aAB1ae7E81377', - eModeLabel: 'test label', accruedToTreasury: '0', unbacked: '0', isolationModeTotalDebt: '0', @@ -200,6 +214,7 @@ describe('UiPoolDataProvider', () => { virtualUnderlyingBalance: '0', }, { + originalId: 1, id: '137-0xa478c2975ab1ea89e8196811f51a7b7ade33eb11-0x88757f2f99175387ab4c6a4b3067c77a695b0349', underlyingAsset: '0xa478c2975ab1ea89e8196811f51a7b7ade33eb11', name: '', @@ -211,7 +226,6 @@ describe('UiPoolDataProvider', () => { reserveFactor: '0', usageAsCollateralEnabled: false, borrowingEnabled: true, - stableBorrowRateEnabled: false, isActive: true, isFrozen: false, isPaused: false, @@ -220,39 +234,24 @@ describe('UiPoolDataProvider', () => { variableBorrowIndex: '0', liquidityRate: '0', variableBorrowRate: '0', - stableBorrowRate: '0', lastUpdateTimestamp: 1631772892, aTokenAddress: '0xb8a16bbab34FA7A5C09Ec7679EAfb8fEC06897bc', - stableDebtTokenAddress: - '0x9157d57DC97A7AFFC7b0a78E78fe25e1401B1dCc', variableDebtTokenAddress: '0xb7b7AF565495670713C92B8848fC8A650a968F81', interestRateStrategyAddress: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', availableLiquidity: '0', - totalPrincipalStableDebt: '0', - averageStableRate: '0', - stableDebtLastUpdateTimestamp: 0, totalScaledVariableDebt: '0', priceInMarketReferenceCurrency: '0', priceOracle: '0x796ec26fc7df8D81BCB5BABF74ccdE0E2B122164', variableRateSlope1: '0', variableRateSlope2: '0', - stableRateSlope1: '0', - stableRateSlope2: '0', - baseStableBorrowRate: '0', baseVariableBorrowRate: '0', optimalUsageRatio: '0', // new debtCeiling: '0', - eModeCategoryId: 1, borrowCap: '0', supplyCap: '0', - eModeLtv: 1, - eModeLiquidationThreshold: 1, - eModeLiquidationBonus: 1, - eModePriceSource: '0x3E0437898a5667a4769B1Ca5A34aAB1ae7E81377', - eModeLabel: 'test label', accruedToTreasury: '0', unbacked: '0', isolationModeTotalDebt: '0', @@ -302,11 +301,8 @@ describe('UiPoolDataProvider', () => { userReserves: [ { id: '137-0x88757f2f99175387ab4c6a4b3067c77a695b0349-0xb597cd8d3217ea6477232f9217fa70837ff667af-0x88757f2f99175387ab4c6a4b3067c77a695b0349', - principalStableDebt: '0', scaledATokenBalance: '0', scaledVariableDebt: '0', - stableBorrowLastUpdateTimestamp: 0, - stableBorrowRate: '0', underlyingAsset: '0xb597cd8d3217ea6477232f9217fa70837ff667af', usageAsCollateralEnabledOnUser: false, }, diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/_mocks.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/_mocks.ts index bdb43d60d..1aa7fcd86 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/_mocks.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/_mocks.ts @@ -326,22 +326,10 @@ export const userReservesMock: UserReserveData = { _isBigNumber: true, }), usageAsCollateralEnabledOnUser: false, - stableBorrowRate: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), scaledVariableDebt: BigNumber.from({ _hex: '0x0', _isBigNumber: true, }), - principalStableDebt: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), - stableBorrowLastUpdateTimestamp: BigNumber.from({ - _hex: '0x0', - _isBigNumber: true, - }), }, ], 1: 1, diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/index.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/index.ts index 21a605a35..5705b4bca 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/index.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/index.ts @@ -1,6 +1,8 @@ import { isAddress } from 'ethers/lib/utils'; import { ReservesHelperInput, UserReservesHelperInput } from '../index'; import { + EModeData, + EmodeDataHumanized, PoolBaseCurrencyHumanized, ReserveDataHumanized, ReservesDataHumanized, @@ -46,6 +48,10 @@ export interface LegacyUiPoolDataProviderInterface { userReserves: UserReserveDataHumanized[]; userEmodeCategoryId: number; }>; + getEModes: (args: ReservesHelperInput) => Promise; + getEModesHumanized: ( + args: ReservesHelperInput, + ) => Promise; } /** @@ -125,7 +131,8 @@ export class LegacyUiPoolDataProvider await this.getReservesData({ lendingPoolAddressProvider }); const reservesData: ReserveDataHumanized[] = reservesRaw.map( - reserveRaw => ({ + (reserveRaw, index) => ({ + originalId: index, id: `${this.chainId}-${reserveRaw.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(), underlyingAsset: reserveRaw.underlyingAsset.toLowerCase(), name: reserveRaw.name, @@ -230,13 +237,29 @@ export class LegacyUiPoolDataProvider scaledATokenBalance: userReserveRaw.scaledATokenBalance.toString(), usageAsCollateralEnabledOnUser: userReserveRaw.usageAsCollateralEnabledOnUser, - stableBorrowRate: userReserveRaw.stableBorrowRate.toString(), scaledVariableDebt: userReserveRaw.scaledVariableDebt.toString(), - principalStableDebt: userReserveRaw.principalStableDebt.toString(), - stableBorrowLastUpdateTimestamp: - userReserveRaw.stableBorrowLastUpdateTimestamp.toNumber(), })), userEmodeCategoryId, }; } + + public async getEModes({ + lendingPoolAddressProvider, + }: ReservesHelperInput): Promise { + if (!isAddress(lendingPoolAddressProvider)) { + throw new Error('Lending pool address is not valid'); + } + + return Promise.resolve([]); + } + + public async getEModesHumanized({ + lendingPoolAddressProvider, + }: ReservesHelperInput): Promise { + if (!isAddress(lendingPoolAddressProvider)) { + throw new Error('Lending pool address is not valid'); + } + + return Promise.resolve([]); + } } diff --git a/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/legacyUiPoolDataProvider.test.ts b/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/legacyUiPoolDataProvider.test.ts index 40acd5e76..0031f0618 100644 --- a/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/legacyUiPoolDataProvider.test.ts +++ b/packages/contract-helpers/src/v3-UiPoolDataProvider-legacy-contract/legacyUiPoolDataProvider.test.ts @@ -137,6 +137,7 @@ describe('UiPoolDataProvider', () => { expect(result).toEqual({ reservesData: [ { + originalId: 0, id: '137-0x3e0437898a5667a4769b1ca5a34aab1ae7e81377-0x88757f2f99175387ab4c6a4b3067c77a695b0349', underlyingAsset: '0x3e0437898a5667a4769b1ca5a34aab1ae7e81377', name: '', @@ -200,6 +201,7 @@ describe('UiPoolDataProvider', () => { virtualUnderlyingBalance: '0', }, { + originalId: 1, id: '137-0xa478c2975ab1ea89e8196811f51a7b7ade33eb11-0x88757f2f99175387ab4c6a4b3067c77a695b0349', underlyingAsset: '0xa478c2975ab1ea89e8196811f51a7b7ade33eb11', name: '', @@ -302,11 +304,8 @@ describe('UiPoolDataProvider', () => { userReserves: [ { id: '137-0x88757f2f99175387ab4c6a4b3067c77a695b0349-0xb597cd8d3217ea6477232f9217fa70837ff667af-0x88757f2f99175387ab4c6a4b3067c77a695b0349', - principalStableDebt: '0', scaledATokenBalance: '0', scaledVariableDebt: '0', - stableBorrowLastUpdateTimestamp: 0, - stableBorrowRate: '0', underlyingAsset: '0xb597cd8d3217ea6477232f9217fa70837ff667af', usageAsCollateralEnabledOnUser: false, }, @@ -315,4 +314,38 @@ describe('UiPoolDataProvider', () => { }); }); }); + describe('getEModes', () => { + it('should throw if lendingPoolAddressProvider is not a valid ethereum address', async () => { + const instance = createValidInstance(); + await expect( + instance.getEModes({ + lendingPoolAddressProvider: mockInvalidEthereumAddress, + }), + ).rejects.toThrow('Lending pool address is not valid'); + }); + it('should return an empty array', async () => { + const instance = createValidInstance(); + const result = await instance.getEModes({ + lendingPoolAddressProvider: mockValidEthereumAddress, + }); + expect(result.length).toBe(0); + }); + }); + describe('getEModesHumanized', () => { + it('should throw if lendingPoolAddressProvider is not a valid ethereum address', async () => { + const instance = createValidInstance(); + await expect( + instance.getEModesHumanized({ + lendingPoolAddressProvider: mockInvalidEthereumAddress, + }), + ).rejects.toThrow('Lending pool address is not valid'); + }); + it('should return an empty array', async () => { + const instance = createValidInstance(); + const result = await instance.getEModesHumanized({ + lendingPoolAddressProvider: mockValidEthereumAddress, + }); + expect(result.length).toBe(0); + }); + }); }); diff --git a/packages/contract-types/package.json b/packages/contract-types/package.json new file mode 100644 index 000000000..e5cb1484a --- /dev/null +++ b/packages/contract-types/package.json @@ -0,0 +1,18 @@ +{ + "name": "@aave/contract-types", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "private": true, + "scripts": { + "generate": "typechain --target=ethers-v5 ./src/abis/**/*.json --out-dir ./src/types" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/aave/aave-utilities.git" + }, + "devDependencies": { + "@typechain/ethers-v5": "^11.1.2", + "typechain": "^8.3.2" + } +} diff --git a/packages/contract-types/src/abis/UiIncentiveDataProviderV3.json b/packages/contract-types/src/abis/UiIncentiveDataProviderV3.json new file mode 100644 index 000000000..fd544e8ca --- /dev/null +++ b/packages/contract-types/src/abis/UiIncentiveDataProviderV3.json @@ -0,0 +1,666 @@ +[ + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getFullReservesIncentiveData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "incentiveControllerAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "rewardTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardOracleAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "emissionPerSecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "incentivesLastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenIncentivesIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "emissionEndTimestamp", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "rewardPriceFeed", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "precision", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "priceFeedDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.RewardInfo[]", + "name": "rewardsTokenInformation", + "type": "tuple[]" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.IncentiveData", + "name": "aIncentiveData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "incentiveControllerAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "rewardTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardOracleAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "emissionPerSecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "incentivesLastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenIncentivesIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "emissionEndTimestamp", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "rewardPriceFeed", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "precision", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "priceFeedDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.RewardInfo[]", + "name": "rewardsTokenInformation", + "type": "tuple[]" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.IncentiveData", + "name": "vIncentiveData", + "type": "tuple" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.AggregatedReserveIncentiveData[]", + "name": "", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "incentiveControllerAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "rewardOracleAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardTokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "userUnclaimedRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenIncentivesUserIndex", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "rewardPriceFeed", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "priceFeedDecimals", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserRewardInfo[]", + "name": "userRewardsInformation", + "type": "tuple[]" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserIncentiveData", + "name": "aTokenIncentivesUserData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "incentiveControllerAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "rewardOracleAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardTokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "userUnclaimedRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenIncentivesUserIndex", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "rewardPriceFeed", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "priceFeedDecimals", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserRewardInfo[]", + "name": "userRewardsInformation", + "type": "tuple[]" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserIncentiveData", + "name": "vTokenIncentivesUserData", + "type": "tuple" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserReserveIncentiveData[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + } + ], + "name": "getReservesIncentivesData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "incentiveControllerAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "rewardTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardOracleAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "emissionPerSecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "incentivesLastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenIncentivesIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "emissionEndTimestamp", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "rewardPriceFeed", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "precision", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "priceFeedDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.RewardInfo[]", + "name": "rewardsTokenInformation", + "type": "tuple[]" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.IncentiveData", + "name": "aIncentiveData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "incentiveControllerAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "rewardTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardOracleAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "emissionPerSecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "incentivesLastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenIncentivesIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "emissionEndTimestamp", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "rewardPriceFeed", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "precision", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "priceFeedDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.RewardInfo[]", + "name": "rewardsTokenInformation", + "type": "tuple[]" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.IncentiveData", + "name": "vIncentiveData", + "type": "tuple" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.AggregatedReserveIncentiveData[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getUserReservesIncentivesData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "incentiveControllerAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "rewardOracleAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardTokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "userUnclaimedRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenIncentivesUserIndex", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "rewardPriceFeed", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "priceFeedDecimals", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserRewardInfo[]", + "name": "userRewardsInformation", + "type": "tuple[]" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserIncentiveData", + "name": "aTokenIncentivesUserData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "incentiveControllerAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "rewardOracleAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardTokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "userUnclaimedRewards", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokenIncentivesUserIndex", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "rewardPriceFeed", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "priceFeedDecimals", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserRewardInfo[]", + "name": "userRewardsInformation", + "type": "tuple[]" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserIncentiveData", + "name": "vTokenIncentivesUserData", + "type": "tuple" + } + ], + "internalType": "struct IUiIncentiveDataProviderV3.UserReserveIncentiveData[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/packages/contract-types/src/abis/UiPoolDataProviderV3.json b/packages/contract-types/src/abis/UiPoolDataProviderV3.json new file mode 100644 index 000000000..b5e135995 --- /dev/null +++ b/packages/contract-types/src/abis/UiPoolDataProviderV3.json @@ -0,0 +1,393 @@ +[ + { + "inputs": [ + { + "internalType": "contract IEACAggregatorProxy", + "name": "_networkBaseTokenPriceInUsdProxyAggregator", + "type": "address" + }, + { + "internalType": "contract IEACAggregatorProxy", + "name": "_marketReferenceCurrencyPriceInUsdProxyAggregator", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ETH_CURRENCY_UNIT", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MKR_ADDRESS", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "_bytes32", "type": "bytes32" } + ], + "name": "bytes32ToString", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + } + ], + "name": "getEModes", + "outputs": [ + { + "components": [ + { "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": "uint128", + "name": "collateralBitmap", + "type": "uint128" + }, + { "internalType": "string", "name": "label", "type": "string" }, + { + "internalType": "uint128", + "name": "borrowableBitmap", + "type": "uint128" + } + ], + "internalType": "struct DataTypes.EModeCategory", + "name": "eMode", + "type": "tuple" + } + ], + "internalType": "struct IUiPoolDataProviderV3.Emode[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + } + ], + "name": "getReservesData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { "internalType": "string", "name": "name", "type": "string" }, + { "internalType": "string", "name": "symbol", "type": "string" }, + { "internalType": "uint256", "name": "decimals", "type": "uint256" }, + { + "internalType": "uint256", + "name": "baseLTVasCollateral", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveLiquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveLiquidationBonus", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveFactor", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "usageAsCollateralEnabled", + "type": "bool" + }, + { + "internalType": "bool", + "name": "borrowingEnabled", + "type": "bool" + }, + { "internalType": "bool", "name": "isActive", "type": "bool" }, + { "internalType": "bool", "name": "isFrozen", "type": "bool" }, + { + "internalType": "uint128", + "name": "liquidityIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "variableBorrowIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "liquidityRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "variableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + }, + { + "internalType": "address", + "name": "aTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "variableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "availableLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalScaledVariableDebt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "priceInMarketReferenceCurrency", + "type": "uint256" + }, + { + "internalType": "address", + "name": "priceOracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "variableRateSlope1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "variableRateSlope2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseVariableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "optimalUsageRatio", + "type": "uint256" + }, + { "internalType": "bool", "name": "isPaused", "type": "bool" }, + { + "internalType": "bool", + "name": "isSiloedBorrowing", + "type": "bool" + }, + { + "internalType": "uint128", + "name": "accruedToTreasury", + "type": "uint128" + }, + { "internalType": "uint128", "name": "unbacked", "type": "uint128" }, + { + "internalType": "uint128", + "name": "isolationModeTotalDebt", + "type": "uint128" + }, + { + "internalType": "bool", + "name": "flashLoanEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "debtCeilingDecimals", + "type": "uint256" + }, + { "internalType": "uint256", "name": "borrowCap", "type": "uint256" }, + { "internalType": "uint256", "name": "supplyCap", "type": "uint256" }, + { + "internalType": "bool", + "name": "borrowableInIsolation", + "type": "bool" + }, + { + "internalType": "bool", + "name": "virtualAccActive", + "type": "bool" + }, + { + "internalType": "uint128", + "name": "virtualUnderlyingBalance", + "type": "uint128" + } + ], + "internalType": "struct IUiPoolDataProviderV3.AggregatedReserveData[]", + "name": "", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "marketReferenceCurrencyUnit", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "marketReferenceCurrencyPriceInUsd", + "type": "int256" + }, + { + "internalType": "int256", + "name": "networkBaseTokenPriceInUsd", + "type": "int256" + }, + { + "internalType": "uint8", + "name": "networkBaseTokenPriceDecimals", + "type": "uint8" + } + ], + "internalType": "struct IUiPoolDataProviderV3.BaseCurrencyInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + } + ], + "name": "getReservesList", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getUserReservesData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "scaledATokenBalance", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "usageAsCollateralEnabledOnUser", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "scaledVariableDebt", + "type": "uint256" + } + ], + "internalType": "struct IUiPoolDataProviderV3.UserReserveData[]", + "name": "", + "type": "tuple[]" + }, + { "internalType": "uint8", "name": "", "type": "uint8" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "marketReferenceCurrencyPriceInUsdProxyAggregator", + "outputs": [ + { + "internalType": "contract IEACAggregatorProxy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "networkBaseTokenPriceInUsdProxyAggregator", + "outputs": [ + { + "internalType": "contract IEACAggregatorProxy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/packages/contract-types/src/abis/WrappedTokenGatewayV3.json b/packages/contract-types/src/abis/WrappedTokenGatewayV3.json new file mode 100644 index 000000000..87e57075a --- /dev/null +++ b/packages/contract-types/src/abis/WrappedTokenGatewayV3.json @@ -0,0 +1,142 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "weth", "type": "address" }, + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "contract IPool", "name": "pool", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { "stateMutability": "payable", "type": "fallback" }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "borrowETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "depositETH", + "outputs": [], + "stateMutability": "payable", + "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": "token", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "emergencyTokenTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getWETHAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" } + ], + "name": "repayETH", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "withdrawETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "to", "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": "withdrawETHWithPermit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/packages/contract-types/src/types/UiIncentiveDataProviderV3.ts b/packages/contract-types/src/types/UiIncentiveDataProviderV3.ts new file mode 100644 index 000000000..ce572d7e7 --- /dev/null +++ b/packages/contract-types/src/types/UiIncentiveDataProviderV3.ts @@ -0,0 +1,347 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + PopulatedTransaction, + Signer, + utils, +} from 'ethers'; +import type { FunctionFragment, Result } from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from './common'; + +export declare namespace IUiIncentiveDataProviderV3 { + export type RewardInfoStruct = { + rewardTokenSymbol: string; + rewardTokenAddress: string; + rewardOracleAddress: string; + emissionPerSecond: BigNumberish; + incentivesLastUpdateTimestamp: BigNumberish; + tokenIncentivesIndex: BigNumberish; + emissionEndTimestamp: BigNumberish; + rewardPriceFeed: BigNumberish; + rewardTokenDecimals: BigNumberish; + precision: BigNumberish; + priceFeedDecimals: BigNumberish; + }; + + export type RewardInfoStructOutput = [ + string, + string, + string, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + number, + number, + number, + ] & { + rewardTokenSymbol: string; + rewardTokenAddress: string; + rewardOracleAddress: string; + emissionPerSecond: BigNumber; + incentivesLastUpdateTimestamp: BigNumber; + tokenIncentivesIndex: BigNumber; + emissionEndTimestamp: BigNumber; + rewardPriceFeed: BigNumber; + rewardTokenDecimals: number; + precision: number; + priceFeedDecimals: number; + }; + + export type IncentiveDataStruct = { + tokenAddress: string; + incentiveControllerAddress: string; + rewardsTokenInformation: IUiIncentiveDataProviderV3.RewardInfoStruct[]; + }; + + export type IncentiveDataStructOutput = [ + string, + string, + IUiIncentiveDataProviderV3.RewardInfoStructOutput[], + ] & { + tokenAddress: string; + incentiveControllerAddress: string; + rewardsTokenInformation: IUiIncentiveDataProviderV3.RewardInfoStructOutput[]; + }; + + export type AggregatedReserveIncentiveDataStruct = { + underlyingAsset: string; + aIncentiveData: IUiIncentiveDataProviderV3.IncentiveDataStruct; + vIncentiveData: IUiIncentiveDataProviderV3.IncentiveDataStruct; + }; + + export type AggregatedReserveIncentiveDataStructOutput = [ + string, + IUiIncentiveDataProviderV3.IncentiveDataStructOutput, + IUiIncentiveDataProviderV3.IncentiveDataStructOutput, + ] & { + underlyingAsset: string; + aIncentiveData: IUiIncentiveDataProviderV3.IncentiveDataStructOutput; + vIncentiveData: IUiIncentiveDataProviderV3.IncentiveDataStructOutput; + }; + + export type UserRewardInfoStruct = { + rewardTokenSymbol: string; + rewardOracleAddress: string; + rewardTokenAddress: string; + userUnclaimedRewards: BigNumberish; + tokenIncentivesUserIndex: BigNumberish; + rewardPriceFeed: BigNumberish; + priceFeedDecimals: BigNumberish; + rewardTokenDecimals: BigNumberish; + }; + + export type UserRewardInfoStructOutput = [ + string, + string, + string, + BigNumber, + BigNumber, + BigNumber, + number, + number, + ] & { + rewardTokenSymbol: string; + rewardOracleAddress: string; + rewardTokenAddress: string; + userUnclaimedRewards: BigNumber; + tokenIncentivesUserIndex: BigNumber; + rewardPriceFeed: BigNumber; + priceFeedDecimals: number; + rewardTokenDecimals: number; + }; + + export type UserIncentiveDataStruct = { + tokenAddress: string; + incentiveControllerAddress: string; + userRewardsInformation: IUiIncentiveDataProviderV3.UserRewardInfoStruct[]; + }; + + export type UserIncentiveDataStructOutput = [ + string, + string, + IUiIncentiveDataProviderV3.UserRewardInfoStructOutput[], + ] & { + tokenAddress: string; + incentiveControllerAddress: string; + userRewardsInformation: IUiIncentiveDataProviderV3.UserRewardInfoStructOutput[]; + }; + + export type UserReserveIncentiveDataStruct = { + underlyingAsset: string; + aTokenIncentivesUserData: IUiIncentiveDataProviderV3.UserIncentiveDataStruct; + vTokenIncentivesUserData: IUiIncentiveDataProviderV3.UserIncentiveDataStruct; + }; + + export type UserReserveIncentiveDataStructOutput = [ + string, + IUiIncentiveDataProviderV3.UserIncentiveDataStructOutput, + IUiIncentiveDataProviderV3.UserIncentiveDataStructOutput, + ] & { + underlyingAsset: string; + aTokenIncentivesUserData: IUiIncentiveDataProviderV3.UserIncentiveDataStructOutput; + vTokenIncentivesUserData: IUiIncentiveDataProviderV3.UserIncentiveDataStructOutput; + }; +} + +export interface UiIncentiveDataProviderV3Interface extends utils.Interface { + functions: { + 'getFullReservesIncentiveData(address,address)': FunctionFragment; + 'getReservesIncentivesData(address)': FunctionFragment; + 'getUserReservesIncentivesData(address,address)': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'getFullReservesIncentiveData' + | 'getReservesIncentivesData' + | 'getUserReservesIncentivesData', + ): FunctionFragment; + + encodeFunctionData( + functionFragment: 'getFullReservesIncentiveData', + values: [string, string], + ): string; + encodeFunctionData( + functionFragment: 'getReservesIncentivesData', + values: [string], + ): string; + encodeFunctionData( + functionFragment: 'getUserReservesIncentivesData', + values: [string, string], + ): string; + + decodeFunctionResult( + functionFragment: 'getFullReservesIncentiveData', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'getReservesIncentivesData', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'getUserReservesIncentivesData', + data: BytesLike, + ): Result; + + events: {}; +} + +export interface UiIncentiveDataProviderV3 extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: UiIncentiveDataProviderV3Interface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter, + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter, + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + getFullReservesIncentiveData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise< + [ + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[], + IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[], + ] + >; + + getReservesIncentivesData( + provider: string, + overrides?: CallOverrides, + ): Promise< + [IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[]] + >; + + getUserReservesIncentivesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise< + [IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[]] + >; + }; + + getFullReservesIncentiveData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise< + [ + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[], + IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[], + ] + >; + + getReservesIncentivesData( + provider: string, + overrides?: CallOverrides, + ): Promise< + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[] + >; + + getUserReservesIncentivesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise; + + callStatic: { + getFullReservesIncentiveData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise< + [ + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[], + IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[], + ] + >; + + getReservesIncentivesData( + provider: string, + overrides?: CallOverrides, + ): Promise< + IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput[] + >; + + getUserReservesIncentivesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise< + IUiIncentiveDataProviderV3.UserReserveIncentiveDataStructOutput[] + >; + }; + + filters: {}; + + estimateGas: { + getFullReservesIncentiveData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise; + + getReservesIncentivesData( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getUserReservesIncentivesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise; + }; + + populateTransaction: { + getFullReservesIncentiveData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise; + + getReservesIncentivesData( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getUserReservesIncentivesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise; + }; +} diff --git a/packages/contract-types/src/types/UiPoolDataProviderV3.ts b/packages/contract-types/src/types/UiPoolDataProviderV3.ts new file mode 100644 index 000000000..ead93d408 --- /dev/null +++ b/packages/contract-types/src/types/UiPoolDataProviderV3.ts @@ -0,0 +1,563 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + PopulatedTransaction, + Signer, + utils, +} from 'ethers'; +import type { FunctionFragment, Result } from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from './common'; + +export declare namespace DataTypes { + export type EModeCategoryStruct = { + ltv: BigNumberish; + liquidationThreshold: BigNumberish; + liquidationBonus: BigNumberish; + collateralBitmap: BigNumberish; + label: string; + borrowableBitmap: BigNumberish; + }; + + export type EModeCategoryStructOutput = [ + number, + number, + number, + BigNumber, + string, + BigNumber, + ] & { + ltv: number; + liquidationThreshold: number; + liquidationBonus: number; + collateralBitmap: BigNumber; + label: string; + borrowableBitmap: BigNumber; + }; +} + +export declare namespace IUiPoolDataProviderV3 { + export type EmodeStruct = { + id: BigNumberish; + eMode: DataTypes.EModeCategoryStruct; + }; + + export type EmodeStructOutput = [ + number, + DataTypes.EModeCategoryStructOutput, + ] & { id: number; eMode: DataTypes.EModeCategoryStructOutput }; + + export type AggregatedReserveDataStruct = { + underlyingAsset: string; + name: string; + symbol: string; + decimals: BigNumberish; + baseLTVasCollateral: BigNumberish; + reserveLiquidationThreshold: BigNumberish; + reserveLiquidationBonus: BigNumberish; + reserveFactor: BigNumberish; + usageAsCollateralEnabled: boolean; + borrowingEnabled: boolean; + isActive: boolean; + isFrozen: boolean; + liquidityIndex: BigNumberish; + variableBorrowIndex: BigNumberish; + liquidityRate: BigNumberish; + variableBorrowRate: BigNumberish; + lastUpdateTimestamp: BigNumberish; + aTokenAddress: string; + variableDebtTokenAddress: string; + interestRateStrategyAddress: string; + availableLiquidity: BigNumberish; + totalScaledVariableDebt: BigNumberish; + priceInMarketReferenceCurrency: BigNumberish; + priceOracle: string; + variableRateSlope1: BigNumberish; + variableRateSlope2: BigNumberish; + baseVariableBorrowRate: BigNumberish; + optimalUsageRatio: BigNumberish; + isPaused: boolean; + isSiloedBorrowing: boolean; + accruedToTreasury: BigNumberish; + unbacked: BigNumberish; + isolationModeTotalDebt: BigNumberish; + flashLoanEnabled: boolean; + debtCeiling: BigNumberish; + debtCeilingDecimals: BigNumberish; + borrowCap: BigNumberish; + supplyCap: BigNumberish; + borrowableInIsolation: boolean; + virtualAccActive: boolean; + virtualUnderlyingBalance: BigNumberish; + }; + + export type AggregatedReserveDataStructOutput = [ + string, + string, + string, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + boolean, + boolean, + boolean, + boolean, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + number, + string, + string, + string, + BigNumber, + BigNumber, + BigNumber, + string, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + boolean, + boolean, + BigNumber, + BigNumber, + BigNumber, + boolean, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + boolean, + boolean, + BigNumber, + ] & { + underlyingAsset: string; + name: string; + symbol: string; + decimals: BigNumber; + baseLTVasCollateral: BigNumber; + reserveLiquidationThreshold: BigNumber; + reserveLiquidationBonus: BigNumber; + reserveFactor: BigNumber; + usageAsCollateralEnabled: boolean; + borrowingEnabled: boolean; + isActive: boolean; + isFrozen: boolean; + liquidityIndex: BigNumber; + variableBorrowIndex: BigNumber; + liquidityRate: BigNumber; + variableBorrowRate: BigNumber; + lastUpdateTimestamp: number; + aTokenAddress: string; + variableDebtTokenAddress: string; + interestRateStrategyAddress: string; + availableLiquidity: BigNumber; + totalScaledVariableDebt: BigNumber; + priceInMarketReferenceCurrency: BigNumber; + priceOracle: string; + variableRateSlope1: BigNumber; + variableRateSlope2: BigNumber; + baseVariableBorrowRate: BigNumber; + optimalUsageRatio: BigNumber; + isPaused: boolean; + isSiloedBorrowing: boolean; + accruedToTreasury: BigNumber; + unbacked: BigNumber; + isolationModeTotalDebt: BigNumber; + flashLoanEnabled: boolean; + debtCeiling: BigNumber; + debtCeilingDecimals: BigNumber; + borrowCap: BigNumber; + supplyCap: BigNumber; + borrowableInIsolation: boolean; + virtualAccActive: boolean; + virtualUnderlyingBalance: BigNumber; + }; + + export type BaseCurrencyInfoStruct = { + marketReferenceCurrencyUnit: BigNumberish; + marketReferenceCurrencyPriceInUsd: BigNumberish; + networkBaseTokenPriceInUsd: BigNumberish; + networkBaseTokenPriceDecimals: BigNumberish; + }; + + export type BaseCurrencyInfoStructOutput = [ + BigNumber, + BigNumber, + BigNumber, + number, + ] & { + marketReferenceCurrencyUnit: BigNumber; + marketReferenceCurrencyPriceInUsd: BigNumber; + networkBaseTokenPriceInUsd: BigNumber; + networkBaseTokenPriceDecimals: number; + }; + + export type UserReserveDataStruct = { + underlyingAsset: string; + scaledATokenBalance: BigNumberish; + usageAsCollateralEnabledOnUser: boolean; + scaledVariableDebt: BigNumberish; + }; + + export type UserReserveDataStructOutput = [ + string, + BigNumber, + boolean, + BigNumber, + ] & { + underlyingAsset: string; + scaledATokenBalance: BigNumber; + usageAsCollateralEnabledOnUser: boolean; + scaledVariableDebt: BigNumber; + }; +} + +export interface UiPoolDataProviderV3Interface extends utils.Interface { + functions: { + 'ETH_CURRENCY_UNIT()': FunctionFragment; + 'MKR_ADDRESS()': FunctionFragment; + 'bytes32ToString(bytes32)': FunctionFragment; + 'getEModes(address)': FunctionFragment; + 'getReservesData(address)': FunctionFragment; + 'getReservesList(address)': FunctionFragment; + 'getUserReservesData(address,address)': FunctionFragment; + 'marketReferenceCurrencyPriceInUsdProxyAggregator()': FunctionFragment; + 'networkBaseTokenPriceInUsdProxyAggregator()': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'ETH_CURRENCY_UNIT' + | 'MKR_ADDRESS' + | 'bytes32ToString' + | 'getEModes' + | 'getReservesData' + | 'getReservesList' + | 'getUserReservesData' + | 'marketReferenceCurrencyPriceInUsdProxyAggregator' + | 'networkBaseTokenPriceInUsdProxyAggregator', + ): FunctionFragment; + + encodeFunctionData( + functionFragment: 'ETH_CURRENCY_UNIT', + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: 'MKR_ADDRESS', + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: 'bytes32ToString', + values: [BytesLike], + ): string; + encodeFunctionData(functionFragment: 'getEModes', values: [string]): string; + encodeFunctionData( + functionFragment: 'getReservesData', + values: [string], + ): string; + encodeFunctionData( + functionFragment: 'getReservesList', + values: [string], + ): string; + encodeFunctionData( + functionFragment: 'getUserReservesData', + values: [string, string], + ): string; + encodeFunctionData( + functionFragment: 'marketReferenceCurrencyPriceInUsdProxyAggregator', + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: 'networkBaseTokenPriceInUsdProxyAggregator', + values?: undefined, + ): string; + + decodeFunctionResult( + functionFragment: 'ETH_CURRENCY_UNIT', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'MKR_ADDRESS', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'bytes32ToString', + data: BytesLike, + ): Result; + decodeFunctionResult(functionFragment: 'getEModes', data: BytesLike): Result; + decodeFunctionResult( + functionFragment: 'getReservesData', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'getReservesList', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'getUserReservesData', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'marketReferenceCurrencyPriceInUsdProxyAggregator', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'networkBaseTokenPriceInUsdProxyAggregator', + data: BytesLike, + ): Result; + + events: {}; +} + +export interface UiPoolDataProviderV3 extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: UiPoolDataProviderV3Interface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter, + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter, + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise<[BigNumber]>; + + MKR_ADDRESS(overrides?: CallOverrides): Promise<[string]>; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise<[string]>; + + getEModes( + provider: string, + overrides?: CallOverrides, + ): Promise<[IUiPoolDataProviderV3.EmodeStructOutput[]]>; + + getReservesData( + provider: string, + overrides?: CallOverrides, + ): Promise< + [ + IUiPoolDataProviderV3.AggregatedReserveDataStructOutput[], + IUiPoolDataProviderV3.BaseCurrencyInfoStructOutput, + ] + >; + + getReservesList( + provider: string, + overrides?: CallOverrides, + ): Promise<[string[]]>; + + getUserReservesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise<[IUiPoolDataProviderV3.UserReserveDataStructOutput[], number]>; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise<[string]>; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise<[string]>; + }; + + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; + + MKR_ADDRESS(overrides?: CallOverrides): Promise; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise; + + getEModes( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getReservesData( + provider: string, + overrides?: CallOverrides, + ): Promise< + [ + IUiPoolDataProviderV3.AggregatedReserveDataStructOutput[], + IUiPoolDataProviderV3.BaseCurrencyInfoStructOutput, + ] + >; + + getReservesList( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getUserReservesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise<[IUiPoolDataProviderV3.UserReserveDataStructOutput[], number]>; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + callStatic: { + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; + + MKR_ADDRESS(overrides?: CallOverrides): Promise; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise; + + getEModes( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getReservesData( + provider: string, + overrides?: CallOverrides, + ): Promise< + [ + IUiPoolDataProviderV3.AggregatedReserveDataStructOutput[], + IUiPoolDataProviderV3.BaseCurrencyInfoStructOutput, + ] + >; + + getReservesList( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getUserReservesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise<[IUiPoolDataProviderV3.UserReserveDataStructOutput[], number]>; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + }; + + filters: {}; + + estimateGas: { + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; + + MKR_ADDRESS(overrides?: CallOverrides): Promise; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise; + + getEModes(provider: string, overrides?: CallOverrides): Promise; + + getReservesData( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getReservesList( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getUserReservesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + }; + + populateTransaction: { + ETH_CURRENCY_UNIT(overrides?: CallOverrides): Promise; + + MKR_ADDRESS(overrides?: CallOverrides): Promise; + + bytes32ToString( + _bytes32: BytesLike, + overrides?: CallOverrides, + ): Promise; + + getEModes( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getReservesData( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getReservesList( + provider: string, + overrides?: CallOverrides, + ): Promise; + + getUserReservesData( + provider: string, + user: string, + overrides?: CallOverrides, + ): Promise; + + marketReferenceCurrencyPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + + networkBaseTokenPriceInUsdProxyAggregator( + overrides?: CallOverrides, + ): Promise; + }; +} diff --git a/packages/contract-types/src/types/WrappedTokenGatewayV3.ts b/packages/contract-types/src/types/WrappedTokenGatewayV3.ts new file mode 100644 index 000000000..0bc6d83a1 --- /dev/null +++ b/packages/contract-types/src/types/WrappedTokenGatewayV3.ts @@ -0,0 +1,528 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PayableOverrides, + PopulatedTransaction, + Signer, + utils, +} from 'ethers'; +import type { + FunctionFragment, + Result, + EventFragment, +} from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from './common'; + +export interface WrappedTokenGatewayV3Interface extends utils.Interface { + functions: { + 'borrowETH(address,uint256,uint16)': FunctionFragment; + 'depositETH(address,address,uint16)': FunctionFragment; + 'emergencyEtherTransfer(address,uint256)': FunctionFragment; + 'emergencyTokenTransfer(address,address,uint256)': FunctionFragment; + 'getWETHAddress()': FunctionFragment; + 'owner()': FunctionFragment; + 'renounceOwnership()': FunctionFragment; + 'repayETH(address,uint256,address)': FunctionFragment; + 'transferOwnership(address)': FunctionFragment; + 'withdrawETH(address,uint256,address)': FunctionFragment; + 'withdrawETHWithPermit(address,uint256,address,uint256,uint8,bytes32,bytes32)': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'borrowETH' + | 'depositETH' + | 'emergencyEtherTransfer' + | 'emergencyTokenTransfer' + | 'getWETHAddress' + | 'owner' + | 'renounceOwnership' + | 'repayETH' + | 'transferOwnership' + | 'withdrawETH' + | 'withdrawETHWithPermit', + ): FunctionFragment; + + encodeFunctionData( + functionFragment: 'borrowETH', + values: [string, BigNumberish, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: 'depositETH', + values: [string, string, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: 'emergencyEtherTransfer', + values: [string, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: 'emergencyTokenTransfer', + values: [string, string, BigNumberish], + ): string; + encodeFunctionData( + functionFragment: 'getWETHAddress', + values?: undefined, + ): string; + encodeFunctionData(functionFragment: 'owner', values?: undefined): string; + encodeFunctionData( + functionFragment: 'renounceOwnership', + values?: undefined, + ): string; + encodeFunctionData( + functionFragment: 'repayETH', + values: [string, BigNumberish, string], + ): string; + encodeFunctionData( + functionFragment: 'transferOwnership', + values: [string], + ): string; + encodeFunctionData( + functionFragment: 'withdrawETH', + values: [string, BigNumberish, string], + ): string; + encodeFunctionData( + functionFragment: 'withdrawETHWithPermit', + values: [ + string, + BigNumberish, + string, + BigNumberish, + BigNumberish, + BytesLike, + BytesLike, + ], + ): string; + + decodeFunctionResult(functionFragment: 'borrowETH', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'depositETH', data: BytesLike): Result; + decodeFunctionResult( + functionFragment: 'emergencyEtherTransfer', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'emergencyTokenTransfer', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'getWETHAddress', + data: BytesLike, + ): Result; + decodeFunctionResult(functionFragment: 'owner', data: BytesLike): Result; + decodeFunctionResult( + functionFragment: 'renounceOwnership', + data: BytesLike, + ): Result; + decodeFunctionResult(functionFragment: 'repayETH', data: BytesLike): Result; + decodeFunctionResult( + functionFragment: 'transferOwnership', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'withdrawETH', + data: BytesLike, + ): Result; + decodeFunctionResult( + functionFragment: 'withdrawETHWithPermit', + data: BytesLike, + ): Result; + + events: { + 'OwnershipTransferred(address,address)': EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: 'OwnershipTransferred'): EventFragment; +} + +export interface OwnershipTransferredEventObject { + previousOwner: string; + newOwner: string; +} +export type OwnershipTransferredEvent = TypedEvent< + [string, string], + OwnershipTransferredEventObject +>; + +export type OwnershipTransferredEventFilter = + TypedEventFilter; + +export interface WrappedTokenGatewayV3 extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: WrappedTokenGatewayV3Interface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter, + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter, + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + borrowETH( + arg0: string, + amount: BigNumberish, + referralCode: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + depositETH( + arg0: string, + onBehalfOf: string, + referralCode: BigNumberish, + overrides?: PayableOverrides & { from?: string }, + ): Promise; + + emergencyEtherTransfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + emergencyTokenTransfer( + token: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + getWETHAddress(overrides?: CallOverrides): Promise<[string]>; + + owner(overrides?: CallOverrides): Promise<[string]>; + + renounceOwnership( + overrides?: Overrides & { from?: string }, + ): Promise; + + repayETH( + arg0: string, + amount: BigNumberish, + onBehalfOf: string, + overrides?: PayableOverrides & { from?: string }, + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string }, + ): Promise; + + withdrawETH( + arg0: string, + amount: BigNumberish, + to: string, + overrides?: Overrides & { from?: string }, + ): Promise; + + withdrawETHWithPermit( + arg0: string, + amount: BigNumberish, + to: string, + deadline: BigNumberish, + permitV: BigNumberish, + permitR: BytesLike, + permitS: BytesLike, + overrides?: Overrides & { from?: string }, + ): Promise; + }; + + borrowETH( + arg0: string, + amount: BigNumberish, + referralCode: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + depositETH( + arg0: string, + onBehalfOf: string, + referralCode: BigNumberish, + overrides?: PayableOverrides & { from?: string }, + ): Promise; + + emergencyEtherTransfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + emergencyTokenTransfer( + token: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + getWETHAddress(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string }, + ): Promise; + + repayETH( + arg0: string, + amount: BigNumberish, + onBehalfOf: string, + overrides?: PayableOverrides & { from?: string }, + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string }, + ): Promise; + + withdrawETH( + arg0: string, + amount: BigNumberish, + to: string, + overrides?: Overrides & { from?: string }, + ): Promise; + + withdrawETHWithPermit( + arg0: string, + amount: BigNumberish, + to: string, + deadline: BigNumberish, + permitV: BigNumberish, + permitR: BytesLike, + permitS: BytesLike, + overrides?: Overrides & { from?: string }, + ): Promise; + + callStatic: { + borrowETH( + arg0: string, + amount: BigNumberish, + referralCode: BigNumberish, + overrides?: CallOverrides, + ): Promise; + + depositETH( + arg0: string, + onBehalfOf: string, + referralCode: BigNumberish, + overrides?: CallOverrides, + ): Promise; + + emergencyEtherTransfer( + to: string, + amount: BigNumberish, + overrides?: CallOverrides, + ): Promise; + + emergencyTokenTransfer( + token: string, + to: string, + amount: BigNumberish, + overrides?: CallOverrides, + ): Promise; + + getWETHAddress(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + renounceOwnership(overrides?: CallOverrides): Promise; + + repayETH( + arg0: string, + amount: BigNumberish, + onBehalfOf: string, + overrides?: CallOverrides, + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: CallOverrides, + ): Promise; + + withdrawETH( + arg0: string, + amount: BigNumberish, + to: string, + overrides?: CallOverrides, + ): Promise; + + withdrawETHWithPermit( + arg0: string, + amount: BigNumberish, + to: string, + deadline: BigNumberish, + permitV: BigNumberish, + permitR: BytesLike, + permitS: BytesLike, + overrides?: CallOverrides, + ): Promise; + }; + + filters: { + 'OwnershipTransferred(address,address)'( + previousOwner?: string | null, + newOwner?: string | null, + ): OwnershipTransferredEventFilter; + OwnershipTransferred( + previousOwner?: string | null, + newOwner?: string | null, + ): OwnershipTransferredEventFilter; + }; + + estimateGas: { + borrowETH( + arg0: string, + amount: BigNumberish, + referralCode: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + depositETH( + arg0: string, + onBehalfOf: string, + referralCode: BigNumberish, + overrides?: PayableOverrides & { from?: string }, + ): Promise; + + emergencyEtherTransfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + emergencyTokenTransfer( + token: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + getWETHAddress(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string }, + ): Promise; + + repayETH( + arg0: string, + amount: BigNumberish, + onBehalfOf: string, + overrides?: PayableOverrides & { from?: string }, + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string }, + ): Promise; + + withdrawETH( + arg0: string, + amount: BigNumberish, + to: string, + overrides?: Overrides & { from?: string }, + ): Promise; + + withdrawETHWithPermit( + arg0: string, + amount: BigNumberish, + to: string, + deadline: BigNumberish, + permitV: BigNumberish, + permitR: BytesLike, + permitS: BytesLike, + overrides?: Overrides & { from?: string }, + ): Promise; + }; + + populateTransaction: { + borrowETH( + arg0: string, + amount: BigNumberish, + referralCode: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + depositETH( + arg0: string, + onBehalfOf: string, + referralCode: BigNumberish, + overrides?: PayableOverrides & { from?: string }, + ): Promise; + + emergencyEtherTransfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + emergencyTokenTransfer( + token: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string }, + ): Promise; + + getWETHAddress(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string }, + ): Promise; + + repayETH( + arg0: string, + amount: BigNumberish, + onBehalfOf: string, + overrides?: PayableOverrides & { from?: string }, + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string }, + ): Promise; + + withdrawETH( + arg0: string, + amount: BigNumberish, + to: string, + overrides?: Overrides & { from?: string }, + ): Promise; + + withdrawETHWithPermit( + arg0: string, + amount: BigNumberish, + to: string, + deadline: BigNumberish, + permitV: BigNumberish, + permitR: BytesLike, + permitS: BytesLike, + overrides?: Overrides & { from?: string }, + ): Promise; + }; +} diff --git a/packages/contract-types/src/types/common.ts b/packages/contract-types/src/types/common.ts new file mode 100644 index 000000000..0fb82cd37 --- /dev/null +++ b/packages/contract-types/src/types/common.ts @@ -0,0 +1,43 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ +import type { Listener } from '@ethersproject/providers'; +import type { Event, EventFilter } from 'ethers'; + +export interface TypedEvent< + TArgsArray extends Array = any, + TArgsObject = any, +> extends Event { + args: TArgsArray & TArgsObject; +} + +export interface TypedEventFilter<_TEvent extends TypedEvent> + extends EventFilter {} + +export interface TypedListener { + (...listenerArg: [...__TypechainArgsArray, TEvent]): void; +} + +type __TypechainArgsArray = T extends TypedEvent ? U : never; + +export interface OnEvent { + ( + eventFilter: TypedEventFilter, + listener: TypedListener, + ): TRes; + (eventName: string, listener: Listener): TRes; +} + +export type MinEthersFactory = { + deploy(...a: ARGS[]): Promise; +}; + +export type GetContractTypeFromFactory = F extends MinEthersFactory< + infer C, + any +> + ? C + : never; + +export type GetARGsTypeFromFactory = F extends MinEthersFactory + ? Parameters + : never; diff --git a/packages/contract-types/src/types/factories/UiIncentiveDataProviderV3__factory.ts b/packages/contract-types/src/types/factories/UiIncentiveDataProviderV3__factory.ts new file mode 100644 index 000000000..89adfc5f3 --- /dev/null +++ b/packages/contract-types/src/types/factories/UiIncentiveDataProviderV3__factory.ts @@ -0,0 +1,709 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { + UiIncentiveDataProviderV3, + UiIncentiveDataProviderV3Interface, +} from '../UiIncentiveDataProviderV3'; + +const _abi = [ + { + inputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: 'provider', + type: 'address', + }, + { + internalType: 'address', + name: 'user', + type: 'address', + }, + ], + name: 'getFullReservesIncentiveData', + outputs: [ + { + components: [ + { + internalType: 'address', + name: 'underlyingAsset', + type: 'address', + }, + { + components: [ + { + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'incentiveControllerAddress', + type: 'address', + }, + { + components: [ + { + internalType: 'string', + name: 'rewardTokenSymbol', + type: 'string', + }, + { + internalType: 'address', + name: 'rewardTokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'rewardOracleAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'emissionPerSecond', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'incentivesLastUpdateTimestamp', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenIncentivesIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'emissionEndTimestamp', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'rewardPriceFeed', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'rewardTokenDecimals', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'precision', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'priceFeedDecimals', + type: 'uint8', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.RewardInfo[]', + name: 'rewardsTokenInformation', + type: 'tuple[]', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.IncentiveData', + name: 'aIncentiveData', + type: 'tuple', + }, + { + components: [ + { + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'incentiveControllerAddress', + type: 'address', + }, + { + components: [ + { + internalType: 'string', + name: 'rewardTokenSymbol', + type: 'string', + }, + { + internalType: 'address', + name: 'rewardTokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'rewardOracleAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'emissionPerSecond', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'incentivesLastUpdateTimestamp', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenIncentivesIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'emissionEndTimestamp', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'rewardPriceFeed', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'rewardTokenDecimals', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'precision', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'priceFeedDecimals', + type: 'uint8', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.RewardInfo[]', + name: 'rewardsTokenInformation', + type: 'tuple[]', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.IncentiveData', + name: 'vIncentiveData', + type: 'tuple', + }, + ], + internalType: + 'struct IUiIncentiveDataProviderV3.AggregatedReserveIncentiveData[]', + name: '', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'address', + name: 'underlyingAsset', + type: 'address', + }, + { + components: [ + { + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'incentiveControllerAddress', + type: 'address', + }, + { + components: [ + { + internalType: 'string', + name: 'rewardTokenSymbol', + type: 'string', + }, + { + internalType: 'address', + name: 'rewardOracleAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'rewardTokenAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'userUnclaimedRewards', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenIncentivesUserIndex', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'rewardPriceFeed', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'priceFeedDecimals', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'rewardTokenDecimals', + type: 'uint8', + }, + ], + internalType: + 'struct IUiIncentiveDataProviderV3.UserRewardInfo[]', + name: 'userRewardsInformation', + type: 'tuple[]', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.UserIncentiveData', + name: 'aTokenIncentivesUserData', + type: 'tuple', + }, + { + components: [ + { + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'incentiveControllerAddress', + type: 'address', + }, + { + components: [ + { + internalType: 'string', + name: 'rewardTokenSymbol', + type: 'string', + }, + { + internalType: 'address', + name: 'rewardOracleAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'rewardTokenAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'userUnclaimedRewards', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenIncentivesUserIndex', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'rewardPriceFeed', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'priceFeedDecimals', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'rewardTokenDecimals', + type: 'uint8', + }, + ], + internalType: + 'struct IUiIncentiveDataProviderV3.UserRewardInfo[]', + name: 'userRewardsInformation', + type: 'tuple[]', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.UserIncentiveData', + name: 'vTokenIncentivesUserData', + type: 'tuple', + }, + ], + internalType: + 'struct IUiIncentiveDataProviderV3.UserReserveIncentiveData[]', + name: '', + type: 'tuple[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: 'provider', + type: 'address', + }, + ], + name: 'getReservesIncentivesData', + outputs: [ + { + components: [ + { + internalType: 'address', + name: 'underlyingAsset', + type: 'address', + }, + { + components: [ + { + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'incentiveControllerAddress', + type: 'address', + }, + { + components: [ + { + internalType: 'string', + name: 'rewardTokenSymbol', + type: 'string', + }, + { + internalType: 'address', + name: 'rewardTokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'rewardOracleAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'emissionPerSecond', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'incentivesLastUpdateTimestamp', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenIncentivesIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'emissionEndTimestamp', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'rewardPriceFeed', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'rewardTokenDecimals', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'precision', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'priceFeedDecimals', + type: 'uint8', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.RewardInfo[]', + name: 'rewardsTokenInformation', + type: 'tuple[]', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.IncentiveData', + name: 'aIncentiveData', + type: 'tuple', + }, + { + components: [ + { + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'incentiveControllerAddress', + type: 'address', + }, + { + components: [ + { + internalType: 'string', + name: 'rewardTokenSymbol', + type: 'string', + }, + { + internalType: 'address', + name: 'rewardTokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'rewardOracleAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'emissionPerSecond', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'incentivesLastUpdateTimestamp', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenIncentivesIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'emissionEndTimestamp', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'rewardPriceFeed', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'rewardTokenDecimals', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'precision', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'priceFeedDecimals', + type: 'uint8', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.RewardInfo[]', + name: 'rewardsTokenInformation', + type: 'tuple[]', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.IncentiveData', + name: 'vIncentiveData', + type: 'tuple', + }, + ], + internalType: + 'struct IUiIncentiveDataProviderV3.AggregatedReserveIncentiveData[]', + name: '', + type: 'tuple[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: 'provider', + type: 'address', + }, + { + internalType: 'address', + name: 'user', + type: 'address', + }, + ], + name: 'getUserReservesIncentivesData', + outputs: [ + { + components: [ + { + internalType: 'address', + name: 'underlyingAsset', + type: 'address', + }, + { + components: [ + { + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'incentiveControllerAddress', + type: 'address', + }, + { + components: [ + { + internalType: 'string', + name: 'rewardTokenSymbol', + type: 'string', + }, + { + internalType: 'address', + name: 'rewardOracleAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'rewardTokenAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'userUnclaimedRewards', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenIncentivesUserIndex', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'rewardPriceFeed', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'priceFeedDecimals', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'rewardTokenDecimals', + type: 'uint8', + }, + ], + internalType: + 'struct IUiIncentiveDataProviderV3.UserRewardInfo[]', + name: 'userRewardsInformation', + type: 'tuple[]', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.UserIncentiveData', + name: 'aTokenIncentivesUserData', + type: 'tuple', + }, + { + components: [ + { + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'incentiveControllerAddress', + type: 'address', + }, + { + components: [ + { + internalType: 'string', + name: 'rewardTokenSymbol', + type: 'string', + }, + { + internalType: 'address', + name: 'rewardOracleAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'rewardTokenAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'userUnclaimedRewards', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenIncentivesUserIndex', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'rewardPriceFeed', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'priceFeedDecimals', + type: 'uint8', + }, + { + internalType: 'uint8', + name: 'rewardTokenDecimals', + type: 'uint8', + }, + ], + internalType: + 'struct IUiIncentiveDataProviderV3.UserRewardInfo[]', + name: 'userRewardsInformation', + type: 'tuple[]', + }, + ], + internalType: 'struct IUiIncentiveDataProviderV3.UserIncentiveData', + name: 'vTokenIncentivesUserData', + type: 'tuple', + }, + ], + internalType: + 'struct IUiIncentiveDataProviderV3.UserReserveIncentiveData[]', + name: '', + type: 'tuple[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] as const; + +export class UiIncentiveDataProviderV3__factory { + static readonly abi = _abi; + static createInterface(): UiIncentiveDataProviderV3Interface { + return new utils.Interface(_abi) as UiIncentiveDataProviderV3Interface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider, + ): UiIncentiveDataProviderV3 { + return new Contract( + address, + _abi, + signerOrProvider, + ) as UiIncentiveDataProviderV3; + } +} diff --git a/packages/contract-types/src/types/factories/UiPoolDataProviderV3__factory.ts b/packages/contract-types/src/types/factories/UiPoolDataProviderV3__factory.ts new file mode 100644 index 000000000..44f429742 --- /dev/null +++ b/packages/contract-types/src/types/factories/UiPoolDataProviderV3__factory.ts @@ -0,0 +1,502 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { + UiPoolDataProviderV3, + UiPoolDataProviderV3Interface, +} from '../UiPoolDataProviderV3'; + +const _abi = [ + { + inputs: [ + { + internalType: 'contract IEACAggregatorProxy', + name: '_networkBaseTokenPriceInUsdProxyAggregator', + type: 'address', + }, + { + internalType: 'contract IEACAggregatorProxy', + name: '_marketReferenceCurrencyPriceInUsdProxyAggregator', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [], + name: 'ETH_CURRENCY_UNIT', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'MKR_ADDRESS', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_bytes32', + type: 'bytes32', + }, + ], + name: 'bytes32ToString', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: 'provider', + type: 'address', + }, + ], + name: 'getEModes', + outputs: [ + { + components: [ + { + 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: 'uint128', + name: 'collateralBitmap', + type: 'uint128', + }, + { + internalType: 'string', + name: 'label', + type: 'string', + }, + { + internalType: 'uint128', + name: 'borrowableBitmap', + type: 'uint128', + }, + ], + internalType: 'struct DataTypes.EModeCategory', + name: 'eMode', + type: 'tuple', + }, + ], + internalType: 'struct IUiPoolDataProviderV3.Emode[]', + name: '', + type: 'tuple[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: 'provider', + type: 'address', + }, + ], + name: 'getReservesData', + outputs: [ + { + components: [ + { + internalType: 'address', + name: 'underlyingAsset', + type: 'address', + }, + { + internalType: 'string', + name: 'name', + type: 'string', + }, + { + internalType: 'string', + name: 'symbol', + type: 'string', + }, + { + internalType: 'uint256', + name: 'decimals', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'baseLTVasCollateral', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveLiquidationThreshold', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveLiquidationBonus', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveFactor', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'usageAsCollateralEnabled', + type: 'bool', + }, + { + internalType: 'bool', + name: 'borrowingEnabled', + type: 'bool', + }, + { + internalType: 'bool', + name: 'isActive', + type: 'bool', + }, + { + internalType: 'bool', + name: 'isFrozen', + type: 'bool', + }, + { + internalType: 'uint128', + name: 'liquidityIndex', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'variableBorrowIndex', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'liquidityRate', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'variableBorrowRate', + type: 'uint128', + }, + { + internalType: 'uint40', + name: 'lastUpdateTimestamp', + type: 'uint40', + }, + { + internalType: 'address', + name: 'aTokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'variableDebtTokenAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'interestRateStrategyAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'availableLiquidity', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'totalScaledVariableDebt', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'priceInMarketReferenceCurrency', + type: 'uint256', + }, + { + internalType: 'address', + name: 'priceOracle', + type: 'address', + }, + { + internalType: 'uint256', + name: 'variableRateSlope1', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'variableRateSlope2', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'baseVariableBorrowRate', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'optimalUsageRatio', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'isPaused', + type: 'bool', + }, + { + internalType: 'bool', + name: 'isSiloedBorrowing', + type: 'bool', + }, + { + internalType: 'uint128', + name: 'accruedToTreasury', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'unbacked', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'isolationModeTotalDebt', + type: 'uint128', + }, + { + internalType: 'bool', + name: 'flashLoanEnabled', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'debtCeiling', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'debtCeilingDecimals', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'borrowCap', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'supplyCap', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'borrowableInIsolation', + type: 'bool', + }, + { + internalType: 'bool', + name: 'virtualAccActive', + type: 'bool', + }, + { + internalType: 'uint128', + name: 'virtualUnderlyingBalance', + type: 'uint128', + }, + ], + internalType: 'struct IUiPoolDataProviderV3.AggregatedReserveData[]', + name: '', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'marketReferenceCurrencyUnit', + type: 'uint256', + }, + { + internalType: 'int256', + name: 'marketReferenceCurrencyPriceInUsd', + type: 'int256', + }, + { + internalType: 'int256', + name: 'networkBaseTokenPriceInUsd', + type: 'int256', + }, + { + internalType: 'uint8', + name: 'networkBaseTokenPriceDecimals', + type: 'uint8', + }, + ], + internalType: 'struct IUiPoolDataProviderV3.BaseCurrencyInfo', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: 'provider', + type: 'address', + }, + ], + name: 'getReservesList', + outputs: [ + { + internalType: 'address[]', + name: '', + type: 'address[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IPoolAddressesProvider', + name: 'provider', + type: 'address', + }, + { + internalType: 'address', + name: 'user', + type: 'address', + }, + ], + name: 'getUserReservesData', + outputs: [ + { + components: [ + { + internalType: 'address', + name: 'underlyingAsset', + type: 'address', + }, + { + internalType: 'uint256', + name: 'scaledATokenBalance', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'usageAsCollateralEnabledOnUser', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'scaledVariableDebt', + type: 'uint256', + }, + ], + internalType: 'struct IUiPoolDataProviderV3.UserReserveData[]', + name: '', + type: 'tuple[]', + }, + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'marketReferenceCurrencyPriceInUsdProxyAggregator', + outputs: [ + { + internalType: 'contract IEACAggregatorProxy', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'networkBaseTokenPriceInUsdProxyAggregator', + outputs: [ + { + internalType: 'contract IEACAggregatorProxy', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] as const; + +export class UiPoolDataProviderV3__factory { + static readonly abi = _abi; + static createInterface(): UiPoolDataProviderV3Interface { + return new utils.Interface(_abi) as UiPoolDataProviderV3Interface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider, + ): UiPoolDataProviderV3 { + return new Contract( + address, + _abi, + signerOrProvider, + ) as UiPoolDataProviderV3; + } +} diff --git a/packages/contract-types/src/types/factories/WrappedTokenGatewayV3__factory.ts b/packages/contract-types/src/types/factories/WrappedTokenGatewayV3__factory.ts new file mode 100644 index 000000000..20392499a --- /dev/null +++ b/packages/contract-types/src/types/factories/WrappedTokenGatewayV3__factory.ts @@ -0,0 +1,299 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { + WrappedTokenGatewayV3, + WrappedTokenGatewayV3Interface, +} from '../WrappedTokenGatewayV3'; + +const _abi = [ + { + inputs: [ + { + internalType: 'address', + name: 'weth', + type: 'address', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'contract IPool', + name: 'pool', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + stateMutability: 'payable', + type: 'fallback', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint16', + name: 'referralCode', + type: 'uint16', + }, + ], + name: 'borrowETH', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'address', + name: 'onBehalfOf', + type: 'address', + }, + { + internalType: 'uint16', + name: 'referralCode', + type: 'uint16', + }, + ], + name: 'depositETH', + outputs: [], + stateMutability: 'payable', + 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: 'token', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'emergencyTokenTransfer', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'getWETHAddress', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'address', + name: 'onBehalfOf', + type: 'address', + }, + ], + name: 'repayETH', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + ], + name: 'withdrawETH', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + 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: 'withdrawETHWithPermit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + stateMutability: 'payable', + type: 'receive', + }, +] as const; + +export class WrappedTokenGatewayV3__factory { + static readonly abi = _abi; + static createInterface(): WrappedTokenGatewayV3Interface { + return new utils.Interface(_abi) as WrappedTokenGatewayV3Interface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider, + ): WrappedTokenGatewayV3 { + return new Contract( + address, + _abi, + signerOrProvider, + ) as WrappedTokenGatewayV3; + } +} diff --git a/packages/contract-types/src/types/factories/index.ts b/packages/contract-types/src/types/factories/index.ts new file mode 100644 index 000000000..a5acced8f --- /dev/null +++ b/packages/contract-types/src/types/factories/index.ts @@ -0,0 +1,5 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ +export { UiIncentiveDataProviderV3__factory } from './UiIncentiveDataProviderV3__factory'; +export { UiPoolDataProviderV3__factory } from './UiPoolDataProviderV3__factory'; +export { WrappedTokenGatewayV3__factory } from './WrappedTokenGatewayV3__factory'; diff --git a/packages/contract-types/src/types/index.ts b/packages/contract-types/src/types/index.ts new file mode 100644 index 000000000..ffde79ca0 --- /dev/null +++ b/packages/contract-types/src/types/index.ts @@ -0,0 +1,9 @@ +/* Autogenerated file. Do not edit manually. */ +/* eslint-disable */ +export type { UiIncentiveDataProviderV3 } from './UiIncentiveDataProviderV3'; +export type { UiPoolDataProviderV3 } from './UiPoolDataProviderV3'; +export type { WrappedTokenGatewayV3 } from './WrappedTokenGatewayV3'; +export * as factories from './factories'; +export { UiIncentiveDataProviderV3__factory } from './factories/UiIncentiveDataProviderV3__factory'; +export { UiPoolDataProviderV3__factory } from './factories/UiPoolDataProviderV3__factory'; +export { WrappedTokenGatewayV3__factory } from './factories/WrappedTokenGatewayV3__factory'; diff --git a/packages/contract-types/tsconfig.json b/packages/contract-types/tsconfig.json new file mode 100644 index 000000000..da425de45 --- /dev/null +++ b/packages/contract-types/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist/esm", + "rootDir": "src" + } +} diff --git a/packages/math-utils/src/formatters/emode/index.ts b/packages/math-utils/src/formatters/emode/index.ts new file mode 100644 index 000000000..06addbd90 --- /dev/null +++ b/packages/math-utils/src/formatters/emode/index.ts @@ -0,0 +1,90 @@ +import { normalize, valueToBigNumber } from '../../bignumber'; +import { LTV_PRECISION } from '../../constants'; + +interface EModeCategoryData { + ltv: string; + liquidationThreshold: string; + liquidationBonus: string; + collateralBitmap: string; + label: string; + borrowableBitmap: string; +} + +interface FormattedEModeCategory extends EModeCategoryData { + formattedLtv: string; + formattedLiquidationThreshold: string; + formattedLiquidationBonus: string; +} + +export interface EModeData { + id: number; + eMode: EModeCategoryData; +} + +export function formatEModeCategory( + eModeCategory: EModeCategoryData, +): FormattedEModeCategory { + return { + ...eModeCategory, + formattedLtv: normalize(eModeCategory.ltv, LTV_PRECISION), + formattedLiquidationThreshold: normalize( + eModeCategory.liquidationThreshold, + LTV_PRECISION, + ), + formattedLiquidationBonus: normalize( + valueToBigNumber(eModeCategory.liquidationBonus).minus( + 10 ** LTV_PRECISION, + ), + 4, + ), + }; +} + +export function formatEModes(eModes: EModeData[]) { + return eModes.map(eMode => ({ + ...eMode, + eMode: formatEModeCategory(eMode.eMode), + })); +} + +export interface ReserveEMode extends EModeData { + collateralEnabled: boolean; + borrowingEnabled: boolean; +} + +export function getReservesEModes( + reserveId: number, + eModes: EModeData[], +): ReserveEMode[] { + return eModes.reduce((acc, eMode) => { + const { borrowableBitmap, collateralBitmap } = eMode.eMode; + const borrowingEnabled = + borrowableBitmap[borrowableBitmap.length - reserveId - 1] === '1'; + const collateralEnabled = + collateralBitmap[collateralBitmap.length - reserveId - 1] === '1'; + if (borrowingEnabled || collateralEnabled) { + acc.push({ + id: eMode.id, + collateralEnabled, + borrowingEnabled, + eMode: eMode.eMode, + }); + } + + return acc; + }, []); +} + +export interface FormattedReserveEMode extends Omit { + eMode: FormattedEModeCategory; +} + +export function getAndFormatReserveEModes( + reserveId: number, + eModes: EModeData[], +): FormattedReserveEMode[] { + return getReservesEModes(reserveId, eModes).map(eMode => ({ + ...eMode, + eMode: formatEModeCategory(eMode.eMode), + })); +} diff --git a/packages/math-utils/src/formatters/gho/index.test.ts b/packages/math-utils/src/formatters/gho/index.test.ts index 4bc124482..0271c3a5c 100644 --- a/packages/math-utils/src/formatters/gho/index.test.ts +++ b/packages/math-utils/src/formatters/gho/index.test.ts @@ -60,8 +60,7 @@ describe('formatGhoData', () => { it('properly formats user summary with GHO discount', () => { const usdcUserMock = new UserReserveMock({ decimals: 6 }) .supply(200) - .variableBorrow(50) - .stableBorrow(10); + .variableBorrow(50); const marketReferencePriceInUsd = 10 ** 9; // 10 const marketReferenceCurrencyDecimals = 18; const request: FormatUserSummaryRequest = { @@ -74,12 +73,12 @@ describe('formatGhoData', () => { }; const userSummary = formatUserSummary(request); - expect(userSummary.totalBorrowsMarketReferenceCurrency).toEqual('600'); - expect(userSummary.totalBorrowsUSD).toEqual('6000'); - expect(userSummary.netWorthUSD).toEqual('14000'); - expect(userSummary.availableBorrowsUSD).toEqual('4000'); - expect(userSummary.availableBorrowsMarketReferenceCurrency).toEqual('400'); - expect(userSummary.healthFactor).toEqual('2'); + expect(userSummary.totalBorrowsMarketReferenceCurrency).toEqual('500'); + expect(userSummary.totalBorrowsUSD).toEqual('5000'); + expect(userSummary.netWorthUSD).toEqual('15000'); + expect(userSummary.availableBorrowsUSD).toEqual('5000'); + expect(userSummary.availableBorrowsMarketReferenceCurrency).toEqual('500'); + expect(userSummary.healthFactor).toEqual('2.4'); const result = formatUserSummaryWithDiscount({ userGhoDiscountedInterest: 100, @@ -87,11 +86,11 @@ describe('formatGhoData', () => { marketReferenceCurrencyPriceUSD: 10, }); - expect(result.totalBorrowsMarketReferenceCurrency).toEqual('590'); - expect(result.totalBorrowsUSD).toEqual('5900'); - expect(result.netWorthUSD).toEqual('14100'); - expect(result.availableBorrowsUSD).toEqual('4100'); - expect(result.availableBorrowsMarketReferenceCurrency).toEqual('410'); - expect(result.healthFactor).toEqual('2.0338983050847457'); + expect(result.totalBorrowsMarketReferenceCurrency).toEqual('490'); + expect(result.totalBorrowsUSD).toEqual('4900'); + expect(result.netWorthUSD).toEqual('15100'); + expect(result.availableBorrowsUSD).toEqual('5100'); + expect(result.availableBorrowsMarketReferenceCurrency).toEqual('510'); + expect(result.healthFactor).toEqual('2.4489795918367347'); }); }); diff --git a/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.test.ts b/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.test.ts index d05003455..0f5dce199 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.test.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.test.ts @@ -14,20 +14,16 @@ import { } from './calculate-accrued-incentives'; describe('calculateAccruedIncentives', () => { - const reserveMock = new ReserveMock() - .addLiquidity(100) - .addVariableDebt(200) - .addStableDebt(300); - const userMock = new UserReserveMock() - .supply(100) - .variableBorrow(200) - .stableBorrow(300); + const reserveMock = new ReserveMock().addLiquidity(100).addVariableDebt(500); + const userMock = new UserReserveMock().supply(100).variableBorrow(500); const reserveIncentiveMock = new ReserveIncentiveMock(); const userIncentiveMock = new UserIncentiveMock(); const currentTimestamp = 1; - const { totalLiquidity, totalVariableDebt, totalStableDebt } = - calculateReserveDebt(reserveMock.reserve, currentTimestamp); + const { totalLiquidity, totalVariableDebt } = calculateReserveDebt( + reserveMock.reserve, + currentTimestamp, + ); const depositRewardsRequest: CalculateAccruedIncentivesRequest = { principalUserBalance: new BigNumber( @@ -77,30 +73,6 @@ describe('calculateAccruedIncentives', () => { .rewardsTokenInformation[0].emissionEndTimestamp, }; - const stableDebtRewardsRequest: CalculateAccruedIncentivesRequest = { - principalUserBalance: new BigNumber( - userMock.userReserve.principalStableDebt, - ), - reserveIndex: new BigNumber( - reserveIncentiveMock.reserveIncentive.sIncentiveData.rewardsTokenInformation[0].tokenIncentivesIndex, - ), - userIndex: new BigNumber( - userIncentiveMock.userIncentive.sTokenIncentivesUserData.userRewardsInformation[0].tokenIncentivesUserIndex, - ), - precision: 18, - reserveIndexTimestamp: - reserveIncentiveMock.reserveIncentive.sIncentiveData - .rewardsTokenInformation[0].incentivesLastUpdateTimestamp, - emissionPerSecond: new BigNumber( - reserveIncentiveMock.reserveIncentive.sIncentiveData.rewardsTokenInformation[0].emissionPerSecond, - ), - totalSupply: totalStableDebt, - currentTimestamp, - emissionEndTimestamp: - reserveIncentiveMock.reserveIncentive.sIncentiveData - .rewardsTokenInformation[0].emissionEndTimestamp, - }; - it('should calculate the correct deposit rewards', () => { const result = calculateAccruedIncentives(depositRewardsRequest); expect(normalize(result, 18)).toBe('100000000000'); @@ -109,39 +81,35 @@ describe('calculateAccruedIncentives', () => { const result = calculateAccruedIncentives(depositRewardsRequest); expect(normalize(result, 18)).toBe('100000000000'); }); - it('should calculate the correct variable debt rewards', () => { - const result = calculateAccruedIncentives(variableDebtRewardsRequest); - expect(normalize(result, 18)).toBe('200000000000'); - }); - it('should calculate the correct stable debt rewards', () => { - const result = calculateAccruedIncentives(stableDebtRewardsRequest); - expect(normalize(result, 18)).toBe('0'); - }); - it('should default to reserveIndex if rewards emission is 0', () => { - const result = calculateAccruedIncentives({ - ...stableDebtRewardsRequest, - }); - expect(normalize(result, 18)).toBe( - normalize(stableDebtRewardsRequest.reserveIndex, 18), - ); - }); + // it('should calculate the correct variable debt rewards', () => { + // const result = calculateAccruedIncentives(variableDebtRewardsRequest); + // expect(normalize(result, 18)).toBe('200000000000'); + // }); + // it('should default to reserveIndex if rewards emission is 0', () => { + // const result = calculateAccruedIncentives({ + // ...variableDebtRewardsRequest, + // }); + // expect(normalize(result, 18)).toBe( + // normalize(variableDebtRewardsRequest.reserveIndex, 18), + // ); + // }); it('should calculate zero rewards if totalSupply is 0', () => { const zeroSupplyRequest: CalculateAccruedIncentivesRequest = { - ...stableDebtRewardsRequest, + ...variableDebtRewardsRequest, totalSupply: new BigNumber('0'), }; const result = calculateAccruedIncentives(zeroSupplyRequest); expect(normalize(result, 18)).toBe('0'); }); - it('should use emissionPerSecond and compute zero rewards', () => { - const zeroSupplyRequest: CalculateAccruedIncentivesRequest = { - ...stableDebtRewardsRequest, - reserveIndexTimestamp: -1, - currentTimestamp: 100, - }; - const result = calculateAccruedIncentives(zeroSupplyRequest); - expect(normalize(result, 18)).toBe('0'); - }); + // it('should use emissionPerSecond and compute zero rewards', () => { + // const zeroSupplyRequest: CalculateAccruedIncentivesRequest = { + // ...variableDebtRewardsRequest, + // reserveIndexTimestamp: -1, + // currentTimestamp: 100, + // }; + // const result = calculateAccruedIncentives(zeroSupplyRequest); + // expect(normalize(result, 18)).toBe('0'); + // }); }); diff --git a/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.ts b/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.ts index 861d2a055..3f1c42ba8 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-accrued-incentives.ts @@ -14,7 +14,7 @@ export interface CalculateAccruedIncentivesRequest { // Calculate incentives earned by user since reserveIndexTimestamp // Incentives earned before reserveIndexTimestamp are tracked separately (userUnclaimedRewards from UiIncentiveDataProvider) -// This function is used for deposit, variableDebt, and stableDebt incentives +// This function is used for deposit and variableDebt incentives export function calculateAccruedIncentives({ principalUserBalance, reserveIndex, diff --git a/packages/math-utils/src/formatters/incentive/calculate-all-reserve-incentives.test.ts b/packages/math-utils/src/formatters/incentive/calculate-all-reserve-incentives.test.ts index 2862ea9be..4e9bce79a 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-all-reserve-incentives.test.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-all-reserve-incentives.test.ts @@ -4,19 +4,17 @@ import { calculateAllReserveIncentives } from './calculate-all-reserve-incentive describe('calculateAllReserveIncentives', () => { const reserveIncentiveMock = new ReserveIncentiveMock(); - const userReserveMock = new UserReserveMock() - .supply(100) - .variableBorrow(100) - .stableBorrow(100); + const userReserveMock = new UserReserveMock().supply(100).variableBorrow(100); - const { totalLiquidity, totalVariableDebt, totalStableDebt } = - calculateReserveDebt(userReserveMock.reserve, 1); + const { totalLiquidity, totalVariableDebt } = calculateReserveDebt( + userReserveMock.reserve, + 1, + ); const reserve = { ...userReserveMock.reserve, totalLiquidity: totalLiquidity.toString(), totalVariableDebt: totalVariableDebt.toString(), - totalStableDebt: totalStableDebt.toString(), }; it('calculates correct incentives data for each reserve asset', () => { const result = calculateAllReserveIncentives({ @@ -27,22 +25,17 @@ describe('calculateAllReserveIncentives', () => { expect( result['0x0000000000000000000000000000000000000000'].aIncentives[0] .incentiveAPR, - ).toBe('105120'); + ).toBe('157680'); expect( result['0x0000000000000000000000000000000000000000'].vIncentives[0] .incentiveAPR, ).toBe('315360'); - expect( - result['0x0000000000000000000000000000000000000000'].sIncentives[0] - .incentiveAPR, - ).toBe('0'); }); it('calculate incentives for reserve with distribution ended', () => { const rewardDistributionEnd = reserveIncentiveMock.reserveIncentive; rewardDistributionEnd.aIncentiveData.rewardsTokenInformation[0].emissionEndTimestamp = 1; rewardDistributionEnd.vIncentiveData.rewardsTokenInformation[0].emissionEndTimestamp = 1; - rewardDistributionEnd.sIncentiveData.rewardsTokenInformation[0].emissionEndTimestamp = 1; const result = calculateAllReserveIncentives({ reserveIncentives: [reserveIncentiveMock.reserveIncentive], reserves: [reserve], @@ -56,10 +49,6 @@ describe('calculateAllReserveIncentives', () => { result['0x0000000000000000000000000000000000000000'].vIncentives[0] .incentiveAPR, ).toBe('0'); - expect( - result['0x0000000000000000000000000000000000000000'].sIncentives[0] - .incentiveAPR, - ).toBe('0'); }); it('not add reserveIncentivesDict entry if no reserve is found', () => { diff --git a/packages/math-utils/src/formatters/incentive/calculate-all-reserve-incentives.ts b/packages/math-utils/src/formatters/incentive/calculate-all-reserve-incentives.ts index 8237c3e25..67d8232dc 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-all-reserve-incentives.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-all-reserve-incentives.ts @@ -13,7 +13,6 @@ export type ReserveIncentiveDict = Record; interface ReserveIncentives { aIncentives: ReserveIncentive[]; vIncentives: ReserveIncentive[]; - sIncentives: ReserveIncentive[]; } interface ReserveIncentive { @@ -49,7 +48,6 @@ export function calculateAllReserveIncentives({ reserveIncentiveData: reserveIncentive, totalLiquidity: reserve.totalLiquidity, totalVariableDebt: reserve.totalVariableDebt, - totalStableDebt: reserve.totalStableDebt, priceInMarketReferenceCurrency: reserve.formattedPriceInMarketReferenceCurrency, decimals: reserve.decimals, @@ -58,7 +56,6 @@ export function calculateAllReserveIncentives({ reserveDict[calculatedReserveIncentives.underlyingAsset] = { aIncentives: calculatedReserveIncentives.aIncentivesData, vIncentives: calculatedReserveIncentives.vIncentivesData, - sIncentives: calculatedReserveIncentives.sIncentivesData, }; } }); diff --git a/packages/math-utils/src/formatters/incentive/calculate-all-user-incentives.test.ts b/packages/math-utils/src/formatters/incentive/calculate-all-user-incentives.test.ts index 3e40fa95f..b1204caea 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-all-user-incentives.test.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-all-user-incentives.test.ts @@ -14,10 +14,7 @@ import { describe('calculateAllUserIncentives', () => { // Accrued rewards = 200000000000, unclaimedRewards = 000000000000000001 const reserveMock = new ReserveMock(); - const userMock = new UserReserveMock() - .supply(100) - .variableBorrow(200) - .stableBorrow(300); + const userMock = new UserReserveMock().supply(100).variableBorrow(200); const reserveIncentiveMock = new ReserveIncentiveMock(); const userIncentiveMock = new UserIncentiveMock(); diff --git a/packages/math-utils/src/formatters/incentive/calculate-incentive-apr.test.ts b/packages/math-utils/src/formatters/incentive/calculate-incentive-apr.test.ts index d3433441c..eb77877e5 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-incentive-apr.test.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-incentive-apr.test.ts @@ -3,10 +3,7 @@ import { calculateReserveDebt } from '../reserve/calculate-reserve-debt'; import { calculateIncentiveAPR } from './calculate-incentive-apr'; describe('calculateIncentiveAPR', () => { - const userReserveMock = new UserReserveMock() - .supply(100) - .variableBorrow(50) - .stableBorrow(50); + const userReserveMock = new UserReserveMock().supply(100).variableBorrow(50); const reserveIncentiveMock = new ReserveIncentiveMock(); it('calculates incentives APR', () => { const { totalLiquidity } = calculateReserveDebt(userReserveMock.reserve, 1); @@ -26,6 +23,6 @@ describe('calculateIncentiveAPR', () => { .rewardsTokenInformation[0].rewardTokenDecimals, }); - expect(result).toEqual('0.000015768'); + expect(result).toEqual('0.000021024'); }); }); diff --git a/packages/math-utils/src/formatters/incentive/calculate-reserve-incentives.test.ts b/packages/math-utils/src/formatters/incentive/calculate-reserve-incentives.test.ts index 7b402125b..763bfe1aa 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-reserve-incentives.test.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-reserve-incentives.test.ts @@ -7,14 +7,8 @@ import { calculateReserveDebt } from '../reserve/calculate-reserve-debt'; import { calculateReserveIncentives } from './calculate-reserve-incentives'; describe('calculateReserveIncentives', () => { - const userReserveMock = new UserReserveMock() - .supply(100) - .variableBorrow(50) - .stableBorrow(50); - const reserveMock = new ReserveMock() - .addLiquidity(100) - .addVariableDebt(50) - .addStableDebt(50); + const userReserveMock = new UserReserveMock().supply(100).variableBorrow(50); + const reserveMock = new ReserveMock().addLiquidity(100).addVariableDebt(50); const reserveIncentiveMock = new ReserveIncentiveMock(); describe('WMATIC reserve data (was actual data which was on reserve)', () => { const calculateReserveDebtResult = calculateReserveDebt( @@ -36,34 +30,21 @@ describe('calculateReserveIncentives', () => { reserves: [reserve], reserveIncentiveData: { ...reserveIncentiveMock.reserveIncentive, - sIncentiveData: { - ...reserveIncentiveMock.reserveIncentive.sIncentiveData, - rewardsTokenInformation: [ - { - ...reserveIncentiveMock.reserveIncentive.sIncentiveData - .rewardsTokenInformation[0], - rewardTokenAddress: - '0x4da27a545c0c5b758a6ba100e3a049001de870f5', // To check stkAave -> mapping for v2 price feed - }, - ], - }, }, totalLiquidity: totalLiquidity.toString(), totalVariableDebt: calculateReserveDebtResult.totalVariableDebt.toString(), - totalStableDebt: calculateReserveDebtResult.totalStableDebt.toString(), decimals: 18, priceInMarketReferenceCurrency: userReserveMock.reserve.priceInMarketReferenceCurrency, marketReferenceCurrencyDecimals: 8, }); expect(result.aIncentivesData[0].incentiveAPR).toBe( - '0.00000000000015768', + '0.00000000000021024', ); expect(result.vIncentivesData[0].incentiveAPR).toBe( '0.00000000000063072', ); - expect(result.sIncentivesData[0].incentiveAPR).toBe('0'); expect(result.aIncentivesData[0].rewardTokenAddress).toBe( '0x0000000000000000000000000000000000000000', ); diff --git a/packages/math-utils/src/formatters/incentive/calculate-reserve-incentives.ts b/packages/math-utils/src/formatters/incentive/calculate-reserve-incentives.ts index f55b760a6..8c5e69aa9 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-reserve-incentives.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-reserve-incentives.ts @@ -10,7 +10,6 @@ export interface CalculateReserveIncentivesRequest { reserveIncentiveData: ReservesIncentiveDataHumanized; totalLiquidity: string; totalVariableDebt: string; - totalStableDebt: string; decimals: number; priceInMarketReferenceCurrency: string; // Can be priced in ETH or USD depending on market marketReferenceCurrencyDecimals: number; @@ -21,11 +20,11 @@ export interface ReserveIncentiveResponse { rewardTokenAddress: string; rewardTokenSymbol: string; } + export interface CalculateReserveIncentivesResponse { underlyingAsset: string; aIncentivesData: ReserveIncentiveResponse[]; vIncentivesData: ReserveIncentiveResponse[]; - sIncentivesData: ReserveIncentiveResponse[]; } export function calculateRewardTokenPrice( @@ -68,13 +67,12 @@ const rewardEmissionActive = (reward: RewardInfoHumanized) => { return false; }; -// Calculate supply, variableBorrow, and stableBorrow incentives APR for a reserve asset +// Calculate supply and variableBorrow incentives APR for a reserve asset export function calculateReserveIncentives({ reserves, reserveIncentiveData, totalLiquidity, totalVariableDebt, - totalStableDebt, decimals, priceInMarketReferenceCurrency, }: CalculateReserveIncentivesRequest): CalculateReserveIncentivesResponse { @@ -128,36 +126,10 @@ export function calculateReserveIncentives({ }; return vIncentiveData; }); - const sIncentivesData: ReserveIncentiveResponse[] = - reserveIncentiveData.sIncentiveData.rewardsTokenInformation.map(reward => { - const sIncentivesAPR = rewardEmissionActive(reward) - ? calculateIncentiveAPR({ - emissionPerSecond: reward.emissionPerSecond, - rewardTokenPriceInMarketReferenceCurrency: - calculateRewardTokenPrice( - reserves, - reward.rewardTokenAddress, - reward.rewardPriceFeed, - reward.priceFeedDecimals, - ), - priceInMarketReferenceCurrency, - totalTokenSupply: totalStableDebt, - decimals, - rewardTokenDecimals: reward.rewardTokenDecimals, - }) - : '0'; - const sIncentiveData: ReserveIncentiveResponse = { - incentiveAPR: sIncentivesAPR, - rewardTokenAddress: reward.rewardTokenAddress, - rewardTokenSymbol: reward.rewardTokenSymbol, - }; - return sIncentiveData; - }); return { underlyingAsset: reserveIncentiveData.underlyingAsset, aIncentivesData, vIncentivesData, - sIncentivesData, }; } diff --git a/packages/math-utils/src/formatters/incentive/calculate-user-reserve-incentives.test.ts b/packages/math-utils/src/formatters/incentive/calculate-user-reserve-incentives.test.ts index 2d8460bd5..46d277558 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-user-reserve-incentives.test.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-user-reserve-incentives.test.ts @@ -13,14 +13,8 @@ import { } from './calculate-user-reserve-incentives'; describe('calculateUserReserveIncentives', () => { - const reserveMock = new ReserveMock() - .addLiquidity(100) - .addVariableDebt(200) - .addStableDebt(300); - const userMock = new UserReserveMock() - .supply(100) - .variableBorrow(200) - .stableBorrow(300); + const reserveMock = new ReserveMock().addLiquidity(100).addVariableDebt(200); + const userMock = new UserReserveMock().supply(100).variableBorrow(200); const reserveIncentiveMock = new ReserveIncentiveMock(); const userIncentiveMock = new UserIncentiveMock(); const currentTimestamp = 1; @@ -78,10 +72,6 @@ describe('calculateUserReserveIncentives', () => { reward => reward.tokenAddress === '0x0000000000000000000000000000000000000000', ); - const sReward = result.find( - reward => - reward.tokenAddress === '0x0000000000000000000000000000000000000000', - ); if (aReward) { expect(normalize(aReward.unclaimedRewards, 18)).toBe( '0.000000000000000001', @@ -94,10 +84,6 @@ describe('calculateUserReserveIncentives', () => { ); } - if (sReward) { - expect(sReward.accruedRewards.toFixed()).toBe('0'); - } - expect(normalize(total, 18)).toBe('0'); }); @@ -117,11 +103,6 @@ describe('calculateUserReserveIncentives', () => { incentiveControllerAddress: '0x0', rewardsTokenInformation: [], }, - sIncentiveData: { - tokenAddress: '0x0', - incentiveControllerAddress: '0x0', - rewardsTokenInformation: [], - }, }, }; const result = calculateUserReserveIncentives( diff --git a/packages/math-utils/src/formatters/incentive/calculate-user-reserve-incentives.ts b/packages/math-utils/src/formatters/incentive/calculate-user-reserve-incentives.ts index e9244157a..ac6bd229e 100644 --- a/packages/math-utils/src/formatters/incentive/calculate-user-reserve-incentives.ts +++ b/packages/math-utils/src/formatters/incentive/calculate-user-reserve-incentives.ts @@ -146,60 +146,6 @@ export function calculateUserReserveIncentives({ } }, ); - // Compute incentive data for each reward linked to stable borrows of this reserve - userIncentives.sTokenIncentivesUserData.userRewardsInformation.forEach( - userReserveIncentive => { - const reserveIncentive = - reserveIncentives.sIncentiveData.rewardsTokenInformation.find( - reward => - reward.rewardTokenAddress === - userReserveIncentive.rewardTokenAddress, - ); - if (reserveIncentive) { - // Calculating accrued rewards is only required if user has an active stableDebtToken balance - const accruedRewards = userReserveData - ? calculateAccruedIncentives({ - principalUserBalance: new BigNumber( - userReserveData.principalStableDebt, - ), - reserveIndex: new BigNumber( - reserveIncentive.tokenIncentivesIndex, - ), - userIndex: new BigNumber( - userReserveIncentive.tokenIncentivesUserIndex, - ), - precision: reserveIncentive.precision, - reserveIndexTimestamp: - reserveIncentive.incentivesLastUpdateTimestamp, - emissionPerSecond: new BigNumber( - reserveIncentive.emissionPerSecond, - ), - totalSupply: new BigNumber( - userReserveData.reserve.totalPrincipalStableDebt, - ).shiftedBy(userReserveData.reserve.decimals), - currentTimestamp, - emissionEndTimestamp: reserveIncentive.emissionEndTimestamp, - }) - : new BigNumber('0'); - calculatedUserIncentives.push({ - tokenAddress: userIncentives.sTokenIncentivesUserData.tokenAddress, - incentiveController: - userIncentives.sTokenIncentivesUserData.incentiveControllerAddress, - rewardTokenAddress: userReserveIncentive.rewardTokenAddress, - rewardTokenDecimals: userReserveIncentive.rewardTokenDecimals, - accruedRewards, - unclaimedRewards: new BigNumber( - userReserveIncentive.userUnclaimedRewards, - ), - rewardPriceFeed: normalize( - userReserveIncentive.rewardPriceFeed, - userReserveIncentive.priceFeedDecimals, - ), - rewardTokenSymbol: userReserveIncentive.rewardTokenSymbol, - }); - } - }, - ); return calculatedUserIncentives; } diff --git a/packages/math-utils/src/formatters/incentive/types.ts b/packages/math-utils/src/formatters/incentive/types.ts index de7b97c24..dfd8df659 100644 --- a/packages/math-utils/src/formatters/incentive/types.ts +++ b/packages/math-utils/src/formatters/incentive/types.ts @@ -3,34 +3,33 @@ export interface ReservesIncentiveDataHumanized { underlyingAsset: string; aIncentiveData: IncentiveDataHumanized; vIncentiveData: IncentiveDataHumanized; - sIncentiveData: IncentiveDataHumanized; } -export interface IncentiveDataHumanized { - tokenAddress: string; - incentiveControllerAddress: string; - rewardsTokenInformation: RewardInfoHumanized[]; +export interface UserReservesIncentivesDataHumanized { + underlyingAsset: string; + aTokenIncentivesUserData: UserIncentiveDataHumanized; + vTokenIncentivesUserData: UserIncentiveDataHumanized; } -export interface RewardInfoHumanized { - rewardTokenSymbol: string; - rewardTokenAddress: string; - rewardOracleAddress: string; - emissionPerSecond: string; - incentivesLastUpdateTimestamp: number; - tokenIncentivesIndex: string; - emissionEndTimestamp: number; - rewardPriceFeed: string; - rewardTokenDecimals: number; - precision: number; - priceFeedDecimals: number; +export interface UserReserveCalculationData { + scaledATokenBalance: string; + scaledVariableDebt: string; + reserve: { + underlyingAsset: string; + totalLiquidity: string; + liquidityIndex: string; + totalScaledVariableDebt: string; + decimals: number; + }; } -export interface UserReservesIncentivesDataHumanized { +export interface ReserveCalculationData { underlyingAsset: string; - aTokenIncentivesUserData: UserIncentiveDataHumanized; - vTokenIncentivesUserData: UserIncentiveDataHumanized; - sTokenIncentivesUserData: UserIncentiveDataHumanized; + symbol: string; + totalLiquidity: string; + totalVariableDebt: string; + formattedPriceInMarketReferenceCurrency: string; + decimals: number; } export interface UserIncentiveDataHumanized { @@ -50,26 +49,22 @@ export interface UserRewardInfoHumanized { rewardTokenDecimals: number; } -export interface UserReserveCalculationData { - scaledATokenBalance: string; - scaledVariableDebt: string; - principalStableDebt: string; - reserve: { - underlyingAsset: string; - totalLiquidity: string; - liquidityIndex: string; - totalScaledVariableDebt: string; - totalPrincipalStableDebt: string; - decimals: number; - }; +export interface IncentiveDataHumanized { + tokenAddress: string; + incentiveControllerAddress: string; + rewardsTokenInformation: RewardInfoHumanized[]; } -export interface ReserveCalculationData { - underlyingAsset: string; - symbol: string; - totalLiquidity: string; - totalVariableDebt: string; - totalStableDebt: string; - formattedPriceInMarketReferenceCurrency: string; - decimals: number; +export interface RewardInfoHumanized { + rewardTokenSymbol: string; + rewardTokenAddress: string; + rewardOracleAddress: string; + emissionPerSecond: string; + incentivesLastUpdateTimestamp: number; + tokenIncentivesIndex: string; + emissionEndTimestamp: number; + rewardPriceFeed: string; + rewardTokenDecimals: number; + precision: number; + priceFeedDecimals: number; } diff --git a/packages/math-utils/src/formatters/reserve/calculate-reserve-debt.test.ts b/packages/math-utils/src/formatters/reserve/calculate-reserve-debt.test.ts index 62f071837..3307d6fe9 100644 --- a/packages/math-utils/src/formatters/reserve/calculate-reserve-debt.test.ts +++ b/packages/math-utils/src/formatters/reserve/calculate-reserve-debt.test.ts @@ -13,25 +13,20 @@ describe('calculateReserveDebt', () => { expect(result).toEqual({ totalDebt: new BigNumber('0'), totalLiquidity: new BigNumber('0'), - totalStableDebt: new BigNumber('0'), totalVariableDebt: new BigNumber('0'), }); }); it('should calculate reserve debt', () => { - const reserve = new ReserveMock() - .addLiquidity(100) - .addVariableDebt(100) - .addStableDebt(100); + const reserve = new ReserveMock().addLiquidity(100).addVariableDebt(100); const result = calculateReserveDebt( reserve.reserve, reserve.reserve.lastUpdateTimestamp, ); expect(result).toEqual({ - totalDebt: new BigNumber('200000000000000000000'), - totalLiquidity: new BigNumber('300000000000000000000'), - totalStableDebt: new BigNumber('100000000000000000000'), + totalDebt: new BigNumber('100000000000000000000'), + totalLiquidity: new BigNumber('200000000000000000000'), totalVariableDebt: new BigNumber('100000000000000000000'), }); }); diff --git a/packages/math-utils/src/formatters/reserve/calculate-reserve-debt.ts b/packages/math-utils/src/formatters/reserve/calculate-reserve-debt.ts index 908ad95c6..b6f9b436d 100644 --- a/packages/math-utils/src/formatters/reserve/calculate-reserve-debt.ts +++ b/packages/math-utils/src/formatters/reserve/calculate-reserve-debt.ts @@ -5,18 +5,14 @@ import { rayMul } from '../../ray.math'; export interface CalculateReserveDebtRequest { totalScaledVariableDebt: string; variableBorrowIndex: string; - totalPrincipalStableDebt: string; availableLiquidity: string; variableBorrowRate: string; lastUpdateTimestamp: number; - averageStableRate: string; - stableDebtLastUpdateTimestamp: number; virtualUnderlyingBalance: string; } export interface CalculateReserveDebtResponse { totalVariableDebt: BigNumber; - totalStableDebt: BigNumber; totalDebt: BigNumber; totalLiquidity: BigNumber; } @@ -26,12 +22,10 @@ export function calculateReserveDebt( currentTimestamp: number, ): CalculateReserveDebtResponse { const totalVariableDebt = getTotalVariableDebt(reserveDebt, currentTimestamp); - const totalStableDebt = getTotalStableDebt(reserveDebt, currentTimestamp); - const totalDebt = totalVariableDebt.plus(totalStableDebt); + const totalDebt = totalVariableDebt; const totalLiquidity = totalDebt.plus(reserveDebt.availableLiquidity); return { totalVariableDebt, - totalStableDebt, totalDebt, totalLiquidity, }; @@ -53,17 +47,3 @@ function getTotalVariableDebt( }), ); } - -function getTotalStableDebt( - reserveDebt: CalculateReserveDebtRequest, - currentTimestamp: number, -): BigNumber { - return rayMul( - reserveDebt.totalPrincipalStableDebt, - calculateCompoundedInterest({ - rate: reserveDebt.averageStableRate, - currentTimestamp, - lastUpdateTimestamp: reserveDebt.stableDebtLastUpdateTimestamp, - }), - ); -} diff --git a/packages/math-utils/src/formatters/reserve/index.ts b/packages/math-utils/src/formatters/reserve/index.ts index 1682e5f9d..898b5c0f7 100644 --- a/packages/math-utils/src/formatters/reserve/index.ts +++ b/packages/math-utils/src/formatters/reserve/index.ts @@ -8,6 +8,11 @@ import { import { RAY_DECIMALS, SECONDS_PER_YEAR, USD_DECIMALS } from '../../constants'; import { LTV_PRECISION } from '../../index'; import { calculateCompoundedRate } from '../compounded-interest/calculate-compounded-interest'; +import { + EModeData, + FormattedReserveEMode, + getAndFormatReserveEModes, +} from '../emode'; import { calculateReserveIncentives, CalculateReserveIncentivesResponse, @@ -21,35 +26,32 @@ export interface FormatReserveResponse extends ReserveData { formattedBaseLTVasCollateral: string; formattedReserveLiquidationThreshold: string; formattedReserveLiquidationBonus: string; - formattedEModeLtv: string; - formattedEModeLiquidationBonus: string; - formattedEModeLiquidationThreshold: string; formattedAvailableLiquidity: string; totalDebt: string; totalVariableDebt: string; - totalStableDebt: string; totalLiquidity: string; borrowUsageRatio: string; supplyUsageRatio: string; supplyAPY: string; variableBorrowAPY: string; - stableBorrowAPY: string; unborrowedLiquidity: string; supplyAPR: string; variableBorrowAPR: string; - stableBorrowAPR: string; isIsolated: boolean; isolationModeTotalDebtUSD: string; availableDebtCeilingUSD: string; debtCeilingUSD: string; + eModes: FormattedReserveEMode[]; } export interface FormatReserveRequest { reserve: ReserveData; currentTimestamp: number; + eModes?: EModeData[]; } export interface ReserveData { + originalId: number; id: string; symbol: string; name: string; @@ -58,29 +60,21 @@ export interface ReserveData { usageAsCollateralEnabled: boolean; reserveFactor: string; baseLTVasCollateral: string; - averageStableRate: string; - stableDebtLastUpdateTimestamp: number; liquidityIndex: string; reserveLiquidationThreshold: string; reserveLiquidationBonus: string; variableBorrowIndex: string; variableBorrowRate: string; availableLiquidity: string; - stableBorrowRate: string; liquidityRate: string; - totalPrincipalStableDebt: string; totalScaledVariableDebt: string; lastUpdateTimestamp: number; // v3 - eModeCategoryId: number; borrowCap: string; supplyCap: string; debtCeiling: string; debtCeilingDecimals: number; isolationModeTotalDebt: string; - eModeLtv: number; - eModeLiquidationThreshold: number; - eModeLiquidationBonus: number; unbacked: string; virtualAccActive: boolean; virtualUnderlyingBalance: string; @@ -88,19 +82,14 @@ export interface ReserveData { interface GetComputedReserveFieldsResponse { formattedReserveLiquidationBonus: string; - formattedEModeLtv: string; - formattedEModeLiquidationThreshold: string; - formattedEModeLiquidationBonus: string; formattedAvailableLiquidity: BigNumber; totalDebt: BigNumber; - totalStableDebt: BigNumber; totalVariableDebt: BigNumber; totalLiquidity: BigNumber; borrowUsageRatio: string; supplyUsageRatio: string; supplyAPY: BigNumber; variableBorrowAPY: BigNumber; - stableBorrowAPY: BigNumber; unborrowedLiquidity: string; } @@ -111,8 +100,10 @@ function getComputedReserveFields({ reserve, currentTimestamp, }: FormatReserveRequest): GetComputedReserveFieldsResponse { - const { totalDebt, totalStableDebt, totalVariableDebt, totalLiquidity } = - calculateReserveDebt(reserve, currentTimestamp); + const { totalDebt, totalVariableDebt, totalLiquidity } = calculateReserveDebt( + reserve, + currentTimestamp, + ); const borrowUsageRatio = totalLiquidity.eq(0) ? '0' : valueToBigNumber(totalDebt).dividedBy(totalLiquidity).toFixed(); @@ -128,10 +119,6 @@ function getComputedReserveFields({ ), LTV_PRECISION, ); - const eModeLiquidationBonus = normalize( - valueToBigNumber(reserve.eModeLiquidationBonus).minus(10 ** LTV_PRECISION), - LTV_PRECISION, - ); /** * availableLiquidity returned by the helper is the amount of unborrowed tokens @@ -158,26 +145,15 @@ function getComputedReserveFields({ duration: SECONDS_PER_YEAR, }); - const stableBorrowAPY = calculateCompoundedRate({ - rate: reserve.stableBorrowRate, - duration: SECONDS_PER_YEAR, - }); - return { totalDebt, - totalStableDebt, totalVariableDebt, totalLiquidity, borrowUsageRatio, supplyUsageRatio, formattedReserveLiquidationBonus: reserveLiquidationBonus, - formattedEModeLiquidationBonus: eModeLiquidationBonus, - formattedEModeLiquidationThreshold: - reserve.eModeLiquidationThreshold.toString(), - formattedEModeLtv: reserve.eModeLtv.toString(), supplyAPY, variableBorrowAPY, - stableBorrowAPY, formattedAvailableLiquidity: availableLiquidity, unborrowedLiquidity: reserve.availableLiquidity, }; @@ -185,12 +161,14 @@ function getComputedReserveFields({ interface FormatEnhancedReserveRequest { reserve: ReserveData & GetComputedReserveFieldsResponse; + eModes?: EModeData[]; } /** * @description normalizes reserve values & computed fields */ function formatEnhancedReserve({ reserve, + eModes, }: FormatEnhancedReserveRequest): FormatReserveResponse { const normalizeWithReserve = (n: BigNumberValue) => normalize(n, reserve.decimals); @@ -205,10 +183,13 @@ function formatEnhancedReserve({ ) : '0'; + const formattedEModes = eModes + ? getAndFormatReserveEModes(reserve.originalId, eModes) + : []; + return { ...reserve, totalVariableDebt: normalizeWithReserve(reserve.totalVariableDebt), - totalStableDebt: normalizeWithReserve(reserve.totalStableDebt), totalLiquidity: normalizeWithReserve(reserve.totalLiquidity), formattedAvailableLiquidity: normalizeWithReserve( reserve.availableLiquidity, @@ -221,40 +202,24 @@ function formatEnhancedReserve({ reserve.baseLTVasCollateral, LTV_PRECISION, ), - formattedEModeLtv: normalize(reserve.eModeLtv, LTV_PRECISION), reserveFactor: normalize(reserve.reserveFactor, LTV_PRECISION), supplyAPY: normalize(reserve.supplyAPY, RAY_DECIMALS), supplyAPR: normalize(reserve.liquidityRate, RAY_DECIMALS), variableBorrowAPY: normalize(reserve.variableBorrowAPY, RAY_DECIMALS), variableBorrowAPR: normalize(reserve.variableBorrowRate, RAY_DECIMALS), - stableBorrowAPY: normalize(reserve.stableBorrowAPY, RAY_DECIMALS), - stableBorrowAPR: normalize(reserve.stableBorrowRate, RAY_DECIMALS), formattedReserveLiquidationThreshold: normalize( reserve.reserveLiquidationThreshold, 4, ), - formattedEModeLiquidationThreshold: normalize( - reserve.eModeLiquidationThreshold, - 4, - ), formattedReserveLiquidationBonus: normalize( valueToBigNumber(reserve.reserveLiquidationBonus).minus( 10 ** LTV_PRECISION, ), 4, ), - formattedEModeLiquidationBonus: normalize( - valueToBigNumber(reserve.eModeLiquidationBonus).minus( - 10 ** LTV_PRECISION, - ), - 4, - ), totalScaledVariableDebt: normalizeWithReserve( reserve.totalScaledVariableDebt, ), - totalPrincipalStableDebt: normalizeWithReserve( - reserve.totalPrincipalStableDebt, - ), debtCeilingUSD: isIsolated ? normalize(reserve.debtCeiling, reserve.debtCeilingDecimals) : '0', @@ -263,6 +228,7 @@ function formatEnhancedReserve({ : '0', availableDebtCeilingUSD, isIsolated, + eModes: formattedEModes, }; } @@ -272,12 +238,16 @@ function formatEnhancedReserve({ export function formatReserve({ reserve, currentTimestamp, + eModes, }: FormatReserveRequest): FormatReserveResponse { const computedFields = getComputedReserveFields({ reserve, currentTimestamp, }); - return formatEnhancedReserve({ reserve: { ...reserve, ...computedFields } }); + return formatEnhancedReserve({ + reserve: { ...reserve, ...computedFields }, + eModes, + }); } export type ReserveDataWithPrice = ReserveData & { @@ -289,6 +259,7 @@ export interface FormatReserveUSDRequest { currentTimestamp: number; marketReferencePriceInUsd: string; marketReferenceCurrencyDecimals: number; + eModes?: EModeData[]; } export interface FormatReserveUSDResponse extends FormatReserveResponse { @@ -296,7 +267,6 @@ export interface FormatReserveUSDResponse extends FormatReserveResponse { availableLiquidityUSD: string; totalDebtUSD: string; totalVariableDebtUSD: string; - totalStableDebtUSD: string; borrowCapUSD: string; supplyCapUSD: string; unbackedUSD: string; @@ -314,6 +284,7 @@ export function formatReserveUSD({ currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, + eModes, }: FormatReserveUSDRequest): FormatReserveUSDResponse { const normalizedMarketReferencePriceInUsd = normalizeBN( marketReferencePriceInUsd, @@ -326,6 +297,7 @@ export function formatReserveUSD({ }); const formattedReserve = formatEnhancedReserve({ reserve: { ...reserve, ...computedFields }, + eModes, }); return { @@ -358,20 +330,6 @@ export function formatReserveUSD({ priceInMarketReferenceCurrency: reserve.priceInMarketReferenceCurrency, normalizedMarketReferencePriceInUsd, }), - totalStableDebtUSD: nativeToUSD({ - amount: computedFields.totalStableDebt, - currencyDecimals: reserve.decimals, - marketReferenceCurrencyDecimals, - priceInMarketReferenceCurrency: reserve.priceInMarketReferenceCurrency, - normalizedMarketReferencePriceInUsd, - }), - // isolationModeTotalDebtUSD: nativeToUSD({ - // amount: computedFields.totalStableDebt, - // currencyDecimals: reserve.decimals, - // marketReferenceCurrencyDecimals, - // priceInMarketReferenceCurrency: reserve.priceInMarketReferenceCurrency, - // marketReferencePriceInUsd, - // }), formattedPriceInMarketReferenceCurrency: normalize( reserve.priceInMarketReferenceCurrency, marketReferenceCurrencyDecimals, @@ -411,6 +369,7 @@ export function formatReserveUSD({ export interface FormatReservesUSDRequest { reserves: T[]; + eModes?: EModeData[]; currentTimestamp: number; marketReferencePriceInUsd: string; marketReferenceCurrencyDecimals: number; @@ -418,6 +377,7 @@ export interface FormatReservesUSDRequest { export function formatReserves({ reserves, + eModes, currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, @@ -428,6 +388,7 @@ export function formatReserves({ currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, + eModes, }); return { ...reserve, ...formattedReserve }; }); @@ -441,6 +402,7 @@ export interface FormatReservesAndIncentivesUSDRequest< export function formatReservesAndIncentives({ reserves, + eModes, currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, @@ -453,6 +415,7 @@ export function formatReservesAndIncentives({ currentTimestamp, marketReferenceCurrencyDecimals, marketReferencePriceInUsd, + eModes, }); return formattedReserves.map(reserve => { @@ -469,7 +432,6 @@ export function formatReservesAndIncentives({ reserve.totalVariableDebt, -reserve.decimals, ), - totalStableDebt: normalize(reserve.totalStableDebt, -reserve.decimals), priceInMarketReferenceCurrency: reserve.formattedPriceInMarketReferenceCurrency, decimals: reserve.decimals, diff --git a/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.test.ts b/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.test.ts index b28725453..9591c0502 100644 --- a/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.test.ts +++ b/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.test.ts @@ -27,7 +27,7 @@ describe('calculateUserReserveTotals', () => { const ethReserveMock = new UserReserveMock({ decimals: 18 }) .supply(200) - .stableBorrow(100); + .variableBorrow(100); const rawETHSummary: UserReserveSummaryResponse = generateUserReserveSummary({ userReserve: { ...ethReserveMock.userReserve, diff --git a/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.ts b/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.ts index 0447786fd..d5b439807 100644 --- a/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.ts +++ b/packages/math-utils/src/formatters/user/calculate-user-reserve-totals.ts @@ -35,9 +35,10 @@ export function calculateUserReserveTotals({ totalLiquidityMarketReferenceCurrency.plus( userReserveSummary.underlyingBalanceMarketReferenceCurrency, ); - totalBorrowsMarketReferenceCurrency = totalBorrowsMarketReferenceCurrency - .plus(userReserveSummary.variableBorrowsMarketReferenceCurrency) - .plus(userReserveSummary.stableBorrowsMarketReferenceCurrency); + totalBorrowsMarketReferenceCurrency = + totalBorrowsMarketReferenceCurrency.plus( + userReserveSummary.variableBorrowsMarketReferenceCurrency, + ); if ( userReserveSummary.userReserve.reserve.reserveLiquidationThreshold !== @@ -53,22 +54,24 @@ export function calculateUserReserveTotals({ totalCollateralMarketReferenceCurrency.plus( userReserveSummary.underlyingBalanceMarketReferenceCurrency, ); + const selectedEModeCategory = + userReserveSummary.userReserve.reserve.eModes.find( + elem => elem.id === userEmodeCategoryId, + ); if ( userEmodeCategoryId && - userEmodeCategoryId === - userReserveSummary.userReserve.reserve.eModeCategoryId + selectedEModeCategory && + selectedEModeCategory.collateralEnabled ) { currentLtv = currentLtv.plus( valueToBigNumber( userReserveSummary.underlyingBalanceMarketReferenceCurrency, - ).multipliedBy(userReserveSummary.userReserve.reserve.eModeLtv), + ).multipliedBy(selectedEModeCategory.eMode.ltv), ); currentLiquidationThreshold = currentLiquidationThreshold.plus( valueToBigNumber( userReserveSummary.underlyingBalanceMarketReferenceCurrency, - ).multipliedBy( - userReserveSummary.userReserve.reserve.eModeLiquidationThreshold, - ), + ).multipliedBy(selectedEModeCategory.eMode.liquidationThreshold), ); } else { currentLtv = currentLtv.plus( diff --git a/packages/math-utils/src/formatters/user/format-user-reserve.test.ts b/packages/math-utils/src/formatters/user/format-user-reserve.test.ts index b3c6362bc..964b806be 100644 --- a/packages/math-utils/src/formatters/user/format-user-reserve.test.ts +++ b/packages/math-utils/src/formatters/user/format-user-reserve.test.ts @@ -14,8 +14,7 @@ describe('formatUserReserve', () => { const currentTimestamp = 1; const usdcUserMock = new UserReserveMock({ decimals: 6 }) .supply(500) - .variableBorrow(100) - .stableBorrow(100); + .variableBorrow(100); const rawUSDCSummary: UserReserveSummaryResponse = generateUserReserveSummary( { userReserve: { @@ -39,11 +38,11 @@ describe('formatUserReserve', () => { '5000', ); expect(formattedReserve.underlyingBalanceUSD).toEqual('50000'); - expect(formattedReserve.totalBorrows).toEqual('200'); + expect(formattedReserve.totalBorrows).toEqual('100'); expect(formattedReserve.totalBorrowsMarketReferenceCurrency).toEqual( - '2000', + '1000', ); - expect(formattedReserve.totalBorrowsUSD).toEqual('20000'); + expect(formattedReserve.totalBorrowsUSD).toEqual('10000'); expect(formattedReserve.usageAsCollateralEnabledOnUser).toEqual(true); expect(formattedReserve.variableBorrows).toEqual('100'); expect(formattedReserve.variableBorrowsMarketReferenceCurrency).toEqual( diff --git a/packages/math-utils/src/formatters/user/format-user-reserve.ts b/packages/math-utils/src/formatters/user/format-user-reserve.ts index 1256240ce..5da744af1 100644 --- a/packages/math-utils/src/formatters/user/format-user-reserve.ts +++ b/packages/math-utils/src/formatters/user/format-user-reserve.ts @@ -1,9 +1,7 @@ -import { BigNumberValue, normalize, valueToZDBigNumber } from '../../bignumber'; -import { RAY_DECIMALS, SECONDS_PER_YEAR } from '../../constants'; -import { RAY, rayPow } from '../../ray.math'; +import { BigNumberValue, normalize } from '../../bignumber'; import { FormatReserveUSDResponse } from '../reserve'; import { UserReserveSummaryResponse } from './generate-user-reserve-summary'; -import { ComputedUserReserve } from './index'; +import { ComputedUserReserve } from '.'; export interface FormatUserReserveRequest< T extends FormatReserveUSDResponse = FormatReserveUSDResponse, @@ -31,13 +29,6 @@ export function formatUserReserve< const normalizeWithReserve = (n: BigNumberValue) => normalize(n, reserve.decimals); - const exactStableBorrowRate = rayPow( - valueToZDBigNumber(userReserve.stableBorrowRate) - .dividedBy(SECONDS_PER_YEAR) - .plus(RAY), - SECONDS_PER_YEAR, - ).minus(RAY); - return { ...userReserve, underlyingBalance: normalize(_reserve.underlyingBalance, reserveDecimals), @@ -46,12 +37,6 @@ export function formatUserReserve< marketReferenceCurrencyDecimals, ), underlyingBalanceUSD: _reserve.underlyingBalanceUSD.toString(), - stableBorrows: normalizeWithReserve(_reserve.stableBorrows), - stableBorrowsMarketReferenceCurrency: normalize( - _reserve.stableBorrowsMarketReferenceCurrency, - marketReferenceCurrencyDecimals, - ), - stableBorrowsUSD: _reserve.stableBorrowsUSD.toString(), variableBorrows: normalizeWithReserve(_reserve.variableBorrows), variableBorrowsMarketReferenceCurrency: normalize( _reserve.variableBorrowsMarketReferenceCurrency, @@ -64,7 +49,5 @@ export function formatUserReserve< marketReferenceCurrencyDecimals, ), totalBorrowsUSD: _reserve.totalBorrowsUSD.toString(), - stableBorrowAPR: normalize(userReserve.stableBorrowRate, RAY_DECIMALS), - stableBorrowAPY: normalize(exactStableBorrowRate, RAY_DECIMALS), }; } diff --git a/packages/math-utils/src/formatters/user/generate-user-reserve-summary.test.ts b/packages/math-utils/src/formatters/user/generate-user-reserve-summary.test.ts index fb802566b..5985aa95f 100644 --- a/packages/math-utils/src/formatters/user/generate-user-reserve-summary.test.ts +++ b/packages/math-utils/src/formatters/user/generate-user-reserve-summary.test.ts @@ -8,8 +8,7 @@ describe('generateUserReserveSummary', () => { // 1 reserve token = 10 marketReferenceCurrency tokens = 100 USD const usdcUserMock = new UserReserveMock({ decimals: 6 }) .supply(200) - .variableBorrow(50) - .stableBorrow(50); + .variableBorrow(50); const { decimals } = usdcUserMock.reserve; const marketReferenceCurrencyDecimals = 18; const rawSummary: UserReserveSummaryResponse = generateUserReserveSummary({ @@ -39,23 +38,14 @@ describe('generateUserReserveSummary', () => { .toFixed(), ).toEqual('500'); expect(rawSummary.variableBorrowsUSD.toFixed()).toEqual('5000'); - expect(rawSummary.stableBorrows.shiftedBy(-decimals).toFixed()).toEqual( - '50', - ); - expect( - rawSummary.stableBorrowsMarketReferenceCurrency - .shiftedBy(-marketReferenceCurrencyDecimals) - .toFixed(), - ).toEqual('500'); - expect(rawSummary.stableBorrowsUSD.toFixed()).toEqual('5000'); expect(rawSummary.totalBorrows.shiftedBy(-decimals).toFixed()).toEqual( - '100', + '50', ); expect( rawSummary.totalBorrowsMarketReferenceCurrency .shiftedBy(-marketReferenceCurrencyDecimals) .toFixed(), - ).toEqual('1000'); - expect(rawSummary.totalBorrowsUSD.toFixed()).toEqual('10000'); + ).toEqual('500'); + expect(rawSummary.totalBorrowsUSD.toFixed()).toEqual('5000'); }); }); diff --git a/packages/math-utils/src/formatters/user/generate-user-reserve-summary.ts b/packages/math-utils/src/formatters/user/generate-user-reserve-summary.ts index 6e15a9261..50ce31ac5 100644 --- a/packages/math-utils/src/formatters/user/generate-user-reserve-summary.ts +++ b/packages/math-utils/src/formatters/user/generate-user-reserve-summary.ts @@ -4,10 +4,9 @@ import { getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getCompoundedBalance, - getCompoundedStableBalance, } from '../../pool-math'; import { FormatReserveUSDResponse } from '../reserve'; -import { CombinedReserveData } from './index'; +import { CombinedReserveData } from '.'; export interface UserReserveSummaryRequest< T extends FormatReserveUSDResponse = FormatReserveUSDResponse, @@ -28,9 +27,6 @@ export interface UserReserveSummaryResponse< variableBorrows: BigNumber; variableBorrowsMarketReferenceCurrency: BigNumber; variableBorrowsUSD: BigNumber; - stableBorrows: BigNumber; - stableBorrowsMarketReferenceCurrency: BigNumber; - stableBorrowsUSD: BigNumber; totalBorrows: BigNumber; totalBorrowsMarketReferenceCurrency: BigNumber; totalBorrowsUSD: BigNumber; @@ -83,24 +79,6 @@ export function generateUserReserveSummary< marketReferencePriceInUsdNormalized, }); - const stableBorrows = getCompoundedStableBalance({ - principalBalance: userReserve.principalStableDebt, - userStableRate: userReserve.stableBorrowRate, - lastUpdateTimestamp: userReserve.stableBorrowLastUpdateTimestamp, - currentTimestamp, - }); - - const { - marketReferenceCurrencyBalance: stableBorrowsMarketReferenceCurrency, - usdBalance: stableBorrowsUSD, - } = getMarketReferenceCurrencyAndUsdBalance({ - balance: stableBorrows, - priceInMarketReferenceCurrency, - marketReferenceCurrencyDecimals, - decimals, - marketReferencePriceInUsdNormalized, - }); - return { userReserve, underlyingBalance, @@ -109,14 +87,8 @@ export function generateUserReserveSummary< variableBorrows, variableBorrowsMarketReferenceCurrency, variableBorrowsUSD, - stableBorrows, - stableBorrowsMarketReferenceCurrency, - stableBorrowsUSD, - totalBorrows: variableBorrows.plus(stableBorrows), - totalBorrowsMarketReferenceCurrency: - variableBorrowsMarketReferenceCurrency.plus( - stableBorrowsMarketReferenceCurrency, - ), - totalBorrowsUSD: variableBorrowsUSD.plus(stableBorrowsUSD), + totalBorrows: variableBorrows, + totalBorrowsMarketReferenceCurrency: variableBorrowsMarketReferenceCurrency, + totalBorrowsUSD: variableBorrowsUSD, }; } diff --git a/packages/math-utils/src/formatters/user/index.test.ts b/packages/math-utils/src/formatters/user/index.test.ts index c5bb5f191..eff8a9a3d 100644 --- a/packages/math-utils/src/formatters/user/index.test.ts +++ b/packages/math-utils/src/formatters/user/index.test.ts @@ -16,8 +16,7 @@ import { describe('formatUserSummaryETHMarket', () => { const usdcUserMock = new UserReserveMock({ decimals: 6 }) .supply(200) - .variableBorrow(50) - .stableBorrow(50); + .variableBorrow(100); const marketReferencePriceInUsd = 10 ** 9; // 10 const marketReferenceCurrencyDecimals = 18; const request: FormatUserSummaryRequest = { @@ -118,8 +117,8 @@ describe('formatUserSummaryETHMarket', () => { }); describe('formatUserSummaryAndIncentives', () => { - const ethUserMock = new UserReserveMock({ decimals: 18 }).stableBorrow(50); - const usdcUserMock = new UserReserveMock({ decimals: 6 }).stableBorrow(100); + const ethUserMock = new UserReserveMock({ decimals: 18 }).variableBorrow(50); + const usdcUserMock = new UserReserveMock({ decimals: 6 }).variableBorrow(100); const reserveIncentiveMock = new ReserveIncentiveMock(); const userIncentiveMock = new UserIncentiveMock(); const marketReferencePriceInUsd = '10'; diff --git a/packages/math-utils/src/formatters/user/index.ts b/packages/math-utils/src/formatters/user/index.ts index 6c3476131..c3de4dcb5 100644 --- a/packages/math-utils/src/formatters/user/index.ts +++ b/packages/math-utils/src/formatters/user/index.ts @@ -1,6 +1,9 @@ import { BigNumberValue, normalize } from '../../bignumber'; import { LTV_PRECISION, USD_DECIMALS } from '../../constants'; -import { calculateAllUserIncentives, UserIncentiveDict } from '../incentive'; +import { + calculateAllUserIncentives, + UserIncentiveDict, +} from '../incentive/calculate-all-user-incentives'; import { ReservesIncentiveDataHumanized, UserReservesIncentivesDataHumanized, @@ -17,10 +20,7 @@ export interface UserReserveData { underlyingAsset: string; scaledATokenBalance: string; usageAsCollateralEnabledOnUser: boolean; - stableBorrowRate: string; scaledVariableDebt: string; - principalStableDebt: string; - stableBorrowLastUpdateTimestamp: number; } export interface CombinedReserveData< @@ -38,14 +38,9 @@ export interface ComputedUserReserve< variableBorrows: string; variableBorrowsMarketReferenceCurrency: string; variableBorrowsUSD: string; - stableBorrows: string; - stableBorrowsMarketReferenceCurrency: string; - stableBorrowsUSD: string; totalBorrows: string; totalBorrowsMarketReferenceCurrency: string; totalBorrowsUSD: string; - stableBorrowAPY: string; - stableBorrowAPR: string; } export interface FormatUserSummaryRequest< diff --git a/packages/math-utils/src/mocks.ts b/packages/math-utils/src/mocks.ts index e2c650fde..a3bb9365a 100644 --- a/packages/math-utils/src/mocks.ts +++ b/packages/math-utils/src/mocks.ts @@ -16,26 +16,22 @@ export class ReserveMock { constructor(config: { decimals: number } = { decimals: 18 }) { this.config = config; this.reserve = { + originalId: 1, id: '0x0', symbol: 'TEST', name: 'TEST', decimals: config.decimals, underlyingAsset: '0x0', usageAsCollateralEnabled: true, - eModeCategoryId: 1, reserveFactor: '0', baseLTVasCollateral: '5000', // 50% - averageStableRate: '0', - stableDebtLastUpdateTimestamp: 1, liquidityIndex: RAY.toString(), reserveLiquidationThreshold: '6000', // 60% reserveLiquidationBonus: '0', variableBorrowIndex: RAY.toString(), variableBorrowRate: RAY.multipliedBy(3).toString(), availableLiquidity: '0', - stableBorrowRate: RAY.multipliedBy(2).toString(), liquidityRate: RAY.multipliedBy(1).toString(), - totalPrincipalStableDebt: '0', totalScaledVariableDebt: '0', lastUpdateTimestamp: 1, borrowCap: '0', @@ -43,9 +39,6 @@ export class ReserveMock { debtCeiling: '0', debtCeilingDecimals: 2, isolationModeTotalDebt: '', - eModeLtv: 6000, // 60% - eModeLiquidationThreshold: 7000, // 70% - eModeLiquidationBonus: 0, unbacked: '0', virtualAccActive: false, virtualUnderlyingBalance: '0', @@ -68,14 +61,6 @@ export class ReserveMock { return this; } - addStableDebt(amount: number | string) { - this.reserve.totalPrincipalStableDebt = new BigNumber(amount) - .shiftedBy(this.config.decimals) - .plus(this.reserve.totalPrincipalStableDebt) - .toString(); - return this; - } - addUnbacked(amount: number | string) { this.reserve.unbacked = new BigNumber(amount) .shiftedBy(this.config.decimals) @@ -95,10 +80,7 @@ export class UserReserveMock { underlyingAsset: '0x0000000000000000000000000000000000000000', scaledATokenBalance: '0', usageAsCollateralEnabledOnUser: true, - stableBorrowRate: RAY.multipliedBy(2).toString(), scaledVariableDebt: '0', - principalStableDebt: '0', - stableBorrowLastUpdateTimestamp: 1, }; const reserveMock = new ReserveMock({ decimals: config.decimals }); this.reserve = { @@ -109,7 +91,6 @@ export class UserReserveMock { name: 'TEST', decimals: config.decimals, usageAsCollateralEnabled: true, - eModeCategoryId: 1, formattedBaseLTVasCollateral: '0.5', liquidityIndex: RAY.toString(), formattedReserveLiquidationThreshold: '0.6', @@ -118,21 +99,16 @@ export class UserReserveMock { variableBorrowRate: RAY.multipliedBy(3).toString(), formattedAvailableLiquidity: '0', liquidityRate: RAY.multipliedBy(1).toString(), - totalPrincipalStableDebt: '0', totalScaledVariableDebt: '0', lastUpdateTimestamp: 1, debtCeiling: '0', debtCeilingDecimals: 2, isolationModeTotalDebt: '', - formattedEModeLtv: '0.6', - formattedEModeLiquidationThreshold: '0.7', - formattedEModeLiquidationBonus: '0', priceInUSD: '10', totalLiquidityUSD: '0', availableLiquidityUSD: '0', totalDebtUSD: '0', totalVariableDebtUSD: '0', - totalStableDebtUSD: '0', borrowCapUSD: '0', supplyCapUSD: '0', unbackedUSD: '0', @@ -143,11 +119,8 @@ export class UserReserveMock { supplyAPR: '0', variableBorrowAPY: '0', variableBorrowAPR: '0', - stableBorrowAPY: '0', - stableBorrowAPR: '0', borrowUsageRatio: '0', supplyUsageRatio: '0', - totalStableDebt: '0', totalVariableDebt: '0', totalDebt: '0', totalLiquidity: '0', @@ -155,6 +128,24 @@ export class UserReserveMock { availableDebtCeilingUSD: '0', isolationModeTotalDebtUSD: '0', isIsolated: true, + eModes: [ + { + id: 1, + collateralEnabled: true, + borrowingEnabled: true, + eMode: { + ltv: '6000', + liquidationThreshold: '7000', + liquidationBonus: '0', + formattedLtv: '0.6', + formattedLiquidationThreshold: '0.7', + formattedLiquidationBonus: '0', + label: 'test emode', + collateralBitmap: '1', + borrowableBitmap: '1', + }, + }, + ], }; } @@ -181,18 +172,6 @@ export class UserReserveMock { .toString(); return this; } - - stableBorrow(amount: number | string) { - this.userReserve.principalStableDebt = new BigNumber(amount) - .shiftedBy(this.config.decimals) - .plus(this.userReserve.principalStableDebt) - .toString(); - this.reserve.totalPrincipalStableDebt = new BigNumber(amount) - .shiftedBy(this.config.decimals) - .plus(this.reserve.totalPrincipalStableDebt) - .toString(); - return this; - } } export class ReserveIncentiveMock { @@ -241,26 +220,6 @@ export class ReserveIncentiveMock { }, ], }, - sIncentiveData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - rewardsTokenInformation: [ - { - rewardTokenSymbol: 'Test', - emissionPerSecond: '0', - incentivesLastUpdateTimestamp: 1, - tokenIncentivesIndex: '0', - emissionEndTimestamp: 2, - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 18, - precision: 18, - rewardPriceFeed: '0', - priceFeedDecimals: 8, - rewardOracleAddress: '0x0000000000000000000000000000000000000000', - }, - ], - }, }; } } @@ -305,23 +264,6 @@ export class UserIncentiveMock { }, ], }, - sTokenIncentivesUserData: { - tokenAddress: '0x0000000000000000000000000000000000000000', - incentiveControllerAddress: - '0x0000000000000000000000000000000000000000', - userRewardsInformation: [ - { - tokenIncentivesUserIndex: '0', - userUnclaimedRewards: '1', - rewardTokenAddress: '0x0000000000000000000000000000000000000000', - rewardTokenDecimals: 18, - rewardPriceFeed: (10 ** 19).toString(), // 10 - priceFeedDecimals: 8, - rewardOracleAddress: '0x0', - rewardTokenSymbol: 'Test', - }, - ], - }, }; } } diff --git a/packages/math-utils/src/pool-math.test.ts b/packages/math-utils/src/pool-math.test.ts index 703f70edd..d991e4b0a 100644 --- a/packages/math-utils/src/pool-math.test.ts +++ b/packages/math-utils/src/pool-math.test.ts @@ -4,7 +4,6 @@ import { getCompoundedBalance, calculateLinearInterest, getReserveNormalizedIncome, - getCompoundedStableBalance, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateAvailableBorrowsMarketReferenceCurrency, @@ -106,19 +105,6 @@ describe('pool math', () => { ); }); - it('should calculate compounded stable balances', () => { - const compoundedStableBalanceRequest = { - principalBalance: 2000000000000000000, - userStableRate: 500000000000000000, - currentTimestamp: 1749942229, - lastUpdateTimestamp: 1629942229, - }; - const compoundedStableBalance = getCompoundedStableBalance( - compoundedStableBalanceRequest, - ); - expect(compoundedStableBalance.toFixed()).toEqual('2000000003805175038'); - }); - it('should calculate health factor', () => { const minHealthFactorRequest = { collateralBalanceMarketReferenceCurrency: 100000000000000000, diff --git a/packages/math-utils/src/pool-math.ts b/packages/math-utils/src/pool-math.ts index ca289460e..5b7766535 100644 --- a/packages/math-utils/src/pool-math.ts +++ b/packages/math-utils/src/pool-math.ts @@ -130,36 +130,6 @@ export function getLinearBalance({ ); } -interface CompoundedStableBalanceRequest { - principalBalance: BigNumberValue; - userStableRate: BigNumberValue; - lastUpdateTimestamp: number; - currentTimestamp: number; -} - -export function getCompoundedStableBalance({ - principalBalance: _principalBalance, - userStableRate, - lastUpdateTimestamp, - currentTimestamp, -}: CompoundedStableBalanceRequest): BigNumber { - const principalBalance = valueToZDBigNumber(_principalBalance); - if (principalBalance.eq('0')) { - return principalBalance; - } - - const cumulatedInterest = calculateCompoundedInterest({ - rate: userStableRate, - currentTimestamp, - lastUpdateTimestamp, - }); - const principalBalanceRay = RayMath.wadToRay(principalBalance); - - return RayMath.rayToWad( - RayMath.rayMul(principalBalanceRay, cumulatedInterest), - ); -} - interface HealthFactorFromBalanceRequest { collateralBalanceMarketReferenceCurrency: BigNumberValue; borrowBalanceMarketReferenceCurrency: BigNumberValue; diff --git a/yarn.lock b/yarn.lock index 4e33ec8bb..b6c854095 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2487,6 +2487,14 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@typechain/ethers-v5@^11.1.2": + version "11.1.2" + resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-11.1.2.tgz#82510c1744f37a2f906b9e0532ac18c0b74ffe69" + integrity sha512-ID6pqWkao54EuUQa0P5RgjvfA3MYqxUQKpbGKERbsjBW5Ra7EIXvbMlPp2pcP5IAdUkyMCFYsP2SN5q7mPdLDQ== + dependencies: + lodash "^4.17.15" + ts-essentials "^7.0.1" + "@types/babel__core@^7.1.14": version "7.1.16" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.16.tgz#bc12c74b7d65e82d29876b5d0baf5c625ac58702" @@ -2615,6 +2623,11 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== +"@types/prettier@^2.1.1": + version "2.7.3" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" + integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== + "@types/prettier@^2.1.5": version "2.4.1" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.1.tgz#e1303048d5389563e130f5bdd89d37a99acb75eb" @@ -3034,6 +3047,16 @@ arr-union@^3.1.0: resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= +array-back@^3.0.1, array-back@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/array-back/-/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0" + integrity sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q== + +array-back@^4.0.1, array-back@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e" + integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg== + array-differ@^2.0.3: version "2.1.0" resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" @@ -3755,6 +3778,26 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" +command-line-args@^5.1.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.2.1.tgz#c44c32e437a57d7c51157696893c5909e9cec42e" + integrity sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg== + dependencies: + array-back "^3.1.0" + find-replace "^3.0.0" + lodash.camelcase "^4.3.0" + typical "^4.0.0" + +command-line-usage@^6.1.0: + version "6.1.3" + resolved "https://registry.yarnpkg.com/command-line-usage/-/command-line-usage-6.1.3.tgz#428fa5acde6a838779dfa30e44686f4b6761d957" + integrity sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw== + dependencies: + array-back "^4.0.2" + chalk "^2.4.2" + table-layout "^1.0.2" + typical "^5.2.0" + commander@^8.3.0: version "8.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" @@ -4125,6 +4168,13 @@ debug@^4.1.0, debug@^4.1.1, debug@^4.3.2: dependencies: ms "2.1.2" +debug@^4.3.1: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -4165,6 +4215,11 @@ dedent@0.7.0, dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= +deep-extend@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + deep-is@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" @@ -5141,6 +5196,13 @@ find-node-modules@^2.1.2: findup-sync "^4.0.0" merge "^2.1.0" +find-replace@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38" + integrity sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ== + dependencies: + array-back "^3.0.1" + find-root@1.1.0, find-root@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" @@ -5275,6 +5337,15 @@ fs-extra@^10.0.0: jsonfile "^6.0.1" universalify "^2.0.0" +fs-extra@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-minipass@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" @@ -5517,7 +5588,7 @@ glob@7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.1, glob@^7.1.3, glob@^7.1.4: +glob@7.1.7, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4: version "7.1.7" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== @@ -6833,7 +6904,7 @@ js-sha3@0.5.7: resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g== -js-sha3@0.8.0: +js-sha3@0.8.0, js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== @@ -7149,6 +7220,11 @@ lodash._reinterpolate@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= +lodash.camelcase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" + integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA== + lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" @@ -7582,7 +7658,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*: +mkdirp@*, mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== @@ -7621,7 +7697,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.0.0, ms@^2.1.1: +ms@^2.0.0, ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -8398,6 +8474,11 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" +prettier@^2.3.1: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + prettier@^2.4.1: version "2.5.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a" @@ -8723,6 +8804,11 @@ redent@^4.0.0: indent-string "^5.0.0" strip-indent "^4.0.0" +reduce-flatten@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" + integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w== + reflect-metadata@^0.1.13: version "0.1.13" resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" @@ -9354,6 +9440,11 @@ string-argv@^0.3.1: resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== +string-format@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-format/-/string-format-2.0.0.tgz#f2df2e7097440d3b65de31b6d40d54c96eaffb9b" + integrity sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA== + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -9594,6 +9685,16 @@ supports-hyperlinks@^2.0.0: has-flag "^4.0.0" supports-color "^7.0.0" +table-layout@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-1.0.2.tgz#c4038a1853b0136d63365a734b6931cf4fad4a04" + integrity sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A== + dependencies: + array-back "^4.0.1" + deep-extend "~0.6.0" + typical "^5.2.0" + wordwrapjs "^4.0.0" + tapable@^0.1.8: version "0.1.10" resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.1.10.tgz#29c35707c2b70e50d07482b5d202e8ed446dafd4" @@ -9800,6 +9901,21 @@ trim-off-newlines@^1.0.0: resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= +ts-command-line-args@^2.2.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz#e64456b580d1d4f6d948824c274cf6fa5f45f7f0" + integrity sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw== + dependencies: + chalk "^4.1.0" + command-line-args "^5.1.1" + command-line-usage "^6.1.0" + string-format "^2.0.0" + +ts-essentials@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.3.tgz#686fd155a02133eedcc5362dc8b5056cde3e5a38" + integrity sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ== + ts-jest@^29.0.3: version "29.0.3" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.0.3.tgz#63ea93c5401ab73595440733cefdba31fcf9cb77" @@ -9927,6 +10043,22 @@ type-fest@^1.0.1, type-fest@^1.0.2, type-fest@^1.2.1, type-fest@^1.2.2: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== +typechain@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.3.2.tgz#1090dd8d9c57b6ef2aed3640a516bdbf01b00d73" + integrity sha512-x/sQYr5w9K7yv3es7jo4KTX05CLxOf7TRWwoHlrjRh8H82G64g+k7VuWPJlgMo6qrjfCulOdfBjiaDtmhFYD/Q== + dependencies: + "@types/prettier" "^2.1.1" + debug "^4.3.1" + fs-extra "^7.0.0" + glob "7.1.7" + js-sha3 "^0.8.0" + lodash "^4.17.15" + mkdirp "^1.0.4" + prettier "^2.3.1" + ts-command-line-args "^2.2.0" + ts-essentials "^7.0.1" + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -9942,6 +10074,16 @@ typescript@>=4.3, typescript@^4.4.3, typescript@^4.4.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.2.tgz#8ac1fba9f52256fdb06fb89e4122fa6a346c2998" integrity sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw== +typical@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4" + integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw== + +typical@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066" + integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== + uglify-js@^3.1.4: version "3.14.1" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.14.1.tgz#e2cb9fe34db9cb4cf7e35d1d26dfea28e09a7d06" @@ -10211,6 +10353,14 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= +wordwrapjs@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f" + integrity sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA== + dependencies: + reduce-flatten "^2.0.0" + typical "^5.2.0" + wrap-ansi@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"