diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 04f85c65..14e8f316 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,18 +41,8 @@ jobs: - run: npm run test:builders - run: npm run test:quotes - run: npm run test:hyeth - - run: npm run test:rwa - run: npm run test:btc2x - # skipping as currently no liquidity for sfrETH - # - run: npm run test:dseth - # - run: npm run test:eth2x - # - run: npm run test:gtceth - # - run: npm run test:iceth - # - run: npm run test:icreth - # - run: npm run test:cdeti - # run last - as it alters the block number - # skip as it can't be minted or redeemed with 0x - # - run: npm run test:eth2xfli + - run: npm run test:eth2x publish: runs-on: ubuntu-latest if: ${{ github.ref == 'refs/heads/main' }} diff --git a/package.json b/package.json index 7414063b..3c33b24a 100644 --- a/package.json +++ b/package.json @@ -30,15 +30,10 @@ "test:quotes": "npm test src/quote/", "test:utils": "npm test src/utils", "test:btc2x": "npm test src/tests/btc2x.test.ts", - "test:cdeti": "npm test src/tests/cdeti", "test:dseth": "npm test src/tests/dseth", "test:eth2x": "npm test src/tests/eth2x.test.ts", - "test:eth2xfli": "npm test src/tests/eth2xfli", - "test:gtceth": "npm test src/tests/gtceth", "test:hyeth": "npm test src/tests/hyeth.test.ts", - "test:rwa": "npm test src/tests/rwa.presale.test.ts", "test:iceth": "npm test src/tests/iceth", - "test:icreth": "npm test src/tests/icreth", "test:watch": "jest --watch" }, "keywords": [ diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts index 88b1c2e9..e2447cba 100644 --- a/src/constants/tokens.ts +++ b/src/constants/tokens.ts @@ -86,11 +86,6 @@ export const InterestCompoundingETHIndex: Token = { address: '0x7C07F7aBe10CE8e33DC6C5aD68FE033085256A84', } -export const LeveragedrEthStakingYield: Token = { - symbol: 'icRETH', - address: '0xcCdAE12162566E3f29fEfA7Bf7F5b24C644493b5', -} - export const MetaverseIndex: Token = { address: '0x72e364F2ABdC788b7E918bc238B21f109Cd634D7', addressPolygon: '0xfe712251173A2cd5F5bE2B46Bb528328EA3565E1', diff --git a/src/flashmint/builders/leveraged.test.ts b/src/flashmint/builders/leveraged.test.ts index 2cd4310b..c1fad765 100644 --- a/src/flashmint/builders/leveraged.test.ts +++ b/src/flashmint/builders/leveraged.test.ts @@ -1,9 +1,6 @@ import { BigNumber } from '@ethersproject/bignumber' -import { - ExchangeIssuanceLeveragedMainnetAddress, - FlashMintLeveragedAddress, -} from 'constants/contracts' +import { ExchangeIssuanceLeveragedMainnetAddress } from 'constants/contracts' import { collateralDebtSwapData, debtCollateralSwapData, @@ -26,7 +23,7 @@ const chainId = 1 const provider = LocalhostProvider const rpcUrl = LocalhostProviderUrl -const { iceth, icreth, reth, usdc } = QuoteTokens +const { iceth, usdc } = QuoteTokens const eth = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' const indexToken = iceth @@ -175,38 +172,6 @@ describe('LeveragedTransactionBuilder()', () => { expect(tx.value).toEqual(buildRequest.inputOutputTokenAmount) }) - test('returns a tx for minting icRETH (rETH)', async () => { - const isMinting = true - const buildRequest = { - isMinting, - indexToken: icreth.address, - indexTokenSymbol: icreth.symbol, - inputOutputToken: reth.address, - inputOutputTokenSymbol: reth.symbol, - indexTokenAmount: wei(1), - inputOutputTokenAmount: BigNumber.from(194235680), - swapDataDebtCollateral: isMinting - ? collateralDebtSwapData['icETH'] - : debtCollateralSwapData['icETH'], - swapDataPaymentToken: isMinting - ? inputSwapData[indexToken.symbol]['ETH'] - : outputSwapData[indexToken.symbol]['ETH'], - } - const refTx = await contract.populateTransaction.issueExactSetFromERC20( - buildRequest.indexToken, - buildRequest.indexTokenAmount, - buildRequest.inputOutputToken, - buildRequest.inputOutputTokenAmount, - buildRequest.swapDataDebtCollateral, - buildRequest.swapDataPaymentToken - ) - const builder = new LeveragedTransactionBuilder(rpcUrl) - const tx = await builder.build(buildRequest) - if (!tx) fail() - expect(tx.to).toBe(FlashMintLeveragedAddress) - expect(tx.data).toEqual(refTx.data) - }) - test('returns a tx for redeeming dsETH (ERC20)', async () => { const buildRequest = createBuildRequest(false) const refTx = await contract.populateTransaction.redeemExactSetForERC20( diff --git a/src/quote/provider/index.test.ts b/src/quote/provider/index.test.ts index 6284be69..8388cc55 100644 --- a/src/quote/provider/index.test.ts +++ b/src/quote/provider/index.test.ts @@ -1,9 +1,6 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { ChainId } from 'constants/chains' -import { - FlashMintHyEthAddress, - FlashMintZeroExMainnetAddress, -} from 'constants/contracts' +import { FlashMintHyEthAddress } from 'constants/contracts' import { IndexCoopEthereum2xIndex } from 'constants/tokens' import { getFlashMintLeveragedContractForToken, @@ -31,7 +28,7 @@ const rpcUrl = LocalhostProviderUrl const provider = LocalhostProvider const zeroexSwapQuoteProvider = IndexZeroExSwapQuoteProvider -const { cdeti, dseth, eth, eth2x, hyeth, iceth, usdc } = QuoteTokens +const { dseth, eth, eth2x, hyeth, iceth, usdc } = QuoteTokens describe('FlashMintQuoteProvider()', () => { test('throws if token is unsupported', async () => { @@ -57,37 +54,6 @@ describe('FlashMintQuoteProvider()', () => { ) }) - test('returns a quote for minting cdETI', async () => { - const request: FlashMintQuoteRequest = { - isMinting: true, - inputToken: eth, - outputToken: cdeti, - indexTokenAmount: wei(1), - slippage: 0.1, - } - const quoteProvider = new FlashMintQuoteProvider( - rpcUrl, - zeroexSwapQuoteProvider - ) - const quote = await quoteProvider.getQuote(request) - if (!quote) fail() - const chainId = (await provider.getNetwork()).chainId - expect(quote.chainId).toEqual(chainId) - expect(quote.contractType).toEqual(FlashMintContractType.zeroEx) - expect(quote.contract).toEqual(FlashMintZeroExMainnetAddress) - expect(quote.isMinting).toEqual(request.isMinting) - expect(quote.inputToken).toEqual(request.inputToken) - expect(quote.outputToken).toEqual(request.outputToken) - expect(quote.inputAmount).toEqual(quote.inputOutputAmount) - expect(quote.outputAmount).toEqual(request.indexTokenAmount) - expect(quote.indexTokenAmount).toEqual(request.indexTokenAmount) - expect(quote.inputOutputAmount.gt(0)).toBe(true) - expect(quote.slippage).toEqual(request.slippage) - expect(quote.tx).not.toBeNull() - expect(quote.tx.to).toBe(FlashMintZeroExMainnetAddress) - expect(quote.tx.data?.length).toBeGreaterThan(0) - }) - test.skip('returns a quote for minting dsETH', async () => { const inputToken = usdc const outputToken = dseth diff --git a/src/quote/provider/utils.test.ts b/src/quote/provider/utils.test.ts index 3f9126ce..73c8da13 100644 --- a/src/quote/provider/utils.test.ts +++ b/src/quote/provider/utils.test.ts @@ -1,8 +1,6 @@ import { ChainId } from 'constants/chains' import { BanklessBEDIndex, - BTC2xFlexibleLeverageIndex, - CoinDeskEthTrendIndex, DefiPulseIndex, DiversifiedStakedETHIndex, ETH2xFlexibleLeverageIndex, @@ -15,9 +13,7 @@ import { IndexCoopInverseBitcoinIndex, IndexCoopInverseEthereumIndex, InterestCompoundingETHIndex, - LeveragedrEthStakingYield, MetaverseIndex, - RealWorldAssetIndex, } from 'constants/tokens' import { FlashMintContractType } from './' @@ -65,14 +61,6 @@ describe('getContractType()', () => { expect(contractType).toBe(FlashMintContractType.zeroEx) }) - test('returns correct contract type for cdETI', async () => { - const contractType = getContractType( - CoinDeskEthTrendIndex.symbol, - ChainId.Mainnet - ) - expect(contractType).toBe(FlashMintContractType.zeroEx) - }) - test('returns correct contract type for DPI', async () => { const contractType = getContractType(DefiPulseIndex.symbol, ChainId.Mainnet) expect(contractType).toBe(FlashMintContractType.zeroEx) @@ -99,14 +87,6 @@ describe('getContractType()', () => { expect(contractType).toBe(FlashMintContractType.zeroEx) }) - test('returns correct contract type for BTC2x-FLI', async () => { - const contractType = getContractType( - BTC2xFlexibleLeverageIndex.symbol, - ChainId.Mainnet - ) - expect(contractType).toBe(FlashMintContractType.leveraged) - }) - test('returns correct contract type for ETH2x-FLI', async () => { const contractType = getContractType( ETH2xFlexibleLeverageIndex.symbol, @@ -146,20 +126,4 @@ describe('getContractType()', () => { ) expect(contractType).toBe(FlashMintContractType.leveraged) }) - - test('returns correct contract type for icRETH', async () => { - const contractType = getContractType( - LeveragedrEthStakingYield.symbol, - ChainId.Mainnet - ) - expect(contractType).toBe(FlashMintContractType.leveraged) - }) - - test('returns correct contract type for RWA', async () => { - const contractType = getContractType( - RealWorldAssetIndex.symbol, - ChainId.Mainnet - ) - expect(contractType).toBe(FlashMintContractType.zeroEx) - }) }) diff --git a/src/quote/provider/utils.ts b/src/quote/provider/utils.ts index b3f413c1..a8f0d9b7 100644 --- a/src/quote/provider/utils.ts +++ b/src/quote/provider/utils.ts @@ -15,7 +15,6 @@ import { IndexCoopInverseBitcoinIndex, IndexCoopInverseEthereumIndex, InterestCompoundingETHIndex, - LeveragedrEthStakingYield, MetaverseIndex, RealWorldAssetIndex, } from 'constants/tokens' @@ -56,8 +55,7 @@ export function getContractType( token === ETH2xFlexibleLeverageIndex.symbol || token === IndexCoopBitcoin2xIndex.symbol || token === IndexCoopEthereum2xIndex.symbol || - token === InterestCompoundingETHIndex.symbol || - token === LeveragedrEthStakingYield.symbol + token === InterestCompoundingETHIndex.symbol ) return FlashMintContractType.leveraged return null diff --git a/src/quote/swap/adapters/adapter.ts b/src/quote/swap/adapters/adapter.ts index 26f3c252..48c527fd 100644 --- a/src/quote/swap/adapters/adapter.ts +++ b/src/quote/swap/adapters/adapter.ts @@ -1,4 +1,5 @@ -import { ETH, stETH } from 'constants/tokens' +import { EthAddress } from 'constants/addresses' +import { stETH } from 'constants/tokens' import { CurveSwapQuoteProvider } from 'quote/swap/adapters/curve' import { UniswapSwapQuoteProvider } from 'quote/swap/adapters/uniswap' import { @@ -17,15 +18,12 @@ export class IndexSwapQuoteProvider implements SwapQuoteProvider { let inputToken = request.inputToken let outputToken = request.outputToken if (inputToken === 'ETH') { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - inputToken = ETH.address! + inputToken = EthAddress } if (outputToken === 'ETH') { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - outputToken = ETH.address! + outputToken = EthAddress } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const eth = ETH.address! + const eth = EthAddress // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const stEth = stETH.address! const isEth = diff --git a/src/tests/btc2xfli/index.test.ts b/src/tests/btc2xfli/index.test.ts deleted file mode 100644 index 56daa653..00000000 --- a/src/tests/btc2xfli/index.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { BigNumber } from '@ethersproject/bignumber' - -import { - getMainnetTestFactory, - QuoteTokens, - SignerAccount2, - TestFactory, - wei, -} from '../utils' - -const { btc2xfli, eth, usdc } = QuoteTokens - -describe('BTC2xFLI (mainnet)', () => { - let factory: TestFactory - beforeEach(() => { - const signer = SignerAccount2 - factory = getMainnetTestFactory(signer) - }) - - test('can mint BTC2xFLI', async () => { - await factory.fetchQuote({ - isMinting: true, - inputToken: eth, - outputToken: btc2xfli, - indexTokenAmount: wei('2'), - slippage: 1, - }) - await factory.executeTx() - }) - - test.skip('can redeem BTC2xFLI', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: btc2xfli, - outputToken: eth, - indexTokenAmount: wei('1'), - slippage: 1, - }) - await factory.executeTx(BigNumber.from(5_000_000)) - }) - - test.skip('can redeem BTC2xFLI for ERC20', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: btc2xfli, - outputToken: usdc, - indexTokenAmount: wei('1'), - slippage: 1, - }) - await factory.executeTx(BigNumber.from(5_000_000)) - }) -}) diff --git a/src/tests/cdeti/index.test.ts b/src/tests/cdeti/index.test.ts deleted file mode 100644 index 68367bf6..00000000 --- a/src/tests/cdeti/index.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - getMainnetTestFactory, - QuoteTokens, - SignerAccount5, - TestFactory, - transferFromWhale, - wei, -} from '../utils' - -const { cdeti, eth, usdc } = QuoteTokens - -describe('cdETI (mainnet)', () => { - let factory: TestFactory - beforeEach(async () => { - const signer = SignerAccount5 - factory = getMainnetTestFactory(signer) - }) - - test('minting with ETH', async () => { - await factory.fetchQuote({ - isMinting: true, - inputToken: eth, - outputToken: cdeti, - indexTokenAmount: wei('1'), - slippage: 0.5, - }) - await factory.executeTx() - }) - - test('redeeming to ETH', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: cdeti, - outputToken: eth, - indexTokenAmount: wei('1'), - slippage: 0.5, - }) - await factory.executeTx() - }) - - test('minting with USDC', async () => { - const quote = await factory.fetchQuote({ - isMinting: true, - inputToken: usdc, - outputToken: cdeti, - indexTokenAmount: wei('0.2'), - slippage: 0.5, - }) - const whale = '0x7713974908Be4BEd47172370115e8b1219F4A5f0' - await transferFromWhale( - whale, - factory.getSigner().address, - wei('10000', quote.inputToken.decimals), - quote.inputToken.address, - factory.getProvider() - ) - await factory.executeTx() - }) - - test('redeeming to USDC', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: cdeti, - outputToken: usdc, - indexTokenAmount: wei('0.2'), - slippage: 0.5, - }) - await factory.executeTx() - }) -}) diff --git a/src/tests/eth2x.test.ts b/src/tests/eth2x.test.ts index 2fe6162e..e8fd6856 100644 --- a/src/tests/eth2x.test.ts +++ b/src/tests/eth2x.test.ts @@ -16,7 +16,7 @@ describe('ETH2X (mainnet)', () => { factory = getMainnetTestFactory(signer) }) - test('can mint with ETH', async () => { + test.only('can mint with ETH', async () => { await factory.fetchQuote({ isMinting: true, inputToken: eth, diff --git a/src/tests/eth2xfli/index.test.ts b/src/tests/eth2xfli/index.test.ts deleted file mode 100644 index 8eb76da0..00000000 --- a/src/tests/eth2xfli/index.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - LocalhostProvider, - QuoteTokens, - TestFactory, - SignerAccount1, - wei, - IndexZeroExSwapQuoteProvider, -} from '../utils' - -const { eth, eth2xfli } = QuoteTokens -const swapQuoteProvider = IndexZeroExSwapQuoteProvider - -describe('ETH2xFLI (mainnet)', () => { - let factory: TestFactory - beforeAll(async () => { - const provider = LocalhostProvider - const signer = SignerAccount1 - factory = new TestFactory(provider, signer, swapQuoteProvider) - }) - - test('can mint ETH2xFLI', async () => { - await factory.fetchQuote({ - isMinting: true, - inputToken: eth, - outputToken: eth2xfli, - indexTokenAmount: wei('1'), - slippage: 1, - }) - await factory.executeTx() - }) - - test.skip('can redeem ETH2xFLI', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: eth2xfli, - outputToken: eth, - indexTokenAmount: wei('1'), - slippage: 1, - }) - await factory.executeTx() - }) -}) diff --git a/src/tests/eth2xfli/quotes.ts b/src/tests/eth2xfli/quotes.ts deleted file mode 100644 index 140bc9e4..00000000 --- a/src/tests/eth2xfli/quotes.ts +++ /dev/null @@ -1,103 +0,0 @@ -export const swapQuote01 = { - chainId: 1, - price: '0.000535397541066074', - guaranteedPrice: '0.000530043565655413', - estimatedPriceImpact: '0.5947', - to: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - data: '0xd9627aa400000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000be70800000000000000000000000000000000000000000000000000017809094f7d78a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2869584cd00000000000000000000000000736923aeba891f67f041a27a6db8ab7a437d6c000000000000000000000000000000000000000000000073c1e26e4d64ca0571', - value: '0', - gas: '136000', - estimatedGas: '136000', - gasPrice: '25500000000', - protocolFee: '0', - minimumProtocolFee: '0', - buyTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - sellTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - buyAmount: '6682103966930887', - sellAmount: '12480640', - sources: [ - { name: '0x', proportion: '0' }, - { name: 'Uniswap', proportion: '0' }, - { name: 'Uniswap_V2', proportion: '0' }, - { name: 'Curve', proportion: '0' }, - { name: 'Balancer', proportion: '0' }, - { name: 'Balancer_V2', proportion: '0' }, - { name: 'BancorV3', proportion: '0' }, - { name: 'SushiSwap', proportion: '1' }, - { name: 'DODO', proportion: '0' }, - { name: 'DODO_V2', proportion: '0' }, - { name: 'CryptoCom', proportion: '0' }, - { name: 'Lido', proportion: '0' }, - { name: 'MakerPsm', proportion: '0' }, - { name: 'KyberDMM', proportion: '0' }, - { name: 'Saddle', proportion: '0' }, - { name: 'Uniswap_V3', proportion: '0' }, - { name: 'Curve_V2', proportion: '0' }, - { name: 'ShibaSwap', proportion: '0' }, - { name: 'Synapse', proportion: '0' }, - { name: 'Synthetix', proportion: '0' }, - { name: 'Aave_V2', proportion: '0' }, - { name: 'Compound', proportion: '0' }, - { name: 'KyberElastic', proportion: '0' }, - ], - orders: [ - { - type: 0, - source: 'SushiSwap', - makerToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - takerToken: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - makerAmount: '6682103966930887', - takerAmount: '12480640', - fillData: { - tokenAddressPath: [ - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - ], - router: '0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f', - }, - fill: { - input: '12480640', - output: '6682103966930887', - adjustedOutput: '3749603966930887', - gas: 115000, - }, - }, - ], - allowanceTarget: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - decodedUniqueId: '73c1e26e4d-1690961265', - sellTokenToEthRate: '1856.66353', - buyTokenToEthRate: '1', - fees: { zeroExFee: null }, - grossPrice: '0.000535397541066074', - grossBuyAmount: '6682103966930887', - grossSellAmount: '12480640', - auxiliaryChainData: {}, - expectedSlippage: '0', -} - -export const swapQuote02 = { - chainId: 1, - estimatedPriceImpact: '0', - price: '1', - guaranteedPrice: '1', - to: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - data: '0xd0e30db0869584cd00000000000000000000000000736923aeba891f67f041a27a6db8ab7a437d6c0000000000000000000000000000000000000000000000abd7fd658764ca0572', - decodedUniqueId: 'abd7fd6587-1690961266', - value: '6599493996498215', - gas: '46000', - estimatedGas: '46000', - gasPrice: '25500000000', - protocolFee: '0', - minimumProtocolFee: '0', - buyTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - sellTokenAddress: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', - buyAmount: '6599493996498215', - sellAmount: '6599493996498215', - sources: [], - orders: [], - sellTokenToEthRate: '1', - buyTokenToEthRate: '1', - allowanceTarget: '0x0000000000000000000000000000000000000000', - auxiliaryChainData: {}, - fees: { zeroExFee: null }, -} diff --git a/src/tests/gtceth/index.test.ts b/src/tests/gtceth/index.test.ts index d1f48f12..553a5d47 100644 --- a/src/tests/gtceth/index.test.ts +++ b/src/tests/gtceth/index.test.ts @@ -5,12 +5,11 @@ import { QuoteTokens, SignerAccount0, TestFactory, - wrapETH, } from '../utils' -const { eth, gtcETH, weth } = QuoteTokens +const { eth, gtcETH } = QuoteTokens -// Works locally, fails on github actions for some reason. +// Does not work atm because of 0x quotes describe.skip('gtcETH (mainnet)', () => { let factory: TestFactory beforeEach(async () => { @@ -28,16 +27,4 @@ describe.skip('gtcETH (mainnet)', () => { }) await factory.executeTx() }) - - test.skip('minting with WETH', async () => { - await factory.fetchQuote({ - isMinting: true, - inputToken: weth, - outputToken: gtcETH, - indexTokenAmount: wei('0.1'), - slippage: 0.5, - }) - await wrapETH(wei(2), factory.getSigner()) - await factory.executeTx() - }) }) diff --git a/src/tests/hyeth.test.ts b/src/tests/hyeth.test.ts index 097fdd9a..154c2077 100644 --- a/src/tests/hyeth.test.ts +++ b/src/tests/hyeth.test.ts @@ -32,7 +32,7 @@ describe('hyETH', () => { await factory.executeTx() }) - test('can mint with USDC (IndexSwapQuoteProvider)', async () => { + test.skip('can mint with USDC (IndexSwapQuoteProvider)', async () => { const factory = getMainnetTestFactoryUniswap(signer) const quote = await factory.fetchQuote({ isMinting: true, @@ -52,7 +52,7 @@ describe('hyETH', () => { await factory.executeTx() }) - test('can redeem to ETH (IndexSwapQuoteProvider)', async () => { + test.skip('can redeem to ETH (IndexSwapQuoteProvider)', async () => { const factory = getMainnetTestFactoryUniswap(signer) await factory.fetchQuote({ isMinting: false, diff --git a/src/tests/icreth/index.test.ts b/src/tests/icreth/index.test.ts deleted file mode 100644 index 0f3c1d46..00000000 --- a/src/tests/icreth/index.test.ts +++ /dev/null @@ -1,152 +0,0 @@ -import { - IndexZeroExSwapQuoteProvider, - LocalhostProvider, - QuoteTokens, - SignerAccount2, - TestFactory, - transferFromWhale, - wei, - wrapETH, -} from '../utils' - -const { eth, icreth, reth, usdc, weth } = QuoteTokens - -const signer = SignerAccount2 -const swapQuoteProvider = IndexZeroExSwapQuoteProvider - -describe('icRETH (mainnet) - ETH', () => { - let factory: TestFactory - beforeAll(async () => { - const provider = LocalhostProvider - factory = new TestFactory(provider, signer, swapQuoteProvider) - }) - - test('can mint icRETH', async () => { - await factory.fetchQuote({ - isMinting: true, - inputToken: eth, - outputToken: icreth, - indexTokenAmount: wei('0.1'), - slippage: 1, - }) - await factory.executeTx() - }) - - test('can redeem icRETH for ETH', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: icreth, - outputToken: eth, - indexTokenAmount: wei('0.1'), - slippage: 1, - }) - await factory.executeTx() - }) -}) - -describe.skip('icRETH (mainnet) - rETH', () => { - let factory: TestFactory - beforeAll(async () => { - const provider = LocalhostProvider - factory = new TestFactory(provider, signer, swapQuoteProvider) - }) - - test('can mint icRETH', async () => { - const rethWhale = '0x7d6149aD9A573A6E2Ca6eBf7D4897c1B766841B4' - const quote = await factory.fetchQuote({ - isMinting: true, - inputToken: reth, - outputToken: icreth, - indexTokenAmount: wei('0.1'), - slippage: 1, - }) - await transferFromWhale( - rethWhale, - factory.getSigner().address, - wei(100), - quote.inputToken.address, - factory.getProvider() - ) - await factory.executeTx() - }) - - test('can redeem icRETH for rETH', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: icreth, - outputToken: reth, - indexTokenAmount: wei('0.1'), - slippage: 1, - }) - await factory.executeTx() - }) -}) - -describe.skip('icRETH (mainnet) - USDC', () => { - let factory: TestFactory - beforeAll(async () => { - const provider = LocalhostProvider - factory = new TestFactory(provider, signer, swapQuoteProvider) - }) - - test('can mint icRETH', async () => { - const usdcWhale = '0x7713974908Be4BEd47172370115e8b1219F4A5f0' - const quote = await factory.fetchQuote({ - isMinting: true, - inputToken: usdc, - outputToken: icreth, - indexTokenAmount: wei('0.1'), - slippage: 1, - }) - await transferFromWhale( - usdcWhale, - factory.getSigner().address, - wei(5000, 6), - quote.inputToken.address, - factory.getProvider() - ) - await factory.executeTx() - }) - - test('can redeem icRETH for USDC', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: icreth, - outputToken: usdc, - indexTokenAmount: wei('0.1'), - slippage: 1, - }) - await factory.executeTx() - }) -}) - -describe('icRETH (mainnet) - WETH', () => { - let factory: TestFactory - beforeAll(async () => { - const provider = LocalhostProvider - factory = new TestFactory(provider, signer, swapQuoteProvider) - }) - - test('can mint icRETH', async () => { - const quote = await factory.fetchQuote({ - isMinting: true, - inputToken: weth, - outputToken: icreth, - indexTokenAmount: wei('0.1'), - slippage: 1, - }) - await wrapETH(quote.inputOutputAmount, factory.getSigner()) - await factory.executeTx() - }) - - test('can redeem icRETH for WETH', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: icreth, - outputToken: weth, - indexTokenAmount: wei('0.1'), - slippage: 1, - }) - await factory.executeTx() - }) -}) diff --git a/src/tests/icreth/quotes.ts b/src/tests/icreth/quotes.ts deleted file mode 100644 index 649fd2f8..00000000 --- a/src/tests/icreth/quotes.ts +++ /dev/null @@ -1,303 +0,0 @@ -export const mintQuoteUsdc1 = { - chainId: 1, - price: '0.914944134587763751', - guaranteedPrice: '0.905794693241886113', - estimatedPriceImpact: '0.0016', - to: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - data: '0x6af479b200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000a05e0dbc562813a000000000000000000000000000000000000000000000000091428b3f713274d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4ae78736cd615f374d3085123a210448e74fc6393000000000000000000000000000000000000000000869584cd00000000000000000000000000736923aeba891f67f041a27a6db8ab7a437d6c00000000000000000000000000000000592bd11a839e89fea25d4612f1064d71', - value: '0', - gas: '145154', - estimatedGas: '145154', - gasPrice: '27500000000', - protocolFee: '0', - minimumProtocolFee: '0', - buyTokenAddress: '0xae78736cd615f374d3085123a210448e74fc6393', - sellTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - buyAmount: '660800605338433500', - sellAmount: '722230549776859450', - sources: [ - { name: '0x', proportion: '0' }, - { name: 'Uniswap', proportion: '0' }, - { name: 'Uniswap_V2', proportion: '0' }, - { name: 'Curve', proportion: '0' }, - { name: 'Balancer', proportion: '0' }, - { name: 'Balancer_V2', proportion: '0' }, - { name: 'BancorV3', proportion: '0' }, - { name: 'SushiSwap', proportion: '0' }, - { name: 'DODO', proportion: '0' }, - { name: 'DODO_V2', proportion: '0' }, - { name: 'CryptoCom', proportion: '0' }, - { name: 'Lido', proportion: '0' }, - { name: 'MakerPsm', proportion: '0' }, - { name: 'KyberDMM', proportion: '0' }, - { name: 'Saddle', proportion: '0' }, - { name: 'Uniswap_V3', proportion: '1' }, - { name: 'Curve_V2', proportion: '0' }, - { name: 'ShibaSwap', proportion: '0' }, - { name: 'Synapse', proportion: '0' }, - { name: 'Synthetix', proportion: '0' }, - { name: 'Aave_V2', proportion: '0' }, - { name: 'Compound', proportion: '0' }, - { name: 'KyberElastic', proportion: '0' }, - ], - orders: [ - { - type: 0, - source: 'Uniswap_V3', - makerToken: '0xae78736cd615f374d3085123a210448e74fc6393', - takerToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - makerAmount: '660800605338433500', - takerAmount: '722230549776859450', - fillData: { - router: '0xe592427a0aece92de3edee1f18e0157c05861564', - path: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4ae78736cd615f374d3085123a210448e74fc6393', - gasUsed: 9577, - routerVersion: 1, - }, - fill: { - input: '722230549776859450', - output: '660800605338433500', - adjustedOutput: '657802076813112313', - gas: 119172, - }, - }, - ], - allowanceTarget: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - decodedUniqueId: '0x592bd11a839e89fea25d4612f1064d71', - sellTokenToEthRate: '1', - buyTokenToEthRate: '0.91495821938685616', - fees: { zeroExFee: null }, - grossPrice: '0.914944134587763751', - grossBuyAmount: '660800605338433500', - grossSellAmount: '722230549776859450', - auxiliaryChainData: {}, - expectedSlippage: null, -} - -export const mintQuoteUsdc2 = { - chainId: 1, - price: '1847.90097', - guaranteedPrice: '1866.379981', - estimatedPriceImpact: '0.2205', - to: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - data: '0x6af479b20000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000b87e1f500000000000000000000000000000000000000000000000001703f3825360e4100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4ae78736cd615f374d3085123a210448e74fc6393000000000000000000000000000000000000000000000000000000000000869584cd00000000000000000000000000736923aeba891f67f041a27a6db8ab7a437d6c0000000000000000000000000000000021f49c0394f3156e80f860d83d1d722e', - value: '0', - gas: '165304', - estimatedGas: '165304', - gasPrice: '27500000000', - protocolFee: '0', - minimumProtocolFee: '0', - buyTokenAddress: '0xae78736cd615f374d3085123a210448e74fc6393', - sellTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - buyAmount: '103652301804539457', - sellAmount: '191539189', - sources: [ - { name: '0x', proportion: '0' }, - { name: 'Uniswap', proportion: '0' }, - { name: 'Uniswap_V2', proportion: '0' }, - { name: 'Curve', proportion: '0' }, - { name: 'Balancer', proportion: '0' }, - { name: 'Balancer_V2', proportion: '0' }, - { name: 'BancorV3', proportion: '0' }, - { name: 'SushiSwap', proportion: '0' }, - { name: 'DODO', proportion: '0' }, - { name: 'DODO_V2', proportion: '0' }, - { name: 'CryptoCom', proportion: '0' }, - { name: 'Lido', proportion: '0' }, - { name: 'MakerPsm', proportion: '0' }, - { name: 'KyberDMM', proportion: '0' }, - { name: 'Saddle', proportion: '0' }, - { name: 'Uniswap_V3', proportion: '1' }, - { name: 'Curve_V2', proportion: '0' }, - { name: 'ShibaSwap', proportion: '0' }, - { name: 'Synapse', proportion: '0' }, - { name: 'Synthetix', proportion: '0' }, - { name: 'Aave_V2', proportion: '0' }, - { name: 'Compound', proportion: '0' }, - { name: 'KyberElastic', proportion: '0' }, - ], - orders: [ - { - type: 0, - source: 'Uniswap_V3', - makerToken: '0xae78736cd615f374d3085123a210448e74fc6393', - takerToken: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - makerAmount: '103652301804539457', - takerAmount: '191539189', - fillData: { - router: '0xe592427a0aece92de3edee1f18e0157c05861564', - path: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4ae78736cd615f374d3085123a210448e74fc6393', - gasUsed: 19652, - routerVersion: 1, - }, - fill: { - input: '103652301804539457', - output: '191539189', - adjustedOutput: '191539189', - gas: 139296, - }, - }, - ], - allowanceTarget: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - decodedUniqueId: '0x21f49c0394f3156e80f860d83d1d722e', - sellTokenToEthRate: '1687.02568', - buyTokenToEthRate: '0.91495821938685616', - fees: { zeroExFee: null }, - grossPrice: '1847.90097', - grossBuyAmount: '103652301804539457', - grossSellAmount: '191539189', - auxiliaryChainData: {}, - expectedSlippage: null, -} - -export const redeemQuoteUsdc1 = { - chainId: 1, - price: '0.915892504636705813', - guaranteedPrice: '0.925051429683072871', - estimatedPriceImpact: '0.1021', - to: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - data: '0x6af479b200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000945b26eb798959d0000000000000000000000000000000000000000000000000a0604290c90f50d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bae78736cd615f374d3085123a210448e74fc63930001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000869584cd00000000000000000000000000736923aeba891f67f041a27a6db8ab7a437d6c0000000000000000000000000000000055605366b0bac8c01627f4ced4769d77', - value: '0', - gas: '144634', - estimatedGas: '144634', - gasPrice: '26500000000', - protocolFee: '0', - minimumProtocolFee: '0', - buyTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - sellTokenAddress: '0xae78736cd615f374d3085123a210448e74fc6393', - buyAmount: '722269364590540045', - sellAmount: '661521097357191759', - sources: [ - { name: '0x', proportion: '0' }, - { name: 'Uniswap', proportion: '0' }, - { name: 'Uniswap_V2', proportion: '0' }, - { name: 'Curve', proportion: '0' }, - { name: 'Balancer', proportion: '0' }, - { name: 'Balancer_V2', proportion: '0' }, - { name: 'BancorV3', proportion: '0' }, - { name: 'SushiSwap', proportion: '0' }, - { name: 'DODO', proportion: '0' }, - { name: 'DODO_V2', proportion: '0' }, - { name: 'CryptoCom', proportion: '0' }, - { name: 'Lido', proportion: '0' }, - { name: 'MakerPsm', proportion: '0' }, - { name: 'KyberDMM', proportion: '0' }, - { name: 'Saddle', proportion: '0' }, - { name: 'Uniswap_V3', proportion: '1' }, - { name: 'Curve_V2', proportion: '0' }, - { name: 'ShibaSwap', proportion: '0' }, - { name: 'Synapse', proportion: '0' }, - { name: 'Synthetix', proportion: '0' }, - { name: 'Aave_V2', proportion: '0' }, - { name: 'Compound', proportion: '0' }, - { name: 'KyberElastic', proportion: '0' }, - ], - orders: [ - { - type: 0, - source: 'Uniswap_V3', - makerToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - takerToken: '0xae78736cd615f374d3085123a210448e74fc6393', - makerAmount: '722269364590540045', - takerAmount: '661521097357191759', - fillData: { - router: '0xe592427a0aece92de3edee1f18e0157c05861564', - path: '0xae78736cd615f374d3085123a210448e74fc63930001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - gasUsed: 9317, - routerVersion: 1, - }, - fill: { - input: '722269364590540045', - output: '661521097357191759', - adjustedOutput: '661521097357191759', - gas: 118632, - }, - }, - ], - allowanceTarget: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - decodedUniqueId: '0x55605366b0bac8c01627f4ced4769d77', - sellTokenToEthRate: '0.91495821938685616', - buyTokenToEthRate: '1', - fees: { zeroExFee: null }, - grossPrice: '0.915892504636705813', - grossBuyAmount: '722269364590540045', - grossSellAmount: '661521097357191759', - auxiliaryChainData: {}, - expectedSlippage: null, -} - -export const redeemQuoteUsdc2 = { - chainId: 1, - price: '1844.195674', - guaranteedPrice: '1825.753717', - estimatedPriceImpact: '0', - to: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - data: '0x6af479b20000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000016dafef9c30acf6000000000000000000000000000000000000000000000000000000000b338e4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042ae78736cd615f374d3085123a210448e74fc63930001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000869584cd00000000000000000000000000736923aeba891f67f041a27a6db8ab7a437d6c000000000000000000000000000000001fd95a3c4511e274ecf2104436f24737', - value: '0', - gas: '165410', - estimatedGas: '165410', - gasPrice: '26500000000', - protocolFee: '0', - minimumProtocolFee: '0', - buyTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - sellTokenAddress: '0xae78736cd615f374d3085123a210448e74fc6393', - buyAmount: '189826399', - sellAmount: '102931810151869686', - sources: [ - { name: '0x', proportion: '0' }, - { name: 'Uniswap', proportion: '0' }, - { name: 'Uniswap_V2', proportion: '0' }, - { name: 'Curve', proportion: '0' }, - { name: 'Balancer', proportion: '0' }, - { name: 'Balancer_V2', proportion: '0' }, - { name: 'BancorV3', proportion: '0' }, - { name: 'SushiSwap', proportion: '0' }, - { name: 'DODO', proportion: '0' }, - { name: 'DODO_V2', proportion: '0' }, - { name: 'CryptoCom', proportion: '0' }, - { name: 'Lido', proportion: '0' }, - { name: 'MakerPsm', proportion: '0' }, - { name: 'KyberDMM', proportion: '0' }, - { name: 'Saddle', proportion: '0' }, - { name: 'Uniswap_V3', proportion: '1' }, - { name: 'Curve_V2', proportion: '0' }, - { name: 'ShibaSwap', proportion: '0' }, - { name: 'Synapse', proportion: '0' }, - { name: 'Synthetix', proportion: '0' }, - { name: 'Aave_V2', proportion: '0' }, - { name: 'Compound', proportion: '0' }, - { name: 'KyberElastic', proportion: '0' }, - ], - orders: [ - { - type: 0, - source: 'Uniswap_V3', - makerToken: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - takerToken: '0xae78736cd615f374d3085123a210448e74fc6393', - makerAmount: '189826399', - takerAmount: '102931810151869686', - fillData: { - router: '0xe592427a0aece92de3edee1f18e0157c05861564', - path: '0xae78736cd615f374d3085123a210448e74fc63930001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - gasUsed: 19705, - routerVersion: 1, - }, - fill: { - input: '102931810151869686', - output: '189826399', - adjustedOutput: '183594268', - gas: 139402, - }, - }, - ], - allowanceTarget: '0xdef1c0ded9bec7f1a1670819833240f027b25eff', - decodedUniqueId: '0x1fd95a3c4511e274ecf2104436f24737', - sellTokenToEthRate: '0.91495821938685616', - buyTokenToEthRate: '1687.02568', - fees: { zeroExFee: null }, - grossPrice: '1844.195674', - grossBuyAmount: '189826399', - grossSellAmount: '102931810151869686', - auxiliaryChainData: {}, - expectedSlippage: null, -} diff --git a/src/tests/rwa.presale.test.ts b/src/tests/rwa.presale.test.ts deleted file mode 100644 index 469a8735..00000000 --- a/src/tests/rwa.presale.test.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { - getMainnetTestFactory, - QuoteTokens, - SignerAccount4, - TestFactory, - transferFromWhale, - wei, - wrapETH, -} from './utils' - -const { eth, rwa, usdc, weth } = QuoteTokens - -describe('RWA presale', () => { - const indexToken = rwa - const signer = SignerAccount4 - let factory: TestFactory - beforeEach(async () => { - factory = getMainnetTestFactory(signer) - }) - - test('can mint with ETH', async () => { - await factory.fetchQuote({ - isMinting: true, - inputToken: eth, - outputToken: indexToken, - indexTokenAmount: wei('1'), - slippage: 0.5, - }) - await factory.executeTx() - }) - - test('can mint with WETH', async () => { - const quote = await factory.fetchQuote({ - isMinting: true, - inputToken: weth, - outputToken: indexToken, - indexTokenAmount: wei('1'), - slippage: 0.5, - }) - await wrapETH(quote.inputAmount, signer) - await factory.executeTx() - }) - - test('can mint with USDC', async () => { - const quote = await factory.fetchQuote({ - isMinting: true, - inputToken: usdc, - outputToken: indexToken, - indexTokenAmount: wei('1'), - slippage: 0.5, - }) - const whale = '0x7713974908Be4BEd47172370115e8b1219F4A5f0' - await transferFromWhale( - whale, - factory.getSigner().address, - wei('10000', quote.inputToken.decimals), - quote.inputToken.address, - factory.getProvider() - ) - await factory.executeTx() - }) - - test('can redeem to USDC', async () => { - await factory.fetchQuote({ - isMinting: false, - inputToken: indexToken, - outputToken: usdc, - indexTokenAmount: wei('1'), - slippage: 0.5, - }) - await factory.executeTx() - }) -}) diff --git a/src/tests/utils/quoteTokens.ts b/src/tests/utils/quoteTokens.ts index b9e058c0..94b9795a 100644 --- a/src/tests/utils/quoteTokens.ts +++ b/src/tests/utils/quoteTokens.ts @@ -1,21 +1,16 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { - BTC2xFlexibleLeverageIndex, - CoinDeskEthTrendIndex, DAI, DefiPulseIndex, DiversifiedStakedETHIndex, ETH, - ETH2xFlexibleLeverageIndex, GitcoinStakedETHIndex, HighYieldETHIndex, IndexCoopBitcoin2xIndex, IndexCoopEthereum2xIndex, InterestCompoundingETHIndex, - LeveragedrEthStakingYield, MetaverseIndex, RETH, - RealWorldAssetIndex, USDC, USDT, WETH, @@ -31,18 +26,6 @@ const btc2x: QuoteToken = { symbol: IndexCoopBitcoin2xIndex.symbol, } -const btc2xfli: QuoteToken = { - address: BTC2xFlexibleLeverageIndex.address!, - decimals: 18, - symbol: BTC2xFlexibleLeverageIndex.symbol, -} - -const cdeti: QuoteToken = { - address: CoinDeskEthTrendIndex.address!, - decimals: 18, - symbol: CoinDeskEthTrendIndex.symbol, -} - const dai: QuoteToken = { address: DAI.address!, decimals: 18, @@ -73,12 +56,6 @@ const eth2x: QuoteToken = { address: IndexCoopEthereum2xIndex.address!, } -const eth2xfli: QuoteToken = { - symbol: ETH2xFlexibleLeverageIndex.symbol, - decimals: 18, - address: ETH2xFlexibleLeverageIndex.address!, -} - const gtcETH = { address: GitcoinStakedETHIndex.address!, decimals: 18, @@ -97,12 +74,6 @@ const iceth: QuoteToken = { address: InterestCompoundingETHIndex.address!, } -const icreth: QuoteToken = { - symbol: LeveragedrEthStakingYield.symbol, - decimals: 18, - address: LeveragedrEthStakingYield.address!, -} - const mvi: QuoteToken = { address: MetaverseIndex.address!, decimals: 18, @@ -115,12 +86,6 @@ const reth: QuoteToken = { symbol: RETH.symbol, } -const rwa: QuoteToken = { - address: RealWorldAssetIndex.address!, - decimals: 18, - symbol: RealWorldAssetIndex.symbol, -} - const seth2: QuoteToken = { address: sETH2.address!, decimals: 18, @@ -159,21 +124,16 @@ const wseth: QuoteToken = { export const QuoteTokens = { btc2x, - btc2xfli, - cdeti, dai, dpi, dseth, eth, eth2x, - eth2xfli, gtcETH, hyeth, iceth, - icreth, mvi, reth, - rwa, seth2, steth, usdc, diff --git a/src/tests/utils/rocket.ts b/src/tests/utils/rocket.ts deleted file mode 100644 index 265e8b94..00000000 --- a/src/tests/utils/rocket.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { BigNumber } from '@ethersproject/bignumber' -import { Contract } from '@ethersproject/contracts' -import { Wallet } from '@ethersproject/wallet' - -const ROCKET_DEPOSIT_POOL = '0x2cac916b2A963Bf162f076C0a8a4a8200BCFBfb4' - -export async function depositIntoRocketPool(amount: BigNumber, signer: Wallet) { - const contract = new Contract( - ROCKET_DEPOSIT_POOL, - ROCKET_DEPOSIT_POOL_ABI, - signer - ) - await contract.deposit({ gasLimit: 220_000, value: amount }) -} - -const ROCKET_DEPOSIT_POOL_ABI = [ - { - inputs: [], - name: 'deposit', - outputs: [], - stateMutability: 'payable', - type: 'function', - }, -] diff --git a/src/utils/contracts.test.ts b/src/utils/contracts.test.ts index b3e18a16..bb4605ee 100644 --- a/src/utils/contracts.test.ts +++ b/src/utils/contracts.test.ts @@ -11,21 +11,16 @@ import { FlashMintZeroExMainnetAddress, } from 'constants/contracts' import { - BTC2xFlexibleLeverageIndex, - ETH2xFlexibleLeverageIndex, DiversifiedStakedETHIndex, InterestCompoundingETHIndex, wsETH2, GitcoinStakedETHIndex, - LeveragedrEthStakingYield, - CoinDeskEthTrendIndex, IndexCoopEthereum2xIndex, IndexCoopBitcoin2xIndex, IndexCoopEthereum3xIndex, IndexCoopBitcoin3xIndex, IndexCoopInverseEthereumIndex, IndexCoopInverseBitcoinIndex, - RealWorldAssetIndex, } from 'constants/tokens' import { @@ -129,21 +124,6 @@ describe('getFlashMintLeveragedContractForToken()', () => { expect(contract.functions.redeemExactSetForETH).toBeDefined() }) - test('returns FlashMintLeveraged contract for icRETH (mainnet)', async () => { - const expectedAddress = FlashMintLeveragedAddress - const contract = getFlashMintLeveragedContractForToken( - LeveragedrEthStakingYield.symbol, - undefined, - 1 - ) - expect(contract.address).toEqual(expectedAddress) - expect(contract.functions.getLeveragedTokenData).toBeDefined() - expect(contract.functions.issueExactSetFromERC20).toBeDefined() - expect(contract.functions.issueExactSetFromETH).toBeDefined() - expect(contract.functions.redeemExactSetForERC20).toBeDefined() - expect(contract.functions.redeemExactSetForETH).toBeDefined() - }) - test('returns the old FlashMintLeveraged contract (mainnet)', async () => { const expectedAddress = ExchangeIssuanceLeveragedMainnetAddress const contract = getFlashMintLeveragedContractForToken( @@ -158,27 +138,6 @@ describe('getFlashMintLeveragedContractForToken()', () => { expect(contract.functions.redeemExactSetForERC20).toBeDefined() expect(contract.functions.redeemExactSetForETH).toBeDefined() }) - - test('returns the FlashMintLeveragedForCompound contract', async () => { - const expectedAddress = FlashMintLeveragedForCompoundAddress - const contract = getFlashMintLeveragedContractForToken( - BTC2xFlexibleLeverageIndex.symbol, - undefined, - 1 - ) - const contract2 = getFlashMintLeveragedContractForToken( - ETH2xFlexibleLeverageIndex.symbol, - undefined, - 1 - ) - expect(contract.address).toEqual(expectedAddress) - expect(contract2.address).toEqual(expectedAddress) - expect(contract.functions.getLeveragedTokenData).toBeDefined() - expect(contract.functions.issueExactSetFromERC20).toBeDefined() - expect(contract.functions.issueExactSetFromETH).toBeDefined() - expect(contract.functions.redeemExactSetForERC20).toBeDefined() - expect(contract.functions.redeemExactSetForETH).toBeDefined() - }) }) describe('getExchangeIssuanceZeroExContractAddress()', () => { @@ -240,22 +199,6 @@ describe('getFlashMintZeroExContract()', () => { }) describe('getFlashMintZeroExContractForToken()', () => { - test('returns Index Protocol for cdETI', async () => { - const expectedAddress = FlashMintZeroExMainnetAddress - const contract = getFlashMintZeroExContractForToken( - CoinDeskEthTrendIndex.symbol, - undefined, - 1 - ) - expect(contract.address).toEqual(expectedAddress) - expect(contract.functions.getRequiredIssuanceComponents).toBeDefined() - expect(contract.functions.getRequiredRedemptionComponents).toBeDefined() - expect(contract.functions.issueExactSetFromETH).toBeDefined() - expect(contract.functions.issueExactSetFromToken).toBeDefined() - expect(contract.functions.redeemExactSetForETH).toBeDefined() - expect(contract.functions.redeemExactSetForToken).toBeDefined() - }) - test('returns Index Protocol for dsETH, gtcETH and wsETH2', async () => { const expectedAddress = FlashMintZeroExMainnetAddress const contract = getFlashMintZeroExContractForToken( @@ -460,21 +403,3 @@ describe('iETH1x', () => { expect(contract.functions.issueExactSetFromETH).toBeDefined() }) }) - -describe('RWA', () => { - test('return correct contract for token - arbitrum', async () => { - const expectedAddress = FlashMintZeroExMainnetAddress - const contract = getFlashMintZeroExContractForToken( - RealWorldAssetIndex.symbol, - undefined, - ChainId.Mainnet - ) - expect(contract.address).toEqual(expectedAddress) - expect(contract.functions.getRequiredIssuanceComponents).toBeDefined() - expect(contract.functions.getRequiredRedemptionComponents).toBeDefined() - expect(contract.functions.issueExactSetFromETH).toBeDefined() - expect(contract.functions.issueExactSetFromToken).toBeDefined() - expect(contract.functions.redeemExactSetForETH).toBeDefined() - expect(contract.functions.redeemExactSetForToken).toBeDefined() - }) -}) diff --git a/src/utils/contracts.ts b/src/utils/contracts.ts index e81ef05a..ea55f232 100644 --- a/src/utils/contracts.ts +++ b/src/utils/contracts.ts @@ -27,7 +27,6 @@ import { DiversifiedStakedETHIndex, wsETH2, GitcoinStakedETHIndex, - LeveragedrEthStakingYield, CoinDeskEthTrendIndex, IndexCoopEthereum2xIndex, IndexCoopBitcoin2xIndex, @@ -164,7 +163,6 @@ export const getFlashMintLeveragedContractForToken = ( return getFlashMintLeveragedForCompoundContract(signerOrProvider) case IndexCoopBitcoin2xIndex.symbol: case IndexCoopEthereum2xIndex.symbol: - case LeveragedrEthStakingYield.symbol: return getIndexFlashMintLeveragedContract(signerOrProvider) default: return getFlashMintLeveragedContract(signerOrProvider, chainId) diff --git a/src/utils/issuanceModules.test.ts b/src/utils/issuanceModules.test.ts index ddd92827..3e74127a 100644 --- a/src/utils/issuanceModules.test.ts +++ b/src/utils/issuanceModules.test.ts @@ -2,7 +2,6 @@ import { ChainId } from 'constants/chains' import { BasicIssuanceModuleAddress, BasicIssuanceModulePolygonAddress, - DebtIssuanceModuleAddress, DebtIssuanceModuleV2Address, IndexDebtIssuanceModuleV2Address, IndexDebtIssuanceModuleV2Address_v2, @@ -10,21 +9,16 @@ import { } from 'constants/contracts' import { BanklessBEDIndex, - BTC2xFlexibleLeverageIndex, DefiPulseIndex, - ETH2xFlexibleLeverageIndex, DiversifiedStakedETHIndex, GitcoinStakedETHIndex, InterestCompoundingETHIndex, MetaverseIndex, wsETH2, - LeveragedrEthStakingYield, - CoinDeskEthTrendIndex, IndexCoopEthereum2xIndex, IndexCoopBitcoin2xIndex, IndexCoopBitcoin3xIndex, HighYieldETHIndex, - RealWorldAssetIndex, } from 'constants/tokens' import { getIssuanceModule } from './issuanceModules' @@ -37,13 +31,6 @@ describe('getIssuanceModule() - Mainnet - IndexProtocol', () => { expect(issuanceModule.isDebtIssuance).toBe(true) }) - test('returns debt issuance module v2 for cdETI', async () => { - const expectedModule = IndexDebtIssuanceModuleV2Address_v2 - const issuanceModule = getIssuanceModule(CoinDeskEthTrendIndex.symbol) - expect(issuanceModule.address).toEqual(expectedModule) - expect(issuanceModule.isDebtIssuance).toBe(true) - }) - test('returns debt issuance module v2 for dsETH', async () => { const expectedModule = IndexDebtIssuanceModuleV2Address_v2 const issuanceModule = getIssuanceModule(DiversifiedStakedETHIndex.symbol) @@ -72,20 +59,6 @@ describe('getIssuanceModule() - Mainnet - IndexProtocol', () => { expect(issuanceModule.isDebtIssuance).toBe(true) }) - test('returns debt issuance module v2 for icRETH', async () => { - const expectedModule = IndexDebtIssuanceModuleV2Address_v2 - const issuanceModule = getIssuanceModule(LeveragedrEthStakingYield.symbol) - expect(issuanceModule.address).toEqual(expectedModule) - expect(issuanceModule.isDebtIssuance).toBe(true) - }) - - test('returns debt issuance module v2 for RWA', async () => { - const expectedModule = IndexDebtIssuanceModuleV2Address_v2 - const issuanceModule = getIssuanceModule(RealWorldAssetIndex.symbol) - expect(issuanceModule.address).toEqual(expectedModule) - expect(issuanceModule.isDebtIssuance).toBe(true) - }) - test('returns debt issuance module v2 for wsETH2', async () => { const expectedModule = IndexDebtIssuanceModuleV2Address const issuanceModule = getIssuanceModule(wsETH2.symbol) @@ -116,20 +89,6 @@ describe('getIssuanceModule() - Mainnet - SetProtocol', () => { expect(issuanceModule.isDebtIssuance).toBe(false) }) - test('returns debt issuance module for BTC2XFLI', async () => { - const expectedModule = DebtIssuanceModuleAddress - const issuanceModule = getIssuanceModule(BTC2xFlexibleLeverageIndex.symbol) - expect(issuanceModule.address).toEqual(expectedModule) - expect(issuanceModule.isDebtIssuance).toBe(true) - }) - - test('returns debt issuance module for ETH2xFLI', async () => { - const expectedModule = DebtIssuanceModuleAddress - const issuanceModule = getIssuanceModule(ETH2xFlexibleLeverageIndex.symbol) - expect(issuanceModule.address).toEqual(expectedModule) - expect(issuanceModule.isDebtIssuance).toBe(true) - }) - test('returns debt issuance module v2 for icETH', async () => { const expectedModule = DebtIssuanceModuleV2Address const issuanceModule = getIssuanceModule(InterestCompoundingETHIndex.symbol) diff --git a/src/utils/issuanceModules.ts b/src/utils/issuanceModules.ts index 44b62f8b..a3a0083f 100644 --- a/src/utils/issuanceModules.ts +++ b/src/utils/issuanceModules.ts @@ -15,7 +15,6 @@ import { InterestCompoundingETHIndex, wsETH2, GitcoinStakedETHIndex, - LeveragedrEthStakingYield, CoinDeskEthTrendIndex, IndexCoopEthereum2xIndex, IndexCoopBitcoin2xIndex, @@ -53,7 +52,6 @@ export function getIssuanceModule( case HighYieldETHIndex.symbol: case IndexCoopBitcoin2xIndex.symbol: case IndexCoopEthereum2xIndex.symbol: - case LeveragedrEthStakingYield.symbol: case RealWorldAssetIndex.symbol: return { address: IndexDebtIssuanceModuleV2Address_v2,