This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: gaulois <[email protected]>
- Loading branch information
1 parent
8b7aecb
commit 621fd9e
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/apps/kwenta/optimism/kwenta.escrow-v2.contract-position-fetcher.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Inject } from '@nestjs/common'; | ||
|
||
import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; | ||
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; | ||
import { GetTokenDefinitionsParams, GetTokenBalancesParams } from '~position/template/contract-position.template.types'; | ||
import { VotingEscrowTemplateContractPositionFetcher } from '~position/template/voting-escrow.template.contract-position-fetcher'; | ||
|
||
import { KwentaContractFactory, KwentaStakingV2 } from '../contracts'; | ||
|
||
@PositionTemplate() | ||
export class OptimismKwentaEscrowV2ContractPositionFetcher extends VotingEscrowTemplateContractPositionFetcher<KwentaStakingV2> { | ||
groupLabel = 'Escrow V2'; | ||
veTokenAddress = '0x61294940ce7cd1bda10e349adc5b538b722ceb88'; | ||
|
||
constructor( | ||
@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit, | ||
@Inject(KwentaContractFactory) protected readonly contractFactory: KwentaContractFactory, | ||
) { | ||
super(appToolkit); | ||
} | ||
|
||
getEscrowContract(address: string): KwentaStakingV2 { | ||
return this.contractFactory.kwentaStakingV2({ address, network: this.network }); | ||
} | ||
|
||
getEscrowedTokenAddress({ contract }: GetTokenDefinitionsParams<KwentaStakingV2>) { | ||
return contract.kwenta(); | ||
} | ||
|
||
async getEscrowedTokenBalance({ contract, address }: GetTokenBalancesParams<KwentaStakingV2>) { | ||
return await contract.unstakedEscrowedBalanceOf(address); | ||
} | ||
} |