Skip to content

Commit aea477c

Browse files
committed
__mainnet__
1 parent 3a5f187 commit aea477c

File tree

7 files changed

+3502
-136
lines changed

7 files changed

+3502
-136
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
with:
1616
starknet-foundry-version: 0.17.1
1717
- run: cd contracts && scarb fmt --check
18-
- run: cd contracts && scarb test -f scarb_descriptor --include-ignored && snforge test
18+
- run: cd contracts && snforge test

contracts/scripts/deploy_blob.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import colors from "colors";
2+
import { deployBlobert, deployDescriptorCustom, deployDescriptorRegular, deploySeeder } from "./libs/contract.js";
3+
import {merkle} from "starknet";
4+
5+
const main = async () => {
6+
console.log(` ____ _ `.red);
7+
console.log(` | \\ ___ ___| |___ _ _ `.red);
8+
console.log(` | | | -_| . | | . | | |`.red);
9+
console.log(` |____/|___| _|_|___|_ |`.red);
10+
console.log(` |_| |___|`.red);
11+
12+
let seeder = 0x592403d219ba2077760667c8244850a22a7e04f8f97af89c9d1c8df4678b79cn;
13+
let descriptor_regular = 0x7c82f2f8199551b5eb828de9d0a485c1dfbe8f4d05502a7e39d1379da398d7fn;
14+
let descriptor_custom = 0x63ab8702d967c25ad40c0c9bf76df50b9473ca57b282810463fe0ab6166751bn;
15+
16+
await deployBlobert(seeder,descriptor_regular, descriptor_custom);
17+
}
18+
19+
20+
main();

contracts/scripts/libs/contract.js

Lines changed: 37 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { fileURLToPath } from "url";
55
import { json } from "starknet";
66
import { getNetwork, getAccount } from "./network.js";
77
import { initial_assigned_recipients } from "../assigned_custom.js";
8+
// import merkle_data from "../test_merkle_data.json" assert { type: "json" };
9+
import merkle_data from "../merkle_data.json" assert { type: "json" };
810

