diff --git a/cspell.json b/cspell.json index aad883a441e1..a1393a5a570e 100644 --- a/cspell.json +++ b/cspell.json @@ -26,7 +26,13 @@ "areth", "artblocks", "arweave", + "auri", + "aurigami", + "avalanche", "avax", + "bech", + "benqi", + "betanet", "bgcolor", "bignumber", "bips", @@ -41,6 +47,10 @@ "canonify", "cashtag", "cbridge", + "celer", + "celo", + "cerc20", + "chainlink", "checksummed", "choudhary", "cipherparams", @@ -49,6 +59,10 @@ "codegen", "commentid", "composertitlebar", + "compoundfinance", + "consolas", + "contenteditable", + "contrib", "contribs", "cooldown", "corepack", @@ -76,6 +90,10 @@ "formating", "fullfilled", "furucombo", + "futuna", + "gasnow", + "geckoview", + "giest", "gltf", "goodghosting", "gundb", @@ -145,6 +163,7 @@ "proxied", "pushstate", "pvtsutils", + "qied", "qrcode", "quickswap", "radisk", @@ -169,6 +188,9 @@ "steganographic", "steganography", "stego", + "stnear", + "strat", + "strats", "subrepo", "sushiswap", "swappable", @@ -180,6 +202,7 @@ "tokenid", "topbar", "traderjoe", + "tranq", "transak", "trisolaris", "twimg", @@ -188,6 +211,7 @@ "typehash", "typeson", "unencrypted", + "unitroller", "unreviewed", "unstake", "unstyled", @@ -204,8 +228,13 @@ "wavax", "webextension", "webm", + "webp", + "wftm", "withdrawed", "wmatic", + "wnative", + "wnear", + "wone", "xdai", "xlarge", "zerion", diff --git a/packages/mask/shared-ui/locales/zh-CN.json b/packages/mask/shared-ui/locales/zh-CN.json index ec05be1dc0f7..15ce168d21ab 100644 --- a/packages/mask/shared-ui/locales/zh-CN.json +++ b/packages/mask/shared-ui/locales/zh-CN.json @@ -395,6 +395,7 @@ "plugin_trader_data_source": "数据源", "plugin_trader_price_updated": "价格已更新", "plugin_savings": "储蓄", + "plugin_savings_asset": "资产", "plugin_savings_wallet": "钱包", "plugin_savings_operation": "操作", "plugin_savings_amount": "数额", diff --git a/packages/mask/src/plugins/EVM/constants.ts b/packages/mask/src/plugins/EVM/constants.ts index 69a6e0b9523c..f249828937ca 100644 --- a/packages/mask/src/plugins/EVM/constants.ts +++ b/packages/mask/src/plugins/EVM/constants.ts @@ -133,7 +133,7 @@ export const PLUGIN_NETWORKS: Web3Plugin.NetworkDescriptor[] = [ name: 'Celo', icon: new URL('./assets/celo.png', import.meta.url), iconColor: 'rgb(53, 208, 127)', - isMainnet: false, + isMainnet: true, }, { ID: `${PLUGIN_ID}_fantom`, 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 86eadc23d02e..6ccd438d633c 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialog.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialog.tsx @@ -1,20 +1,9 @@ import { useMemo, useState } from 'react' import { useAsync, useUpdateEffect } from 'react-use' -import { DialogContent } from '@mui/material' +import { DialogContent, CircularProgress } from '@mui/material' import { isDashboardPage, EMPTY_LIST } from '@masknet/shared-base' import { FolderTabPanel, FolderTabs } from '@masknet/theme' -import { - createContract, - ChainId, - FungibleTokenDetailed, - getChainIdFromNetworkType, - useChainId, - useWeb3, - EthereumTokenType, - useFungibleTokensDetailed, - getAaveConstants, - ZERO_ADDRESS, -} from '@masknet/web3-shared-evm' +import { ChainId, getChainIdFromNetworkType, useChainId, useWeb3 } from '@masknet/web3-shared-evm' import { useI18N } from '../../../utils' import { InjectedDialog } from '@masknet/shared' import { WalletStatusBox } from '../../../components/shared/WalletStatusBox' @@ -26,13 +15,8 @@ import { SavingsProtocol, TabType } from '../types' import { useStyles } from './SavingsDialogStyles' import { SavingsTable } from './SavingsTable' import { SavingsForm } 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 { SavingsProtocols, LazyProtocolsResolvers } from '../protocols' +import { flatten } from 'lodash-unified' export interface SavingsDialogProps { open: boolean @@ -56,44 +40,22 @@ export function SavingsDialog({ open, onClose }: SavingsDialogProps) { return networks.map((network) => getChainIdFromNetworkType(network)) }, []) - const { value: aaveTokens } = useAsync(async () => { - if (chainId !== ChainId.Mainnet) { - return [] + 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)), + ) + return flatten(allResults) + } catch (error) { + console.error('lazyProtocols: resolve error', error) } - - 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]] - }) + return [] }, [web3, chainId]) - const { value: detailedAaveTokens } = useFungibleTokensDetailed( - compact(flatten(aaveTokens ?? [])).map((m) => { - return { address: m, type: EthereumTokenType.ERC20 } - }) ?? [], - 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 [FungibleTokenDetailed, FungibleTokenDetailed]), - ), - ], - [chainId, detailedAaveTokens, tab], - ) + const protocols = useMemo(() => { + return [...SavingsProtocols, ...(lazyProtocols ?? [])].filter((x) => x.bareToken.chainId === chainId) + }, [chainId, lazyProtocols]) useUpdateEffect(() => { setChainId(currentChainId) @@ -134,22 +96,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 8b13fe54e7b3..3fc048768172 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialogStyles.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsDialogStyles.tsx @@ -48,4 +48,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 d54655305633..f54dd03a4ca9 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsForm.tsx @@ -3,15 +3,12 @@ import { Typography } from '@mui/material' import { useCallback, useEffect, useMemo, useState } from 'react' import { useAsync, useAsyncFn } from 'react-use' import { unreachable } from '@dimensiondev/kit' -import { isLessThan, rightShift } from '@masknet/web3-shared-base' +import { isGreaterThan, isLessThan, rightShift, ZERO } from '@masknet/web3-shared-base' import { - createContract, createERC20Token, - createLookupTableResolver, EthereumTokenType, formatBalance, formatCurrency, - getAaveConstants, isSameAddress, TransactionState, TransactionStateType, @@ -19,7 +16,6 @@ import { useFungibleTokenBalance, useTokenConstants, useWeb3, - ZERO_ADDRESS, } from '@masknet/web3-shared-evm' import { FormattedCurrency, LoadingAnimation, TokenAmountPanel, TokenIcon } from '@masknet/shared' import { useRemoteControlledDialog } from '@masknet/shared-base-ui' @@ -33,13 +29,11 @@ import { ActionButtonPromise } from '../../../extension/options-page/DashboardCo import { PluginTraderMessages } from '../../Trader/messages' import type { Coin } from '../../Trader/types' import { EthereumERC20TokenApprovedBoundary } from '../../../web3/UI/EthereumERC20TokenApprovedBoundary' -import type { AaveLendingPoolAddressProvider } from '@masknet/web3-contracts/types/AaveLendingPoolAddressProvider' -import AaveLendingPoolAddressProviderABI from '@masknet/web3-contracts/abis/AaveLendingPoolAddressProvider.json' -import type { AbiItem } from 'web3-utils' import { WalletMessages } from '../../Wallet/messages' import { isTwitter } from '../../../social-network-adaptor/twitter.com/base' import { activatedSocialNetworkUI } from '../../../social-network' import { isFacebook } from '../../../social-network-adaptor/facebook.com/base' +import { AllProtocolInfos } from '../info' export interface SavingsFormProps { chainId: number @@ -48,14 +42,6 @@ export interface SavingsFormProps { onClose?: () => void } -export const resolveProtocolName = createLookupTableResolver( - { - [ProtocolType.Lido]: 'Lido', - [ProtocolType.AAVE]: 'AAVE', - }, - 'unknown', -) - export function SavingsForm({ chainId, protocol, tab, onClose }: SavingsFormProps) { const { t } = useI18N() const { classes } = useStyles() @@ -64,12 +50,10 @@ export function SavingsForm({ chainId, protocol, tab, onClose }: SavingsFormProp const account = useAccount() const { NATIVE_TOKEN_ADDRESS } = useTokenConstants() const [inputAmount, setInputAmount] = useState('') - const [estimatedGas, setEstimatedGas] = useState(new BigNumber('0')) + const [estimatedGas, setEstimatedGas] = useState(ZERO) const [tradeState, setTradeState] = useState({ type: TransactionStateType.UNKNOWN, }) - const [open, setOpen] = useState(false) - const { value: nativeTokenBalance } = useFungibleTokenBalance(EthereumTokenType.Native, '', chainId) const { setDialog: openSwapDialog } = useRemoteControlledDialog(PluginTraderMessages.swapDialogUpdated) @@ -108,7 +92,7 @@ export function SavingsForm({ chainId, protocol, tab, onClose }: SavingsFormProp ) const { loading } = useAsync(async () => { - if (!(tokenAmount.toNumber() > 0)) return + if (!isGreaterThan(tokenAmount, 0)) return try { setEstimatedGas( tab === TabType.Deposit @@ -117,7 +101,6 @@ export function SavingsForm({ chainId, protocol, tab, onClose }: SavingsFormProp ) } catch { // do nothing - console.log('Failed to estimate gas') } }, [chainId, tab, protocol, tokenAmount]) // #endregion @@ -149,24 +132,13 @@ export function SavingsForm({ chainId, protocol, tab, onClose }: SavingsFormProp 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.type === EthereumTokenType.ERC20 ? createERC20Token(chainId, token.address, token.decimals, token.name, token.symbol) : undefined, approveAmount: new BigNumber(inputAmount).shiftedBy(token.decimals), - approveAddress: poolAddress, + approveAddress: protocol.approveAddress, } }, [protocol.bareToken, inputAmount, chainId]) @@ -186,21 +158,28 @@ export function SavingsForm({ chainId, protocol, tab, onClose }: SavingsFormProp setTradeState({ type: TransactionStateType.WAIT_FOR_CONFIRMING, }) - if ( - !(await protocol.deposit(account, chainId, web3, tokenAmount, (state) => { - setTradeState((prev) => { - if ( - prev.type === TransactionStateType.UNKNOWN && - state.type === TransactionStateType.CONFIRMED - ) - return prev - return state + let receipt + try { + receipt = await protocol.deposit(account, chainId, web3, tokenAmount) + if (receipt !== null) { + setTradeState({ + type: TransactionStateType.CONFIRMED, + no: 1, + receipt, }) - })) - ) { - throw new Error('Failed to deposit token.') - } else { + await protocol.updateBalance(chainId, web3, account) + } + } catch (error) { + setTradeState({ + type: TransactionStateType.FAILED, + error: error as Error, + }) + } + + if (receipt !== null) { await protocol.updateBalance(chainId, web3, account) + } else { + throw new Error('Failed to deposit token.') } return case TabType.Withdraw: @@ -224,13 +203,16 @@ export function SavingsForm({ chainId, protocol, tab, onClose }: SavingsFormProp useEffect(() => { if (tradeState.type === TransactionStateType.UNKNOWN) return + + const protocolInfo = AllProtocolInfos[protocol.type] + const currentApr = protocol.apr setTransactionDialog({ open: true, state: tradeState, shareText: [ - `I just deposit ${inputAmount} ${protocol.bareToken.symbol} with ${resolveProtocolName( - protocol.type, - )}. ${ + `I just deposit ${inputAmount} ${protocol.bareToken.symbol} with @${ + protocolInfo.twitter + } for ${currentApr}% APR. ${ isTwitter(activatedSocialNetworkUI) || isFacebook(activatedSocialNetworkUI) ? `Follow @${ isTwitter(activatedSocialNetworkUI) ? t('twitter_account') : t('facebook_account') diff --git a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx index 161dd223be89..adcdcfa00ae5 100644 --- a/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx +++ b/packages/mask/src/plugins/Savings/SNSAdaptor/SavingsTable.tsx @@ -7,6 +7,7 @@ import { ChainId, formatBalance, isSameAddress, useAccount, useAssets, useWeb3 } import { ProviderIconURLs } from './IconURL' import { useI18N } from '../../../utils' import { SavingsProtocol, TabType } from '../types' +import { useMemo } from 'react' import { CircleLoadingIcon, DirectIcon } from '@masknet/icons' const useStyles = makeStyles()((theme, props) => ({ @@ -56,6 +57,7 @@ const useStyles = makeStyles()((theme, props) => ({ height: '16px', position: 'absolute', bottom: 0, + borderRadius: '16px', right: '-5px', }, protocolLabel: {}, @@ -116,11 +118,16 @@ export function SavingsTable({ chainId, tab, protocols, setTab, setSelectedProto const { loading } = useAsync(async () => { await Promise.all( protocols.map(async (protocol) => { - protocol.updateApr(chainId, web3) - protocol.updateBalance(chainId, web3, account) + return tab === TabType.Deposit + ? protocol.updateApr(chainId, web3) + : protocol.updateBalance(chainId, web3, account) }), ) - }, [chainId, web3, account, protocols]) + }, [chainId, web3, account, protocols, tab]) + + const displayProtocols = useMemo(() => { + return tab === TabType.Deposit ? protocols : protocols.filter((x) => !x.balance.isZero()) + }, [protocols, loading]) return ( @@ -146,66 +153,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} - -
-
- {tab === TabType.Deposit ? ( - - {protocol.apr}% - - ) : null} - - - - isSameAddress(x.token.address, protocol.bareToken.address), - )?.balance - : protocol.balance - } - decimals={protocol.bareToken.decimals} - significant={6} - minimumBalance={rightShift(10, protocol.bareToken.decimals - 6)} - formatter={formatBalance} - /> + {displayProtocols.map((protocol, index) => ( + + +
+ + +
+
+ + {protocol.bareToken.symbol} +
+
+ {tab === TabType.Deposit ? ( + + {protocol.apr}% - - - + ) : null} + + + + isSameAddress(x.token.address, protocol.bareToken.address), + )?.balance + : 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/base.ts b/packages/mask/src/plugins/Savings/base.ts index 617e7809ef65..3961f5116966 100644 --- a/packages/mask/src/plugins/Savings/base.ts +++ b/packages/mask/src/plugins/Savings/base.ts @@ -26,6 +26,7 @@ export const base: Plugin.Shared.Definition = { ChainId.Arbitrum, ChainId.xDai, ChainId.Aurora, + ChainId.Celo, ChainId.Avalanche, ChainId.Fantom, ChainId.Harmony, diff --git a/packages/mask/src/plugins/Savings/constants.ts b/packages/mask/src/plugins/Savings/constants.ts index 83f06963c5e3..a8aec366ef44 100644 --- a/packages/mask/src/plugins/Savings/constants.ts +++ b/packages/mask/src/plugins/Savings/constants.ts @@ -1,5 +1,12 @@ -import { ChainId, createERC20Tokens, createNativeToken, FungibleTokenDetailed } from '@masknet/web3-shared-evm' - +import { + ChainId, + getBenQiConstants, + getCompoundConstants, + createERC20Tokens, + createNativeToken, + FungibleTokenDetailed, + ZERO_ADDRESS, +} from '@masknet/web3-shared-evm' export const SAVINGS_PLUGIN_NAME = 'Savings' export const SAVINGS_PLUGIN_ID = 'com.savings' @@ -10,129 +17,7 @@ export const LDO_PAIRS: Array<[FungibleTokenDetailed, FungibleTokenDetailed]> = ], ] -export const AAVE_PAIRS: Array<[FungibleTokenDetailed, FungibleTokenDetailed]> = [ - [ - createERC20Tokens('USDT_ADDRESS', 'Tether USD', 'USDT', 6)[ChainId.Mainnet], - createERC20Tokens('aUSDT_ADDRESS', 'Aave Interest bearing USDT', 'aUSDT', 6)[ChainId.Mainnet], - ], - [ - createERC20Tokens('WBTC_ADDRESS', 'WBTC', 'WBTC', 8)[ChainId.Mainnet], - createERC20Tokens('aWBTC_ADDRESS', 'aWBTC', 'aWBTC', 8)[ChainId.Mainnet], - ], - [ - createERC20Tokens('WETH_ADDRESS', 'WETH', 'WETH', 18)[ChainId.Mainnet], - createERC20Tokens('aWETH_ADDRESS', 'aWETH', 'aWETH', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('YFI_ADDRESS', 'YFI', 'YFI', 18)[ChainId.Mainnet], - createERC20Tokens('aYFI_ADDRESS', 'aYFI', 'aYFI', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('ZRX_ADDRESS', 'ZRX', 'ZRX', 18)[ChainId.Mainnet], - createERC20Tokens('aZRX_ADDRESS', 'aZRX', 'aZRX', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('UNI_ADDRESS', 'UNI', 'UNI', 18)[ChainId.Mainnet], - createERC20Tokens('aUNI_ADDRESS', 'aUNI', 'aUNI', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('AAVE_ADDRESS', 'AAVE', 'AAVE', 18)[ChainId.Mainnet], - createERC20Tokens('aAAVE_ADDRESS', 'aAAVE', 'aAAVE', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('BAT_ADDRESS', 'BAT', 'BAT', 18)[ChainId.Mainnet], - createERC20Tokens('aBAT_ADDRESS', 'aBAT', 'aBAT', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('BUSD_ADDRESS', 'BUSD', 'BUSD', 18)[ChainId.Mainnet], - createERC20Tokens('aBUSD_ADDRESS', 'aBUSD', 'aBUSD', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('DAI_ADDRESS', 'DAI', 'DAI', 18)[ChainId.Mainnet], - createERC20Tokens('aDAI_ADDRESS', 'aDAI', 'aDAI', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('ENJ_ADDRESS', 'ENJ', 'ENJ', 18)[ChainId.Mainnet], - createERC20Tokens('aENJ_ADDRESS', 'aENJ', 'aENJ', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('KNC_ADDRESS', 'KNC', 'KNC', 18)[ChainId.Mainnet], - createERC20Tokens('aKNC_ADDRESS', 'aKNC', 'aKNC', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('LINK_ADDRESS', 'LINK', 'LINK', 18)[ChainId.Mainnet], - createERC20Tokens('aLINK_ADDRESS', 'aLINK', 'aLINK', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('MANA_ADDRESS', 'MANA', 'MANA', 18)[ChainId.Mainnet], - createERC20Tokens('aMANA_ADDRESS', 'aMANA', 'aMANA', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('MKR_ADDRESS', 'MKR', 'MKR', 18)[ChainId.Mainnet], - createERC20Tokens('aMKR_ADDRESS', 'aMKR', 'aMKR', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('REN_ADDRESS', 'REN', 'REN', 18)[ChainId.Mainnet], - createERC20Tokens('aREN_ADDRESS', 'aREN', 'aREN', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('SNX_ADDRESS', 'SNX', 'SNX', 18)[ChainId.Mainnet], - createERC20Tokens('aSNX_ADDRESS', 'aSNX', 'aSNX', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('sUSD_ADDRESS', 'sUSD', 'sUSD', 18)[ChainId.Mainnet], - createERC20Tokens('aSUSD_ADDRESS', 'aSUSD', 'aSUSD', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('TUSD_ADDRESS', 'TUSD', 'TUSD', 18)[ChainId.Mainnet], - createERC20Tokens('aTUSD_ADDRESS', 'aTUSD', 'aTUSD', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('USDC_ADDRESS', 'USDC', 'USDC', 6)[ChainId.Mainnet], - createERC20Tokens('aUSDC_ADDRESS', 'aUSDC', 'aUSDC', 6)[ChainId.Mainnet], - ], - [ - createERC20Tokens('CRV_ADDRESS', 'CRV', 'CRV', 18)[ChainId.Mainnet], - createERC20Tokens('aCRV_ADDRESS', 'aCRV', 'aCRV', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('GUSD_ADDRESS', 'GUSD', 'GUSD', 2)[ChainId.Mainnet], - createERC20Tokens('aGUSD_ADDRESS', 'aGUSD', 'aGUSD', 2)[ChainId.Mainnet], - ], - [ - createERC20Tokens('BAL_ADDRESS', 'BAL', 'BAL', 18)[ChainId.Mainnet], - createERC20Tokens('aBAL_ADDRESS', 'aBAL', 'aBAL', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('xSUSHI_ADDRESS', 'xSUSHI', 'xSUSHI', 18)[ChainId.Mainnet], - createERC20Tokens('aXSUSHI_ADDRESS', 'aXSUSHI', 'aXSUSHI', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('renFIL_ADDRESS', 'renFIL', 'renFIL', 18)[ChainId.Mainnet], - createERC20Tokens('aRENFIL_ADDRESS', 'aRENFIL', 'aRENFIL', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('RAI_ADDRESS', 'RAI', 'RAI', 18)[ChainId.Mainnet], - createERC20Tokens('aRAI_ADDRESS', 'aRAI', 'aRAI', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('AMPL_ADDRESS', 'AMPL', 'AMPL', 9)[ChainId.Mainnet], - createERC20Tokens('aAMPL_ADDRESS', 'aAMPL', 'aAMPL', 9)[ChainId.Mainnet], - ], - [ - createERC20Tokens('USDP_ADDRESS', 'USDP', 'USDP', 18)[ChainId.Mainnet], - createERC20Tokens('aUSDP_ADDRESS', 'aUSDP', 'aUSDP', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('DPI_ADDRESS', 'DPI', 'DPI', 18)[ChainId.Mainnet], - createERC20Tokens('aDPI_ADDRESS', 'aDPI', 'aDPI', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('FRAX_ADDRESS', 'FRAX', 'FRAX', 18)[ChainId.Mainnet], - createERC20Tokens('aFRAX_ADDRESS', 'aFRAX', 'aFRAX', 18)[ChainId.Mainnet], - ], - [ - createERC20Tokens('FEI_ADDRESS', 'FEI', 'FEI', 18)[ChainId.Mainnet], - 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/info.ts b/packages/mask/src/plugins/Savings/info.ts new file mode 100644 index 000000000000..c62f0cdbb39c --- /dev/null +++ b/packages/mask/src/plugins/Savings/info.ts @@ -0,0 +1,55 @@ +import { ProtocolType } from './types' + +export type ProtocolInfo = { + twitter: string + name: string + website: string +} + +export const AllProtocolInfos: Record = { + [ProtocolType.Lido]: { + twitter: 'LidoFinance', + name: 'Lido', + website: 'https://stake.lido.fi/', + }, + [ProtocolType.BENQI]: { + twitter: 'BenqiFinance', + name: 'BENQI', + website: 'https://app.benqi.fi/', + }, + [ProtocolType.Compound]: { + twitter: 'compoundfinance', + name: 'Compound', + website: 'https://app.compound.finance/', + }, + [ProtocolType.AAVE]: { + twitter: 'AaveAave', + name: 'Aave', + website: 'https://aave.com/', + }, + [ProtocolType.Aurigami]: { + twitter: 'aurigami_PLY', + name: 'Aurigami', + website: 'https://www.aurigami.finance/', + }, + [ProtocolType.Giest]: { + twitter: 'GeistFinance', + name: 'Geist Finance', + website: 'https://geist.finance/', + }, + [ProtocolType.Alpaca]: { + twitter: 'Alpaca Finance', + name: 'AlpacaFinance', + website: 'https://www.alpacafinance.org/', + }, + [ProtocolType.Moola]: { + twitter: 'Moola_Market', + name: 'Moola', + website: 'https://app.moola.market/', + }, + [ProtocolType.Tranquil]: { + twitter: 'tranquil_fi', + name: 'Tranquil', + website: 'https://www.tranquil.finance/', + }, +} diff --git a/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts b/packages/mask/src/plugins/Savings/protocols/aave/AAVEProtocol.ts similarity index 64% rename from packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts rename to packages/mask/src/plugins/Savings/protocols/aave/AAVEProtocol.ts index 1349d35b9d31..5d3cc17a7963 100644 --- a/packages/mask/src/plugins/Savings/protocols/AAVEProtocol.ts +++ b/packages/mask/src/plugins/Savings/protocols/aave/AAVEProtocol.ts @@ -7,16 +7,11 @@ import { createContract, FungibleTokenDetailed, getAaveConstants, - TransactionEventType, - TransactionState, - TransactionStateType, ZERO_ADDRESS, } from '@masknet/web3-shared-evm' import type { AaveLendingPool } from '@masknet/web3-contracts/types/AaveLendingPool' -import type { AaveLendingPoolAddressProvider } from '@masknet/web3-contracts/types/AaveLendingPoolAddressProvider' -import AaveLendingPoolAddressProviderABI from '@masknet/web3-contracts/abis/AaveLendingPoolAddressProvider.json' import AaveLendingPoolABI from '@masknet/web3-contracts/abis/AaveLendingPool.json' -import { ProtocolType, SavingsProtocol } from '../types' +import { ProtocolType, SavingsProtocol } from '../../types' import type { ERC20 } from '@masknet/web3-contracts/types/ERC20' import ERC20ABI from '@masknet/web3-contracts/abis/ERC20.json' @@ -25,8 +20,11 @@ export class AAVEProtocol implements SavingsProtocol { private _apr = '0.00' private _balance = ZERO + private poolAddress - constructor(readonly pair: [FungibleTokenDetailed, FungibleTokenDetailed]) {} + constructor(readonly pair: [FungibleTokenDetailed, FungibleTokenDetailed], poolAddress: string) { + this.poolAddress = poolAddress + } get type() { return ProtocolType.AAVE @@ -48,6 +46,10 @@ export class AAVEProtocol implements SavingsProtocol { return this.pair[1] } + get approveAddress() { + return this.poolAddress + } + public async updateApr(chainId: ChainId, web3: Web3) { try { const subgraphUrl = getAaveConstants(chainId).AAVE_SUBGRAPHS || '' @@ -92,7 +94,6 @@ export class AAVEProtocol implements SavingsProtocol { const liquidityRate = +fullResponse.data.reserves[0].liquidityRate const RAY = pow10(27) // 10 to the power 27 - const SECONDS_PER_YEAR = 31536000 // 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) @@ -164,85 +165,27 @@ export class AAVEProtocol implements SavingsProtocol { } 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[], - ) + 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, - onChange: (state: TransactionState) => void, - ) { + public async deposit(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { try { const gasEstimate = await this.depositEstimate(account, chainId, web3, value) const operation = await this.createDepositTokenOperation(account, chainId, web3, value) if (operation) { - await operation - .send({ - from: account, - gas: gasEstimate.toNumber(), - }) - .on(TransactionEventType.ERROR, (error) => { - onChange({ - type: TransactionStateType.FAILED, - error, - }) - }) - .on(TransactionEventType.CONFIRMATION, (no, receipt) => { - onChange({ - type: TransactionStateType.CONFIRMED, - no, - receipt, - }) - }) - - return true + return operation.send({ + from: account, + gas: gasEstimate.toNumber(), + }) } - onChange({ - type: TransactionStateType.FAILED, - error: new Error("Can't create deposit operation"), - }) - return false - } catch (error) { - onChange({ - type: TransactionStateType.FAILED, - error: new Error('deposit failed'), - }) - return false - } + } catch (error) {} + return null } 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 contract = createContract(web3, this.poolAddress, AaveLendingPoolABI as AbiItem[]) const gasEstimate = await contract?.methods .withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account) .estimateGas({ @@ -256,20 +199,8 @@ export class AAVEProtocol implements SavingsProtocol { public async withdraw(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 gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) - const contract = createContract( - web3, - poolAddress || ZERO_ADDRESS, - AaveLendingPoolABI as AbiItem[], - ) + const contract = createContract(web3, this.poolAddress, AaveLendingPoolABI as AbiItem[]) await contract?.methods.withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account).send({ from: account, gas: gasEstimate.toNumber(), diff --git a/packages/mask/src/plugins/Savings/protocols/aave/AAVEResolver.ts b/packages/mask/src/plugins/Savings/protocols/aave/AAVEResolver.ts new file mode 100644 index 000000000000..8b6cdbc5ea7e --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/aave/AAVEResolver.ts @@ -0,0 +1,65 @@ +import type { ProtocolPairsResolver, SavingsProtocol } from '../../types' +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import { createContract, ChainId, EthereumTokenType, getAaveConstants, ZERO_ADDRESS } 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 } from 'lodash-unified' +import { AAVEProtocol } from './AAVEProtocol' +import type { AaveLendingPoolAddressProvider } from '@masknet/web3-contracts/types/AaveLendingPoolAddressProvider' +import AaveLendingPoolAddressProviderABI from '@masknet/web3-contracts/abis/AaveLendingPoolAddressProvider.json' +import { getFungibleTokensDetailed, splitToPair } from '../common/tokens' + +export class AAVEResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.Mainnet] + static getAaveLendingPoolAddressProviderContract(chainId: ChainId, web3: Web3) { + const aaveLPoolAddress = + getAaveConstants(chainId).AAVE_LENDING_POOL_ADDRESSES_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS + const lPoolAddressProviderContract = createContract( + web3, + aaveLPoolAddress, + AaveLendingPoolAddressProviderABI as AbiItem[], + ) + return lPoolAddressProviderContract + } + + static getProtocolDataContract(chainId: ChainId, web3: Web3) { + const address = getAaveConstants(chainId).AAVE_PROTOCOL_DATA_PROVIDER_CONTRACT_ADDRESS || ZERO_ADDRESS + return createContract(web3, address, AaveProtocolDataProviderABI as AbiItem[]) + } + + private async lookupPoolAddress(chainId: ChainId, web3: Web3) { + const lPoolAddressProviderContract = AAVEResolver.getAaveLendingPoolAddressProviderContract(chainId, web3) + if (lPoolAddressProviderContract === null) return null + return lPoolAddressProviderContract.methods.getLendingPool().call() + } + + private async lookupTokens(chainId: ChainId, web3: Web3) { + const protocolDataContract = AAVEResolver.getProtocolDataContract(chainId, web3) + const tokens = await protocolDataContract?.methods.getAllReservesTokens().call() + const aTokens = await protocolDataContract?.methods.getAllATokens().call() + const aaveTokens = tokens?.map((token) => { + return [token[1], aTokens?.filter((f) => f[0].toUpperCase() === `a${token[0]}`.toUpperCase())[0][1]] + }) + const allTokens = + compact(flatten(aaveTokens ?? [])).map((m) => { + return { address: m, type: EthereumTokenType.ERC20 } + }) ?? [] + return allTokens + } + + public async resolve(chainId: ChainId, web3: Web3): Promise { + if (!this.supportChains.includes(ChainId.Mainnet)) { + return [] + } + const [allTokens, poolAddress] = await Promise.all([ + this.lookupTokens(chainId, web3), + this.lookupPoolAddress(chainId, web3), + ]) + if (poolAddress === null) return [] + const detailedAaveTokens = await getFungibleTokensDetailed(allTokens, web3, chainId) + return splitToPair(detailedAaveTokens).map((pair: any) => new AAVEProtocol(pair, poolAddress)) + } +} + +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..3f3fd68da4ce --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/alpaca/AlpacaProtocol.ts @@ -0,0 +1,203 @@ +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, FungibleTokenDetailed } from '@masknet/web3-shared-evm' +import { ProtocolType, 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: [FungibleTokenDetailed, FungibleTokenDetailed]) {} + + 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) { + try { + const gasEstimate = await this.depositEstimate(account, chainId, web3, value) + const operation = await this.createDepositTokenOperation(web3, value) + if (operation) { + const args = this.isNativeToken + ? { + value: value.toString(), + from: account, + gas: gasEstimate.toNumber(), + } + : { + from: account, + gas: gasEstimate.toNumber(), + } + return operation.send(args) + } + } catch (error) {} + return null + } + + 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) { + try { + const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) + const operation = await this.createWithdrawTokenOperation(web3, value) + if (operation) { + await operation.send({ + from: account, + gas: gasEstimate.toNumber(), + }) + return true + } + return false + } catch (error) { + console.error('AlpacaProtocol.withdraw error', error) + return false + } + } +} 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..375d8a570dd8 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/alpaca/pairs.ts @@ -0,0 +1,57 @@ +import { + FungibleTokenDetailed, + getAlpacaConstants, + createNativeToken, + ChainId, + EthereumTokenType, +} from '@masknet/web3-shared-evm' +import { AlpacaProtocol } from './AlpacaProtocol' +import type Web3 from 'web3' +import type { SavingsProtocol, ProtocolPairsResolver } from '../../types' +import { flatten } from 'lodash-unified' +import { getFungibleTokensDetailed, splitToPair } from '../common/tokens' + +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): 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 { address: m, type: EthereumTokenType.ERC20 } + }) + + const detailedTokens = await getFungibleTokensDetailed(allTokens, web3, chainId) + return splitToPair(detailedTokens).map((pair: [FungibleTokenDetailed, FungibleTokenDetailed]) => { + const [bareToken, stakeToken] = pair + if (stakeToken.symbol === AlpacaProtocol.nativeToken) { + pair[0] = createNativeToken(ChainId.BSC) + } + return new AlpacaProtocol(pair) + }) + } +} + +export const alpacaLazyResolver = new PairResolver() 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..fab81753b4f2 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/benqi/BenQiProtocol.ts @@ -0,0 +1,23 @@ +import { ProtocolType } from '../../types' +import { default as BenQiRewardProtocol, RewardToken, PairConfig } from '../common/protocol/BenQiRewardProtocol' +import type { FungibleTokenDetailed } from '@masknet/web3-shared-evm' +import { BENQI_COMPTROLLER, BENQI_ChainlinkOracle } from '../../constants' + +export default class BenQiProtocol extends BenQiRewardProtocol { + static nativeToken = 'qiAVAX' + + constructor( + pair: [FungibleTokenDetailed, FungibleTokenDetailed], + allPairs: [[FungibleTokenDetailed, FungibleTokenDetailed]], + 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..9d9be1524ea6 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/benqi/pairs.ts @@ -0,0 +1,44 @@ +import type Web3 from 'web3' +import { ChainId, FungibleTokenDetailed, createNativeToken } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, ProtocolPairsResolver } from '../../types' +import { BENQI_COMPTROLLER } from '../../constants' +import CompoundLikeFetcher from '../common/CompoundLikeFetcher' +import BenQiProtocol from './BenQiProtocol' + +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): Promise { + if (!this.supportChains.includes(ChainId.Avalanche)) { + return [] + } + const allPairs = await CompoundLikeFetcher.fetch(BENQI_COMPTROLLER, chainId, web3) + return allPairs.map((pair: [FungibleTokenDetailed, FungibleTokenDetailed]) => { + 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..2571082e2fa7 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/AAVELikeFetcher.ts @@ -0,0 +1,66 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import { createContract, ChainId, EthereumTokenType, FungibleTokenDetailed } 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 } from 'lodash-unified' +import type { AaveLendingPoolAddressProvider } from '@masknet/web3-contracts/types/AaveLendingPoolAddressProvider' +import AaveLendingPoolAddressProviderABI from '@masknet/web3-contracts/abis/AaveLendingPoolAddressProvider.json' +import { getFungibleTokensDetailed, splitToPair } from './tokens' + +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 ?? [])).map((m) => { + return { address: m, type: EthereumTokenType.ERC20 } + }) ?? [] + return allTokens + } + + static async fetch(dataProviderAddress: string, poolProviderAddress: string, chainId: ChainId, web3: Web3) { + 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, web3, chainId) + const allPairs = splitToPair(detailedAaveTokens) + const pairsWithPool: Array<[[FungibleTokenDetailed, FungibleTokenDetailed], string, string]> = [] + allPairs.forEach((pair: [FungibleTokenDetailed, FungibleTokenDetailed]) => { + pairsWithPool.push([pair, poolAddress, dataProviderAddress]) + }) + return pairsWithPool + } +} 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..be91464cc7fc --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/CompoundLikeFetcher.ts @@ -0,0 +1,55 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import { createContract, ChainId, EthereumTokenType, 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, splitToPair } from './tokens' +import type { CERC20 } from '@masknet/web3-contracts/types/CERC20' +import CERC20ABI from '@masknet/web3-contracts/abis/CERC20.json' +import { flatten, compact } from 'lodash-unified' + +const cache = new Map() + +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)).map((m) => { + return { address: m, type: EthereumTokenType.ERC20 } + }) ?? [] + return allTokens + } + + static async fetch(compAddress: string, chainId: ChainId, web3: Web3) { + const cacheValue = cache.get(compAddress) + if (cacheValue !== undefined && cacheValue !== null) { + return cacheValue + } + const allTokens = await this.lookupTokens(compAddress, web3) + const detailedTokens = await getFungibleTokensDetailed(allTokens, web3, chainId) + const allPairs = splitToPair(detailedTokens) + cache.set(compAddress, allPairs) + return allPairs + } +} 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..8db8f515652a --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/protocol/AAVELikeProtocol.ts @@ -0,0 +1,143 @@ +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, FungibleTokenDetailed } 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 } 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: [FungibleTokenDetailed, FungibleTokenDetailed], + 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) { + try { + const gasEstimate = await this.depositEstimate(account, chainId, web3, value) + const operation = await this.createDepositTokenOperation(account, chainId, web3, value) + if (operation) { + return operation.send({ + from: account, + gas: gasEstimate.toNumber(), + }) + } + } catch (error) {} + return null + } + + 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) { + try { + const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) + const contract = createContract(web3, this.poolAddress, AaveLendingPoolABI as AbiItem[]) + await contract?.methods.withdraw(this.bareToken.address, new BigNumber(value).toFixed(), account).send({ + from: account, + gas: gasEstimate.toNumber(), + }) + return true + } catch (error) { + return false + } + } +} 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..d08f33a9ba88 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/protocol/BenQiRewardProtocol.ts @@ -0,0 +1,236 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import BigNumber from 'bignumber.js' +import CompoundTimestampBasedProtocol from './CompoundTimestampBasedProtocol' +import type { FungibleTokenDetailed, 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: [FungibleTokenDetailed, FungibleTokenDetailed], + nativeToken: string, + readonly allPairs: [[FungibleTokenDetailed, FungibleTokenDetailed]], + readonly rewardTokens: RewardToken[], + readonly config: PairConfig, + ) { + super(pair, nativeToken) + } + + // load price + public async fetchPrices( + matchPairs: Array<{ + underlying: FungibleTokenDetailed + market: FungibleTokenDetailed + }>, + 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: [FungibleTokenDetailed, FungibleTokenDetailed]) => + pair[1]?.symbol && allTokens.find((item) => item.symbol === pair[1].symbol), + ) + .map((pair: [FungibleTokenDetailed, FungibleTokenDetailed]) => { + 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..0968756158ad --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/protocol/CompoundBlockBasedProtocol.ts @@ -0,0 +1,162 @@ +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, FungibleTokenDetailed } from '@masknet/web3-shared-evm' +import { ProtocolType, SavingsProtocol } 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: [FungibleTokenDetailed, FungibleTokenDetailed], 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) { + try { + 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) { + return operation.send(args) + } + } catch (error) {} + return null + } + + 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) { + try { + const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) + const contract = this.getPoolContract(web3) + await contract?.methods.redeemUnderlying(value.toString()).send({ + from: account, + gas: gasEstimate.toNumber(), + }) + return true + } catch (error) { + return false + } + } +} 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..ea2106d8fddb --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/protocol/CompoundTimestampBasedProtocol.ts @@ -0,0 +1,169 @@ +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, FungibleTokenDetailed } from '@masknet/web3-shared-evm' +import { ProtocolType, SavingsProtocol } 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: [FungibleTokenDetailed, FungibleTokenDetailed], 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) { + try { + 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) { + return operation.send(args) + } + } catch (error) {} + return null + } + + 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) { + try { + const gasEstimate = await this.withdrawEstimate(account, chainId, web3, value) + const contract = this.getPoolContract(web3) + await contract?.methods.redeemUnderlying(value.toString()).send({ + from: account, + gas: gasEstimate.toNumber(), + }) + return true + } catch (error) { + return false + } + } +} 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..747178f7857b --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/common/tokens.ts @@ -0,0 +1,114 @@ +import type Web3 from 'web3' +import type { AbiItem } from 'web3-utils' +import { + createContract, + ChainId, + getERC20TokenDetailed, + ERC20TokenDetailed, + FungibleToken, + FungibleTokenDetailed, + getTraderConstants, +} from '@masknet/web3-shared-evm' +import { ZERO } from '@masknet/web3-shared-base' +import type { ERC20 } from '@masknet/web3-contracts/types/ERC20' +import type { ERC20Bytes32 } from '@masknet/web3-contracts/types/ERC20Bytes32' +import ERC20ABI from '@masknet/web3-contracts/abis/ERC20.json' +import ERC20Bytes32ABI from '@masknet/web3-contracts/abis/ERC20Bytes32.json' +import type { Pair } from '@masknet/web3-contracts/types/Pair' +import PairABI from '@masknet/web3-contracts/abis/Pair.json' +import { Pair as UniswapPair } from '@uniswap/v2-sdk' +import { CurrencyAmount, Token } from '@uniswap/sdk-core' +import BigNumber from 'bignumber.js' +import { getPairAddress } from '../../../Trader/helpers/pair' + +export async function getPriceFromTrisolaris( + token0: ERC20TokenDetailed, + token1: ERC20TokenDetailed, + priceToken: ERC20TokenDetailed, + 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 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 function splitToPair(a: FungibleTokenDetailed[] | undefined) { + if (!a) { + return [] + } + const pairs: Array<[FungibleTokenDetailed, FungibleTokenDetailed]> = [] + a.forEach((value, index) => { + if (!(index % 2 === 0)) return + const pair = a.slice(index, index + 2) + if (pair.length === 2) { + const [a, b] = pair + pairs.push([a, b]) + } + }) + return pairs +} + +export async function getFungibleTokensDetailed( + allTokens: Array>, + web3: Web3, + chainId: ChainId, +) { + return Promise.all( + allTokens.map(async (token, i) => { + const erc20TokenContract = createContract(web3, token.address, ERC20ABI as AbiItem[]) + const erc20TokenBytes32Contract = createContract( + web3, + token.address, + ERC20Bytes32ABI as AbiItem[], + ) + return getERC20TokenDetailed( + token.address, + chainId, + erc20TokenContract, + erc20TokenBytes32Contract, + token as Partial, + ) + }), + ) +} 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..543f115539e6 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/compound/CompoundProtocol.ts @@ -0,0 +1,15 @@ +import { ProtocolType } from '../../types' +import CompoundBlockBasedProtocol from '../common/protocol/CompoundBlockBasedProtocol' +import type { FungibleTokenDetailed } from '@masknet/web3-shared-evm' + +export default class CompoundProtocol extends CompoundBlockBasedProtocol { + static nativeToken = 'cETH' + + constructor(pair: [FungibleTokenDetailed, FungibleTokenDetailed]) { + 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..98d316fe7425 --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/compound/pairs.ts @@ -0,0 +1,25 @@ +import type Web3 from 'web3' +import { ChainId, FungibleTokenDetailed, createNativeToken } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, ProtocolPairsResolver } from '../../types' +import { COMPOUND_COMPTROLLER } from '../../constants' +import CompoundLikeFetcher from '../common/CompoundLikeFetcher' +import CompoundProtocol from './CompoundProtocol' + +export class CompoundPairResolver implements ProtocolPairsResolver { + public supportChains: ChainId[] = [ChainId.Mainnet] + public async resolve(chainId: ChainId, web3: Web3): Promise { + if (!this.supportChains.includes(ChainId.Mainnet)) { + return [] + } + const allPairs = await CompoundLikeFetcher.fetch(COMPOUND_COMPTROLLER, chainId, web3) + return allPairs.map((pair: [FungibleTokenDetailed, FungibleTokenDetailed]) => { + 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/index.ts b/packages/mask/src/plugins/Savings/protocols/index.ts index c4e741db42d2..5d23e5efa508 100644 --- a/packages/mask/src/plugins/Savings/protocols/index.ts +++ b/packages/mask/src/plugins/Savings/protocols/index.ts @@ -1,8 +1,17 @@ -import { AAVE_PAIRS, LDO_PAIRS } from '../constants' -import { LidoProtocol } from './LDOProtocol' -import { AAVEProtocol } from './AAVEProtocol' +import { compoundLazyResolver } from './compound/pairs' +import { benqiLazyResolver } from './benqi/pairs' -export const SavingsProtocols = [ - ...LDO_PAIRS.map((pair) => new LidoProtocol(pair)), - ...AAVE_PAIRS.map((pair) => new AAVEProtocol(pair)), +import { LDO_PAIRS } from './ldo/pairs' +import { aaveLazyResolver } from './aave/AAVEResolver' +import { alpacaLazyResolver } from './alpaca/pairs' +import { moolaLazyResolver } from './moola/pairs' + +export const SavingsProtocols = [...LDO_PAIRS] + +export const LazyProtocolsResolvers = [ + aaveLazyResolver, + compoundLazyResolver, + benqiLazyResolver, + alpacaLazyResolver, + moolaLazyResolver, ] diff --git a/packages/mask/src/plugins/Savings/protocols/LDOProtocol.ts b/packages/mask/src/plugins/Savings/protocols/ldo/LDOProtocol.ts similarity index 71% rename from packages/mask/src/plugins/Savings/protocols/LDOProtocol.ts rename to packages/mask/src/plugins/Savings/protocols/ldo/LDOProtocol.ts index 00f4079c4d32..b7ca2e9132e6 100644 --- a/packages/mask/src/plugins/Savings/protocols/LDOProtocol.ts +++ b/packages/mask/src/plugins/Savings/protocols/ldo/LDOProtocol.ts @@ -6,15 +6,12 @@ import { createContract, FungibleTokenDetailed, getLidoConstants, - TransactionEventType, - TransactionState, - TransactionStateType, ZERO_ADDRESS, } from '@masknet/web3-shared-evm' import { 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 { SavingsProtocol, ProtocolType } from '../../types' export class LidoProtocol implements SavingsProtocol { private _apr = '0.00' @@ -23,6 +20,7 @@ export class LidoProtocol implements SavingsProtocol { readonly type = ProtocolType.Lido constructor(readonly pair: [FungibleTokenDetailed, FungibleTokenDetailed]) {} + approveAddress: string | undefined get apr() { return this._apr @@ -83,48 +81,21 @@ export class LidoProtocol implements SavingsProtocol { } } - public async deposit( - account: string, - chainId: ChainId, - web3: Web3, - value: BigNumber.Value, - onChange: (state: TransactionState) => void, - ) { + public async deposit(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { try { const contract = createContract( web3, getLidoConstants(chainId).LIDO_stETH_ADDRESS || ZERO_ADDRESS, LidoABI as AbiItem[], ) - await contract?.methods - .submit(getLidoConstants(chainId).LIDO_REFERRAL_ADDRESS || ZERO_ADDRESS) - .send({ - from: account, - value: value.toString(), - gas: 300000, - }) - .on(TransactionEventType.ERROR, (error) => { - onChange({ - type: TransactionStateType.FAILED, - error, - }) - }) - .on(TransactionEventType.CONFIRMATION, (no, receipt) => { - onChange({ - type: TransactionStateType.CONFIRMED, - no, - receipt, - }) - }) - return true - } catch (error) { - onChange({ - type: TransactionStateType.FAILED, - error: new Error('deposit failed'), + if (contract === null) return null + return contract.methods.submit(getLidoConstants(chainId).LIDO_REFERRAL_ADDRESS || ZERO_ADDRESS).send({ + from: account, + value: value.toString(), + gas: 300000, }) - console.error('LDO `deposit()` Error', error) - return false - } + } catch (error) {} + return null } public async withdrawEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value) { 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..07ead69c4c1e --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/ldo/pairs.ts @@ -0,0 +1,11 @@ +import { ChainId, createERC20Tokens, createNativeToken, FungibleTokenDetailed } from '@masknet/web3-shared-evm' +import { LidoProtocol } from './LDOProtocol' + +export const LDO_PAIRS_LIST: Array<[FungibleTokenDetailed, FungibleTokenDetailed]> = [ + [ + 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..ecb65c821cbe --- /dev/null +++ b/packages/mask/src/plugins/Savings/protocols/moola/pairs.ts @@ -0,0 +1,38 @@ +import type Web3 from 'web3' +import { ChainId, FungibleTokenDetailed, getMoolaConstants, ZERO_ADDRESS } from '@masknet/web3-shared-evm' +import type { SavingsProtocol, ProtocolPairsResolver } from '../../types' +import AAVELikeFetcher from '../common/AAVELikeFetcher' +import { MoolaProtocol } from './MoolaProtocol' + +// Metadata +// address from: +// https://github.com/moolamarket/moola-v2/blob/main/cli.js#L290 +// +// custom logos from: +// https://openapi.debank.com/v1/token/list_by_ids?is_all=true&has_balance=true&ids=0x471EcE3750Da237f93B8E339c536989b8978a438,0x765DE816845861e75A25fCA122bb6898B8B1282a,0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73,0xe8537a3d056DA446677B9E9d6c5dB704EaAb4787,0x17700282592D6917F6A73D0bF8AcCf4D578c131e +// temp1.filter(_ => _.chain == 'celo').map(_ => ({address: _.id, name: _.symbol, logo_url: _.logo_url })) + +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): Promise { + if (!this.supportChains.includes(chainId)) { + return [] + } + + const allPairsWithArgs = await AAVELikeFetcher.fetch( + AaveProtocolDataProvider, + LendingPoolAddressProvider, + chainId, + web3, + ) + return allPairsWithArgs.map((args: [[FungibleTokenDetailed, FungibleTokenDetailed], string, string]) => { + const [pair, pool, dataProvider] = args + return new MoolaProtocol(pair, pool, dataProvider) + }) + } +} + +export const moolaLazyResolver = new MoolaPairResolver() diff --git a/packages/mask/src/plugins/Savings/types.ts b/packages/mask/src/plugins/Savings/types.ts index 6cad6d354e83..f535084d03f4 100644 --- a/packages/mask/src/plugins/Savings/types.ts +++ b/packages/mask/src/plugins/Savings/types.ts @@ -1,6 +1,7 @@ import type Web3 from 'web3' import type BigNumber from 'bignumber.js' -import type { ChainId, FungibleTokenDetailed, TransactionState } from '@masknet/web3-shared-evm' +import type { ChainId, FungibleTokenDetailed } from '@masknet/web3-shared-evm' +import type { TransactionReceipt } from 'web3-core/types' export enum TabType { Deposit = 'deposit', @@ -10,7 +11,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 @@ -31,18 +40,18 @@ export interface SavingsProtocol { readonly bareToken: FungibleTokenDetailed readonly stakeToken: FungibleTokenDetailed + readonly approveAddress: string | undefined updateApr(chainId: ChainId, web3: Web3): Promise updateBalance(chainId: ChainId, web3: Web3, account: string): Promise depositEstimate(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value): Promise - deposit( - account: string, - chainId: ChainId, - web3: Web3, - value: BigNumber.Value, - onChange: (state: TransactionState) => void, - ): Promise + deposit(account: string, chainId: ChainId, web3: Web3, value: BigNumber.Value): Promise 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): Promise +} diff --git a/packages/mask/src/plugins/Trader/apis/trader/index.ts b/packages/mask/src/plugins/Trader/apis/trader/index.ts index c36a2ebde6f3..86d30bde27b6 100644 --- a/packages/mask/src/plugins/Trader/apis/trader/index.ts +++ b/packages/mask/src/plugins/Trader/apis/trader/index.ts @@ -64,6 +64,7 @@ export async function getAvailableTraderProviders(chainId: ChainId) { case NetworkType.Metis: case NetworkType.Optimistic: case NetworkType.Conflux: + case NetworkType.Harmony: console.error('To be implement network: ', networkType) return [] default: diff --git a/packages/mask/src/plugins/Trader/constants/0x.ts b/packages/mask/src/plugins/Trader/constants/0x.ts index 9edc0eec1c8f..29d52684ddd5 100644 --- a/packages/mask/src/plugins/Trader/constants/0x.ts +++ b/packages/mask/src/plugins/Trader/constants/0x.ts @@ -14,8 +14,8 @@ export const ZRX_BASE_URL: Record = { [NetworkType.Fuse]: '', [NetworkType.Metis]: '', [NetworkType.Optimistic]: '', - [NetworkType.Harmony]: '', [NetworkType.Conflux]: '', + [NetworkType.Harmony]: '', } export const ZRX_AFFILIATE_ADDRESS = '0x934B510D4C9103E6a87AEf13b816fb080286D649' diff --git a/packages/mask/src/plugins/Trader/constants/openocean.ts b/packages/mask/src/plugins/Trader/constants/openocean.ts index c7c970c5dd4d..629f376f0c99 100644 --- a/packages/mask/src/plugins/Trader/constants/openocean.ts +++ b/packages/mask/src/plugins/Trader/constants/openocean.ts @@ -9,6 +9,7 @@ export const networkNames: Record = { [NetworkType.Arbitrum]: 'arbitrum', [NetworkType.xDai]: 'xdai', [NetworkType.Celo]: 'celo', + [NetworkType.Harmony]: 'harmony', [NetworkType.Fantom]: 'fantom', [NetworkType.Avalanche]: 'avalanche', [NetworkType.Aurora]: 'aurora', @@ -16,6 +17,5 @@ export const networkNames: Record = { [NetworkType.Fuse]: '', [NetworkType.Metis]: '', [NetworkType.Optimistic]: '', - [NetworkType.Harmony]: '', [NetworkType.Conflux]: '', } diff --git a/packages/mask/src/plugins/Trader/trader/0x/useTrade.ts b/packages/mask/src/plugins/Trader/trader/0x/useTrade.ts index 84c7e8c513d2..f78b97f38cd8 100644 --- a/packages/mask/src/plugins/Trader/trader/0x/useTrade.ts +++ b/packages/mask/src/plugins/Trader/trader/0x/useTrade.ts @@ -36,6 +36,7 @@ export function getNativeTokenLabel(networkType: NetworkType) { case NetworkType.Optimistic: case NetworkType.Harmony: case NetworkType.Conflux: + case NetworkType.Harmony: return NATIVE_TOKEN_ADDRESS default: safeUnreachable(networkType) diff --git a/packages/public-api/src/web.ts b/packages/public-api/src/web.ts index 103627077de1..6c8e67b1bb8f 100644 --- a/packages/public-api/src/web.ts +++ b/packages/public-api/src/web.ts @@ -235,8 +235,8 @@ export enum NetworkType { Fuse = 'Fuse', Metis = 'Metis', Optimistic = 'Optimistic', - Harmony = 'Harmony', Conflux = 'Conflux', + Harmony = 'Harmony', } export enum ProviderType { 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/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/assets/chains.json b/packages/web3-shared/evm/assets/chains.json index 4c8a00736ca8..5e1374533d7e 100644 --- a/packages/web3-shared/evm/assets/chains.json +++ b/packages/web3-shared/evm/assets/chains.json @@ -2815,7 +2815,8 @@ "nativeCurrency": { "name": "ONE", "symbol": "ONE", - "decimals": 18 + "decimals": 18, + "logoURI": "https://static.debank.com/image/hmy_token/logo_url/0xcf664087a5bb0237a0bad6742852ec6c8d69a27a/734c003023531e31c636ae25d5a73172.png" }, "infoURL": "https://www.harmony.one/", "shortName": "hmy-s1", @@ -2829,7 +2830,8 @@ "nativeCurrency": { "name": "ONE", "symbol": "ONE", - "decimals": 18 + "decimals": 18, + "logoURI": "https://static.debank.com/image/hmy_token/logo_url/0xcf664087a5bb0237a0bad6742852ec6c8d69a27a/734c003023531e31c636ae25d5a73172.png" }, "infoURL": "https://www.harmony.one/", "shortName": "hmy-s2", @@ -2843,7 +2845,8 @@ "nativeCurrency": { "name": "ONE", "symbol": "ONE", - "decimals": 18 + "decimals": 18, + "logoURI": "https://static.debank.com/image/hmy_token/logo_url/0xcf664087a5bb0237a0bad6742852ec6c8d69a27a/734c003023531e31c636ae25d5a73172.png" }, "infoURL": "https://www.harmony.one/", "shortName": "hmy-s3", diff --git a/packages/web3-shared/evm/constants/constants.ts b/packages/web3-shared/evm/constants/constants.ts index feef208f28eb..4bf1bb76249f 100644 --- a/packages/web3-shared/evm/constants/constants.ts +++ b/packages/web3-shared/evm/constants/constants.ts @@ -26,6 +26,14 @@ 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 './utils' function getEnvConstants(key: 'WEB3_CONSTANTS_RPC') { @@ -122,3 +130,24 @@ export const useAaveConstants = hookTransform(getAaveConstants) export const getLidoConstants = transform(Lido) export const useLidoConstants = hookTransform(getLidoConstants) + +export const getBenQiConstants = transform(BenQi) +export const useBenQiConstants = hookTransform(getBenQiConstants) + +export const getAurigamiConstants = transform(Aurigami) +export const useAurigamiConstants = hookTransform(getAurigamiConstants) + +export const getTranquilConstants = transform(Tranquil) +export const useTranquilConstants = hookTransform(getTranquilConstants) + +export const getCompoundConstants = transform(Compound) +export const useCompoundConstants = hookTransform(getCompoundConstants) + +export const getMoolaConstants = transform(Moola) +export const useMoolaConstants = hookTransform(getMoolaConstants) + +export const getGiestConstants = transform(Giest) +export const useGiestConstants = hookTransform(getGiestConstants) + +export const getAlpacaConstants = transform(Alpaca) +export const useAlpacaConstants = hookTransform(getAlpacaConstants) diff --git a/packages/web3-shared/evm/hooks/useERC20TokenDetailed.ts b/packages/web3-shared/evm/hooks/useERC20TokenDetailed.ts index 257a26986673..3bf0c52f6b16 100644 --- a/packages/web3-shared/evm/hooks/useERC20TokenDetailed.ts +++ b/packages/web3-shared/evm/hooks/useERC20TokenDetailed.ts @@ -63,7 +63,7 @@ export function useFungibleTokensDetailed( const lazyBlank = Promise.resolve('') const lazyZero = Promise.resolve('0') -async function getERC20TokenDetailed( +export async function getERC20TokenDetailed( address: string, chainId: ChainId, erc20TokenContract: ERC20 | null, diff --git a/packages/web3-shared/evm/types/index.ts b/packages/web3-shared/evm/types/index.ts index fc07b546a044..ba5e5598410f 100644 --- a/packages/web3-shared/evm/types/index.ts +++ b/packages/web3-shared/evm/types/index.ts @@ -663,8 +663,8 @@ export enum NetworkType { Fuse = 'Fuse', Metis = 'Metis', Optimistic = 'Optimistic', - Harmony = 'Harmony', Conflux = 'Conflux', + Harmony = 'Harmony', } export enum ProviderType {