-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.ts
41 lines (31 loc) · 1.42 KB
/
deploy.ts
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
import { patract, network, artifacts } from "redspot";
const { getContractFactory } = patract;
const { createSigner, keyring, api } = network;
async function run() {
await api.isReady;
// The redspot signer supports passing in an address. If you want to use substrate uri, you can do it like this:
// const signer = createSigner(keyring.createFromUri("bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice"));
// Or get the configured account from redspot config:
// const signer = (await getSigners())[0]
const signer = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"; // Alice Address
const contractFactory = await getContractFactory("erc20_pausable", signer);
const balance = await api.query.system.account(signer);
console.log("Balance: ", balance.toHuman());
// The `deploy` method will attempt to deploy a new contract.
// The `deployed` method will first find out if the same contract already exists based on the parameters.
// If the contract exists, it will be returned, otherwise a new contract will be created.
const contract = await contractFactory.deploy("new", "1000000", {
gasLimit: "400000000000",
value: "1000 UNIT",
});
const abi = artifacts.readArtifact("erc20_pausable");
console.log("");
console.log(
"Deploy successfully. The contract address: ",
contract.address.toString()
);
api.disconnect();
}
run().catch((err) => {
console.log(err);
});