Skip to content

Commit

Permalink
get scenarios working with chainid in forkspec
Browse files Browse the repository at this point in the history
  • Loading branch information
hayesgm committed Mar 4, 2022
1 parent a7ac19a commit 2f7e233
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions deployments/fuji/relations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import baseRelationConfig from '../relations';
export default {
...baseRelationConfig,
'comet:implementation': {
proxy: {
field: (comet) => (comet.extensionDelegate ? comet.extensionDelegate() : null),
},
relations: {},
},
};
2 changes: 2 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ const config: HardhatUserConfig = {
},
{
name: 'kovan',
chainId: 42,
url: getDefaultProviderURL('kovan'),
allocation: 0.1, // eth
},
{
name: 'fuji',
chainId: 43113,
url: 'https://api.avax-test.network/ext/bc/C/rpc',
},
],
Expand Down
1 change: 1 addition & 0 deletions plugins/scenario/World.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type ForkSpec = {
url?: string;
blockNumber?: number;
allocation?: number;
chainId?: number;
};

export class World {
Expand Down
1 change: 1 addition & 0 deletions plugins/scenario/utils/hreForBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function hreForBase(base: ForkSpec): HardhatRuntimeEnvironment {
...(base.blockNumber && { blockNumber: base.blockNumber }),
},
},
...(base.chainId ? { chainId: base.chainId } : {}),
};

const forkedConfig = {
Expand Down
10 changes: 3 additions & 7 deletions scenario/context/CometActor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ export default class CometActor {

async transferAssetFrom({ src, dst, asset, amount }) {
let comet = await this.context.getComet();
await (
await comet.connect(this.signer).transferAssetFrom(src, dst, asset, amount)
).wait();
await (await comet.connect(this.signer).transferAssetFrom(src, dst, asset, amount)).wait();
}

async signAuthorization({
Expand All @@ -98,7 +96,7 @@ export default class CometActor {
nonce: BigNumberish;
expiry: number;
chainId: number;
}) {
}): Promise<Signature> {
let comet = await this.context.getComet();
const domain = {
name: await comet.name(),
Expand Down Expand Up @@ -144,8 +142,6 @@ export default class CometActor {

async withdrawReserves(to: CometActor, amount: number) {
let comet = await this.context.getComet();
await (
await comet.connect(this.signer).withdrawReserves(to.address, amount)
).wait();
await (await comet.connect(this.signer).withdrawReserves(to.address, amount)).wait();
}
}

0 comments on commit 2f7e233

Please sign in to comment.