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

Commit

Permalink
feat(tokemak): Add accTOKE
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich committed Dec 28, 2022
1 parent 6f67371 commit 31c4458
Show file tree
Hide file tree
Showing 8 changed files with 2,525 additions and 0 deletions.
420 changes: 420 additions & 0 deletions src/apps/tokemak/contracts/abis/tokemak-acc-toke.json

Large diffs are not rendered by default.

1,162 changes: 1,162 additions & 0 deletions src/apps/tokemak/contracts/ethers/TokemakAccToke.ts

Large diffs are not rendered by default.

900 changes: 900 additions & 0 deletions src/apps/tokemak/contracts/ethers/factories/TokemakAccToke__factory.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/apps/tokemak/contracts/ethers/factories/index.ts
@@ -1,6 +1,7 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export { TokemakAccToke__factory } from './TokemakAccToke__factory';
export { TokemakReactor__factory } from './TokemakReactor__factory';
export { TokemakRewards__factory } from './TokemakRewards__factory';
export { TokemakRewardsHash__factory } from './TokemakRewardsHash__factory';
Expand Down
2 changes: 2 additions & 0 deletions src/apps/tokemak/contracts/ethers/index.ts
@@ -1,11 +1,13 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export type { TokemakAccToke } from './TokemakAccToke';
export type { TokemakReactor } from './TokemakReactor';
export type { TokemakRewards } from './TokemakRewards';
export type { TokemakRewardsHash } from './TokemakRewardsHash';
export type { TokemakTokeStaking } from './TokemakTokeStaking';
export * as factories from './factories';
export { TokemakAccToke__factory } from './factories/TokemakAccToke__factory';
export { TokemakReactor__factory } from './factories/TokemakReactor__factory';
export { TokemakRewardsHash__factory } from './factories/TokemakRewardsHash__factory';
export { TokemakRewards__factory } from './factories/TokemakRewards__factory';
Expand Down
5 changes: 5 additions & 0 deletions src/apps/tokemak/contracts/index.ts
Expand Up @@ -4,6 +4,7 @@ import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface';
import { ContractFactory } from '~contract/contracts';
import { Network } from '~types/network.interface';

import { TokemakAccToke__factory } from './ethers';
import { TokemakReactor__factory } from './ethers';
import { TokemakRewards__factory } from './ethers';
import { TokemakRewardsHash__factory } from './ethers';
Expand All @@ -18,6 +19,9 @@ export class TokemakContractFactory extends ContractFactory {
super((network: Network) => appToolkit.getNetworkProvider(network));
}

tokemakAccToke({ address, network }: ContractOpts) {
return TokemakAccToke__factory.connect(address, this.appToolkit.getNetworkProvider(network));
}
tokemakReactor({ address, network }: ContractOpts) {
return TokemakReactor__factory.connect(address, this.appToolkit.getNetworkProvider(network));
}
Expand All @@ -32,6 +36,7 @@ export class TokemakContractFactory extends ContractFactory {
}
}

export type { TokemakAccToke } from './ethers';
export type { TokemakReactor } from './ethers';
export type { TokemakRewards } from './ethers';
export type { TokemakRewardsHash } from './ethers';
Expand Down
33 changes: 33 additions & 0 deletions src/apps/tokemak/ethereum/tokemak.acc-toke.token-fetcher.ts
@@ -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 { AppTokenTemplatePositionFetcher } from '~position/template/app-token.template.position-fetcher';
import { GetUnderlyingTokensParams } from '~position/template/app-token.template.types';

import { TokemakContractFactory } from '../contracts';
import { TokemakAccToke } from '../contracts/ethers/TokemakAccToke';

@PositionTemplate()
export class EthereumTokemakAccTokeTokenFetcher extends AppTokenTemplatePositionFetcher<TokemakAccToke> {
groupLabel = 'accTOKE';

constructor(
@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit,
@Inject(TokemakContractFactory) private readonly contractFactory: TokemakContractFactory,
) {
super(appToolkit);
}

getContract(address: string): TokemakAccToke {
return this.contractFactory.tokemakAccToke({ network: this.network, address });
}

async getAddresses(): Promise<string[]> {
return ['0xa374a62ddbd21e3d5716cb04821cb710897c0972'];
}

async getUnderlyingTokenDefinitions({ contract }: GetUnderlyingTokensParams<TokemakAccToke>) {
return [{ address: await contract.toke(), network: this.network }];
}
}
2 changes: 2 additions & 0 deletions src/apps/tokemak/tokemak.module.ts
Expand Up @@ -3,6 +3,7 @@ import { AbstractApp } from '~app/app.dynamic-module';

import { TokemakClaimableResolver } from './common/tokemak.claimable.resolver';
import { TokemakContractFactory } from './contracts';
import { EthereumTokemakAccTokeTokenFetcher } from './ethereum/tokemak.acc-toke.token-fetcher';
import { EthereumTokemakClaimableContractPositionFetcher } from './ethereum/tokemak.claimable.contract-position-fetcher';
import { EthereumTokemakFarmContractPositionFetcher } from './ethereum/tokemak.farm.contract-position-fetcher';
import { EthereumTokemakReactorTokenFetcher } from './ethereum/tokemak.reactor.token-fetcher';
Expand All @@ -17,6 +18,7 @@ import { TokemakAppDefinition, TOKEMAK_DEFINITION } from './tokemak.definition';
EthereumTokemakReactorTokenFetcher,
EthereumTokemakFarmContractPositionFetcher,
EthereumTokemakClaimableContractPositionFetcher,
EthereumTokemakAccTokeTokenFetcher,
],
})
export class TokemakAppModule extends AbstractApp() {}

0 comments on commit 31c4458

Please sign in to comment.