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

**URL:** <https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466>\
**Category:** Programs & Applications\
**Created:** [May 28, 2021, 2:15am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466 "2021-05-28T02:15:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephenandrews](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stephenandrews/32/1803_2.png) [@stephenandrews](https://forum.dfinity.org/u/stephenandrews)\
**Post date:** [May 28, 2021, 2:15am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/1 "2021-05-28T02:15:41Z")

</div>

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).

> **[Toniq-Labs/wrapped\_cycles](https://github.com/Toniq-Labs/wrapped_cycles)**
>
> Motoko code for a Wrapped ICP Cycles canister on DFINITY's IC

---

<div class="post-metadata">

**Author:** ![hackape](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/hackape/32/1165_2.png) [@hackape](https://forum.dfinity.org/u/hackape)\
**Post date:** [May 28, 2021, 4:56am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/2 "2021-05-28T04:56:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stephenandrews](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stephenandrews/32/1803_2.png) [@stephenandrews](https://forum.dfinity.org/u/stephenandrews)\
**Post date:** [May 28, 2021, 5:14am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/3 "2021-05-28T05:14:17Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![jzxchiang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jzxchiang/32/2592_2.png) [@jzxchiang](https://forum.dfinity.org/u/jzxchiang)\
**Post date:** [May 28, 2021, 6:08am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/4 "2021-05-28T06:08:57Z")

</div>

By non-upgradeable, do you mean something like [this](https://forum.dfinity.org/t/unstoppability-vs-immutability/2304/2)?

---

<div class="post-metadata">

**Author:** ![LightningLad91](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lightninglad91/32/5373_2.png) [@LightningLad91](https://forum.dfinity.org/u/LightningLad91)\
**Post date:** [May 28, 2021, 7:07pm UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/5 "2021-05-28T19:07:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Ori](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@Ori](https://forum.dfinity.org/u/Ori)\
**Post date:** [May 28, 2021, 7:54pm UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/6 "2021-05-28T19:54:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/wang/32/446_2.png) [@wang](https://forum.dfinity.org/u/wang)\
**Post date:** [May 29, 2021, 12:47am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/7 "2021-05-29T00:47:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stephenandrews](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stephenandrews/32/1803_2.png) [@stephenandrews](https://forum.dfinity.org/u/stephenandrews)\
**Post date:** [May 29, 2021, 12:57am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/8 "2021-05-29T00:57:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [May 29, 2021, 1:36am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/9 "2021-05-29T01:36:46Z")

</div>

On naming, how about this?

ETH → WETH  
ICP → WICP

---

<div class="post-metadata">

**Author:** ![wang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/wang/32/446_2.png) [@wang](https://forum.dfinity.org/u/wang)\
**Post date:** [May 29, 2021, 1:40am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/10 "2021-05-29T01:40:18Z")

</div>

`WICP` and `WCYCLE` make sense to me

---

<div class="post-metadata">

**Author:** ![PaulLiu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulliu/32/4701_2.png) [@PaulLiu](https://forum.dfinity.org/u/PaulLiu)\
**Post date:** [May 29, 2021, 7:51pm UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/11 "2021-05-29T19:51:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![flyq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/flyq/32/3637_2.png) [@flyq](https://forum.dfinity.org/u/flyq)\
**Post date:** [May 30, 2021, 1:21am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/12 "2021-05-30T01:21:27Z")

</div>

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](https://github.com/dfinance-tech/motoko-token/tree/ledger) :motoko_go:

---

<div class="post-metadata">

**Author:** ![stephenandrews](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stephenandrews/32/1803_2.png) [@stephenandrews](https://forum.dfinity.org/u/stephenandrews)\
**Post date:** [May 30, 2021, 2:18am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/13 "2021-05-30T02:18:15Z")

</div>

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](https://github.com/Toniq-Labs/ic-fungible-token/blob/main/README.md)

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](https://github.com/dfinity/nns-ifaces/blob/master/ledger.did)

And then using the AccountIdentifier library that we put together: [GitHub - stephenandrews/motoko-accountid](https://github.com/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).

---

<div class="post-metadata">

**Author:** ![stephenandrews](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stephenandrews/32/1803_2.png) [@stephenandrews](https://forum.dfinity.org/u/stephenandrews)\
**Post date:** [May 30, 2021, 2:21am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/14 "2021-05-30T02:21:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PaulLiu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulliu/32/4701_2.png) [@PaulLiu](https://forum.dfinity.org/u/PaulLiu)\
**Post date:** [May 30, 2021, 3:26am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/15 "2021-05-30T03:26:43Z")

</div>

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

Trillion ICP Cycles = TIC

---

<div class="post-metadata">

**Author:** ![stephenandrews](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/stephenandrews/32/1803_2.png) [@stephenandrews](https://forum.dfinity.org/u/stephenandrews)\
**Post date:** [May 30, 2021, 3:41am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/16 "2021-05-30T03:41:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/wang/32/446_2.png) [@wang](https://forum.dfinity.org/u/wang)\
**Post date:** [May 30, 2021, 10:34am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/17 "2021-05-30T10:34:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ccyanxyz](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ccyanxyz/32/1025_2.png) [@ccyanxyz](https://forum.dfinity.org/u/ccyanxyz)\
**Post date:** [May 30, 2021, 12:49pm UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/18 "2021-05-30T12:49:33Z")

</div>

Wrapped Trillion Cycles (WTC)

---

<div class="post-metadata">

**Author:** ![wang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/wang/32/446_2.png) [@wang](https://forum.dfinity.org/u/wang)\
**Post date:** [May 30, 2021, 1:26pm UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/19 "2021-05-30T13:26:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Maxfinity](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/maxfinity/32/1484_2.png) [@Maxfinity](https://forum.dfinity.org/u/Maxfinity)\
**Post date:** [May 31, 2021, 11:13am UTC](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466/20 "2021-05-31T11:13:51Z")

</div>

> [@stephenandrews](#):
>
> 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.

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

[Next page](https://forum.dfinity.org/t/wrapped-icp-cycles-wic-working-motoko-code-using-erc20-style-token/4466.md?page=2)
