-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformula.js
48 lines (46 loc) · 928 Bytes
/
formula.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const paramsSchema = {
properties: {
name: {
type: "string",
},
symbol: {
type: "string",
},
totalSupply: {
type: "integer",
exclusiveMinimum: 0,
},
},
required: ["name", "symbol", "totalSupply"],
};
function deploy(params) {
const [address] = api.hardhat.script({
path: "./scripts/deploy.ts",
envs: {
TOKEN_NAME: params.name,
TOKEN_SYMBOL: params.symbol,
TOKEN_SUPPLY: params.totalSupply.toString(),
},
outputs: [
{
name: "address",
extract: {
type: "regex",
expr: "My token deployed with address (?<address>0x[a-zA-Z0-9]{40})",
groupName: "address",
},
},
],
});
api.offchain.deploy({
details: {
envs: {
TOKEN_ADDRESS: address,
RPC_URL: params.config.evm.rpcUrl(),
},
flags: {
build: true,
},
},
});
}