How to transfer cycles between wallets in motoko?

My project at https://hwqwz-ryaaa-aaaai-aasoa-cai.raw.ic0.app/ does a bunch of this. Mostly you have to use cycles and there is a motoko canister called ExperimentalCycles.

You can see my canister code at https://hwqwz-ryaaa-aaaai-aasoa-cai.raw.ic0.app/candy.mo

And the license manager code at https://hwqwz-ryaaa-aaaai-aasoa-cai.raw.ic0.app/licenseManager.mo

Basically this keeps a counter and then every X number of calls it will send a buck worth of cycles to the creator of the library.

The canister and app also implements people paying me ICPs to get a distribution license…I had to use the ledger shim (Annouce Ledger Candid: your missing candid interface to the NNS ledger). Basically they send ICP to my account, and the block to the dapp canister. It confirms the block with the ledger and give them credit. It isn’t wrapped ICP, but it is close.

I’m working on the github where I can host more of this in a straightforward manner.

3 Likes