Skip to content

Commit

Permalink
Merge pull request #85 from IndexCoop/feat/add-flashmint-wrapped
Browse files Browse the repository at this point in the history
feat: add flash mint wrapped
  • Loading branch information
janndriessen authored Oct 21, 2024
2 parents 8a4f5f3 + f7f39e5 commit d5202b3
Show file tree
Hide file tree
Showing 33 changed files with 1,446 additions and 143 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
- run: npm run test:builders
- run: npm run test:quotes
- run: npm run test:base
- run: npm run test:icusd
- run: npm run test:hyeth
# - run: npm run test:btc2x
# - run: npm run test:eth2x
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"test:eth2x": "npm test src/tests/eth2x.test.ts",
"test:hyeth": "npm test src/tests/hyeth.test.ts",
"test:iceth": "npm test src/tests/iceth",
"test:icusd": "npm test src/tests/icusd.test.ts",
"test:watch": "jest --watch"
},
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions src/constants/abis/FlashMintWrapped.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"components":[{"internalType":"address","name":"quickRouter","type":"address"},{"internalType":"address","name":"sushiRouter","type":"address"},{"internalType":"address","name":"uniV3Router","type":"address"},{"internalType":"address","name":"uniV3Quoter","type":"address"},{"internalType":"address","name":"curveAddressProvider","type":"address"},{"internalType":"address","name":"curveCalculator","type":"address"},{"internalType":"address","name":"balV2Vault","type":"address"},{"internalType":"address","name":"weth","type":"address"}],"internalType":"struct DEXAdapterV3.Addresses","name":"_dexAddresses","type":"tuple"},{"internalType":"contract IController","name":"_setController","type":"address"},{"internalType":"contract IDebtIssuanceModule","name":"_issuanceModule","type":"address"},{"internalType":"address","name":"_wrapModule","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"_inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountInputToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountSetIssued","type":"uint256"}],"name":"FlashMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"_outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountSetRedeemed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountOutputToken","type":"uint256"}],"name":"FlashRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"}],"name":"approveSetToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dexAdapter","outputs":[{"internalType":"address","name":"quickRouter","type":"address"},{"internalType":"address","name":"sushiRouter","type":"address"},{"internalType":"address","name":"uniV3Router","type":"address"},{"internalType":"address","name":"uniV3Quoter","type":"address"},{"internalType":"address","name":"curveAddressProvider","type":"address"},{"internalType":"address","name":"curveCalculator","type":"address"},{"internalType":"address","name":"balV2Vault","type":"address"},{"internalType":"address","name":"weth","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"address","name":"_inputToken","type":"address"},{"internalType":"uint256","name":"_setAmount","type":"uint256"},{"components":[{"internalType":"address","name":"underlyingERC20","type":"address"},{"components":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes32[]","name":"poolIds","type":"bytes32[]"},{"internalType":"enum DEXAdapterV3.Exchange","name":"exchange","type":"uint8"}],"internalType":"struct DEXAdapterV3.SwapData","name":"dexData","type":"tuple"},{"internalType":"uint256","name":"buyUnderlyingAmount","type":"uint256"}],"internalType":"struct FlashMintWrapped.ComponentSwapData[]","name":"_swapData","type":"tuple[]"}],"name":"getIssueExactSet","outputs":[{"internalType":"uint256","name":"amountInputNeeded","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"address","name":"_outputToken","type":"address"},{"internalType":"uint256","name":"_setAmount","type":"uint256"},{"components":[{"internalType":"address","name":"underlyingERC20","type":"address"},{"components":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes32[]","name":"poolIds","type":"bytes32[]"},{"internalType":"enum DEXAdapterV3.Exchange","name":"exchange","type":"uint8"}],"internalType":"struct DEXAdapterV3.SwapData","name":"dexData","type":"tuple"},{"internalType":"uint256","name":"buyUnderlyingAmount","type":"uint256"}],"internalType":"struct FlashMintWrapped.ComponentSwapData[]","name":"_swapData","type":"tuple[]"}],"name":"getRedeemExactSet","outputs":[{"internalType":"uint256","name":"amountOutputReceived","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"issuanceModule","outputs":[{"internalType":"contract IDebtIssuanceModule","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"contract IERC20","name":"_inputToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"},{"internalType":"uint256","name":"_maxAmountInputToken","type":"uint256"},{"components":[{"internalType":"address","name":"underlyingERC20","type":"address"},{"components":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes32[]","name":"poolIds","type":"bytes32[]"},{"internalType":"enum DEXAdapterV3.Exchange","name":"exchange","type":"uint8"}],"internalType":"struct DEXAdapterV3.SwapData","name":"dexData","type":"tuple"},{"internalType":"uint256","name":"buyUnderlyingAmount","type":"uint256"}],"internalType":"struct FlashMintWrapped.ComponentSwapData[]","name":"_swapData","type":"tuple[]"},{"components":[{"internalType":"string","name":"integrationName","type":"string"},{"internalType":"bytes","name":"wrapData","type":"bytes"}],"internalType":"struct FlashMintWrapped.ComponentWrapData[]","name":"_wrapData","type":"tuple[]"}],"name":"issueExactSetFromERC20","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"},{"components":[{"internalType":"address","name":"underlyingERC20","type":"address"},{"components":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes32[]","name":"poolIds","type":"bytes32[]"},{"internalType":"enum DEXAdapterV3.Exchange","name":"exchange","type":"uint8"}],"internalType":"struct DEXAdapterV3.SwapData","name":"dexData","type":"tuple"},{"internalType":"uint256","name":"buyUnderlyingAmount","type":"uint256"}],"internalType":"struct FlashMintWrapped.ComponentSwapData[]","name":"_swapData","type":"tuple[]"},{"components":[{"internalType":"string","name":"integrationName","type":"string"},{"internalType":"bytes","name":"wrapData","type":"bytes"}],"internalType":"struct FlashMintWrapped.ComponentWrapData[]","name":"_wrapData","type":"tuple[]"}],"name":"issueExactSetFromETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"contract IERC20","name":"_outputToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"},{"internalType":"uint256","name":"_minOutputReceive","type":"uint256"},{"components":[{"internalType":"address","name":"underlyingERC20","type":"address"},{"components":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes32[]","name":"poolIds","type":"bytes32[]"},{"internalType":"enum DEXAdapterV3.Exchange","name":"exchange","type":"uint8"}],"internalType":"struct DEXAdapterV3.SwapData","name":"dexData","type":"tuple"},{"internalType":"uint256","name":"buyUnderlyingAmount","type":"uint256"}],"internalType":"struct FlashMintWrapped.ComponentSwapData[]","name":"_swapData","type":"tuple[]"},{"components":[{"internalType":"string","name":"integrationName","type":"string"},{"internalType":"bytes","name":"wrapData","type":"bytes"}],"internalType":"struct FlashMintWrapped.ComponentWrapData[]","name":"_unwrapData","type":"tuple[]"}],"name":"redeemExactSetForERC20","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"},{"internalType":"uint256","name":"_minOutputReceive","type":"uint256"},{"components":[{"internalType":"address","name":"underlyingERC20","type":"address"},{"components":[{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes32[]","name":"poolIds","type":"bytes32[]"},{"internalType":"enum DEXAdapterV3.Exchange","name":"exchange","type":"uint8"}],"internalType":"struct DEXAdapterV3.SwapData","name":"dexData","type":"tuple"},{"internalType":"uint256","name":"buyUnderlyingAmount","type":"uint256"}],"internalType":"struct FlashMintWrapped.ComponentSwapData[]","name":"_swapData","type":"tuple[]"},{"components":[{"internalType":"string","name":"integrationName","type":"string"},{"internalType":"bytes","name":"wrapData","type":"bytes"}],"internalType":"struct FlashMintWrapped.ComponentWrapData[]","name":"_unwrapData","type":"tuple[]"}],"name":"redeemExactSetForETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setController","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"_tokens","type":"address[]"},{"internalType":"address payable","name":"_to","type":"address"}],"name":"withdrawTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"wrapModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
2 changes: 2 additions & 0 deletions src/constants/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { ChainId } from 'constants/chains'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const Contracts: { [key: number]: any } = {
[ChainId.Mainnet]: {
DebtIssuanceModuleV3: '0x86B7C605C03B9bbb0F6A25FBBb63baF15d875193',
FlashMintHyEthV3: '0xCb1eEA349f25288627f008C5e2a69b684bddDf49',
FlashMintWrapped: '0x7ddE626dE8CE73229838B5c2F9A71bc7ac207801',
},
[ChainId.Arbitrum]: {
DebtIssuanceModuleV3: '0x4ac26c26116fa976352b70700af58bc2442489d8',
Expand Down
2 changes: 1 addition & 1 deletion src/constants/swapdata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Exchange } from 'utils'
import { ETH, InterestCompoundingETHIndex, stETH } from './tokens'

Expand Down
7 changes: 7 additions & 0 deletions src/constants/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { getIndexTokenData } from '@indexcoop/tokenlists'

export interface Token {
symbol: string
address?: string
Expand Down Expand Up @@ -100,6 +103,10 @@ export const RealWorldAssetIndex: Token = {
symbol: 'RWA',
}

export const TheUSDCYieldIndex: Token = {
...getIndexTokenData('icUSD', 1)!,
}

// Other

export const DAI: Token = {
Expand Down
1 change: 1 addition & 0 deletions src/flashmint/builders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from './hyeth'
export * from './interface'
export * from './leveraged'
export * from './leveraged-extended'
export * from './wrapped'
export * from './zeroex'
Loading

0 comments on commit d5202b3

Please sign in to comment.