This repository contains contract of FA2 token that can be used for wrapping native Tezos coin ($XTZ or $TEZ) into FA2 token.
Contract implements FA2 interface token with some custom logic. Contract contains single-asset logic for wrapping native Tezos, delegating locked Tezos to bakers (as admin), transfer token and update operators. Token is designed for free minting and burning wrapped tokens.
All baking rewards for locked and delegated Tezos goes to admin
Contract has all required FA2 entrypoints such as transfer, update_operators and balance_of callback view.
If Alice wants to wrap her $XTZ into $wXTZ, she should call Mint entrypoint to mint tokens for some receiver. $XTZ sent to contract will be locked inside contract untill call Burn.
When Alice owns $wXTZ and want to get back her $XTZs, she should call Burn entrypoint. This method sends amountof $XTZ from contract to the receiver passed inside call params.
Also, if Bob is operator of Alices $wXTZs, he could call Burn with from_ param as Alice address and burn her tokens.
-
Installed NodeJS (tested with NodeJS v16+)
-
Installed Yarn
-
Installed node modules with:
yarn installyarn start-sandbox
#> wait for about 10 seconds
yarn test
#> executing tests
yarn stop-sandboxyarn compile -c fa2yarn migrate
# Execute yarn migrate -h for more migrate params.