Wrapped ICP Cycles (WIC) - Working MOTOKO code using ERC20 style token

We put up a repo showing how we can use wrapped ICP cycles as a token that can be converted back to cycles in future. This also provides an easier way for canister owners to add cycles to their canisters - buy WIC from an exchange and then use the simple “burn” call to add these cycles to an canister that the user wants to (as long as it has the accept_cycles call added to it).

13 Likes

I think you need to address the balance and allowance persistency. They’re not stable, you’d lose data after upgrade canister code.

This would be a non-upgradeable contract - I believe there’s meant to be a way to set the owner of the contract to noone. The ERC20-like calls are just filler though until a proper standard is agreed upon (which includes the allowances and balances).

By non-upgradeable, do you mean something like this?

Genuinely curious, what purpose would this serve? Would this provide a way for developers/future businesses to sell back their excess cycles? Does the IC provide a way to convert cycles back to ICP?

The IC currently doesn’t provide a way to convert cycles back. But if someone had an excess and wanted some funds they might reasonably look to sell them. Note this doesn’t hinder stabilising the cost of cycles, if someone needed to sell theirs they’d probably offer them below cost and they’d get bought up quickly, so the price would return to its stable value.

Wrapping cycles gives them a standard interoperable interface, allowing them to be used in DeFi applications.

1 Like

Another important benefit (in my eyes) is for tx fees. For example tokens - when we transfer tokens via a token standard, it doesn’t incur any fee for the sending user. It just burns cycles from the token canister. Now someone needs to pay for these cycles some how, so how can we make this possible? With a wrapped cycle token, we can allow senders of tokens to utilize WIC to pay for tx fees. The token canister would accept the WIC, transfer it to cycles, and process the token transfer.

On naming, how about this?

ETH → WETH
ICP → WICP

WICP and WCYCLE make sense to me

2 Likes

I’ll suggest WTC = wrapped trillion cycles. The basic unit of cycles is just too small.

5 Likes

Well done work.

I have two suggestions. One is to increase support for historical records, and the other is to support Account Identifier, so as to be unified with ledger canister and lower the user obstacle. You can refer to this: GitHub - dfinance-tech/motoko-token at ledger :motoko_go:

1 Like

Yeah the ERC20 standard stuff is to be updated once we have an agreed upon standard. We’ve put forward out thoughts here which does use AccountIdentifier as well as a few other differences (spenders are Principals and we drop approve() due to known issues with it): ic-fungible-token/README.md at main · Toniq-Labs/ic-fungible-token · GitHub

We use it as a Text type though, as per the interface to the ledger canister: nns-ifaces/ledger.did at master · dfinity/nns-ifaces · GitHub

And then using the AccountIdentifier library that we put together: GitHub - stephenandrews/motoko-accountid. I do agree a transaction list is required, although we are still thinking over how we want to do this (storing in secondary canisters etc, essentially what BigMap hopes to achieve).

Yeah definitely should be 1T cycles wrapped - our implementation does do this.

We went with WIC as in Wrapped ICP Cycles as you can pronounce it as wick (like a candle wick) which burns (cycles are essentially burnt when they are used), although we like the following as well:
WTC - Wrapped Trillion Cycles
WICC - Wrapped IC Cycles
WIT - Wrapped ICP Trillion cycles

WCYCLE seems a bit long imo

If “Trillion” is in the name, that is already a differentiator. So maybe we can drop “Wrapped”?

Trillion ICP Cycles = TIC

Yup I like this one, my new preferred name for it. TIC lets go!

1 Like

TIC may be confused for The Internet Computer?

I am slightly in favor of keeping the W prefix for consistency with WICP. WTC/WICC/WIT all seem ok

2 Likes

Wrapped Trillion Cycles (WTC)

1 Like

How do we feel about TC for trillion cycles in general?

  • this instruction costs 0.00000050 TC
  • an app uses 0.002 TC per day
  • i’ll pay you 40 TC for that function
  • 1 ICP mints 75 TC
  • offer 1000 ICP @ 74 TC per, 74k TC for the lot
6 Likes

Still not sure how we can wrap icp as only whitelisted canisters can own ICP.