diff --git a/src/apps/argo-finance/argo-finance.definition.ts b/src/apps/argo-finance/argo-finance.definition.ts new file mode 100644 index 000000000..b221641cf --- /dev/null +++ b/src/apps/argo-finance/argo-finance.definition.ts @@ -0,0 +1,39 @@ +import { Register } from '~app-toolkit/decorators'; +import { appDefinition, AppDefinition } from '~app/app.definition'; +import { AppAction, AppTag, GroupType } from '~app/app.interface'; +import { Network } from '~types/network.interface'; + +export const ARGO_FINANCE_DEFINITION = appDefinition({ + id: 'argo-finance', + name: 'Argo Finance', + description: + 'Argo is the premier liquid staking protocol built on top of the Cronos blockchain that aims to unlock the value of all staked CRO and maximize the capital efficiency of CRO across the Crypto.com ecosystem.', + url: 'https://www.argofinance.money/', + + groups: { + pledging: { + id: 'pledging', + type: GroupType.POSITION, + label: 'Pledging', + }, + }, + + tags: [AppTag.LIQUID_STAKING], + keywords: [], + links: {}, + + supportedNetworks: { + [Network.CRONOS_MAINNET]: [AppAction.VIEW], + }, + + primaryColor: '#fff', +}); + +@Register.AppDefinition(ARGO_FINANCE_DEFINITION.id) +export class ArgoFinanceAppDefinition extends AppDefinition { + constructor() { + super(ARGO_FINANCE_DEFINITION); + } +} + +export default ARGO_FINANCE_DEFINITION; diff --git a/src/apps/argo-finance/argo-finance.module.ts b/src/apps/argo-finance/argo-finance.module.ts new file mode 100644 index 000000000..c8796170c --- /dev/null +++ b/src/apps/argo-finance/argo-finance.module.ts @@ -0,0 +1,20 @@ +import { Register } from '~app-toolkit/decorators'; +import { AbstractApp } from '~app/app.dynamic-module'; + +import { ArgoFinanceAppDefinition, ARGO_FINANCE_DEFINITION } from './argo-finance.definition'; +import { ArgoFinanceContractFactory } from './contracts'; +import { CronosArgoFinanceBalanceFetcher } from './cronos/argo-finance.balance-fetcher'; +import { CronosArgoFinancePledgingContractPositionFetcher } from './cronos/argo-finance.pledging.contract-position-fetcher'; +import { CronosArgoFinancePledgingTokenFetcher } from './cronos/argo-finance.pledging.token-fetcher'; + +@Register.AppModule({ + appId: ARGO_FINANCE_DEFINITION.id, + providers: [ + ArgoFinanceAppDefinition, + ArgoFinanceContractFactory, + CronosArgoFinanceBalanceFetcher, + CronosArgoFinancePledgingContractPositionFetcher, + CronosArgoFinancePledgingTokenFetcher, + ], +}) +export class ArgoFinanceAppModule extends AbstractApp() {} diff --git a/src/apps/argo-finance/contracts/abis/x-argo-pledging.json b/src/apps/argo-finance/contracts/abis/x-argo-pledging.json new file mode 100644 index 000000000..dc6c98a59 --- /dev/null +++ b/src/apps/argo-finance/contracts/abis/x-argo-pledging.json @@ -0,0 +1,1177 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "EmergencyWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardsToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address", + "name": "_stakingToken", + "type": "address" + } + ], + "name": "__xArgoPledging_init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "_balances", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardsToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_distributor", + "type": "address" + } + ], + "name": "addReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardsToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_distributor", + "type": "address" + }, + { + "internalType": "bool", + "name": "_approved", + "type": "bool" + } + ], + "name": "approveRewardDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "bonusEndBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "claimableRewards", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct xArgoPledging.RewardData[]", + "name": "_rewards", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "emergencyWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardsToken", + "type": "address" + } + ], + "name": "getRewardForDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getUserMaxMorale", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getUserMorale", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getUserxArgoPledged", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardsToken", + "type": "address" + } + ], + "name": "lastTimeRewardApplicable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_rewardPerBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_endBlock", + "type": "uint256" + } + ], + "name": "modifyEmissions", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardsToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "pendingReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "pledge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "poolInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "lastRewardBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accRewardPerShare", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rateMRLE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardData", + "outputs": [ + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardDistributors", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardsToken", + "type": "address" + } + ], + "name": "rewardPerToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewardTokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_rate", + "type": "uint256" + } + ], + "name": "setMORALERate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_startTime", + "type": "uint256" + } + ], + "name": "setMORALEStartTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakingToken", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "startBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "startTimeMRLE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalxARGO", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "unpledge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "updatePool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "userMRLE", + "outputs": [ + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxMRLE", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountxArgo", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userRewardPerTokenPaid", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "wCRO", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "xARGO", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } +] diff --git a/src/apps/argo-finance/contracts/abis/x-argo.json b/src/apps/argo-finance/contracts/abis/x-argo.json new file mode 100644 index 000000000..e09053f89 --- /dev/null +++ b/src/apps/argo-finance/contracts/abis/x-argo.json @@ -0,0 +1,358 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_argoStaking", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "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": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Minted", + "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" + }, + { + "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": [], + "name": "argoStaking", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "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": "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": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mintTo", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/apps/argo-finance/contracts/ethers/XArgo.ts b/src/apps/argo-finance/contracts/ethers/XArgo.ts new file mode 100644 index 000000000..2f5f28eef --- /dev/null +++ b/src/apps/argo-finance/contracts/ethers/XArgo.ts @@ -0,0 +1,413 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from 'ethers'; +import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; + +export interface XArgoInterface extends utils.Interface { + functions: { + 'allowance(address,address)': FunctionFragment; + 'approve(address,uint256)': FunctionFragment; + 'argoStaking()': FunctionFragment; + 'balanceOf(address)': FunctionFragment; + 'burn(uint256)': FunctionFragment; + 'decimals()': FunctionFragment; + 'decreaseAllowance(address,uint256)': FunctionFragment; + 'increaseAllowance(address,uint256)': FunctionFragment; + 'mintTo(address,uint256)': FunctionFragment; + 'name()': FunctionFragment; + 'symbol()': FunctionFragment; + 'totalSupply()': FunctionFragment; + 'transfer(address,uint256)': FunctionFragment; + 'transferFrom(address,address,uint256)': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'allowance' + | 'approve' + | 'argoStaking' + | 'balanceOf' + | 'burn' + | 'decimals' + | 'decreaseAllowance' + | 'increaseAllowance' + | 'mintTo' + | 'name' + | 'symbol' + | 'totalSupply' + | 'transfer' + | 'transferFrom', + ): FunctionFragment; + + encodeFunctionData(functionFragment: 'allowance', values: [string, string]): string; + encodeFunctionData(functionFragment: 'approve', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'argoStaking', values?: undefined): string; + encodeFunctionData(functionFragment: 'balanceOf', values: [string]): string; + encodeFunctionData(functionFragment: 'burn', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'decimals', values?: undefined): string; + encodeFunctionData(functionFragment: 'decreaseAllowance', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'increaseAllowance', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'mintTo', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'name', values?: undefined): string; + encodeFunctionData(functionFragment: 'symbol', values?: undefined): string; + encodeFunctionData(functionFragment: 'totalSupply', values?: undefined): string; + encodeFunctionData(functionFragment: 'transfer', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'transferFrom', values: [string, string, BigNumberish]): string; + + decodeFunctionResult(functionFragment: 'allowance', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'approve', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'argoStaking', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'balanceOf', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'burn', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'decimals', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'decreaseAllowance', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'increaseAllowance', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'mintTo', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'name', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'symbol', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'totalSupply', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'transfer', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'transferFrom', data: BytesLike): Result; + + events: { + 'Approval(address,address,uint256)': EventFragment; + 'Minted(address,uint256)': EventFragment; + 'Transfer(address,address,uint256)': EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: 'Approval'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Minted'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Transfer'): EventFragment; +} + +export interface ApprovalEventObject { + owner: string; + spender: string; + value: BigNumber; +} +export type ApprovalEvent = TypedEvent<[string, string, BigNumber], ApprovalEventObject>; + +export type ApprovalEventFilter = TypedEventFilter; + +export interface MintedEventObject { + to: string; + amount: BigNumber; +} +export type MintedEvent = TypedEvent<[string, BigNumber], MintedEventObject>; + +export type MintedEventFilter = TypedEventFilter; + +export interface TransferEventObject { + from: string; + to: string; + value: BigNumber; +} +export type TransferEvent = TypedEvent<[string, string, BigNumber], TransferEventObject>; + +export type TransferEventFilter = TypedEventFilter; + +export interface XArgo extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: XArgoInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>; + + listeners(eventFilter?: TypedEventFilter): Array>; + listeners(eventName?: string): Array; + removeAllListeners(eventFilter: TypedEventFilter): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + argoStaking(overrides?: CallOverrides): Promise<[string]>; + + balanceOf(account: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + burn( + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + decimals(overrides?: CallOverrides): Promise<[number]>; + + decreaseAllowance( + spender: string, + subtractedValue: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + increaseAllowance( + spender: string, + addedValue: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + mintTo( + _to: string, + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + name(overrides?: CallOverrides): Promise<[string]>; + + symbol(overrides?: CallOverrides): Promise<[string]>; + + totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + }; + + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + argoStaking(overrides?: CallOverrides): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + burn(amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: string, + subtractedValue: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + increaseAllowance( + spender: string, + addedValue: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + mintTo( + _to: string, + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + callStatic: { + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise; + + approve(spender: string, amount: BigNumberish, overrides?: CallOverrides): Promise; + + argoStaking(overrides?: CallOverrides): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + burn(amount: BigNumberish, overrides?: CallOverrides): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance(spender: string, subtractedValue: BigNumberish, overrides?: CallOverrides): Promise; + + increaseAllowance(spender: string, addedValue: BigNumberish, overrides?: CallOverrides): Promise; + + mintTo(_to: string, _amount: BigNumberish, overrides?: CallOverrides): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer(to: string, amount: BigNumberish, overrides?: CallOverrides): Promise; + + transferFrom(from: string, to: string, amount: BigNumberish, overrides?: CallOverrides): Promise; + }; + + filters: { + 'Approval(address,address,uint256)'( + owner?: string | null, + spender?: string | null, + value?: null, + ): ApprovalEventFilter; + Approval(owner?: string | null, spender?: string | null, value?: null): ApprovalEventFilter; + + 'Minted(address,uint256)'(to?: null, amount?: null): MintedEventFilter; + Minted(to?: null, amount?: null): MintedEventFilter; + + 'Transfer(address,address,uint256)'(from?: string | null, to?: string | null, value?: null): TransferEventFilter; + Transfer(from?: string | null, to?: string | null, value?: null): TransferEventFilter; + }; + + estimateGas: { + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + argoStaking(overrides?: CallOverrides): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + burn(amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: string, + subtractedValue: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + increaseAllowance( + spender: string, + addedValue: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + mintTo( + _to: string, + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + }; + + populateTransaction: { + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + argoStaking(overrides?: CallOverrides): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + burn( + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: string, + subtractedValue: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + increaseAllowance( + spender: string, + addedValue: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + mintTo( + _to: string, + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + }; +} diff --git a/src/apps/argo-finance/contracts/ethers/XArgoPledging.ts b/src/apps/argo-finance/contracts/ethers/XArgoPledging.ts new file mode 100644 index 000000000..88b3d280f --- /dev/null +++ b/src/apps/argo-finance/contracts/ethers/XArgoPledging.ts @@ -0,0 +1,1297 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PayableOverrides, + PopulatedTransaction, + Signer, + utils, +} from 'ethers'; +import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; + +export declare namespace XArgoPledging { + export type RewardDataStruct = { token: string; amount: BigNumberish }; + + export type RewardDataStructOutput = [string, BigNumber] & { + token: string; + amount: BigNumber; + }; +} + +export interface XArgoPledgingInterface extends utils.Interface { + functions: { + 'admin()': FunctionFragment; + 'implementation()': FunctionFragment; + 'upgradeTo(address)': FunctionFragment; + 'upgradeToAndCall(address,bytes)': FunctionFragment; + 'DEFAULT_ADMIN_ROLE()': FunctionFragment; + '__xArgoPledging_init(address,address)': FunctionFragment; + '_balances(address)': FunctionFragment; + 'addReward(address,address)': FunctionFragment; + 'approveRewardDistributor(address,address,bool)': FunctionFragment; + 'bonusEndBlock()': FunctionFragment; + 'claimableRewards(address)': FunctionFragment; + 'emergencyWithdraw()': FunctionFragment; + 'getReward()': FunctionFragment; + 'getRewardForDuration(address)': FunctionFragment; + 'getRoleAdmin(bytes32)': FunctionFragment; + 'getUserMaxMorale()': FunctionFragment; + 'getUserMorale()': FunctionFragment; + 'getUserxArgoPledged()': FunctionFragment; + 'grantRole(bytes32,address)': FunctionFragment; + 'hasRole(bytes32,address)': FunctionFragment; + 'lastTimeRewardApplicable(address)': FunctionFragment; + 'modifyEmissions(uint256,uint256,uint256)': FunctionFragment; + 'notifyRewardAmount(address,uint256)': FunctionFragment; + 'paused()': FunctionFragment; + 'pendingReward(address)': FunctionFragment; + 'pledge(uint256)': FunctionFragment; + 'poolInfo()': FunctionFragment; + 'rateMRLE()': FunctionFragment; + 'renounceRole(bytes32,address)': FunctionFragment; + 'revokeRole(bytes32,address)': FunctionFragment; + 'rewardData(address)': FunctionFragment; + 'rewardDistributors(address,address)': FunctionFragment; + 'rewardPerBlock()': FunctionFragment; + 'rewardPerToken(address)': FunctionFragment; + 'rewardTokens(uint256)': FunctionFragment; + 'rewards(address,address)': FunctionFragment; + 'rewardsDuration()': FunctionFragment; + 'setMORALERate(uint256)': FunctionFragment; + 'setMORALEStartTime(uint256)': FunctionFragment; + 'stakingToken()': FunctionFragment; + 'startBlock()': FunctionFragment; + 'startTimeMRLE()': FunctionFragment; + 'supportsInterface(bytes4)': FunctionFragment; + 'totalSupply()': FunctionFragment; + 'totalxARGO()': FunctionFragment; + 'unpledge(uint256)': FunctionFragment; + 'updatePool()': FunctionFragment; + 'userInfo(address)': FunctionFragment; + 'userMRLE(address,uint256)': FunctionFragment; + 'userRewardPerTokenPaid(address,address)': FunctionFragment; + 'wCRO()': FunctionFragment; + 'xARGO()': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'admin' + | 'implementation' + | 'upgradeTo' + | 'upgradeToAndCall' + | 'DEFAULT_ADMIN_ROLE' + | '__xArgoPledging_init' + | '_balances' + | 'addReward' + | 'approveRewardDistributor' + | 'bonusEndBlock' + | 'claimableRewards' + | 'emergencyWithdraw' + | 'getReward' + | 'getRewardForDuration' + | 'getRoleAdmin' + | 'getUserMaxMorale' + | 'getUserMorale' + | 'getUserxArgoPledged' + | 'grantRole' + | 'hasRole' + | 'lastTimeRewardApplicable' + | 'modifyEmissions' + | 'notifyRewardAmount' + | 'paused' + | 'pendingReward' + | 'pledge' + | 'poolInfo' + | 'rateMRLE' + | 'renounceRole' + | 'revokeRole' + | 'rewardData' + | 'rewardDistributors' + | 'rewardPerBlock' + | 'rewardPerToken' + | 'rewardTokens' + | 'rewards' + | 'rewardsDuration' + | 'setMORALERate' + | 'setMORALEStartTime' + | 'stakingToken' + | 'startBlock' + | 'startTimeMRLE' + | 'supportsInterface' + | 'totalSupply' + | 'totalxARGO' + | 'unpledge' + | 'updatePool' + | 'userInfo' + | 'userMRLE' + | 'userRewardPerTokenPaid' + | 'wCRO' + | 'xARGO', + ): FunctionFragment; + + encodeFunctionData(functionFragment: 'admin', values?: undefined): string; + encodeFunctionData(functionFragment: 'implementation', values?: undefined): string; + encodeFunctionData(functionFragment: 'upgradeTo', values: [string]): string; + encodeFunctionData(functionFragment: 'upgradeToAndCall', values: [string, BytesLike]): string; + encodeFunctionData(functionFragment: 'DEFAULT_ADMIN_ROLE', values?: undefined): string; + encodeFunctionData(functionFragment: '__xArgoPledging_init', values: [string, string]): string; + encodeFunctionData(functionFragment: '_balances', values: [string]): string; + encodeFunctionData(functionFragment: 'addReward', values: [string, string]): string; + encodeFunctionData(functionFragment: 'approveRewardDistributor', values: [string, string, boolean]): string; + encodeFunctionData(functionFragment: 'bonusEndBlock', values?: undefined): string; + encodeFunctionData(functionFragment: 'claimableRewards', values: [string]): string; + encodeFunctionData(functionFragment: 'emergencyWithdraw', values?: undefined): string; + encodeFunctionData(functionFragment: 'getReward', values?: undefined): string; + encodeFunctionData(functionFragment: 'getRewardForDuration', values: [string]): string; + encodeFunctionData(functionFragment: 'getRoleAdmin', values: [BytesLike]): string; + encodeFunctionData(functionFragment: 'getUserMaxMorale', values?: undefined): string; + encodeFunctionData(functionFragment: 'getUserMorale', values?: undefined): string; + encodeFunctionData(functionFragment: 'getUserxArgoPledged', values?: undefined): string; + encodeFunctionData(functionFragment: 'grantRole', values: [BytesLike, string]): string; + encodeFunctionData(functionFragment: 'hasRole', values: [BytesLike, string]): string; + encodeFunctionData(functionFragment: 'lastTimeRewardApplicable', values: [string]): string; + encodeFunctionData(functionFragment: 'modifyEmissions', values: [BigNumberish, BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: 'notifyRewardAmount', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'paused', values?: undefined): string; + encodeFunctionData(functionFragment: 'pendingReward', values: [string]): string; + encodeFunctionData(functionFragment: 'pledge', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'poolInfo', values?: undefined): string; + encodeFunctionData(functionFragment: 'rateMRLE', values?: undefined): string; + encodeFunctionData(functionFragment: 'renounceRole', values: [BytesLike, string]): string; + encodeFunctionData(functionFragment: 'revokeRole', values: [BytesLike, string]): string; + encodeFunctionData(functionFragment: 'rewardData', values: [string]): string; + encodeFunctionData(functionFragment: 'rewardDistributors', values: [string, string]): string; + encodeFunctionData(functionFragment: 'rewardPerBlock', values?: undefined): string; + encodeFunctionData(functionFragment: 'rewardPerToken', values: [string]): string; + encodeFunctionData(functionFragment: 'rewardTokens', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'rewards', values: [string, string]): string; + encodeFunctionData(functionFragment: 'rewardsDuration', values?: undefined): string; + encodeFunctionData(functionFragment: 'setMORALERate', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'setMORALEStartTime', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'stakingToken', values?: undefined): string; + encodeFunctionData(functionFragment: 'startBlock', values?: undefined): string; + encodeFunctionData(functionFragment: 'startTimeMRLE', values?: undefined): string; + encodeFunctionData(functionFragment: 'supportsInterface', values: [BytesLike]): string; + encodeFunctionData(functionFragment: 'totalSupply', values?: undefined): string; + encodeFunctionData(functionFragment: 'totalxARGO', values?: undefined): string; + encodeFunctionData(functionFragment: 'unpledge', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'updatePool', values?: undefined): string; + encodeFunctionData(functionFragment: 'userInfo', values: [string]): string; + encodeFunctionData(functionFragment: 'userMRLE', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'userRewardPerTokenPaid', values: [string, string]): string; + encodeFunctionData(functionFragment: 'wCRO', values?: undefined): string; + encodeFunctionData(functionFragment: 'xARGO', values?: undefined): string; + + decodeFunctionResult(functionFragment: 'admin', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'implementation', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'upgradeTo', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'upgradeToAndCall', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'DEFAULT_ADMIN_ROLE', data: BytesLike): Result; + decodeFunctionResult(functionFragment: '__xArgoPledging_init', data: BytesLike): Result; + decodeFunctionResult(functionFragment: '_balances', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'addReward', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'approveRewardDistributor', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'bonusEndBlock', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'claimableRewards', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'emergencyWithdraw', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getReward', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getRewardForDuration', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getRoleAdmin', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getUserMaxMorale', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getUserMorale', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getUserxArgoPledged', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'grantRole', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'hasRole', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'lastTimeRewardApplicable', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'modifyEmissions', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'notifyRewardAmount', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'paused', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'pendingReward', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'pledge', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'poolInfo', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rateMRLE', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'renounceRole', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'revokeRole', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rewardData', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rewardDistributors', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rewardPerBlock', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rewardPerToken', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rewardTokens', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rewards', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'rewardsDuration', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setMORALERate', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setMORALEStartTime', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'stakingToken', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'startBlock', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'startTimeMRLE', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'supportsInterface', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'totalSupply', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'totalxARGO', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'unpledge', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'updatePool', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'userInfo', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'userMRLE', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'userRewardPerTokenPaid', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'wCRO', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'xARGO', data: BytesLike): Result; + + events: { + 'Upgraded(address)': EventFragment; + 'Deposit(address,uint256)': EventFragment; + 'EmergencyWithdraw(address,uint256)': EventFragment; + 'Paused(address)': EventFragment; + 'RewardAdded(uint256)': EventFragment; + 'RewardPaid(address,address,uint256)': EventFragment; + 'RoleAdminChanged(bytes32,bytes32,bytes32)': EventFragment; + 'RoleGranted(bytes32,address,address)': EventFragment; + 'RoleRevoked(bytes32,address,address)': EventFragment; + 'Staked(address,uint256)': EventFragment; + 'Unpaused(address)': EventFragment; + 'Withdraw(address,uint256)': EventFragment; + 'Withdrawn(address,uint256)': EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: 'Upgraded'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Deposit'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'EmergencyWithdraw'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Paused'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'RewardAdded'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'RewardPaid'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'RoleAdminChanged'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'RoleGranted'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'RoleRevoked'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Staked'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Unpaused'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Withdraw'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Withdrawn'): EventFragment; +} + +export interface UpgradedEventObject { + implementation: string; +} +export type UpgradedEvent = TypedEvent<[string], UpgradedEventObject>; + +export type UpgradedEventFilter = TypedEventFilter; + +export interface DepositEventObject { + user: string; + amount: BigNumber; +} +export type DepositEvent = TypedEvent<[string, BigNumber], DepositEventObject>; + +export type DepositEventFilter = TypedEventFilter; + +export interface EmergencyWithdrawEventObject { + user: string; + amount: BigNumber; +} +export type EmergencyWithdrawEvent = TypedEvent<[string, BigNumber], EmergencyWithdrawEventObject>; + +export type EmergencyWithdrawEventFilter = TypedEventFilter; + +export interface PausedEventObject { + account: string; +} +export type PausedEvent = TypedEvent<[string], PausedEventObject>; + +export type PausedEventFilter = TypedEventFilter; + +export interface RewardAddedEventObject { + reward: BigNumber; +} +export type RewardAddedEvent = TypedEvent<[BigNumber], RewardAddedEventObject>; + +export type RewardAddedEventFilter = TypedEventFilter; + +export interface RewardPaidEventObject { + user: string; + rewardsToken: string; + reward: BigNumber; +} +export type RewardPaidEvent = TypedEvent<[string, string, BigNumber], RewardPaidEventObject>; + +export type RewardPaidEventFilter = TypedEventFilter; + +export interface RoleAdminChangedEventObject { + role: string; + previousAdminRole: string; + newAdminRole: string; +} +export type RoleAdminChangedEvent = TypedEvent<[string, string, string], RoleAdminChangedEventObject>; + +export type RoleAdminChangedEventFilter = TypedEventFilter; + +export interface RoleGrantedEventObject { + role: string; + account: string; + sender: string; +} +export type RoleGrantedEvent = TypedEvent<[string, string, string], RoleGrantedEventObject>; + +export type RoleGrantedEventFilter = TypedEventFilter; + +export interface RoleRevokedEventObject { + role: string; + account: string; + sender: string; +} +export type RoleRevokedEvent = TypedEvent<[string, string, string], RoleRevokedEventObject>; + +export type RoleRevokedEventFilter = TypedEventFilter; + +export interface StakedEventObject { + user: string; + amount: BigNumber; +} +export type StakedEvent = TypedEvent<[string, BigNumber], StakedEventObject>; + +export type StakedEventFilter = TypedEventFilter; + +export interface UnpausedEventObject { + account: string; +} +export type UnpausedEvent = TypedEvent<[string], UnpausedEventObject>; + +export type UnpausedEventFilter = TypedEventFilter; + +export interface WithdrawEventObject { + user: string; + amount: BigNumber; +} +export type WithdrawEvent = TypedEvent<[string, BigNumber], WithdrawEventObject>; + +export type WithdrawEventFilter = TypedEventFilter; + +export interface WithdrawnEventObject { + user: string; + amount: BigNumber; +} +export type WithdrawnEvent = TypedEvent<[string, BigNumber], WithdrawnEventObject>; + +export type WithdrawnEventFilter = TypedEventFilter; + +export interface XArgoPledging extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: XArgoPledgingInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined, + ): Promise>; + + listeners(eventFilter?: TypedEventFilter): Array>; + listeners(eventName?: string): Array; + removeAllListeners(eventFilter: TypedEventFilter): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + admin(overrides?: Overrides & { from?: string | Promise }): Promise; + + implementation(overrides?: Overrides & { from?: string | Promise }): Promise; + + upgradeTo( + newImplementation: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + upgradeToAndCall( + newImplementation: string, + data: BytesLike, + overrides?: PayableOverrides & { from?: string | Promise }, + ): Promise; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise<[string]>; + + __xArgoPledging_init( + _admin: string, + _stakingToken: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + _balances(arg0: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + addReward( + _rewardsToken: string, + _distributor: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + approveRewardDistributor( + _rewardsToken: string, + _distributor: string, + _approved: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + bonusEndBlock(overrides?: CallOverrides): Promise<[BigNumber]>; + + claimableRewards( + account: string, + overrides?: CallOverrides, + ): Promise< + [XArgoPledging.RewardDataStructOutput[]] & { + _rewards: XArgoPledging.RewardDataStructOutput[]; + } + >; + + emergencyWithdraw(overrides?: Overrides & { from?: string | Promise }): Promise; + + getReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + getRewardForDuration(_rewardsToken: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise<[string]>; + + getUserMaxMorale(overrides?: CallOverrides): Promise<[BigNumber]>; + + getUserMorale(overrides?: CallOverrides): Promise<[BigNumber]>; + + getUserxArgoPledged(overrides?: CallOverrides): Promise<[BigNumber]>; + + grantRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + hasRole(role: BytesLike, account: string, overrides?: CallOverrides): Promise<[boolean]>; + + lastTimeRewardApplicable(_rewardsToken: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + modifyEmissions( + _rewardPerBlock: BigNumberish, + _startBlock: BigNumberish, + _endBlock: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + notifyRewardAmount( + _rewardsToken: string, + reward: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + paused(overrides?: CallOverrides): Promise<[boolean]>; + + pendingReward(_user: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + pledge( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + poolInfo(overrides?: CallOverrides): Promise< + [BigNumber, BigNumber] & { + lastRewardBlock: BigNumber; + accRewardPerShare: BigNumber; + } + >; + + rateMRLE(overrides?: CallOverrides): Promise<[BigNumber]>; + + renounceRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + revokeRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + rewardData( + arg0: string, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber, BigNumber] & { + periodFinish: BigNumber; + rewardRate: BigNumber; + lastUpdateTime: BigNumber; + rewardPerTokenStored: BigNumber; + } + >; + + rewardDistributors(arg0: string, arg1: string, overrides?: CallOverrides): Promise<[boolean]>; + + rewardPerBlock(overrides?: CallOverrides): Promise<[BigNumber]>; + + rewardPerToken(_rewardsToken: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + rewardTokens(arg0: BigNumberish, overrides?: CallOverrides): Promise<[string]>; + + rewards(arg0: string, arg1: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + rewardsDuration(overrides?: CallOverrides): Promise<[BigNumber]>; + + setMORALERate( + _rate: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + setMORALEStartTime( + _startTime: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + stakingToken(overrides?: CallOverrides): Promise<[string]>; + + startBlock(overrides?: CallOverrides): Promise<[BigNumber]>; + + startTimeMRLE(overrides?: CallOverrides): Promise<[BigNumber]>; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise<[boolean]>; + + totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + + totalxARGO(overrides?: CallOverrides): Promise<[BigNumber]>; + + unpledge( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + updatePool(overrides?: Overrides & { from?: string | Promise }): Promise; + + userInfo( + arg0: string, + overrides?: CallOverrides, + ): Promise<[BigNumber, BigNumber] & { amount: BigNumber; rewardDebt: BigNumber }>; + + userMRLE( + arg0: string, + arg1: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber] & { + startTime: BigNumber; + maxMRLE: BigNumber; + amountxArgo: BigNumber; + } + >; + + userRewardPerTokenPaid(arg0: string, arg1: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + wCRO(overrides?: CallOverrides): Promise<[string]>; + + xARGO(overrides?: CallOverrides): Promise<[string]>; + }; + + admin(overrides?: Overrides & { from?: string | Promise }): Promise; + + implementation(overrides?: Overrides & { from?: string | Promise }): Promise; + + upgradeTo( + newImplementation: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + upgradeToAndCall( + newImplementation: string, + data: BytesLike, + overrides?: PayableOverrides & { from?: string | Promise }, + ): Promise; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise; + + __xArgoPledging_init( + _admin: string, + _stakingToken: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + _balances(arg0: string, overrides?: CallOverrides): Promise; + + addReward( + _rewardsToken: string, + _distributor: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + approveRewardDistributor( + _rewardsToken: string, + _distributor: string, + _approved: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + bonusEndBlock(overrides?: CallOverrides): Promise; + + claimableRewards(account: string, overrides?: CallOverrides): Promise; + + emergencyWithdraw(overrides?: Overrides & { from?: string | Promise }): Promise; + + getReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + getRewardForDuration(_rewardsToken: string, overrides?: CallOverrides): Promise; + + getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise; + + getUserMaxMorale(overrides?: CallOverrides): Promise; + + getUserMorale(overrides?: CallOverrides): Promise; + + getUserxArgoPledged(overrides?: CallOverrides): Promise; + + grantRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + hasRole(role: BytesLike, account: string, overrides?: CallOverrides): Promise; + + lastTimeRewardApplicable(_rewardsToken: string, overrides?: CallOverrides): Promise; + + modifyEmissions( + _rewardPerBlock: BigNumberish, + _startBlock: BigNumberish, + _endBlock: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + notifyRewardAmount( + _rewardsToken: string, + reward: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + paused(overrides?: CallOverrides): Promise; + + pendingReward(_user: string, overrides?: CallOverrides): Promise; + + pledge( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + poolInfo(overrides?: CallOverrides): Promise< + [BigNumber, BigNumber] & { + lastRewardBlock: BigNumber; + accRewardPerShare: BigNumber; + } + >; + + rateMRLE(overrides?: CallOverrides): Promise; + + renounceRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + revokeRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + rewardData( + arg0: string, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber, BigNumber] & { + periodFinish: BigNumber; + rewardRate: BigNumber; + lastUpdateTime: BigNumber; + rewardPerTokenStored: BigNumber; + } + >; + + rewardDistributors(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + rewardPerBlock(overrides?: CallOverrides): Promise; + + rewardPerToken(_rewardsToken: string, overrides?: CallOverrides): Promise; + + rewardTokens(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + rewards(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + rewardsDuration(overrides?: CallOverrides): Promise; + + setMORALERate( + _rate: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + setMORALEStartTime( + _startTime: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + stakingToken(overrides?: CallOverrides): Promise; + + startBlock(overrides?: CallOverrides): Promise; + + startTimeMRLE(overrides?: CallOverrides): Promise; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + totalxARGO(overrides?: CallOverrides): Promise; + + unpledge( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + updatePool(overrides?: Overrides & { from?: string | Promise }): Promise; + + userInfo( + arg0: string, + overrides?: CallOverrides, + ): Promise<[BigNumber, BigNumber] & { amount: BigNumber; rewardDebt: BigNumber }>; + + userMRLE( + arg0: string, + arg1: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber] & { + startTime: BigNumber; + maxMRLE: BigNumber; + amountxArgo: BigNumber; + } + >; + + userRewardPerTokenPaid(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + wCRO(overrides?: CallOverrides): Promise; + + xARGO(overrides?: CallOverrides): Promise; + + callStatic: { + admin(overrides?: CallOverrides): Promise; + + implementation(overrides?: CallOverrides): Promise; + + upgradeTo(newImplementation: string, overrides?: CallOverrides): Promise; + + upgradeToAndCall(newImplementation: string, data: BytesLike, overrides?: CallOverrides): Promise; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise; + + __xArgoPledging_init(_admin: string, _stakingToken: string, overrides?: CallOverrides): Promise; + + _balances(arg0: string, overrides?: CallOverrides): Promise; + + addReward(_rewardsToken: string, _distributor: string, overrides?: CallOverrides): Promise; + + approveRewardDistributor( + _rewardsToken: string, + _distributor: string, + _approved: boolean, + overrides?: CallOverrides, + ): Promise; + + bonusEndBlock(overrides?: CallOverrides): Promise; + + claimableRewards(account: string, overrides?: CallOverrides): Promise; + + emergencyWithdraw(overrides?: CallOverrides): Promise; + + getReward(overrides?: CallOverrides): Promise; + + getRewardForDuration(_rewardsToken: string, overrides?: CallOverrides): Promise; + + getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise; + + getUserMaxMorale(overrides?: CallOverrides): Promise; + + getUserMorale(overrides?: CallOverrides): Promise; + + getUserxArgoPledged(overrides?: CallOverrides): Promise; + + grantRole(role: BytesLike, account: string, overrides?: CallOverrides): Promise; + + hasRole(role: BytesLike, account: string, overrides?: CallOverrides): Promise; + + lastTimeRewardApplicable(_rewardsToken: string, overrides?: CallOverrides): Promise; + + modifyEmissions( + _rewardPerBlock: BigNumberish, + _startBlock: BigNumberish, + _endBlock: BigNumberish, + overrides?: CallOverrides, + ): Promise; + + notifyRewardAmount(_rewardsToken: string, reward: BigNumberish, overrides?: CallOverrides): Promise; + + paused(overrides?: CallOverrides): Promise; + + pendingReward(_user: string, overrides?: CallOverrides): Promise; + + pledge(_amount: BigNumberish, overrides?: CallOverrides): Promise; + + poolInfo(overrides?: CallOverrides): Promise< + [BigNumber, BigNumber] & { + lastRewardBlock: BigNumber; + accRewardPerShare: BigNumber; + } + >; + + rateMRLE(overrides?: CallOverrides): Promise; + + renounceRole(role: BytesLike, account: string, overrides?: CallOverrides): Promise; + + revokeRole(role: BytesLike, account: string, overrides?: CallOverrides): Promise; + + rewardData( + arg0: string, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber, BigNumber] & { + periodFinish: BigNumber; + rewardRate: BigNumber; + lastUpdateTime: BigNumber; + rewardPerTokenStored: BigNumber; + } + >; + + rewardDistributors(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + rewardPerBlock(overrides?: CallOverrides): Promise; + + rewardPerToken(_rewardsToken: string, overrides?: CallOverrides): Promise; + + rewardTokens(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + rewards(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + rewardsDuration(overrides?: CallOverrides): Promise; + + setMORALERate(_rate: BigNumberish, overrides?: CallOverrides): Promise; + + setMORALEStartTime(_startTime: BigNumberish, overrides?: CallOverrides): Promise; + + stakingToken(overrides?: CallOverrides): Promise; + + startBlock(overrides?: CallOverrides): Promise; + + startTimeMRLE(overrides?: CallOverrides): Promise; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + totalxARGO(overrides?: CallOverrides): Promise; + + unpledge(_amount: BigNumberish, overrides?: CallOverrides): Promise; + + updatePool(overrides?: CallOverrides): Promise; + + userInfo( + arg0: string, + overrides?: CallOverrides, + ): Promise<[BigNumber, BigNumber] & { amount: BigNumber; rewardDebt: BigNumber }>; + + userMRLE( + arg0: string, + arg1: BigNumberish, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber] & { + startTime: BigNumber; + maxMRLE: BigNumber; + amountxArgo: BigNumber; + } + >; + + userRewardPerTokenPaid(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + wCRO(overrides?: CallOverrides): Promise; + + xARGO(overrides?: CallOverrides): Promise; + }; + + filters: { + 'Upgraded(address)'(implementation?: string | null): UpgradedEventFilter; + Upgraded(implementation?: string | null): UpgradedEventFilter; + + 'Deposit(address,uint256)'(user?: string | null, amount?: null): DepositEventFilter; + Deposit(user?: string | null, amount?: null): DepositEventFilter; + + 'EmergencyWithdraw(address,uint256)'(user?: string | null, amount?: null): EmergencyWithdrawEventFilter; + EmergencyWithdraw(user?: string | null, amount?: null): EmergencyWithdrawEventFilter; + + 'Paused(address)'(account?: null): PausedEventFilter; + Paused(account?: null): PausedEventFilter; + + 'RewardAdded(uint256)'(reward?: null): RewardAddedEventFilter; + RewardAdded(reward?: null): RewardAddedEventFilter; + + 'RewardPaid(address,address,uint256)'( + user?: string | null, + rewardsToken?: string | null, + reward?: null, + ): RewardPaidEventFilter; + RewardPaid(user?: string | null, rewardsToken?: string | null, reward?: null): RewardPaidEventFilter; + + 'RoleAdminChanged(bytes32,bytes32,bytes32)'( + role?: BytesLike | null, + previousAdminRole?: BytesLike | null, + newAdminRole?: BytesLike | null, + ): RoleAdminChangedEventFilter; + RoleAdminChanged( + role?: BytesLike | null, + previousAdminRole?: BytesLike | null, + newAdminRole?: BytesLike | null, + ): RoleAdminChangedEventFilter; + + 'RoleGranted(bytes32,address,address)'( + role?: BytesLike | null, + account?: string | null, + sender?: string | null, + ): RoleGrantedEventFilter; + RoleGranted(role?: BytesLike | null, account?: string | null, sender?: string | null): RoleGrantedEventFilter; + + 'RoleRevoked(bytes32,address,address)'( + role?: BytesLike | null, + account?: string | null, + sender?: string | null, + ): RoleRevokedEventFilter; + RoleRevoked(role?: BytesLike | null, account?: string | null, sender?: string | null): RoleRevokedEventFilter; + + 'Staked(address,uint256)'(user?: string | null, amount?: null): StakedEventFilter; + Staked(user?: string | null, amount?: null): StakedEventFilter; + + 'Unpaused(address)'(account?: null): UnpausedEventFilter; + Unpaused(account?: null): UnpausedEventFilter; + + 'Withdraw(address,uint256)'(user?: string | null, amount?: null): WithdrawEventFilter; + Withdraw(user?: string | null, amount?: null): WithdrawEventFilter; + + 'Withdrawn(address,uint256)'(user?: string | null, amount?: null): WithdrawnEventFilter; + Withdrawn(user?: string | null, amount?: null): WithdrawnEventFilter; + }; + + estimateGas: { + admin(overrides?: Overrides & { from?: string | Promise }): Promise; + + implementation(overrides?: Overrides & { from?: string | Promise }): Promise; + + upgradeTo( + newImplementation: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + upgradeToAndCall( + newImplementation: string, + data: BytesLike, + overrides?: PayableOverrides & { from?: string | Promise }, + ): Promise; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise; + + __xArgoPledging_init( + _admin: string, + _stakingToken: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + _balances(arg0: string, overrides?: CallOverrides): Promise; + + addReward( + _rewardsToken: string, + _distributor: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + approveRewardDistributor( + _rewardsToken: string, + _distributor: string, + _approved: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + bonusEndBlock(overrides?: CallOverrides): Promise; + + claimableRewards(account: string, overrides?: CallOverrides): Promise; + + emergencyWithdraw(overrides?: Overrides & { from?: string | Promise }): Promise; + + getReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + getRewardForDuration(_rewardsToken: string, overrides?: CallOverrides): Promise; + + getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise; + + getUserMaxMorale(overrides?: CallOverrides): Promise; + + getUserMorale(overrides?: CallOverrides): Promise; + + getUserxArgoPledged(overrides?: CallOverrides): Promise; + + grantRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + hasRole(role: BytesLike, account: string, overrides?: CallOverrides): Promise; + + lastTimeRewardApplicable(_rewardsToken: string, overrides?: CallOverrides): Promise; + + modifyEmissions( + _rewardPerBlock: BigNumberish, + _startBlock: BigNumberish, + _endBlock: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + notifyRewardAmount( + _rewardsToken: string, + reward: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + paused(overrides?: CallOverrides): Promise; + + pendingReward(_user: string, overrides?: CallOverrides): Promise; + + pledge(_amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + poolInfo(overrides?: CallOverrides): Promise; + + rateMRLE(overrides?: CallOverrides): Promise; + + renounceRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + revokeRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + rewardData(arg0: string, overrides?: CallOverrides): Promise; + + rewardDistributors(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + rewardPerBlock(overrides?: CallOverrides): Promise; + + rewardPerToken(_rewardsToken: string, overrides?: CallOverrides): Promise; + + rewardTokens(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + rewards(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + rewardsDuration(overrides?: CallOverrides): Promise; + + setMORALERate(_rate: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + setMORALEStartTime( + _startTime: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + stakingToken(overrides?: CallOverrides): Promise; + + startBlock(overrides?: CallOverrides): Promise; + + startTimeMRLE(overrides?: CallOverrides): Promise; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + totalxARGO(overrides?: CallOverrides): Promise; + + unpledge(_amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + updatePool(overrides?: Overrides & { from?: string | Promise }): Promise; + + userInfo(arg0: string, overrides?: CallOverrides): Promise; + + userMRLE(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + userRewardPerTokenPaid(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + wCRO(overrides?: CallOverrides): Promise; + + xARGO(overrides?: CallOverrides): Promise; + }; + + populateTransaction: { + admin(overrides?: Overrides & { from?: string | Promise }): Promise; + + implementation(overrides?: Overrides & { from?: string | Promise }): Promise; + + upgradeTo( + newImplementation: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + upgradeToAndCall( + newImplementation: string, + data: BytesLike, + overrides?: PayableOverrides & { from?: string | Promise }, + ): Promise; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise; + + __xArgoPledging_init( + _admin: string, + _stakingToken: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + _balances(arg0: string, overrides?: CallOverrides): Promise; + + addReward( + _rewardsToken: string, + _distributor: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + approveRewardDistributor( + _rewardsToken: string, + _distributor: string, + _approved: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + bonusEndBlock(overrides?: CallOverrides): Promise; + + claimableRewards(account: string, overrides?: CallOverrides): Promise; + + emergencyWithdraw(overrides?: Overrides & { from?: string | Promise }): Promise; + + getReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + getRewardForDuration(_rewardsToken: string, overrides?: CallOverrides): Promise; + + getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise; + + getUserMaxMorale(overrides?: CallOverrides): Promise; + + getUserMorale(overrides?: CallOverrides): Promise; + + getUserxArgoPledged(overrides?: CallOverrides): Promise; + + grantRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + hasRole(role: BytesLike, account: string, overrides?: CallOverrides): Promise; + + lastTimeRewardApplicable(_rewardsToken: string, overrides?: CallOverrides): Promise; + + modifyEmissions( + _rewardPerBlock: BigNumberish, + _startBlock: BigNumberish, + _endBlock: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + notifyRewardAmount( + _rewardsToken: string, + reward: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + paused(overrides?: CallOverrides): Promise; + + pendingReward(_user: string, overrides?: CallOverrides): Promise; + + pledge( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + poolInfo(overrides?: CallOverrides): Promise; + + rateMRLE(overrides?: CallOverrides): Promise; + + renounceRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + revokeRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + rewardData(arg0: string, overrides?: CallOverrides): Promise; + + rewardDistributors(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + rewardPerBlock(overrides?: CallOverrides): Promise; + + rewardPerToken(_rewardsToken: string, overrides?: CallOverrides): Promise; + + rewardTokens(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + rewards(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + rewardsDuration(overrides?: CallOverrides): Promise; + + setMORALERate( + _rate: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + setMORALEStartTime( + _startTime: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + stakingToken(overrides?: CallOverrides): Promise; + + startBlock(overrides?: CallOverrides): Promise; + + startTimeMRLE(overrides?: CallOverrides): Promise; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + totalxARGO(overrides?: CallOverrides): Promise; + + unpledge( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + updatePool(overrides?: Overrides & { from?: string | Promise }): Promise; + + userInfo(arg0: string, overrides?: CallOverrides): Promise; + + userMRLE(arg0: string, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + userRewardPerTokenPaid(arg0: string, arg1: string, overrides?: CallOverrides): Promise; + + wCRO(overrides?: CallOverrides): Promise; + + xARGO(overrides?: CallOverrides): Promise; + }; +} diff --git a/src/apps/argo-finance/contracts/ethers/common.ts b/src/apps/argo-finance/contracts/ethers/common.ts new file mode 100644 index 000000000..6cfb10425 --- /dev/null +++ b/src/apps/argo-finance/contracts/ethers/common.ts @@ -0,0 +1,30 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { Listener } from '@ethersproject/providers'; +import type { Event, EventFilter } from 'ethers'; + +export interface TypedEvent = any, TArgsObject = any> extends Event { + args: TArgsArray & TArgsObject; +} + +export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {} + +export interface TypedListener { + (...listenerArg: [...__TypechainArgsArray, TEvent]): void; +} + +type __TypechainArgsArray = T extends TypedEvent ? U : never; + +export interface OnEvent { + (eventFilter: TypedEventFilter, listener: TypedListener): TRes; + (eventName: string, listener: Listener): TRes; +} + +export type MinEthersFactory = { + deploy(...a: ARGS[]): Promise; +}; + +export type GetContractTypeFromFactory = F extends MinEthersFactory ? C : never; + +export type GetARGsTypeFromFactory = F extends MinEthersFactory ? Parameters : never; diff --git a/src/apps/argo-finance/contracts/ethers/factories/XArgoPledging__factory.ts b/src/apps/argo-finance/contracts/ethers/factories/XArgoPledging__factory.ts new file mode 100644 index 000000000..86f8ac45d --- /dev/null +++ b/src/apps/argo-finance/contracts/ethers/factories/XArgoPledging__factory.ts @@ -0,0 +1,1195 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { XArgoPledging, XArgoPledgingInterface } from '../XArgoPledging'; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'implementation', + type: 'address', + }, + ], + name: 'Upgraded', + type: 'event', + }, + { + stateMutability: 'payable', + type: 'fallback', + }, + { + inputs: [], + name: 'admin', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'implementation', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newImplementation', + type: 'address', + }, + ], + name: 'upgradeTo', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newImplementation', + type: 'address', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'upgradeToAndCall', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + stateMutability: 'payable', + type: 'receive', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Deposit', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'EmergencyWithdraw', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'Paused', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'reward', + type: 'uint256', + }, + ], + name: 'RewardAdded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'rewardsToken', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'reward', + type: 'uint256', + }, + ], + name: 'RewardPaid', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'previousAdminRole', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'newAdminRole', + type: 'bytes32', + }, + ], + name: 'RoleAdminChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'RoleGranted', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'RoleRevoked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Staked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'Unpaused', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Withdraw', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Withdrawn', + type: 'event', + }, + { + inputs: [], + name: 'DEFAULT_ADMIN_ROLE', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_admin', + type: 'address', + }, + { + internalType: 'address', + name: '_stakingToken', + type: 'address', + }, + ], + name: '__xArgoPledging_init', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: '_balances', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_rewardsToken', + type: 'address', + }, + { + internalType: 'address', + name: '_distributor', + type: 'address', + }, + ], + name: 'addReward', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_rewardsToken', + type: 'address', + }, + { + internalType: 'address', + name: '_distributor', + type: 'address', + }, + { + internalType: 'bool', + name: '_approved', + type: 'bool', + }, + ], + name: 'approveRewardDistributor', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'bonusEndBlock', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'claimableRewards', + outputs: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + internalType: 'struct xArgoPledging.RewardData[]', + name: '_rewards', + type: 'tuple[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'emergencyWithdraw', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'getReward', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_rewardsToken', + type: 'address', + }, + ], + name: 'getRewardForDuration', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + ], + name: 'getRoleAdmin', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getUserMaxMorale', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getUserMorale', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getUserxArgoPledged', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'grantRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'hasRole', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_rewardsToken', + type: 'address', + }, + ], + name: 'lastTimeRewardApplicable', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_rewardPerBlock', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_startBlock', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_endBlock', + type: 'uint256', + }, + ], + name: 'modifyEmissions', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_rewardsToken', + type: 'address', + }, + { + internalType: 'uint256', + name: 'reward', + type: 'uint256', + }, + ], + name: 'notifyRewardAmount', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'paused', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_user', + type: 'address', + }, + ], + name: 'pendingReward', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'pledge', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'poolInfo', + outputs: [ + { + internalType: 'uint256', + name: 'lastRewardBlock', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'accRewardPerShare', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'rateMRLE', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'renounceRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'revokeRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'rewardData', + outputs: [ + { + internalType: 'uint256', + name: 'periodFinish', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'rewardRate', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'lastUpdateTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'rewardPerTokenStored', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'rewardDistributors', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'rewardPerBlock', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_rewardsToken', + type: 'address', + }, + ], + name: 'rewardPerToken', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'rewardTokens', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'rewards', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'rewardsDuration', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_rate', + type: 'uint256', + }, + ], + name: 'setMORALERate', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_startTime', + type: 'uint256', + }, + ], + name: 'setMORALEStartTime', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'stakingToken', + outputs: [ + { + internalType: 'contract IERC20Upgradeable', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'startBlock', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'startTimeMRLE', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes4', + name: 'interfaceId', + type: 'bytes4', + }, + ], + name: 'supportsInterface', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalxARGO', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'unpledge', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'updatePool', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'userInfo', + outputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'rewardDebt', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + name: 'userMRLE', + outputs: [ + { + internalType: 'uint256', + name: 'startTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'maxMRLE', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountxArgo', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'userRewardPerTokenPaid', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'wCRO', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'xARGO', + outputs: [ + { + internalType: 'contract IERC20Upgradeable', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'initialLogic', + type: 'address', + }, + { + internalType: 'address', + name: 'initialAdmin', + type: 'address', + }, + { + internalType: 'bytes', + name: '_data', + type: 'bytes', + }, + ], + stateMutability: 'payable', + type: 'constructor', + }, +]; + +export class XArgoPledging__factory { + static readonly abi = _abi; + static createInterface(): XArgoPledgingInterface { + return new utils.Interface(_abi) as XArgoPledgingInterface; + } + static connect(address: string, signerOrProvider: Signer | Provider): XArgoPledging { + return new Contract(address, _abi, signerOrProvider) as XArgoPledging; + } +} diff --git a/src/apps/argo-finance/contracts/ethers/factories/XArgo__factory.ts b/src/apps/argo-finance/contracts/ethers/factories/XArgo__factory.ts new file mode 100644 index 000000000..af19bc44e --- /dev/null +++ b/src/apps/argo-finance/contracts/ethers/factories/XArgo__factory.ts @@ -0,0 +1,376 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { XArgo, XArgoInterface } from '../XArgo'; + +const _abi = [ + { + inputs: [ + { + internalType: 'address', + name: '_argoStaking', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + 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: false, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Minted', + 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', + }, + { + 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: [], + name: 'argoStaking', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'burn', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + 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: '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: 'address', + name: '_to', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'mintTo', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'symbol', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'from', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, +]; + +export class XArgo__factory { + static readonly abi = _abi; + static createInterface(): XArgoInterface { + return new utils.Interface(_abi) as XArgoInterface; + } + static connect(address: string, signerOrProvider: Signer | Provider): XArgo { + return new Contract(address, _abi, signerOrProvider) as XArgo; + } +} diff --git a/src/apps/argo-finance/contracts/ethers/factories/index.ts b/src/apps/argo-finance/contracts/ethers/factories/index.ts new file mode 100644 index 000000000..f1e61f5a4 --- /dev/null +++ b/src/apps/argo-finance/contracts/ethers/factories/index.ts @@ -0,0 +1,5 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { XArgo__factory } from './XArgo__factory'; +export { XArgoPledging__factory } from './XArgoPledging__factory'; diff --git a/src/apps/argo-finance/contracts/ethers/index.ts b/src/apps/argo-finance/contracts/ethers/index.ts new file mode 100644 index 000000000..35d2f7b23 --- /dev/null +++ b/src/apps/argo-finance/contracts/ethers/index.ts @@ -0,0 +1,8 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { XArgo } from './XArgo'; +export type { XArgoPledging } from './XArgoPledging'; +export * as factories from './factories'; +export { XArgoPledging__factory } from './factories/XArgoPledging__factory'; +export { XArgo__factory } from './factories/XArgo__factory'; diff --git a/src/apps/argo-finance/contracts/index.ts b/src/apps/argo-finance/contracts/index.ts new file mode 100644 index 000000000..217d5795a --- /dev/null +++ b/src/apps/argo-finance/contracts/index.ts @@ -0,0 +1,28 @@ +import { Injectable, Inject } from '@nestjs/common'; + +import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; +import { ContractFactory } from '~contract/contracts'; +import { Network } from '~types/network.interface'; + +import { XArgo__factory } from './ethers'; +import { XArgoPledging__factory } from './ethers'; + +// eslint-disable-next-line +type ContractOpts = { address: string; network: Network }; + +@Injectable() +export class ArgoFinanceContractFactory extends ContractFactory { + constructor(@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit) { + super((network: Network) => appToolkit.getNetworkProvider(network)); + } + + xArgo({ address, network }: ContractOpts) { + return XArgo__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } + xArgoPledging({ address, network }: ContractOpts) { + return XArgoPledging__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } +} + +export type { XArgo } from './ethers'; +export type { XArgoPledging } from './ethers'; diff --git a/src/apps/argo-finance/cronos/argo-finance.balance-fetcher.ts b/src/apps/argo-finance/cronos/argo-finance.balance-fetcher.ts new file mode 100644 index 000000000..83944d2d1 --- /dev/null +++ b/src/apps/argo-finance/cronos/argo-finance.balance-fetcher.ts @@ -0,0 +1,71 @@ +import { Inject } from '@nestjs/common'; +import { drillBalance } from '~app-toolkit'; +import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; +import { Register } from '~app-toolkit/decorators'; +import { presentBalanceFetcherResponse } from '~app-toolkit/helpers/presentation/balance-fetcher-response.present'; +import { BalanceFetcher } from '~balance/balance-fetcher.interface'; +import { Network } from '~types/network.interface'; +import { isSupplied } from '~position/position.utils'; +import { ARGO_FINANCE_DEFINITION } from '../argo-finance.definition'; +import { ArgoFinanceContractFactory } from '../contracts'; +import { MetaType } from '~position/position.interface'; +import { ADDRESSES } from './consts'; + +const network = Network.CRONOS_MAINNET; + +@Register.BalanceFetcher(ARGO_FINANCE_DEFINITION.id, network) +export class CronosArgoFinanceBalanceFetcher implements BalanceFetcher { + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(ArgoFinanceContractFactory) private readonly argoFinanceContractFactory: ArgoFinanceContractFactory + ) { } + + async getFarmBalances(address: string) { + return this.appToolkit.helpers.contractPositionBalanceHelper.getContractPositionBalances( + { + address, + appId: ARGO_FINANCE_DEFINITION.id, + groupId: ARGO_FINANCE_DEFINITION.groups.pledging.id, + network, + resolveBalances: async ({ address, contractPosition, multicall }) => { + // Resolve the staked token and reward token from the contract position object + const stakedToken = contractPosition.tokens.find(isSupplied)!; + const rewardToken = contractPosition.tokens.find(token => token.symbol === "xARGO" && token.metaType === MetaType.CLAIMABLE)!; + const rewardToken2 = contractPosition.tokens.find(token => token.symbol === "WCRO")!; + // Instantiate an Ethers contract instance + const contract = this.argoFinanceContractFactory.xArgoPledging(contractPosition); + + // Resolve the requested address' staked balance and earned balance + const [stakedBalanceRaw, rewardBalanceRaw] = await Promise.all([ + multicall.wrap(contract)._balances(address), + multicall.wrap(contract).claimableRewards(address), + ]); + // Drill the balance into the token object. Drill will push the balance into the token tree, + // thereby showing the user's exposure to underlying tokens of the jar token! + return [ + drillBalance(stakedToken, stakedBalanceRaw.toString()), + drillBalance(rewardToken, rewardBalanceRaw.find( + (token) => token.token === "0xb966B5D6A0fCd5b373B180Bbe072BBFbbEe10552", + )!.amount.toString()), + drillBalance(rewardToken2, rewardBalanceRaw.find( + (token) => token.token === "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", + )!.amount.toString())!, + ]; + }, + } + ); + } + + async getBalances(address: string) { + const [farmBalances] = await Promise.all([ + this.getFarmBalances(address), + ]); + + return presentBalanceFetcherResponse([ + { + label: "Pledging", + assets: farmBalances, + }, + ]); + } +} diff --git a/src/apps/argo-finance/cronos/argo-finance.pledging.contract-position-fetcher.ts b/src/apps/argo-finance/cronos/argo-finance.pledging.contract-position-fetcher.ts new file mode 100644 index 000000000..fc372a297 --- /dev/null +++ b/src/apps/argo-finance/cronos/argo-finance.pledging.contract-position-fetcher.ts @@ -0,0 +1,76 @@ +import { Inject } from '@nestjs/common'; +import { XArgoPledging } from '../contracts'; +import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; +import { Register } from '~app-toolkit/decorators'; +import { PositionFetcher } from '~position/position-fetcher.interface'; +import { buildDollarDisplayItem } from '~app-toolkit/helpers/presentation/display-item.present'; +import { getImagesFromToken } from '~app-toolkit/helpers/presentation/image.present'; +import { ContractType } from '~position/contract.interface'; +import { ContractPosition } from '~position/position.interface'; +import { claimable, supplied } from "~position/position.utils"; +import { Network } from '~types/network.interface'; + +import { ARGO_FINANCE_DEFINITION } from '../argo-finance.definition'; +import { ArgoFinanceContractFactory } from '../contracts'; +import { ADDRESSES } from './consts'; + +const appId = ARGO_FINANCE_DEFINITION.id; +const groupId = ARGO_FINANCE_DEFINITION.groups.pledging.id; +const network = Network.CRONOS_MAINNET; + +@Register.ContractPositionFetcher({ appId, groupId, network }) +export class CronosArgoFinancePledgingContractPositionFetcher implements PositionFetcher { + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(ArgoFinanceContractFactory) private readonly argoFinanceContractFactory: ArgoFinanceContractFactory, + ) { } + + async getVePosition(address: string, baseAddress: string) { + const multicall = this.appToolkit.getMulticall(network); + const baseTokens = await this.appToolkit.getBaseTokenPrices(network); + const contractTokens = await this.appToolkit.getAppTokenPositions({ + appId, + groupIds: [groupId], + network, + }) + let baseToken = contractTokens.find(t => t.symbol === 'xARGO')!; + let croToken = baseTokens.find(t => t.symbol === "WCRO")!; + const veToken = multicall.wrap(this.appToolkit.globalContracts.erc20({ address, network })); + const [supplyRaw, decimals, symbol] = await Promise.all([ + veToken.totalSupply(), + veToken.decimals(), + veToken.symbol(), + ]); + const supply = Number(supplyRaw) / 10 ** decimals; + const pricePerShare = 1; // Note: Consult liquidity pools for peg once set up + const price = baseToken.price * pricePerShare; + const liquidity = supply * price; + + const tokens = [supplied(baseToken), claimable(baseToken), claimable(croToken)]; + const position: ContractPosition = + { + type: ContractType.POSITION, + appId, + groupId, + address: ADDRESSES.pledging, + network, + tokens, + dataProps: { + + }, + displayProps: { + label: "xARGO", + secondaryLabel: buildDollarDisplayItem(price), + images: getImagesFromToken(baseToken), + }, + }; + return position; + } + + async getPositions() { + const [argo] = await Promise.all([ + this.getVePosition(ADDRESSES.xargo, ADDRESSES.argo), + ]); + return [argo]; + } +} diff --git a/src/apps/argo-finance/cronos/argo-finance.pledging.token-fetcher.ts b/src/apps/argo-finance/cronos/argo-finance.pledging.token-fetcher.ts new file mode 100644 index 000000000..6e8922d0e --- /dev/null +++ b/src/apps/argo-finance/cronos/argo-finance.pledging.token-fetcher.ts @@ -0,0 +1,72 @@ +import { Inject } from '@nestjs/common'; + +import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; +import { Register } from '~app-toolkit/decorators'; +import { PositionFetcher } from '~position/position-fetcher.interface'; +import { buildDollarDisplayItem } from '~app-toolkit/helpers/presentation/display-item.present'; +import { getImagesFromToken } from '~app-toolkit/helpers/presentation/image.present'; +import { ContractType } from '~position/contract.interface'; +import { AppTokenPosition } from '~position/position.interface'; +import { Network } from '~types/network.interface'; + +import { ARGO_FINANCE_DEFINITION } from '../argo-finance.definition'; +import { ArgoFinanceContractFactory } from '../contracts'; + +import { ADDRESSES } from './consts'; + +const appId = ARGO_FINANCE_DEFINITION.id; +const groupId = ARGO_FINANCE_DEFINITION.groups.pledging.id; +const network = Network.CRONOS_MAINNET; + +@Register.TokenPositionFetcher({ appId, groupId, network }) +export class CronosArgoFinancePledgingTokenFetcher implements PositionFetcher { + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(ArgoFinanceContractFactory) private readonly argoFinanceContractFactory: ArgoFinanceContractFactory, + ) { } + + async getVePosition(address: string, baseAddress: string) { + const multicall = this.appToolkit.getMulticall(network); + const baseTokens = await this.appToolkit.getBaseTokenPrices(network); + const baseToken = baseTokens.find(t => t.address === baseAddress)!; + const veToken = multicall.wrap(this.appToolkit.globalContracts.erc20({ address, network })); + const [supplyRaw, decimals, symbol] = await Promise.all([ + veToken.totalSupply(), + veToken.decimals(), + veToken.symbol(), + ]); + const supply = Number(supplyRaw) / 10 ** decimals; + const pricePerShare = 1; // Note: Consult liquidity pools for peg once set up + const price = baseToken.price * pricePerShare; + const liquidity = supply * price; + + const token: AppTokenPosition = { + type: ContractType.APP_TOKEN, + appId, + groupId, + address, + network, + symbol, + decimals, + supply, + price, + pricePerShare, + tokens: [baseToken], + dataProps: { liquidity }, + displayProps: { + label: symbol, + secondaryLabel: buildDollarDisplayItem(price), + images: getImagesFromToken(baseToken), + statsItems: [{ label: 'Liquidity', value: buildDollarDisplayItem(liquidity) }], + }, + }; + return token; + } + + async getPositions() { + const [argo] = await Promise.all([ + this.getVePosition(ADDRESSES.xargo, ADDRESSES.argo), + ]); + return [argo]; + } +} diff --git a/src/apps/argo-finance/cronos/consts.ts b/src/apps/argo-finance/cronos/consts.ts new file mode 100644 index 000000000..8dedd0beb --- /dev/null +++ b/src/apps/argo-finance/cronos/consts.ts @@ -0,0 +1,5 @@ +export const ADDRESSES = { + argo: '0x47a9d630dc5b28f75d3af3be3aaa982512cd89aa'.toLowerCase(), + xargo: '0xb966B5D6A0fCd5b373B180Bbe072BBFbbEe10552'.toLowerCase(), + pledging: '0x1dE93ce995d1bC763c2422ba30b1E73dE4A45a01'.toLowerCase(), +}; diff --git a/src/apps/argo-finance/index.ts b/src/apps/argo-finance/index.ts new file mode 100644 index 000000000..7112f4dfa --- /dev/null +++ b/src/apps/argo-finance/index.ts @@ -0,0 +1,3 @@ +export { ARGO_FINANCE_DEFINITION, ArgoFinanceAppDefinition } from './argo-finance.definition'; +export { ArgoFinanceAppModule } from './argo-finance.module'; +export { ArgoFinanceContractFactory } from './contracts';