Skip to content

Instantly share code, notes, and snippets.

@johnnieskywalker
Last active June 19, 2024 09:11
Show Gist options
  • Save johnnieskywalker/0551a4963f24d8f9cb8923c28e551afa to your computer and use it in GitHub Desktop.
Save johnnieskywalker/0551a4963f24d8f9cb8923c28e551afa to your computer and use it in GitHub Desktop.
How to withdraw funds from OnX guide

Instructions for Withdrawing Funds from OnX

If your funds are stuck in OnX, follow these steps to withdraw them from the smart contracts.

Identifying Where Your Funds Are Stuck

Your funds could be in one of several smart contracts. Most likely, they are in the OnX Farm:

You must locate where your funds are before proceeding.

Case 1: Withdraw from OnX Farm

This is the code for an emergency withdrawal on the OnX Farm:

function emergencyWithdraw(uint256 _pid) public {
    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][msg.sender];
    pool.token.safeTransfer(address(msg.sender), user.amount);
    emit EmergencyWithdraw(msg.sender, _pid, user.amount);
    user.amount = 0;
    user.rewardDebt = 0;
}

Step 1: Find Your Pool

  1. Read the OnX Farm Smart Contract on Etherscan: OnX Farm Smart Contract
  2. Check poolInfo by passing numbers from 0 to 26 as arguments to see the token of each pool. Knowing what token you deposited will make this easier.

Step 2: Find Your Funds

  1. Call the userInfo method with your address and the ID of the pool.
  2. If the returned amount is non-zero, you can withdraw your funds. You might need to check all pools if you don't remember the token you deposited.

Step 3: Withdraw Funds (Be Careful)

  1. Connect your wallet to Etherscan to write to the contract: Write Contract
  2. Call the emergencyWithdraw function, passing the pool ID (_pid) as an argument.
  3. Carefully execute the transaction.

Case 2: Withdraw from an OnX Pool

OnX has multiple pools. Your funds might be stuck in one of these. First, browse all OnX pools and find where your funds are: OnX Pools.

Determine the Amount of Token to Withdraw

  1. Visit the pool page, e.g., Example OnX Pool.
  2. Read the contract and call the balanceOf method, passing your address as an argument: Read Contract.

Execute Withdraw Transaction

  1. Go to the write contract page for your pool: Write Contract.
  2. Call the withdraw function, passing the amount of your funds as an argument.
  3. Execute the transaction. If your funds are still in the contract and you correctly passed the amount, your withdrawal transaction should look like this: Example Transaction.

Other OnX Smart Contracts

Refer to the OnX Finance documentation for other smart contract addresses: OnX Finance Documentation.

Token and Contract Addresses

  • Ethereum
    • ONX token (ONX): 0xe0ad1806fd3e7edf6ff52fdb822432e847411033
    • Staked ONX token (sONX): 0xa99f0ad2a539b2867fcfea47f7e71f240940b47c
    • onEthereum (onETH): 0xC1330aCBbcE97cb9695B7ee161c0F95B875a8b0F
    • onStable (ONS): 0xfC97C0c12438B6E4CF246cD831b02FeF4950DCAD
    • OnX.Finance Governance (onONX): 0x424b1ae0af693d4577dde25081e970cb656013c7
  • Fantom
    • ONX Token (ONX): 0x27749e79ad796c4251e0a0564aef45235493a0b6
    • Bridge for ONX token: Multichain Cross-Chain Router
  • Polygon
    • ONX Token (ONX): 0xeb94a5e2c643403e29fa1d7197e7e0708b09ad84
    • Bridge for ONX token: Polygon Bridge
  • Avalanche
    • ONX Token (ONX): 0x3D8f74620857dd8ED6D0dA02ceB13fd0Ed8Ba678
    • Bridge for ONX token: Multichain Cross-Chain Router
  • Binance Smart Chain
    • ONX Token (ONX): 0x50dfd52c9f6961bf94d1d5489ae4b3e37d2f1fe7
    • Bridge for ONX token: Multichain Cross-Chain Router (available soon)

Contract Addresses

  • ONX Token Contract: 0xE0aD1806Fd3E7edF6FF52Fdb822432e847411033
  • ONX Farm Contract: 0x168F8469Ac17dd39cd9a2c2eAD647f814a488ce9
  • Pre-mint Timelock: 0x5716749e23C94c0d03ed03B9AB951D6686d385E1
  • onVault (holding collateral backing onETH in circulation): 0x3BdF1977d87EDAD8e0617efCEa958F6d43A4C30E
  • OnX Insurance Fund: 0x53d3B757af4d1B897D4A4f24A46769790B0052Ba

If you need any assistance, feel free to reach out to me. I'll try to help you withdraw your funds whenever I have some free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment