Skip to content

Commit

Permalink
Add timeout
Browse files Browse the repository at this point in the history
DanielSchiavini committed Sep 4, 2024
1 parent 319bcf8 commit cdd2e4c
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
6 changes: 3 additions & 3 deletions test/router.test.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ const routerSwapTest = async (coin1: string, coin2: string) => {
const { route, output } = await curve.router.getBestRouteAndOutput(coin1, coin2, amount);
assert.isTrue(route.length > 0);
const required = await curve.router.required(coin1, coin2, output);
await stealTokens(coin1, `0x1${'0'.repeat(22)}`);
await stealTokens(coin1);

console.log(route.map((step) => `${step.poolId} (${step.swapParams})`).join(' --> '))
console.log(route);
@@ -123,14 +123,14 @@ function mockProperty<T, K extends keyof T>(obj: T, prop: K, value: T[K]) {
return () => Object.defineProperty(obj, prop, { get: () => oldValue });
}

async function stealTokens(coinName: string, amount: string) {
async function stealTokens(coinName: string, amount: string = `0x1${'0'.repeat(22)}`) {
const [coinAddress] = _getCoinAddresses(coinName);
const richAccount = await getRichestCoinHolder(coinAddress);
const richAddress = richAccount.address;
const contract = _curve.contracts[coinAddress].contract;
const cleanup = mockProperty(_curve.signer as JsonRpcSigner, 'address', richAddress);
try {
await _curve.provider.send("hardhat_setBalance", [richAddress, `0x1$${'0'.repeat(12)}`]);
await _curve.provider.send("hardhat_setBalance", [richAddress, `0x1${'0'.repeat(12)}`]);
await _curve.provider.send("hardhat_impersonateAccount", [richAddress]);

console.log(`Stealing ${amount} ${coinName} from ${richAddress}. It has ${richAccount.rawBalance}.`);

0 comments on commit cdd2e4c

Please sign in to comment.