Skip to content

Commit

Permalink
add canisters
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkoom committed May 16, 2024
1 parent 361e622 commit 70cab24
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/fund.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Principal "mo:base/Principal";
import Ledger "./ledger_service";
import C "./_constants"

actor {
let ledger = actor (C.ledgerId) : Ledger.Self;

public shared ({ caller }) func send(owner : Principal, amount : Nat) : async Ledger.Result {
assert (caller == Principal.fromText(C.admin1));

let to : Ledger.Account = {
owner;
subaccount = null;
};

let transferArg : Ledger.TransferArg = {
to;
fee = null;
memo = null;
from_subaccount = null;
created_at_time = null;
amount;
};

await ledger.icrc1_transfer(transferArg);
};

// test

public shared query ({ caller }) func whoami() : async Text {
return Principal.toText(caller);
};
};
33 changes: 33 additions & 0 deletions src/fund_promo.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Principal "mo:base/Principal";
import Ledger "./ledger_service";
import C "./_constants"

actor {
let ledger = actor (C.ledgerId) : Ledger.Self;

public shared ({ caller }) func send(owner : Principal, amount : Nat) : async Ledger.Result {
assert (caller == Principal.fromText(C.admin1));

let to : Ledger.Account = {
owner;
subaccount = null;
};

let transferArg : Ledger.TransferArg = {
to;
fee = null;
memo = null;
from_subaccount = null;
created_at_time = null;
amount;
};

await ledger.icrc1_transfer(transferArg);
};

// test

public shared query ({ caller }) func whoami() : async Text {
return Principal.toText(caller);
};
};
1 change: 1 addition & 0 deletions src/treasury.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
actor {}

0 comments on commit 70cab24

Please sign in to comment.