Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
feat(kwenta): escrow v2 (#2961)
Browse files Browse the repository at this point in the history
Co-authored-by: gaulois <[email protected]>
  • Loading branch information
gdeschryver and gaulois authored Oct 6, 2023
1 parent 8b7aecb commit 621fd9e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/apps/kwenta/kwenta.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { AbstractApp } from '~app/app.dynamic-module';
import { SynthetixContractFactory } from '../synthetix/contracts';

import { KwentaContractFactory } from './contracts';
import { OptimismKwentaEscrowV2ContractPositionFetcher } from './optimism/kwenta.escrow-v2.contract-position-fetcher';
import { OptimismKwentaEscrowContractPositionFetcher } from './optimism/kwenta.escrow.contract-position-fetcher';
import { OptimismKwentaPerpV1CrossMarginContractPositionFetcher } from './optimism/kwenta.perp-v1-cross-margin.contract-position-fetcher';
import { OptimismKwentaPerpV2SmartMarginContractPositionFetcher } from './optimism/kwenta.perp-v2-smart-margin.contract-position-fetcher';
import { OptimismKwentaStakingContractPositionFetcher } from './optimism/kwenta.staking.contract-position-fetcher';
import { OptimismKwentaStakingV2ContractPositionFetcher } from './optimism/kwenta.staking-v2.contract-position-fetcher';
import { OptimismKwentaStakingContractPositionFetcher } from './optimism/kwenta.staking.contract-position-fetcher';

@Module({
providers: [
Expand All @@ -20,6 +21,7 @@ import { OptimismKwentaStakingV2ContractPositionFetcher } from './optimism/kwent
OptimismKwentaStakingContractPositionFetcher,
OptimismKwentaEscrowContractPositionFetcher,
OptimismKwentaStakingV2ContractPositionFetcher,
OptimismKwentaEscrowV2ContractPositionFetcher,
],
})
export class KwentaAppModule extends AbstractApp() { }
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);
}
}

0 comments on commit 621fd9e

Please sign in to comment.