forked from muellerberndt/rektosaurus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
50 lines (41 loc) · 1.54 KB
/
deploy.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
49
50
// Payloads to be stored on-chain.
// In principle, arbitrary metadata can be encoded into data:application/json URLs,
// but for testing purposes it's more practical to store most metadata off-chain
const BUILTIN_PAYLOADS = [
'"/><script>console.log(1337);</script>',
'javascript:console.log(1338);',
'x" onerror="javascript:console.log(1339);" y="',
'data:text/html;base64,PGh0bWw+PHNjcmlwdD5jb25zb2xlLmxvZygxMzQwKTs8L3NjcmlwdD48L2h0bWw+'
]
// This is a script for deploying your contracts. You can adapt it to deploy
// yours, or create new ones.
async function main() {
// This is just a convenience check
if (network.name === "hardhat") {
console.warn(
"You are trying to deploy a contract to the Hardhat Network, which" +
"gets automatically created and destroyed every time. Use the Hardhat" +
" option '--network localhost'"
);
}
// ethers is avaialble in the global scope
const [deployer] = await ethers.getSigners();
console.log(
"Deploying the contracts with the account:",
await deployer.getAddress()
);
const Rektosaurus = await ethers.getContractFactory("Rektosaurus");
const rektosaurus = await Rektosaurus.deploy();
await rektosaurus.deployed();
console.log("Rektosaurus address:", rektosaurus.address);
// Add some on-chain payloads
for (var i = 0; i < BUILTIN_PAYLOADS.length; i++) {
await rektosaurus.mint(i + 2, deployer.address, BUILTIN_PAYLOADS[i]);
}
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});