OneClick Contracts
OneClick Contracts zaps multiple actions into one transaction. You can use this function to enhance your user experience with Sharwa.
provideETH
provideETHUse this function when you need to provide ETH to a margin account.
Wrap ETH to WETH
Deposit WETH to a margin account
Example on TS:
await OneClickMarginTrading.provideETH(
1, //margin account id
{value: parseEther("0.001")} // ETH amount
)borrowSwap
borrowSwapUse this function when you need to open Long or Short position in one transaction.
Borrow Token "A"
Swap token "A" for token "B"
For example, borrow ETH and sell it for USDC to open a Short position on ETH within one transaction.
Example on TS:
await OneClickMarginTrading.borrowSwap(
1, //margin account iD
await USDC.getAddress() // token address to sell
await WETH.getAddress(), // token address to buy
parseUnits("3", await USDC.decimals()), // token amount to sell
0 // minumum token to receive (slippage control)
)swapRepay
swapRepayUse this function when you want to close a position and repay the debt in one transaction.
Swap token "A" for token "B"
Repay the debt for token "B"
Example: Borrow USDC and swap it for ETH. Then fix the profits by selling ETH for USDC and repaying the debt in one transaction.
withdrawProvideERC721
withdrawProvideERC721Use this function when you want to purchase an option on Hegic using collateral from your margin account
Withdraw token "A" from a margin account
Swap token "A" for USDC.e
Purchase an option on Hegic
Deposit Hegic Option (ERC-721) to the margin account
Example: purchase an option position using collateral from the margin account.
transferBuyProvideERC721
transferBuyProvideERC721Use this function when you want to purchase an option on Hegic using funds from your wallet and deposit the purchased option to the margin account.
Swaps token "A" from the user's wallet (works only with WETH, WBTC and USDC)
Swaps token "A" for USDC.e
Purchase an option on Hegic
Provide Hegic Option (ERC-721) to a margin account
Example: purchase an option option position to hedge your margin account using funds from your wallet.
Last updated