releasing-rewards

Releasing Delegation Rewards

Interacting with Vesting Contracts

If you have a vesting contract with The Graph, there are two essential functions that may be of interest to you.

  • Releasing unlocked GRT tokens from your vesting contract
  • Withdrawing delegation rewards from your vesting contract

In this guide, we will explain how you can move delegation rewards, which are unlocked by default, to your beneficiary address. To learn more about moving unlocked GRT, have a look at this: Releasing Unlocked GRT Tokens.

Video Tutorial

Step-by-step Video Guide

This guide on withdrawing rewards from your vesting contract is also available as a video:

Withdrawing rewards from vesting contract in 3 steps.

Here’s what you’re going to learn today. We’ll have a detailed look at each step in the explanations below.

1

Identifying your vesting contract address

Finding out what the address of your vesting contract is.

logo
2

Connecting your beneficiary address

Preparing your MetaMask wallet and logging in to your account.

metamask
3

Interacting with your vesting contract

Using Remix to interact with the vesting contract.

Step 1 – Identifying Your Vesting Contract Address.

No worries if you aren’t sure what your vesting contract address is. You can find out really quick by querying The Graph API. All you need to do is to visit The Graph Explorer, copy & paste the following command:

Copy to Clipboard

And enter your ETH address where it says “Your ETH Address.” After this, hit the play button and you’ll see your contract address. Let’s do exactly that with an example ETH address:

vesting-contract-query

Once you’ve written down your vesting contract address, we can go ahead.

Step 2 – Connecting to Your Beneficiary Address.

Install the MetaMask extension in your browser (if you haven’t already) and connect your ETH address to it. If you have already done that, simply log into MetaMask. Make sure that you are using the beneficiary ETH address that is connected to your vesting contract.

Step 3 – Interacting with Your Vesting Contract.

Open the Remix app in the web browser that you are using MetaMask with. Next, click on the file icon to create a new file. You can call the file “TockenUnlock.abi”. Confirm by hitting enter.

Next, copy the code from Edge & Node team member Abarmat that he published on GitHub. You can then paste the code into the TokenLockWallet.abi which you have just created. Make sure there are a total of 605 lines of code.

In the next step, click on the ETH symbol you can find on the left-hand side. This will forward you to the page where you can deploy & run transactions. Over there, select “Injected Web3” as your environment.

This will prompt a MetaMask message asking you to connect your wallet. Select your beneficiary ETH address, click on “Next” and “Connect” to connect your wallet.

Once you are connected to MetaMask, you can paste the vesting contract address you copied earlier into the “At Address” field. After this, click the “At Address” button and confirm the message that pops up by clicking “OK.”

After having added the vesting contract address, you can scroll down to the section “Deployed Contracts.” Expand the section and scroll down to where it says “withdrawSurplus.” Here, you can insert the amount of GRT you want to withdraw with 18 decimals at the end. 

remix-withdraw

Note: Numbers are formatted with the integer type uint256. There are 18 decimals. (GRT amount is E+18).

You can then select the amount of GRT you want to withdraw.

  • 1000000000000000000 equals 1.00 GRT
  • 12000000000000000000 equals 12.00 GRT
  • 123000000000000000000 equals 123.00 GRT
  • 1234000000000000000000 equals 1,234.00 GRT
  • 12345000000000000000000 equals 12,345.00 GRT
  • 123456000000000000000000 equals 123,456.00 GRT
  • And so on.

To prevent unreasonably high gas prices, it’s advisable to set your gas limit to 300,000, which is a “rule of thumb” for more complex contracts.

Summary

Great! You are now able to withdraw rewards from your vesting contract to your beneficiary ETH address.

Go Back

Delegator Knowledge Hub