diff --git a/cspell.json b/cspell.json index 8bab630fe39c..7c41f40a8b51 100644 --- a/cspell.json +++ b/cspell.json @@ -27,8 +27,13 @@ "artblocks", "arweave", "attrace", + "auri", + "aurigami", "avalanche", "avax", + "bech", + "benqi", + "betanet", "bgcolor", "bignumber", "binancecoin", @@ -45,6 +50,10 @@ "canonify", "cashtag", "cbridge", + "celer", + "celo", + "cerc20", + "chainlink", "checksummed", "choudhary", "cipherparams", @@ -53,6 +62,10 @@ "codegen", "commentid", "composertitlebar", + "compoundfinance", + "consolas", + "contenteditable", + "contrib", "contribs", "cooldown", "corepack", @@ -86,6 +99,7 @@ "gapcheck", "gasnow", "geckoview", + "giest", "gltf", "goodghosting", "gundb", @@ -169,6 +183,7 @@ "proxied", "pushstate", "pvtsutils", + "qied", "qrcode", "quickswap", "radisk", @@ -198,6 +213,9 @@ "steganographic", "steganography", "stego", + "stnear", + "strat", + "strats", "subrepo", "sushiswap", "swappable", @@ -211,6 +229,7 @@ "topbar", "toruslabs", "traderjoe", + "tranq", "transak", "trisolaris", "twimg", @@ -219,6 +238,7 @@ "typehash", "typeson", "unencrypted", + "unitroller", "unreviewed", "unstake", "unstyled", @@ -237,6 +257,9 @@ "webm", "withdrawed", "wmatic", + "wnative", + "wnear", + "wone", "xdai", "xlarge", "zerion", diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/IconURL.tsx b/packages/mask/src/plugins/Savings/SNSAdaptor/IconURL.tsx index 718a431cd33c..2c86e0e39796 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/IconURL.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/IconURL.tsx @@ -2,5 +2,12 @@ import { ProtocolType } from '../types' export const ProviderIconURLs: Record = { [ProtocolType.Lido]: new URL('./assets/lido.png', import.meta.url).toString(), + [ProtocolType.BENQI]: new URL('./assets/benqi.png', import.meta.url).toString(), + [ProtocolType.Compound]: new URL('./assets/compound.png', import.meta.url).toString(), [ProtocolType.AAVE]: new URL('./assets/aave.png', import.meta.url).toString(), + [ProtocolType.Aurigami]: new URL('./assets/aurigami.png', import.meta.url).toString(), + [ProtocolType.Giest]: new URL('./assets/giest.png', import.meta.url).toString(), + [ProtocolType.Alpaca]: new URL('./assets/alpaca.png', import.meta.url).toString(), + [ProtocolType.Moola]: new URL('./assets/moola.png', import.meta.url).toString(), + [ProtocolType.Tranquil]: new URL('./assets/tranquil.png', import.meta.url).toString(), } diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialog.tsx b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialog.tsx index 0708b1b909bb..1be665fe8ed4 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialog.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialog.tsx @@ -1,18 +1,10 @@ import { useMemo, useState } from 'react' import { useAsync, useUpdateEffect } from 'react-use' -import { DialogActions, DialogContent, Tab, Typography } from '@mui/material' +import { DialogActions, DialogContent, CircularProgress, Tab, Typography } from '@mui/material' import { isDashboardPage, EMPTY_LIST } from '@masknet/shared-base' import { MaskTabList, useTabs } from '@masknet/theme' -import { - createContract, - ChainId, - SchemaType, - getAaveConstants, - ZERO_ADDRESS, - networkResolver, - NetworkType, -} from '@masknet/web3-shared-evm' -import { PluginWalletStatusBar, useI18N } from '../../../utils' +import { ChainId, networkResolver, NetworkType } from '@masknet/web3-shared-evm' +import { useI18N, PluginWalletStatusBar } from '../../../utils' import { InjectedDialog } from '@masknet/shared' import { AllProviderTradeContext } from '../../Trader/trader/useAllProviderTradeContext' import { TargetChainIdContext } from '@masknet/plugin-infra/web3-evm' @@ -22,17 +14,14 @@ import { SavingsProtocol, TabType } from '../types' import { useStyles } from './SavingsDialogStyles' import { SavingsTable } from './SavingsTable' import { SavingsFormDialog } from './SavingsForm' -import type { AaveProtocolDataProvider } from '@masknet/web3-contracts/types/AaveProtocolDataProvider' -import AaveProtocolDataProviderABI from '@masknet/web3-contracts/abis/AaveProtocolDataProvider.json' -import { LidoProtocol } from '../protocols/LDOProtocol' -import { AAVEProtocol } from '../protocols/AAVEProtocol' -import { LDO_PAIRS } from '../constants' -import type { AbiItem } from 'web3-utils' -import { flatten, compact, chunk } from 'lodash-unified' -import { useChainId, useFungibleTokens, useWeb3 } from '@masknet/plugin-infra/web3' -import { FungibleToken, NetworkPluginID } from '@masknet/web3-shared-base' -import { ChainBoundary } from '../../../web3/UI/ChainBoundary' +import { flatten } from 'lodash-unified' +import { useChainId, useWeb3, useWeb3Connection } from '@masknet/plugin-infra/web3' +import { NetworkPluginID } from '@masknet/web3-shared-base' +import { SavingsProtocols, LazyProtocolsResolvers } from '../protocols' import { TabContext, TabPanel } from '@mui/lab' +import { ChainBoundary } from '../../../web3/UI/ChainBoundary' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + export interface SavingsDialogProps { open: boolean onClose?: () => void @@ -46,6 +35,7 @@ export function SavingsDialog({ open, onClose }: SavingsDialogProps) { const currentChainId = useChainId(NetworkPluginID.PLUGIN_EVM) const [chainId, setChainId] = useState(currentChainId) const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM, { chainId }) + const connection = useWeb3Connection(NetworkPluginID.PLUGIN_EVM, { chainId }) const [tab, setTab] = useState(TabType.Deposit) const [selectedProtocol, setSelectedProtocol] = useState(null) @@ -55,46 +45,24 @@ export function SavingsDialog({ open, onClose }: SavingsDialogProps) { return networks.map((network: NetworkType) => networkResolver.networkChainId(network)) }, []) - const { value: aaveTokens } = useAsync(async () => { - if (!open || chainId !== ChainId.Mainnet) { - return EMPTY_LIST + const { loading: lazyLoading, value: lazyProtocols } = useAsync(async () => { + const currentChainLazyResolvers = LazyProtocolsResolvers.filter((_) => _.supportChains.includes(chainId)) + try { + const allResults = await Promise.all( + currentChainLazyResolvers.map((resolver) => + resolver.resolve(chainId, web3, connection as Web3Helper.Web3ConnectionScope), + ), + ) + return flatten(allResults) + } catch (error) { + console.error('lazyProtocols: resolve error', error) } + return [] + }, [web3, chainId]) - const address = getAaveConstants(chainId).AAVE_PROTOCOL_DATA_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS - - const protocolDataContract = createContract( - web3, - address, - AaveProtocolDataProviderABI as AbiItem[], - ) - - const tokens = await protocolDataContract?.methods.getAllReservesTokens().call() - - const aTokens = await protocolDataContract?.methods.getAllATokens().call() - - return tokens?.map((token) => { - return [token[1], aTokens?.filter((f) => f[0].toUpperCase() === `a${token[0]}`.toUpperCase())[0][1]] - }) - }, [open, web3, chainId]) - - const { value: detailedAaveTokens } = useFungibleTokens( - NetworkPluginID.PLUGIN_EVM, - compact(flatten(aaveTokens ?? [])), - { - chainId, - }, - ) - - const protocols = useMemo( - () => [ - ...LDO_PAIRS.filter((x) => x[0].chainId === chainId).map((pair) => new LidoProtocol(pair)), - ...chunk(detailedAaveTokens, 2).map( - (pair) => - new AAVEProtocol(pair as [FungibleToken, FungibleToken]), - ), - ], - [chainId, detailedAaveTokens, tab], - ) + const protocols = useMemo(() => { + return [...SavingsProtocols, ...(lazyProtocols ?? [])].filter((x) => x.bareToken.chainId === chainId) + }, [chainId, lazyProtocols]) useUpdateEffect(() => { setChainId(currentChainId) @@ -131,22 +99,34 @@ export function SavingsDialog({ open, onClose }: SavingsDialogProps) {
- + {lazyLoading ? ( +
+ +
+ ) : ( + + )}
- + {lazyLoading ? ( +
+ +
+ ) : ( + + )}
diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialogStyles.tsx b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialogStyles.tsx index cc7924258e17..f9f35fd25d87 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialogStyles.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialogStyles.tsx @@ -51,4 +51,11 @@ export const useStyles = makeStyles<{ isDashboard: boolean }>()((theme, { isDash width: 535, margin: 'auto', }, + loading: { + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + minHeight: 300, + width: '100%', + }, })) diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx index 1b5da7267f83..cfa42618f2fc 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx @@ -1,27 +1,17 @@ import { useState, useCallback, useMemo } from 'react' import { useAsync, useAsyncFn } from 'react-use' -import type { AbiItem } from 'web3-utils' import BigNumber from 'bignumber.js' import { unreachable } from '@dimensiondev/kit' import { isLessThan, rightShift, - createLookupTableResolver, NetworkPluginID, ZERO, isSameAddress, formatBalance, formatCurrency, } from '@masknet/web3-shared-base' -import { - createContract, - createERC20Token, - SchemaType, - getAaveConstants, - useTokenConstants, - ZERO_ADDRESS, - chainResolver, -} from '@masknet/web3-shared-evm' +import { createERC20Token, SchemaType, useTokenConstants, chainResolver } from '@masknet/web3-shared-evm' import { useAccount, useFungibleTokenBalance, useFungibleTokenPrice, useWeb3 } from '@masknet/plugin-infra/web3' import { FormattedCurrency, @@ -31,10 +21,7 @@ import { TokenIcon, useOpenShareTxDialog, } from '@masknet/shared' -import type { AaveLendingPoolAddressProvider } from '@masknet/web3-contracts/types/AaveLendingPoolAddressProvider' -import AaveLendingPoolAddressProviderABI from '@masknet/web3-contracts/abis/AaveLendingPoolAddressProvider.json' import { useRemoteControlledDialog } from '@masknet/shared-base-ui' -import { PluginWalletStatusBar, useI18N } from '../../../utils' import { WalletConnectedBoundary } from '../../../web3/UI/WalletConnectedBoundary' import { ChainBoundary } from '../../../web3/UI/ChainBoundary' import { PluginTraderMessages } from '../../Trader/messages' @@ -46,6 +33,7 @@ import { DialogActions, DialogContent, Typography } from '@mui/material' import { isTwitter } from '../../../social-network-adaptor/twitter.com/base' import { activatedSocialNetworkUI } from '../../../social-network' import { ActionButtonPromise } from '../../../extension/options-page/DashboardComponents/ActionButton' +import { PluginWalletStatusBar, useI18N } from '../../../utils' export interface SavingsFormDialogProps { chainId: number @@ -54,14 +42,6 @@ export interface SavingsFormDialogProps { onClose?: () => void } -export const resolveProtocolName = createLookupTableResolver( - { - [ProtocolType.Lido]: 'Lido', - [ProtocolType.AAVE]: 'AAVE', - }, - 'unknown', -) - export function SavingsFormDialog({ chainId, protocol, tab, onClose }: SavingsFormDialogProps) { const { t } = useI18N() const { classes } = useStyles() @@ -152,24 +132,13 @@ export function SavingsFormDialog({ chainId, protocol, tab, onClose }: SavingsFo const { value: approvalData } = useAsync(async () => { const token = protocol.bareToken - const aavePoolAddress = - getAaveConstants(chainId).AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS - - const lPoolAddressProviderContract = createContract( - web3, - aavePoolAddress, - AaveLendingPoolAddressProviderABI as AbiItem[], - ) - - const poolAddress = await lPoolAddressProviderContract?.methods.getLendingPool().call() - return { approveToken: token.schema === SchemaType.ERC20 ? createERC20Token(chainId, token.address, token.name, token.symbol, token.decimals) : undefined, approveAmount: new BigNumber(inputAmount).shiftedBy(token.decimals), - approveAddress: poolAddress, + approveAddress: protocol.approveAddress, } }, [protocol.bareToken, inputAmount, chainId]) diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx index f94dbd776e62..fc9d8d2b091a 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx @@ -8,7 +8,10 @@ import type { ChainId, Web3 } from '@masknet/web3-shared-evm' import { ProviderIconURLs } from './IconURL' import { useI18N } from '../../../utils' import { SavingsProtocol, TabType } from '../types' -import { useAccount, useWeb3, useFungibleAssets } from '@masknet/plugin-infra/web3' +import { useAccount, useWeb3, useBalance, useFungibleAssets } from '@masknet/plugin-infra/web3' +import { useMemo } from 'react' +import BigNumber from 'bignumber.js' +import { SchemaType } from '@masknet/web3-shared-evm' const useStyles = makeStyles()((theme, props) => ({ containerWrap: { @@ -55,6 +58,7 @@ const useStyles = makeStyles()((theme, props) => ({ position: 'absolute', bottom: 0, right: '-5px', + borderRadius: '16px', }, protocolLabel: {}, placeholder: { @@ -104,17 +108,38 @@ export function SavingsTable({ chainId, tab, protocols, setTab, setSelectedProto const web3 = useWeb3(NetworkPluginID.PLUGIN_EVM, { chainId }) const account = useAccount(NetworkPluginID.PLUGIN_EVM) + const { value: balance = '0', loading: loadingBalance } = useBalance(NetworkPluginID.PLUGIN_EVM) + const { value: assets, loading: getAssetsLoading } = useFungibleAssets(NetworkPluginID.PLUGIN_EVM) // Only fetch protocol APR and Balance on chainId change const { loading } = useAsync(async () => { await Promise.all( protocols.map(async (protocol) => { - await protocol.updateApr(chainId, web3 as Web3) - await protocol.updateBalance(chainId, web3 as Web3, account) + return tab === TabType.Deposit + ? protocol.updateApr(chainId, web3 as Web3) + : protocol.updateBalance(chainId, web3 as Web3, account) }), ) }, [chainId, web3, account, protocols]) + + const hiddenZeroAssetProtocol = true + + const displayProtocols = useMemo(() => { + return tab === TabType.Deposit + ? protocols.filter((protocol) => { + if (!assets) return false + const bareToken = protocol.bareToken + // protocol has balance + const isNative = bareToken.schema === SchemaType.Native + const assetBalance = isNative + ? balance + : assets!.find((x) => isSameAddress(x.address, bareToken.address))?.balance + return hiddenZeroAssetProtocol ? assetBalance && !new BigNumber(assetBalance).isZero() : true + }) + : protocols.filter((x) => !x.balance.isZero()) + }, [protocols, loading, assets, balance]) + return ( @@ -139,65 +164,65 @@ export function SavingsTable({ chainId, tab, protocols, setTab, setSelectedProto {t('popups_loading')} - ) : protocols.length ? ( + ) : displayProtocols.length ? (
- {protocols - .filter((x) => !x.balance.isZero()) - .map((protocol, index) => ( - - -
- - -
-
- - {protocol.bareToken.symbol} - -
+ {displayProtocols.map((protocol, index) => ( + + +
+ + +
+
+ + {protocol.bareToken.symbol} + +
+
+ {tab === TabType.Deposit ? ( + + {protocol.apr}% - {tab === TabType.Deposit ? ( - - {protocol.apr}% - - ) : null} - - - + ) : null} + + + isSameAddress(x.address, protocol.bareToken.address), )?.balance - : protocol.balance - } - decimals={protocol.bareToken.decimals} - significant={6} - minimumBalance={rightShift(10, protocol.bareToken.decimals - 6)} - formatter={formatBalance} - /> - - - - - + : protocol.balance + } + decimals={protocol.bareToken.decimals} + significant={6} + minimumBalance={rightShift(10, protocol.bareToken.decimals - 6)} + formatter={formatBalance} + /> + + + + - ))} +
+ ))}
) : (
diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/assets/alpaca.png b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/alpaca.png new file mode 100644 index 000000000000..363fb15ae4b7 Binary files /dev/null and b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/alpaca.png differ diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/assets/aurigami.png b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/aurigami.png new file mode 100644 index 000000000000..3a02c00936b4 Binary files /dev/null and b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/aurigami.png differ diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/assets/benqi.png b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/benqi.png new file mode 100644 index 000000000000..95773b768fc0 Binary files /dev/null and b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/benqi.png differ diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/assets/compound.png b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/compound.png new file mode 100644 index 000000000000..8e6658dca600 Binary files /dev/null and b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/compound.png differ diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/assets/giest.png b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/giest.png new file mode 100644 index 000000000000..21ba007db4d9 Binary files /dev/null and b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/giest.png differ diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/assets/moola.png b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/moola.png new file mode 100644 index 000000000000..6005f8cae0e2 Binary files /dev/null and b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/moola.png differ diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/assets/tranquil.png b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/tranquil.png new file mode 100644 index 000000000000..055fca4958d2 Binary files /dev/null and b/packages/mask/src/plugins/Savings/SNSAdaptor/assets/tranquil.png differ diff --git a/packages/mask/src/plugins/Savings/constants.ts b/packages/mask/src/plugins/Savings/constants.ts index 5aea64af3f1a..128cc4f2fb47 100644 --- a/packages/mask/src/plugins/Savings/constants.ts +++ b/packages/mask/src/plugins/Savings/constants.ts @@ -1,5 +1,13 @@ import type { FungibleToken } from '@masknet/web3-shared-base' -import { ChainId, createERC20Tokens, createNativeToken, SchemaType } from '@masknet/web3-shared-evm' +import { + ChainId, + createERC20Tokens, + createNativeToken, + SchemaType, + getBenQiConstants, + getCompoundConstants, + ZERO_ADDRESS, +} from '@masknet/web3-shared-evm' export const SAVINGS_PLUGIN_NAME = 'Savings' export const SAVINGS_PLUGIN_ID = 'com.savings' @@ -137,3 +145,8 @@ export const AAVE_PAIRS: Array<[FungibleToken, FungibleToke createERC20Tokens('aFEI_ADDRESS', 'aFEI', 'aFEI', 18)[ChainId.Mainnet], ], ] + +export const COMPOUND_COMPTROLLER = getCompoundConstants(ChainId.Mainnet).COMPTROLLER || ZERO_ADDRESS + +export const BENQI_COMPTROLLER = getBenQiConstants(ChainId.Avalanche).COMPTROLLER || ZERO_ADDRESS +export const BENQI_ChainlinkOracle = getBenQiConstants(ChainId.Avalanche).ORACLE || ZERO_ADDRESS diff --git a/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts b/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts deleted file mode 100644 index 4c1ddaf1e699..000000000000 --- a/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts +++ /dev/null @@ -1,254 +0,0 @@ -import BigNumber from 'bignumber.js' -import type Web3 from 'web3' -import type { AbiItem } from 'web3-utils' -import AaveLendingPoolABI from '@masknet/web3-contracts/abis/AaveLendingPool.json' -import AaveLendingPoolAddressProviderABI from '@masknet/web3-contracts/abis/AaveLendingPoolAddressProvider.json' -import ERC20ABI from '@masknet/web3-contracts/abis/ERC20.json' -import type { AaveLendingPool } from '@masknet/web3-contracts/types/AaveLendingPool' -import type { AaveLendingPoolAddressProvider } from '@masknet/web3-contracts/types/AaveLendingPoolAddressProvider' -import type { ERC20 } from '@masknet/web3-contracts/types/ERC20' -import { FungibleToken, pow10, ZERO } from '@masknet/web3-shared-base' -import { - ChainId, - createContract, - getAaveConstants, - SchemaType, - TransactionEventType, - ZERO_ADDRESS, -} from '@masknet/web3-shared-evm' -import { ProtocolType, SavingsProtocol } from '../types' - -export class AAVEProtocol implements SavingsProtocol { - static DEFAULT_APR = '0.17' - - private _apr = '0.00' - private _balance = ZERO - - constructor(readonly pair: [FungibleToken, FungibleToken]) {} - - get type() { - return ProtocolType.AAVE - } - - get apr() { - return this._apr - } - - get balance() { - return this._balance - } - - get bareToken() { - return this.pair[0] - } - - get stakeToken() { - return this.pair[1] - } - - public async updateApr(chainId: ChainId, web3: Web3) { - try { - const subgraphUrl = getAaveConstants(chainId).AAVE_SUBGRAPHS || '' - - if (!subgraphUrl) { - this._apr = AAVEProtocol.DEFAULT_APR - return - } - - const body = JSON.stringify({ - query: `{ - reserves (where: { - underlyingAsset: "${this.bareToken.address}" - pool: "0xb53c1a33016b2dc2ff3653530bff1848a515c8c5" - }) { - id - name - underlyingAsset - price { - id - } - liquidityRate - } - }`, - }) - const response = await fetch(subgraphUrl, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body, - }) - const fullResponse: { - data: { - reserves: Array<{ - id: string - name: string - decimals: number - underlyingAsset: string - liquidityRate: number - }> - } - } = await response.json() - const liquidityRate = +fullResponse.data.reserves[0].liquidityRate - - const RAY = pow10(27) // 10 to the power 27 - - // APY and APR are returned here as decimals, multiply by 100 to get the percents - this._apr = new BigNumber(liquidityRate).times(100).div(RAY).toFixed(2) - } catch (error) { - console.error('AAVE: Apr Error:', error) - this._apr = AAVEProtocol.DEFAULT_APR - } - } - - public async updateBalance(chainId: ChainId, web3: Web3, account: string) { - try { - const subgraphUrl = getAaveConstants(chainId).AAVE_SUBGRAPHS || '' - - if (!subgraphUrl) { - this._apr = AAVEProtocol.DEFAULT_APR - return - } - - const body = JSON.stringify({ - query: `{ - reserves (where: { - underlyingAsset: "${this.bareToken.address}" - pool : "0xb53c1a33016b2dc2ff3653530bff1848a515c8c5" - }) { - id - aToken { - id - } - } - }`, - }) - const response = await fetch(subgraphUrl, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body, - }) - - const fullResponse: { - data: { - reserves: Array<{ - aToken: { - id: string - } - }> - } - } = await response.json() - - const aTokenId = fullResponse.data.reserves[0].aToken.id - const contract = createContract(web3, aTokenId || ZERO_ADDRESS, ERC20ABI as AbiItem[]) - this._balance = new BigNumber((await contract?.methods.balanceOf(account).call()) ?? '0') - } catch (error) { - console.error('AAVE BALANCE ERROR: ', error) - this._balance = ZERO - } - } - - public async depositEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { - try { - const operation = await this.createDepositTokenOperation(account, chainId, web3, value) - const gasEstimate = await operation?.estimateGas({ - from: account, - }) - - return new BigNumber(gasEstimate || 0) - } catch (error) { - console.error('AAVE deposit estimate ERROR: ', error) - return ZERO - } - } - - private async createDepositTokenOperation(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { - const aaveLPoolAddress = - getAaveConstants(chainId).AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS - const lPoolAddressProviderContract = createContract( - web3, - aaveLPoolAddress, - AaveLendingPoolAddressProviderABI as AbiItem[], - ) - - const poolAddress = await lPoolAddressProviderContract?.methods.getLendingPool().call() - - const contract = createContract( - web3, - poolAddress || ZERO_ADDRESS, - AaveLendingPoolABI as AbiItem[], - ) - return contract?.methods.deposit(this.bareToken.address, new BigNumber(value).toFixed(), account, '0') - } - - public async deposit(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { - const gasEstimate = await this.depositEstimate(account, chainId, web3, value) - const operation = await this.createDepositTokenOperation(account, chainId, web3, value) - if (!operation) { - throw new Error("Can't create deposit operation") - } - return new Promise((resolve, reject) => { - operation - .send({ - from: account, - gas: gasEstimate.toNumber(), - }) - .once(TransactionEventType.ERROR, reject) - .once(TransactionEventType.CONFIRMATION, (_, receipt) => { - resolve(receipt.transactionHash) - }) - }) - } - - public async withdrawEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { - try { - const lPoolAddressProviderContract = createContract( - web3, - getAaveConstants(chainId).AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS, - AaveLendingPoolAddressProviderABI as AbiItem[], - ) - - const poolAddress = await lPoolAddressProviderContract?.methods.getLendingPool().call() - - const contract = createContract( - web3, - poolAddress || ZERO_ADDRESS, - AaveLendingPoolABI as AbiItem[], - ) - const gasEstimate = await contract?.methods - .withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account) - .estimateGas({ - from: account, - }) - return new BigNumber(gasEstimate || 0) - } catch (error) { - return ZERO - } - } - - public async withdraw(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { - const lPoolAddressProviderContract = createContract( - web3, - getAaveConstants(chainId).AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS, - AaveLendingPoolAddressProviderABI as AbiItem[], - ) - - const poolAddress = await lPoolAddressProviderContract?.methods.getLendingPool().call() - - const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) - const contract = createContract( - web3, - poolAddress || ZERO_ADDRESS, - AaveLendingPoolABI as AbiItem[], - ) - return new Promise((resolve) => - contract?.methods - .withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account) - .send({ - from: account, - gas: gasEstimate.toNumber(), - }) - .once(TransactionEventType.CONFIRMATION, (_, receipt) => { - resolve(receipt.transactionHash) - }), - ) - } -} diff --git a/packages/mask/src/plugins/Savings/protocols/aave/AAVEProtocol.ts b/packages/mask/src/plugins/Savings/protocols/aave/AAVEProtocol.ts new file mode 100644 index 000000000000..6b5ce198ec98 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/aave/AAVEProtocol.ts @@ -0,0 +1,8 @@ +import { ProtocolType } from '../../types' +import AAVELikeProtocol from '../common/protocol/AAVELikeProtocol' + +export class AAVEProtocol extends AAVELikeProtocol { + override get type() { + return ProtocolType.AAVE + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/aave/pairs.ts b/packages/mask/src/plugins/Savings/protocols/aave/pairs.ts new file mode 100644 index 000000000000..b3aabe1d8c4c --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/aave/pairs.ts @@ -0,0 +1,38 @@ +import type Web3 from 'web3' +import { ChainId, getAaveConstants, ZERO_ADDRESS } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, ProtocolPairsResolver, PairToken } from '../../types' +import AAVELikeFetcher from '../common/AAVELikeFetcher' +import { AAVEProtocol } from './AAVEProtocol' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +const AaveProtocolDataProvider = + getAaveConstants(ChainId.Mainnet).AAVE_PROTOCOL_DATA_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS +const LendingPoolAddressProvider = + getAaveConstants(ChainId.Mainnet).AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS + +export class AAVEResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.Mainnet] + public async resolve( + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ): Promise { + if (!this.supportChains.includes(chainId)) { + return [] + } + + const allPairsWithArgs = await AAVELikeFetcher.fetch( + AaveProtocolDataProvider, + LendingPoolAddressProvider, + chainId, + web3, + connection, + ) + return allPairsWithArgs.map((args) => { + const [pair, pool, dataProvider] = args + return new AAVEProtocol(pair as PairToken, pool as string, dataProvider as string) + }) + } +} + +export const aaveLazyResolver = new AAVEResolver() diff --git a/packages/mask/src/plugins/Savings/protocols/alpaca/AlpacaProtocol.ts b/packages/mask/src/plugins/Savings/protocols/alpaca/AlpacaProtocol.ts new file mode 100644 index 000000000000..2e7cf6ec3ba2 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/alpaca/AlpacaProtocol.ts @@ -0,0 +1,211 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import BigNumber from 'bignumber.js' +import { ZERO } from '@masknet/web3-shared-base' +import { ChainId, createContract, TransactionEventType } from '@masknet/web3-shared-evm' +import { ProtocolType, PairToken, SavingsProtocol } from '../../types' +import type { AlpacaVault } from '@masknet/web3-contracts/types/AlpacaVault' +import AlpacaVaultABI from '@masknet/web3-contracts/abis/AlpacaVault.json' +import type { AlpacaVaultConfig } from '@masknet/web3-contracts/types/AlpacaVaultConfig' +import AlpacaVaultConfigABI from '@masknet/web3-contracts/abis/AlpacaVaultConfig.json' +import { SUMMARY_API } from './pairs' + +export const TIMESTAMPS_PER_DAY = 60 * 60 * 24 +export const DAYS_PER_YEAR = 365 + +export function createAlpacaContract(address: string, web3: Web3) { + return createContract(web3, address, AlpacaVaultABI as AbiItem[]) +} + +export function createAlpacaConfigContract(address: string, web3: Web3) { + return createContract(web3, address, AlpacaVaultConfigABI as AbiItem[]) +} + +export class AlpacaProtocol implements SavingsProtocol { + static DEFAULT_APR = '0.00' + + private _apr = '0.00' + private _balance = ZERO + static nativeToken = 'ibBNB' + + constructor(readonly pair: PairToken) {} + + get type() { + return ProtocolType.Alpaca + } + + get apr() { + return this._apr + } + + get balance() { + return this._balance + } + + get bareToken() { + return this.pair[0] + } + + get stakeToken() { + return this.pair[1] + } + + get approveAddress() { + return this.stakeToken.address + } + + get isNativeToken() { + return this.stakeToken.symbol === AlpacaProtocol.nativeToken + } + + public getPoolContract(web3: Web3) { + return createAlpacaContract(this.stakeToken.address, web3) + } + + public async updateApr(chainId: ChainId, web3: Web3) { + try { + if (!SUMMARY_API) { + this._apr = AlpacaProtocol.DEFAULT_APR + return + } + const req = await fetch(SUMMARY_API) + const response = await req.json() + const { lendingPools } = response.data + const summary = lendingPools.find((_: any) => _.ibToken.address === this.stakeToken.address) + this._apr = new BigNumber(summary.lendingApr).toFixed(2) + } catch (error) { + this._apr = AlpacaProtocol.DEFAULT_APR + } + } + + public async updateBalance(chainId: ChainId, web3: Web3, account: string) { + try { + const contract = this.getPoolContract(web3) + if (contract === null) { + this._balance = ZERO + return + } + const [shares, sharePrice] = await Promise.all([ + contract.methods.balanceOf(account).call(), + this.getSharePrice(web3), + ]) + // balance = shares * sharePrice + this._balance = new BigNumber(shares).multipliedBy(new BigNumber(sharePrice)).shiftedBy(-18) + } catch (error) { + this._balance = ZERO + } + } + + private async getSharePrice(web3: Web3): Promise { + try { + const contract = this.getPoolContract(web3) + if (contract === null) { + return ZERO + } + const [totalToken, totalSupply] = await Promise.all([ + contract.methods.totalToken().call(), + contract.methods.totalSupply().call(), + ]) + // sharePrice = totalToken / totalSupply + return new BigNumber(totalToken).shiftedBy(18).dividedBy(new BigNumber(totalSupply)) + } catch (error) { + return ZERO + } + } + + private async amountToShares(web3: Web3, value: BigNumber.Value) { + const sharePrice = await this.getSharePrice(web3) + // shares = amount / sharePrice + const shares = new BigNumber(value).shiftedBy(18).div(new BigNumber(sharePrice)) + return shares.toFixed(0) + } + + public async depositEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + try { + const operation = await this.createDepositTokenOperation(web3, value) + const gasEstimate = await operation?.estimateGas( + this.isNativeToken + ? { + value: value.toString(), + from: account, + } + : { + from: account, + }, + ) + return new BigNumber(gasEstimate || 0) + } catch (error) { + return ZERO + } + } + + private async createDepositTokenOperation(web3: Web3, value: BigNumber.Value) { + const contract = this.getPoolContract(web3) + return contract?.methods.deposit(value.toString()) + } + + public async deposit(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const gasEstimate = await this.depositEstimate(account, chainId, web3, value) + const operation = await this.createDepositTokenOperation(web3, value) + const args = this.isNativeToken + ? { + value: value.toString(), + from: account, + gas: gasEstimate.toNumber(), + } + : { + from: account, + gas: gasEstimate.toNumber(), + } + + if (!operation) { + throw new Error("Can't create deposit operation") + } + return new Promise((resolve, reject) => { + operation + .send(args) + .once(TransactionEventType.ERROR, reject) + .once(TransactionEventType.CONFIRMATION, (_, receipt) => { + resolve(receipt.transactionHash) + }) + }) + } + + private async createWithdrawTokenOperation(web3: Web3, value: BigNumber.Value) { + const contract = this.getPoolContract(web3) + const sharesToWithdraw = await this.amountToShares(web3, value) + return contract?.methods.withdraw(sharesToWithdraw) + } + + public async withdrawEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + try { + const operation = await this.createWithdrawTokenOperation(web3, value) + const gasEstimate = await operation?.estimateGas({ + from: account, + }) + return new BigNumber(gasEstimate || 0) + } catch (error) { + return ZERO + } + } + + public async withdraw(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) + const operation = await this.createWithdrawTokenOperation(web3, value) + + if (!operation) { + throw new Error("Can't create withdraw operation") + } + + return new Promise((resolve) => + operation + .send({ + from: account, + gas: gasEstimate.toNumber(), + }) + .once(TransactionEventType.CONFIRMATION, (_, receipt) => { + resolve(receipt.transactionHash) + }), + ) + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/alpaca/pairs.ts b/packages/mask/src/plugins/Savings/protocols/alpaca/pairs.ts new file mode 100644 index 000000000000..0335d3ae90d8 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/alpaca/pairs.ts @@ -0,0 +1,56 @@ +import { getAlpacaConstants, createNativeToken, ChainId } from '@masknet/web3-shared-evm' +import { AlpacaProtocol } from './AlpacaProtocol' +import type Web3 from 'web3' +import type { SavingsProtocol, PairToken, ProtocolPairsResolver } from '../../types' +import { flatten, chunk } from 'lodash-unified' +import { getFungibleTokensDetailed } from '../common/tokens' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +export const SUMMARY_API = getAlpacaConstants(ChainId.BSC).SUMMARY_API + +export class PairResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.BSC] + public async resolve( + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ): Promise { + if (!this.supportChains.includes(chainId)) { + return [] + } + if (!SUMMARY_API) return [] + const response = await fetch(SUMMARY_API) + const fullResponse: { + data: { + lendingPools: Array<{ + baseToken: { + address: string + symbol: string + } + ibToken: { + address: string + symbol: string + } + }> + } + } = await response.json() + const allTokens = flatten( + fullResponse.data.lendingPools.map((_) => { + return [_.baseToken.address, _.ibToken.address] + }), + ).map((m) => { + return m + }) + + const detailedTokens = await getFungibleTokensDetailed(allTokens, connection, chainId) + return chunk(detailedTokens, 2).map((pair) => { + const [bareToken, stakeToken] = pair + if (stakeToken.symbol === AlpacaProtocol.nativeToken) { + pair[0] = createNativeToken(ChainId.BSC) + } + return new AlpacaProtocol(pair as PairToken) + }) + } +} + +export const alpacaLazyResolver = new PairResolver() diff --git a/packages/mask/src/plugins/Savings/protocols/aurigami/AurigamiProtocol.ts b/packages/mask/src/plugins/Savings/protocols/aurigami/AurigamiProtocol.ts new file mode 100644 index 000000000000..90702d97ffd0 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/aurigami/AurigamiProtocol.ts @@ -0,0 +1,91 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import { createContract } from '@masknet/web3-shared-evm' +import { ProtocolType, PairToken, TokenDetail } from '../../types' +import { + default as BenQiRewardProtocol, + RewardToken, + MarketStatus, + emptyRewardType, + PairConfig, +} from '../common/protocol/BenQiRewardProtocol' +import BigNumber from 'bignumber.js' + +import type { AuriLens } from '@masknet/web3-contracts/types/AuriLens' +import AuriLensABI from '@masknet/web3-contracts/abis/AuriLens.json' +import { MARKETS_NOT_IN_PRICE_ORACLE, getNoneInPriceOraclePrices } from './price' + +export function getLensContract(address: string, web3: Web3) { + return createContract(web3, address, AuriLensABI as AbiItem[]) +} + +const auRewardTokenSymbol = 'auPLY' +const rewardTokens: RewardToken[] = [ + { + symbol: auRewardTokenSymbol, + rewardType: emptyRewardType, + }, +] + +export default class AurigamiProtocol extends BenQiRewardProtocol { + static nativeToken = 'auETH' + + constructor(pair: PairToken, allPairs: PairToken[], config: PairConfig) { + super(pair, AurigamiProtocol.nativeToken, allPairs, rewardTokens, config) + } + override get type() { + return ProtocolType.Aurigami + } + + // load price + public override async fetchPrices( + matchPairs: Array<{ + underlying: TokenDetail + market: TokenDetail + }>, + notInPairTokens: RewardToken[], + web3: Web3, + ) { + if (!this.config.lens) return [] + const lens = getLensContract(this.config.lens, web3) + if (lens === null) return [] + return Promise.all( + matchPairs + .filter((_) => _.market.symbol !== undefined) + .map(async (item) => { + const { underlying, market } = item + const notInOracle = market.symbol ? MARKETS_NOT_IN_PRICE_ORACLE.includes(market.symbol) : false + const price = notInOracle + ? await getNoneInPriceOraclePrices(web3, market.symbol) + : (await lens.methods.auTokenUnderlyingPrice(market.address).call())[1] + // https://github.com/Aurigami-Finance/aurigami-smart-contracts/blob/main/contracts/AuriOracle.sol#L124 + const defaultDecimals = 18 + const decimalDefault = 8 + const paddingDecimals = 10 + const decimalDelta = underlying.decimals - defaultDecimals + const divideDecimals = + underlying.decimals <= defaultDecimals + ? decimalDefault + paddingDecimals + defaultDecimals - underlying.decimals + : decimalDefault + paddingDecimals - decimalDelta + return { + symbol: market.symbol, + price: notInOracle ? price : new BigNumber(price).shiftedBy(-divideDecimals), + } as MarketStatus + }), + ) + } + + public override async fetchSpeeds(web3: Web3) { + if (!this.config.lens) return [] + const lens = getLensContract(this.config.lens, web3) + if (lens === null) return [] + const [plyRewardSupplySpeed, plyRewardBorrowSpeed, auroraRewardSupplySpeed, auroraRewardBorrowSpeed] = + await lens.methods.getRewardSpeeds(this.config.comptroller, this.stakeToken.address).call() + return [ + { + symbol: auRewardTokenSymbol, + speed: new BigNumber(plyRewardSupplySpeed), + }, + ] + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/aurigami/pairs.ts b/packages/mask/src/plugins/Savings/protocols/aurigami/pairs.ts new file mode 100644 index 000000000000..8a00fe157fbb --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/aurigami/pairs.ts @@ -0,0 +1,44 @@ +import type Web3 from 'web3' +import { ChainId, createNativeToken, ZERO_ADDRESS, getAurigamiConstants } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, ProtocolPairsResolver, PairToken } from '../../types' +import CompoundLikeFetcher from '../common/CompoundLikeFetcher' +import AurigamiProtocol from './AurigamiProtocol' +import type { PairConfig } from '../common/protocol/BenQiRewardProtocol' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +export const AURIGAMI_COMPTROLLER = getAurigamiConstants(ChainId.Aurora).COMPTROLLER || ZERO_ADDRESS +export const AURIGAMI_ORACLE = getAurigamiConstants(ChainId.Aurora).ORACLE || ZERO_ADDRESS +export const AURIGAMI_LENS = getAurigamiConstants(ChainId.Aurora).LENS || ZERO_ADDRESS + +const excludePairs = ['DAI', 'USN', 'TRI'] + +const pairConfig = { + comptroller: AURIGAMI_COMPTROLLER, + oracle: AURIGAMI_ORACLE, + lens: AURIGAMI_LENS, +} + +export class AurigamiPairResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.Aurora] + public async resolve( + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ): Promise { + if (!this.supportChains.includes(ChainId.Aurora)) { + return [] + } + const allPairs = await CompoundLikeFetcher.fetch(AURIGAMI_COMPTROLLER, chainId, web3, connection) + return allPairs + .filter((pair: PairToken) => pair[0]?.symbol && !excludePairs.includes(pair[0].symbol)) + .map((pair: PairToken) => { + const [bareToken, stakeToken] = pair + if (stakeToken.symbol === AurigamiProtocol.nativeToken) { + pair[0] = createNativeToken(ChainId.Aurora) + } + return new AurigamiProtocol(pair, allPairs, pairConfig) + }) + } +} + +export const aurigamiLazyResolver = new AurigamiPairResolver() diff --git a/packages/mask/src/plugins/Savings/protocols/aurigami/price.ts b/packages/mask/src/plugins/Savings/protocols/aurigami/price.ts new file mode 100644 index 000000000000..1691339c0038 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/aurigami/price.ts @@ -0,0 +1,92 @@ +import type Web3 from 'web3' +import { createERC20Tokens, getTraderConstants, ChainId } from '@masknet/web3-shared-evm' +import { getUniswapV2PairPrice } from '../common/tokens' +import type { TokenDetail } from '../../types' +import { ZERO } from '@masknet/web3-shared-base' +import type BigNumber from 'bignumber.js' +import { getPairAddress } from '../../../Trader/helpers/pair' +import { Token } from '@uniswap/sdk-core' + +export const PLY = createERC20Tokens('PLY_ADDRESS', 'PLY', 'PLY', 18)[ChainId.Aurora] +export const NEAR = createERC20Tokens('NEAR_ADDRESS', 'Near', 'NEAR', 24)[ChainId.Aurora] +export const USDT = createERC20Tokens('USDT_ADDRESS', 'Tether USD', 'USDT', 6)[ChainId.Aurora] +export const AURORA = createERC20Tokens('AURORA_ADDRESS', 'AURORA', 'AURORA', 18)[ChainId.Aurora] +export const TRI = createERC20Tokens('TRI_ADDRESS', 'TRI', 'TRI', 18)[ChainId.Aurora] + +const PAIR_PLY = { + token0: PLY, + token1: NEAR, + price: PLY, +} + +const PAIR_NEAR = { + token0: NEAR, + token1: USDT, + price: NEAR, +} + +const PAIR_AURORA = { + token0: AURORA, + token1: NEAR, + price: AURORA, +} + +const PAIR_TRI = { + token0: NEAR, + token1: TRI, + price: TRI, +} + +// get price from dex +export const MARKETS_NOT_IN_PRICE_ORACLE = ['auPLY', 'auNEAR', 'auTRI', 'auAURORA', 'auSTNEAR'] + +export async function getPriceFromTrisolaris( + token0: TokenDetail, + token1: TokenDetail, + priceToken: TokenDetail, + web3: Web3, +) { + const DEX_TRADE = getTraderConstants(ChainId.Aurora) + if (!DEX_TRADE.TRISOLARIS_FACTORY_ADDRESS || !DEX_TRADE.TRISOLARIS_INIT_CODE_HASH) return ZERO + const tokenA = new Token(ChainId.Aurora, token0.address, token0.decimals, token0.symbol, token0.name) + const tokenB = new Token(ChainId.Aurora, token1.address, token1.decimals, token1.symbol, token1.name) + const priceOfToken = new Token( + ChainId.Aurora, + priceToken.address, + priceToken.decimals, + priceToken.symbol, + priceToken.name, + ) + const pairAddress = getPairAddress( + DEX_TRADE.TRISOLARIS_FACTORY_ADDRESS, + DEX_TRADE.TRISOLARIS_INIT_CODE_HASH, + tokenA, + tokenB, + ) + return getUniswapV2PairPrice(pairAddress, tokenA, tokenB, priceOfToken, web3) +} + +export async function getNoneInPriceOraclePrices(web3: Web3, symbol?: string) { + if (!symbol) return ZERO + const plyPriceInNear = await getPriceFromTrisolaris(PAIR_PLY.token0, PAIR_PLY.token1, PAIR_PLY.price, web3) + const auroraPriceInNear = await getPriceFromTrisolaris( + PAIR_AURORA.token0, + PAIR_AURORA.token1, + PAIR_AURORA.price, + web3, + ) + + const triPriceInNear = await getPriceFromTrisolaris(PAIR_TRI.token0, PAIR_TRI.token1, PAIR_TRI.price, web3) + const nearPriceInUsdt = await getPriceFromTrisolaris(PAIR_NEAR.token0, PAIR_NEAR.token1, PAIR_NEAR.price, web3) + if (plyPriceInNear && nearPriceInUsdt && auroraPriceInNear && triPriceInNear) { + const priceList: { [key: string]: BigNumber } = { + auPLY: nearPriceInUsdt.multipliedBy(plyPriceInNear), + auNEAR: nearPriceInUsdt, + auSTNEAR: nearPriceInUsdt, + auTRI: nearPriceInUsdt.multipliedBy(triPriceInNear), + auAURORA: nearPriceInUsdt.multipliedBy(auroraPriceInNear), + } + return priceList[symbol] || ZERO + } + return ZERO +} diff --git a/packages/mask/src/plugins/Savings/protocols/benqi/BenQiProtocol.ts b/packages/mask/src/plugins/Savings/protocols/benqi/BenQiProtocol.ts new file mode 100644 index 000000000000..5ba25b158541 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/benqi/BenQiProtocol.ts @@ -0,0 +1,18 @@ +import { ProtocolType, PairToken } from '../../types' +import { default as BenQiRewardProtocol, RewardToken, PairConfig } from '../common/protocol/BenQiRewardProtocol' +import { BENQI_COMPTROLLER, BENQI_ChainlinkOracle } from '../../constants' + +export default class BenQiProtocol extends BenQiRewardProtocol { + static nativeToken = 'qiAVAX' + + constructor(pair: PairToken, allPairs: PairToken[], rewardTokens: RewardToken[]) { + super(pair, BenQiProtocol.nativeToken, allPairs, rewardTokens, { + comptroller: BENQI_COMPTROLLER, + oracle: BENQI_ChainlinkOracle, + }) + } + + override get type() { + return ProtocolType.BENQI + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/benqi/pairs.ts b/packages/mask/src/plugins/Savings/protocols/benqi/pairs.ts new file mode 100644 index 000000000000..db4129b05b15 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/benqi/pairs.ts @@ -0,0 +1,49 @@ +import type Web3 from 'web3' +import { ChainId, createNativeToken } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, ProtocolPairsResolver, PairToken } from '../../types' +import { BENQI_COMPTROLLER } from '../../constants' +import CompoundLikeFetcher from '../common/CompoundLikeFetcher' +import BenQiProtocol from './BenQiProtocol' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +export type RewardToken = { + symbol: string + rewardType: number +} + +const qiQiReward = 0 +const qiAVAXReward = 1 + +const rewardTokens: RewardToken[] = [ + { + symbol: 'qiQI', + rewardType: qiQiReward, + }, + { + symbol: 'qiAVAX', + rewardType: qiAVAXReward, + }, +] + +export class BenQiPairResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.Avalanche] + public async resolve( + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ): Promise { + if (!this.supportChains.includes(ChainId.Avalanche)) { + return [] + } + const allPairs = await CompoundLikeFetcher.fetch(BENQI_COMPTROLLER, chainId, web3, connection) + return allPairs.map((pair: PairToken) => { + const [bareToken, stakeToken] = pair + if (stakeToken.symbol === BenQiProtocol.nativeToken) { + pair[0] = createNativeToken(ChainId.Avalanche) + } + return new BenQiProtocol(pair, allPairs, rewardTokens) + }) + } +} + +export const benqiLazyResolver = new BenQiPairResolver() diff --git a/packages/mask/src/plugins/Savings/protocols/common/AAVELikeFetcher.ts b/packages/mask/src/plugins/Savings/protocols/common/AAVELikeFetcher.ts new file mode 100644 index 000000000000..23e9b09fb265 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/AAVELikeFetcher.ts @@ -0,0 +1,70 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import { createContract, ChainId } from '@masknet/web3-shared-evm' +import type { AaveProtocolDataProvider } from '@masknet/web3-contracts/types/AaveProtocolDataProvider' +import AaveProtocolDataProviderABI from '@masknet/web3-contracts/abis/AaveProtocolDataProvider.json' +import { flatten, compact, chunk } from 'lodash-unified' +import type { AaveLendingPoolAddressProvider } from '@masknet/web3-contracts/types/AaveLendingPoolAddressProvider' +import AaveLendingPoolAddressProviderABI from '@masknet/web3-contracts/abis/AaveLendingPoolAddressProvider.json' +import { getFungibleTokensDetailed } from './tokens' +import type { PairToken } from '../../types' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +export default class AAVELikeFetcher { + static getAaveLendingPoolAddressProviderContract(aaveLPoolAddress: string, chainId: ChainId, web3: Web3) { + const lPoolAddressProviderContract = createContract( + web3, + aaveLPoolAddress, + AaveLendingPoolAddressProviderABI as AbiItem[], + ) + return lPoolAddressProviderContract + } + + static getProtocolDataContract(dataAddress: string, chainId: ChainId, web3: Web3) { + return createContract(web3, dataAddress, AaveProtocolDataProviderABI as AbiItem[]) + } + + static async lookupPoolAddress(aaveLPoolAddress: string, chainId: ChainId, web3: Web3) { + const lPoolAddressProviderContract = this.getAaveLendingPoolAddressProviderContract( + aaveLPoolAddress, + chainId, + web3, + ) + if (lPoolAddressProviderContract === null) return null + return lPoolAddressProviderContract.methods.getLendingPool().call() + } + + static async lookupTokens(dataProviderAddress: string, chainId: ChainId, web3: Web3) { + const protocolDataContract = this.getProtocolDataContract(dataProviderAddress, chainId, web3) + if (protocolDataContract === null) return [] + const tokens = await protocolDataContract?.methods.getAllReservesTokens().call() + const aaveTokens = await Promise.all( + tokens?.map(async (token) => { + const tokenAddress = await protocolDataContract.methods.getReserveTokensAddresses(token[1]).call() + return [token[1], tokenAddress?.aTokenAddress] + }), + ) + const allTokens = compact(flatten(aaveTokens ?? [])) ?? [] + return allTokens + } + + static async fetch( + dataProviderAddress: string, + poolProviderAddress: string, + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ) { + const [allTokens, poolAddress] = await Promise.all([ + this.lookupTokens(dataProviderAddress, chainId, web3), + this.lookupPoolAddress(poolProviderAddress, chainId, web3), + ]) + + if (poolAddress === null) return [] + const detailedAaveTokens = await getFungibleTokensDetailed(allTokens, connection, chainId) + const allPairs = chunk(detailedAaveTokens, 2) + return allPairs.map((pair) => { + return [pair as PairToken, poolAddress, dataProviderAddress] + }) + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/common/CompoundLikeFetcher.ts b/packages/mask/src/plugins/Savings/protocols/common/CompoundLikeFetcher.ts new file mode 100644 index 000000000000..ab6893e206ca --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/CompoundLikeFetcher.ts @@ -0,0 +1,47 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import { createContract, ChainId, SchemaType, ZERO_ADDRESS } from '@masknet/web3-shared-evm' +import type { Comptroller } from '@masknet/web3-contracts/types/Comptroller' +import ComptrollerABI from '@masknet/web3-contracts/abis/Comptroller.json' +import { getFungibleTokensDetailed } from './tokens' +import type { CERC20 } from '@masknet/web3-contracts/types/CERC20' +import CERC20ABI from '@masknet/web3-contracts/abis/CERC20.json' +import { flatten, compact, chunk } from 'lodash-unified' +import type { Web3Helper } from '@masknet/plugin-infra/web3' +import type { FungibleToken } from '@masknet/web3-shared-base' + +export default class CompoundLikeFetcher { + static getComptrollerContract(address: string, web3: Web3) { + return createContract(web3, address, ComptrollerABI as AbiItem[]) + } + + static async lookupMeta(marketAddress: string, web3: Web3) { + const contract = createContract(web3, marketAddress, CERC20ABI as AbiItem[]) + try { + const underlying = await contract?.methods.underlying().call() + return [underlying, marketAddress] + } catch (error) { + // native token will throw error + console.error('CompoundLikeFetcher.lookupMeta failed', error) + } + return [ZERO_ADDRESS, marketAddress] + } + + static async lookupTokens(compAddress: string, web3: Web3) { + const comptroller = CompoundLikeFetcher.getComptrollerContract(compAddress, web3) + if (comptroller === null) { + return [] + } + const allMarkets = await comptroller.methods.getAllMarkets().call() + const allMarketsPairs = await Promise.all(allMarkets.map((market: string) => this.lookupMeta(market, web3))) + const allTokens = compact(flatten(allMarketsPairs ?? [])) ?? [] + return allTokens + } + + static async fetch(compAddress: string, chainId: ChainId, web3: Web3, connection: Web3Helper.Web3ConnectionScope) { + const allTokens = await this.lookupTokens(compAddress, web3) + const detailedTokens = await getFungibleTokensDetailed(allTokens, connection, chainId) + const allPairs = chunk(detailedTokens, 2) + return allPairs.map((pair) => pair as [FungibleToken, FungibleToken]) + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/common/protocol/AAVELikeProtocol.ts b/packages/mask/src/plugins/Savings/protocols/common/protocol/AAVELikeProtocol.ts new file mode 100644 index 000000000000..63a768e9f710 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/protocol/AAVELikeProtocol.ts @@ -0,0 +1,146 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import BigNumber from 'bignumber.js' +import { pow10, ZERO } from '@masknet/web3-shared-base' +import { ChainId, createContract, TransactionEventType } from '@masknet/web3-shared-evm' +import type { AaveLendingPool } from '@masknet/web3-contracts/types/AaveLendingPool' +import AaveLendingPoolABI from '@masknet/web3-contracts/abis/AaveLendingPool.json' +import { ProtocolType, SavingsProtocol, PairToken } from '../../../types' +import AAVELikeFetcher from '../AAVELikeFetcher' + +export default class AAVELikeProtocol implements SavingsProtocol { + static DEFAULT_APR = '0.00' + + private _apr = '0.00' + private _balance = ZERO + private poolAddress + private dataProviderAddr + + constructor(readonly pair: PairToken, poolAddress: string, dataProviderAddr: string) { + this.poolAddress = poolAddress + this.dataProviderAddr = dataProviderAddr + } + + get type() { + return ProtocolType.AAVE + } + + get apr() { + return this._apr + } + + get balance() { + return this._balance + } + + get bareToken() { + return this.pair[0] + } + + get stakeToken() { + return this.pair[1] + } + + get approveAddress() { + return this.poolAddress + } + + public async updateApr(chainId: ChainId, web3: Web3) { + try { + const contract = AAVELikeFetcher.getProtocolDataContract(this.dataProviderAddr, chainId, web3) + if (contract === null) { + return + } + const reserveData = await contract?.methods.getReserveData(this.bareToken.address).call() + const liquidityRate = reserveData.liquidityRate + const RAY = pow10(27) // 10 to the power 27 + // // APY and APR are returned here as decimals, multiply by 100 to get the percents + this._apr = new BigNumber(liquidityRate).times(100).div(RAY).toFixed(2) + } catch (error) { + console.error('AAVELikeProtocol: Apr Error:', error) + this._apr = AAVELikeProtocol.DEFAULT_APR + } + } + + public async updateBalance(chainId: ChainId, web3: Web3, account: string) { + try { + const contract = AAVELikeFetcher.getProtocolDataContract(this.dataProviderAddr, chainId, web3) + if (contract === null) { + return + } + const userReserveData = await contract?.methods.getUserReserveData(this.bareToken.address, account).call() + this._balance = new BigNumber(userReserveData.currentATokenBalance) + } catch (error) { + console.error('AAVELikeProtocol BALANCE ERROR: ', error) + this._balance = ZERO + } + } + + public async depositEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + try { + const operation = await this.createDepositTokenOperation(account, chainId, web3, value) + const gasEstimate = await operation?.estimateGas({ + from: account, + }) + + return new BigNumber(gasEstimate || 0) + } catch (error) { + console.error('AAVELikeProtocol deposit estimate ERROR: ', error) + return ZERO + } + } + + private async createDepositTokenOperation(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const contract = createContract(web3, this.poolAddress, AaveLendingPoolABI as AbiItem[]) + return contract?.methods.deposit(this.bareToken.address, new BigNumber(value).toFixed(), account, '0') + } + + public async deposit(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const gasEstimate = await this.depositEstimate(account, chainId, web3, value) + const operation = await this.createDepositTokenOperation(account, chainId, web3, value) + if (!operation) { + throw new Error("Can't create deposit operation") + } + return new Promise((resolve, reject) => { + operation + .send({ + from: account, + gas: gasEstimate.toNumber(), + }) + .once(TransactionEventType.ERROR, reject) + .once(TransactionEventType.CONFIRMATION, (_, receipt) => { + resolve(receipt.transactionHash) + }) + }) + } + + public async withdrawEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + try { + const contract = createContract(web3, this.poolAddress, AaveLendingPoolABI as AbiItem[]) + const gasEstimate = await contract?.methods + .withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account) + .estimateGas({ + from: account, + }) + return new BigNumber(gasEstimate || 0) + } catch (error) { + return ZERO + } + } + + public async withdraw(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) + const contract = createContract(web3, this.poolAddress, AaveLendingPoolABI as AbiItem[]) + return new Promise((resolve) => + contract?.methods + .withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account) + .send({ + from: account, + gas: gasEstimate.toNumber(), + }) + .once(TransactionEventType.CONFIRMATION, (_, receipt) => { + resolve(receipt.transactionHash) + }), + ) + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/common/protocol/BenQiRewardProtocol.ts b/packages/mask/src/plugins/Savings/protocols/common/protocol/BenQiRewardProtocol.ts new file mode 100644 index 000000000000..0a68fca01026 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/protocol/BenQiRewardProtocol.ts @@ -0,0 +1,233 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import BigNumber from 'bignumber.js' +import type { PairToken, TokenDetail } from '../../../types' +import CompoundTimestampBasedProtocol from './CompoundTimestampBasedProtocol' +import type { ChainId } from '@masknet/web3-shared-evm' +import { createContract } from '@masknet/web3-shared-evm' +import { isZero, ZERO } from '@masknet/web3-shared-base' +import type { BenQiComptroller } from '@masknet/web3-contracts/types/BenQiComptroller' +import BenQiComptrollerABI from '@masknet/web3-contracts/abis/BenQiComptroller.json' +import type { BenqiChainlinkOracle } from '@masknet/web3-contracts/types/BenqiChainlinkOracle' +import BenqiChainlinkOracleABI from '@masknet/web3-contracts/abis/BenqiChainlinkOracle.json' + +export const emptyRewardType = -1 +export type RewardToken = { + symbol: string + rewardType: number +} + +export type RewardSpeed = { + symbol: string + speed: BigNumber +} + +export type PairConfig = { + oracle: string + comptroller: string + lens?: string +} +export type MarketStatus = { + symbol: string + price: BigNumber +} + +export type IndexWithStatus = { + [key: string]: MarketStatus +} + +export function getBenQiComptrollerContract(address: string, web3: Web3) { + return createContract(web3, address, BenQiComptrollerABI as AbiItem[]) +} + +export function getBenQiOracleComptrollerContract(address: string, web3: Web3) { + return createContract(web3, address, BenqiChainlinkOracleABI as AbiItem[]) +} + +export default class BenQiRewardProtocol extends CompoundTimestampBasedProtocol { + constructor( + pair: PairToken, + nativeToken: string, + readonly allPairs: PairToken[], + readonly rewardTokens: RewardToken[], + readonly config: PairConfig, + ) { + super(pair, nativeToken) + } + + // load price + public async fetchPrices( + matchPairs: Array<{ + underlying: TokenDetail + market: TokenDetail + }>, + notInPairTokens: RewardToken[], + web3: Web3, + ) { + const oracle = getBenQiOracleComptrollerContract(this.config.oracle, web3) + if (oracle === null) return [] + return Promise.all( + matchPairs + .filter((_) => _.market.symbol !== undefined) + .map(async (item) => { + const { underlying, market } = item + const price = await oracle.methods.getUnderlyingPrice(market.address).call() + // https://github.com/Benqi-fi/BENQI-Smart-Contracts/blob/master/Chainlink/BenqiChainlinkOracle.sol#L43 + // https://github.com/tranquil-finance/core-contracts/blob/master/contracts/Chainlink/TranquilChainlinkOracle.sol#L53 + const defaultDecimals = 18 + const decimalDelta = defaultDecimals - underlying.decimals + const divideDecimals = decimalDelta > 0 ? defaultDecimals + decimalDelta : defaultDecimals + return { + symbol: market.symbol, + price: new BigNumber(price).shiftedBy(-divideDecimals), + } as MarketStatus + }), + ) + } + + // load reward token speed + public async fetchSpeeds(web3: Web3) { + const comptroller = getBenQiComptrollerContract(this.config.comptroller, web3) + if (comptroller === null) return [] + return Promise.all( + this.rewardTokens.map(async ({ rewardType, symbol }) => { + // https://snowtrace.io/tx/0x68a0a82884299df30c33a4ac36d32d247db7e3fa379cd41a1a1bc2f07f4cb173 + // `rewardSpeeds` renamed `supplyRewardSpeeds` since May-02-2022 09:47:38 AM + const speed = await comptroller.methods.supplyRewardSpeeds(rewardType, this.stakeToken.address).call() + return { + speed: new BigNumber(speed), + symbol, + } as RewardSpeed + }), + ) + } + + // include rewardToken and stakeToken + public async getAllNeedFetchPricePairs() { + const allTokens = [ + { + symbol: this.stakeToken.symbol, + rewardType: emptyRewardType, + }, + ].concat(this.rewardTokens) + const matchPairs = this.allPairs + .filter((pair: PairToken) => pair[1]?.symbol && allTokens.find((item) => item.symbol === pair[1].symbol)) + .map((pair: PairToken) => { + return { + underlying: pair[0], + market: pair[1], + } + }) + + const notMatchTokens = this.rewardTokens.filter( + (rewardToken: RewardToken) => !this.allPairs.find((item) => rewardToken.symbol === item[1].symbol), + ) + + return { + matchPairs, + notMatchTokens, + } + } + + public async loadMarketPriceAndSpeed(comptroller: BenQiComptroller, web3: Web3) { + const { matchPairs: needLoadPricePairs, notMatchTokens: notInPairTokens } = + await this.getAllNeedFetchPricePairs() + let allPrice: MarketStatus[] = [] + try { + allPrice = await this.fetchPrices(needLoadPricePairs, notInPairTokens, web3) + } catch (error) { + console.error('BenQiRewardProtocol.fetchPrices', error) + } + let currentMarketSpeeds: RewardSpeed[] = [] + try { + currentMarketSpeeds = await this.fetchSpeeds(web3) + } catch (error) { + console.error('BenQiRewardProtocol.fetchSpeeds', error) + } + const indexBySymbol: IndexWithStatus = {} + allPrice.forEach((item: MarketStatus) => { + indexBySymbol[item.symbol] = item + }) + return { + allPrices: indexBySymbol, + currentMarketSpeeds, + } + } + + // curRewardsPerDay = curRewardSpeed * 60 * 60 * 24 + // curBaseSupply = curRewardPrice * curRewardsPerDay / assetTotalSupply * assetPrice + // curRewardSupplyAPR = curBaseSupply * 365 + public override async getDistributionAPR(chainId: ChainId, web3: Web3): Promise { + const comptroller = getBenQiComptrollerContract(this.config.comptroller, web3) + const market = this.getPoolContract(web3) + if (market === null) return ZERO + if (comptroller === null) return ZERO + + try { + const { allPrices: symbolWithPrice, currentMarketSpeeds } = await this.loadMarketPriceAndSpeed( + comptroller, + web3, + ) + + // market supply + const [totalSupply, exchangeRate] = await Promise.all([ + market.methods.totalSupply().call(), + market.methods.exchangeRateStored().call(), + ]) + + const bareTokenDecimals = 18 + this.bareToken.decimals + const totalSupplyAmount = new BigNumber(totalSupply) + .times(new BigNumber(exchangeRate)) + .shiftedBy(-bareTokenDecimals) + + const marketPrice = this.stakeToken.symbol && symbolWithPrice[this.stakeToken.symbol].price + // can not fetch the price + if (!marketPrice) return ZERO + if (marketPrice && isZero(marketPrice)) { + return ZERO + } + + const totalPrice = marketPrice ? totalSupplyAmount.times(marketPrice) : ZERO + const rewardsAPR = this.rewardTokens.map(({ symbol }) => { + // price not found + if (!symbolWithPrice[symbol]) { + return { + apr: ZERO, + } + } + const { price: rewardPrice } = symbolWithPrice[symbol] + const speedItem = currentMarketSpeeds.find((_) => _.symbol === symbol) + if (!speedItem) + return { + apr: ZERO, + } + + const { speed: rewardSpeed } = speedItem + const rewardPerDay = rewardSpeed.shiftedBy(-18).times(60 * 60 * 24) + const rewardValue = rewardPerDay.times(rewardPrice) + const supplyBase = rewardValue.div(totalPrice) + const supply = supplyBase.times(365).times(100) + return { + symbol, + marketPrice: marketPrice ? marketPrice.toString(10) : 0, + rewardPrice: rewardPrice.toString(10), + rewardPerDay: rewardPerDay.toString(10), + rewardValue: rewardValue.toString(10), + supplyBase: supplyBase.toString(10), + rewardSpeed: rewardSpeed.toString(10), + totalPrice: totalPrice.toString(10), + aprDisplay: supply.toString(10), + apr: supply, + } + }) + let totalDistributionAPR = ZERO + rewardsAPR.forEach((item) => { + totalDistributionAPR = totalDistributionAPR.plus(item.apr) + }) + return totalDistributionAPR + } catch (error) { + console.error('getDistributionAPR', error) + return ZERO + } + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/common/protocol/CompoundBlockBasedProtocol.ts b/packages/mask/src/plugins/Savings/protocols/common/protocol/CompoundBlockBasedProtocol.ts new file mode 100644 index 000000000000..3a4bff36e4da --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/protocol/CompoundBlockBasedProtocol.ts @@ -0,0 +1,170 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import BigNumber from 'bignumber.js' +import { ZERO } from '@masknet/web3-shared-base' +import { ChainId, createContract, TransactionEventType } from '@masknet/web3-shared-evm' +import { ProtocolType, SavingsProtocol, PairToken } from '../../../types' +import type { CERC20 } from '@masknet/web3-contracts/types/CERC20' +import type { CEther } from '@masknet/web3-contracts/types/CEther' +import CERC20ABI from '@masknet/web3-contracts/abis/CERC20.json' +import CEtherABI from '@masknet/web3-contracts/abis/CEther.json' + +export const BLOCKS_PER_DAY = 6570 +export const DAYS_PER_YEAR = 365 + +export default class CompoundBlockBasedProtocol implements SavingsProtocol { + private DEFAULT_APR = '0.00' + + private _apr = '0.00' + private _balance = ZERO + + constructor(readonly pair: PairToken, readonly nativeToken: string) {} + + get type() { + return ProtocolType.Compound + } + + get apr() { + return this._apr + } + + get balance() { + return this._balance + } + + get bareToken() { + return this.pair[0] + } + + get stakeToken() { + return this.pair[1] + } + + get isNativeToken() { + return this.stakeToken.symbol === this.nativeToken + } + + get approveAddress() { + return this.stakeToken.address + } + + public getPoolContract(web3: Web3) { + const contract = this.isNativeToken + ? createContract(web3, this.stakeToken.address, CEtherABI as AbiItem[]) + : createContract(web3, this.stakeToken.address, CERC20ABI as AbiItem[]) + return contract + } + + public async updateApr(chainId: ChainId, web3: Web3) { + try { + const contract = this.getPoolContract(web3) + if (contract === null) { + this._apr = this.DEFAULT_APR + return + } + const supplyRate = await contract.methods.supplyRatePerBlock().call() + const supplyBase = new BigNumber(supplyRate).times(BLOCKS_PER_DAY) + const apy = supplyBase.times(DAYS_PER_YEAR).shiftedBy(-16) + this._apr = apy.toFixed(2) + } catch (error) { + this._apr = this.DEFAULT_APR + } + } + + public async updateBalance(chainId: ChainId, web3: Web3, account: string) { + try { + const contract = this.getPoolContract(web3) + if (contract === null) { + this._balance = ZERO + return + } + const balance = await contract.methods.balanceOfUnderlying(account).call() + this._balance = new BigNumber(balance) + } catch (error) { + this._balance = ZERO + } + } + + public async depositEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + try { + const operation = await this.createDepositTokenOperation(web3, value) + const args = this.isNativeToken + ? { + value: value.toString(), + from: account, + } + : { + from: account, + } + const gasEstimate = await operation?.estimateGas(args) + return new BigNumber(gasEstimate || 0) + } catch (error) { + return ZERO + } + } + + private async createDepositTokenOperation(web3: Web3, value: BigNumber.Value) { + const contract = this.getPoolContract(web3) + if (this.isNativeToken) { + return (contract as CEther)?.methods.mint() + } else { + return contract?.methods.mint(value.toString()) + } + } + + public async deposit(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const gasEstimate = await this.depositEstimate(account, chainId, web3, value) + const operation = await this.createDepositTokenOperation(web3, value) + const args = this.isNativeToken + ? { + from: account, + value: value.toString(), + gas: gasEstimate.toNumber(), + } + : { + from: account, + gas: gasEstimate.toNumber(), + } + + if (!operation) { + throw new Error("Can't create deposit operation") + } + return new Promise((resolve, reject) => { + operation + .send(args) + .once(TransactionEventType.ERROR, reject) + .once(TransactionEventType.CONFIRMATION, (_, receipt) => { + resolve(receipt.transactionHash) + }) + }) + } + + public async withdrawEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + try { + const contract = this.getPoolContract(web3) + const operation = contract?.methods.redeemUnderlying(value.toString()) + const gasEstimate = await operation?.estimateGas({ + from: account, + }) + return new BigNumber(gasEstimate || 0) + } catch (error) { + return ZERO + } + } + + public async withdraw(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) + const contract = this.getPoolContract(web3) + return new Promise((resolve) => + contract?.methods + .redeemUnderlying(value.toString()) + .send({ + from: account, + gas: gasEstimate.toNumber(), + }) + .once(TransactionEventType.CONFIRMATION, (_, receipt) => { + resolve(receipt.transactionHash) + }), + ) + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/common/protocol/CompoundTimestampBasedProtocol.ts b/packages/mask/src/plugins/Savings/protocols/common/protocol/CompoundTimestampBasedProtocol.ts new file mode 100644 index 000000000000..e36125cb4065 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/protocol/CompoundTimestampBasedProtocol.ts @@ -0,0 +1,176 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import BigNumber from 'bignumber.js' +import { ZERO } from '@masknet/web3-shared-base' +import { ChainId, createContract, TransactionEventType } from '@masknet/web3-shared-evm' +import { ProtocolType, SavingsProtocol, PairToken } from '../../../types' +import type { QiERC20 } from '@masknet/web3-contracts/types/QiERC20' +import type { QiAvax } from '@masknet/web3-contracts/types/QiAvax' +import QiERC20ABI from '@masknet/web3-contracts/abis/QiERC20.json' +import QiAvaxABI from '@masknet/web3-contracts/abis/QiAvax.json' + +export const TIMESTAMPS_PER_DAY = 60 * 60 * 24 +export const DAYS_PER_YEAR = 365 + +export default class CompoundTimestampBasedProtocol implements SavingsProtocol { + private DEFAULT_APR = '0.00' + + private _apr = '0.00' + private _balance = ZERO + + constructor(readonly pair: PairToken, readonly nativeToken: string) {} + + get type() { + return ProtocolType.BENQI + } + + get apr() { + return this._apr + } + + get balance() { + return this._balance + } + + get bareToken() { + return this.pair[0] + } + + get stakeToken() { + return this.pair[1] + } + + get approveAddress() { + return this.stakeToken.address + } + + get isNativeToken() { + return this.stakeToken.symbol === this.nativeToken + } + + public getPoolContract(web3: Web3) { + const contract = this.isNativeToken + ? createContract(web3, this.stakeToken.address, QiAvaxABI as AbiItem[]) + : createContract(web3, this.stakeToken.address, QiERC20ABI as AbiItem[]) + return contract + } + + public async getDistributionAPR(chainId: ChainId, web3: Web3): Promise { + return ZERO + } + + public async updateApr(chainId: ChainId, web3: Web3) { + try { + const contract = this.getPoolContract(web3) + if (contract === null) { + this._apr = this.DEFAULT_APR + return + } + const [supplyRate, distributionAPR] = await Promise.all([ + contract.methods.supplyRatePerTimestamp().call(), + this.getDistributionAPR(chainId, web3), + ]) + const supplyBase = new BigNumber(supplyRate).times(TIMESTAMPS_PER_DAY) + const apy = supplyBase.times(DAYS_PER_YEAR).shiftedBy(-16) + this._apr = apy.plus(distributionAPR).toFixed(2) + } catch (error) { + this._apr = this.DEFAULT_APR + } + } + + public async updateBalance(chainId: ChainId, web3: Web3, account: string) { + try { + const contract = this.getPoolContract(web3) + if (contract === null) { + this._balance = ZERO + return + } + const balance = await contract.methods.balanceOfUnderlying(account).call() + this._balance = new BigNumber(balance) + } catch (error) { + this._balance = ZERO + } + } + + public async depositEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + try { + const operation = await this.createDepositTokenOperation(web3, value) + const args = this.isNativeToken + ? { + value: value.toString(), + from: account, + } + : { + from: account, + } + const gasEstimate = await operation?.estimateGas(args) + return new BigNumber(gasEstimate || 0) + } catch (error) { + return ZERO + } + } + + private async createDepositTokenOperation(web3: Web3, value: BigNumber.Value) { + const contract = this.getPoolContract(web3) + if (this.isNativeToken) { + return (contract as QiAvax)?.methods.mint() + } else { + return contract?.methods.mint(value.toString()) + } + } + + public async deposit(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const gasEstimate = await this.depositEstimate(account, chainId, web3, value) + const operation = await this.createDepositTokenOperation(web3, value) + const args = this.isNativeToken + ? { + from: account, + value: value.toString(), + gas: gasEstimate.toNumber(), + } + : { + from: account, + gas: gasEstimate.toNumber(), + } + if (!operation) { + throw new Error("Can't create deposit operation") + } + return new Promise((resolve, reject) => { + operation + .send(args) + .once(TransactionEventType.ERROR, reject) + .once(TransactionEventType.CONFIRMATION, (_, receipt) => { + resolve(receipt.transactionHash) + }) + }) + } + + public async withdrawEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + try { + const contract = this.getPoolContract(web3) + const operation = contract?.methods.redeemUnderlying(value.toString()) + const gasEstimate = await operation?.estimateGas({ + from: account, + }) + return new BigNumber(gasEstimate || 0) + } catch (error) { + return ZERO + } + } + + public async withdraw(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { + const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) + const contract = this.getPoolContract(web3) + return new Promise((resolve) => + contract?.methods + .redeemUnderlying(value.toString()) + .send({ + from: account, + gas: gasEstimate.toNumber(), + }) + .once(TransactionEventType.CONFIRMATION, (_, receipt) => { + resolve(receipt.transactionHash) + }), + ) + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/common/tokens.ts b/packages/mask/src/plugins/Savings/protocols/common/tokens.ts new file mode 100644 index 000000000000..22e8191ccb84 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/tokens.ts @@ -0,0 +1,51 @@ +import { ChainId, createContract } from '@masknet/web3-shared-evm' +import type { NetworkPluginID } from '@masknet/web3-shared-base' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +import { Pair as UniswapPair } from '@uniswap/v2-sdk' +import { CurrencyAmount, Token } from '@uniswap/sdk-core' +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import type { Pair } from '@masknet/web3-contracts/types/Pair' +import PairABI from '@masknet/web3-contracts/abis/Pair.json' +import BigNumber from 'bignumber.js' + +export async function getUniswapV2PairPrice( + pairAddress: string, + token0: Token, + token1: Token, + priceToken: Token, + web3: Web3, +) { + const pair = createContract(web3, pairAddress, PairABI as AbiItem[]) + const [reserves] = await Promise.all([pair?.methods.getReserves().call()]) + if (!reserves) return null + + const uniPair = new UniswapPair( + CurrencyAmount.fromRawAmount(token0, reserves._reserve0), + CurrencyAmount.fromRawAmount(token1, reserves._reserve1), + ) + const paddingDecimalsLimit = 18 + const pricePaddingDecimals = + token0.decimals < paddingDecimalsLimit || token1.decimals < paddingDecimalsLimit + ? paddingDecimalsLimit - token1.decimals + token0.decimals + : 0 + const curPrice = new BigNumber( + (priceToken.symbol === token0.symbol ? uniPair.token0Price : uniPair.token1Price).toSignificant(10), + ).shiftedBy(pricePaddingDecimals) + return curPrice +} + +export async function getFungibleTokensDetailed( + allTokens: string[], + connection: Web3Helper.Web3ConnectionScope, + chainId: ChainId, +): Promise>> { + return Promise.all( + allTokens.map(async (address, i) => { + return connection.getFungibleToken?.(address ?? '', { + chainId, + }) + }), + ) +} diff --git a/packages/mask/src/plugins/Savings/protocols/compound/CompoundProtocol.ts b/packages/mask/src/plugins/Savings/protocols/compound/CompoundProtocol.ts new file mode 100644 index 000000000000..44beafab5285 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/compound/CompoundProtocol.ts @@ -0,0 +1,14 @@ +import { ProtocolType, PairToken } from '../../types' +import CompoundBlockBasedProtocol from '../common/protocol/CompoundBlockBasedProtocol' + +export default class CompoundProtocol extends CompoundBlockBasedProtocol { + static nativeToken = 'cETH' + + constructor(pair: PairToken) { + super(pair, CompoundProtocol.nativeToken) + } + + override get type() { + return ProtocolType.Compound + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/compound/pairs.ts b/packages/mask/src/plugins/Savings/protocols/compound/pairs.ts new file mode 100644 index 000000000000..a27c21096bca --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/compound/pairs.ts @@ -0,0 +1,30 @@ +import type Web3 from 'web3' +import { ChainId, createNativeToken } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, ProtocolPairsResolver, PairToken } from '../../types' +import { COMPOUND_COMPTROLLER } from '../../constants' +import CompoundLikeFetcher from '../common/CompoundLikeFetcher' +import CompoundProtocol from './CompoundProtocol' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +export class CompoundPairResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.Mainnet] + public async resolve( + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ): Promise { + if (!this.supportChains.includes(ChainId.Mainnet)) { + return [] + } + const allPairs = await CompoundLikeFetcher.fetch(COMPOUND_COMPTROLLER, chainId, web3, connection) + return allPairs.map((pair: PairToken) => { + const [bareToken, stakeToken] = pair + if (stakeToken.symbol === CompoundProtocol.nativeToken) { + pair[0] = createNativeToken(ChainId.Mainnet) + } + return new CompoundProtocol(pair) + }) + } +} + +export const compoundLazyResolver = new CompoundPairResolver() diff --git a/packages/mask/src/plugins/Savings/protocols/giest/GiestProtocol.ts b/packages/mask/src/plugins/Savings/protocols/giest/GiestProtocol.ts new file mode 100644 index 000000000000..bc3faac925b4 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/giest/GiestProtocol.ts @@ -0,0 +1,8 @@ +import { ProtocolType } from '../../types' +import AAVELikeProtocol from '../common/protocol/AAVELikeProtocol' + +export class GiestProtocol extends AAVELikeProtocol { + override get type() { + return ProtocolType.Giest + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/giest/pairs.ts b/packages/mask/src/plugins/Savings/protocols/giest/pairs.ts new file mode 100644 index 000000000000..05c8a40f9b7c --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/giest/pairs.ts @@ -0,0 +1,43 @@ +import type Web3 from 'web3' +import { ChainId, getGiestConstants, ZERO_ADDRESS } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, PairToken, ProtocolPairsResolver } from '../../types' +import AAVELikeFetcher from '../common/AAVELikeFetcher' +import { GiestProtocol } from './GiestProtocol' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +// Metadata +// addresses: +// https://docs.geist.finance/useful-info/deployments-addresses +// + +export const AaveProtocolDataProvider = getGiestConstants(ChainId.Fantom).PROTOCOL_DATA_PROVIDER || ZERO_ADDRESS +export const LendingPoolAddressProvider = + getGiestConstants(ChainId.Fantom).LENDING_POOL_ADDRESSES_PROVIDER || ZERO_ADDRESS + +export class GiestPairResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.Fantom] + + public async resolve( + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ): Promise { + if (!this.supportChains.includes(chainId)) { + return [] + } + + const allPairsWithArgs = await AAVELikeFetcher.fetch( + AaveProtocolDataProvider, + LendingPoolAddressProvider, + chainId, + web3, + connection, + ) + return allPairsWithArgs.map((args) => { + const [pair, pool, dataProvider] = args + return new GiestProtocol(pair as PairToken, pool as string, dataProvider as string) + }) + } +} + +export const giestLazyResolver = new GiestPairResolver() diff --git a/packages/mask/src/plugins/Savings/protocols/index.ts b/packages/mask/src/plugins/Savings/protocols/index.ts index c4e741db42d2..fb8a4236c520 100644 --- a/packages/mask/src/plugins/Savings/protocols/index.ts +++ b/packages/mask/src/plugins/Savings/protocols/index.ts @@ -1,8 +1,25 @@ -import { AAVE_PAIRS, LDO_PAIRS } from '../constants' -import { LidoProtocol } from './LDOProtocol' -import { AAVEProtocol } from './AAVEProtocol' - -export const SavingsProtocols = [ - ...LDO_PAIRS.map((pair) => new LidoProtocol(pair)), - ...AAVE_PAIRS.map((pair) => new AAVEProtocol(pair)), -] +import { LDO_PAIRS } from './ldo/pairs' +import type { ProtocolPairsResolver } from '../types' + +import { aaveLazyResolver } from './aave/pairs' +import { compoundLazyResolver } from './compound/pairs' +import { benqiLazyResolver } from './benqi/pairs' + +import { alpacaLazyResolver } from './alpaca/pairs' +import { moolaLazyResolver } from './moola/pairs' +import { aurigamiLazyResolver } from './aurigami/pairs' +import { giestLazyResolver } from './giest/pairs' +import { tranquilLazyResolver } from './tranquil/pairs' + +export const SavingsProtocols = [...LDO_PAIRS] +export const LazyProtocolsResolvers: ProtocolPairsResolver[] = [] + +LazyProtocolsResolvers.push(aaveLazyResolver) + +LazyProtocolsResolvers.push(compoundLazyResolver) +LazyProtocolsResolvers.push(benqiLazyResolver) +LazyProtocolsResolvers.push(alpacaLazyResolver) +LazyProtocolsResolvers.push(moolaLazyResolver) +LazyProtocolsResolvers.push(aurigamiLazyResolver) +LazyProtocolsResolvers.push(giestLazyResolver) +LazyProtocolsResolvers.push(tranquilLazyResolver) diff --git a/packages/mask/src/plugins/Savings/protocols/LDOProtocol.ts b/packages/mask/src/plugins/Savings/protocols/ldo/LDOProtocol.ts similarity index 97% rename from packages/mask/src/plugins/Savings/protocols/LDOProtocol.ts rename to packages/mask/src/plugins/Savings/protocols/ldo/LDOProtocol.ts index c13f8025566b..2bb27b80ca51 100644 --- a/packages/mask/src/plugins/Savings/protocols/LDOProtocol.ts +++ b/packages/mask/src/plugins/Savings/protocols/ldo/LDOProtocol.ts @@ -12,13 +12,14 @@ import { import { FungibleToken, ZERO } from '@masknet/web3-shared-base' import type { Lido } from '@masknet/web3-contracts/types/Lido' import LidoABI from '@masknet/web3-contracts/abis/Lido.json' -import { ProtocolType, SavingsProtocol } from '../types' +import { ProtocolType, SavingsProtocol } from '../../types' export class LidoProtocol implements SavingsProtocol { private _apr = '0.00' private _balance = ZERO readonly type = ProtocolType.Lido + approveAddress: string | undefined constructor(readonly pair: [FungibleToken, FungibleToken]) {} diff --git a/packages/mask/src/plugins/Savings/protocols/ldo/pairs.ts b/packages/mask/src/plugins/Savings/protocols/ldo/pairs.ts new file mode 100644 index 000000000000..1ccb9593dcbb --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/ldo/pairs.ts @@ -0,0 +1,12 @@ +import { LidoProtocol } from './LDOProtocol' +import type { FungibleToken } from '@masknet/web3-shared-base' +import { ChainId, createERC20Tokens, createNativeToken, SchemaType } from '@masknet/web3-shared-evm' + +export const LDO_PAIRS_LIST: Array<[FungibleToken, FungibleToken]> = [ + [ + createNativeToken(ChainId.Mainnet), + createERC20Tokens('LDO_stETH_ADDRESS', 'Liquid staked Ether 2.0', 'stETH', 18)[ChainId.Mainnet], + ], +] + +export const LDO_PAIRS = LDO_PAIRS_LIST.map((pair) => new LidoProtocol(pair)) diff --git a/packages/mask/src/plugins/Savings/protocols/moola/MoolaProtocol.ts b/packages/mask/src/plugins/Savings/protocols/moola/MoolaProtocol.ts new file mode 100644 index 000000000000..eda3ef548151 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/moola/MoolaProtocol.ts @@ -0,0 +1,8 @@ +import { ProtocolType } from '../../types' +import AAVELikeProtocol from '../common/protocol/AAVELikeProtocol' + +export class MoolaProtocol extends AAVELikeProtocol { + override get type() { + return ProtocolType.Moola + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/moola/pairs.ts b/packages/mask/src/plugins/Savings/protocols/moola/pairs.ts new file mode 100644 index 000000000000..46174a1c8e8f --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/moola/pairs.ts @@ -0,0 +1,40 @@ +import type Web3 from 'web3' +import { ChainId, getMoolaConstants, ZERO_ADDRESS } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, PairToken, ProtocolPairsResolver } from '../../types' +import AAVELikeFetcher from '../common/AAVELikeFetcher' +import { MoolaProtocol } from './MoolaProtocol' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +// Metadata +// address from: +// https://github.com/moolamarket/moola-v2/blob/main/cli.js#L290 +// +const AaveProtocolDataProvider = getMoolaConstants(ChainId.Celo).PROTOCOL_DATA_PROVIDER || ZERO_ADDRESS +const LendingPoolAddressProvider = getMoolaConstants(ChainId.Celo)?.LENDING_POOL_ADDRESSES_PROVIDER || ZERO_ADDRESS + +export class MoolaPairResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.Celo] + public async resolve( + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ): Promise { + if (!this.supportChains.includes(chainId)) { + return [] + } + + const allPairsWithArgs = await AAVELikeFetcher.fetch( + AaveProtocolDataProvider, + LendingPoolAddressProvider, + chainId, + web3, + connection, + ) + return allPairsWithArgs.map((args) => { + const [pair, pool, dataProvider] = args + return new MoolaProtocol(pair as PairToken, pool as string, dataProvider as string) + }) + } +} + +export const moolaLazyResolver = new MoolaPairResolver() diff --git a/packages/mask/src/plugins/Savings/protocols/tranquil/TranquilProtocol.ts b/packages/mask/src/plugins/Savings/protocols/tranquil/TranquilProtocol.ts new file mode 100644 index 000000000000..1993b50ac990 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/tranquil/TranquilProtocol.ts @@ -0,0 +1,68 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import { ChainId, getTranquilConstants, ZERO_ADDRESS, createContract } from '@masknet/web3-shared-evm' +import { ProtocolType, PairToken, TokenDetail } from '../../types' +import BigNumber from 'bignumber.js' +import { + default as BenQiRewardProtocol, + MarketStatus, + RewardToken, + PairConfig, +} from '../common/protocol/BenQiRewardProtocol' +import type { TranquilPriceOracleV2 } from '@masknet/web3-contracts/types/TranquilPriceOracleV2' +import TranquilPriceOracleV2ABI from '@masknet/web3-contracts/abis/TranquilPriceOracleV2.json' + +export const TRANQ_ADDRESS = getTranquilConstants(ChainId.Harmony).TRANQ || ZERO_ADDRESS + +export function getComptrollerContract(address: string, web3: Web3) { + return createContract(web3, address, TranquilPriceOracleV2ABI as AbiItem[]) +} + +export default class TranquilProtocol extends BenQiRewardProtocol { + static nativeToken = 'tqONE' + + constructor(pair: PairToken, allPairs: PairToken[], rewardTokens: RewardToken[], config: PairConfig) { + super(pair, TranquilProtocol.nativeToken, allPairs, rewardTokens, config) + } + + override get type() { + return ProtocolType.Tranquil + } + + public override async fetchPrices( + matchPairs: Array<{ + underlying: TokenDetail + market: TokenDetail + }>, + notInPairTokens: RewardToken[], + web3: Web3, + ) { + const oracle = getComptrollerContract(this.config.oracle, web3) + if (oracle === null) return [] + const allResults = await Promise.all( + matchPairs + .filter((_) => _.market.symbol !== undefined) + .map(async (item) => { + const { underlying, market } = item + const price = await oracle.methods.getUnderlyingPrice(market.address).call() + // https://github.com/tranquil-finance/core-contracts/blob/master/contracts/Chainlink/TranquilChainlinkOracle.sol#L53 + const defaultDecimals = 18 + const decimalDelta = defaultDecimals - underlying.decimals + const divideDecimals = decimalDelta > 0 ? defaultDecimals + decimalDelta : defaultDecimals + return { + symbol: market.symbol, + price: new BigNumber(price).shiftedBy(-divideDecimals), + } as MarketStatus + }), + ) + + // TRANQ not in tranquil pair list + const price = await oracle.methods.getPrice(TRANQ_ADDRESS).call() + allResults.push({ + symbol: 'TRANQ', + price: new BigNumber(price).shiftedBy(-18), + }) + + return allResults + } +} diff --git a/packages/mask/src/plugins/Savings/protocols/tranquil/pairs.ts b/packages/mask/src/plugins/Savings/protocols/tranquil/pairs.ts new file mode 100644 index 000000000000..ba519a749621 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/tranquil/pairs.ts @@ -0,0 +1,56 @@ +import type Web3 from 'web3' +import { ChainId, ZERO_ADDRESS, getTranquilConstants, createNativeToken } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, ProtocolPairsResolver } from '../../types' +import CompoundLikeFetcher from '../common/CompoundLikeFetcher' +import TranquilProtocol from './TranquilProtocol' +import type { RewardToken, PairConfig } from '../common/protocol/BenQiRewardProtocol' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +export const TRANQUIL_COMPTROLLER = getTranquilConstants(ChainId.Harmony).COMPTROLLER || ZERO_ADDRESS +export const TRANQUIL_Oracle = getTranquilConstants(ChainId.Harmony).ORACLE || ZERO_ADDRESS + +const TRANQ_INDEX = 0 +const tqONE_INDEX = 1 + +export const rewardTokens: RewardToken[] = [ + { + symbol: 'TRANQ', + rewardType: TRANQ_INDEX, + }, + { + symbol: 'tqONE', + rewardType: tqONE_INDEX, + }, +] + +const pairConfig = { + comptroller: TRANQUIL_COMPTROLLER, + oracle: TRANQUIL_Oracle, +} + +const defaultChain = ChainId.Harmony + +export class TranquilPairResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [defaultChain] + public rewardTokens: RewardToken[] = rewardTokens + + public async resolve( + chainId: ChainId, + web3: Web3, + connection: Web3Helper.Web3ConnectionScope, + ): Promise { + if (!this.supportChains.includes(defaultChain)) { + return [] + } + const allPairs = await CompoundLikeFetcher.fetch(TRANQUIL_COMPTROLLER, chainId, web3, connection) + return allPairs.map((pair) => { + const [bareToken, stakeToken] = pair + if (stakeToken.symbol === TranquilProtocol.nativeToken) { + pair[0] = createNativeToken(defaultChain) + } + return new TranquilProtocol(pair, allPairs, this.rewardTokens, pairConfig) + }) + } +} + +export const tranquilLazyResolver = new TranquilPairResolver() diff --git a/packages/mask/src/plugins/Savings/types.ts b/packages/mask/src/plugins/Savings/types.ts index 135b796a111d..104b7bc396f7 100644 --- a/packages/mask/src/plugins/Savings/types.ts +++ b/packages/mask/src/plugins/Savings/types.ts @@ -2,6 +2,10 @@ import type Web3 from 'web3' import type BigNumber from 'bignumber.js' import type { ChainId, SchemaType } from '@masknet/web3-shared-evm' import type { FungibleToken } from '@masknet/web3-shared-base' +import type { Web3Helper } from '@masknet/plugin-infra/web3' + +export type TokenDetail = FungibleToken +export type PairToken = [FungibleToken, FungibleToken] export enum TabType { Deposit = 'deposit', @@ -11,7 +15,15 @@ export enum TabType { export enum ProtocolType { Lido = 0, AAVE = 1, + BENQI = 2, + Compound = 3, + Giest = 4, + Moola = 5, + Alpaca = 6, + Aurigami = 7, + Tranquil = 8, } + export interface SavingsProtocol { readonly type: ProtocolType @@ -32,6 +44,7 @@ export interface SavingsProtocol { readonly bareToken: FungibleToken readonly stakeToken: FungibleToken + readonly approveAddress: string | undefined updateApr(chainId: ChainId, web3: Web3): Promise updateBalance(chainId: ChainId, web3: Web3, account: string): Promise @@ -41,3 +54,8 @@ export interface SavingsProtocol { withdrawEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value): Promise withdraw(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value): Promise } + +export interface ProtocolPairsResolver { + supportChains: ChainId[] + resolve(chainId: ChainId, web3: Web3, connection: Web3Helper.Web3ConnectionScope): Promise +} diff --git a/packages/plugins/EVM/src/state/Hub/TokenIconSpecialIconList.json b/packages/plugins/EVM/src/state/Hub/TokenIconSpecialIconList.json index 2909c44aacdf..c3250ea89997 100644 --- a/packages/plugins/EVM/src/state/Hub/TokenIconSpecialIconList.json +++ b/packages/plugins/EVM/src/state/Hub/TokenIconSpecialIconList.json @@ -193,5 +193,160 @@ "name": "AVAX", "address": "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", "logo_url": "https://raw.githubusercontent.com/sushiswap/icons/master/network/avalanche.jpg'" + }, + { + "name": "STNEAR", + "address": "0x07f9f7f963c5cd2bbffd30ccfb964be114332e30", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0x07f9f7f963c5cd2bbffd30ccfb964be114332e30/625cb2649588721db770dc0f54379a43.png" + }, + { + "name": "USDT", + "address": "0x4988a896b1227218e4a686fde5eabdcabd91571f", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0x4988a896b1227218e4a686fde5eabdcabd91571f/3c1a718331e468abe1fc2ebe319f6c77.png" + }, + { + "name": "AURORA", + "address": "0x8bec47865ade3b172a928df8f990bc7f2a3b9f79", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0x8bec47865ade3b172a928df8f990bc7f2a3b9f79/ec63b91b7247ce338caa842eb6439530.png" + }, + { + "name": "USDC", + "address": "0xb12bfca5a55806aaf64e99521918a4bf0fc40802", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0xb12bfca5a55806aaf64e99521918a4bf0fc40802/43cebbf7a996ebbb31c6b1513e282f0b.png" + }, + { + "name": "NEAR", + "address": "0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d/af4e945c578e905bd2e9dd50deb46972.png" + }, + { + "name": "WBTC", + "address": "0xf4eb217ba2454613b15dbdea6e5f22276410e89e", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0xf4eb217ba2454613b15dbdea6e5f22276410e89e/4b8dce79188a892a6ebf6caeec886bed.png" + }, + { + "name": "TRI", + "address": "0xfa94348467f64d5a457f75f8bc40495d33c65abb", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0xfa94348467f64d5a457f75f8bc40495d33c65abb/f529cbfca541546078d1aa49ecf81056.png" + }, + { + "name": "stONE", + "address": "0x22d62b19b7039333ad773b7185bb61294f3adc19", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x22d62b19b7039333ad773b7185bb61294f3adc19/2f50553aafc56d830f636a2d67487786.png" + }, + { + "name": "1WBTC", + "address": "0x3095c7557bcb296ccc6e363de01b760ba031f2d9", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x3095c7557bcb296ccc6e363de01b760ba031f2d9/4b8dce79188a892a6ebf6caeec886bed.png" + }, + { + "name": "1USDT", + "address": "0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f/3c1a718331e468abe1fc2ebe319f6c77.png" + }, + { + "name": "1ETH", + "address": "0x6983d1e6def3690c4d616b13597a09e6193ea013", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x6983d1e6def3690c4d616b13597a09e6193ea013/56f5de0d16e8848bb9ff27cbd8f73f30.png" + }, + { + "name": "1USDC", + "address": "0x985458e523db3d53125813ed68c274899e9dfab4", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x985458e523db3d53125813ed68c274899e9dfab4/43cebbf7a996ebbb31c6b1513e282f0b.png" + }, + { + "name": "1BTC", + "address": "0xdc54046c0451f9269fee1840aec808d36015697d", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0xdc54046c0451f9269fee1840aec808d36015697d/ed6d39af4cdeca39b6d19dab162b5c02.png" + }, + { + "name": "1DAI", + "address": "0xef977d2f931c1978db5f6747666fa1eacb0d0339", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0xef977d2f931c1978db5f6747666fa1eacb0d0339/61b18dee6896c6dab0684a78d0eee10a.png" + }, + { + "address": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE", + "name": "sAVAX", + "logo_url": "https://app.benqi.fi/images/assets/savax.png" + }, + { + "address": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + "name": "USDt", + "logo_url": "https://app.benqi.fi/images/assets/usdt.png" + }, + { + "address": "0x17700282592d6917f6a73d0bf8accf4d578c131e", + "name": "MOO", + "logo_url": "https://static.debank.com/image/celo_token/logo_url/0x17700282592d6917f6a73d0bf8accf4d578c131e/7ed8826cb36d17b032528714ce908b20.png" + }, + { + "address": "0x471ece3750da237f93b8e339c536989b8978a438", + "name": "CELO", + "logo_url": "https://static.debank.com/image/celo_token/logo_url/0x471ece3750da237f93b8e339c536989b8978a438/6f524d91db674876ba0f5767cf0124cc.png" + }, + { + "address": "0x765de816845861e75a25fca122bb6898b8b1282a", + "name": "cUSD", + "logo_url": "https://static.debank.com/image/celo_token/logo_url/0x765de816845861e75a25fca122bb6898b8b1282a/17f6d58bd2a344a2098ef8123be88693.png" + }, + { + "address": "0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73", + "name": "cEUR", + "logo_url": "https://static.debank.com/image/celo_token/logo_url/0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73/f00fcdbf2e75d1d5a8dbbe57653ecbb5.png" + }, + { + "address": "0xe8537a3d056da446677b9e9d6c5db704eaab4787", + "name": "cREAL", + "logo_url": "https://s2.coinmarketcap.com/static/img/coins/128x128/16385.png" + }, + { + "address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + "name": "USDC", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x04068da6c83afcfa0e13ba15a6696662335d5b75/fffcd27b9efff5a86ab942084c05924d.png" + }, + { + "address": "0x049d68029688eabf473097a2fc38ef61633a3c7a", + "name": "fUSDT", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x049d68029688eabf473097a2fc38ef61633a3c7a/66eadee7b7bb16b75e02b570ab8d5c01.png" + }, + { + "address": "0x1e4f97b9f9f913c46f1632781732927b9019c68b", + "name": "CRV", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x1e4f97b9f9f913c46f1632781732927b9019c68b/38f4cbac8fb4ac70c384a65ae0cca337.png" + }, + { + "address": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", + "name": "WFTM", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83/2b7d91858f9c62aafc8d7778b9c22f57.png" + }, + { + "address": "0x321162cd933e2be498cd2267a90534a804051b11", + "name": "BTC", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x321162cd933e2be498cd2267a90534a804051b11/d3c52e7c7449afa8bd4fad1c93f50d93.png" + }, + { + "address": "0x74b23882a30290451a17c44f4f05243b6b58c76d", + "name": "ETH", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x74b23882a30290451a17c44f4f05243b6b58c76d/61844453e63cf81301f845d7864236f6.png" + }, + { + "address": "0x82f0b8b456c1a451378467398982d4834b6829c1", + "name": "MIM", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x82f0b8b456c1a451378467398982d4834b6829c1/7d0c0fb6eab1b7a8a9bfb7dcc04cb11e.png" + }, + { + "address": "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", + "name": "DAI", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e/549c4205dbb199f1b8b03af783f35e71.png" + }, + { + "address": "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8", + "name": "LINK", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8/69425617db0ef93a7c21c4f9b81c7ca5.png" + }, + { + "address": "0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f", + "name": "PLY", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f/3a56718d2d1c32b1b12c95b2f1e5806c.png" } ] diff --git a/packages/shared/src/UI/components/TokenIcon/TokenIconSpecialIconList.json b/packages/shared/src/UI/components/TokenIcon/TokenIconSpecialIconList.json index 2909c44aacdf..c3250ea89997 100644 --- a/packages/shared/src/UI/components/TokenIcon/TokenIconSpecialIconList.json +++ b/packages/shared/src/UI/components/TokenIcon/TokenIconSpecialIconList.json @@ -193,5 +193,160 @@ "name": "AVAX", "address": "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", "logo_url": "https://raw.githubusercontent.com/sushiswap/icons/master/network/avalanche.jpg'" + }, + { + "name": "STNEAR", + "address": "0x07f9f7f963c5cd2bbffd30ccfb964be114332e30", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0x07f9f7f963c5cd2bbffd30ccfb964be114332e30/625cb2649588721db770dc0f54379a43.png" + }, + { + "name": "USDT", + "address": "0x4988a896b1227218e4a686fde5eabdcabd91571f", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0x4988a896b1227218e4a686fde5eabdcabd91571f/3c1a718331e468abe1fc2ebe319f6c77.png" + }, + { + "name": "AURORA", + "address": "0x8bec47865ade3b172a928df8f990bc7f2a3b9f79", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0x8bec47865ade3b172a928df8f990bc7f2a3b9f79/ec63b91b7247ce338caa842eb6439530.png" + }, + { + "name": "USDC", + "address": "0xb12bfca5a55806aaf64e99521918a4bf0fc40802", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0xb12bfca5a55806aaf64e99521918a4bf0fc40802/43cebbf7a996ebbb31c6b1513e282f0b.png" + }, + { + "name": "NEAR", + "address": "0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d/af4e945c578e905bd2e9dd50deb46972.png" + }, + { + "name": "WBTC", + "address": "0xf4eb217ba2454613b15dbdea6e5f22276410e89e", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0xf4eb217ba2454613b15dbdea6e5f22276410e89e/4b8dce79188a892a6ebf6caeec886bed.png" + }, + { + "name": "TRI", + "address": "0xfa94348467f64d5a457f75f8bc40495d33c65abb", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0xfa94348467f64d5a457f75f8bc40495d33c65abb/f529cbfca541546078d1aa49ecf81056.png" + }, + { + "name": "stONE", + "address": "0x22d62b19b7039333ad773b7185bb61294f3adc19", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x22d62b19b7039333ad773b7185bb61294f3adc19/2f50553aafc56d830f636a2d67487786.png" + }, + { + "name": "1WBTC", + "address": "0x3095c7557bcb296ccc6e363de01b760ba031f2d9", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x3095c7557bcb296ccc6e363de01b760ba031f2d9/4b8dce79188a892a6ebf6caeec886bed.png" + }, + { + "name": "1USDT", + "address": "0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f/3c1a718331e468abe1fc2ebe319f6c77.png" + }, + { + "name": "1ETH", + "address": "0x6983d1e6def3690c4d616b13597a09e6193ea013", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x6983d1e6def3690c4d616b13597a09e6193ea013/56f5de0d16e8848bb9ff27cbd8f73f30.png" + }, + { + "name": "1USDC", + "address": "0x985458e523db3d53125813ed68c274899e9dfab4", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0x985458e523db3d53125813ed68c274899e9dfab4/43cebbf7a996ebbb31c6b1513e282f0b.png" + }, + { + "name": "1BTC", + "address": "0xdc54046c0451f9269fee1840aec808d36015697d", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0xdc54046c0451f9269fee1840aec808d36015697d/ed6d39af4cdeca39b6d19dab162b5c02.png" + }, + { + "name": "1DAI", + "address": "0xef977d2f931c1978db5f6747666fa1eacb0d0339", + "logo_url": "https://static.debank.com/image/hmy_token/logo_url/0xef977d2f931c1978db5f6747666fa1eacb0d0339/61b18dee6896c6dab0684a78d0eee10a.png" + }, + { + "address": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE", + "name": "sAVAX", + "logo_url": "https://app.benqi.fi/images/assets/savax.png" + }, + { + "address": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + "name": "USDt", + "logo_url": "https://app.benqi.fi/images/assets/usdt.png" + }, + { + "address": "0x17700282592d6917f6a73d0bf8accf4d578c131e", + "name": "MOO", + "logo_url": "https://static.debank.com/image/celo_token/logo_url/0x17700282592d6917f6a73d0bf8accf4d578c131e/7ed8826cb36d17b032528714ce908b20.png" + }, + { + "address": "0x471ece3750da237f93b8e339c536989b8978a438", + "name": "CELO", + "logo_url": "https://static.debank.com/image/celo_token/logo_url/0x471ece3750da237f93b8e339c536989b8978a438/6f524d91db674876ba0f5767cf0124cc.png" + }, + { + "address": "0x765de816845861e75a25fca122bb6898b8b1282a", + "name": "cUSD", + "logo_url": "https://static.debank.com/image/celo_token/logo_url/0x765de816845861e75a25fca122bb6898b8b1282a/17f6d58bd2a344a2098ef8123be88693.png" + }, + { + "address": "0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73", + "name": "cEUR", + "logo_url": "https://static.debank.com/image/celo_token/logo_url/0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73/f00fcdbf2e75d1d5a8dbbe57653ecbb5.png" + }, + { + "address": "0xe8537a3d056da446677b9e9d6c5db704eaab4787", + "name": "cREAL", + "logo_url": "https://s2.coinmarketcap.com/static/img/coins/128x128/16385.png" + }, + { + "address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + "name": "USDC", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x04068da6c83afcfa0e13ba15a6696662335d5b75/fffcd27b9efff5a86ab942084c05924d.png" + }, + { + "address": "0x049d68029688eabf473097a2fc38ef61633a3c7a", + "name": "fUSDT", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x049d68029688eabf473097a2fc38ef61633a3c7a/66eadee7b7bb16b75e02b570ab8d5c01.png" + }, + { + "address": "0x1e4f97b9f9f913c46f1632781732927b9019c68b", + "name": "CRV", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x1e4f97b9f9f913c46f1632781732927b9019c68b/38f4cbac8fb4ac70c384a65ae0cca337.png" + }, + { + "address": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", + "name": "WFTM", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83/2b7d91858f9c62aafc8d7778b9c22f57.png" + }, + { + "address": "0x321162cd933e2be498cd2267a90534a804051b11", + "name": "BTC", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x321162cd933e2be498cd2267a90534a804051b11/d3c52e7c7449afa8bd4fad1c93f50d93.png" + }, + { + "address": "0x74b23882a30290451a17c44f4f05243b6b58c76d", + "name": "ETH", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x74b23882a30290451a17c44f4f05243b6b58c76d/61844453e63cf81301f845d7864236f6.png" + }, + { + "address": "0x82f0b8b456c1a451378467398982d4834b6829c1", + "name": "MIM", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x82f0b8b456c1a451378467398982d4834b6829c1/7d0c0fb6eab1b7a8a9bfb7dcc04cb11e.png" + }, + { + "address": "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", + "name": "DAI", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e/549c4205dbb199f1b8b03af783f35e71.png" + }, + { + "address": "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8", + "name": "LINK", + "logo_url": "https://static.debank.com/image/ftm_token/logo_url/0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8/69425617db0ef93a7c21c4f9b81c7ca5.png" + }, + { + "address": "0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f", + "name": "PLY", + "logo_url": "https://static.debank.com/image/aurora_token/logo_url/0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f/3a56718d2d1c32b1b12c95b2f1e5806c.png" } ] diff --git a/packages/typed-message/dom/Metadata/index.ts b/packages/typed-message/dom/Metadata/index.ts index 04a24b6f91c9..62fded24f070 100644 --- a/packages/typed-message/dom/Metadata/index.ts +++ b/packages/typed-message/dom/Metadata/index.ts @@ -2,8 +2,8 @@ import { Result, Ok, Err, Some, Option, None } from 'ts-results' import type { ReactElement, ReactNode } from 'react' import type { TypedMessage } from '../../base/index.js' import z_schema from 'z-schema' -import draft, { enableMapSet, Draft } from 'immer' -enableMapSet() +import draft, { Draft } from 'immer' +// enableMapSet() const metadataSchemaStore = new Map() export function getKnownMetadataKeys() { diff --git a/packages/web3-constants/evm/alpaca.json b/packages/web3-constants/evm/alpaca.json new file mode 100644 index 000000000000..1a805b4538e3 --- /dev/null +++ b/packages/web3-constants/evm/alpaca.json @@ -0,0 +1,25 @@ +{ + "SUMMARY_API": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "https://alpaca-static-api.alpacafinance.org/bsc/v1/landing/summary.json", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + } +} diff --git a/packages/web3-constants/evm/aurigami.json b/packages/web3-constants/evm/aurigami.json new file mode 100644 index 000000000000..981bb804aa69 --- /dev/null +++ b/packages/web3-constants/evm/aurigami.json @@ -0,0 +1,163 @@ +{ + "COMPTROLLER": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "ORACLE": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0xC6e5185438e1730959c1eF3551059A3feC744E90", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "LENS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0xC41a5C1625d492436600789469c1CE2eA20CEA6B", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "AURORA_ADDRESS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "PLY_ADDRESS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "NEAR_ADDRESS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "TRI_ADDRESS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0xfa94348467f64d5a457f75f8bc40495d33c65abb", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + } +} diff --git a/packages/web3-constants/evm/benqi.json b/packages/web3-constants/evm/benqi.json new file mode 100644 index 000000000000..8da5a43c638e --- /dev/null +++ b/packages/web3-constants/evm/benqi.json @@ -0,0 +1,48 @@ +{ + "COMPTROLLER": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "0x486Af39519B4Dc9a7fCcd318217352830E8AD9b4", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "ORACLE": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "0x316ae55ec59e0beb2121c0e41d4bdef8bf66b32b", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + } +} diff --git a/packages/web3-constants/evm/compound.json b/packages/web3-constants/evm/compound.json new file mode 100644 index 000000000000..3370b179bd7a --- /dev/null +++ b/packages/web3-constants/evm/compound.json @@ -0,0 +1,25 @@ +{ + "COMPTROLLER": { + "Mainnet": "0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + } +} diff --git a/packages/web3-constants/evm/giest.json b/packages/web3-constants/evm/giest.json new file mode 100644 index 000000000000..be28cc53fd50 --- /dev/null +++ b/packages/web3-constants/evm/giest.json @@ -0,0 +1,48 @@ +{ + "LENDING_POOL_ADDRESSES_PROVIDER": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "0x6c793c628Fe2b480c5e6FB7957dDa4b9291F9c9b", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "PROTOCOL_DATA_PROVIDER": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "0xf3B0611e2E4D2cd6aB4bb3e01aDe211c3f42A8C3", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + } +} diff --git a/packages/web3-constants/evm/moola.json b/packages/web3-constants/evm/moola.json new file mode 100644 index 000000000000..7043ea01d586 --- /dev/null +++ b/packages/web3-constants/evm/moola.json @@ -0,0 +1,48 @@ +{ + "LENDING_POOL_ADDRESSES_PROVIDER": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "0xD1088091A174d33412a968Fa34Cb67131188B332", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "PROTOCOL_DATA_PROVIDER": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "0x43d067ed784D9DD2ffEda73775e2CC4c560103A1", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + } +} diff --git a/packages/web3-constants/evm/token.json b/packages/web3-constants/evm/token.json index 1486158cf340..cfbea9e0eb04 100644 --- a/packages/web3-constants/evm/token.json +++ b/packages/web3-constants/evm/token.json @@ -2436,5 +2436,97 @@ "Conflux": "0x0000000000000000000000000000000000000000", "Harmony": "", "Harmony_Test": "" + }, + "AURORA_ADDRESS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "PLY_ADDRESS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "NEAR_ADDRESS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "", + "Harmony_Test": "" + }, + "TRI_ADDRESS": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "0xfa94348467f64d5a457f75f8bc40495d33c65abb", + "Aurora_Testnet": "", + "Conflux": "0x0000000000000000000000000000000000000000", + "Harmony": "", + "Harmony_Test": "" } } diff --git a/packages/web3-constants/evm/tranquil.json b/packages/web3-constants/evm/tranquil.json new file mode 100644 index 000000000000..5556bcf22a30 --- /dev/null +++ b/packages/web3-constants/evm/tranquil.json @@ -0,0 +1,71 @@ +{ + "COMPTROLLER": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "0x6a82A17B48EF6be278BBC56138F35d04594587E3", + "Harmony_Test": "" + }, + "ORACLE": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "0x0C99E05CD2dCb52A583a3694F4d91813eFb5B071", + "Harmony_Test": "" + }, + "TRANQ": { + "Mainnet": "", + "Ropsten": "", + "Rinkeby": "", + "Kovan": "", + "Gorli": "", + "BSC": "", + "BSCT": "", + "Matic": "", + "Mumbai": "", + "Arbitrum": "", + "Arbitrum_Rinkeby": "", + "xDai": "", + "Avalanche": "", + "Avalanche_Fuji": "", + "Celo": "", + "Fantom": "", + "Aurora": "", + "Aurora_Testnet": "", + "Conflux": "", + "Harmony": "0xcf1709ad76a79d5a60210f23e81ce2460542a836", + "Harmony_Test": "" + } +} diff --git a/packages/web3-contracts/abis/AlpacaVault.json b/packages/web3-contracts/abis/AlpacaVault.json new file mode 100644 index 000000000000..708efa82f0a5 --- /dev/null +++ b/packages/web3-contracts/abis/AlpacaVault.json @@ -0,0 +1,430 @@ +[ + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "healthBefore", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "healthAfter", "type": "uint256" } + ], + "name": "AddCollateral", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "debtShare", "type": "uint256" } + ], + "name": "AddDebt", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "killer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "posVal", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "debt", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "prize", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "left", "type": "uint256" } + ], + "name": "Kill", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "debtShare", "type": "uint256" } + ], + "name": "RemoveDebt", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "loan", "type": "uint256" } + ], + "name": "Work", + "type": "event" + }, + { + "inputs": [], + "name": "POSITION_ID", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STRATEGY", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_IN_EXEC_LOCK", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "id", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bool", "name": "goRogue", "type": "bool" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "addCollateral", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "config", + "outputs": [{ "internalType": "contract IVaultConfig", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "debtShare", "type": "uint256" }], + "name": "debtShareToVal", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "debtToken", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "debtVal", "type": "uint256" }], + "name": "debtValToShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "amountToken", "type": "uint256" }], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "fairLaunchPoolId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IVaultConfig", "name": "_config", "type": "address" }, + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "string", "name": "_name", "type": "string" }, + { "internalType": "string", "name": "_symbol", "type": "string" }, + { "internalType": "uint8", "name": "_decimals", "type": "uint8" }, + { "internalType": "address", "name": "_debtToken", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }], + "name": "kill", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastAccrueTime", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextPositionID", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "value", "type": "uint256" }], + "name": "pendingInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }], + "name": "positionInfo", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "positions", + "outputs": [ + { "internalType": "address", "name": "worker", "type": "address" }, + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "uint256", "name": "debtShare", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "value", "type": "uint256" }], + "name": "reduceReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "address", "name": "targetedToken", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "requestFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reservePool", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_poolId", "type": "uint256" }], + "name": "setFairLaunchPoolId", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalToken", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract IVaultConfig", "name": "_config", "type": "address" }], + "name": "updateConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vaultDebtShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaultDebtVal", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "share", "type": "uint256" }], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "withdrawReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "id", "type": "uint256" }, + { "internalType": "address", "name": "worker", "type": "address" }, + { "internalType": "uint256", "name": "principalAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "maxReturn", "type": "uint256" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "work", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/packages/web3-contracts/abis/AlpacaVaultConfig.json b/packages/web3-contracts/abis/AlpacaVaultConfig.json new file mode 100644 index 000000000000..4e9487208434 --- /dev/null +++ b/packages/web3-contracts/abis/AlpacaVaultConfig.json @@ -0,0 +1,346 @@ +[ + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "addStrat", "type": "address" }, + { "indexed": false, "internalType": "bool", "name": "ok", "type": "bool" } + ], + "name": "SetApprovedAddStrategy", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "maxKillBps", "type": "uint256" } + ], + "name": "SetMaxKillBps", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "minDebtSize", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "reservePoolBps", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "killBps", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "interestModel", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "wrappedNative", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "wNativeRelayer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "fairLaunch", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "killTreasuryBps", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "treasury", "type": "address" } + ], + "name": "SetParams", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "addr", "type": "address" }, + { "indexed": false, "internalType": "bool", "name": "ok", "type": "bool" } + ], + "name": "SetWhitelistedCaller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "addr", "type": "address" }, + { "indexed": false, "internalType": "bool", "name": "ok", "type": "bool" } + ], + "name": "SetWhitelistedLiquidator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "worker", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "workerConfig", "type": "address" } + ], + "name": "SetWorkers", + "type": "event" + }, + { + "inputs": [{ "internalType": "address", "name": "worker", "type": "address" }], + "name": "acceptDebt", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "approvedAddStrategies", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFairLaunchAddr", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "debt", "type": "uint256" }, + { "internalType": "uint256", "name": "floating", "type": "uint256" } + ], + "name": "getInterestRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKillBps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKillTreasuryBps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReservePoolBps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTreasuryAddr", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWNativeRelayer", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWrappedNativeAddr", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_minDebtSize", "type": "uint256" }, + { "internalType": "uint256", "name": "_reservePoolBps", "type": "uint256" }, + { "internalType": "uint256", "name": "_killBps", "type": "uint256" }, + { "internalType": "contract InterestModel", "name": "_interestModel", "type": "address" }, + { "internalType": "address", "name": "_getWrappedNativeAddr", "type": "address" }, + { "internalType": "address", "name": "_getWNativeRelayer", "type": "address" }, + { "internalType": "address", "name": "_getFairLaunchAddr", "type": "address" }, + { "internalType": "uint256", "name": "_getKillTreasuryBps", "type": "uint256" }, + { "internalType": "address", "name": "_treasury", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interestModel", + "outputs": [{ "internalType": "contract InterestModel", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "worker", "type": "address" }], + "name": "isWorker", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "worker", "type": "address" }], + "name": "isWorkerReserveConsistent", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "worker", "type": "address" }], + "name": "isWorkerStable", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "worker", "type": "address" }, + { "internalType": "uint256", "name": "debt", "type": "uint256" } + ], + "name": "killFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxKillBps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minDebtSize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "worker", "type": "address" }, + { "internalType": "uint256", "name": "debt", "type": "uint256" } + ], + "name": "rawKillFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "address[]", "name": "addStrats", "type": "address[]" }, + { "internalType": "bool", "name": "ok", "type": "bool" } + ], + "name": "setApprovedAddStrategy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_maxKillBps", "type": "uint256" }], + "name": "setMaxKillBps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_minDebtSize", "type": "uint256" }, + { "internalType": "uint256", "name": "_reservePoolBps", "type": "uint256" }, + { "internalType": "uint256", "name": "_killBps", "type": "uint256" }, + { "internalType": "contract InterestModel", "name": "_interestModel", "type": "address" }, + { "internalType": "address", "name": "_getWrappedNativeAddr", "type": "address" }, + { "internalType": "address", "name": "_getWNativeRelayer", "type": "address" }, + { "internalType": "address", "name": "_getFairLaunchAddr", "type": "address" }, + { "internalType": "uint256", "name": "_getKillTreasuryBps", "type": "uint256" }, + { "internalType": "address", "name": "_treasury", "type": "address" } + ], + "name": "setParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "callers", "type": "address[]" }, + { "internalType": "bool", "name": "ok", "type": "bool" } + ], + "name": "setWhitelistedCallers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "callers", "type": "address[]" }, + { "internalType": "bool", "name": "ok", "type": "bool" } + ], + "name": "setWhitelistedLiquidators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "addrs", "type": "address[]" }, + { "internalType": "contract IWorkerConfig[]", "name": "configs", "type": "address[]" } + ], + "name": "setWorkers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "treasury", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "whitelistedCallers", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "whitelistedLiquidators", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "worker", "type": "address" }, + { "internalType": "uint256", "name": "debt", "type": "uint256" } + ], + "name": "workFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "workers", + "outputs": [{ "internalType": "contract IWorkerConfig", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/AuriLens.json b/packages/web3-contracts/abis/AuriLens.json new file mode 100644 index 000000000000..463d6723d1e2 --- /dev/null +++ b/packages/web3-contracts/abis/AuriLens.json @@ -0,0 +1,108 @@ +[ + { + "inputs": [ + { + "internalType": "contract AuToken", + "name": "auToken", + "type": "address" + } + ], + "name": "auTokenUnderlyingPrice", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "auToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "underlyingPrice", + "type": "uint256" + } + ], + "internalType": "struct AuriLens.AuTokenUnderlyingPrice", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "comptroller", + "type": "address" + } + ], + "name": "getAddresses", + "outputs": [ + { + "internalType": "address", + "name": "ply", + "type": "address" + }, + { + "internalType": "address", + "name": "aurora", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenLock", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "contract AuToken", + "name": "auToken", + "type": "address" + } + ], + "name": "getRewardSpeeds", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "plyRewardSupplySpeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "plyRewardBorrowSpeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "auroraRewardSupplySpeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "auroraRewardBorrowSpeed", + "type": "uint256" + } + ], + "internalType": "struct AuriLens.RewardSpeeds", + "name": "rewardSpeeds", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/BenQiComptroller.json b/packages/web3-contracts/abis/BenQiComptroller.json new file mode 100644 index 000000000000..29b5ab392e10 --- /dev/null +++ b/packages/web3-contracts/abis/BenQiComptroller.json @@ -0,0 +1,1000 @@ +[ + { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "string", "name": "action", "type": "string" }, + { "indexed": false, "internalType": "bool", "name": "pauseState", "type": "bool" } + ], + "name": "ActionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "indexed": false, "internalType": "string", "name": "action", "type": "string" }, + { "indexed": false, "internalType": "bool", "name": "pauseState", "type": "bool" } + ], + "name": "ActionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "contributor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newSpeed", "type": "uint256" } + ], + "name": "ContributorQiSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint8", "name": "tokenType", "type": "uint8" }, + { "indexed": true, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "qiDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "qiBorrowIndex", "type": "uint256" } + ], + "name": "DistributedBorrowerReward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint8", "name": "tokenType", "type": "uint8" }, + { "indexed": true, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "qiDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "qiBorrowIndex", "type": "uint256" } + ], + "name": "DistributedSupplierReward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "error", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "info", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "account", "type": "address" } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "account", "type": "address" } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }], + "name": "MarketListed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newBorrowCap", "type": "uint256" } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldBorrowCapGuardian", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newBorrowCapGuardian", "type": "address" } + ], + "name": "NewBorrowCapGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldCloseFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCloseFactorMantissa", "type": "uint256" } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldCollateralFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCollateralFactorMantissa", "type": "uint256" } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationIncentiveMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPauseGuardian", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPauseGuardian", "type": "address" } + ], + "name": "NewPauseGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract PriceOracle", "name": "oldPriceOracle", "type": "address" }, + { "indexed": false, "internalType": "contract PriceOracle", "name": "newPriceOracle", "type": "address" } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "QiGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint8", "name": "tokenType", "type": "uint8" }, + { "indexed": true, "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newSpeed", "type": "uint256" } + ], + "name": "SpeedUpdated", + "type": "event" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "constant": false, + "inputs": [{ "internalType": "contract Unitroller", "name": "unitroller", "type": "address" }], + "name": "_become", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "_borrowGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address payable", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "_grantQi", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "_mintGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newBorrowCapGuardian", "type": "address" }], + "name": "_setBorrowCapGuardian", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "internalType": "bool", "name": "state", "type": "bool" } + ], + "name": "_setBorrowPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newCloseFactorMantissa", "type": "uint256" }], + "name": "_setCloseFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "internalType": "uint256", "name": "newCollateralFactorMantissa", "type": "uint256" } + ], + "name": "_setCollateralFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newLiquidationIncentiveMantissa", "type": "uint256" }], + "name": "_setLiquidationIncentive", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract QiToken[]", "name": "qiTokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "newBorrowCaps", "type": "uint256[]" } + ], + "name": "_setMarketBorrowCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "internalType": "bool", "name": "state", "type": "bool" } + ], + "name": "_setMintPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newPauseGuardian", "type": "address" }], + "name": "_setPauseGuardian", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract PriceOracle", "name": "newOracle", "type": "address" }], + "name": "_setPriceOracle", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint8", "name": "rewardType", "type": "uint8" }, + { "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "internalType": "uint256", "name": "rewardSpeed", "type": "uint256" } + ], + "name": "_setRewardSpeed", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bool", "name": "state", "type": "bool" }], + "name": "_setSeizePaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bool", "name": "state", "type": "bool" }], + "name": "_setTransferPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract QiToken", "name": "qiToken", "type": "address" }], + "name": "_supportMarket", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "accountAssets", + "outputs": [{ "internalType": "contract QiToken", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allMarkets", + "outputs": [{ "internalType": "contract QiToken", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "borrowAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowCapGuardian", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "borrowCaps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "borrowGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "borrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "contract QiToken", "name": "qiToken", "type": "address" } + ], + "name": "checkMembership", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint8", "name": "rewardType", "type": "uint8" }, + { "internalType": "address payable", "name": "holder", "type": "address" } + ], + "name": "claimReward", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint8", "name": "rewardType", "type": "uint8" }, + { "internalType": "address payable", "name": "holder", "type": "address" }, + { "internalType": "contract QiToken[]", "name": "qiTokens", "type": "address[]" } + ], + "name": "claimReward", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint8", "name": "rewardType", "type": "uint8" }, + { "internalType": "address payable[]", "name": "holders", "type": "address[]" }, + { "internalType": "contract QiToken[]", "name": "qiTokens", "type": "address[]" }, + { "internalType": "bool", "name": "borrowers", "type": "bool" }, + { "internalType": "bool", "name": "suppliers", "type": "bool" } + ], + "name": "claimReward", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address[]", "name": "qiTokens", "type": "address[]" }], + "name": "enterMarkets", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "qiTokenAddress", "type": "address" }], + "name": "exitMarket", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAllMarkets", + "outputs": [{ "internalType": "contract QiToken[]", "name": "", "type": "address[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAssetsIn", + "outputs": [{ "internalType": "contract QiToken[]", "name": "", "type": "address[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBlockTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "address", "name": "qiTokenModify", "type": "address" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "initialIndexConstant", + "outputs": [{ "internalType": "uint224", "name": "", "type": "uint224" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isComptroller", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "qiTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "liquidateBorrowAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "qiTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "actualRepayAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "liquidateBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "qiTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "qiTokenCollateral", "type": "address" }, + { "internalType": "uint256", "name": "actualRepayAmount", "type": "uint256" } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "markets", + "outputs": [ + { "internalType": "bool", "name": "isListed", "type": "bool" }, + { "internalType": "uint256", "name": "collateralFactorMantissa", "type": "uint256" }, + { "internalType": "bool", "name": "isQied", "type": "bool" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "minter", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "mintAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "mintGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "minter", "type": "address" }, + { "internalType": "uint256", "name": "actualMintAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "mintVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "oracle", + "outputs": [{ "internalType": "contract PriceOracle", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pauseGuardian", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingComptrollerImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "qiAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "redeemer", "type": "address" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "redeemAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "redeemer", "type": "address" }, + { "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "redeemVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "payer", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "payer", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "actualRepayAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowerIndex", "type": "uint256" } + ], + "name": "repayBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "uint8", "name": "", "type": "uint8" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "rewardAccrued", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "rewardAvax", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "uint8", "name": "", "type": "uint8" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "rewardBorrowState", + "outputs": [ + { "internalType": "uint224", "name": "index", "type": "uint224" }, + { "internalType": "uint32", "name": "timestamp", "type": "uint32" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "uint8", "name": "", "type": "uint8" }, + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "rewardBorrowerIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "rewardQi", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "uint8", "name": "", "type": "uint8" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "supplyRewardSpeeds", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "uint8", "name": "", "type": "uint8" }, + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "rewardSupplierIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "uint8", "name": "", "type": "uint8" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "rewardSupplyState", + "outputs": [ + { "internalType": "uint224", "name": "index", "type": "uint224" }, + { "internalType": "uint32", "name": "timestamp", "type": "uint32" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "qiTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seizeAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "seizeGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "qiTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seizeVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newQiAddress", "type": "address" }], + "name": "setQiAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "transferTokens", "type": "uint256" } + ], + "name": "transferAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "transferGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "qiToken", "type": "address" }, + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "transferTokens", "type": "uint256" } + ], + "name": "transferVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/BenqiChainlinkOracle.json b/packages/web3-contracts/abis/BenqiChainlinkOracle.json new file mode 100644 index 000000000000..42820a4d817f --- /dev/null +++ b/packages/web3-contracts/abis/BenqiChainlinkOracle.json @@ -0,0 +1,122 @@ +[ + { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "feed", "type": "address" }, + { "indexed": false, "internalType": "string", "name": "symbol", "type": "string" } + ], + "name": "FeedSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "previousPriceMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "requestedPriceMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newPriceMantissa", "type": "uint256" } + ], + "name": "PricePosted", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], + "name": "assetPrices", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "string", "name": "symbol", "type": "string" }], + "name": "getFeed", + "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "contract QiToken", "name": "qiToken", "type": "address" }], + "name": "getUnderlyingPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isPriceOracle", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newAdmin", "type": "address" }], + "name": "setAdmin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "setDirectPrice", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "string", "name": "symbol", "type": "string" }, + { "internalType": "address", "name": "feed", "type": "address" } + ], + "name": "setFeed", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract QiToken", "name": "qiToken", "type": "address" }, + { "internalType": "uint256", "name": "underlyingPriceMantissa", "type": "uint256" } + ], + "name": "setUnderlyingPrice", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/CERC20.json b/packages/web3-contracts/abis/CERC20.json new file mode 100644 index 000000000000..4df8805ceeec --- /dev/null +++ b/packages/web3-contracts/abis/CERC20.json @@ -0,0 +1,711 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "underlying_", "type": "address" }, + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, + { "internalType": "address payable", "name": "admin_", "type": "address" }, + { "internalType": "address", "name": "implementation_", "type": "address" }, + { "internalType": "bytes", "name": "becomeImplementationData", "type": "bytes" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "error", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "info", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "liquidator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "cTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldImplementation", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newImplementation", "type": "address" } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPendingAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPendingAdmin", "type": "address" } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "_addReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "implementation_", "type": "address" }, + { "internalType": "bool", "name": "allowResign", "type": "bool" }, + { "internalType": "bytes", "name": "becomeImplementationData", "type": "bytes" } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "delegateToImplementation", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "delegateToViewImplementation", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isCToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract CTokenInterface", "name": "cTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolSeizeShareMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract EIP20NonStandardInterface", "name": "token", "type": "address" }], + "name": "sweepToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/CEther.json b/packages/web3-contracts/abis/CEther.json new file mode 100644 index 000000000000..95b40811ee17 --- /dev/null +++ b/packages/web3-contracts/abis/CEther.json @@ -0,0 +1,596 @@ +[ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "spender", "type": "address" }, + { "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "mint", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "src", "type": "address" }, + { "name": "dst", "type": "address" }, + { "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repayBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "initialExchangeRateMantissa", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "dst", "type": "address" }, + { "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "borrower", "type": "address" }, + { "name": "cTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "liquidator", "type": "address" }, + { "name": "borrower", "type": "address" }, + { "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "name": "", "type": "uint256" }, + { "name": "", "type": "uint256" }, + { "name": "", "type": "uint256" }, + { "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "name": "owner", "type": "address" }, + { "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "borrower", "type": "address" }], + "name": "repayBorrowBehalf", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isCToken", + "outputs": [{ "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "name": "comptroller_", "type": "address" }, + { "name": "interestRateModel_", "type": "address" }, + { "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "name": "name_", "type": "string" }, + { "name": "symbol_", "type": "string" }, + { "name": "decimals_", "type": "uint256" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "minter", "type": "address" }, + { "indexed": false, "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "redeemer", "type": "address" }, + { "indexed": false, "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "borrower", "type": "address" }, + { "indexed": false, "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "payer", "type": "address" }, + { "indexed": false, "name": "borrower", "type": "address" }, + { "indexed": false, "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "liquidator", "type": "address" }, + { "indexed": false, "name": "borrower", "type": "address" }, + { "indexed": false, "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "name": "cTokenCollateral", "type": "address" }, + { "indexed": false, "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "oldPendingAdmin", "type": "address" }, + { "indexed": false, "name": "newPendingAdmin", "type": "address" } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "oldAdmin", "type": "address" }, + { "indexed": false, "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "oldComptroller", "type": "address" }, + { "indexed": false, "name": "newComptroller", "type": "address" } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "oldInterestRateModel", "type": "address" }, + { "indexed": false, "name": "newInterestRateModel", "type": "address" } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "admin", "type": "address" }, + { "indexed": false, "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "name": "error", "type": "uint256" }, + { "indexed": false, "name": "info", "type": "uint256" }, + { "indexed": false, "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "from", "type": "address" }, + { "indexed": true, "name": "to", "type": "address" }, + { "indexed": false, "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "owner", "type": "address" }, + { "indexed": true, "name": "spender", "type": "address" }, + { "indexed": false, "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + } +] diff --git a/packages/web3-contracts/abis/Comptroller.json b/packages/web3-contracts/abis/Comptroller.json new file mode 100644 index 000000000000..4ab6879f4b4a --- /dev/null +++ b/packages/web3-contracts/abis/Comptroller.json @@ -0,0 +1,1084 @@ +[ + { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "string", "name": "action", "type": "string" }, + { "indexed": false, "internalType": "bool", "name": "pauseState", "type": "bool" } + ], + "name": "ActionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": false, "internalType": "string", "name": "action", "type": "string" }, + { "indexed": false, "internalType": "bool", "name": "pauseState", "type": "bool" } + ], + "name": "ActionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldCompAccrued", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCompAccrued", "type": "uint256" } + ], + "name": "CompAccruedAdjusted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newSpeed", "type": "uint256" } + ], + "name": "CompBorrowSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "CompGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldCompReceivable", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCompReceivable", "type": "uint256" } + ], + "name": "CompReceivableUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newSpeed", "type": "uint256" } + ], + "name": "CompSupplySpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "contributor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newSpeed", "type": "uint256" } + ], + "name": "ContributorCompSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "compDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "compBorrowIndex", "type": "uint256" } + ], + "name": "DistributedBorrowerComp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "supplier", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "compDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "compSupplyIndex", "type": "uint256" } + ], + "name": "DistributedSupplierComp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "error", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "info", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "account", "type": "address" } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "account", "type": "address" } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "contract CToken", "name": "cToken", "type": "address" }], + "name": "MarketListed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newBorrowCap", "type": "uint256" } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldBorrowCapGuardian", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newBorrowCapGuardian", "type": "address" } + ], + "name": "NewBorrowCapGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldCloseFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCloseFactorMantissa", "type": "uint256" } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldCollateralFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCollateralFactorMantissa", "type": "uint256" } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationIncentiveMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPauseGuardian", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPauseGuardian", "type": "address" } + ], + "name": "NewPauseGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract PriceOracle", "name": "oldPriceOracle", "type": "address" }, + { "indexed": false, "internalType": "contract PriceOracle", "name": "newPriceOracle", "type": "address" } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract Unitroller", "name": "unitroller", "type": "address" }], + "name": "_become", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "_borrowGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "_grantComp", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "_mintGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newBorrowCapGuardian", "type": "address" }], + "name": "_setBorrowCapGuardian", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "internalType": "bool", "name": "state", "type": "bool" } + ], + "name": "_setBorrowPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newCloseFactorMantissa", "type": "uint256" }], + "name": "_setCloseFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "internalType": "uint256", "name": "newCollateralFactorMantissa", "type": "uint256" } + ], + "name": "_setCollateralFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract CToken[]", "name": "cTokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "supplySpeeds", "type": "uint256[]" }, + { "internalType": "uint256[]", "name": "borrowSpeeds", "type": "uint256[]" } + ], + "name": "_setCompSpeeds", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "contributor", "type": "address" }, + { "internalType": "uint256", "name": "compSpeed", "type": "uint256" } + ], + "name": "_setContributorCompSpeed", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newLiquidationIncentiveMantissa", "type": "uint256" }], + "name": "_setLiquidationIncentive", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract CToken[]", "name": "cTokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "newBorrowCaps", "type": "uint256[]" } + ], + "name": "_setMarketBorrowCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract CToken", "name": "cToken", "type": "address" }, + { "internalType": "bool", "name": "state", "type": "bool" } + ], + "name": "_setMintPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newPauseGuardian", "type": "address" }], + "name": "_setPauseGuardian", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract PriceOracle", "name": "newOracle", "type": "address" }], + "name": "_setPriceOracle", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bool", "name": "state", "type": "bool" }], + "name": "_setSeizePaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bool", "name": "state", "type": "bool" }], + "name": "_setTransferPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract CToken", "name": "cToken", "type": "address" }], + "name": "_supportMarket", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "accountAssets", + "outputs": [{ "internalType": "contract CToken", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allMarkets", + "outputs": [{ "internalType": "contract CToken", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "borrowAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowCapGuardian", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "borrowCaps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "borrowGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "borrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "contract CToken", "name": "cToken", "type": "address" } + ], + "name": "checkMembership", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "holder", "type": "address" }, + { "internalType": "contract CToken[]", "name": "cTokens", "type": "address[]" } + ], + "name": "claimComp", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address[]", "name": "holders", "type": "address[]" }, + { "internalType": "contract CToken[]", "name": "cTokens", "type": "address[]" }, + { "internalType": "bool", "name": "borrowers", "type": "bool" }, + { "internalType": "bool", "name": "suppliers", "type": "bool" } + ], + "name": "claimComp", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], + "name": "claimComp", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "compAccrued", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "compBorrowSpeeds", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "compBorrowState", + "outputs": [ + { "internalType": "uint224", "name": "index", "type": "uint224" }, + { "internalType": "uint32", "name": "block", "type": "uint32" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "compBorrowerIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "compContributorSpeeds", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "compInitialIndex", + "outputs": [{ "internalType": "uint224", "name": "", "type": "uint224" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "compRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "compReceivable", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "compSpeeds", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "compSupplierIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "compSupplySpeeds", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "compSupplyState", + "outputs": [ + { "internalType": "uint224", "name": "index", "type": "uint224" }, + { "internalType": "uint32", "name": "block", "type": "uint32" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address[]", "name": "cTokens", "type": "address[]" }], + "name": "enterMarkets", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "cTokenAddress", "type": "address" }], + "name": "exitMarket", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address[]", "name": "affectedUsers", "type": "address[]" }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "name": "fixBadAccruals", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAllMarkets", + "outputs": [{ "internalType": "contract CToken[]", "name": "", "type": "address[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAssetsIn", + "outputs": [{ "internalType": "contract CToken[]", "name": "", "type": "address[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCompAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "address", "name": "cTokenModify", "type": "address" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isComptroller", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "contract CToken", "name": "cToken", "type": "address" }], + "name": "isDeprecated", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "lastContributorBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "cTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "liquidateBorrowAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "cTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "actualRepayAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "liquidateBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "cTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "cTokenCollateral", "type": "address" }, + { "internalType": "uint256", "name": "actualRepayAmount", "type": "uint256" } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "markets", + "outputs": [ + { "internalType": "bool", "name": "isListed", "type": "bool" }, + { "internalType": "uint256", "name": "collateralFactorMantissa", "type": "uint256" }, + { "internalType": "bool", "name": "isComped", "type": "bool" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "minter", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "mintAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "mintGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "minter", "type": "address" }, + { "internalType": "uint256", "name": "actualMintAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "mintVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "oracle", + "outputs": [{ "internalType": "contract PriceOracle", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pauseGuardian", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingComptrollerImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "proposal65FixExecuted", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "redeemer", "type": "address" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "redeemAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "redeemer", "type": "address" }, + { "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "redeemVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "payer", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "payer", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "actualRepayAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowerIndex", "type": "uint256" } + ], + "name": "repayBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "cTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seizeAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "seizeGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "cTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seizeVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "transferTokens", "type": "uint256" } + ], + "name": "transferAllowed", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "transferGuardianPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "cToken", "type": "address" }, + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "transferTokens", "type": "uint256" } + ], + "name": "transferVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "contributor", "type": "address" }], + "name": "updateContributorRewards", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/QiAvax.json b/packages/web3-contracts/abis/QiAvax.json new file mode 100644 index 000000000000..316618eb915d --- /dev/null +++ b/packages/web3-contracts/abis/QiAvax.json @@ -0,0 +1,671 @@ +[ + { + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, + { "internalType": "address payable", "name": "admin_", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "error", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "info", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "liquidator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "qiTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPendingAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPendingAdmin", "type": "address" } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldProtocolSeizeShareMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newProtocolSeizeShareMantissa", "type": "uint256" } + ], + "name": "NewProtocolSeizeShare", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "_addReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newProtocolSeizeShareMantissa", "type": "uint256" }], + "name": "_setProtocolSeizeShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isQiToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "contract QiToken", "name": "qiTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "mint", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolSeizeShareMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repayBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "borrower", "type": "address" }], + "name": "repayBorrowBehalf", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/QiERC20.json b/packages/web3-contracts/abis/QiERC20.json new file mode 100644 index 000000000000..ab344fe39f6c --- /dev/null +++ b/packages/web3-contracts/abis/QiERC20.json @@ -0,0 +1,729 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "underlying_", "type": "address" }, + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, + { "internalType": "address payable", "name": "admin_", "type": "address" }, + { "internalType": "address", "name": "implementation_", "type": "address" }, + { "internalType": "bytes", "name": "becomeImplementationData", "type": "bytes" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "error", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "info", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "liquidator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "qiTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldImplementation", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newImplementation", "type": "address" } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPendingAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPendingAdmin", "type": "address" } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldProtocolSeizeShareMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newProtocolSeizeShareMantissa", "type": "uint256" } + ], + "name": "NewProtocolSeizeShare", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "_addReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "implementation_", "type": "address" }, + { "internalType": "bool", "name": "allowResign", "type": "bool" }, + { "internalType": "bytes", "name": "becomeImplementationData", "type": "bytes" } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newProtocolSeizeShareMantissa", "type": "uint256" }], + "name": "_setProtocolSeizeShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "delegateToImplementation", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "delegateToViewImplementation", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isQiToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract QiTokenInterface", "name": "qiTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolSeizeShareMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract EIP20NonStandardInterface", "name": "token", "type": "address" }], + "name": "sweepToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/packages/web3-contracts/abis/TranquilPriceOracleV2.json b/packages/web3-contracts/abis/TranquilPriceOracleV2.json new file mode 100644 index 000000000000..1dc0259c6d0f --- /dev/null +++ b/packages/web3-contracts/abis/TranquilPriceOracleV2.json @@ -0,0 +1,252 @@ +[ + { + "type": "constructor", + "inputs": [], + "stateMutability": "nonpayable" + }, + { + "name": "OwnershipTransferred", + "type": "event", + "inputs": [ + { + "type": "address", + "name": "previousOwner", + "indexed": true, + "internalType": "address" + }, + { + "type": "address", + "internalType": "address", + "name": "newOwner", + "indexed": true + } + ], + "anonymous": false + }, + { + "inputs": [], + "name": "WONE_ADDRESS", + "outputs": [ + { + "type": "address", + "internalType": "address", + "name": "" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true, + "signature": "0x6a255ac6" + }, + { + "name": "chainlinkOracle", + "stateMutability": "view", + "outputs": [ + { + "internalType": "contract ChainlinkOracle", + "type": "address", + "name": "" + } + ], + "type": "function", + "inputs": [], + "constant": true, + "signature": "0xef06e72c" + }, + { + "type": "function", + "name": "fallbackOracle", + "outputs": [ + { + "name": "", + "internalType": "contract FallbackOracle", + "type": "address" + } + ], + "inputs": [], + "stateMutability": "view", + "constant": true, + "signature": "0x629838e5" + }, + { + "inputs": [], + "stateMutability": "view", + "name": "isPriceOracle", + "type": "function", + "outputs": [ + { + "name": "", + "internalType": "bool", + "type": "bool" + } + ], + "constant": true, + "signature": "0x66331bba" + }, + { + "stateMutability": "view", + "inputs": [], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "type": "function", + "name": "owner", + "constant": true, + "signature": "0x8da5cb5b" + }, + { + "type": "function", + "inputs": [], + "name": "renounceOwnership", + "stateMutability": "nonpayable", + "outputs": [] + }, + { + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "type": "function", + "name": "specialTokenOracles", + "outputs": [ + { + "type": "address", + "name": "", + "internalType": "contract ITokenOracle" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "name": "transferOwnership", + "outputs": [] + }, + { + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "", + "internalType": "contract UniswapOracle" + } + ], + "name": "uniswapOracle", + "stateMutability": "view", + "constant": true, + "signature": "0x120c6c5b" + }, + { + "stateMutability": "nonpayable", + "outputs": [], + "inputs": [ + { + "type": "address", + "name": "_token", + "internalType": "address" + }, + { + "type": "address", + "name": "_specialTokenOracle", + "internalType": "contract ITokenOracle" + } + ], + "name": "setSpecialTokenOracle", + "type": "function" + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "setChainlinkOracle", + "outputs": [], + "inputs": [ + { + "name": "_chainlinkOracle", + "type": "address", + "internalType": "contract ChainlinkOracle" + } + ] + }, + { + "type": "function", + "outputs": [], + "name": "setUniswapOracle", + "inputs": [ + { + "type": "address", + "name": "_uniswapOracle", + "internalType": "contract UniswapOracle" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setFallbackOracle", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "_fallbackOracle", + "internalType": "contract FallbackOracle", + "type": "address" + } + ], + "outputs": [] + }, + { + "name": "getUnderlyingPrice", + "inputs": [ + { + "internalType": "contract TqToken", + "name": "tqToken", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "type": "function", + "stateMutability": "view" + }, + { + "stateMutability": "view", + "name": "getPrice", + "inputs": [ + { + "name": "token", + "internalType": "address", + "type": "address" + } + ], + "type": "function", + "outputs": [ + { + "type": "uint256", + "internalType": "uint256", + "name": "" + } + ], + "constant": true, + "signature": "0x41976e09" + } +] diff --git a/packages/web3-contracts/types/AlpacaVault.d.ts b/packages/web3-contracts/types/AlpacaVault.d.ts new file mode 100644 index 000000000000..588695e8dcca --- /dev/null +++ b/packages/web3-contracts/types/AlpacaVault.d.ts @@ -0,0 +1,265 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type AddCollateral = ContractEventLog<{ + id: string + amount: string + healthBefore: string + healthAfter: string + 0: string + 1: string + 2: string + 3: string +}> +export type AddDebt = ContractEventLog<{ + id: string + debtShare: string + 0: string + 1: string +}> +export type Approval = ContractEventLog<{ + owner: string + spender: string + value: string + 0: string + 1: string + 2: string +}> +export type Kill = ContractEventLog<{ + id: string + killer: string + owner: string + posVal: string + debt: string + prize: string + left: string + 0: string + 1: string + 2: string + 3: string + 4: string + 5: string + 6: string +}> +export type OwnershipTransferred = ContractEventLog<{ + previousOwner: string + newOwner: string + 0: string + 1: string +}> +export type RemoveDebt = ContractEventLog<{ + id: string + debtShare: string + 0: string + 1: string +}> +export type Transfer = ContractEventLog<{ + from: string + to: string + value: string + 0: string + 1: string + 2: string +}> +export type Work = ContractEventLog<{ + id: string + loan: string + 0: string + 1: string +}> + +export interface AlpacaVault extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): AlpacaVault + clone(): AlpacaVault + methods: { + POSITION_ID(): NonPayableTransactionObject + + STRATEGY(): NonPayableTransactionObject + + _IN_EXEC_LOCK(): NonPayableTransactionObject + + addCollateral( + id: number | string | BN, + amount: number | string | BN, + goRogue: boolean, + data: string | number[], + ): PayableTransactionObject + + allowance(owner: string, spender: string): NonPayableTransactionObject + + approve(spender: string, amount: number | string | BN): NonPayableTransactionObject + + balanceOf(account: string): NonPayableTransactionObject + + config(): NonPayableTransactionObject + + debtShareToVal(debtShare: number | string | BN): NonPayableTransactionObject + + debtToken(): NonPayableTransactionObject + + debtValToShare(debtVal: number | string | BN): NonPayableTransactionObject + + decimals(): NonPayableTransactionObject + + decreaseAllowance(spender: string, subtractedValue: number | string | BN): NonPayableTransactionObject + + deposit(amountToken: number | string | BN): PayableTransactionObject + + fairLaunchPoolId(): NonPayableTransactionObject + + increaseAllowance(spender: string, addedValue: number | string | BN): NonPayableTransactionObject + + initialize( + _config: string, + _token: string, + _name: string, + _symbol: string, + _decimals: number | string | BN, + _debtToken: string, + ): NonPayableTransactionObject + + kill(id: number | string | BN): NonPayableTransactionObject + + lastAccrueTime(): NonPayableTransactionObject + + name(): NonPayableTransactionObject + + nextPositionID(): NonPayableTransactionObject + + owner(): NonPayableTransactionObject + + pendingInterest(value: number | string | BN): NonPayableTransactionObject + + positionInfo(id: number | string | BN): NonPayableTransactionObject<{ + 0: string + 1: string + }> + + positions(arg0: number | string | BN): NonPayableTransactionObject<{ + worker: string + owner: string + debtShare: string + 0: string + 1: string + 2: string + }> + + reduceReserve(value: number | string | BN): NonPayableTransactionObject + + renounceOwnership(): NonPayableTransactionObject + + requestFunds(targetedToken: string, amount: number | string | BN): NonPayableTransactionObject + + reservePool(): NonPayableTransactionObject + + setFairLaunchPoolId(_poolId: number | string | BN): NonPayableTransactionObject + + symbol(): NonPayableTransactionObject + + token(): NonPayableTransactionObject + + totalSupply(): NonPayableTransactionObject + + totalToken(): NonPayableTransactionObject + + transfer(recipient: string, amount: number | string | BN): NonPayableTransactionObject + + transferFrom( + sender: string, + recipient: string, + amount: number | string | BN, + ): NonPayableTransactionObject + + transferOwnership(newOwner: string): NonPayableTransactionObject + + updateConfig(_config: string): NonPayableTransactionObject + + vaultDebtShare(): NonPayableTransactionObject + + vaultDebtVal(): NonPayableTransactionObject + + withdraw(share: number | string | BN): NonPayableTransactionObject + + withdrawReserve(to: string, value: number | string | BN): NonPayableTransactionObject + + work( + id: number | string | BN, + worker: string, + principalAmount: number | string | BN, + borrowAmount: number | string | BN, + maxReturn: number | string | BN, + data: string | number[], + ): PayableTransactionObject + } + events: { + AddCollateral(cb?: Callback): EventEmitter + AddCollateral(options?: EventOptions, cb?: Callback): EventEmitter + + AddDebt(cb?: Callback): EventEmitter + AddDebt(options?: EventOptions, cb?: Callback): EventEmitter + + Approval(cb?: Callback): EventEmitter + Approval(options?: EventOptions, cb?: Callback): EventEmitter + + Kill(cb?: Callback): EventEmitter + Kill(options?: EventOptions, cb?: Callback): EventEmitter + + OwnershipTransferred(cb?: Callback): EventEmitter + OwnershipTransferred(options?: EventOptions, cb?: Callback): EventEmitter + + RemoveDebt(cb?: Callback): EventEmitter + RemoveDebt(options?: EventOptions, cb?: Callback): EventEmitter + + Transfer(cb?: Callback): EventEmitter + Transfer(options?: EventOptions, cb?: Callback): EventEmitter + + Work(cb?: Callback): EventEmitter + Work(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'AddCollateral', cb: Callback): void + once(event: 'AddCollateral', options: EventOptions, cb: Callback): void + + once(event: 'AddDebt', cb: Callback): void + once(event: 'AddDebt', options: EventOptions, cb: Callback): void + + once(event: 'Approval', cb: Callback): void + once(event: 'Approval', options: EventOptions, cb: Callback): void + + once(event: 'Kill', cb: Callback): void + once(event: 'Kill', options: EventOptions, cb: Callback): void + + once(event: 'OwnershipTransferred', cb: Callback): void + once(event: 'OwnershipTransferred', options: EventOptions, cb: Callback): void + + once(event: 'RemoveDebt', cb: Callback): void + once(event: 'RemoveDebt', options: EventOptions, cb: Callback): void + + once(event: 'Transfer', cb: Callback): void + once(event: 'Transfer', options: EventOptions, cb: Callback): void + + once(event: 'Work', cb: Callback): void + once(event: 'Work', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/AlpacaVaultConfig.d.ts b/packages/web3-contracts/types/AlpacaVaultConfig.d.ts new file mode 100644 index 000000000000..e62ef53d98d0 --- /dev/null +++ b/packages/web3-contracts/types/AlpacaVaultConfig.d.ts @@ -0,0 +1,226 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type OwnershipTransferred = ContractEventLog<{ + previousOwner: string + newOwner: string + 0: string + 1: string +}> +export type SetApprovedAddStrategy = ContractEventLog<{ + caller: string + addStrat: string + ok: boolean + 0: string + 1: string + 2: boolean +}> +export type SetMaxKillBps = ContractEventLog<{ + caller: string + maxKillBps: string + 0: string + 1: string +}> +export type SetParams = ContractEventLog<{ + caller: string + minDebtSize: string + reservePoolBps: string + killBps: string + interestModel: string + wrappedNative: string + wNativeRelayer: string + fairLaunch: string + killTreasuryBps: string + treasury: string + 0: string + 1: string + 2: string + 3: string + 4: string + 5: string + 6: string + 7: string + 8: string + 9: string +}> +export type SetWhitelistedCaller = ContractEventLog<{ + caller: string + addr: string + ok: boolean + 0: string + 1: string + 2: boolean +}> +export type SetWhitelistedLiquidator = ContractEventLog<{ + caller: string + addr: string + ok: boolean + 0: string + 1: string + 2: boolean +}> +export type SetWorkers = ContractEventLog<{ + caller: string + worker: string + workerConfig: string + 0: string + 1: string + 2: string +}> + +export interface AlpacaVaultConfig extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): AlpacaVaultConfig + clone(): AlpacaVaultConfig + methods: { + acceptDebt(worker: string): NonPayableTransactionObject + + approvedAddStrategies(arg0: string): NonPayableTransactionObject + + getFairLaunchAddr(): NonPayableTransactionObject + + getInterestRate(debt: number | string | BN, floating: number | string | BN): NonPayableTransactionObject + + getKillBps(): NonPayableTransactionObject + + getKillTreasuryBps(): NonPayableTransactionObject + + getReservePoolBps(): NonPayableTransactionObject + + getTreasuryAddr(): NonPayableTransactionObject + + getWNativeRelayer(): NonPayableTransactionObject + + getWrappedNativeAddr(): NonPayableTransactionObject + + initialize( + _minDebtSize: number | string | BN, + _reservePoolBps: number | string | BN, + _killBps: number | string | BN, + _interestModel: string, + _getWrappedNativeAddr: string, + _getWNativeRelayer: string, + _getFairLaunchAddr: string, + _getKillTreasuryBps: number | string | BN, + _treasury: string, + ): NonPayableTransactionObject + + interestModel(): NonPayableTransactionObject + + isWorker(worker: string): NonPayableTransactionObject + + isWorkerReserveConsistent(worker: string): NonPayableTransactionObject + + isWorkerStable(worker: string): NonPayableTransactionObject + + killFactor(worker: string, debt: number | string | BN): NonPayableTransactionObject + + maxKillBps(): NonPayableTransactionObject + + minDebtSize(): NonPayableTransactionObject + + owner(): NonPayableTransactionObject + + rawKillFactor(worker: string, debt: number | string | BN): NonPayableTransactionObject + + renounceOwnership(): NonPayableTransactionObject + + setApprovedAddStrategy(addStrats: string[], ok: boolean): NonPayableTransactionObject + + setMaxKillBps(_maxKillBps: number | string | BN): NonPayableTransactionObject + + setParams( + _minDebtSize: number | string | BN, + _reservePoolBps: number | string | BN, + _killBps: number | string | BN, + _interestModel: string, + _getWrappedNativeAddr: string, + _getWNativeRelayer: string, + _getFairLaunchAddr: string, + _getKillTreasuryBps: number | string | BN, + _treasury: string, + ): NonPayableTransactionObject + + setWhitelistedCallers(callers: string[], ok: boolean): NonPayableTransactionObject + + setWhitelistedLiquidators(callers: string[], ok: boolean): NonPayableTransactionObject + + setWorkers(addrs: string[], configs: string[]): NonPayableTransactionObject + + transferOwnership(newOwner: string): NonPayableTransactionObject + + treasury(): NonPayableTransactionObject + + whitelistedCallers(arg0: string): NonPayableTransactionObject + + whitelistedLiquidators(arg0: string): NonPayableTransactionObject + + workFactor(worker: string, debt: number | string | BN): NonPayableTransactionObject + + workers(arg0: string): NonPayableTransactionObject + } + events: { + OwnershipTransferred(cb?: Callback): EventEmitter + OwnershipTransferred(options?: EventOptions, cb?: Callback): EventEmitter + + SetApprovedAddStrategy(cb?: Callback): EventEmitter + SetApprovedAddStrategy(options?: EventOptions, cb?: Callback): EventEmitter + + SetMaxKillBps(cb?: Callback): EventEmitter + SetMaxKillBps(options?: EventOptions, cb?: Callback): EventEmitter + + SetParams(cb?: Callback): EventEmitter + SetParams(options?: EventOptions, cb?: Callback): EventEmitter + + SetWhitelistedCaller(cb?: Callback): EventEmitter + SetWhitelistedCaller(options?: EventOptions, cb?: Callback): EventEmitter + + SetWhitelistedLiquidator(cb?: Callback): EventEmitter + SetWhitelistedLiquidator(options?: EventOptions, cb?: Callback): EventEmitter + + SetWorkers(cb?: Callback): EventEmitter + SetWorkers(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'OwnershipTransferred', cb: Callback): void + once(event: 'OwnershipTransferred', options: EventOptions, cb: Callback): void + + once(event: 'SetApprovedAddStrategy', cb: Callback): void + once(event: 'SetApprovedAddStrategy', options: EventOptions, cb: Callback): void + + once(event: 'SetMaxKillBps', cb: Callback): void + once(event: 'SetMaxKillBps', options: EventOptions, cb: Callback): void + + once(event: 'SetParams', cb: Callback): void + once(event: 'SetParams', options: EventOptions, cb: Callback): void + + once(event: 'SetWhitelistedCaller', cb: Callback): void + once(event: 'SetWhitelistedCaller', options: EventOptions, cb: Callback): void + + once(event: 'SetWhitelistedLiquidator', cb: Callback): void + once(event: 'SetWhitelistedLiquidator', options: EventOptions, cb: Callback): void + + once(event: 'SetWorkers', cb: Callback): void + once(event: 'SetWorkers', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/AuriLens.d.ts b/packages/web3-contracts/types/AuriLens.d.ts new file mode 100644 index 000000000000..99240c5ef658 --- /dev/null +++ b/packages/web3-contracts/types/AuriLens.d.ts @@ -0,0 +1,47 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export interface AuriLens extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): AuriLens + clone(): AuriLens + methods: { + auTokenUnderlyingPrice(auToken: string): NonPayableTransactionObject<[string, string]> + + getAddresses(comptroller: string): NonPayableTransactionObject<{ + ply: string + aurora: string + tokenLock: string + 0: string + 1: string + 2: string + }> + + getRewardSpeeds( + comptroller: string, + auToken: string, + ): NonPayableTransactionObject<[string, string, string, string]> + } + events: { + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } +} diff --git a/packages/web3-contracts/types/BenQiComptroller.d.ts b/packages/web3-contracts/types/BenQiComptroller.d.ts new file mode 100644 index 000000000000..e3ec60ae0713 --- /dev/null +++ b/packages/web3-contracts/types/BenQiComptroller.d.ts @@ -0,0 +1,549 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type ActionPaused_string_bool = ContractEventLog<{ + action: string + pauseState: boolean + 0: string + 1: boolean +}> +export type ActionPaused_address_string_bool = ContractEventLog<{ + qiToken: string + action: string + pauseState: boolean + 0: string + 1: string + 2: boolean +}> +export type ContributorQiSpeedUpdated = ContractEventLog<{ + contributor: string + newSpeed: string + 0: string + 1: string +}> +export type DistributedBorrowerReward = ContractEventLog<{ + tokenType: string + qiToken: string + borrower: string + qiDelta: string + qiBorrowIndex: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type DistributedSupplierReward = ContractEventLog<{ + tokenType: string + qiToken: string + borrower: string + qiDelta: string + qiBorrowIndex: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type Failure = ContractEventLog<{ + error: string + info: string + detail: string + 0: string + 1: string + 2: string +}> +export type MarketEntered = ContractEventLog<{ + qiToken: string + account: string + 0: string + 1: string +}> +export type MarketExited = ContractEventLog<{ + qiToken: string + account: string + 0: string + 1: string +}> +export type MarketListed = ContractEventLog<{ + qiToken: string + 0: string +}> +export type NewBorrowCap = ContractEventLog<{ + qiToken: string + newBorrowCap: string + 0: string + 1: string +}> +export type NewBorrowCapGuardian = ContractEventLog<{ + oldBorrowCapGuardian: string + newBorrowCapGuardian: string + 0: string + 1: string +}> +export type NewCloseFactor = ContractEventLog<{ + oldCloseFactorMantissa: string + newCloseFactorMantissa: string + 0: string + 1: string +}> +export type NewCollateralFactor = ContractEventLog<{ + qiToken: string + oldCollateralFactorMantissa: string + newCollateralFactorMantissa: string + 0: string + 1: string + 2: string +}> +export type NewLiquidationIncentive = ContractEventLog<{ + oldLiquidationIncentiveMantissa: string + newLiquidationIncentiveMantissa: string + 0: string + 1: string +}> +export type NewPauseGuardian = ContractEventLog<{ + oldPauseGuardian: string + newPauseGuardian: string + 0: string + 1: string +}> +export type NewPriceOracle = ContractEventLog<{ + oldPriceOracle: string + newPriceOracle: string + 0: string + 1: string +}> +export type QiGranted = ContractEventLog<{ + recipient: string + amount: string + 0: string + 1: string +}> +export type SpeedUpdated = ContractEventLog<{ + tokenType: string + qiToken: string + newSpeed: string + 0: string + 1: string + 2: string +}> + +export interface BenQiComptroller extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): BenQiComptroller + clone(): BenQiComptroller + methods: { + _become(unitroller: string): NonPayableTransactionObject + + _borrowGuardianPaused(): NonPayableTransactionObject + + _grantQi(recipient: string, amount: number | string | BN): NonPayableTransactionObject + + _mintGuardianPaused(): NonPayableTransactionObject + + _setBorrowCapGuardian(newBorrowCapGuardian: string): NonPayableTransactionObject + + _setBorrowPaused(qiToken: string, state: boolean): NonPayableTransactionObject + + _setCloseFactor(newCloseFactorMantissa: number | string | BN): NonPayableTransactionObject + + _setCollateralFactor( + qiToken: string, + newCollateralFactorMantissa: number | string | BN, + ): NonPayableTransactionObject + + _setLiquidationIncentive( + newLiquidationIncentiveMantissa: number | string | BN, + ): NonPayableTransactionObject + + _setMarketBorrowCaps( + qiTokens: string[], + newBorrowCaps: (number | string | BN)[], + ): NonPayableTransactionObject + + _setMintPaused(qiToken: string, state: boolean): NonPayableTransactionObject + + _setPauseGuardian(newPauseGuardian: string): NonPayableTransactionObject + + _setPriceOracle(newOracle: string): NonPayableTransactionObject + + _setRewardSpeed( + rewardType: number | string | BN, + qiToken: string, + rewardSpeed: number | string | BN, + ): NonPayableTransactionObject + + _setSeizePaused(state: boolean): NonPayableTransactionObject + + _setTransferPaused(state: boolean): NonPayableTransactionObject + + _supportMarket(qiToken: string): NonPayableTransactionObject + + accountAssets(arg0: string, arg1: number | string | BN): NonPayableTransactionObject + + admin(): NonPayableTransactionObject + + allMarkets(arg0: number | string | BN): NonPayableTransactionObject + + borrowAllowed( + qiToken: string, + borrower: string, + borrowAmount: number | string | BN, + ): NonPayableTransactionObject + + borrowCapGuardian(): NonPayableTransactionObject + + borrowCaps(arg0: string): NonPayableTransactionObject + + borrowGuardianPaused(arg0: string): NonPayableTransactionObject + + borrowVerify( + qiToken: string, + borrower: string, + borrowAmount: number | string | BN, + ): NonPayableTransactionObject + + checkMembership(account: string, qiToken: string): NonPayableTransactionObject + + 'claimReward(uint8,address)'( + rewardType: number | string | BN, + holder: string, + ): NonPayableTransactionObject + + 'claimReward(uint8,address,address[])'( + rewardType: number | string | BN, + holder: string, + qiTokens: string[], + ): NonPayableTransactionObject + + 'claimReward(uint8,address[],address[],bool,bool)'( + rewardType: number | string | BN, + holders: string[], + qiTokens: string[], + borrowers: boolean, + suppliers: boolean, + ): PayableTransactionObject + + closeFactorMantissa(): NonPayableTransactionObject + + comptrollerImplementation(): NonPayableTransactionObject + + enterMarkets(qiTokens: string[]): NonPayableTransactionObject + + exitMarket(qiTokenAddress: string): NonPayableTransactionObject + + getAccountLiquidity(account: string): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + }> + + getAllMarkets(): NonPayableTransactionObject + + getAssetsIn(account: string): NonPayableTransactionObject + + getBlockTimestamp(): NonPayableTransactionObject + + getHypotheticalAccountLiquidity( + account: string, + qiTokenModify: string, + redeemTokens: number | string | BN, + borrowAmount: number | string | BN, + ): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + }> + + initialIndexConstant(): NonPayableTransactionObject + + isComptroller(): NonPayableTransactionObject + + liquidateBorrowAllowed( + qiTokenBorrowed: string, + qiTokenCollateral: string, + liquidator: string, + borrower: string, + repayAmount: number | string | BN, + ): NonPayableTransactionObject + + liquidateBorrowVerify( + qiTokenBorrowed: string, + qiTokenCollateral: string, + liquidator: string, + borrower: string, + actualRepayAmount: number | string | BN, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + liquidateCalculateSeizeTokens( + qiTokenBorrowed: string, + qiTokenCollateral: string, + actualRepayAmount: number | string | BN, + ): NonPayableTransactionObject<{ + 0: string + 1: string + }> + + liquidationIncentiveMantissa(): NonPayableTransactionObject + + markets(arg0: string): NonPayableTransactionObject<{ + isListed: boolean + collateralFactorMantissa: string + isQied: boolean + 0: boolean + 1: string + 2: boolean + }> + + maxAssets(): NonPayableTransactionObject + + mintAllowed( + qiToken: string, + minter: string, + mintAmount: number | string | BN, + ): NonPayableTransactionObject + + mintGuardianPaused(arg0: string): NonPayableTransactionObject + + mintVerify( + qiToken: string, + minter: string, + actualMintAmount: number | string | BN, + mintTokens: number | string | BN, + ): NonPayableTransactionObject + + oracle(): NonPayableTransactionObject + + pauseGuardian(): NonPayableTransactionObject + + pendingAdmin(): NonPayableTransactionObject + + pendingComptrollerImplementation(): NonPayableTransactionObject + + qiAddress(): NonPayableTransactionObject + + redeemAllowed( + qiToken: string, + redeemer: string, + redeemTokens: number | string | BN, + ): NonPayableTransactionObject + + redeemVerify( + qiToken: string, + redeemer: string, + redeemAmount: number | string | BN, + redeemTokens: number | string | BN, + ): NonPayableTransactionObject + + repayBorrowAllowed( + qiToken: string, + payer: string, + borrower: string, + repayAmount: number | string | BN, + ): NonPayableTransactionObject + + repayBorrowVerify( + qiToken: string, + payer: string, + borrower: string, + actualRepayAmount: number | string | BN, + borrowerIndex: number | string | BN, + ): NonPayableTransactionObject + + rewardAccrued(arg0: number | string | BN, arg1: string): NonPayableTransactionObject + + rewardAvax(): NonPayableTransactionObject + + rewardBorrowState( + arg0: number | string | BN, + arg1: string, + ): NonPayableTransactionObject<{ + index: string + timestamp: string + 0: string + 1: string + }> + + rewardBorrowerIndex(arg0: number | string | BN, arg1: string, arg2: string): NonPayableTransactionObject + + rewardQi(): NonPayableTransactionObject + + supplyRewardSpeeds(arg0: number | string | BN, arg1: string): NonPayableTransactionObject + + rewardSupplierIndex(arg0: number | string | BN, arg1: string, arg2: string): NonPayableTransactionObject + + rewardSupplyState( + arg0: number | string | BN, + arg1: string, + ): NonPayableTransactionObject<{ + index: string + timestamp: string + 0: string + 1: string + }> + + seizeAllowed( + qiTokenCollateral: string, + qiTokenBorrowed: string, + liquidator: string, + borrower: string, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + seizeGuardianPaused(): NonPayableTransactionObject + + seizeVerify( + qiTokenCollateral: string, + qiTokenBorrowed: string, + liquidator: string, + borrower: string, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + setQiAddress(newQiAddress: string): NonPayableTransactionObject + + transferAllowed( + qiToken: string, + src: string, + dst: string, + transferTokens: number | string | BN, + ): NonPayableTransactionObject + + transferGuardianPaused(): NonPayableTransactionObject + + transferVerify( + qiToken: string, + src: string, + dst: string, + transferTokens: number | string | BN, + ): NonPayableTransactionObject + } + events: { + 'ActionPaused(string,bool)'(cb?: Callback): EventEmitter + 'ActionPaused(string,bool)'(options?: EventOptions, cb?: Callback): EventEmitter + + 'ActionPaused(address,string,bool)'(cb?: Callback): EventEmitter + 'ActionPaused(address,string,bool)'( + options?: EventOptions, + cb?: Callback, + ): EventEmitter + + ContributorQiSpeedUpdated(cb?: Callback): EventEmitter + ContributorQiSpeedUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + DistributedBorrowerReward(cb?: Callback): EventEmitter + DistributedBorrowerReward(options?: EventOptions, cb?: Callback): EventEmitter + + DistributedSupplierReward(cb?: Callback): EventEmitter + DistributedSupplierReward(options?: EventOptions, cb?: Callback): EventEmitter + + Failure(cb?: Callback): EventEmitter + Failure(options?: EventOptions, cb?: Callback): EventEmitter + + MarketEntered(cb?: Callback): EventEmitter + MarketEntered(options?: EventOptions, cb?: Callback): EventEmitter + + MarketExited(cb?: Callback): EventEmitter + MarketExited(options?: EventOptions, cb?: Callback): EventEmitter + + MarketListed(cb?: Callback): EventEmitter + MarketListed(options?: EventOptions, cb?: Callback): EventEmitter + + NewBorrowCap(cb?: Callback): EventEmitter + NewBorrowCap(options?: EventOptions, cb?: Callback): EventEmitter + + NewBorrowCapGuardian(cb?: Callback): EventEmitter + NewBorrowCapGuardian(options?: EventOptions, cb?: Callback): EventEmitter + + NewCloseFactor(cb?: Callback): EventEmitter + NewCloseFactor(options?: EventOptions, cb?: Callback): EventEmitter + + NewCollateralFactor(cb?: Callback): EventEmitter + NewCollateralFactor(options?: EventOptions, cb?: Callback): EventEmitter + + NewLiquidationIncentive(cb?: Callback): EventEmitter + NewLiquidationIncentive(options?: EventOptions, cb?: Callback): EventEmitter + + NewPauseGuardian(cb?: Callback): EventEmitter + NewPauseGuardian(options?: EventOptions, cb?: Callback): EventEmitter + + NewPriceOracle(cb?: Callback): EventEmitter + NewPriceOracle(options?: EventOptions, cb?: Callback): EventEmitter + + QiGranted(cb?: Callback): EventEmitter + QiGranted(options?: EventOptions, cb?: Callback): EventEmitter + + SpeedUpdated(cb?: Callback): EventEmitter + SpeedUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'ContributorQiSpeedUpdated', cb: Callback): void + once(event: 'ContributorQiSpeedUpdated', options: EventOptions, cb: Callback): void + + once(event: 'DistributedBorrowerReward', cb: Callback): void + once(event: 'DistributedBorrowerReward', options: EventOptions, cb: Callback): void + + once(event: 'DistributedSupplierReward', cb: Callback): void + once(event: 'DistributedSupplierReward', options: EventOptions, cb: Callback): void + + once(event: 'Failure', cb: Callback): void + once(event: 'Failure', options: EventOptions, cb: Callback): void + + once(event: 'MarketEntered', cb: Callback): void + once(event: 'MarketEntered', options: EventOptions, cb: Callback): void + + once(event: 'MarketExited', cb: Callback): void + once(event: 'MarketExited', options: EventOptions, cb: Callback): void + + once(event: 'MarketListed', cb: Callback): void + once(event: 'MarketListed', options: EventOptions, cb: Callback): void + + once(event: 'NewBorrowCap', cb: Callback): void + once(event: 'NewBorrowCap', options: EventOptions, cb: Callback): void + + once(event: 'NewBorrowCapGuardian', cb: Callback): void + once(event: 'NewBorrowCapGuardian', options: EventOptions, cb: Callback): void + + once(event: 'NewCloseFactor', cb: Callback): void + once(event: 'NewCloseFactor', options: EventOptions, cb: Callback): void + + once(event: 'NewCollateralFactor', cb: Callback): void + once(event: 'NewCollateralFactor', options: EventOptions, cb: Callback): void + + once(event: 'NewLiquidationIncentive', cb: Callback): void + once(event: 'NewLiquidationIncentive', options: EventOptions, cb: Callback): void + + once(event: 'NewPauseGuardian', cb: Callback): void + once(event: 'NewPauseGuardian', options: EventOptions, cb: Callback): void + + once(event: 'NewPriceOracle', cb: Callback): void + once(event: 'NewPriceOracle', options: EventOptions, cb: Callback): void + + once(event: 'QiGranted', cb: Callback): void + once(event: 'QiGranted', options: EventOptions, cb: Callback): void + + once(event: 'SpeedUpdated', cb: Callback): void + once(event: 'SpeedUpdated', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/BenqiChainlinkOracle.d.ts b/packages/web3-contracts/types/BenqiChainlinkOracle.d.ts new file mode 100644 index 000000000000..217dd84df95a --- /dev/null +++ b/packages/web3-contracts/types/BenqiChainlinkOracle.d.ts @@ -0,0 +1,93 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type FeedSet = ContractEventLog<{ + feed: string + symbol: string + 0: string + 1: string +}> +export type NewAdmin = ContractEventLog<{ + oldAdmin: string + newAdmin: string + 0: string + 1: string +}> +export type PricePosted = ContractEventLog<{ + asset: string + previousPriceMantissa: string + requestedPriceMantissa: string + newPriceMantissa: string + 0: string + 1: string + 2: string + 3: string +}> + +export interface BenqiChainlinkOracle extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): BenqiChainlinkOracle + clone(): BenqiChainlinkOracle + methods: { + admin(): NonPayableTransactionObject + + assetPrices(asset: string): NonPayableTransactionObject + + getFeed(symbol: string): NonPayableTransactionObject + + getUnderlyingPrice(qiToken: string): NonPayableTransactionObject + + isPriceOracle(): NonPayableTransactionObject + + setAdmin(newAdmin: string): NonPayableTransactionObject + + setDirectPrice(asset: string, price: number | string | BN): NonPayableTransactionObject + + setFeed(symbol: string, feed: string): NonPayableTransactionObject + + setUnderlyingPrice( + qiToken: string, + underlyingPriceMantissa: number | string | BN, + ): NonPayableTransactionObject + } + events: { + FeedSet(cb?: Callback): EventEmitter + FeedSet(options?: EventOptions, cb?: Callback): EventEmitter + + NewAdmin(cb?: Callback): EventEmitter + NewAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + PricePosted(cb?: Callback): EventEmitter + PricePosted(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'FeedSet', cb: Callback): void + once(event: 'FeedSet', options: EventOptions, cb: Callback): void + + once(event: 'NewAdmin', cb: Callback): void + once(event: 'NewAdmin', options: EventOptions, cb: Callback): void + + once(event: 'PricePosted', cb: Callback): void + once(event: 'PricePosted', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/CERC20.d.ts b/packages/web3-contracts/types/CERC20.d.ts new file mode 100644 index 000000000000..411d2f0cdfdf --- /dev/null +++ b/packages/web3-contracts/types/CERC20.d.ts @@ -0,0 +1,391 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type AccrueInterest = ContractEventLog<{ + cashPrior: string + interestAccumulated: string + borrowIndex: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string +}> +export type Approval = ContractEventLog<{ + owner: string + spender: string + amount: string + 0: string + 1: string + 2: string +}> +export type Borrow = ContractEventLog<{ + borrower: string + borrowAmount: string + accountBorrows: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string +}> +export type Failure = ContractEventLog<{ + error: string + info: string + detail: string + 0: string + 1: string + 2: string +}> +export type LiquidateBorrow = ContractEventLog<{ + liquidator: string + borrower: string + repayAmount: string + cTokenCollateral: string + seizeTokens: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type Mint = ContractEventLog<{ + minter: string + mintAmount: string + mintTokens: string + 0: string + 1: string + 2: string +}> +export type NewAdmin = ContractEventLog<{ + oldAdmin: string + newAdmin: string + 0: string + 1: string +}> +export type NewComptroller = ContractEventLog<{ + oldComptroller: string + newComptroller: string + 0: string + 1: string +}> +export type NewImplementation = ContractEventLog<{ + oldImplementation: string + newImplementation: string + 0: string + 1: string +}> +export type NewMarketInterestRateModel = ContractEventLog<{ + oldInterestRateModel: string + newInterestRateModel: string + 0: string + 1: string +}> +export type NewPendingAdmin = ContractEventLog<{ + oldPendingAdmin: string + newPendingAdmin: string + 0: string + 1: string +}> +export type NewReserveFactor = ContractEventLog<{ + oldReserveFactorMantissa: string + newReserveFactorMantissa: string + 0: string + 1: string +}> +export type Redeem = ContractEventLog<{ + redeemer: string + redeemAmount: string + redeemTokens: string + 0: string + 1: string + 2: string +}> +export type RepayBorrow = ContractEventLog<{ + payer: string + borrower: string + repayAmount: string + accountBorrows: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type ReservesAdded = ContractEventLog<{ + benefactor: string + addAmount: string + newTotalReserves: string + 0: string + 1: string + 2: string +}> +export type ReservesReduced = ContractEventLog<{ + admin: string + reduceAmount: string + newTotalReserves: string + 0: string + 1: string + 2: string +}> +export type Transfer = ContractEventLog<{ + from: string + to: string + amount: string + 0: string + 1: string + 2: string +}> + +export interface CERC20 extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): CERC20 + clone(): CERC20 + methods: { + _acceptAdmin(): NonPayableTransactionObject + + _addReserves(addAmount: number | string | BN): NonPayableTransactionObject + + _reduceReserves(reduceAmount: number | string | BN): NonPayableTransactionObject + + _setComptroller(newComptroller: string): NonPayableTransactionObject + + _setImplementation( + implementation_: string, + allowResign: boolean, + becomeImplementationData: string | number[], + ): NonPayableTransactionObject + + _setInterestRateModel(newInterestRateModel: string): NonPayableTransactionObject + + _setPendingAdmin(newPendingAdmin: string): NonPayableTransactionObject + + _setReserveFactor(newReserveFactorMantissa: number | string | BN): NonPayableTransactionObject + + accrualBlockNumber(): NonPayableTransactionObject + + accrueInterest(): NonPayableTransactionObject + + admin(): NonPayableTransactionObject + + allowance(owner: string, spender: string): NonPayableTransactionObject + + approve(spender: string, amount: number | string | BN): NonPayableTransactionObject + + balanceOf(owner: string): NonPayableTransactionObject + + balanceOfUnderlying(owner: string): NonPayableTransactionObject + + borrow(borrowAmount: number | string | BN): NonPayableTransactionObject + + borrowBalanceCurrent(account: string): NonPayableTransactionObject + + borrowBalanceStored(account: string): NonPayableTransactionObject + + borrowIndex(): NonPayableTransactionObject + + borrowRatePerBlock(): NonPayableTransactionObject + + comptroller(): NonPayableTransactionObject + + decimals(): NonPayableTransactionObject + + delegateToImplementation(data: string | number[]): NonPayableTransactionObject + + delegateToViewImplementation(data: string | number[]): NonPayableTransactionObject + + exchangeRateCurrent(): NonPayableTransactionObject + + exchangeRateStored(): NonPayableTransactionObject + + getAccountSnapshot(account: string): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + 3: string + }> + + getCash(): NonPayableTransactionObject + + implementation(): NonPayableTransactionObject + + interestRateModel(): NonPayableTransactionObject + + isCToken(): NonPayableTransactionObject + + liquidateBorrow( + borrower: string, + repayAmount: number | string | BN, + cTokenCollateral: string, + ): NonPayableTransactionObject + + mint(mintAmount: number | string | BN): NonPayableTransactionObject + + name(): NonPayableTransactionObject + + pendingAdmin(): NonPayableTransactionObject + + protocolSeizeShareMantissa(): NonPayableTransactionObject + + redeem(redeemTokens: number | string | BN): NonPayableTransactionObject + + redeemUnderlying(redeemAmount: number | string | BN): NonPayableTransactionObject + + repayBorrow(repayAmount: number | string | BN): NonPayableTransactionObject + + repayBorrowBehalf(borrower: string, repayAmount: number | string | BN): NonPayableTransactionObject + + reserveFactorMantissa(): NonPayableTransactionObject + + seize( + liquidator: string, + borrower: string, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + supplyRatePerBlock(): NonPayableTransactionObject + + sweepToken(token: string): NonPayableTransactionObject + + symbol(): NonPayableTransactionObject + + totalBorrows(): NonPayableTransactionObject + + totalBorrowsCurrent(): NonPayableTransactionObject + + totalReserves(): NonPayableTransactionObject + + totalSupply(): NonPayableTransactionObject + + transfer(dst: string, amount: number | string | BN): NonPayableTransactionObject + + transferFrom(src: string, dst: string, amount: number | string | BN): NonPayableTransactionObject + + underlying(): NonPayableTransactionObject + } + events: { + AccrueInterest(cb?: Callback): EventEmitter + AccrueInterest(options?: EventOptions, cb?: Callback): EventEmitter + + Approval(cb?: Callback): EventEmitter + Approval(options?: EventOptions, cb?: Callback): EventEmitter + + Borrow(cb?: Callback): EventEmitter + Borrow(options?: EventOptions, cb?: Callback): EventEmitter + + Failure(cb?: Callback): EventEmitter + Failure(options?: EventOptions, cb?: Callback): EventEmitter + + LiquidateBorrow(cb?: Callback): EventEmitter + LiquidateBorrow(options?: EventOptions, cb?: Callback): EventEmitter + + Mint(cb?: Callback): EventEmitter + Mint(options?: EventOptions, cb?: Callback): EventEmitter + + NewAdmin(cb?: Callback): EventEmitter + NewAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + NewComptroller(cb?: Callback): EventEmitter + NewComptroller(options?: EventOptions, cb?: Callback): EventEmitter + + NewImplementation(cb?: Callback): EventEmitter + NewImplementation(options?: EventOptions, cb?: Callback): EventEmitter + + NewMarketInterestRateModel(cb?: Callback): EventEmitter + NewMarketInterestRateModel(options?: EventOptions, cb?: Callback): EventEmitter + + NewPendingAdmin(cb?: Callback): EventEmitter + NewPendingAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + NewReserveFactor(cb?: Callback): EventEmitter + NewReserveFactor(options?: EventOptions, cb?: Callback): EventEmitter + + Redeem(cb?: Callback): EventEmitter + Redeem(options?: EventOptions, cb?: Callback): EventEmitter + + RepayBorrow(cb?: Callback): EventEmitter + RepayBorrow(options?: EventOptions, cb?: Callback): EventEmitter + + ReservesAdded(cb?: Callback): EventEmitter + ReservesAdded(options?: EventOptions, cb?: Callback): EventEmitter + + ReservesReduced(cb?: Callback): EventEmitter + ReservesReduced(options?: EventOptions, cb?: Callback): EventEmitter + + Transfer(cb?: Callback): EventEmitter + Transfer(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'AccrueInterest', cb: Callback): void + once(event: 'AccrueInterest', options: EventOptions, cb: Callback): void + + once(event: 'Approval', cb: Callback): void + once(event: 'Approval', options: EventOptions, cb: Callback): void + + once(event: 'Borrow', cb: Callback): void + once(event: 'Borrow', options: EventOptions, cb: Callback): void + + once(event: 'Failure', cb: Callback): void + once(event: 'Failure', options: EventOptions, cb: Callback): void + + once(event: 'LiquidateBorrow', cb: Callback): void + once(event: 'LiquidateBorrow', options: EventOptions, cb: Callback): void + + once(event: 'Mint', cb: Callback): void + once(event: 'Mint', options: EventOptions, cb: Callback): void + + once(event: 'NewAdmin', cb: Callback): void + once(event: 'NewAdmin', options: EventOptions, cb: Callback): void + + once(event: 'NewComptroller', cb: Callback): void + once(event: 'NewComptroller', options: EventOptions, cb: Callback): void + + once(event: 'NewImplementation', cb: Callback): void + once(event: 'NewImplementation', options: EventOptions, cb: Callback): void + + once(event: 'NewMarketInterestRateModel', cb: Callback): void + once(event: 'NewMarketInterestRateModel', options: EventOptions, cb: Callback): void + + once(event: 'NewPendingAdmin', cb: Callback): void + once(event: 'NewPendingAdmin', options: EventOptions, cb: Callback): void + + once(event: 'NewReserveFactor', cb: Callback): void + once(event: 'NewReserveFactor', options: EventOptions, cb: Callback): void + + once(event: 'Redeem', cb: Callback): void + once(event: 'Redeem', options: EventOptions, cb: Callback): void + + once(event: 'RepayBorrow', cb: Callback): void + once(event: 'RepayBorrow', options: EventOptions, cb: Callback): void + + once(event: 'ReservesAdded', cb: Callback): void + once(event: 'ReservesAdded', options: EventOptions, cb: Callback): void + + once(event: 'ReservesReduced', cb: Callback): void + once(event: 'ReservesReduced', options: EventOptions, cb: Callback): void + + once(event: 'Transfer', cb: Callback): void + once(event: 'Transfer', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/CEther.d.ts b/packages/web3-contracts/types/CEther.d.ts new file mode 100644 index 000000000000..6404a52c8f3b --- /dev/null +++ b/packages/web3-contracts/types/CEther.d.ts @@ -0,0 +1,341 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type AccrueInterest = ContractEventLog<{ + interestAccumulated: string + borrowIndex: string + totalBorrows: string + 0: string + 1: string + 2: string +}> +export type Mint = ContractEventLog<{ + minter: string + mintAmount: string + mintTokens: string + 0: string + 1: string + 2: string +}> +export type Redeem = ContractEventLog<{ + redeemer: string + redeemAmount: string + redeemTokens: string + 0: string + 1: string + 2: string +}> +export type Borrow = ContractEventLog<{ + borrower: string + borrowAmount: string + accountBorrows: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string +}> +export type RepayBorrow = ContractEventLog<{ + payer: string + borrower: string + repayAmount: string + accountBorrows: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type LiquidateBorrow = ContractEventLog<{ + liquidator: string + borrower: string + repayAmount: string + cTokenCollateral: string + seizeTokens: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type NewPendingAdmin = ContractEventLog<{ + oldPendingAdmin: string + newPendingAdmin: string + 0: string + 1: string +}> +export type NewAdmin = ContractEventLog<{ + oldAdmin: string + newAdmin: string + 0: string + 1: string +}> +export type NewComptroller = ContractEventLog<{ + oldComptroller: string + newComptroller: string + 0: string + 1: string +}> +export type NewMarketInterestRateModel = ContractEventLog<{ + oldInterestRateModel: string + newInterestRateModel: string + 0: string + 1: string +}> +export type NewReserveFactor = ContractEventLog<{ + oldReserveFactorMantissa: string + newReserveFactorMantissa: string + 0: string + 1: string +}> +export type ReservesReduced = ContractEventLog<{ + admin: string + reduceAmount: string + newTotalReserves: string + 0: string + 1: string + 2: string +}> +export type Failure = ContractEventLog<{ + error: string + info: string + detail: string + 0: string + 1: string + 2: string +}> +export type Transfer = ContractEventLog<{ + from: string + to: string + amount: string + 0: string + 1: string + 2: string +}> +export type Approval = ContractEventLog<{ + owner: string + spender: string + amount: string + 0: string + 1: string + 2: string +}> + +export interface CEther extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): CEther + clone(): CEther + methods: { + name(): NonPayableTransactionObject + + approve(spender: string, amount: number | string | BN): NonPayableTransactionObject + + mint(): PayableTransactionObject + + reserveFactorMantissa(): NonPayableTransactionObject + + borrowBalanceCurrent(account: string): NonPayableTransactionObject + + totalSupply(): NonPayableTransactionObject + + exchangeRateStored(): NonPayableTransactionObject + + transferFrom(src: string, dst: string, amount: number | string | BN): NonPayableTransactionObject + + pendingAdmin(): NonPayableTransactionObject + + decimals(): NonPayableTransactionObject + + balanceOfUnderlying(owner: string): NonPayableTransactionObject + + getCash(): NonPayableTransactionObject + + _setComptroller(newComptroller: string): NonPayableTransactionObject + + totalBorrows(): NonPayableTransactionObject + + repayBorrow(): PayableTransactionObject + + comptroller(): NonPayableTransactionObject + + _reduceReserves(reduceAmount: number | string | BN): NonPayableTransactionObject + + initialExchangeRateMantissa(): NonPayableTransactionObject + + accrualBlockNumber(): NonPayableTransactionObject + + balanceOf(owner: string): NonPayableTransactionObject + + totalBorrowsCurrent(): NonPayableTransactionObject + + redeemUnderlying(redeemAmount: number | string | BN): NonPayableTransactionObject + + totalReserves(): NonPayableTransactionObject + + symbol(): NonPayableTransactionObject + + borrowBalanceStored(account: string): NonPayableTransactionObject + + accrueInterest(): NonPayableTransactionObject + + transfer(dst: string, amount: number | string | BN): NonPayableTransactionObject + + borrowIndex(): NonPayableTransactionObject + + liquidateBorrow(borrower: string, cTokenCollateral: string): PayableTransactionObject + + supplyRatePerBlock(): NonPayableTransactionObject + + seize( + liquidator: string, + borrower: string, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + _setPendingAdmin(newPendingAdmin: string): NonPayableTransactionObject + + exchangeRateCurrent(): NonPayableTransactionObject + + getAccountSnapshot(account: string): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + 3: string + }> + + borrow(borrowAmount: number | string | BN): NonPayableTransactionObject + + redeem(redeemTokens: number | string | BN): NonPayableTransactionObject + + allowance(owner: string, spender: string): NonPayableTransactionObject + + repayBorrowBehalf(borrower: string): PayableTransactionObject + + _acceptAdmin(): NonPayableTransactionObject + + _setInterestRateModel(newInterestRateModel: string): NonPayableTransactionObject + + interestRateModel(): NonPayableTransactionObject + + admin(): NonPayableTransactionObject + + borrowRatePerBlock(): NonPayableTransactionObject + + _setReserveFactor(newReserveFactorMantissa: number | string | BN): NonPayableTransactionObject + + isCToken(): NonPayableTransactionObject + } + events: { + AccrueInterest(cb?: Callback): EventEmitter + AccrueInterest(options?: EventOptions, cb?: Callback): EventEmitter + + Mint(cb?: Callback): EventEmitter + Mint(options?: EventOptions, cb?: Callback): EventEmitter + + Redeem(cb?: Callback): EventEmitter + Redeem(options?: EventOptions, cb?: Callback): EventEmitter + + Borrow(cb?: Callback): EventEmitter + Borrow(options?: EventOptions, cb?: Callback): EventEmitter + + RepayBorrow(cb?: Callback): EventEmitter + RepayBorrow(options?: EventOptions, cb?: Callback): EventEmitter + + LiquidateBorrow(cb?: Callback): EventEmitter + LiquidateBorrow(options?: EventOptions, cb?: Callback): EventEmitter + + NewPendingAdmin(cb?: Callback): EventEmitter + NewPendingAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + NewAdmin(cb?: Callback): EventEmitter + NewAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + NewComptroller(cb?: Callback): EventEmitter + NewComptroller(options?: EventOptions, cb?: Callback): EventEmitter + + NewMarketInterestRateModel(cb?: Callback): EventEmitter + NewMarketInterestRateModel(options?: EventOptions, cb?: Callback): EventEmitter + + NewReserveFactor(cb?: Callback): EventEmitter + NewReserveFactor(options?: EventOptions, cb?: Callback): EventEmitter + + ReservesReduced(cb?: Callback): EventEmitter + ReservesReduced(options?: EventOptions, cb?: Callback): EventEmitter + + Failure(cb?: Callback): EventEmitter + Failure(options?: EventOptions, cb?: Callback): EventEmitter + + Transfer(cb?: Callback): EventEmitter + Transfer(options?: EventOptions, cb?: Callback): EventEmitter + + Approval(cb?: Callback): EventEmitter + Approval(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'AccrueInterest', cb: Callback): void + once(event: 'AccrueInterest', options: EventOptions, cb: Callback): void + + once(event: 'Mint', cb: Callback): void + once(event: 'Mint', options: EventOptions, cb: Callback): void + + once(event: 'Redeem', cb: Callback): void + once(event: 'Redeem', options: EventOptions, cb: Callback): void + + once(event: 'Borrow', cb: Callback): void + once(event: 'Borrow', options: EventOptions, cb: Callback): void + + once(event: 'RepayBorrow', cb: Callback): void + once(event: 'RepayBorrow', options: EventOptions, cb: Callback): void + + once(event: 'LiquidateBorrow', cb: Callback): void + once(event: 'LiquidateBorrow', options: EventOptions, cb: Callback): void + + once(event: 'NewPendingAdmin', cb: Callback): void + once(event: 'NewPendingAdmin', options: EventOptions, cb: Callback): void + + once(event: 'NewAdmin', cb: Callback): void + once(event: 'NewAdmin', options: EventOptions, cb: Callback): void + + once(event: 'NewComptroller', cb: Callback): void + once(event: 'NewComptroller', options: EventOptions, cb: Callback): void + + once(event: 'NewMarketInterestRateModel', cb: Callback): void + once(event: 'NewMarketInterestRateModel', options: EventOptions, cb: Callback): void + + once(event: 'NewReserveFactor', cb: Callback): void + once(event: 'NewReserveFactor', options: EventOptions, cb: Callback): void + + once(event: 'ReservesReduced', cb: Callback): void + once(event: 'ReservesReduced', options: EventOptions, cb: Callback): void + + once(event: 'Failure', cb: Callback): void + once(event: 'Failure', options: EventOptions, cb: Callback): void + + once(event: 'Transfer', cb: Callback): void + once(event: 'Transfer', options: EventOptions, cb: Callback): void + + once(event: 'Approval', cb: Callback): void + once(event: 'Approval', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/Comptroller.d.ts b/packages/web3-contracts/types/Comptroller.d.ts new file mode 100644 index 000000000000..b5cb2f2f548d --- /dev/null +++ b/packages/web3-contracts/types/Comptroller.d.ts @@ -0,0 +1,588 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type ActionPaused_string_bool = ContractEventLog<{ + action: string + pauseState: boolean + 0: string + 1: boolean +}> +export type ActionPaused_address_string_bool = ContractEventLog<{ + cToken: string + action: string + pauseState: boolean + 0: string + 1: string + 2: boolean +}> +export type CompAccruedAdjusted = ContractEventLog<{ + user: string + oldCompAccrued: string + newCompAccrued: string + 0: string + 1: string + 2: string +}> +export type CompBorrowSpeedUpdated = ContractEventLog<{ + cToken: string + newSpeed: string + 0: string + 1: string +}> +export type CompGranted = ContractEventLog<{ + recipient: string + amount: string + 0: string + 1: string +}> +export type CompReceivableUpdated = ContractEventLog<{ + user: string + oldCompReceivable: string + newCompReceivable: string + 0: string + 1: string + 2: string +}> +export type CompSupplySpeedUpdated = ContractEventLog<{ + cToken: string + newSpeed: string + 0: string + 1: string +}> +export type ContributorCompSpeedUpdated = ContractEventLog<{ + contributor: string + newSpeed: string + 0: string + 1: string +}> +export type DistributedBorrowerComp = ContractEventLog<{ + cToken: string + borrower: string + compDelta: string + compBorrowIndex: string + 0: string + 1: string + 2: string + 3: string +}> +export type DistributedSupplierComp = ContractEventLog<{ + cToken: string + supplier: string + compDelta: string + compSupplyIndex: string + 0: string + 1: string + 2: string + 3: string +}> +export type Failure = ContractEventLog<{ + error: string + info: string + detail: string + 0: string + 1: string + 2: string +}> +export type MarketEntered = ContractEventLog<{ + cToken: string + account: string + 0: string + 1: string +}> +export type MarketExited = ContractEventLog<{ + cToken: string + account: string + 0: string + 1: string +}> +export type MarketListed = ContractEventLog<{ + cToken: string + 0: string +}> +export type NewBorrowCap = ContractEventLog<{ + cToken: string + newBorrowCap: string + 0: string + 1: string +}> +export type NewBorrowCapGuardian = ContractEventLog<{ + oldBorrowCapGuardian: string + newBorrowCapGuardian: string + 0: string + 1: string +}> +export type NewCloseFactor = ContractEventLog<{ + oldCloseFactorMantissa: string + newCloseFactorMantissa: string + 0: string + 1: string +}> +export type NewCollateralFactor = ContractEventLog<{ + cToken: string + oldCollateralFactorMantissa: string + newCollateralFactorMantissa: string + 0: string + 1: string + 2: string +}> +export type NewLiquidationIncentive = ContractEventLog<{ + oldLiquidationIncentiveMantissa: string + newLiquidationIncentiveMantissa: string + 0: string + 1: string +}> +export type NewPauseGuardian = ContractEventLog<{ + oldPauseGuardian: string + newPauseGuardian: string + 0: string + 1: string +}> +export type NewPriceOracle = ContractEventLog<{ + oldPriceOracle: string + newPriceOracle: string + 0: string + 1: string +}> + +export interface Comptroller extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): Comptroller + clone(): Comptroller + methods: { + _become(unitroller: string): NonPayableTransactionObject + + _borrowGuardianPaused(): NonPayableTransactionObject + + _grantComp(recipient: string, amount: number | string | BN): NonPayableTransactionObject + + _mintGuardianPaused(): NonPayableTransactionObject + + _setBorrowCapGuardian(newBorrowCapGuardian: string): NonPayableTransactionObject + + _setBorrowPaused(cToken: string, state: boolean): NonPayableTransactionObject + + _setCloseFactor(newCloseFactorMantissa: number | string | BN): NonPayableTransactionObject + + _setCollateralFactor( + cToken: string, + newCollateralFactorMantissa: number | string | BN, + ): NonPayableTransactionObject + + _setCompSpeeds( + cTokens: string[], + supplySpeeds: (number | string | BN)[], + borrowSpeeds: (number | string | BN)[], + ): NonPayableTransactionObject + + _setContributorCompSpeed( + contributor: string, + compSpeed: number | string | BN, + ): NonPayableTransactionObject + + _setLiquidationIncentive( + newLiquidationIncentiveMantissa: number | string | BN, + ): NonPayableTransactionObject + + _setMarketBorrowCaps( + cTokens: string[], + newBorrowCaps: (number | string | BN)[], + ): NonPayableTransactionObject + + _setMintPaused(cToken: string, state: boolean): NonPayableTransactionObject + + _setPauseGuardian(newPauseGuardian: string): NonPayableTransactionObject + + _setPriceOracle(newOracle: string): NonPayableTransactionObject + + _setSeizePaused(state: boolean): NonPayableTransactionObject + + _setTransferPaused(state: boolean): NonPayableTransactionObject + + _supportMarket(cToken: string): NonPayableTransactionObject + + accountAssets(arg0: string, arg1: number | string | BN): NonPayableTransactionObject + + admin(): NonPayableTransactionObject + + allMarkets(arg0: number | string | BN): NonPayableTransactionObject + + borrowAllowed( + cToken: string, + borrower: string, + borrowAmount: number | string | BN, + ): NonPayableTransactionObject + + borrowCapGuardian(): NonPayableTransactionObject + + borrowCaps(arg0: string): NonPayableTransactionObject + + borrowGuardianPaused(arg0: string): NonPayableTransactionObject + + borrowVerify( + cToken: string, + borrower: string, + borrowAmount: number | string | BN, + ): NonPayableTransactionObject + + checkMembership(account: string, cToken: string): NonPayableTransactionObject + + 'claimComp(address,address[])'(holder: string, cTokens: string[]): NonPayableTransactionObject + + 'claimComp(address[],address[],bool,bool)'( + holders: string[], + cTokens: string[], + borrowers: boolean, + suppliers: boolean, + ): NonPayableTransactionObject + + 'claimComp(address)'(holder: string): NonPayableTransactionObject + + closeFactorMantissa(): NonPayableTransactionObject + + compAccrued(arg0: string): NonPayableTransactionObject + + compBorrowSpeeds(arg0: string): NonPayableTransactionObject + + compBorrowState(arg0: string): NonPayableTransactionObject<{ + index: string + block: string + 0: string + 1: string + }> + + compBorrowerIndex(arg0: string, arg1: string): NonPayableTransactionObject + + compContributorSpeeds(arg0: string): NonPayableTransactionObject + + compInitialIndex(): NonPayableTransactionObject + + compRate(): NonPayableTransactionObject + + compReceivable(arg0: string): NonPayableTransactionObject + + compSpeeds(arg0: string): NonPayableTransactionObject + + compSupplierIndex(arg0: string, arg1: string): NonPayableTransactionObject + + compSupplySpeeds(arg0: string): NonPayableTransactionObject + + compSupplyState(arg0: string): NonPayableTransactionObject<{ + index: string + block: string + 0: string + 1: string + }> + + comptrollerImplementation(): NonPayableTransactionObject + + enterMarkets(cTokens: string[]): NonPayableTransactionObject + + exitMarket(cTokenAddress: string): NonPayableTransactionObject + + fixBadAccruals(affectedUsers: string[], amounts: (number | string | BN)[]): NonPayableTransactionObject + + getAccountLiquidity(account: string): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + }> + + getAllMarkets(): NonPayableTransactionObject + + getAssetsIn(account: string): NonPayableTransactionObject + + getBlockNumber(): NonPayableTransactionObject + + getCompAddress(): NonPayableTransactionObject + + getHypotheticalAccountLiquidity( + account: string, + cTokenModify: string, + redeemTokens: number | string | BN, + borrowAmount: number | string | BN, + ): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + }> + + isComptroller(): NonPayableTransactionObject + + isDeprecated(cToken: string): NonPayableTransactionObject + + lastContributorBlock(arg0: string): NonPayableTransactionObject + + liquidateBorrowAllowed( + cTokenBorrowed: string, + cTokenCollateral: string, + liquidator: string, + borrower: string, + repayAmount: number | string | BN, + ): NonPayableTransactionObject + + liquidateBorrowVerify( + cTokenBorrowed: string, + cTokenCollateral: string, + liquidator: string, + borrower: string, + actualRepayAmount: number | string | BN, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + liquidateCalculateSeizeTokens( + cTokenBorrowed: string, + cTokenCollateral: string, + actualRepayAmount: number | string | BN, + ): NonPayableTransactionObject<{ + 0: string + 1: string + }> + + liquidationIncentiveMantissa(): NonPayableTransactionObject + + markets(arg0: string): NonPayableTransactionObject<{ + isListed: boolean + collateralFactorMantissa: string + isComped: boolean + 0: boolean + 1: string + 2: boolean + }> + + maxAssets(): NonPayableTransactionObject + + mintAllowed( + cToken: string, + minter: string, + mintAmount: number | string | BN, + ): NonPayableTransactionObject + + mintGuardianPaused(arg0: string): NonPayableTransactionObject + + mintVerify( + cToken: string, + minter: string, + actualMintAmount: number | string | BN, + mintTokens: number | string | BN, + ): NonPayableTransactionObject + + oracle(): NonPayableTransactionObject + + pauseGuardian(): NonPayableTransactionObject + + pendingAdmin(): NonPayableTransactionObject + + pendingComptrollerImplementation(): NonPayableTransactionObject + + proposal65FixExecuted(): NonPayableTransactionObject + + redeemAllowed( + cToken: string, + redeemer: string, + redeemTokens: number | string | BN, + ): NonPayableTransactionObject + + redeemVerify( + cToken: string, + redeemer: string, + redeemAmount: number | string | BN, + redeemTokens: number | string | BN, + ): NonPayableTransactionObject + + repayBorrowAllowed( + cToken: string, + payer: string, + borrower: string, + repayAmount: number | string | BN, + ): NonPayableTransactionObject + + repayBorrowVerify( + cToken: string, + payer: string, + borrower: string, + actualRepayAmount: number | string | BN, + borrowerIndex: number | string | BN, + ): NonPayableTransactionObject + + seizeAllowed( + cTokenCollateral: string, + cTokenBorrowed: string, + liquidator: string, + borrower: string, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + seizeGuardianPaused(): NonPayableTransactionObject + + seizeVerify( + cTokenCollateral: string, + cTokenBorrowed: string, + liquidator: string, + borrower: string, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + transferAllowed( + cToken: string, + src: string, + dst: string, + transferTokens: number | string | BN, + ): NonPayableTransactionObject + + transferGuardianPaused(): NonPayableTransactionObject + + transferVerify( + cToken: string, + src: string, + dst: string, + transferTokens: number | string | BN, + ): NonPayableTransactionObject + + updateContributorRewards(contributor: string): NonPayableTransactionObject + } + events: { + 'ActionPaused(string,bool)'(cb?: Callback): EventEmitter + 'ActionPaused(string,bool)'(options?: EventOptions, cb?: Callback): EventEmitter + + 'ActionPaused(address,string,bool)'(cb?: Callback): EventEmitter + 'ActionPaused(address,string,bool)'( + options?: EventOptions, + cb?: Callback, + ): EventEmitter + + CompAccruedAdjusted(cb?: Callback): EventEmitter + CompAccruedAdjusted(options?: EventOptions, cb?: Callback): EventEmitter + + CompBorrowSpeedUpdated(cb?: Callback): EventEmitter + CompBorrowSpeedUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + CompGranted(cb?: Callback): EventEmitter + CompGranted(options?: EventOptions, cb?: Callback): EventEmitter + + CompReceivableUpdated(cb?: Callback): EventEmitter + CompReceivableUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + CompSupplySpeedUpdated(cb?: Callback): EventEmitter + CompSupplySpeedUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + ContributorCompSpeedUpdated(cb?: Callback): EventEmitter + ContributorCompSpeedUpdated(options?: EventOptions, cb?: Callback): EventEmitter + + DistributedBorrowerComp(cb?: Callback): EventEmitter + DistributedBorrowerComp(options?: EventOptions, cb?: Callback): EventEmitter + + DistributedSupplierComp(cb?: Callback): EventEmitter + DistributedSupplierComp(options?: EventOptions, cb?: Callback): EventEmitter + + Failure(cb?: Callback): EventEmitter + Failure(options?: EventOptions, cb?: Callback): EventEmitter + + MarketEntered(cb?: Callback): EventEmitter + MarketEntered(options?: EventOptions, cb?: Callback): EventEmitter + + MarketExited(cb?: Callback): EventEmitter + MarketExited(options?: EventOptions, cb?: Callback): EventEmitter + + MarketListed(cb?: Callback): EventEmitter + MarketListed(options?: EventOptions, cb?: Callback): EventEmitter + + NewBorrowCap(cb?: Callback): EventEmitter + NewBorrowCap(options?: EventOptions, cb?: Callback): EventEmitter + + NewBorrowCapGuardian(cb?: Callback): EventEmitter + NewBorrowCapGuardian(options?: EventOptions, cb?: Callback): EventEmitter + + NewCloseFactor(cb?: Callback): EventEmitter + NewCloseFactor(options?: EventOptions, cb?: Callback): EventEmitter + + NewCollateralFactor(cb?: Callback): EventEmitter + NewCollateralFactor(options?: EventOptions, cb?: Callback): EventEmitter + + NewLiquidationIncentive(cb?: Callback): EventEmitter + NewLiquidationIncentive(options?: EventOptions, cb?: Callback): EventEmitter + + NewPauseGuardian(cb?: Callback): EventEmitter + NewPauseGuardian(options?: EventOptions, cb?: Callback): EventEmitter + + NewPriceOracle(cb?: Callback): EventEmitter + NewPriceOracle(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'CompAccruedAdjusted', cb: Callback): void + once(event: 'CompAccruedAdjusted', options: EventOptions, cb: Callback): void + + once(event: 'CompBorrowSpeedUpdated', cb: Callback): void + once(event: 'CompBorrowSpeedUpdated', options: EventOptions, cb: Callback): void + + once(event: 'CompGranted', cb: Callback): void + once(event: 'CompGranted', options: EventOptions, cb: Callback): void + + once(event: 'CompReceivableUpdated', cb: Callback): void + once(event: 'CompReceivableUpdated', options: EventOptions, cb: Callback): void + + once(event: 'CompSupplySpeedUpdated', cb: Callback): void + once(event: 'CompSupplySpeedUpdated', options: EventOptions, cb: Callback): void + + once(event: 'ContributorCompSpeedUpdated', cb: Callback): void + once(event: 'ContributorCompSpeedUpdated', options: EventOptions, cb: Callback): void + + once(event: 'DistributedBorrowerComp', cb: Callback): void + once(event: 'DistributedBorrowerComp', options: EventOptions, cb: Callback): void + + once(event: 'DistributedSupplierComp', cb: Callback): void + once(event: 'DistributedSupplierComp', options: EventOptions, cb: Callback): void + + once(event: 'Failure', cb: Callback): void + once(event: 'Failure', options: EventOptions, cb: Callback): void + + once(event: 'MarketEntered', cb: Callback): void + once(event: 'MarketEntered', options: EventOptions, cb: Callback): void + + once(event: 'MarketExited', cb: Callback): void + once(event: 'MarketExited', options: EventOptions, cb: Callback): void + + once(event: 'MarketListed', cb: Callback): void + once(event: 'MarketListed', options: EventOptions, cb: Callback): void + + once(event: 'NewBorrowCap', cb: Callback): void + once(event: 'NewBorrowCap', options: EventOptions, cb: Callback): void + + once(event: 'NewBorrowCapGuardian', cb: Callback): void + once(event: 'NewBorrowCapGuardian', options: EventOptions, cb: Callback): void + + once(event: 'NewCloseFactor', cb: Callback): void + once(event: 'NewCloseFactor', options: EventOptions, cb: Callback): void + + once(event: 'NewCollateralFactor', cb: Callback): void + once(event: 'NewCollateralFactor', options: EventOptions, cb: Callback): void + + once(event: 'NewLiquidationIncentive', cb: Callback): void + once(event: 'NewLiquidationIncentive', options: EventOptions, cb: Callback): void + + once(event: 'NewPauseGuardian', cb: Callback): void + once(event: 'NewPauseGuardian', options: EventOptions, cb: Callback): void + + once(event: 'NewPriceOracle', cb: Callback): void + once(event: 'NewPriceOracle', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/QiAvax.d.ts b/packages/web3-contracts/types/QiAvax.d.ts new file mode 100644 index 000000000000..bdd7d6d4aedc --- /dev/null +++ b/packages/web3-contracts/types/QiAvax.d.ts @@ -0,0 +1,382 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type AccrueInterest = ContractEventLog<{ + cashPrior: string + interestAccumulated: string + borrowIndex: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string +}> +export type Approval = ContractEventLog<{ + owner: string + spender: string + amount: string + 0: string + 1: string + 2: string +}> +export type Borrow = ContractEventLog<{ + borrower: string + borrowAmount: string + accountBorrows: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string +}> +export type Failure = ContractEventLog<{ + error: string + info: string + detail: string + 0: string + 1: string + 2: string +}> +export type LiquidateBorrow = ContractEventLog<{ + liquidator: string + borrower: string + repayAmount: string + qiTokenCollateral: string + seizeTokens: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type Mint = ContractEventLog<{ + minter: string + mintAmount: string + mintTokens: string + 0: string + 1: string + 2: string +}> +export type NewAdmin = ContractEventLog<{ + oldAdmin: string + newAdmin: string + 0: string + 1: string +}> +export type NewComptroller = ContractEventLog<{ + oldComptroller: string + newComptroller: string + 0: string + 1: string +}> +export type NewMarketInterestRateModel = ContractEventLog<{ + oldInterestRateModel: string + newInterestRateModel: string + 0: string + 1: string +}> +export type NewPendingAdmin = ContractEventLog<{ + oldPendingAdmin: string + newPendingAdmin: string + 0: string + 1: string +}> +export type NewProtocolSeizeShare = ContractEventLog<{ + oldProtocolSeizeShareMantissa: string + newProtocolSeizeShareMantissa: string + 0: string + 1: string +}> +export type NewReserveFactor = ContractEventLog<{ + oldReserveFactorMantissa: string + newReserveFactorMantissa: string + 0: string + 1: string +}> +export type Redeem = ContractEventLog<{ + redeemer: string + redeemAmount: string + redeemTokens: string + 0: string + 1: string + 2: string +}> +export type RepayBorrow = ContractEventLog<{ + payer: string + borrower: string + repayAmount: string + accountBorrows: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type ReservesAdded = ContractEventLog<{ + benefactor: string + addAmount: string + newTotalReserves: string + 0: string + 1: string + 2: string +}> +export type ReservesReduced = ContractEventLog<{ + admin: string + reduceAmount: string + newTotalReserves: string + 0: string + 1: string + 2: string +}> +export type Transfer = ContractEventLog<{ + from: string + to: string + amount: string + 0: string + 1: string + 2: string +}> + +export interface QiAvax extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): QiAvax + clone(): QiAvax + methods: { + _acceptAdmin(): NonPayableTransactionObject + + _addReserves(): PayableTransactionObject + + _reduceReserves(reduceAmount: number | string | BN): NonPayableTransactionObject + + _setComptroller(newComptroller: string): NonPayableTransactionObject + + _setInterestRateModel(newInterestRateModel: string): NonPayableTransactionObject + + _setPendingAdmin(newPendingAdmin: string): NonPayableTransactionObject + + _setProtocolSeizeShare(newProtocolSeizeShareMantissa: number | string | BN): NonPayableTransactionObject + + _setReserveFactor(newReserveFactorMantissa: number | string | BN): NonPayableTransactionObject + + accrualBlockTimestamp(): NonPayableTransactionObject + + accrueInterest(): NonPayableTransactionObject + + admin(): NonPayableTransactionObject + + allowance(owner: string, spender: string): NonPayableTransactionObject + + approve(spender: string, amount: number | string | BN): NonPayableTransactionObject + + balanceOf(owner: string): NonPayableTransactionObject + + balanceOfUnderlying(owner: string): NonPayableTransactionObject + + borrow(borrowAmount: number | string | BN): NonPayableTransactionObject + + borrowBalanceCurrent(account: string): NonPayableTransactionObject + + borrowBalanceStored(account: string): NonPayableTransactionObject + + borrowIndex(): NonPayableTransactionObject + + borrowRatePerTimestamp(): NonPayableTransactionObject + + comptroller(): NonPayableTransactionObject + + decimals(): NonPayableTransactionObject + + exchangeRateCurrent(): NonPayableTransactionObject + + exchangeRateStored(): NonPayableTransactionObject + + getAccountSnapshot(account: string): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + 3: string + }> + + getCash(): NonPayableTransactionObject + + initialize( + comptroller_: string, + interestRateModel_: string, + initialExchangeRateMantissa_: number | string | BN, + name_: string, + symbol_: string, + decimals_: number | string | BN, + ): NonPayableTransactionObject + + interestRateModel(): NonPayableTransactionObject + + isQiToken(): NonPayableTransactionObject + + liquidateBorrow(borrower: string, qiTokenCollateral: string): PayableTransactionObject + + mint(): PayableTransactionObject + + name(): NonPayableTransactionObject + + pendingAdmin(): NonPayableTransactionObject + + protocolSeizeShareMantissa(): NonPayableTransactionObject + + redeem(redeemTokens: number | string | BN): NonPayableTransactionObject + + redeemUnderlying(redeemAmount: number | string | BN): NonPayableTransactionObject + + repayBorrow(): PayableTransactionObject + + repayBorrowBehalf(borrower: string): PayableTransactionObject + + reserveFactorMantissa(): NonPayableTransactionObject + + seize( + liquidator: string, + borrower: string, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + supplyRatePerTimestamp(): NonPayableTransactionObject + + symbol(): NonPayableTransactionObject + + totalBorrows(): NonPayableTransactionObject + + totalBorrowsCurrent(): NonPayableTransactionObject + + totalReserves(): NonPayableTransactionObject + + totalSupply(): NonPayableTransactionObject + + transfer(dst: string, amount: number | string | BN): NonPayableTransactionObject + + transferFrom(src: string, dst: string, amount: number | string | BN): NonPayableTransactionObject + } + events: { + AccrueInterest(cb?: Callback): EventEmitter + AccrueInterest(options?: EventOptions, cb?: Callback): EventEmitter + + Approval(cb?: Callback): EventEmitter + Approval(options?: EventOptions, cb?: Callback): EventEmitter + + Borrow(cb?: Callback): EventEmitter + Borrow(options?: EventOptions, cb?: Callback): EventEmitter + + Failure(cb?: Callback): EventEmitter + Failure(options?: EventOptions, cb?: Callback): EventEmitter + + LiquidateBorrow(cb?: Callback): EventEmitter + LiquidateBorrow(options?: EventOptions, cb?: Callback): EventEmitter + + Mint(cb?: Callback): EventEmitter + Mint(options?: EventOptions, cb?: Callback): EventEmitter + + NewAdmin(cb?: Callback): EventEmitter + NewAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + NewComptroller(cb?: Callback): EventEmitter + NewComptroller(options?: EventOptions, cb?: Callback): EventEmitter + + NewMarketInterestRateModel(cb?: Callback): EventEmitter + NewMarketInterestRateModel(options?: EventOptions, cb?: Callback): EventEmitter + + NewPendingAdmin(cb?: Callback): EventEmitter + NewPendingAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + NewProtocolSeizeShare(cb?: Callback): EventEmitter + NewProtocolSeizeShare(options?: EventOptions, cb?: Callback): EventEmitter + + NewReserveFactor(cb?: Callback): EventEmitter + NewReserveFactor(options?: EventOptions, cb?: Callback): EventEmitter + + Redeem(cb?: Callback): EventEmitter + Redeem(options?: EventOptions, cb?: Callback): EventEmitter + + RepayBorrow(cb?: Callback): EventEmitter + RepayBorrow(options?: EventOptions, cb?: Callback): EventEmitter + + ReservesAdded(cb?: Callback): EventEmitter + ReservesAdded(options?: EventOptions, cb?: Callback): EventEmitter + + ReservesReduced(cb?: Callback): EventEmitter + ReservesReduced(options?: EventOptions, cb?: Callback): EventEmitter + + Transfer(cb?: Callback): EventEmitter + Transfer(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'AccrueInterest', cb: Callback): void + once(event: 'AccrueInterest', options: EventOptions, cb: Callback): void + + once(event: 'Approval', cb: Callback): void + once(event: 'Approval', options: EventOptions, cb: Callback): void + + once(event: 'Borrow', cb: Callback): void + once(event: 'Borrow', options: EventOptions, cb: Callback): void + + once(event: 'Failure', cb: Callback): void + once(event: 'Failure', options: EventOptions, cb: Callback): void + + once(event: 'LiquidateBorrow', cb: Callback): void + once(event: 'LiquidateBorrow', options: EventOptions, cb: Callback): void + + once(event: 'Mint', cb: Callback): void + once(event: 'Mint', options: EventOptions, cb: Callback): void + + once(event: 'NewAdmin', cb: Callback): void + once(event: 'NewAdmin', options: EventOptions, cb: Callback): void + + once(event: 'NewComptroller', cb: Callback): void + once(event: 'NewComptroller', options: EventOptions, cb: Callback): void + + once(event: 'NewMarketInterestRateModel', cb: Callback): void + once(event: 'NewMarketInterestRateModel', options: EventOptions, cb: Callback): void + + once(event: 'NewPendingAdmin', cb: Callback): void + once(event: 'NewPendingAdmin', options: EventOptions, cb: Callback): void + + once(event: 'NewProtocolSeizeShare', cb: Callback): void + once(event: 'NewProtocolSeizeShare', options: EventOptions, cb: Callback): void + + once(event: 'NewReserveFactor', cb: Callback): void + once(event: 'NewReserveFactor', options: EventOptions, cb: Callback): void + + once(event: 'Redeem', cb: Callback): void + once(event: 'Redeem', options: EventOptions, cb: Callback): void + + once(event: 'RepayBorrow', cb: Callback): void + once(event: 'RepayBorrow', options: EventOptions, cb: Callback): void + + once(event: 'ReservesAdded', cb: Callback): void + once(event: 'ReservesAdded', options: EventOptions, cb: Callback): void + + once(event: 'ReservesReduced', cb: Callback): void + once(event: 'ReservesReduced', options: EventOptions, cb: Callback): void + + once(event: 'Transfer', cb: Callback): void + once(event: 'Transfer', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/QiERC20.d.ts b/packages/web3-contracts/types/QiERC20.d.ts new file mode 100644 index 000000000000..cf41f4734f5f --- /dev/null +++ b/packages/web3-contracts/types/QiERC20.d.ts @@ -0,0 +1,405 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type AccrueInterest = ContractEventLog<{ + cashPrior: string + interestAccumulated: string + borrowIndex: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string +}> +export type Approval = ContractEventLog<{ + owner: string + spender: string + amount: string + 0: string + 1: string + 2: string +}> +export type Borrow = ContractEventLog<{ + borrower: string + borrowAmount: string + accountBorrows: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string +}> +export type Failure = ContractEventLog<{ + error: string + info: string + detail: string + 0: string + 1: string + 2: string +}> +export type LiquidateBorrow = ContractEventLog<{ + liquidator: string + borrower: string + repayAmount: string + qiTokenCollateral: string + seizeTokens: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type Mint = ContractEventLog<{ + minter: string + mintAmount: string + mintTokens: string + 0: string + 1: string + 2: string +}> +export type NewAdmin = ContractEventLog<{ + oldAdmin: string + newAdmin: string + 0: string + 1: string +}> +export type NewComptroller = ContractEventLog<{ + oldComptroller: string + newComptroller: string + 0: string + 1: string +}> +export type NewImplementation = ContractEventLog<{ + oldImplementation: string + newImplementation: string + 0: string + 1: string +}> +export type NewMarketInterestRateModel = ContractEventLog<{ + oldInterestRateModel: string + newInterestRateModel: string + 0: string + 1: string +}> +export type NewPendingAdmin = ContractEventLog<{ + oldPendingAdmin: string + newPendingAdmin: string + 0: string + 1: string +}> +export type NewProtocolSeizeShare = ContractEventLog<{ + oldProtocolSeizeShareMantissa: string + newProtocolSeizeShareMantissa: string + 0: string + 1: string +}> +export type NewReserveFactor = ContractEventLog<{ + oldReserveFactorMantissa: string + newReserveFactorMantissa: string + 0: string + 1: string +}> +export type Redeem = ContractEventLog<{ + redeemer: string + redeemAmount: string + redeemTokens: string + 0: string + 1: string + 2: string +}> +export type RepayBorrow = ContractEventLog<{ + payer: string + borrower: string + repayAmount: string + accountBorrows: string + totalBorrows: string + 0: string + 1: string + 2: string + 3: string + 4: string +}> +export type ReservesAdded = ContractEventLog<{ + benefactor: string + addAmount: string + newTotalReserves: string + 0: string + 1: string + 2: string +}> +export type ReservesReduced = ContractEventLog<{ + admin: string + reduceAmount: string + newTotalReserves: string + 0: string + 1: string + 2: string +}> +export type Transfer = ContractEventLog<{ + from: string + to: string + amount: string + 0: string + 1: string + 2: string +}> + +export interface QiERC20 extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): QiERC20 + clone(): QiERC20 + methods: { + _acceptAdmin(): NonPayableTransactionObject + + _addReserves(addAmount: number | string | BN): NonPayableTransactionObject + + _reduceReserves(reduceAmount: number | string | BN): NonPayableTransactionObject + + _setComptroller(newComptroller: string): NonPayableTransactionObject + + _setImplementation( + implementation_: string, + allowResign: boolean, + becomeImplementationData: string | number[], + ): NonPayableTransactionObject + + _setInterestRateModel(newInterestRateModel: string): NonPayableTransactionObject + + _setPendingAdmin(newPendingAdmin: string): NonPayableTransactionObject + + _setProtocolSeizeShare(newProtocolSeizeShareMantissa: number | string | BN): NonPayableTransactionObject + + _setReserveFactor(newReserveFactorMantissa: number | string | BN): NonPayableTransactionObject + + accrualBlockTimestamp(): NonPayableTransactionObject + + accrueInterest(): NonPayableTransactionObject + + admin(): NonPayableTransactionObject + + allowance(owner: string, spender: string): NonPayableTransactionObject + + approve(spender: string, amount: number | string | BN): NonPayableTransactionObject + + balanceOf(owner: string): NonPayableTransactionObject + + balanceOfUnderlying(owner: string): NonPayableTransactionObject + + borrow(borrowAmount: number | string | BN): NonPayableTransactionObject + + borrowBalanceCurrent(account: string): NonPayableTransactionObject + + borrowBalanceStored(account: string): NonPayableTransactionObject + + borrowIndex(): NonPayableTransactionObject + + borrowRatePerTimestamp(): NonPayableTransactionObject + + comptroller(): NonPayableTransactionObject + + decimals(): NonPayableTransactionObject + + delegateToImplementation(data: string | number[]): NonPayableTransactionObject + + delegateToViewImplementation(data: string | number[]): NonPayableTransactionObject + + exchangeRateCurrent(): NonPayableTransactionObject + + exchangeRateStored(): NonPayableTransactionObject + + getAccountSnapshot(account: string): NonPayableTransactionObject<{ + 0: string + 1: string + 2: string + 3: string + }> + + getCash(): NonPayableTransactionObject + + implementation(): NonPayableTransactionObject + + interestRateModel(): NonPayableTransactionObject + + isQiToken(): NonPayableTransactionObject + + liquidateBorrow( + borrower: string, + repayAmount: number | string | BN, + qiTokenCollateral: string, + ): NonPayableTransactionObject + + mint(mintAmount: number | string | BN): NonPayableTransactionObject + + name(): NonPayableTransactionObject + + pendingAdmin(): NonPayableTransactionObject + + protocolSeizeShareMantissa(): NonPayableTransactionObject + + redeem(redeemTokens: number | string | BN): NonPayableTransactionObject + + redeemUnderlying(redeemAmount: number | string | BN): NonPayableTransactionObject + + repayBorrow(repayAmount: number | string | BN): NonPayableTransactionObject + + repayBorrowBehalf(borrower: string, repayAmount: number | string | BN): NonPayableTransactionObject + + reserveFactorMantissa(): NonPayableTransactionObject + + seize( + liquidator: string, + borrower: string, + seizeTokens: number | string | BN, + ): NonPayableTransactionObject + + supplyRatePerTimestamp(): NonPayableTransactionObject + + sweepToken(token: string): NonPayableTransactionObject + + symbol(): NonPayableTransactionObject + + totalBorrows(): NonPayableTransactionObject + + totalBorrowsCurrent(): NonPayableTransactionObject + + totalReserves(): NonPayableTransactionObject + + totalSupply(): NonPayableTransactionObject + + transfer(dst: string, amount: number | string | BN): NonPayableTransactionObject + + transferFrom(src: string, dst: string, amount: number | string | BN): NonPayableTransactionObject + + underlying(): NonPayableTransactionObject + } + events: { + AccrueInterest(cb?: Callback): EventEmitter + AccrueInterest(options?: EventOptions, cb?: Callback): EventEmitter + + Approval(cb?: Callback): EventEmitter + Approval(options?: EventOptions, cb?: Callback): EventEmitter + + Borrow(cb?: Callback): EventEmitter + Borrow(options?: EventOptions, cb?: Callback): EventEmitter + + Failure(cb?: Callback): EventEmitter + Failure(options?: EventOptions, cb?: Callback): EventEmitter + + LiquidateBorrow(cb?: Callback): EventEmitter + LiquidateBorrow(options?: EventOptions, cb?: Callback): EventEmitter + + Mint(cb?: Callback): EventEmitter + Mint(options?: EventOptions, cb?: Callback): EventEmitter + + NewAdmin(cb?: Callback): EventEmitter + NewAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + NewComptroller(cb?: Callback): EventEmitter + NewComptroller(options?: EventOptions, cb?: Callback): EventEmitter + + NewImplementation(cb?: Callback): EventEmitter + NewImplementation(options?: EventOptions, cb?: Callback): EventEmitter + + NewMarketInterestRateModel(cb?: Callback): EventEmitter + NewMarketInterestRateModel(options?: EventOptions, cb?: Callback): EventEmitter + + NewPendingAdmin(cb?: Callback): EventEmitter + NewPendingAdmin(options?: EventOptions, cb?: Callback): EventEmitter + + NewProtocolSeizeShare(cb?: Callback): EventEmitter + NewProtocolSeizeShare(options?: EventOptions, cb?: Callback): EventEmitter + + NewReserveFactor(cb?: Callback): EventEmitter + NewReserveFactor(options?: EventOptions, cb?: Callback): EventEmitter + + Redeem(cb?: Callback): EventEmitter + Redeem(options?: EventOptions, cb?: Callback): EventEmitter + + RepayBorrow(cb?: Callback): EventEmitter + RepayBorrow(options?: EventOptions, cb?: Callback): EventEmitter + + ReservesAdded(cb?: Callback): EventEmitter + ReservesAdded(options?: EventOptions, cb?: Callback): EventEmitter + + ReservesReduced(cb?: Callback): EventEmitter + ReservesReduced(options?: EventOptions, cb?: Callback): EventEmitter + + Transfer(cb?: Callback): EventEmitter + Transfer(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'AccrueInterest', cb: Callback): void + once(event: 'AccrueInterest', options: EventOptions, cb: Callback): void + + once(event: 'Approval', cb: Callback): void + once(event: 'Approval', options: EventOptions, cb: Callback): void + + once(event: 'Borrow', cb: Callback): void + once(event: 'Borrow', options: EventOptions, cb: Callback): void + + once(event: 'Failure', cb: Callback): void + once(event: 'Failure', options: EventOptions, cb: Callback): void + + once(event: 'LiquidateBorrow', cb: Callback): void + once(event: 'LiquidateBorrow', options: EventOptions, cb: Callback): void + + once(event: 'Mint', cb: Callback): void + once(event: 'Mint', options: EventOptions, cb: Callback): void + + once(event: 'NewAdmin', cb: Callback): void + once(event: 'NewAdmin', options: EventOptions, cb: Callback): void + + once(event: 'NewComptroller', cb: Callback): void + once(event: 'NewComptroller', options: EventOptions, cb: Callback): void + + once(event: 'NewImplementation', cb: Callback): void + once(event: 'NewImplementation', options: EventOptions, cb: Callback): void + + once(event: 'NewMarketInterestRateModel', cb: Callback): void + once(event: 'NewMarketInterestRateModel', options: EventOptions, cb: Callback): void + + once(event: 'NewPendingAdmin', cb: Callback): void + once(event: 'NewPendingAdmin', options: EventOptions, cb: Callback): void + + once(event: 'NewProtocolSeizeShare', cb: Callback): void + once(event: 'NewProtocolSeizeShare', options: EventOptions, cb: Callback): void + + once(event: 'NewReserveFactor', cb: Callback): void + once(event: 'NewReserveFactor', options: EventOptions, cb: Callback): void + + once(event: 'Redeem', cb: Callback): void + once(event: 'Redeem', options: EventOptions, cb: Callback): void + + once(event: 'RepayBorrow', cb: Callback): void + once(event: 'RepayBorrow', options: EventOptions, cb: Callback): void + + once(event: 'ReservesAdded', cb: Callback): void + once(event: 'ReservesAdded', options: EventOptions, cb: Callback): void + + once(event: 'ReservesReduced', cb: Callback): void + once(event: 'ReservesReduced', options: EventOptions, cb: Callback): void + + once(event: 'Transfer', cb: Callback): void + once(event: 'Transfer', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-contracts/types/TranquilPriceOracleV2.d.ts b/packages/web3-contracts/types/TranquilPriceOracleV2.d.ts new file mode 100644 index 000000000000..3c2f6c4aae16 --- /dev/null +++ b/packages/web3-contracts/types/TranquilPriceOracleV2.d.ts @@ -0,0 +1,74 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from 'bn.js' +import { ContractOptions } from 'web3-eth-contract' +import { EventLog } from 'web3-core' +import { EventEmitter } from 'events' +import { + Callback, + PayableTransactionObject, + NonPayableTransactionObject, + BlockType, + ContractEventLog, + BaseContract, +} from './types' + +interface EventOptions { + filter?: object + fromBlock?: BlockType + topics?: string[] +} + +export type OwnershipTransferred = ContractEventLog<{ + previousOwner: string + newOwner: string + 0: string + 1: string +}> + +export interface TranquilPriceOracleV2 extends BaseContract { + constructor(jsonInterface: any[], address?: string, options?: ContractOptions): TranquilPriceOracleV2 + clone(): TranquilPriceOracleV2 + methods: { + WONE_ADDRESS(): NonPayableTransactionObject + + chainlinkOracle(): NonPayableTransactionObject + + fallbackOracle(): NonPayableTransactionObject + + isPriceOracle(): NonPayableTransactionObject + + owner(): NonPayableTransactionObject + + renounceOwnership(): NonPayableTransactionObject + + specialTokenOracles(arg0: string): NonPayableTransactionObject + + transferOwnership(newOwner: string): NonPayableTransactionObject + + uniswapOracle(): NonPayableTransactionObject + + setSpecialTokenOracle(_token: string, _specialTokenOracle: string): NonPayableTransactionObject + + setChainlinkOracle(_chainlinkOracle: string): NonPayableTransactionObject + + setUniswapOracle(_uniswapOracle: string): NonPayableTransactionObject + + setFallbackOracle(_fallbackOracle: string): NonPayableTransactionObject + + getUnderlyingPrice(tqToken: string): NonPayableTransactionObject + + getPrice(token: string): NonPayableTransactionObject + } + events: { + OwnershipTransferred(cb?: Callback): EventEmitter + OwnershipTransferred(options?: EventOptions, cb?: Callback): EventEmitter + + allEvents(options?: EventOptions, cb?: Callback): EventEmitter + } + + once(event: 'OwnershipTransferred', cb: Callback): void + once(event: 'OwnershipTransferred', options: EventOptions, cb: Callback): void +} diff --git a/packages/web3-shared/evm/constants/constants.ts b/packages/web3-shared/evm/constants/constants.ts index f96125e1f100..10683e99c5a3 100644 --- a/packages/web3-shared/evm/constants/constants.ts +++ b/packages/web3-shared/evm/constants/constants.ts @@ -25,6 +25,13 @@ import CryptoArtAI from '@masknet/web3-constants/evm/cryptoartai.json' import ArtBlocks from '@masknet/web3-constants/evm/artblocks.json' import Aave from '@masknet/web3-constants/evm/aave.json' import Lido from '@masknet/web3-constants/evm/lido.json' +import BenQi from '@masknet/web3-constants/evm/benqi.json' +import Aurigami from '@masknet/web3-constants/evm/aurigami.json' +import Tranquil from '@masknet/web3-constants/evm/tranquil.json' +import Compound from '@masknet/web3-constants/evm/compound.json' +import Moola from '@masknet/web3-constants/evm/moola.json' +import Giest from '@masknet/web3-constants/evm/giest.json' +import Alpaca from '@masknet/web3-constants/evm/alpaca.json' import { hookTransform, transform, transformFromJSON } from '@masknet/web3-shared-base' import { ChainId } from '../types' @@ -119,3 +126,24 @@ export const useAaveConstants = hookTransform(getAaveConstants) export const getLidoConstants = transform(ChainId, Lido) export const useLidoConstants = hookTransform(getLidoConstants) + +export const getBenQiConstants = transform(ChainId, BenQi) +export const useBenQiConstants = hookTransform(getBenQiConstants) + +export const getAurigamiConstants = transform(ChainId, Aurigami) +export const useAurigamiConstants = hookTransform(getAurigamiConstants) + +export const getTranquilConstants = transform(ChainId, Tranquil) +export const useTranquilConstants = hookTransform(getTranquilConstants) + +export const getCompoundConstants = transform(ChainId, Compound) +export const useCompoundConstants = hookTransform(getCompoundConstants) + +export const getMoolaConstants = transform(ChainId, Moola) +export const useMoolaConstants = hookTransform(getMoolaConstants) + +export const getGiestConstants = transform(ChainId, Giest) +export const useGiestConstants = hookTransform(getGiestConstants) + +export const getAlpacaConstants = transform(ChainId, Alpaca) +export const useAlpacaConstants = hookTransform(getAlpacaConstants)