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 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:


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.


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


Here is the corresponding method and event listing:

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