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

Commit

Permalink
feat(umami-finance): GLP vaults (#2791)
Browse files Browse the repository at this point in the history
* feat(umami-finance): GLP vaults, remove deprecated v1 vault

* update to latest deployment

* add vaults logo, update main app logo

---------

Co-authored-by: William Poulin <will@zapper.fi>
  • Loading branch information
Clonescody and wpoulin committed Jul 1, 2023
1 parent 7f13e14 commit c8f4c9a
Show file tree
Hide file tree
Showing 28 changed files with 6,209 additions and 6,869 deletions.
@@ -0,0 +1,80 @@
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 {
GetAddressesParams,
GetUnderlyingTokensParams,
UnderlyingTokenDefinition,
GetPricePerShareParams,
DefaultAppTokenDataProps,
GetDisplayPropsParams,
} from '~position/template/app-token.template.types';

import { UmamiFinanceGlpVaultAddress } from '../common/umami-finance.constants';
import { UmamiFinanceContractFactory } from '../contracts';
import { UmamiFinanceGlpVault } from '../contracts/ethers/UmamiFinanceGlpVault';

export type UmamiFinanceGlpVaultAppTokenDefinition = {
address: string;
timelockedVaultAddress: string;
};

@PositionTemplate()
export class ArbitrumUmamiFinanceGlpVaultsTokenFetcher extends AppTokenTemplatePositionFetcher<
UmamiFinanceGlpVault,
DefaultAppTokenDataProps,
UmamiFinanceGlpVaultAppTokenDefinition
> {
groupLabel: string;

constructor(
@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit,
@Inject(UmamiFinanceContractFactory) private readonly umamiFinanceContractFactory: UmamiFinanceContractFactory,
) {
super(appToolkit);
this.groupLabel = 'GLP Vaults';
}

getContract(_address: string): UmamiFinanceGlpVault {
return this.umamiFinanceContractFactory.umamiFinanceGlpVault({ address: _address, network: this.network });
}

async getAddresses(_params: GetAddressesParams<UmamiFinanceGlpVaultAppTokenDefinition>): Promise<string[]> {
return [
UmamiFinanceGlpVaultAddress.GLP_USDC,
UmamiFinanceGlpVaultAddress.GLP_WETH,
UmamiFinanceGlpVaultAddress.GLP_WBTC,
UmamiFinanceGlpVaultAddress.GLP_LINK,
UmamiFinanceGlpVaultAddress.GLP_UNI,
];
}

async getUnderlyingTokenDefinitions({
contract,
}: GetUnderlyingTokensParams<UmamiFinanceGlpVault, UmamiFinanceGlpVaultAppTokenDefinition>): Promise<
UnderlyingTokenDefinition[]
> {
const underlyingToken = await contract.asset();
return [{ address: underlyingToken, network: this.network }];
}

async getPricePerShare({
contract,
appToken,
}: GetPricePerShareParams<
UmamiFinanceGlpVault,
DefaultAppTokenDataProps,
UmamiFinanceGlpVaultAppTokenDefinition
>): Promise<number[]> {
const pricePerShareRaw = await contract.pps();
const pricePerShare = Number(pricePerShareRaw) / 10 ** appToken.decimals;

return [pricePerShare];
}

async getLabel({ appToken }: GetDisplayPropsParams<UmamiFinanceGlpVault>): Promise<string> {
return `GLP ${appToken.tokens[0].symbol}`;
}
}
@@ -0,0 +1,75 @@
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 {
GetAddressesParams,
DefaultAppTokenDefinition,
GetUnderlyingTokensParams,
UnderlyingTokenDefinition,
GetPricePerShareParams,
DefaultAppTokenDataProps,
GetDisplayPropsParams,
} from '~position/template/app-token.template.types';

import { UmamiFinanceTimelockedGlpVaultAddress } from '../common/umami-finance.constants';
import { UmamiFinanceContractFactory } from '../contracts';
import { UmamiFinanceTimelockedGlpVault } from '../contracts/ethers/UmamiFinanceTimelockedGlpVault';

@PositionTemplate()
export class ArbitrumUmamiFinanceTimelockedGlpVaultsTokenFetcher extends AppTokenTemplatePositionFetcher<UmamiFinanceTimelockedGlpVault> {
groupLabel: string;

constructor(
@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit,
@Inject(UmamiFinanceContractFactory) private readonly umamiFinanceContractFactory: UmamiFinanceContractFactory,
) {
super(appToolkit);
this.groupLabel = 'Timelocked GLP Vaults';
}

getContract(_address: string): UmamiFinanceTimelockedGlpVault {
return this.umamiFinanceContractFactory.umamiFinanceTimelockedGlpVault({
address: _address,
network: this.network,
});
}

async getAddresses(_params: GetAddressesParams<DefaultAppTokenDefinition>): Promise<string[]> {
return [
UmamiFinanceTimelockedGlpVaultAddress.TL_GLP_USDC,
UmamiFinanceTimelockedGlpVaultAddress.TL_GLP_WETH,
UmamiFinanceTimelockedGlpVaultAddress.TL_GLP_WBTC,
UmamiFinanceTimelockedGlpVaultAddress.TL_GLP_LINK,
UmamiFinanceTimelockedGlpVaultAddress.TL_GLP_UNI,
];
}

async getUnderlyingTokenDefinitions({
contract,
}: GetUnderlyingTokensParams<UmamiFinanceTimelockedGlpVault, DefaultAppTokenDefinition>): Promise<
UnderlyingTokenDefinition[]
> {
const underlyingToken = await contract.asset();
return [{ address: underlyingToken, network: this.network }];
}

async getPricePerShare({
contract,
appToken,
}: GetPricePerShareParams<
UmamiFinanceTimelockedGlpVault,
DefaultAppTokenDataProps,
DefaultAppTokenDefinition
>): Promise<number[]> {
const pricePerShareRaw = await contract.pps();
const pricePerShare = Number(pricePerShareRaw) / 10 ** appToken.decimals;

return [pricePerShare];
}

async getLabel({ appToken }: GetDisplayPropsParams<UmamiFinanceTimelockedGlpVault>): Promise<string> {
return `Timelocked GLP ${appToken.tokens[0].symbol}`;
}
}

This file was deleted.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/apps/umami-finance/assets/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/apps/umami-finance/common/umami-finance.constants.ts
@@ -0,0 +1,15 @@
export enum UmamiFinanceGlpVaultAddress {
GLP_USDC = '0x727ed4ef04bb2a96ec77e44c1a91dbb01b605e42',
GLP_WETH = '0xbb84d79159d6bbe1de148dc82640caa677e06126',
GLP_WBTC = '0x6a89faf99587a12e6bb0351f2fa9006c6cd12257',
GLP_LINK = '0xe0a21a475f8da0ee7fa5af8c1809d8ac5257607d',
GLP_UNI = '0x37c0705a65948ea5e0ae1add13552bcad7711a23',
}

export enum UmamiFinanceTimelockedGlpVaultAddress {
TL_GLP_USDC = '0xdca4e88c00a8800ebcebad63abdbaaaa755557f9',
TL_GLP_WETH = '0xf2ad33e12a9780f1e42d878a29a3e0756008c838',
TL_GLP_WBTC = '0x83c19ec75d649aec7c99e2c6663ca055569da7c0',
TL_GLP_LINK = '0xb0d9e1832bd973abd8f3b4d710ead21fcbefcb7c',
TL_GLP_UNI = '0xee57e7e3776e4868976f315e07a883955c9225d5',
}

0 comments on commit c8f4c9a

Please sign in to comment.