Kwenta Documentation
DiscordKwentaTwitterBlog
  • 🥂Welcome to Kwenta
  • Getting Started
    • How to start using Kwenta
    • Introduction
    • Getting started on Optimism
    • How to get sUSD
    • Access Kwenta
      • Installing the IPFS Companion to Access Kwenta
      • Backup RPCs
      • Withdrawing from v2 Isolated Margin using Optimistic Etherscan
  • Using Kwenta
    • Futures on Kwenta
    • Jargon
    • Synthetix Isolated Margin
      • Funding
        • Technical Details
      • Delayed Orders
      • Maker/Takers on Kwenta
      • Leverage
      • Liquidations
      • Initial/Maintenance Margin
      • One-Click Trading
        • Onboarding to 1CT
        • FAQ
      • Smart Margin
        • Dashboard Overview
        • Futures UI Overview
        • Get Started with Smart Margin
          • Withdrawing sUSD & ETH
          • Opening/Closing Positions
          • Conditional Orders
            • Limit Orders
            • Stop-Loss Orders
          • FAQ
      • Delegated Trading
        • Getting started
        • Managing Delegates
        • Accessing Accounts Delegate to You
      • Fees
      • Referral Program
        • The Traders Tab
        • The Affiliates Tab
        • Incentive Tiers and Rewards
      • FAQ
    • Perennial Isolated Margin
      • Perennial Intro
        • Market Design
        • Oracles
        • Payoff & Positions
        • Trading Fees and Price Impact
        • Funding Rate
        • Interest Rate
        • Leverage & Liquidations
        • Collateral
        • CodeBase
      • Bridging to Arbitrum
      • Trading on Perennial
        • Dashboard Overview
        • Futures UI Overview
        • Opening/Closing Positions
        • Advanced Orders
          • Limit Orders
          • Stop-Loss Orders
      • Gasless Trading
        • Onboarding to 1-Click-Trading
        • FAQ
  • Kwenta Token
    • Staking KWENTA
      • How to stake KWENTA
      • Escrow and Vesting
      • Transferring Escrow Entries
    • Claiming Rewards
    • Trading Rewards
  • DAO
    • Kwenta Token
    • Governance
    • MarketingDAO
    • devDAO
      • Contributing to the Kwenta Frontend
        • Troubleshooting
        • Testing
  • Developers
    • Deployed Contracts
      • V2 Futures Market Proxy Contracts
    • Verify Kwenta
    • Kwenta SDK
  • Resources
    • Audits
    • Development progress Epoch 1 2024
    • GitHub
Powered by GitBook
On this page
  • 1. Register on Optimistic Etherscan
  • 2. Locate Your Deposit
  • 3. Locate the Custom Contract ABI
  • 4. Add Custom ABI to Optimistic Etherscan
  • 5. Withdraw Margin

Was this helpful?

  1. Getting Started
  2. Access Kwenta

Withdrawing from v2 Isolated Margin using Optimistic Etherscan

PreviousBackup RPCsNextFutures on Kwenta

Last updated 1 year ago

Was this helpful?

Kwenta v2 Isolated Margin has been deprecated with the release of Smart Margin v2. Users who did not withdraw before Isolated Margin was deprecated may still withdraw from the contracts using the Optimistic Etherscan interface.

1. Register on Optimistic Etherscan

To get started, please ensure you have registered for an Optimistic Etherscan account. It's free, and is required to use custom contract interactions.

2. Locate Your Deposit

Each market has its own a unique proxy contract address. If you know the contract address, simply navigate to the contract on Optimistic Etherscan.

