forked from spinner-cash/launchtrail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prelude.repl
43 lines (38 loc) · 1.24 KB
/
prelude.repl
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
function create_canister() {
let id = call ic.provisional_create_canister_with_cycles(record { settings = null; amount = null });
id.canister_id
};
function deploy(id, wasm, did, arg) {
call ic.install_code(
record {
arg = encode did.__init_args(arg);
wasm_module = wasm;
mode = variant { install };
canister_id = id;
},
)
};
identity private "../dist/private.pem";
let launchtrail = create_canister();
import did = "2vxsx-fae" as "../dist/launchtrail.did";
let _ = deploy(launchtrail, file "../dist/launchtrail.wasm", did, record { bucket_size = 1000; max_buckets = 1000; "config" = record { min_schedule = 0; submitters = vec { private }; revokers = vec { private }; }; });
function submit(canister, method, requires) {
call launchtrail.submit(record {
canister = canister;
method = method;
requires = requires;
sha256 = null;
expires = variant { In = 10_000_000_000 };
activates = variant { In = 1_000_000 };
revokers = null;
executors = null;
payment = 0;
url = "";
})
};
function execute(index, args) {
call launchtrail.execute(record { index = index; args = args })
};
function revoke(index, reason) {
call launchtrail.execute(record { index = index; reason = reason })
};