Skip to content

Commit

Permalink
feat: add ic21
Browse files Browse the repository at this point in the history
  • Loading branch information
janndriessen committed Oct 24, 2024
1 parent 86c90e5 commit 9eb44e0
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
chainId: 1,
forking: {
url: process.env.MAINNET_ALCHEMY_API,
blockNumber: 20984179,
blockNumber: 21037088,
},
chains: {
1: {
Expand Down
1 change: 1 addition & 0 deletions src/quote/provider/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function getContractType(
token === DefiPulseIndex.symbol ||
token === DiversifiedStakedETHIndex.symbol ||
token === GitcoinStakedETHIndex.symbol ||
token === 'ic21' ||
token === MetaverseIndex.symbol ||
token === RealWorldAssetIndex.symbol
)
Expand Down
61 changes: 61 additions & 0 deletions src/tests/ic21.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {
getMainnetTestFactory,
QuoteTokens,
SignerAccount4,
TestFactory,
transferFromWhale,
wei,
wrapETH,
} from './utils'

const { eth, ic21, usdc, weth } = QuoteTokens

describe('ic21 (mainnet)', () => {
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: ic21,
indexTokenAmount: wei('1'),
slippage: 0.5,
})
await factory.executeTx()
})

test('can mint with USDC', async () => {
const quote = await factory.fetchQuote({
isMinting: true,
inputToken: usdc,
outputToken: ic21,
indexTokenAmount: wei('1'),
slippage: 0.5,
})
const usdcWhale = '0x7713974908Be4BEd47172370115e8b1219F4A5f0'
await transferFromWhale(
usdcWhale,
factory.getSigner().address,
wei('100000', quote.inputToken.decimals),
quote.inputToken.address,
factory.getProvider()
)
await factory.executeTx()
})

test('can mint with WETH', async () => {
const quote = await factory.fetchQuote({
isMinting: true,
inputToken: weth,
outputToken: ic21,
indexTokenAmount: wei('1'),
slippage: 0.5,
})
await wrapETH(quote.inputOutputAmount, factory.getSigner())
await factory.executeTx()
})
})
7 changes: 7 additions & 0 deletions src/tests/utils/quoteTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ const hyeth = {
symbol: HighYieldETHIndex.symbol,
}

const ic21: QuoteToken = {
symbol: 'ic21',
decimals: 18,
address: '0x1B5E16C5b20Fb5EE87C61fE9Afe735Cca3B21A65',
}

const iceth: QuoteToken = {
symbol: InterestCompoundingETHIndex.symbol,
decimals: 18,
Expand Down Expand Up @@ -138,6 +144,7 @@ export const QuoteTokens = {
eth2x,
gtcETH,
hyeth,
ic21,
iceth,
icusd,
mvi,
Expand Down
1 change: 1 addition & 0 deletions src/utils/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export const getFlashMintZeroExContractForToken = (
case CoinDeskEthTrendIndex.symbol:
case DiversifiedStakedETHIndex.symbol:
case GitcoinStakedETHIndex.symbol:
case 'ic21':
case RealWorldAssetIndex.symbol:
case wsETH2.symbol:
return new Contract(
Expand Down
1 change: 1 addition & 0 deletions src/utils/issuanceModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function getIssuanceModule(
case CoinDeskEthTrendIndex.symbol:
case DiversifiedStakedETHIndex.symbol:
case HighYieldETHIndex.symbol:
case 'ic21':
case IndexCoopBitcoin2xIndex.symbol:
case IndexCoopEthereum2xIndex.symbol:
case RealWorldAssetIndex.symbol:
Expand Down

0 comments on commit 9eb44e0

Please sign in to comment.