If you don't know the contract address, you find it in the Synthetix Github. You can search for the correct address by searching the page for PerpsV2ProxyETHPERP. If you were trading another market, you'll need to replace the ticker in your search (for example, PerpsV2Proxy1INCHPERP if you were trading 1inch.

Ensure you've located the mainnet address (this should be the first result in your search), and follow the link directly to the contract on Optimistic Etherscan.

3. Locate the Custom Contract ABI

The contract code should list a Custom Contract ABI. To speed up the process, the Custom Contract ABI for all contracts has been copied below. Simply copy the text in the Custom ABI box below to your clipboard for use in the next step:

Custom ABI
[{"inputs":[{"internalType":"address payable","name":"_proxy","type":"address"},{"internalType":"address","name":"_marketState","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_resolver","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"CacheUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int256","name":"funding","type":"int256"},{"indexed":false,"internalType":"int256","name":"fundingRate","type":"int256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FundingRecomputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"int256","name":"marginDelta","type":"int256"}],"name":"MarginTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"trackingCode","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"baseAsset","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"marketKey","type":"bytes32"},{"indexed":false,"internalType":"int256","name":"sizeDelta","type":"int256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"PerpsTracking","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"margin","type":"uint256"},{"indexed":false,"internalType":"int256","name":"size","type":"int256"},{"indexed":false,"internalType":"int256","name":"tradeSize","type":"int256"},{"indexed":false,"internalType":"uint256","name":"lastPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fundingIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"int256","name":"skew","type":"int256"}],"name":"PositionModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"proxyAddress","type":"address"}],"name":"ProxyUpdated","type":"event"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"desiredFillPrice","type":"uint256"}],"name":"closePosition","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"desiredFillPrice","type":"uint256"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"name":"closePositionWithTracking","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isResolverCached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"marketState","outputs":[{"internalType":"contract IPerpsV2MarketState","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"messageSender","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"int256","name":"sizeDelta","type":"int256"},{"internalType":"uint256","name":"desiredFillPrice","type":"uint256"}],"name":"modifyPosition","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"int256","name":"sizeDelta","type":"int256"},{"internalType":"uint256","name":"desiredFillPrice","type":"uint256"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"name":"modifyPositionWithTracking","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proxy","outputs":[{"internalType":"contract Proxy","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebuildCache","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"recomputeFunding","outputs":[{"internalType":"uint256","name":"lastIndex","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"resolver","outputs":[{"internalType":"contract AddressResolver","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"resolverAddressesRequired","outputs":[{"internalType":"bytes32[]","name":"addresses","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"setMessageSender","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"_proxy","type":"address"}],"name":"setProxy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"int256","name":"marginDelta","type":"int256"}],"name":"transferMargin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawAllMargin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

4. Add Custom ABI to Optimistic Etherscan

Using the data found on this contract page, we'll add a custom ABI to Optimistic Etherscan. This allows us to withdraw from the contract. You'll need to be logged in to complete this step.

Click +Add to add your Custom Contract ABI, and enter the following information:

  • Name: Enter a name to identify the contract. Any name may be entered.

  • Address: Copy the proxy contract address from the previous step, and paste it in this field

  • Custom ABI: Copy the Custom Contract ABIto this field

5. Withdraw Margin

  1. Navigate to the contract page and select Connect to Web3 to connect your wallet.

  2. Once connected, select Write Custom at the top of the page.

  3. Find the function 12. withdrawAllMargin at the bottom of the page and select Write to withdraw all margin.

Note: Most users will find their deposit in the ETH market proxy contract:

If the ABI was added correctly, you'll have access to the withdraw function. For the ETH market, this can be done at .

These steps will guide you through withdrawing your funds from the deprecated Isolated Margin contracts using the Optimistic Etherscan interface. If you need additional assistance please open a ticket in

https://optimistic.etherscan.io/address/0x2B3bb4c683BFc5239B029131EEf3B1d214478d93
https://optimistic.etherscan.io/address/0x2B3bb4c683BFc5239B029131EEf3B1d214478d93#writeCustomContract
Discord.
https://optimistic.etherscan.io/registeroptimistic.etherscan.io
An Optimistic Etherscan account is required to use a custom ABI.
synthetix-docs/addresses.md at master · Synthetixio/synthetix-docsGitHub
Some proxy contracts are mislabeled on Etherscan. Follow the link directly from the Synthetix Github to locate the correct contract.
https://optimistic.etherscan.io/mycustomabioptimistic.etherscan.io
A custom ABI can be added here
Logo
Search for your market proxy contract
You'll copy and paste this data in the next step
Cut and paste the data to ensure accuracy
Ensue your wallet is connected and Write the function, 12. withdrawAllMargin