The Golem Network Token Wrapped (GNTW) Contract

The Golem Network Token (GNT) is not a fully ERC20-compliant token. The ERC20 standard requires the following methods and events to be implemented for full compliance:

Check out the Golem Network Token source code at Golem Crowdfunding Funded To 820,000 ETH Cap, and you will notice that the transferFrom(...) and approve(...) methods are not implemented, and the Approval(...) event is not implemented.

It is for this reason that there is only a Trustless Golem Network Token (GNT) Selling Contract. There is no equivalent buying contract or a buy/sell contract.

User /u/vnovak has deployed an ERC20-compliant wrapper token for GNT to 0x936f78b9852d12f5cb93177c1f84fb8513d06263 – source ERC20-compliant wrapper token for GNT – will enable trading of wrapped GNT on Etherdelta.

Good news! This will also allow the trading of buy contracts or buy/sell contracts on the decentralised trusted platform https://cryptoderivatives.market/. This post will look into more details on GNTW smart contract that wraps the GNT.

See The Original Augur REP TokenTraderFactory Contract (Work In Progress) for more details on the REP TokenTraderFactory contract that will allow the creation of a buy/sell market on GNTW.


Table of contents


1. How The GNTW Wrapper Works

1. You transfer your GNT tokens to the GNTW contract. The GNTW contract now owns your GNT tokens, and issues you with the equivalent number of GNTW tokens.
2. You can transfer your GNTW tokens between addresses like any ERC20-compliant tokens.
3. You can approve the transfer of GNTWs to another account using the GNTW approve(...). The other account can then use the GNTW transferFrom(...) to transfer up to the approved amount from your account to itself.
4. At any time, you can transfer your GNTWs to the GNTW contract and your GNTs will be unwrapped and deposited to your account.


2. How To Wrap Your GNT In GNTW

1. Call createPersonalDepositAddress(). This creates a new DepositSlot contract and associates it with your account.
2. Call getPersonalDepositAddress(address depositer) to find out your personal deposit address. This is the address of your newly created DepositSlot contract. The depositer is your Ethereum wallet address.
3. Use the GNT contract to transfer(address _to, uint256 _value) your GNTs from your account to your personal deposit address. The _to is your personal deposit address from 2. above. _value is the amount of tokens you want to transfer, in the native units. 1 GNT = 1e18 or 1,000,000,000,000,000,000 (enter without commas).
4. Call processDeposit() so that the GNTW contract wraps your newly deposited GNTs. Your will receive the same number of GNTWs as amount of GNTs you deposited.
5. You can now use the ERC20-compliant GNTW contract methods transfer(address _to, uint256 _amount), approve(address _spender, uint256 _amount) and transferFrom(address _from, address _to, uint256 _amount) to move the GNTWs to different accounts.
6. Test it yourself. Before you wrap up significant amounts of your GNTs, check out the source code below, wrap up a small amount of your GNTs, transfer a portion of your GNTWs to another of your accounts, check that you can unwrap the GNTW into GNTs in both accounts and check that the numbers are correct.


3. How To Unwrap Your GNT From GNTW

1. To extract GNTs from your GNTW contract, use the GNT contract transfer(...) to transfer the GNTW tokens from your account to the GNTW contract. Your GNTs will be unwrapped and transferred from the GNTW contract to your account.


4. Watch The GNTW Contract And Token In Ethereum Wallet / Mist

4.1 Watch The GNTW Contract

To watch the GNTW contract in Ethereum Wallet or Mist, select the Contracts tab on the top bar. Click on Watch Contract.

In the following screen:

WatchGNTWContract_20161123_003541

4.2 Watch The GNTW Token

To watch the GNTW token in Ethereum Wallet or Mist, select the Contracts tab on the top bar. Click on Watch Token.

In the following screen, set the TOKEN CONTRACT ADDRESS to 0x936f78b9852d12f5cb93177c1f84fb8513d06263. The TOKEN NAME, TOKEN SYMBOL and DECIMAL PLACES OF SMALLEST UNIT will be automatically filled.

WatchGNTWToken_20161123_004929


5. GNTW Source Code

The verified GNTW source code at the address 0x936f78b9852d12f5cb93177c1f84fb8513d06263 is shown below.

You can see that it is a fully ERC20-compliant wrapper token.

See also the Maker Market GNT wrapper at makerdao/token-wrapper for comparison.


6. GNTW Application Binary Interface

[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"depositer","type":"address"}],"name":"getPersonalDepositAddress","outputs":[{"name":"depositAddress","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"standard","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"createPersonalDepositAddress","outputs":[{"name":"depositAddress","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"GNT","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"processDeposit","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Approval","type":"event"}]

Here is the corresponding method and event listing:

This entry was posted in Blog and tagged , , , , . Bookmark the permalink.