Skip to content

Commit 5dbc07d

Browse files
committed
add remix config file
1 parent 271fab2 commit 5dbc07d

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"defaultConfig": "ethers6",
3+
"customConfig": {
4+
"baseConfiguration": "default",
5+
"dependencies": []
6+
}
7+
}

libs/remix-ws-templates/src/templates/introToEIP7702/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export default async (opts) => {
1313
// @ts-ignore
1414
'scripts/run-eip7702.ts': (await import('!!raw-loader!./scripts/run-eip7702.ts')).default,
1515
// @ts-ignore
16-
'README.md': (await import('raw-loader!./README.md')).default
16+
'README.md': (await import('raw-loader!./README.md')).default,
17+
// @ts-ignore
18+
'.remix/script.config.json': (await import('!!raw-loader!./.remix/script.config.json')).default
1719
}
1820
return filesObj
1921
}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ethers } from 'ethers'
1+
import { ethers } from 'ethers';
22

33
/**
44
* Deploy the given contract
@@ -8,22 +8,22 @@ import { ethers } from 'ethers'
88
* @return {Contract} deployed contract
99
*/
1010
export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {
11+
console.log(`deploying ${contractName}`)
1112

12-
console.log(`deploying ${contractName}`)
13-
// Note that the script needs the ABI which is generated from the compilation artifact.
14-
// Make sure contract is compiled and artifacts are generated
15-
const artifactsPath = `browser/contracts/artifacts/${contractName}.json` // Change this for different path
13+
// Note that the script needs the ABI which is generated from the compilation artifact.
14+
// Make sure contract is compiled and artifacts are generated
15+
const artifactsPath = `browser/contracts/artifacts/${contractName}.json` // Change this for different path
16+
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
1617

17-
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
18-
// 'web3Provider' is a remix global variable object
18+
// 'web3Provider' is a remix global variable object
19+
const provider = new ethers.BrowserProvider(web3Provider);
20+
const signer = await provider.getSigner(accountIndex);
1921

20-
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex)
22+
const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer);
23+
const contract = await factory.deploy(...args);
2124

22-
const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
25+
// The contract is NOT deployed yet; we must wait until it is mined
26+
await contract.waitForDeployment();
2327

24-
const contract = await factory.deploy(...args)
25-
26-
// The contract is NOT deployed yet; we must wait until it is mined
27-
await contract.deployed()
28-
return contract
29-
}
28+
return contract;
29+
}

0 commit comments

Comments
 (0)