Skip to main content
All CollectionsAdvanced
Guide to Unstaking Tokens on Gnosis Chain
Guide to Unstaking Tokens on Gnosis Chain

This guide will walk you through the process of unstaking your tokens from the TokenLocking contract on Gnosis Chain.

Updated over 3 weeks ago

Overview

Prerequisites

Before you begin, ensure you have the following:

  • A web3-compatible wallet (e.g., MetaMask) connected to Gnosis Chain.

  • Some xDAI in your wallet to cover transaction fees.

  • The TokenLocking Contract ABI (provided below).

  • For reference, the token contract address for CLNY on Gnosis Chain is: 0xc9B6218AffE8Aba68a13899Cbf7cF7f14DDd304C

Step 1: Load the Contract ABI

  1. Enter the TokenLocking Contract ABI provided below.

  2. Connect your wallet to the site using the "Connect Wallet" button.

TokenLocking Contract ABI:

[
{
"constant": false,
"inputs": [
{
"name": "_token",
"type": "address"
},
{
"name": "_amount",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_token",
"type": "address"
},
{
"name": "_user",
"type": "address"
}
],
"name": "getUserLock",
"outputs": [
{
"components": [
{
"name": "lockCount",
"type": "uint256"
},
{
"name": "balance",
"type": "uint256"
},
{
"name": "timestamp",
"type": "uint256"
}
],
"name": "lock",
"type": "tuple"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]

Step 2: Check Your Locked Tokens

  1. Navigate to Read Functions in the tool.

  2. Locate the function: "Read Function: getUserLock".

  3. Enter the Token Address.

    • For example CLNY (0xc9B6218AffE8Aba68a13899Cbf7cF7f14DDd304C).

  4. Click "CALL GETUSERLOCK".

  5. The function will return an array of values, similar to:

    [ "0", "10006113344029417188709", "0" ]
    • The second value represents the number of tokens you have locked. This value can be used as a number in the next step.

Step 3: Initiate Unstaking

  1. Navigate to Write Functions.

  2. Locate the function: "Write Function: withdraw".

  3. Enter the following details:

    • Token Contract Address:

      • For example CLNY 0xc9B6218AffE8Aba68a13899Cbf7cF7f14DDd304C

    • Amount:

      • The amount of tokens to withdraw.

      • i.e. the second value from the getUserLock response in the previous step

  4. Click "Call Withdraw" and confirm the transaction in your wallet.

Step 4: Confirm the Transaction

  • After submitting, wait for the transaction to be confirmed on Gnosis Chain.

  • Once complete, your tokens should be available in your wallet.

Troubleshooting

  • Ensure you are connected to Gnosis Chain.

  • Use the same wallet that originally locked the tokens.

  • Make sure you have enough xDAI for gas fees.

  • If the transaction fails, double-check the token address and amount.

Additional Resources

By following this guide, you will successfully unstake your tokens from the TokenLocking contract. πŸš€

Attachment icon
Did this answer your question?