911
const __filename = fileURLToPath(import.meta.url);
1012
const __dirname = path.dirname(__filename);
@@ -88,8 +90,8 @@ export const deployBlobert = async (seeder,descriptor_regular, descriptor_custom
8890
let token_name = "Blobert";
8991
let token_symbol = "BLOB";
9092
let owner = 0x0140809B710276e2e07c06278DD8f7D4a2528acE2764Fce32200852CB3893e5Cn
91-
//todo change
92-
let fee_token_address = 0x4ef0e2993abf44178d3a40f2818828ed1c09cde9009677b7a3323570b4c0f2en
93+
let fee_token_address = 0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49n
94+
// let fee_token_address = 0x4ef0e2993abf44178d3a40f2818828ed1c09cde9009677b7a3323570b4c0f2en
9395
let fee_token_amount = 100 * (10 ** 18)
9496

9597
let constructorCalldata = [
@@ -100,28 +102,26 @@ export const deployBlobert = async (seeder,descriptor_regular, descriptor_custom
100102
descriptor_regular,
101103
descriptor_custom,
102104
fee_token_address,
103-
fee_token_amount, 0 // u256
105+
fee_token_amount, 0 // u256 high
104106
]
105107

106-
// merkle roots
107-
let merkle_roots = whitelist_merkle_roots()
108-
constructorCalldata.push(merkle_roots.length)
109-
for (let j =0 ; j < merkle_roots.length; j++) {
110-
constructorCalldata.push(merkle_roots[j]);
111-
}
112-
113-
// todo update whitelist time
108+
// add merkle roots
109+
constructorCalldata
110+
= addArrayToCalldata(constructorCalldata, whitelist_merkle_roots())
114111

115112
// mint start time
116-
constructorCalldata.push(Math.round(new Date().getTime() / 1000) + 60 * 20) // regular mint start time // 12 minutes from now
117-
constructorCalldata.push(Math.round(new Date().getTime() / 1000) + 30 ) // whitelist mint start time // 30 seconds from now
113+
let wltime = Math.round(new Date().getTime() / 1000) + (50 * 60)
114+
let regtime = wltime + (60 * 60 * 24)
115+
constructorCalldata
116+
.push( regtime )
117+
constructorCalldata
118+
.push( wltime)
118119

119120
// initial custom nft recipients
120121
let initial_assigned_recips = initial_assigned_recipients();
121-
constructorCalldata.push(initial_assigned_recips.length)
122-
for (let j =0 ; j < initial_assigned_recips.length; j++) {
123-
constructorCalldata.push(initial_assigned_recips[j]);
124-
}
122+
constructorCalldata
123+
= addArrayToCalldata(constructorCalldata, initial_assigned_recips)
124+
125125

126126
// Deploy contract
127127
console.log(`\nDeploying ${name} ... \n\n`.green);
@@ -137,7 +137,7 @@ export const deployBlobert = async (seeder,descriptor_regular, descriptor_custom
137137
"Tx hash: ".green,
138138
`${network.explorer_url}/tx/${contract.transaction_hash})`,
139139
);
140-
await account.waitForTransaction(contract.transaction_hash);
140+
let a = await account.waitForTransaction(contract.transaction_hash);
141141
console.log("Contract Address: ".green, contract.address, "\n\n");
142142

143143
}
@@ -213,95 +213,10 @@ export const deployDescriptorRegular = async () => {
213213
}
214214

215215
export const deployDescriptorCustom = async () => {
216-
216+
217217
// Load account
218218
const account = getAccount();
219219

220-
///////////////////////////////////////////
221-
///////////////////////////////////////////
222-
///////////////////////////////////////////
223-
224-
let descriptor_custom_data_addresses = [];
225-
226-
// Declare custom data 1
227-
let descriptor_custom_data_1 = "DescriptorCustomData1"
228-
const descriptor_custom_data_1_class_hash
229-
= (await declare(getPath(descriptor_custom_data_1), descriptor_custom_data_1)).class_hash;
230-
231-
// Deploy contract
232-
console.log(`\nDeploying ${descriptor_custom_data_1} ... \n\n`.green);
233-
let contract = await account.deployContract({
234-
classHash: descriptor_custom_data_1_class_hash
235-
});
236-
237-
// Wait for transaction
238-
let network = getNetwork(process.env.STARKNET_NETWORK);
239-
console.log(
240-
"Tx hash: ".green,
241-
`${network.explorer_url}/tx/${contract.transaction_hash})`,
242-
);
243-
await account.waitForTransaction(contract.transaction_hash);
244-
console.log("Contract Address: ".green, contract.address, "\n\n");
245-
descriptor_custom_data_addresses.push(contract.address)
246-
247-
248-
///////////////////////////////////////////
249-
///////////////////////////////////////////
250-
///////////////////////////////////////////
251-
252-
253-
// Declare custom data 2
254-
let descriptor_custom_data_2 = "DescriptorCustomData2"
255-
const descriptor_custom_data_2_class_hash
256-
= (await declare(getPath(descriptor_custom_data_2), descriptor_custom_data_2)).class_hash;
257-
258-
// Deploy contract
259-
console.log(`\nDeploying ${descriptor_custom_data_2} ... \n\n`.green);
260-
contract = await account.deployContract({
261-
classHash: descriptor_custom_data_2_class_hash,
262-
constructorCalldata: [],
263-
});
264-
265-
// Wait for transaction
266-
network = getNetwork(process.env.STARKNET_NETWORK);
267-
console.log(
268-
"Tx hash: ".green,
269-
`${network.explorer_url}/tx/${contract.transaction_hash})`,
270-
);
271-
await account.waitForTransaction(contract.transaction_hash);
272-
console.log("Contract Address: ".green, contract.address, "\n\n");
273-
descriptor_custom_data_addresses.push(contract.address)
274-
275-
276-
///////////////////////////////////////////
277-
///////////////////////////////////////////
278-
///////////////////////////////////////////
279-
280-
281-
// // Declare custom data 3
282-
let descriptor_custom_data_3 = "DescriptorCustomData3"
283-
const descriptor_custom_data_3_class_hash
284-
= (await declare(getPath(descriptor_custom_data_3), descriptor_custom_data_3)).class_hash;
285-
286-
// Deploy contract
287-
console.log(`\nDeploying ${descriptor_custom_data_3} ... \n\n`.green);
288-
contract = await account.deployContract({
289-
classHash: descriptor_custom_data_3_class_hash,
290-
constructorCalldata: [],
291-
});
292-
293-
294-
// Wait for transaction
295-
network = getNetwork(process.env.STARKNET_NETWORK);
296-
console.log(
297-
"Tx hash: ".green,
298-
`${network.explorer_url}/tx/${contract.transaction_hash})`,
299-
);
300-
await account.waitForTransaction(contract.transaction_hash);
301-
console.log("Contract Address: ".green, contract.address, "\n\n");
302-
descriptor_custom_data_addresses.push(contract.address)
303-
304-
305220
///////////////////////////////////////////
306221
///////////////////////////////////////////
307222
///////////////////////////////////////////
@@ -313,26 +228,19 @@ export const deployDescriptorCustom = async () => {
313228

314229
// Deploy contract
315230
console.log(`\nDeploying ${descriptor_custom} ... \n\n`.green);
316-
contract = await account.deployContract({
317-
classHash: descriptor_custom_class_hash,
318-
constructorCalldata: [
319-
descriptor_custom_data_addresses.length,
320-
descriptor_custom_data_addresses[0],
321-
descriptor_custom_data_addresses[1],
322-
descriptor_custom_data_addresses[2],
323-
],
231+
let contract = await account.deployContract({
232+
classHash: descriptor_custom_class_hash
324233
});
325234

326235

327236
// Wait for transaction
328-
network = getNetwork(process.env.STARKNET_NETWORK);
237+
let network = getNetwork(process.env.STARKNET_NETWORK);
329238
console.log(
330239
"Tx hash: ".green,
331240
`${network.explorer_url}/tx/${contract.transaction_hash})`,
332241
);
333242
await account.waitForTransaction(contract.transaction_hash);
334243
console.log("Contract Address: ".green, contract.address, "\n\n");
335-
descriptor_custom_data_addresses.push(contract.address)
336244

337245
return contract.address
338246
}
@@ -341,9 +249,20 @@ export const deployDescriptorCustom = async () => {
341249

342250
function whitelist_merkle_roots(){
343251
return [
344-
0x3a5f886e952da36285158c8e9e2cec6d4d17d1271cbb66d6c770bc0ea795025n, // tier 1
345-
0x7355045c69306c4f0aa9b82ec8fe14cedc41f4e1ecf632f159d416d89b30a7n, // tier 2
346-
0x5ae7c1084891066205bff66d47382b55de150e9e7f8807e76e33cc65b7e8a23n, // tier 3
347-
0xe124d0eba590a8049e8a1107799a3ed7253f0eaa4c2c1d1e6927969dc1069dn, // tier 4
252+
BigInt(merkle_data["1"]["root"]),
253+
BigInt(merkle_data["2"]["root"]),
254+
BigInt(merkle_data["3"]["root"]),
255+
BigInt(merkle_data["4"]["root"]),
348256
]
257+
}
258+
259+
260+
const addArrayToCalldata = (calldata, arr) => {
261+
262+
calldata.push(arr.length)
263+
for (let j =0 ; j < arr.length; j++) {
264+
calldata.push(arr[j]);
265+
}
266+
267+
return calldata
349268
}

contracts/scripts/libs/interaction.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import colors from "colors";
55

66
import * as fs from "fs";
77

8-
const blobertAddress = 0x42f5f669ae20b76fa38badec759f4c25b099ae05e167595f81964f796f8bb80n;
8+
const blobertAddress = 0x007075083c7f643a2009cf1dfa28dfec9366f7d374743c2e378e03c01e16c3afn;
99
export const generateSvgImage = async () => {
1010

1111
///////////////////////////////////////////
@@ -14,17 +14,6 @@ export const generateSvgImage = async () => {
1414

1515
// Load account
1616
const account = getAccount();
17-
18-
// read abi of Test contract
19-
let res = await account.callContract(
20-
{contractAddress: blobertAddress, entrypoint: "svg_image", calldata:[39,0] } // 36 fails
21-
)
22-
23-
let pending_word = res[res.length - 2]
24-
let pending_word_len = res[res.length -1]
25-
res.pop() // pop pending_word_len
26-
res.pop() // pop pending word
27-
res.shift() // shift "data"
2817
let bytearr = {
2918
data: res,
3019
pending_word: pending_word,
@@ -57,9 +46,11 @@ export const callWhitelistMint = async () => {
5746
calldata.push(account.address) //recipient
5847

5948
let merkle_proof = [
60-
0x1bfd917fdf403007307805477ec62a6b8ec2883afa38cdc52a47b1756822248n,
61-
0x294c410fc840bc5c257d481337bbcb5901662c1276c29b94f491b04e2b18cban,
62-
0xa08249e3f9ee50da4382d47fa01ce5c3a1f7466dcadf0e0c375add37ef48ebn
49+
"2461346573285723365912187430944399967588953026779287944953191952128612292614",
50+
"1046207144106800084680566165664977077184516474202712165255045607345244738617",
51+
"1700665023328058276710386641482722623796946951043856227758729548785023586887",
52+
"1776384935207426675478629185070085697852105557904271143125014918582071270454",
53+
"2356048579238990704538630181877896738178417927929725321119494838445799290171"
6354
]
6455

6556
calldata.push(merkle_proof.length)
@@ -87,5 +78,5 @@ export const callWhitelistMint = async () => {
8778
}
8879

8980

90-
generateSvgImage()
91-
// callWhitelistMint()
81+
// generateSvgImage()
82+
callWhitelistMint()

contracts/scripts/libs/network.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Account, RpcProvider, json } from "starknet";
44
const NETWORKS = {
55
mainnet: {
66
name: "mainnet",
7+
explorer_url: "https://voyager.online",
8+
rpc_url: `${process.env.RPC_API_KEY}`,
79
feeder_gateway_url: "https://alpha-mainnet.starknet.io/feeder_gateway",
810
gateway_url: "https://alpha-mainnet.starknet.io/gateway",
911
},

contracts/scripts/mainnet_deploy.ansi

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Compiling blob v0.1.0 (/Users/credence/Desktop/BobbyRealms/contracts/Scarb.toml)
2+
Finished release target(s) in 7 seconds
3+
 ____ _ 
4+
 | \ ___ ___| |___ _ _ 
5+
 | | | -_| . | | . | | |
6+
 |____/|___| _|_|___|_ |
7+
 |_| |___|
8+

9+
Declaring Seeder...
10+
11+

12+
- Class Hash:  0x2d380808a4096a20d9412d6be237b55be1cda3e962db1a787b74e1eb4c9cd27
13+
- Tx Hash:  https://voyager.online/tx/0x1dde39b5bb28a8f2ee4bfa425c164803d22471afdb6b8966160578ef28365a4)
14+

15+
Deploying Seeder ...
16+
17+

18+
Tx hash:  https://voyager.online/tx/0x1a00d4d711169240c3df91697a5d83b80eb8b4974f8887836e5da86fdab7f5c)
19+
Contract Address:  0x592403d219ba2077760667c8244850a22a7e04f8f97af89c9d1c8df4678b79c
20+
21+
22+

23+
Declaring DescriptorRegular...
24+
25+

26+
- Class Hash:  0x57900913798506416e6339b42e1c903d9c4469353a2f39a10510060c79c7482
27+
- Tx Hash:  https://voyager.online/tx/0x7702b1fdb9ad45cb716a081d6c0d369099695f56b15235b3577153405a60c0b)
28+

29+
Deploying DescriptorRegular ...
30+
31+

32+
Tx hash:  https://voyager.online/tx/0x11011702cfd39a039697db4ed95c9f62d61c833ad7b75ed8a263d60504da724)
33+
Contract Address:  0x7c82f2f8199551b5eb828de9d0a485c1dfbe8f4d05502a7e39d1379da398d7f
34+
35+
36+

37+
Declaring DescriptorCustom...
38+
39+

40+
- Class Hash:  0x19524960405f69c76cf80f5d9cbfae56fd2c0920b7060f0c59f4d46a7f596fb
41+
- Tx Hash:  https://voyager.online/tx/0x7faf6545c43c2f44f3819df64b26d06119dbbfc1e57ccc2e7c5e2b91aa34c1e)
42+

43+
Deploying DescriptorCustom ...
44+
45+

46+
Tx hash:  https://voyager.online/tx/0x322d77180a396bb86aeb935b2f6b138bb666970e78fae29a4ff0814a6bdde65)
47+
Contract Address:  0x63ab8702d967c25ad40c0c9bf76df50b9473ca57b282810463fe0ab6166751b
48+
49+
50+

51+
Declaring Blobert...
52+
53+

54+
- Class Hash:  0x761ab63f932aa13127acaa2fafa9cd837e0658a157152c67894103a9ae2eb5a
55+
- Tx Hash:  https://voyager.online/tx/0x775afbc654e8bf4f4c9df9c248d050c5062655e93402b28b3a6ef100efbeb1e)
56+
57+
58+
59+
Deploying Blobert ...
60+
61+
62+
Tx hash: https://voyager.online/tx/0x302e96aad5ae3c3a21942e8a4948847243d191830c560bb8937e4625a73687f)
63+
Contract Address: 0x539f522b29ae9251dbf7443c7a950cf260372e69efab3710a11bf17a9599f1
64+

0 commit comments

Comments
 (0)