-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
actor {} |