-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from IndexCoop/feat/add-rwa-presale
feat: add rwa presale
- Loading branch information
Showing
11 changed files
with
135 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
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() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters