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 383
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]> Co-authored-by: William Poulin <[email protected]>
- Loading branch information
1 parent
7c95fa7
commit 2f5510f
Showing
8 changed files
with
5,200 additions
and
14 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
1,376 changes: 1,376 additions & 0 deletions
1,376
src/apps/thales/contracts/ethers/factories/Vaults__factory.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* Autogenerated file. Do not edit manually. */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export { EscrowThales__factory } from './EscrowThales__factory'; | ||
export { LpStaking__factory } from './LpStaking__factory'; | ||
export { StakingThales__factory } from './StakingThales__factory'; | ||
export { EscrowThales__factory } from "./EscrowThales__factory"; | ||
export { LpStaking__factory } from "./LpStaking__factory"; | ||
export { StakingThales__factory } from "./StakingThales__factory"; | ||
export { Vaults__factory } from "./Vaults__factory"; |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
/* Autogenerated file. Do not edit manually. */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export type { EscrowThales } from './EscrowThales'; | ||
export type { LpStaking } from './LpStaking'; | ||
export type { StakingThales } from './StakingThales'; | ||
export * as factories from './factories'; | ||
export { EscrowThales__factory } from './factories/EscrowThales__factory'; | ||
export { LpStaking__factory } from './factories/LpStaking__factory'; | ||
export { StakingThales__factory } from './factories/StakingThales__factory'; | ||
export type { EscrowThales } from "./EscrowThales"; | ||
export type { LpStaking } from "./LpStaking"; | ||
export type { StakingThales } from "./StakingThales"; | ||
export type { Vaults } from "./Vaults"; | ||
export * as factories from "./factories"; | ||
export { EscrowThales__factory } from "./factories/EscrowThales__factory"; | ||
export { LpStaking__factory } from "./factories/LpStaking__factory"; | ||
export { StakingThales__factory } from "./factories/StakingThales__factory"; | ||
export { Vaults__factory } from "./factories/Vaults__factory"; |
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
67 changes: 67 additions & 0 deletions
67
src/apps/thales/optimism/thales.vault.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,67 @@ | ||
import { Inject } from '@nestjs/common'; | ||
import { BigNumberish } from 'ethers'; | ||
import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface'; | ||
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; | ||
import { MetaType } from '~position/position.interface'; | ||
import { ContractPositionTemplatePositionFetcher } from '~position/template/contract-position.template.position-fetcher'; | ||
import { GetDisplayPropsParams, GetTokenBalancesParams } from '~position/template/contract-position.template.types'; | ||
|
||
import { Vaults, ThalesContractFactory } from '../contracts'; | ||
|
||
|
||
let vaultAddressToName = new Map<string, string>([ | ||
['0xb484027cb0c538538bad2be492714154f9196f93', 'Thales Discount'], | ||
['0x43318de9e8f65b591598f17add87ae7247649c83', 'Thales Degen Discount'], | ||
['0x6c7fd4321183b542e81bcc7de4dfb88f9dbca29f', 'Thales Safu Discount'], | ||
['0xc922f4cde42dd658a7d3ea852caf7eae47f6cecd', 'Overtime Discount'], | ||
['0xbaac5464bf6e767c9af0e8d4677c01be2065fd5f', 'Overtime Degen Discount'], | ||
['0x43d19841d818b2ccc63a8b44ce8c7def8616d98e', 'Overtime Safu Discount'], | ||
]); | ||
|
||
@PositionTemplate() | ||
export class OptimismThalesVaultContractPositionFetcher extends ContractPositionTemplatePositionFetcher<Vaults> { | ||
groupLabel = 'Vault'; | ||
|
||
constructor( | ||
@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit, | ||
@Inject(ThalesContractFactory) private readonly contractFactory: ThalesContractFactory, | ||
) { | ||
super(appToolkit); | ||
} | ||
|
||
getContract(address: string): Vaults { | ||
return this.contractFactory.vaults({ network: this.network, address }); | ||
} | ||
|
||
async getDefinitions() { | ||
let definitions = new Array; | ||
for (let vaultAddress of vaultAddressToName.keys()) { | ||
definitions.push({ address: vaultAddress }) | ||
} | ||
return definitions; | ||
} | ||
|
||
async getTokenDefinitions() { | ||
return [ | ||
{ | ||
address: '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9', // sUSD | ||
metaType: MetaType.SUPPLIED, | ||
network: this.network, | ||
}, | ||
]; | ||
} | ||
|
||
async getLabel({ contractPosition }: GetDisplayPropsParams<Vaults>) { | ||
return `${vaultAddressToName.get(contractPosition.address)} Vault`; | ||
} | ||
|
||
async getTokenBalancesPerPosition({ | ||
address, | ||
contract, | ||
}: GetTokenBalancesParams<Vaults>): Promise<BigNumberish[]> { | ||
const currentRound = await contract.round(); | ||
const currentBalance = await contract.getBalancesPerRound(Number(currentRound), address); | ||
const pendingdeposit = await contract.getBalancesPerRound(Number(currentRound) + 1, address); | ||
return [Number(currentBalance) + Number(pendingdeposit)]; | ||
} | ||
} |
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