-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdeploySplitEquippable.ts
98 lines (89 loc) · 2.99 KB
/
deploySplitEquippable.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import { ethers } from "hardhat";
import {
SimpleCatalog,
SimpleExternalEquip,
SimpleNestableExternalEquip,
RMRKEquipRenderUtils,
} from "../typechain-types";
import { ContractTransaction } from "ethers";
const pricePerMint = ethers.utils.parseEther("0.0001");
async function main() {
const [nestableKanaria, kanariaEquip, nestableGem, gemEquip, base, views] =
await deployContracts();
}
async function deployContracts(): Promise<
[
SimpleNestableExternalEquip,
SimpleExternalEquip,
SimpleNestableExternalEquip,
SimpleExternalEquip,
SimpleCatalog,
RMRKEquipRenderUtils
]
> {
const [beneficiary] = await ethers.getSigners();
const equipFactory = await ethers.getContractFactory("SimpleExternalEquip");
const nestableFactory = await ethers.getContractFactory(
"SimpleNestableExternalEquip"
);
const catalogFactory = await ethers.getContractFactory("SimpleCatalog");
const viewsFactory = await ethers.getContractFactory("RMRKEquipRenderUtils");
const nestableKanaria: SimpleNestableExternalEquip =
await nestableFactory.deploy(
ethers.constants.AddressZero,
"Kanaria",
"KAN",
"ipfs://collectionMeta",
"ipfs://tokenMeta",
{
erc20TokenAddress: ethers.constants.AddressZero,
tokenUriIsEnumerable: true,
royaltyRecipient: await beneficiary.getAddress(),
royaltyPercentageBps: 10,
maxSupply: 1000,
pricePerMint: pricePerMint
}
);
const nestableGem: SimpleNestableExternalEquip = await nestableFactory.deploy(
ethers.constants.AddressZero,
"Gem",
"GM",
"ipfs://collectionMeta",
"ipfs://tokenMeta",
{
erc20TokenAddress: ethers.constants.AddressZero,
tokenUriIsEnumerable: true,
royaltyRecipient: await beneficiary.getAddress(),
royaltyPercentageBps: 10,
maxSupply: 3000,
pricePerMint: pricePerMint
}
);
const kanariaEquip: SimpleExternalEquip = await equipFactory.deploy(
nestableKanaria.address
);
const gemEquip: SimpleExternalEquip = await equipFactory.deploy(
nestableGem.address
);
const base: SimpleCatalog = await catalogFactory.deploy("KB", "svg");
const views: RMRKEquipRenderUtils = await viewsFactory.deploy();
await nestableKanaria.deployed();
await kanariaEquip.deployed();
await nestableGem.deployed();
await gemEquip.deployed();
await base.deployed();
await views.deployed();
const allTx = [
await nestableKanaria.setEquippableAddress(kanariaEquip.address),
await nestableGem.setEquippableAddress(gemEquip.address),
];
await Promise.all(allTx.map((tx) => tx.wait()));
console.log(
`Sample contracts deployed to ${nestableKanaria.address} (Kanaria Nestable) | ${kanariaEquip.address} (Kanaria Equip), ${nestableGem.address} (Gem Nestable) | ${gemEquip.address} (Gem Equip) and ${base.address} (Catalog)`
);
return [nestableKanaria, kanariaEquip, nestableGem, gemEquip, base, views];
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});