diff --git a/src/apps/abracadabra/abracadabra.definition.ts b/src/apps/abracadabra/abracadabra.definition.ts index 8eca6eb45..862bfe773 100644 --- a/src/apps/abracadabra/abracadabra.definition.ts +++ b/src/apps/abracadabra/abracadabra.definition.ts @@ -7,6 +7,7 @@ export const ABRACADABRA_DEFINITION = appDefinition({ id: 'abracadabra', groups: { stakedSpell: { id: 'staked-spell', type: GroupType.TOKEN }, + mSpell: { id: 'm-spell', type: GroupType.POSITION }, cauldron: { id: 'cauldron', type: GroupType.POSITION }, farm: { id: 'farm', type: GroupType.POSITION }, }, @@ -26,6 +27,7 @@ export const ABRACADABRA_DEFINITION = appDefinition({ [Network.AVALANCHE_MAINNET]: [AppAction.VIEW], [Network.ETHEREUM_MAINNET]: [AppAction.VIEW], [Network.FANTOM_OPERA_MAINNET]: [AppAction.VIEW], + [Network.BINANCE_SMART_CHAIN_MAINNET]: [AppAction.VIEW], }, }); diff --git a/src/apps/abracadabra/abracadabra.module.ts b/src/apps/abracadabra/abracadabra.module.ts index 90bf8452c..d9a9c46a9 100644 --- a/src/apps/abracadabra/abracadabra.module.ts +++ b/src/apps/abracadabra/abracadabra.module.ts @@ -6,18 +6,24 @@ import { AbracadabraAppDefinition, ABRACADABRA_DEFINITION } from './abracadabra. import { ArbitrumAbracadabraBalanceFetcher } from './arbitrum/abracadabra.balance-fetcher'; import { ArbitrumAbracadabraCauldronContractPositionFetcher } from './arbitrum/abracadabra.cauldron.contract-position-fetcher'; import { ArbitrumAbracadabraFarmContractPositionFetcher } from './arbitrum/abracadabra.farm.contract-position-fetcher'; +import { ArbitrumAbracadabraMspellContractPositionFetcher } from './arbitrum/abracadabra.m-spell.contract-position-fetcher'; import { ArbitrumAbracadabraStakedSpellTokenFetcher } from './arbitrum/abracadabra.staked-spell.token-fetcher'; import { AvalancheAbracadabraBalanceFetcher } from './avalanche/abracadabra.balance-fetcher'; import { AvalancheAbracadabraCauldronContractPositionFetcher } from './avalanche/abracadabra.cauldron.contract-position-fetcher'; import { AvalancheAbracadabraFarmContractPositionFetcher } from './avalanche/abracadabra.farm.contract-position-fetcher'; +import { AvalancheAbracadabraMspellContractPositionFetcher } from './avalanche/abracadabra.m-spell.contract-position-fetcher'; import { AvalancheAbracadabraStakedSpellTokenFetcher } from './avalanche/abracadabra.staked-spell.token-fetcher'; +import { BinanceSmartChainAbracadabraBalanceFetcher } from './binance-smart-chain/abracadabra.balance-fetcher'; +import { BinanceSmartChainAbracadabraCauldronContractPositionFetcher } from './binance-smart-chain/abracadabra.cauldron.contract-position-fetcher'; import { AbracadabraContractFactory } from './contracts'; import { EthereumAbracadabraBalanceFetcher } from './ethereum/abracadabra.balance-fetcher'; import { EthereumAbracadabraCauldronContractPositionFetcher } from './ethereum/abracadabra.cauldron.contract-position-fetcher'; import { EthereumAbracadabraFarmContractPositionFetcher } from './ethereum/abracadabra.farm.contract-position-fetcher'; +import { EthereumAbracadabraMspellContractPositionFetcher } from './ethereum/abracadabra.m-spell.contract-position-fetcher'; import { EthereumAbracadabraStakedSpellTokenFetcher } from './ethereum/abracadabra.staked-spell.token-fetcher'; import { FantomAbracadabraBalanceFetcher } from './fantom/abracadabra.balance-fetcher'; import { FantomAbracadabraCauldronContractPositionFetcher } from './fantom/abracadabra.cauldron.contract-position-fetcher'; +import { FantomAbracadabraMspellContractPositionFetcher } from './fantom/abracadabra.m-spell.contract-position-fetcher'; import { FantomAbracadabraFarmContractPositionFetcher } from './fantom/abracadbra.farm.contract-position-fetcher'; import { FantomAbracadabraStakedSpellTokenFetcher } from './fantom/abracadbra.staked-spell.token-fetcher'; import { AbracadabraCauldronBalanceHelper } from './helpers/abracadabra.cauldron.balance-helper'; @@ -34,21 +40,28 @@ import { AbracadabraCauldronContractPositionHelper } from './helpers/abracadabra ArbitrumAbracadabraCauldronContractPositionFetcher, ArbitrumAbracadabraFarmContractPositionFetcher, ArbitrumAbracadabraBalanceFetcher, + ArbitrumAbracadabraMspellContractPositionFetcher, // Avalanche AvalancheAbracadabraStakedSpellTokenFetcher, AvalancheAbracadabraCauldronContractPositionFetcher, AvalancheAbracadabraFarmContractPositionFetcher, AvalancheAbracadabraBalanceFetcher, + AvalancheAbracadabraMspellContractPositionFetcher, // Ethereum EthereumAbracadabraStakedSpellTokenFetcher, EthereumAbracadabraCauldronContractPositionFetcher, EthereumAbracadabraFarmContractPositionFetcher, EthereumAbracadabraBalanceFetcher, + EthereumAbracadabraMspellContractPositionFetcher, // Fantom FantomAbracadabraStakedSpellTokenFetcher, FantomAbracadabraCauldronContractPositionFetcher, FantomAbracadabraFarmContractPositionFetcher, FantomAbracadabraBalanceFetcher, + FantomAbracadabraMspellContractPositionFetcher, + // Binance Smart Chain + BinanceSmartChainAbracadabraCauldronContractPositionFetcher, + BinanceSmartChainAbracadabraBalanceFetcher, // Helpers AbracadabraCauldronBalanceHelper, AbracadabraCauldronContractPositionHelper, diff --git a/src/apps/abracadabra/arbitrum/abracadabra.balance-fetcher.ts b/src/apps/abracadabra/arbitrum/abracadabra.balance-fetcher.ts index 766ce98e6..519d0f82c 100644 --- a/src/apps/abracadabra/arbitrum/abracadabra.balance-fetcher.ts +++ b/src/apps/abracadabra/arbitrum/abracadabra.balance-fetcher.ts @@ -7,9 +7,10 @@ import { BalanceFetcher } from '~balance/balance-fetcher.interface'; import { Network } from '~types/network.interface'; import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; -import { AbracadabraContractFactory, PopsicleChef } from '../contracts'; +import { AbracadabraContractFactory, PopsicleChef, AbracadabraMspell } from '../contracts'; import { AbracadabraCauldronBalanceHelper } from '../helpers/abracadabra.cauldron.balance-helper'; +const appId = ABRACADABRA_DEFINITION.id; const network = Network.ARBITRUM_MAINNET; @Register.BalanceFetcher(ABRACADABRA_DEFINITION.id, network) @@ -57,10 +58,11 @@ export class ArbitrumAbracadabraBalanceFetcher implements BalanceFetcher { } async getBalances(address: string) { - const [stakedSpellBalances, cauldronBalances, farmBalances] = await Promise.all([ + const [stakedSpellBalances, cauldronBalances, farmBalances, mspellBalances] = await Promise.all([ this.getStakedSpellBalances(address), this.getCauldronBalances(address), this.getFarmBalances(address), + this.getMspellBalance(address), ]); return presentBalanceFetcherResponse([ @@ -76,6 +78,28 @@ export class ArbitrumAbracadabraBalanceFetcher implements BalanceFetcher { label: 'Farms', assets: farmBalances, }, + { + label: 'mSPELL', + assets: mspellBalances, + }, ]); } + private async getMspellBalance(address: string) { + return this.appToolkit.helpers.singleStakingContractPositionBalanceHelper.getBalances({ + address, + appId, + network, + groupId: ABRACADABRA_DEFINITION.groups.mSpell.id, + resolveContract: opts => this.contractFactory.abracadabraMspell(opts), + resolveStakedTokenBalance: ({ multicall, contract }) => { + return multicall + .wrap(contract) + .userInfo(address) + .then(v => v[0]); + }, + resolveRewardTokenBalances: ({ multicall, contract }) => { + return multicall.wrap(contract).pendingReward(address); + }, + }); + } } diff --git a/src/apps/abracadabra/arbitrum/abracadabra.m-spell.contract-position-fetcher.ts b/src/apps/abracadabra/arbitrum/abracadabra.m-spell.contract-position-fetcher.ts new file mode 100644 index 000000000..606f0104a --- /dev/null +++ b/src/apps/abracadabra/arbitrum/abracadabra.m-spell.contract-position-fetcher.ts @@ -0,0 +1,35 @@ +import { Inject } from '@nestjs/common'; + +import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; +import { Register } from '~app-toolkit/decorators'; +import { PositionFetcher } from '~position/position-fetcher.interface'; +import { ContractPosition } from '~position/position.interface'; +import { Network } from '~types/network.interface'; + +import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; +import { AbracadabraContractFactory, AbracadabraMspell } from '../contracts'; + +const appId = ABRACADABRA_DEFINITION.id; +const groupId = ABRACADABRA_DEFINITION.groups.mSpell.id; +const network = Network.ARBITRUM_MAINNET; +@Register.ContractPositionFetcher({ appId, groupId, network }) +export class ArbitrumAbracadabraMspellContractPositionFetcher implements PositionFetcher { + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(AbracadabraContractFactory) + private readonly contractFactory: AbracadabraContractFactory, + ) {} + + async getPositions() { + return this.appToolkit.helpers.singleStakingFarmContractPositionHelper.getContractPositions({ + appId, + groupId, + network, + resolveFarmAddresses: async () => ['0x1df188958a8674b5177f77667b8d173c3cdd9e51'], + resolveStakedTokenAddress: async ({ multicall, contract }) => multicall.wrap(contract).spell(), + resolveFarmContract: opts => this.contractFactory.abracadabraMspell(opts), + resolveRewardTokenAddresses: async ({ multicall, contract }) => multicall.wrap(contract).mim(), + resolveRois: () => ({ dailyROI: 0, weeklyROI: 0, yearlyROI: 0 }), + }); + } +} diff --git a/src/apps/abracadabra/avalanche/abracadabra.balance-fetcher.ts b/src/apps/abracadabra/avalanche/abracadabra.balance-fetcher.ts index 697fedde4..ea54c927d 100644 --- a/src/apps/abracadabra/avalanche/abracadabra.balance-fetcher.ts +++ b/src/apps/abracadabra/avalanche/abracadabra.balance-fetcher.ts @@ -7,9 +7,10 @@ import { BalanceFetcher } from '~balance/balance-fetcher.interface'; import { Network } from '~types/network.interface'; import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; -import { AbracadabraContractFactory, PopsicleChef } from '../contracts'; +import { AbracadabraContractFactory, PopsicleChef, AbracadabraMspell } from '../contracts'; import { AbracadabraCauldronBalanceHelper } from '../helpers/abracadabra.cauldron.balance-helper'; +const appId = ABRACADABRA_DEFINITION.id; const network = Network.AVALANCHE_MAINNET; @Register.BalanceFetcher(ABRACADABRA_DEFINITION.id, network) @@ -57,10 +58,11 @@ export class AvalancheAbracadabraBalanceFetcher implements BalanceFetcher { } async getBalances(address: string) { - const [stakedSpellBalances, cauldronBalances, farmBalances] = await Promise.all([ + const [stakedSpellBalances, cauldronBalances, farmBalances, mspellBalances] = await Promise.all([ this.getStakedSpellBalances(address), this.getCauldronBalances(address), this.getFarmBalances(address), + this.getMspellBalance(address), ]); return presentBalanceFetcherResponse([ @@ -76,6 +78,28 @@ export class AvalancheAbracadabraBalanceFetcher implements BalanceFetcher { label: 'Farms', assets: farmBalances, }, + { + label: 'mSPELL', + assets: mspellBalances, + }, ]); } + private async getMspellBalance(address: string) { + return this.appToolkit.helpers.singleStakingContractPositionBalanceHelper.getBalances({ + address, + appId, + network, + groupId: ABRACADABRA_DEFINITION.groups.mSpell.id, + resolveContract: opts => this.contractFactory.abracadabraMspell(opts), + resolveStakedTokenBalance: ({ multicall, contract }) => { + return multicall + .wrap(contract) + .userInfo(address) + .then(v => v[0]); + }, + resolveRewardTokenBalances: ({ multicall, contract }) => { + return multicall.wrap(contract).pendingReward(address); + }, + }); + } } diff --git a/src/apps/abracadabra/avalanche/abracadabra.m-spell.contract-position-fetcher.ts b/src/apps/abracadabra/avalanche/abracadabra.m-spell.contract-position-fetcher.ts new file mode 100644 index 000000000..5f7fef8a0 --- /dev/null +++ b/src/apps/abracadabra/avalanche/abracadabra.m-spell.contract-position-fetcher.ts @@ -0,0 +1,35 @@ +import { Inject } from '@nestjs/common'; + +import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; +import { Register } from '~app-toolkit/decorators'; +import { PositionFetcher } from '~position/position-fetcher.interface'; +import { ContractPosition } from '~position/position.interface'; +import { Network } from '~types/network.interface'; + +import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; +import { AbracadabraContractFactory, AbracadabraMspell } from '../contracts'; + +const appId = ABRACADABRA_DEFINITION.id; +const groupId = ABRACADABRA_DEFINITION.groups.mSpell.id; +const network = Network.AVALANCHE_MAINNET; +@Register.ContractPositionFetcher({ appId, groupId, network }) +export class AvalancheAbracadabraMspellContractPositionFetcher implements PositionFetcher { + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(AbracadabraContractFactory) + private readonly contractFactory: AbracadabraContractFactory, + ) {} + + async getPositions() { + return this.appToolkit.helpers.singleStakingFarmContractPositionHelper.getContractPositions({ + appId, + groupId, + network, + resolveFarmAddresses: async () => ['0xbd84472b31d947314fdfa2ea42460a2727f955af'], + resolveStakedTokenAddress: async ({ multicall, contract }) => multicall.wrap(contract).spell(), + resolveFarmContract: opts => this.contractFactory.abracadabraMspell(opts), + resolveRewardTokenAddresses: async ({ multicall, contract }) => multicall.wrap(contract).mim(), + resolveRois: () => ({ dailyROI: 0, weeklyROI: 0, yearlyROI: 0 }), + }); + } +} diff --git a/src/apps/abracadabra/binance-smart-chain/abracadabra.balance-fetcher.ts b/src/apps/abracadabra/binance-smart-chain/abracadabra.balance-fetcher.ts new file mode 100644 index 000000000..6330294a1 --- /dev/null +++ b/src/apps/abracadabra/binance-smart-chain/abracadabra.balance-fetcher.ts @@ -0,0 +1,34 @@ +import { Inject } from '@nestjs/common'; + +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 { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; +import { AbracadabraCauldronBalanceHelper } from '../helpers/abracadabra.cauldron.balance-helper'; + +const network = Network.BINANCE_SMART_CHAIN_MAINNET; + +@Register.BalanceFetcher(ABRACADABRA_DEFINITION.id, network) +export class BinanceSmartChainAbracadabraBalanceFetcher implements BalanceFetcher { + constructor( + @Inject(AbracadabraCauldronBalanceHelper) + private readonly abracadabraCauldronBalanceHelper: AbracadabraCauldronBalanceHelper, + ) {} + + private async getCauldronBalances(address: string) { + return this.abracadabraCauldronBalanceHelper.getBalances({ address, network }); + } + + async getBalances(address: string) { + const [cauldronBalances] = await Promise.all([this.getCauldronBalances(address)]); + + return presentBalanceFetcherResponse([ + { + label: 'Cauldrons', + assets: cauldronBalances, + }, + ]); + } +} diff --git a/src/apps/abracadabra/binance-smart-chain/abracadabra.cauldron.contract-position-fetcher.ts b/src/apps/abracadabra/binance-smart-chain/abracadabra.cauldron.contract-position-fetcher.ts new file mode 100644 index 000000000..ffb653947 --- /dev/null +++ b/src/apps/abracadabra/binance-smart-chain/abracadabra.cauldron.contract-position-fetcher.ts @@ -0,0 +1,34 @@ +import { Inject } from '@nestjs/common'; + +import { Register } from '~app-toolkit/decorators'; +import { PositionFetcher } from '~position/position-fetcher.interface'; +import { ContractPosition } from '~position/position.interface'; +import { Network } from '~types/network.interface'; + +import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; +import { AbracadabraCauldronContractPositionHelper } from '../helpers/abracadabra.cauldron.contract-position-helper'; + +const CAULDRONS = [ + '0x692cf15f80415d83e8c0e139cabcda67fcc12c90', // wBNB + '0xf8049467f3a9d50176f4816b20cddd9bb8a93319', // CAKE +]; + +const appId = ABRACADABRA_DEFINITION.id; +const groupId = ABRACADABRA_DEFINITION.groups.cauldron.id; +const network = Network.BINANCE_SMART_CHAIN_MAINNET; + +@Register.ContractPositionFetcher({ appId, groupId, network }) +export class BinanceSmartChainAbracadabraCauldronContractPositionFetcher implements PositionFetcher { + constructor( + @Inject(AbracadabraCauldronContractPositionHelper) + private readonly abracadabraCauldronContractPositionHelper: AbracadabraCauldronContractPositionHelper, + ) {} + + async getPositions() { + return this.abracadabraCauldronContractPositionHelper.getContractPositions({ + cauldronAddresses: CAULDRONS, + network, + dependencies: [], + }); + } +} diff --git a/src/apps/abracadabra/contracts/abis/abracadabra-mspell.json b/src/apps/abracadabra/contracts/abis/abracadabra-mspell.json new file mode 100644 index 000000000..b11f694ae --- /dev/null +++ b/src/apps/abracadabra/contracts/abis/abracadabra-mspell.json @@ -0,0 +1,164 @@ +[ + { + "inputs": [ + { "internalType": "contract ERC20", "name": "_mim", "type": "address" }, + { "internalType": "contract ERC20", "name": "_spell", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "ClaimReward", + "type": "event" + }, + { + "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": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "ACC_REWARD_PER_SHARE_PRECISION", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accRewardPerShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "claimOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "emergencyWithdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "lastRewardBalance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mim", + "outputs": [{ "internalType": "contract ERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], + "name": "pendingReward", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "spell", + "outputs": [{ "internalType": "contract ERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bool", "name": "status", "type": "bool" }], + "name": "toggleLockUp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "toggleLockup", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newOwner", "type": "address" }, + { "internalType": "bool", "name": "direct", "type": "bool" }, + { "internalType": "bool", "name": "renounce", "type": "bool" } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "updateReward", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "userInfo", + "outputs": [ + { "internalType": "uint128", "name": "amount", "type": "uint128" }, + { "internalType": "uint128", "name": "rewardDebt", "type": "uint128" }, + { "internalType": "uint128", "name": "lastAdded", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/apps/abracadabra/contracts/ethers/AbracadabraMspell.ts b/src/apps/abracadabra/contracts/ethers/AbracadabraMspell.ts new file mode 100644 index 000000000..716a85fb2 --- /dev/null +++ b/src/apps/abracadabra/contracts/ethers/AbracadabraMspell.ts @@ -0,0 +1,446 @@ +/* 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 AbracadabraMspellInterface extends utils.Interface { + functions: { + 'ACC_REWARD_PER_SHARE_PRECISION()': FunctionFragment; + 'accRewardPerShare()': FunctionFragment; + 'claimOwnership()': FunctionFragment; + 'deposit(uint256)': FunctionFragment; + 'emergencyWithdraw()': FunctionFragment; + 'lastRewardBalance()': FunctionFragment; + 'mim()': FunctionFragment; + 'owner()': FunctionFragment; + 'pendingOwner()': FunctionFragment; + 'pendingReward(address)': FunctionFragment; + 'spell()': FunctionFragment; + 'toggleLockUp(bool)': FunctionFragment; + 'toggleLockup()': FunctionFragment; + 'transferOwnership(address,bool,bool)': FunctionFragment; + 'updateReward()': FunctionFragment; + 'userInfo(address)': FunctionFragment; + 'withdraw(uint256)': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'ACC_REWARD_PER_SHARE_PRECISION' + | 'accRewardPerShare' + | 'claimOwnership' + | 'deposit' + | 'emergencyWithdraw' + | 'lastRewardBalance' + | 'mim' + | 'owner' + | 'pendingOwner' + | 'pendingReward' + | 'spell' + | 'toggleLockUp' + | 'toggleLockup' + | 'transferOwnership' + | 'updateReward' + | 'userInfo' + | 'withdraw', + ): FunctionFragment; + + encodeFunctionData(functionFragment: 'ACC_REWARD_PER_SHARE_PRECISION', values?: undefined): string; + encodeFunctionData(functionFragment: 'accRewardPerShare', values?: undefined): string; + encodeFunctionData(functionFragment: 'claimOwnership', values?: undefined): string; + encodeFunctionData(functionFragment: 'deposit', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'emergencyWithdraw', values?: undefined): string; + encodeFunctionData(functionFragment: 'lastRewardBalance', values?: undefined): string; + encodeFunctionData(functionFragment: 'mim', values?: undefined): string; + encodeFunctionData(functionFragment: 'owner', values?: undefined): string; + encodeFunctionData(functionFragment: 'pendingOwner', values?: undefined): string; + encodeFunctionData(functionFragment: 'pendingReward', values: [string]): string; + encodeFunctionData(functionFragment: 'spell', values?: undefined): string; + encodeFunctionData(functionFragment: 'toggleLockUp', values: [boolean]): string; + encodeFunctionData(functionFragment: 'toggleLockup', values?: undefined): string; + encodeFunctionData(functionFragment: 'transferOwnership', values: [string, boolean, boolean]): string; + encodeFunctionData(functionFragment: 'updateReward', values?: undefined): string; + encodeFunctionData(functionFragment: 'userInfo', values: [string]): string; + encodeFunctionData(functionFragment: 'withdraw', values: [BigNumberish]): string; + + decodeFunctionResult(functionFragment: 'ACC_REWARD_PER_SHARE_PRECISION', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'accRewardPerShare', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'claimOwnership', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'deposit', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'emergencyWithdraw', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'lastRewardBalance', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'mim', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'owner', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'pendingOwner', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'pendingReward', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'spell', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'toggleLockUp', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'toggleLockup', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'transferOwnership', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'updateReward', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'userInfo', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'withdraw', data: BytesLike): Result; + + events: { + 'ClaimReward(address,uint256)': EventFragment; + 'Deposit(address,uint256)': EventFragment; + 'EmergencyWithdraw(address,uint256)': EventFragment; + 'OwnershipTransferred(address,address)': EventFragment; + 'Withdraw(address,uint256)': EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: 'ClaimReward'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Deposit'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'EmergencyWithdraw'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'OwnershipTransferred'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Withdraw'): EventFragment; +} + +export interface ClaimRewardEventObject { + user: string; + amount: BigNumber; +} +export type ClaimRewardEvent = TypedEvent<[string, BigNumber], ClaimRewardEventObject>; + +export type ClaimRewardEventFilter = 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 OwnershipTransferredEventObject { + previousOwner: string; + newOwner: string; +} +export type OwnershipTransferredEvent = TypedEvent<[string, string], OwnershipTransferredEventObject>; + +export type OwnershipTransferredEventFilter = TypedEventFilter; + +export interface WithdrawEventObject { + user: string; + amount: BigNumber; +} +export type WithdrawEvent = TypedEvent<[string, BigNumber], WithdrawEventObject>; + +export type WithdrawEventFilter = TypedEventFilter; + +export interface AbracadabraMspell extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: AbracadabraMspellInterface; + + 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: { + ACC_REWARD_PER_SHARE_PRECISION(overrides?: CallOverrides): Promise<[BigNumber]>; + + accRewardPerShare(overrides?: CallOverrides): Promise<[BigNumber]>; + + claimOwnership(overrides?: Overrides & { from?: string | Promise }): Promise; + + deposit( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + emergencyWithdraw(overrides?: Overrides & { from?: string | Promise }): Promise; + + lastRewardBalance(overrides?: CallOverrides): Promise<[BigNumber]>; + + mim(overrides?: CallOverrides): Promise<[string]>; + + owner(overrides?: CallOverrides): Promise<[string]>; + + pendingOwner(overrides?: CallOverrides): Promise<[string]>; + + pendingReward(_user: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + spell(overrides?: CallOverrides): Promise<[string]>; + + toggleLockUp( + status: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + toggleLockup(overrides?: CallOverrides): Promise<[boolean]>; + + transferOwnership( + newOwner: string, + direct: boolean, + renounce: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + updateReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + userInfo( + arg0: string, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber] & { + amount: BigNumber; + rewardDebt: BigNumber; + lastAdded: BigNumber; + } + >; + + withdraw( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + }; + + ACC_REWARD_PER_SHARE_PRECISION(overrides?: CallOverrides): Promise; + + accRewardPerShare(overrides?: CallOverrides): Promise; + + claimOwnership(overrides?: Overrides & { from?: string | Promise }): Promise; + + deposit( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + emergencyWithdraw(overrides?: Overrides & { from?: string | Promise }): Promise; + + lastRewardBalance(overrides?: CallOverrides): Promise; + + mim(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + pendingOwner(overrides?: CallOverrides): Promise; + + pendingReward(_user: string, overrides?: CallOverrides): Promise; + + spell(overrides?: CallOverrides): Promise; + + toggleLockUp( + status: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + toggleLockup(overrides?: CallOverrides): Promise; + + transferOwnership( + newOwner: string, + direct: boolean, + renounce: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + updateReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + userInfo( + arg0: string, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber] & { + amount: BigNumber; + rewardDebt: BigNumber; + lastAdded: BigNumber; + } + >; + + withdraw( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + callStatic: { + ACC_REWARD_PER_SHARE_PRECISION(overrides?: CallOverrides): Promise; + + accRewardPerShare(overrides?: CallOverrides): Promise; + + claimOwnership(overrides?: CallOverrides): Promise; + + deposit(_amount: BigNumberish, overrides?: CallOverrides): Promise; + + emergencyWithdraw(overrides?: CallOverrides): Promise; + + lastRewardBalance(overrides?: CallOverrides): Promise; + + mim(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + pendingOwner(overrides?: CallOverrides): Promise; + + pendingReward(_user: string, overrides?: CallOverrides): Promise; + + spell(overrides?: CallOverrides): Promise; + + toggleLockUp(status: boolean, overrides?: CallOverrides): Promise; + + toggleLockup(overrides?: CallOverrides): Promise; + + transferOwnership(newOwner: string, direct: boolean, renounce: boolean, overrides?: CallOverrides): Promise; + + updateReward(overrides?: CallOverrides): Promise; + + userInfo( + arg0: string, + overrides?: CallOverrides, + ): Promise< + [BigNumber, BigNumber, BigNumber] & { + amount: BigNumber; + rewardDebt: BigNumber; + lastAdded: BigNumber; + } + >; + + withdraw(_amount: BigNumberish, overrides?: CallOverrides): Promise; + }; + + filters: { + 'ClaimReward(address,uint256)'(user?: string | null, amount?: null): ClaimRewardEventFilter; + ClaimReward(user?: string | null, amount?: null): ClaimRewardEventFilter; + + '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; + + 'OwnershipTransferred(address,address)'( + previousOwner?: string | null, + newOwner?: string | null, + ): OwnershipTransferredEventFilter; + OwnershipTransferred(previousOwner?: string | null, newOwner?: string | null): OwnershipTransferredEventFilter; + + 'Withdraw(address,uint256)'(user?: string | null, amount?: null): WithdrawEventFilter; + Withdraw(user?: string | null, amount?: null): WithdrawEventFilter; + }; + + estimateGas: { + ACC_REWARD_PER_SHARE_PRECISION(overrides?: CallOverrides): Promise; + + accRewardPerShare(overrides?: CallOverrides): Promise; + + claimOwnership(overrides?: Overrides & { from?: string | Promise }): Promise; + + deposit(_amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + emergencyWithdraw(overrides?: Overrides & { from?: string | Promise }): Promise; + + lastRewardBalance(overrides?: CallOverrides): Promise; + + mim(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + pendingOwner(overrides?: CallOverrides): Promise; + + pendingReward(_user: string, overrides?: CallOverrides): Promise; + + spell(overrides?: CallOverrides): Promise; + + toggleLockUp(status: boolean, overrides?: Overrides & { from?: string | Promise }): Promise; + + toggleLockup(overrides?: CallOverrides): Promise; + + transferOwnership( + newOwner: string, + direct: boolean, + renounce: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + updateReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + userInfo(arg0: string, overrides?: CallOverrides): Promise; + + withdraw(_amount: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + }; + + populateTransaction: { + ACC_REWARD_PER_SHARE_PRECISION(overrides?: CallOverrides): Promise; + + accRewardPerShare(overrides?: CallOverrides): Promise; + + claimOwnership(overrides?: Overrides & { from?: string | Promise }): Promise; + + deposit( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + emergencyWithdraw(overrides?: Overrides & { from?: string | Promise }): Promise; + + lastRewardBalance(overrides?: CallOverrides): Promise; + + mim(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + pendingOwner(overrides?: CallOverrides): Promise; + + pendingReward(_user: string, overrides?: CallOverrides): Promise; + + spell(overrides?: CallOverrides): Promise; + + toggleLockUp( + status: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + toggleLockup(overrides?: CallOverrides): Promise; + + transferOwnership( + newOwner: string, + direct: boolean, + renounce: boolean, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + updateReward(overrides?: Overrides & { from?: string | Promise }): Promise; + + userInfo(arg0: string, overrides?: CallOverrides): Promise; + + withdraw( + _amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + }; +} diff --git a/src/apps/abracadabra/contracts/ethers/factories/AbracadabraMspell__factory.ts b/src/apps/abracadabra/contracts/ethers/factories/AbracadabraMspell__factory.ts new file mode 100644 index 000000000..86431941e --- /dev/null +++ b/src/apps/abracadabra/contracts/ethers/factories/AbracadabraMspell__factory.ts @@ -0,0 +1,366 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { AbracadabraMspell, AbracadabraMspellInterface } from '../AbracadabraMspell'; + +const _abi = [ + { + inputs: [ + { + internalType: 'contract ERC20', + name: '_mim', + type: 'address', + }, + { + internalType: 'contract ERC20', + name: '_spell', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ClaimReward', + type: 'event', + }, + { + 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: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Withdraw', + type: 'event', + }, + { + inputs: [], + name: 'ACC_REWARD_PER_SHARE_PRECISION', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'accRewardPerShare', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'claimOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'deposit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'emergencyWithdraw', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'lastRewardBalance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'mim', + outputs: [ + { + internalType: 'contract ERC20', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'pendingOwner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_user', + type: 'address', + }, + ], + name: 'pendingReward', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'spell', + outputs: [ + { + internalType: 'contract ERC20', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bool', + name: 'status', + type: 'bool', + }, + ], + name: 'toggleLockUp', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'toggleLockup', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + { + internalType: 'bool', + name: 'direct', + type: 'bool', + }, + { + internalType: 'bool', + name: 'renounce', + type: 'bool', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'updateReward', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'userInfo', + outputs: [ + { + internalType: 'uint128', + name: 'amount', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'rewardDebt', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'lastAdded', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'withdraw', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +]; + +export class AbracadabraMspell__factory { + static readonly abi = _abi; + static createInterface(): AbracadabraMspellInterface { + return new utils.Interface(_abi) as AbracadabraMspellInterface; + } + static connect(address: string, signerOrProvider: Signer | Provider): AbracadabraMspell { + return new Contract(address, _abi, signerOrProvider) as AbracadabraMspell; + } +} diff --git a/src/apps/abracadabra/contracts/ethers/factories/index.ts b/src/apps/abracadabra/contracts/ethers/factories/index.ts index e75017b43..38c1db981 100644 --- a/src/apps/abracadabra/contracts/ethers/factories/index.ts +++ b/src/apps/abracadabra/contracts/ethers/factories/index.ts @@ -4,5 +4,6 @@ export { AbracadabraBentoBoxTokenContract__factory } from './AbracadabraBentoBoxTokenContract__factory'; export { AbracadabraConvexWrapper__factory } from './AbracadabraConvexWrapper__factory'; export { AbracadabraCouldronTokenContract__factory } from './AbracadabraCouldronTokenContract__factory'; +export { AbracadabraMspell__factory } from './AbracadabraMspell__factory'; export { AbracadabraStakedSpellTokenContract__factory } from './AbracadabraStakedSpellTokenContract__factory'; export { PopsicleChef__factory } from './PopsicleChef__factory'; diff --git a/src/apps/abracadabra/contracts/ethers/index.ts b/src/apps/abracadabra/contracts/ethers/index.ts index c07032977..548954706 100644 --- a/src/apps/abracadabra/contracts/ethers/index.ts +++ b/src/apps/abracadabra/contracts/ethers/index.ts @@ -4,11 +4,13 @@ export type { AbracadabraBentoBoxTokenContract } from './AbracadabraBentoBoxTokenContract'; export type { AbracadabraConvexWrapper } from './AbracadabraConvexWrapper'; export type { AbracadabraCouldronTokenContract } from './AbracadabraCouldronTokenContract'; +export type { AbracadabraMspell } from './AbracadabraMspell'; export type { AbracadabraStakedSpellTokenContract } from './AbracadabraStakedSpellTokenContract'; export type { PopsicleChef } from './PopsicleChef'; export * as factories from './factories'; export { AbracadabraBentoBoxTokenContract__factory } from './factories/AbracadabraBentoBoxTokenContract__factory'; export { AbracadabraConvexWrapper__factory } from './factories/AbracadabraConvexWrapper__factory'; export { AbracadabraCouldronTokenContract__factory } from './factories/AbracadabraCouldronTokenContract__factory'; +export { AbracadabraMspell__factory } from './factories/AbracadabraMspell__factory'; export { AbracadabraStakedSpellTokenContract__factory } from './factories/AbracadabraStakedSpellTokenContract__factory'; export { PopsicleChef__factory } from './factories/PopsicleChef__factory'; diff --git a/src/apps/abracadabra/contracts/index.ts b/src/apps/abracadabra/contracts/index.ts index 8b724bff6..62057a3c9 100644 --- a/src/apps/abracadabra/contracts/index.ts +++ b/src/apps/abracadabra/contracts/index.ts @@ -7,6 +7,7 @@ import { Network } from '~types/network.interface'; import { AbracadabraBentoBoxTokenContract__factory } from './ethers'; import { AbracadabraConvexWrapper__factory } from './ethers'; import { AbracadabraCouldronTokenContract__factory } from './ethers'; +import { AbracadabraMspell__factory } from './ethers'; import { AbracadabraStakedSpellTokenContract__factory } from './ethers'; import { PopsicleChef__factory } from './ethers'; @@ -28,6 +29,9 @@ export class AbracadabraContractFactory extends ContractFactory { abracadabraCouldronTokenContract({ address, network }: ContractOpts) { return AbracadabraCouldronTokenContract__factory.connect(address, this.appToolkit.getNetworkProvider(network)); } + abracadabraMspell({ address, network }: ContractOpts) { + return AbracadabraMspell__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } abracadabraStakedSpellTokenContract({ address, network }: ContractOpts) { return AbracadabraStakedSpellTokenContract__factory.connect(address, this.appToolkit.getNetworkProvider(network)); } @@ -39,5 +43,6 @@ export class AbracadabraContractFactory extends ContractFactory { export type { AbracadabraBentoBoxTokenContract } from './ethers'; export type { AbracadabraConvexWrapper } from './ethers'; export type { AbracadabraCouldronTokenContract } from './ethers'; +export type { AbracadabraMspell } from './ethers'; export type { AbracadabraStakedSpellTokenContract } from './ethers'; export type { PopsicleChef } from './ethers'; diff --git a/src/apps/abracadabra/ethereum/abracadabra.balance-fetcher.ts b/src/apps/abracadabra/ethereum/abracadabra.balance-fetcher.ts index 97cc0172f..c20aaa367 100644 --- a/src/apps/abracadabra/ethereum/abracadabra.balance-fetcher.ts +++ b/src/apps/abracadabra/ethereum/abracadabra.balance-fetcher.ts @@ -7,9 +7,10 @@ import { BalanceFetcher } from '~balance/balance-fetcher.interface'; import { Network } from '~types/network.interface'; import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; -import { AbracadabraContractFactory, PopsicleChef } from '../contracts'; +import { AbracadabraContractFactory, PopsicleChef, AbracadabraMspell } from '../contracts'; import { AbracadabraCauldronBalanceHelper } from '../helpers/abracadabra.cauldron.balance-helper'; +const appId = ABRACADABRA_DEFINITION.id; const network = Network.ETHEREUM_MAINNET; @Register.BalanceFetcher(ABRACADABRA_DEFINITION.id, network) @@ -57,10 +58,11 @@ export class EthereumAbracadabraBalanceFetcher implements BalanceFetcher { } async getBalances(address: string) { - const [stakedSpellBalances, cauldronBalances, farmBalances] = await Promise.all([ + const [stakedSpellBalances, cauldronBalances, farmBalances, mspellBalances] = await Promise.all([ this.getStakedSpellBalances(address), this.getCauldronBalances(address), this.getFarmBalances(address), + this.getMspellBalance(address), ]); return presentBalanceFetcherResponse([ @@ -76,6 +78,28 @@ export class EthereumAbracadabraBalanceFetcher implements BalanceFetcher { label: 'Farms', assets: farmBalances, }, + { + label: 'mSPELL', + assets: mspellBalances, + }, ]); } + private async getMspellBalance(address: string) { + return this.appToolkit.helpers.singleStakingContractPositionBalanceHelper.getBalances({ + address, + appId, + network, + groupId: ABRACADABRA_DEFINITION.groups.mSpell.id, + resolveContract: opts => this.contractFactory.abracadabraMspell(opts), + resolveStakedTokenBalance: ({ multicall, contract }) => { + return multicall + .wrap(contract) + .userInfo(address) + .then(v => v[0]); + }, + resolveRewardTokenBalances: ({ multicall, contract }) => { + return multicall.wrap(contract).pendingReward(address); + }, + }); + } } diff --git a/src/apps/abracadabra/ethereum/abracadabra.cauldron.contract-position-fetcher.ts b/src/apps/abracadabra/ethereum/abracadabra.cauldron.contract-position-fetcher.ts index e268a6964..1f8c1dd81 100644 --- a/src/apps/abracadabra/ethereum/abracadabra.cauldron.contract-position-fetcher.ts +++ b/src/apps/abracadabra/ethereum/abracadabra.cauldron.contract-position-fetcher.ts @@ -41,6 +41,8 @@ const CAULDRONS = [ '0x59e9082e068ddb27fc5ef1690f9a9f22b32e573f', // UST V2 '0x390db10e65b5ab920c19149c919d970ad9d18a41', // WETH '0x5ec47ee69bede0b6c2a2fc0d9d094df16c192498', // WBTC + '0xf179fe36a36b32a4644587b8cdee7a23af98ed37', // yvCVXETH + '0x7ce7d9ed62b9a6c5ace1c6ec9aeb115fa3064757', // yvDAI ]; const appId = ABRACADABRA_DEFINITION.id; diff --git a/src/apps/abracadabra/ethereum/abracadabra.m-spell.contract-position-fetcher.ts b/src/apps/abracadabra/ethereum/abracadabra.m-spell.contract-position-fetcher.ts new file mode 100644 index 000000000..cbb2b3d2c --- /dev/null +++ b/src/apps/abracadabra/ethereum/abracadabra.m-spell.contract-position-fetcher.ts @@ -0,0 +1,35 @@ +import { Inject } from '@nestjs/common'; + +import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; +import { Register } from '~app-toolkit/decorators'; +import { PositionFetcher } from '~position/position-fetcher.interface'; +import { ContractPosition } from '~position/position.interface'; +import { Network } from '~types/network.interface'; + +import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; +import { AbracadabraContractFactory, AbracadabraMspell } from '../contracts'; + +const appId = ABRACADABRA_DEFINITION.id; +const groupId = ABRACADABRA_DEFINITION.groups.mSpell.id; +const network = Network.ETHEREUM_MAINNET; +@Register.ContractPositionFetcher({ appId, groupId, network }) +export class EthereumAbracadabraMspellContractPositionFetcher implements PositionFetcher { + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(AbracadabraContractFactory) + private readonly contractFactory: AbracadabraContractFactory, + ) {} + + async getPositions() { + return this.appToolkit.helpers.singleStakingFarmContractPositionHelper.getContractPositions({ + appId, + groupId, + network, + resolveFarmAddresses: async () => ['0xbd2fbaf2dc95bd78cf1cd3c5235b33d1165e6797'], + resolveStakedTokenAddress: async ({ multicall, contract }) => multicall.wrap(contract).spell(), + resolveFarmContract: opts => this.contractFactory.abracadabraMspell(opts), + resolveRewardTokenAddresses: async ({ multicall, contract }) => multicall.wrap(contract).mim(), + resolveRois: () => ({ dailyROI: 0, weeklyROI: 0, yearlyROI: 0 }), + }); + } +} diff --git a/src/apps/abracadabra/fantom/abracadabra.balance-fetcher.ts b/src/apps/abracadabra/fantom/abracadabra.balance-fetcher.ts index 9db5e6ffa..ff4b93b54 100644 --- a/src/apps/abracadabra/fantom/abracadabra.balance-fetcher.ts +++ b/src/apps/abracadabra/fantom/abracadabra.balance-fetcher.ts @@ -7,9 +7,10 @@ import { BalanceFetcher } from '~balance/balance-fetcher.interface'; import { Network } from '~types/network.interface'; import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; -import { AbracadabraContractFactory, PopsicleChef } from '../contracts'; +import { AbracadabraContractFactory, PopsicleChef, AbracadabraMspell } from '../contracts'; import { AbracadabraCauldronBalanceHelper } from '../helpers/abracadabra.cauldron.balance-helper'; +const appId = ABRACADABRA_DEFINITION.id; const network = Network.FANTOM_OPERA_MAINNET; @Register.BalanceFetcher(ABRACADABRA_DEFINITION.id, network) @@ -57,10 +58,11 @@ export class FantomAbracadabraBalanceFetcher implements BalanceFetcher { } async getBalances(address: string) { - const [stakedSpellBalances, cauldronBalances, farmBalances] = await Promise.all([ + const [stakedSpellBalances, cauldronBalances, farmBalances, mspellBalances] = await Promise.all([ this.getStakedSpellBalances(address), this.getCauldronBalances(address), this.getFarmBalances(address), + this.getMspellBalance(address), ]); return presentBalanceFetcherResponse([ @@ -76,6 +78,28 @@ export class FantomAbracadabraBalanceFetcher implements BalanceFetcher { label: 'Farms', assets: farmBalances, }, + { + label: 'mSPELL', + assets: mspellBalances, + }, ]); } + private async getMspellBalance(address: string) { + return this.appToolkit.helpers.singleStakingContractPositionBalanceHelper.getBalances({ + address, + appId, + network, + groupId: ABRACADABRA_DEFINITION.groups.mSpell.id, + resolveContract: opts => this.contractFactory.abracadabraMspell(opts), + resolveStakedTokenBalance: ({ multicall, contract }) => { + return multicall + .wrap(contract) + .userInfo(address) + .then(v => v[0]); + }, + resolveRewardTokenBalances: ({ multicall, contract }) => { + return multicall.wrap(contract).pendingReward(address); + }, + }); + } } diff --git a/src/apps/abracadabra/fantom/abracadabra.cauldron.contract-position-fetcher.ts b/src/apps/abracadabra/fantom/abracadabra.cauldron.contract-position-fetcher.ts index f84397dc0..8b547c166 100644 --- a/src/apps/abracadabra/fantom/abracadabra.cauldron.contract-position-fetcher.ts +++ b/src/apps/abracadabra/fantom/abracadabra.cauldron.contract-position-fetcher.ts @@ -13,6 +13,9 @@ const CAULDRONS = [ '0x8e45af6743422e488afacdad842ce75a09eaed34', // wFTM '0xd4357d43545f793101b592bacab89943dc89d11b', // wFTM '0xed745b045f9495b8bfc7b58eea8e0d0597884e12', // yvFTM + '0xa3fc1b4b7f06c2391f7ad7d4795c1cd28a59917e', // xBOO + '0x7208d9f9398d7b02c5c22c334c2a7a3a98c0a45d', // FTM/MIM SpiritLP + '0x4fdffa59bf8dda3f4d5b38f260eab8bfac6d7bc1', // FTM/MIM SpookyLP ]; const appId = ABRACADABRA_DEFINITION.id; @@ -33,6 +36,9 @@ export class FantomAbracadabraCauldronContractPositionFetcher implements Positio dependencies: [ { appId: ABRACADABRA_DEFINITION.id, groupIds: [ABRACADABRA_DEFINITION.groups.stakedSpell.id], network }, { appId: YEARN_DEFINITION.id, groupIds: [YEARN_DEFINITION.groups.vault.id], network }, + { appId: 'spookyswap', groupIds: ['x-boo'], network }, + { appId: 'spookyswap', groupIds: ['pool'], network }, + { appId: 'spiritswap', groupIds: ['pool'], network }, ], }); } diff --git a/src/apps/abracadabra/fantom/abracadabra.m-spell.contract-position-fetcher.ts b/src/apps/abracadabra/fantom/abracadabra.m-spell.contract-position-fetcher.ts new file mode 100644 index 000000000..1f5773e5f --- /dev/null +++ b/src/apps/abracadabra/fantom/abracadabra.m-spell.contract-position-fetcher.ts @@ -0,0 +1,35 @@ +import { Inject } from '@nestjs/common'; + +import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; +import { Register } from '~app-toolkit/decorators'; +import { PositionFetcher } from '~position/position-fetcher.interface'; +import { ContractPosition } from '~position/position.interface'; +import { Network } from '~types/network.interface'; + +import { ABRACADABRA_DEFINITION } from '../abracadabra.definition'; +import { AbracadabraContractFactory, AbracadabraMspell } from '../contracts'; + +const appId = ABRACADABRA_DEFINITION.id; +const groupId = ABRACADABRA_DEFINITION.groups.mSpell.id; +const network = Network.FANTOM_OPERA_MAINNET; +@Register.ContractPositionFetcher({ appId, groupId, network }) +export class FantomAbracadabraMspellContractPositionFetcher implements PositionFetcher { + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(AbracadabraContractFactory) + private readonly contractFactory: AbracadabraContractFactory, + ) {} + + async getPositions() { + return this.appToolkit.helpers.singleStakingFarmContractPositionHelper.getContractPositions({ + appId, + groupId, + network, + resolveFarmAddresses: async () => ['0xa668762fb20bcd7148db1bdb402ec06eb6dad569'], + resolveStakedTokenAddress: async ({ multicall, contract }) => multicall.wrap(contract).spell(), + resolveFarmContract: opts => this.contractFactory.abracadabraMspell(opts), + resolveRewardTokenAddresses: async ({ multicall, contract }) => multicall.wrap(contract).mim(), + resolveRois: () => ({ dailyROI: 0, weeklyROI: 0, yearlyROI: 0 }), + }); + } +}