diff --git a/src/app-toolkit/helpers/position/single-vault.token-helper.ts b/src/app-toolkit/helpers/position/single-vault.token-helper.ts index 150d14712..21493563d 100644 --- a/src/app-toolkit/helpers/position/single-vault.token-helper.ts +++ b/src/app-toolkit/helpers/position/single-vault.token-helper.ts @@ -9,13 +9,14 @@ import { Network } from '~types/network.interface'; import { buildDollarDisplayItem } from '../presentation/display-item.present'; import { getTokenImg } from '../presentation/image.present'; -type SingleVaultTokenHelperParams = { +type SingleVaultTokenHelperParams = { address: string; network: Network; appId: string; groupId: string; dependencies?: AppGroupsDefinition[]; - resolveUnderlyingTokenAddress: (opts: { address: string; network: Network }) => string | Promise; + resolveContract: (opts: { address: string; network: Network }) => T; + resolveUnderlyingTokenAddress: (opts: { contract: T }) => string | Promise; resolveReserve?: (opts: { underlyingToken: Token; address: string; network: Network }) => Promise; resolvePricePerShare?: (opts: { reserve: number; @@ -34,12 +35,13 @@ export type SingleVaultTokenDataProps = { export class SingleVaultTokenHelper { constructor(@Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit) {} - async getTokens({ + async getTokens({ address, network, appId, groupId, dependencies = [], + resolveContract, resolveUnderlyingTokenAddress, resolveReserve = async ({ underlyingToken, address, network }) => { const contract = this.appToolkit.globalContracts.erc20({ address: underlyingToken.address, network }); @@ -48,7 +50,7 @@ export class SingleVaultTokenHelper { }, resolvePricePerShare = ({ reserve, supply }) => reserve / supply, resolveImages = ({ address }) => [getTokenImg(address, network)], - }: SingleVaultTokenHelperParams) { + }: SingleVaultTokenHelperParams) { // Supports implementations forked (or similar) to xSUSHI const type = ContractType.APP_TOKEN; const multicall = this.appToolkit.getMulticall(network); @@ -56,7 +58,8 @@ export class SingleVaultTokenHelper { const appTokens = await this.appToolkit.getAppTokenPositions(...dependencies); const allTokens = [...appTokens, ...baseTokens]; - const underlyingTokenAddressRaw = await resolveUnderlyingTokenAddress({ address, network }); + const contract = resolveContract({ address, network }); + const underlyingTokenAddressRaw = await resolveUnderlyingTokenAddress({ contract }); const underlyingTokenAddress = underlyingTokenAddressRaw.toLowerCase(); const underlyingToken = allTokens.find(p => p.address === underlyingTokenAddress); if (!underlyingToken) return []; @@ -74,7 +77,6 @@ export class SingleVaultTokenHelper { const pricePerShare = await resolvePricePerShare({ reserve, supply, address, network }); const price = Number(pricePerShare) * underlyingToken.price; const liquidity = supply * price; - const tokens = [underlyingToken]; // Display properties diff --git a/src/apps/aelin/contracts/abis/aelin-v-aelin.json b/src/apps/aelin/contracts/abis/aelin-v-aelin.json new file mode 100644 index 000000000..8460c073e --- /dev/null +++ b/src/apps/aelin/contracts/abis/aelin-v-aelin.json @@ -0,0 +1,123 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "preDistributionAddress", "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": 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": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "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": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/apps/aelin/contracts/ethers/AelinVAelin.ts b/src/apps/aelin/contracts/ethers/AelinVAelin.ts new file mode 100644 index 000000000..ef2e01aa4 --- /dev/null +++ b/src/apps/aelin/contracts/ethers/AelinVAelin.ts @@ -0,0 +1,336 @@ +/* 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 AelinVAelinInterface extends utils.Interface { + functions: { + 'allowance(address,address)': FunctionFragment; + 'approve(address,uint256)': FunctionFragment; + 'balanceOf(address)': FunctionFragment; + 'decimals()': FunctionFragment; + 'decreaseAllowance(address,uint256)': FunctionFragment; + 'increaseAllowance(address,uint256)': FunctionFragment; + 'name()': FunctionFragment; + 'symbol()': FunctionFragment; + 'totalSupply()': FunctionFragment; + 'transfer(address,uint256)': FunctionFragment; + 'transferFrom(address,address,uint256)': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'allowance' + | 'approve' + | 'balanceOf' + | 'decimals' + | 'decreaseAllowance' + | 'increaseAllowance' + | 'name' + | 'symbol' + | 'totalSupply' + | 'transfer' + | 'transferFrom', + ): FunctionFragment; + + encodeFunctionData(functionFragment: 'allowance', values: [string, string]): string; + encodeFunctionData(functionFragment: 'approve', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'balanceOf', values: [string]): string; + encodeFunctionData(functionFragment: 'decimals', values?: undefined): string; + encodeFunctionData(functionFragment: 'decreaseAllowance', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'increaseAllowance', 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: 'balanceOf', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'decimals', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'decreaseAllowance', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'increaseAllowance', 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; + 'Transfer(address,address,uint256)': EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: 'Approval'): 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 TransferEventObject { + from: string; + to: string; + value: BigNumber; +} +export type TransferEvent = TypedEvent<[string, string, BigNumber], TransferEventObject>; + +export type TransferEventFilter = TypedEventFilter; + +export interface AelinVAelin extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: AelinVAelinInterface; + + 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; + + balanceOf(account: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + 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; + + name(overrides?: CallOverrides): Promise<[string]>; + + symbol(overrides?: CallOverrides): Promise<[string]>; + + totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + + transfer( + recipient: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + transferFrom( + sender: string, + recipient: 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; + + balanceOf(account: string, overrides?: CallOverrides): 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; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + recipient: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + transferFrom( + sender: string, + recipient: 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; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance(spender: string, subtractedValue: BigNumberish, overrides?: CallOverrides): Promise; + + increaseAllowance(spender: string, addedValue: BigNumberish, overrides?: CallOverrides): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer(recipient: string, amount: BigNumberish, overrides?: CallOverrides): Promise; + + transferFrom(sender: string, recipient: 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; + + '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; + + balanceOf(account: string, overrides?: CallOverrides): 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; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + recipient: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + transferFrom( + sender: string, + recipient: 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; + + balanceOf(account: string, overrides?: CallOverrides): 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; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + recipient: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + + transferFrom( + sender: string, + recipient: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise }, + ): Promise; + }; +} diff --git a/src/apps/aelin/contracts/ethers/factories/AelinVAelin__factory.ts b/src/apps/aelin/contracts/ethers/factories/AelinVAelin__factory.ts new file mode 100644 index 000000000..94e864ab3 --- /dev/null +++ b/src/apps/aelin/contracts/ethers/factories/AelinVAelin__factory.ts @@ -0,0 +1,301 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { AelinVAelin, AelinVAelinInterface } from '../AelinVAelin'; + +const _abi = [ + { + inputs: [ + { + internalType: 'address', + name: 'preDistributionAddress', + 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: 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: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'decimals', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'subtractedValue', + type: 'uint256', + }, + ], + name: 'decreaseAllowance', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'addedValue', + type: 'uint256', + }, + ], + name: 'increaseAllowance', + 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: 'recipient', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + internalType: 'address', + name: 'recipient', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, +]; + +export class AelinVAelin__factory { + static readonly abi = _abi; + static createInterface(): AelinVAelinInterface { + return new utils.Interface(_abi) as AelinVAelinInterface; + } + static connect(address: string, signerOrProvider: Signer | Provider): AelinVAelin { + return new Contract(address, _abi, signerOrProvider) as AelinVAelin; + } +} diff --git a/src/apps/aelin/contracts/ethers/factories/index.ts b/src/apps/aelin/contracts/ethers/factories/index.ts index 828e40c67..21dc607ac 100644 --- a/src/apps/aelin/contracts/ethers/factories/index.ts +++ b/src/apps/aelin/contracts/ethers/factories/index.ts @@ -3,3 +3,4 @@ /* eslint-disable */ export { AelinPool__factory } from './AelinPool__factory'; export { AelinStaking__factory } from './AelinStaking__factory'; +export { AelinVAelin__factory } from './AelinVAelin__factory'; diff --git a/src/apps/aelin/contracts/ethers/index.ts b/src/apps/aelin/contracts/ethers/index.ts index db808ead1..1e23a6294 100644 --- a/src/apps/aelin/contracts/ethers/index.ts +++ b/src/apps/aelin/contracts/ethers/index.ts @@ -3,6 +3,8 @@ /* eslint-disable */ export type { AelinPool } from './AelinPool'; export type { AelinStaking } from './AelinStaking'; +export type { AelinVAelin } from './AelinVAelin'; export * as factories from './factories'; export { AelinPool__factory } from './factories/AelinPool__factory'; export { AelinStaking__factory } from './factories/AelinStaking__factory'; +export { AelinVAelin__factory } from './factories/AelinVAelin__factory'; diff --git a/src/apps/aelin/contracts/index.ts b/src/apps/aelin/contracts/index.ts index af8f970ef..27bd1aab9 100644 --- a/src/apps/aelin/contracts/index.ts +++ b/src/apps/aelin/contracts/index.ts @@ -6,6 +6,7 @@ import { Network } from '~types/network.interface'; import { AelinPool__factory } from './ethers'; import { AelinStaking__factory } from './ethers'; +import { AelinVAelin__factory } from './ethers'; type ContractOpts = { address: string; network: Network }; @@ -21,7 +22,11 @@ export class AelinContractFactory extends ContractFactory { aelinStaking({ address, network }: ContractOpts) { return AelinStaking__factory.connect(address, this.appToolkit.getNetworkProvider(network)); } + aelinVAelin({ address, network }: ContractOpts) { + return AelinVAelin__factory.connect(address, this.appToolkit.getNetworkProvider(network)); + } } export type { AelinPool } from './ethers'; export type { AelinStaking } from './ethers'; +export type { AelinVAelin } from './ethers'; diff --git a/src/apps/aelin/optimism/aelin.v-aelin.token-fetcher.ts b/src/apps/aelin/optimism/aelin.v-aelin.token-fetcher.ts index 5b0460fdb..ffad445c1 100644 --- a/src/apps/aelin/optimism/aelin.v-aelin.token-fetcher.ts +++ b/src/apps/aelin/optimism/aelin.v-aelin.token-fetcher.ts @@ -7,6 +7,7 @@ import { AppTokenPosition } from '~position/position.interface'; import { Network } from '~types/network.interface'; import { AELIN_DEFINITION } from '../aelin.definition'; +import { AelinContractFactory } from '../contracts'; @Register.TokenPositionFetcher({ appId: AELIN_DEFINITION.id, @@ -14,15 +15,19 @@ import { AELIN_DEFINITION } from '../aelin.definition'; network: Network.OPTIMISM_MAINNET, }) export class OptimismAelinVAelinTokenFetcher implements PositionFetcher { - constructor(@Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit) {} + constructor( + @Inject(APP_TOOLKIT) private readonly appToolkit: IAppToolkit, + @Inject(AelinContractFactory) private readonly aelinContractFactory: AelinContractFactory, + ) {} async getPositions() { return this.appToolkit.helpers.singleVaultTokenHelper.getTokens({ - address: '0x780f70882ff4929d1a658a4e8ec8d4316b24748a', - resolveUnderlyingTokenAddress: () => '0x61baadcf22d2565b0f471b291c475db5555e0b76', appId: AELIN_DEFINITION.id, groupId: AELIN_DEFINITION.groups.vAelin.id, network: Network.OPTIMISM_MAINNET, + address: '0x780f70882ff4929d1a658a4e8ec8d4316b24748a', + resolveContract: ({ address, network }) => this.aelinContractFactory.aelinVAelin({ address, network }), + resolveUnderlyingTokenAddress: () => '0x61baadcf22d2565b0f471b291c475db5555e0b76', resolvePricePerShare: () => 1, }); }