Wrapped ICP(WICP) is the wrapped token of ICP, the native token of the Internet Computer network. It has backed 1:1 with ICP and the same value by way of Canister's full control over ICP! WICP uses the EXT fungible token standard to allow interoperability between DApps and other tokens. Moreover, integrate ICP with DeFi to solve the problem of ICP's lack of approval function.
In order to interact with the Internet Computer mainnet version of the Wrapped ICP (WICP) canister, you need the address.
- WICP Canister ID:
5xnja-6aaaa-aaaan-qad4a-cai
- WICP Account ID:
e994ad0378bb902896b55dd5a69a72e7fb2762bba50b32f66f77d2d99d07ac94
You have to use this address (Canister ID) to make your calls, with the exception of the Account ID during the mint.
Using the mint method is done in two steps. First, we need to make a transfer call at the ICP ledger to the WICP account ID. Using the following command you’ll be returned the block height when your transaction has been approved.
dfx ledger --network ic transfer "e994ad0378bb902896b55dd5a69a72e7fb2762bba50b32f66f77d2d99d07ac94" --amount value --memo 0
Now that we have the block height of our ICP transfer, we can call the mint method on the WICP canister.
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai mint '(record {to=variant {principal=principal "yourPrincipalId"}; blockHeight=yourBlockHeight:nat64})'
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai mint '(record {to=variant {address="yourAccountId"}; blockHeight=yourBlockHeight:nat64})'
Open ICPSwap 1.0 and come to the Wrap page. For example, enter 0.1 as follows, then click the "Wrap" button.
Calling withdraw unwraps your WICP, burns it, and then unlocks and sends ICP from the WICP canister to the balance of the Principal ID you specify.
The Withdraw method takes two parameters, ‘amount’ and ‘to’. ‘Amount‘ is an integer that represents the amount of WICP you’d like to withdraw to ICP. ‘To‘ is a string that should be the Principal ID or Account ID that you wish the ICP to be transferred to.
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai withdraw '(record {to=variant {principal=principal "yourPrincipalId"}; amount=value:nat})'
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai withdraw '(record {to=variant {address="yourAccountId"}; amount=value:nat})'
The unwarp feature is to restore the WICP to ICP, click the button as shown, exchange the WICP and ICP location, enter the WICP amount, and click the "Unwrap" button.
You can transfer WICP to any other valid Account. Your balance at the WICP ledger will be deducted and the Account you transfer to, will be incremented.
Transfers ‘value’ (Nat) amount of tokens to user ‘to’ (Principal or Account), returns a TransferResponse which contains the transfer amount or an error message.
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai transfer '(record {to=variant {principal=principal "toPrincipalId"}; token="WICP"; notify=false; from=variant {principal=principal "yourPrincipalId"}; memo=vec {}; subaccount=null; nonce=1; amount=value})'
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai transfer '(record {to=variant {address="toAddress"}; token="WICP"; notify=false; from=variant {address="yourAddress"}; memo=vec {}; subaccount=null; nonce=1; amount=value})'
Open ICPSwap website and come to the Wallet page. Click the Token tab, then you will find the token list. Click the transfer button of WICP, input the Account and Amount in the new window.
You can set an allowance using this method, giving a third-party access to a specific number of tokens they can withdraw from your balance if they want.
An allowance permits the ‘spender’ (Principal) to withdraw tokens from your account or your sub-account, up to the ‘value’ (Nat) amount. If it is called again, it overwrites the current allowance with ‘value’ (Nat). There is no upper limit for value, you can approve a larger value than you have, but 3rd parties are still bound by the upper limit of your account balance.
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai approve '(record {subaccount=null; allowance=value; spender=principal "toPrincipalId"})'
Transfers ‘value’ (Nat) amount of tokens from user ‘from’ (Principal or Acount) to user ‘to’ (Principal or Account), this method allows canister smart contracts to transfer tokens on your behalf, it returns a TransferResponse which contains the transfer amount or an error message.
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai transferFrom '(record {to=variant {principal=principal "toPrincipalId"}; token="WICP"; notify=false; from=variant {principal=principal "yourPrincipalId"}; memo=vec {}; subaccount=null; nonce=1; amount=value})'
dfx canister --network=ic call 5xnja-6aaaa-aaaan-qad4a-cai transferFrom '(record {to=variant {address="toAddress"}; token="WICP"; notify=false; from=variant {address="yourAddress"}; memo=vec {}; subaccount=null; nonce=1; amount=value})'
Set the fee of the token. Only the owner of the token has permission.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai setFee '(value:nat)'
Set the account for the fee of the token. Only the owner of the token has permission.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai setFeeTo '(variant {principal=principal "fee-to-principal"})'
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai setFeeTo '(variant {address="fee-to-address"})'
Returns the balance of user who
.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai balance '(record {token="WICP"; user=variant {principal=principal "who-principal"}})'
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai balance '(record {token="WICP"; user=variant {address="who-address"}})'"(principal \"who-account-principal\")"
Returns the amount which spender is still allowed to withdraw from owner.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai allowance '(record {owner=variant {principal=principal "owner-principal"}; subaccount=null; spender=principal "spender-principal"})'
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai allowance '(record {owner=variant {address="owner-address"}; subaccount=null; spender=principal "spender-principal"})'
Returns the wrap transaction of Wrapped ICP (WICP). The ‘user’ and ‘index’ is optional.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai wrappedTx '(record {user=opt variant {principal=principal "query-principal"}; offset=opt 1; limit=opt 10; index=opt 10001})'
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai wrappedTx '(record {user=opt variant {address="query-address"}; offset=opt 1; limit=opt 10; index=opt 10001})'
Returns the transfer records of Wrapped ICP (WICP). The ‘hash’, ‘user’ and ‘index’ is optional.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai transactions '(record {hash=opt "hash-value"; user=opt variant {principal=principal "query-principal"}; offset=opt 1; limit=opt 10; index=opt 10001})'
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai transactions '(record {hash=opt "hash-value"; user=opt variant {address="query-address"}; offset=opt 1; limit=opt 10; index=opt 10001})'
Returns the list of the Wrapped ICP (WICP) holders.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai holders '(record {offset=opt 1; limit=opt 10})'
Returns the total amount of the Wrapped ICP (WICP) holders.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai totalHolders
Returns the logo of Wrapped ICP (WICP).
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai logo
Returns the total supply of the token.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai supply
Returns the fee of the token.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai getFee
Returns the metadata of the token.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai metadata
Returns the extensions of the token.
dfx canister --network=ic call --query 5xnja-6aaaa-aaaan-qad4a-cai extensions
Create branches from the main
branch and name it in accordance to conventional commits here, or follow the examples bellow:
test: Adding missing tests
feat: A new feature
fix: A bug fix
chore: Build process or auxiliary tool changes
docs: Documentation only changes
refactor: A code change that neither fixes a bug or adds a feature
style: Markup, white-space, formatting, missing semi-colons...