Manually Withdraw

Learn how manually withdraw your assets from Gamma

Introduction

If you don't have access to the Gamma Web Application, there are ways to withdraw your funds from the protocol. This guide will review ways to withdraw your assets if you don't have access. This includes withdrawing from LP incentives, any vault, or the GAMMA staking contract.

We'll use block explorers like Etherscan to do this action. Make sure you use the proper explorer for the network you have your assets on.

pageUsing Block Explorers

Withdraw from Incentives

1) Choose an incentive contract

A link to the proper incentive contract is in the incentives section on each incentivized vault page.

If you can't access this, navigate to the Contracts / Wallets page and scroll down to the Infrastructure Contracts section. There, you'll find our incentive contracts (Masterchef) listed. Find the one that applies to your funds. Ask us for assistance if you do not know which one it is.

2) Query the PID

You'll need to get the PID number of the vault you want to withdraw from. The PID is a number that ties the vault to the incentive contract. You can query the PID manually below.

First, make sure you know the vault contract address. In this example, we're looking for the OP-USDC Narrow vault: 0x2102bef0d9727ea50ba844e7658e38480961835c.

Under "Read Contract" go to Section "3. lptoken".

In the first box "<input> (uint256)", type in a number from 0 - ∞. Starting from 0.

Press "Query".

This action will give you the vault address. The correct number used to query it is the PID. Repeat this query until you find the correct address. In this case, "5".

Copy down the number in the red box.

3) Query the amount

Under "Read Contract" go to Section "11. userInfo".

In the first box "<input> (uint256)", type in the PID number corresponding to the vault you deposited in.

In the second box "<input> (address)", type your deposit address.

Press "Query".

This action will give you the amount you deposited (in wei).

Copy down the number in the red box.

4) Connect your wallet

On "Write Contract", connect the wallet you used to stake the LP tokens.

5) Write the transaction

Under "Write Contract" go to Section " 15. withdraw" or "16. withdrawAndHarvest" (they do the same thing).

In the first box "pid (uint256)", type in the PID number corresponding to the vault you deposited in.

In the second box "amount (uint256)", type in the amount you queried in step three.

In the third box "to (address)", type your deposit address.

Press "Write".

6) Verify the transaction

After completing the transaction, click "View your transaction" to verify everything went through. This action will withdraw your LP tokens and incentives from the incentive contract.

You're all done!

Withdraw from Vaults

1) Choose a vault

Usually, there is a link to the vault contract in the main and withdraw sections on each vault detail page.

If you can't access this, navigate to the vault repo. There, you'll find our vault contracts listed. Find the one that applies to your funds. Ask us for assistance if you do not know which one it is.

2) Query the shares

You'll need to get the amount of LP tokens (shares) of the vault you want to withdraw from. This number is 10^18 * your LP token value. Confusing! Let's do a contract query and get the right number.

Under "Read Contract" go to Section "4. balanceof".

In the first box, "account (address)", type in the wallet address that holds your LP tokens or the address you deposited funds from.

Press "Query".

This action will give you "shares" or the amount of LP tokens in the correct format.

Copy down the number in the red box.

3) Connect your wallet

On "Write Contract", connect the wallet you used to deposit your assets into a vault

4) Write the transaction

Under "Write Contract" go to Section "18. withdraw"

In the first box "shares (uint256)", type in the shares number you queried in step two. This is the number of your LP tokens * 10^18.

In the second box "to (address)", type in your deposit address.

In the third box "from (address)", type in your deposit address

Boxes two and three are the same address

In the fourth box "minAmounts (uint256[4])", type in [0,0,0,0].

Press "Write".

5) Verify the transaction

After completing the transaction, click "View your transaction" to verify everything went through. This action will dissolve your LP tokens and withdraw your assets from the vault.

You're all done!

Withdraw from V1 NFT Vaults

1) Choose a vault

Navigate to the Vault Repository. There, you'll find our V1 NFT vault contracts listed. Find the one that applies to your funds. Ask us for assistance if you do not know which one it is.

For your withdrawal to work, you must have your NFT in the wallet that you deposited with.

2) Query the shares

You'll need to get the amount of LP tokens (shares) of the vault you want to withdraw from. This number is 10^18 * your LP token value. Confusing! Let's do a contract query and get the right number.

Under "Read Contract" go to Section "3. balanceof".

In the first box, "account (address)", type in the wallet address that holds your LP tokens or the address you deposited funds from.

Press "Query".

This action will give you "shares" or the amount of LP tokens in the correct format.

Copy down the number in the red box.

3) Connect your wallet

On "Write Contract", connect the wallet you used to deposit your assets into a vault

4) Write the transaction

Under "Write Contract" go to Section "17. withdraw"

In the first box "shares (uint256)", type in the shares number you queried in step two. This is the number of your LP tokens * 10^18.

In the second box "to (address)", type in your deposit address.

In the third box "from (address)", type in your deposit address

Boxes two and three are the same address

Press "Write".

5) Verify the transaction

After completing the transaction, click "View your transaction" to verify everything went through. This action will dissolve your LP tokens and withdraw your assets from the vault.

You're all done!

Withdraw staked GAMMA

1) Choose the staking contract

Navigate to the GAMMA staking contract.

2) Query the share

You'll need to get the amount of xGAMMA in the staking contract that you want to withdraw. This number is 10^18 * your xGAMMA. Confusing! Let's do a contract query and get the right number.

Under "Read Contract" go to Section "2. balanceOf".

In the first box, "account (address)", type in the wallet address that holds your xGAMMA or the address you deposited funds from.

Press "Query".

This action will give you "share" or the amount of xGAMMA in the correct format. In this example, about 27.59 xGAMMA is in the wallet.

Copy down the number in the red box.

3) Connect your wallet

On "Write Contract", connect the wallet you used to deposit your GAMMA.

4) Write the transaction

Under "Write Contract" go to Section "5. leave"

In the first box "_share (uint256)", type in the share number you queried in step two. This is the number of your xGAMMA tokens * 10^18.

Press "Write".

5) Verify the transaction

After completing the transaction, click "View your transaction" to verify everything went through. This action will unstake your GAMMA from the staking contract.

You're all done!

Last updated