From dafba06136ae516ee6ae8cabaae0bc8c73b67229 Mon Sep 17 00:00:00 2001 From: Pablo Veyrat Date: Thu, 7 Dec 2023 12:07:56 +0100 Subject: [PATCH] refactor: sdk cleaning old useless stuff --- .env.sample | 2 - CONTRIBUTING.md | 2 +- README.md | 65 +---------- package.json | 4 +- src/constants/contracts.ts | 77 +------------ src/constants/contracts_addresses/arbitrum.ts | 1 - src/constants/contracts_addresses/aurora.ts | 1 - .../contracts_addresses/avalanche.ts | 7 -- src/constants/contracts_addresses/fantom.ts | 1 - src/constants/contracts_addresses/mainnet.ts | 105 ------------------ src/constants/contracts_addresses/optimism.ts | 1 - src/constants/contracts_addresses/polygon.ts | 7 -- src/constants/index.ts | 1 - src/constants/parameters/arbitrum.ts | 11 -- src/constants/parameters/avalanche.ts | 11 -- src/constants/parameters/optimism.ts | 11 -- src/constants/tokens.ts | 79 ------------- src/utils/index.ts | 27 ----- 18 files changed, 5 insertions(+), 408 deletions(-) delete mode 100644 .env.sample delete mode 100644 src/constants/tokens.ts diff --git a/.env.sample b/.env.sample deleted file mode 100644 index 95b860d7..00000000 --- a/.env.sample +++ /dev/null @@ -1,2 +0,0 @@ -PROVIDER_URL= -MNEMONIC= \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index de7db213..818791e8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ First of all thank you for your interest in this repository! -This is only the beginning of the Angle protocol and codebase, and anyone is welcome to improve it. +This is only the beginning of the Angle protocol and Merkl codebases, and anyone is welcome to improve them. To submit some code, please work in a fork, reach out to explain what you've done and open a Pull Request from your fork. diff --git a/README.md b/README.md index a466bcc2..b4cee4fa 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,9 @@ # Angle SDK Angle SDK -- [Angle SDK](#angle-sdk) -- [Warning:](#warning) -- [Estimators](#estimators) - - [Example:](#example) -- [Ethereum Read & Write](#ethereum-read--write) - - [Example:](#example-1) -- [Keeper functions](#keeper-functions) -- [Constants](#constants) -- [Lib](#lib) - - [Build and use in development environment](#build-and-use-in-development-enviroment) - -SDK to build applications on top of [Angle Protocol](https://angle.money). +This is a SDK maintained by Angle Labs to build applications on top of [Angle Protocol](https://angle.money) and [Merkl](https://merkl.angle.money). ## Warning This SDK is in open beta, and is constantly under development. USE AT YOUR OWN RISK. Please make sure you're using the last SDK version, otherwise the results / addresses may be incorrect. - -## Estimators - -Estimators are utility functions to preview the result of Angle's operations. - -```js -import { estimateMint, parseAmount } from '@angleprotocol/sdk'; -// To compute the amount of stablecoin you'd get from a mint - -const stablecoinsObtained = await estimateMint(parseAmount.usdc(1), 'USDC', 'agEUR'); -console.log(stablecoinsObtained); -``` - -## Ethereum Read & Write - -Located in the `calls` folder, these functions are example of scripted interactions with Angle Protocol's contracts. - -```js -import { ethers } from 'ethers'; - -import { ChainId, harvest } from '@angleprotocol/sdk'; -// To harvest a collateral strategy - -const signer = // initialize an ethers signer - -const receipt = await harvest(ChainId.MAINNET, 'agEUR', 'USDC', signer); -await receipt.wait(); -``` - -## Keeper functions - -Located in the `calls` folder, a set of functions that can be used to build keeper bots - -## Constants - -Located in the `constants` folder, all the contract addresses, parameters and abis - -## Lib - -Located in the `lib` folder, a set of classes and utilities that can be used to work with big numbers - -### Build and use in development environment - -1. To properly generate the ABI types run `yarn generate-types-from-abis`. - -2. To build the SDK run `yarn build`. - -3. Once built, run `yarn link`. This will create a symbolic link to this package in your local yarn repositories. - -4. To add the local package to your project, go in the root directory of your project (where you would typically run `yarn add ...`) and run `yarn link @angleprotocol/sdk`. _Notice that `@angleprotocol/sdk` is the name of the SDK project in its `package.json` file._ - -If you update the SDK you will have to rerun Step 1 but the linking to the newest version will be done automatically in the other projects (you do not need to rerun Steps 2 and 3) diff --git a/package.json b/package.json index 0902c3e0..309a9a41 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@angleprotocol/sdk", "version": "3.0.126", - "description": "SDK for Angle Protocol DApps", + "description": "SDK for Angle DApps", "keywords": [ "angle", "angle money", @@ -26,7 +26,7 @@ }, "license": "GPL-3.0-or-later", "author": { - "name": "Angle Core Team", + "name": "Angle Labs", "email": "contact@angle.money", "url": "https://angle.money" }, diff --git a/src/constants/contracts.ts b/src/constants/contracts.ts index e71f3062..93fb4b0b 100644 --- a/src/constants/contracts.ts +++ b/src/constants/contracts.ts @@ -16,15 +16,6 @@ import LINEA_ADDRESSES from './contracts_addresses/linea'; import ZKSYNC_ADDRESSES from './contracts_addresses/zksync'; import MANTLE_ADDRESSES from './contracts_addresses/mantle'; -export enum AMO { - 'agEURvEUROC' = 'agEURvEUROC', -} - -type AMOType = Readonly<{ - AMO: string; - KeeperJob: string; -}>; - export enum BorrowCollateral { 'LUSD' = 'LUSD', 'bIB01' = 'bIB01', @@ -60,23 +51,6 @@ type BorrowCollateralType = { }; }; -export enum LenderStrategy { - 'GenericOptimisedLender' = 'GenericOptimisedLender', - 'AaveFlashloan' = 'AaveFlashloan', -} - -type LenderStrategyType = { - AaveConvexStaker?: string; - Contract: string; - GenericAave?: string; - GenericCompound?: string; - GenericEuler?: string; -}; - -export enum SimpleStrategy { - 'StETH' = 'StETH', -} - export enum Collateral { 'DAI' = 'DAI', 'FEI' = 'FEI', @@ -97,12 +71,6 @@ type CollateralType = Readonly< PoolManager: string; SanToken: string; Staking?: string; - Strategies?: { - [strategy in SimpleStrategy]?: string; - } & - { - [strategy in LenderStrategy]?: LenderStrategyType; - }; }> >; @@ -132,7 +100,6 @@ type StablecoinType = Readonly< Anyswap?: string; LayerZero?: string; RainbowBridge?: string; - Synapse?: string; }; }> >; @@ -174,24 +141,10 @@ export type ContractsRegistryType = Readonly< Timelock: string; veANGLE: string; veBoostProxy: string; - ExternalStakings: { - tokenName: string; - stakingContractAddress: string; - poolContractAddress: string; - liquidityGaugeAddress?: string; - }[]; - Gauges: { gaugeName: string; gaugeAddress: string; type: number }[]; - AMO: { - AMOMinter: string; - BPAMOs?: { - [key in AMO]?: AMOType; - }; - }; bridges?: { Anyswap?: string; LayerZero?: string; RainbowBridge?: string; - Synapse?: string; }; } & { [key in Stablecoin]?: StablecoinType; @@ -225,9 +178,6 @@ type RegistryArgs = | { stablecoin: Stablecoin | string; } - | { - amo: AMO | string; - } | { stablecoin: Stablecoin | string; collateral: Collateral | string; @@ -239,21 +189,13 @@ type RegistryArgs = | { stablecoin: Stablecoin | string; collateral: Collateral | string; - strategy: SimpleStrategy | string; } | { stablecoin: Stablecoin | string; collateral: Collateral | string; - lenderStrategy: LenderStrategy | string; }; export function registry(chainId: number | ChainId): ContractsRegistryType['1'] | undefined; -export function registry( - chainId: number | ChainId, - args: { - amo: AMO | string; - } -): AMOType | undefined; export function registry(chainId: number | ChainId, stablecoin: Stablecoin | string): StablecoinType | undefined; export function registry( chainId: number | ChainId, @@ -285,17 +227,8 @@ export function registry( args: { stablecoin: Stablecoin | string; collateral: Collateral | string; - strategy: SimpleStrategy | string; } ): string | undefined; -export function registry( - chainId: number | ChainId, - args: { - stablecoin: Stablecoin | string; - collateral: Collateral | string; - lenderStrategy: LenderStrategy | string; - } -): LenderStrategyType | undefined; export function registry(chainId: number | ChainId, args: RegistryArgs = null, collateral: Collateral | string | null = null): any { if (!!args && typeof args === 'string' && !!collateral) { return registry(chainId, { stablecoin: args, collateral: collateral }); @@ -303,13 +236,7 @@ export function registry(chainId: number | ChainId, args: RegistryArgs = null, c if (!!args && typeof args === 'string') { return registry(chainId, { stablecoin: args }); } - if (!!args && typeof args !== 'string' && 'strategy' in args) { - return CONTRACTS_ADDRESSES[chainId as ChainId]?.[args.stablecoin as Stablecoin]?.collaterals?.[args.collateral as Collateral] - ?.Strategies?.[args.strategy as SimpleStrategy]; - } else if (!!args && typeof args !== 'string' && 'lenderStrategy' in args) { - return CONTRACTS_ADDRESSES[chainId as ChainId]?.[args.stablecoin as Stablecoin]?.collaterals?.[args.collateral as Collateral] - ?.Strategies?.[args.lenderStrategy as LenderStrategy]; - } else if (!!args && typeof args !== 'string' && 'borrowCollateral' in args) { + if (!!args && typeof args !== 'string' && 'borrowCollateral' in args) { return CONTRACTS_ADDRESSES[chainId as ChainId]?.[args.stablecoin as Stablecoin]?.borrowCollaterals?.[ args.borrowCollateral as BorrowCollateral ]; @@ -317,8 +244,6 @@ export function registry(chainId: number | ChainId, args: RegistryArgs = null, c return CONTRACTS_ADDRESSES[chainId as ChainId]?.[args.stablecoin as Stablecoin]?.collaterals?.[args.collateral as Collateral]; } else if (!!args && typeof args !== 'string' && 'stablecoin' in args) { return CONTRACTS_ADDRESSES[chainId as ChainId]?.[args.stablecoin as Stablecoin]; - } else if (!!args && typeof args !== 'string' && 'amo' in args) { - return CONTRACTS_ADDRESSES[chainId as ChainId]?.AMO?.BPAMOs?.[args.amo as AMO]; } else { return CONTRACTS_ADDRESSES[chainId as ChainId]; } diff --git a/src/constants/contracts_addresses/arbitrum.ts b/src/constants/contracts_addresses/arbitrum.ts index 7d46b4cd..8896bbb9 100644 --- a/src/constants/contracts_addresses/arbitrum.ts +++ b/src/constants/contracts_addresses/arbitrum.ts @@ -45,7 +45,6 @@ const addresses: ContractsRegistryType['1'] = { }, }, bridges: { - Synapse: '0x16BFc5fe024980124bEf51d1D792dC539d1B5Bf0', LayerZero: '0x16cd38b1B54E7abf307Cb2697E2D9321e843d5AA', }, OracleTokenUSD: '0xA14d53bC1F1c0F31B4aA3BD109344E5009051a84', diff --git a/src/constants/contracts_addresses/aurora.ts b/src/constants/contracts_addresses/aurora.ts index 805005f5..c026dd02 100644 --- a/src/constants/contracts_addresses/aurora.ts +++ b/src/constants/contracts_addresses/aurora.ts @@ -7,7 +7,6 @@ const addresses: ContractsRegistryType['1'] = { RainbowBridge: '0xdc7AcDE9ff18B4D189010a21a44cE51ec874eA7C', }, }, - ExternalStakings: [], Governor: '0xb87a5C4f023e6b9F0B78905dB0B00f82e47952bE', Guardian: '0x9864AeBFF39e1ED02545856aE0e595E97fC6fCb4', }; diff --git a/src/constants/contracts_addresses/avalanche.ts b/src/constants/contracts_addresses/avalanche.ts index 0ab864b3..ac14d6b8 100644 --- a/src/constants/contracts_addresses/avalanche.ts +++ b/src/constants/contracts_addresses/avalanche.ts @@ -29,13 +29,6 @@ const addresses: ContractsRegistryType['1'] = { SwapperV2: '0x5e6955627e30660ecA4bCA2fB8Ac09e0DBEb63C1', Treasury: '0xa014A485D64efb236423004AB1a99C0aaa97a549', }, - ExternalStakings: [ - { - tokenName: 'Pangolin agEUR/AVAX', - stakingContractAddress: '', - poolContractAddress: '0x4A045a80967B5ecc440c88dF9a15a3339d43D029', - }, - ], CoreBorrow: '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD', FlashAngle: '0x9C215206Da4bf108aE5aEEf9dA7caD3352A36Dad', Governor: '0x43a7947A1288e65fAF30D8dDb3ca61Eaabd41613', diff --git a/src/constants/contracts_addresses/fantom.ts b/src/constants/contracts_addresses/fantom.ts index 681dea00..665408e4 100644 --- a/src/constants/contracts_addresses/fantom.ts +++ b/src/constants/contracts_addresses/fantom.ts @@ -7,7 +7,6 @@ const addresses: ContractsRegistryType['1'] = { Anyswap: '0x02a2b736F9150d36C0919F3aCEE8BA2A92FBBb40', }, }, - ExternalStakings: [], }; export default addresses; diff --git a/src/constants/contracts_addresses/mainnet.ts b/src/constants/contracts_addresses/mainnet.ts index f260a646..186a1fe4 100644 --- a/src/constants/contracts_addresses/mainnet.ts +++ b/src/constants/contracts_addresses/mainnet.ts @@ -109,17 +109,6 @@ const addresses: ContractsRegistryType['1'] = { PoolManager: '0xc9daabC677F3d1301006e723bD21C60be57a5915', SanToken: '0x7B8E89b0cE7BAC2cfEC92A371Da899eA8CBdb450', Staking: '0x65e4992250B296790c07FAdF0f0723902a07E91d', - Strategies: { - GenericOptimisedLender: { - Contract: '0x5577f822A979b7456ca08C5E311067d777e734c4', - GenericAave: '0x53890a56d175fb8123cc1b430e8407aa20928792', - GenericCompound: '0x6e97bE3E5C6e7167287E208A32720068fd9A9E06', - GenericEuler: '0xceD32E95C971610AdF264EC8f619fCBf242D64D7', - }, - AaveFlashloan: { - Contract: '0x9fBbCB9e5399693cDeAE803d7e08938Bb6A847AA', - }, - }, }, FEI: { FeeManager: '0x4A5E967100CA28566CB2A39216992C6dB57e95A4', @@ -129,12 +118,6 @@ const addresses: ContractsRegistryType['1'] = { PoolManager: '0x53b981389Cfc5dCDA2DC2e903147B5DD0E985F44', SanToken: '0x5d8D3Ac6D21C016f9C935030480B7057B21EC804', Staking: '0x3d7E670d105e8FBcAE3BF2bFC54324302cDb6aD5', - Strategies: { - GenericOptimisedLender: { - Contract: '0xb46a42427e412869F1bd7B9b3a2b5E5856A8907e', - GenericAave: '0xe2a58De0B3A8a1143d541935bf78F04a84fb6303', - }, - }, }, FRAX: { FeeManager: '0x9c8438713cEa5466125f0331d9d875Ea43115bc9', @@ -145,13 +128,6 @@ const addresses: ContractsRegistryType['1'] = { Adapter4626Stakable: '0x14244978b1CC189324C3e35685D6Ae2F632e9846', SanToken: '0xb3B209Bb213A5Da5B947C56f2C770b3E1015f1FE', Staking: '0xbB9485e2b9B0da40Db3874A144700e31bd9c40C2', - Strategies: { - GenericOptimisedLender: { - Contract: '0x2D78B6f5Dc8985D90145F27C8f5A3782Eb9DeB2E', - GenericAave: '0x00aFAEF24D5D6814DbE64Cb97da9B0eea37475B5', - AaveConvexStaker: '0x9354f45b62c4217652053df752ae7ad2f9ff854a', - }, - }, }, USDC: { FeeManager: '0x97B6897AAd7aBa3861c04C0e6388Fc02AF1F227f', @@ -161,17 +137,6 @@ const addresses: ContractsRegistryType['1'] = { PoolManager: '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD', SanToken: '0x9C215206Da4bf108aE5aEEf9dA7caD3352A36Dad', Staking: '0x2Fa1255383364F6e17Be6A6aC7A56C9aCD6850a3', - Strategies: { - GenericOptimisedLender: { - Contract: '0xBfa4459868C60da9edd835F0be684EDeC054557b', - GenericAave: '0xe4377620697Be18E6d6aa911CA488571EeB3f081', - GenericCompound: '0xE2773fB045e53De5344f245E03eA614AF1064Ce3', - GenericEuler: '0xf5aD02F3DbBF4b42DEE1f1255607f929CA2a7c5a', - }, - AaveFlashloan: { - Contract: '0x1F847FD5E08Fb559A69280A14e7E904e6DBfF81f', - }, - }, }, wETH: { FeeManager: '0x3C69835bc56cf4F356CdedE634415f847DaA4753', @@ -179,9 +144,6 @@ const addresses: ContractsRegistryType['1'] = { PerpetualManager: '0xB924497a1157B1F8835c93cb7F3d4Aa6D2f227BA', PoolManager: '0x3f66867b4b6eCeBA0dBb6776be15619F73BC30A2', SanToken: '0x30c955906735e48D73080fD20CB488518A6333C8', - Strategies: { - StETH: '0x41A65AAE5d1C8437288d5a29B4D049897572758E', - }, }, }, OracleTokenUSD: '0xb49f677943BC038e9857d61E7d053CaA2C1734C1', @@ -214,15 +176,6 @@ const addresses: ContractsRegistryType['1'] = { SwapperV2: '0x601057CaAE843Bf34598217E95FB572F5e04186e', Treasury: '0x19F925a26A3a8eeE2438603CB04F39cbC007EfFB', }, - AMO: { - AMOMinter: '0xec876Edc3F1a24c99d7c56F017E1D51581952F84', - BPAMOs: { - agEURvEUROC: { - AMO: '0xC1e8Dba1cbF29f1CaA8343CAe96d5AdFD9bca736', - KeeperJob: '0xaa8787423EA62F55d90A3D98E8b05F684A79e348', - }, - }, - }, ANGLE: '0x31429d1856aD1377A8A0079410B297e1a9e214c2', AngleHelpers: '0x1B17ac6B8371D63E030C5981891d5FBb3E4e068E', AngleDistributor: '0x4f91F01cE8ec07c9B1f6a82c18811848254917Ab', @@ -259,64 +212,6 @@ const addresses: ContractsRegistryType['1'] = { Timelock: '0x5183f032bf42109cD370B9559FD22207e432301E', veANGLE: '0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5', veBoostProxy: '0x52701bFA0599db6db2b2476075D9a2f4Cb77DAe3', - ExternalStakings: [ - { - tokenName: 'Gelato Uniswap agEUR/USDC LP', - stakingContractAddress: '0xd97f480266B8c220929EFDF9B00d72E94Fa1f7d1', - poolContractAddress: '0x2bD9F7974Bc0E4Cb19B8813F8Be6034F3E772add', - liquidityGaugeAddress: '0xEB7547a8a734b6fdDBB8Ce0C314a9E6485100a3C', - }, - { - tokenName: 'Gelato Uniswap agEUR/wETH LP', - stakingContractAddress: '0x7eE4A0F368681E4d97a8dBe78dBD756e097B6a76', - poolContractAddress: '0x26C2251801D2cfb5461751c984Dc3eAA358bdf0f', - liquidityGaugeAddress: '0x3785Ce82be62a342052b9E5431e9D3a839cfB581', - }, - { - tokenName: 'SushiSwap LP Token agEUR/ANGLE', - stakingContractAddress: '0xA86CC1ae2D94C6ED2aB3bF68fB128c2825673267', - poolContractAddress: '0x1f4c763BdE1D4832B3EA0640e66Da00B98831355', - liquidityGaugeAddress: '0xBa625B318483516F7483DD2c4706aC92d44dBB2B', - }, - { - tokenName: 'Uniswap V2 agEUR/FEI', - stakingContractAddress: '0xBcb307F590972B1C3188b7916d2969Cf75309dc6', - poolContractAddress: '0xF89CE5eD65737dA8440411544b0499c9FaD323B2', - liquidityGaugeAddress: '0xd6282C5aEAaD4d776B932451C44b8EB453E44244', - }, - { - tokenName: 'Curve.fi Factory Plain Pool: 3EURpool', - stakingContractAddress: '0xf868da244C17CF0E288AE4A92c8636f072A7BaE3', - poolContractAddress: '0xb9446c4Ef5EBE66268dA6700D26f96273DE3d571', - }, - ], - Gauges: [ - { - gaugeName: 'Curve agEUR/ibEUR', - gaugeAddress: '0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185', - type: 2, - }, - { - gaugeName: 'Curve 3EUR', - gaugeAddress: '0x5EB715d601C2F27f83Cb554b6B36e047822fB70a', - type: 2, - }, - { - gaugeName: 'UniswapV3 agEUR/USDC', - gaugeAddress: '0x4EA4C5ca64A3950E53c61d0616DAF92727119093', - type: 2, - }, - { - gaugeName: 'Convex Bribes', - gaugeAddress: '0x957c66E97870e42301081217fBB1Aac45bc4eb4D', - type: 2, - }, - { - gaugeName: 'Pangolin agEUR/AVAX', - gaugeAddress: '0x9b8308742A0Faefbd7d39F7073eA07a328551eD4', - type: 2, - }, - ], }; export default addresses; diff --git a/src/constants/contracts_addresses/optimism.ts b/src/constants/contracts_addresses/optimism.ts index 82a373b5..431f0c25 100644 --- a/src/constants/contracts_addresses/optimism.ts +++ b/src/constants/contracts_addresses/optimism.ts @@ -25,7 +25,6 @@ const addresses: ContractsRegistryType['1'] = { }, }, bridges: { - Synapse: '0xa0554607e477cdC9d0EE2A6b087F4b2DC2815C22', LayerZero: '0x840b25c87B626a259CA5AC32124fA752F0230a72', }, OracleTokenUSD: '0x3626369857A10CcC6cc3A6e4f5C2f5984a519F20', diff --git a/src/constants/contracts_addresses/polygon.ts b/src/constants/contracts_addresses/polygon.ts index 27b6e794..adc48545 100644 --- a/src/constants/contracts_addresses/polygon.ts +++ b/src/constants/contracts_addresses/polygon.ts @@ -48,13 +48,6 @@ const addresses: ContractsRegistryType['1'] = { SwapperV2: '0x516735bF9a517fc66F53a798B1910498a8a621c5', Treasury: '0x2F2e0ba9746aae15888cf234c4EB5B301710927e', }, - ExternalStakings: [ - { - tokenName: 'G-UNI agEUR/USDC', - stakingContractAddress: '0x15BdE1A8d16d4072d949591aFd4fA7ad9d127D05', - poolContractAddress: '0x1644de0A8E54626b54AC77463900FcFFD8B94542', - }, - ], CoreBorrow: '0x78754109cb73772d70A6560297037657C2AF51b8', FlashAngle: '0x2878596427bfA6b52Fa6D93B519A0c610bbDf00a', Governor: '0xdA2D2f638D6fcbE306236583845e5822554c02EA', diff --git a/src/constants/index.ts b/src/constants/index.ts index c3c92788..65f6377c 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -28,5 +28,4 @@ export default ( export * from './contracts'; export * from './layerZero'; export * from './merkl'; -export * from './tokens'; export * from './types'; diff --git a/src/constants/parameters/arbitrum.ts b/src/constants/parameters/arbitrum.ts index e5d646df..8777f506 100644 --- a/src/constants/parameters/arbitrum.ts +++ b/src/constants/parameters/arbitrum.ts @@ -13,17 +13,6 @@ const stablesParameters: StablesParameters = { maxBorrowable: parseAmount.ether('1000000'), flashLoanFee: parseAmount.gwei('0'), }, - bridges: [ - { - name: 'Synapse', - token: '0x16BFc5fe024980124bEf51d1D792dC539d1B5Bf0', - params: { - fees: parseAmount.gwei('0.002'), - limit: parseEther('0'), - hourlyLimit: parseEther('50000'), - }, - }, - ], vaultManagers: [ { collateral: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', diff --git a/src/constants/parameters/avalanche.ts b/src/constants/parameters/avalanche.ts index 9e3b7549..d55229e7 100644 --- a/src/constants/parameters/avalanche.ts +++ b/src/constants/parameters/avalanche.ts @@ -13,17 +13,6 @@ const stablesParameters: StablesParameters = { maxBorrowable: parseAmount.ether('1000000'), flashLoanFee: parseAmount.gwei('0'), }, - bridges: [ - { - name: 'Anyswap', - token: '0x6feFd97F328342a8A840546A55FDcfEe7542F9A8', - params: { - fees: parseAmount.gwei('0.002'), - limit: parseEther('1000000'), - hourlyLimit: parseEther('50000'), - }, - }, - ], vaultManagers: [ { collateral: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', diff --git a/src/constants/parameters/optimism.ts b/src/constants/parameters/optimism.ts index 0f320907..53777629 100644 --- a/src/constants/parameters/optimism.ts +++ b/src/constants/parameters/optimism.ts @@ -13,17 +13,6 @@ const stablesParameters: StablesParameters = { maxBorrowable: parseAmount.ether('1000000'), flashLoanFee: parseAmount.gwei('0'), }, - bridges: [ - { - name: 'Synapse', - token: '0xa0554607e477cdC9d0EE2A6b087F4b2DC2815C22', - params: { - fees: parseAmount.gwei('0.002'), - limit: parseEther('0'), - hourlyLimit: parseEther('50000'), - }, - }, - ], vaultManagers: [ { collateral: '0x4200000000000000000000000000000000000006', diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts deleted file mode 100644 index d28efb4d..00000000 --- a/src/constants/tokens.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { constants } from 'ethers'; - -import { AssetType, ChainId, Token } from '../types'; -import { CONTRACTS_ADDRESSES, registry } from './contracts'; - -const listStables = (chainId: ChainId) => { - return Object.keys(CONTRACTS_ADDRESSES[chainId]) - .filter((key) => key.startsWith('ag')) - .map((key) => { - const contractAddress = registry(chainId, key)?.AgToken; - if (!!contractAddress) return { key: key, contractAddress: contractAddress }; - return { key: '', contractAddress: '' }; - }) - .filter((obj) => { - return !!obj.key && !!obj.contractAddress; - }) - .map((obj: { key: string; contractAddress: string }) => { - return new Token(chainId, obj.contractAddress, 18, obj.key, `Angle ${obj.key.slice(2)}`, true); - }); -}; - -type TokenDict = { - [tokenAddress: string]: Token; -}; -type AllTokens = Readonly<{ - [AssetType.STABLE]: Readonly; - [AssetType.COLLATERAL]: Readonly; - [AssetType.EXTERNAL_STAKING]: Readonly; - [AssetType.ANGLE]: Token; -}>; -const arrayOfTokensToTokenDict = (arr: Token[]): TokenDict => { - return arr.reduce((acc, token) => { - return { - ...acc, - [token.address.toLowerCase()]: token, - }; - }, {}); -}; - -export const ALL_TOKENS: AllTokens = { - [AssetType.STABLE]: arrayOfTokensToTokenDict(listStables(ChainId.MAINNET)), - [AssetType.COLLATERAL]: arrayOfTokensToTokenDict([ - new Token(ChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'Dai Stablecoin'), - new Token(ChainId.MAINNET, '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 6, 'USDC', 'USD Coin'), - new Token(ChainId.MAINNET, '0x956f47f50a910163d8bf957cf5846d573e7f87ca', 18, 'FEI', 'Fei USD'), - new Token(ChainId.MAINNET, '0x853d955acef822db058eb8505911ed77f175b99e', 18, 'FRAX', 'FRAX'), - new Token(ChainId.MAINNET, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'wETH', 'Wrapped Ether'), - ]), - - [AssetType.EXTERNAL_STAKING]: arrayOfTokensToTokenDict([ - new Token( - ChainId.MAINNET, - '0x2bD9F7974Bc0E4Cb19B8813F8Be6034F3E772add', - 18, - 'G-Uni agEUR/USDC old', - 'Gelato Uniswap agEUR/USDC LP old' - ), - new Token(ChainId.MAINNET, '0xEDECB43233549c51CC3268b5dE840239787AD56c', 18, 'G-Uni agEUR/USDC', 'Gelato Uniswap agEUR/USDC LP'), - new Token( - ChainId.MAINNET, - '0x26C2251801D2cfb5461751c984Dc3eAA358bdf0f', - 18, - 'G-Uni agEUR/wETH old', - 'Gelato Uniswap agEUR/wETH LP old' - ), - new Token(ChainId.MAINNET, '0x857E0B2eD0E82D5cDEB015E77ebB873C47F99575', 18, 'G-Uni agEUR/wETH', 'Gelato Uniswap agEUR/wETH LP'), - new Token(ChainId.MAINNET, '0x1f4c763bde1d4832b3ea0640e66da00b98831355', 18, 'SLP agEUR/ANGLE', 'SushiSwap LP agEUR/ANGLE'), - new Token(ChainId.MAINNET, '0xb9446c4Ef5EBE66268dA6700D26f96273DE3d571', 18, '3EURpool-f', 'Curve.fi Factory Plain Pool: 3EURpool'), - new Token(ChainId.MAINNET, '0xb37d6c07482bc11cd28a1f11f1a6ad7b66dec933', 18, 'ag+ib-EUR-f', 'Curve.fi Factory Plain Pool:ag+ib-EUR-f'), - new Token(ChainId.MAINNET, '0xF89CE5eD65737dA8440411544b0499c9FaD323B2', 18, 'UNI-V2 agEUR/FEI', 'Uniswap V2 agEUR/FEI'), - ]), - [AssetType.ANGLE]: new Token( - ChainId.MAINNET, - CONTRACTS_ADDRESSES[ChainId.MAINNET].ANGLE ?? constants.AddressZero, - 18, - 'ANGLE', - 'Angle Governance Token' - ), -}; diff --git a/src/utils/index.ts b/src/utils/index.ts index 9e7405cf..dfb1acad 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,9 +1,6 @@ import { BigNumberish } from 'ethers'; import { formatUnits } from 'ethers/lib/utils'; -import { ALL_TOKENS, AssetType } from '../index'; -import { Token } from '../types'; - export * from './merkl'; export * from './thegraph'; @@ -22,27 +19,3 @@ export const requireEnvVars = (vars: T[]): Record); }; - -export function parseStable(stablecoin: string): Token { - let stable; - for (const token of Object.values(ALL_TOKENS[AssetType.STABLE])) { - if (token.symbol === stablecoin || token.address === stablecoin || token.name === stablecoin || token.symbol === 'ag' + stablecoin) { - stable = token; - } - } - if (stable === undefined) throw 'Incorrect stablecoin value'; - - return stable; -} - -export function parseCollat(collateral: string): Token { - let collat; - for (const token of Object.values(ALL_TOKENS[AssetType.COLLATERAL])) { - if (token.symbol === collateral || token.address === collateral || token.name === collateral) { - collat = token; - } - } - if (collat === undefined) throw 'Incorrect collateral value'; - - return collat; -}