Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: XORless transactions for all actions #1171

Open
4 tasks
AndreyKortosov opened this issue Aug 13, 2024 · 0 comments
Open
4 tasks

[Feature]: XORless transactions for all actions #1171

AndreyKortosov opened this issue Aug 13, 2024 · 0 comments
Assignees
Labels
feature Adding support for a new feature in the network

Comments

@AndreyKortosov
Copy link

AndreyKortosov commented Aug 13, 2024

User stories

As a I want to
SORA user Send a transaction without holding XOR
~ Swap without holding XOR
~ Provide liquidity without holding XOR
~ Place a limit order without holding XOR
~ Place a market order without holding XOR
~ Single-side pool without holding XOR
~ Bridge tokens without holding XOR
~ Open a borrowing position (vault) without holding XOR
~ Close a borrowing position without holding XOR
~ Add collateral to a borrowing position without holding XOR
~ Claim rewards without holding XOR
ADAR user Batch swap transfer without holding XOR

Acceptance criteria

  1. The user wants to make a transaction and provide the necessary information for it, input token as well.
    1. The front-end checks the input token in the Fee tokens whitelist -
      1. If the input token is in the list, the front-end calls the target pallet where additional input - Fee token.
      2. Otherwise, the input token isn’t in the list, the front-end calls the target pallet where in additional input - Fee token will be XOR.
    2. The whitelist is stored on the front-end side in the JSON file.
    3. The target pallet calls an extension the XOR fee pallet to handle the fee.
    4. The XOR fee pallet sees to the token of fees
      1. If the fee token is XOR.
        1. Target pallet to make an operation and pay network fee in XOR
      2. If the fee token is not XOR, another token
        1. The XOR fee pallet swaps the token to XOR via XYK pool with influence on the price.
        2. Target pallet to make an operation and pay network fee in XOR
    5. The blockchain aggregates fee transactions in one block to optimize resources.
    6. The front-end receives the result of the transaction.
    7. The front-end shows the result to the User.

Sequence diagram

image-20240723-161241

White list of tokens with enough liquidity

Below you can find a list of tokens which has liquidity of more than $4000 + TBCD, based on Polkaswap statistics for 13.08.2024 - Polkaswap — The DEX for the Interoperable Future.

  • XOR
  • KXOR
  • ETH
  • KUSD
  • APOLLO
  • VAL
  • LLD
  • PSWAP
  • DAI
  • HMX
  • XSTUSD
  • DOT
  • DEO
  • KSM
  • TBCD

Also, for the last 6 months, ~97% of all transactions in SORA were made in 4 tokens: XOR, TBCD, ETH, and DAI.

Definition of Done

  • Exists a new white list of fee tokens.
  • Fee transaction in the aggregated block.
  • If the input token is in the whitelist, the user can make transactions without XOR on the balance.
  • If the input token is not in the whitelist, the user can make transactions only by paying XOR for the fee.

Roll Out Plan

Here’s a plan for how to roll out XORless transactions to Polkaswap:

  • Kensetsu page

    • kensetsu.createCdp
    • kensetsu.closeCdp
    • kensetsu.repayDebt
    • kensetsu.depositCollateral
    • kensetsu.borrow
  • Referral system page

    • referrals.reserve
    • referrals.unreserve
    • referrals.setReferrer
  • Pool page

    • poolXYK.depositLiquidity
    • utility.batchAll([tradingPair.register, poolXYK.initializePool, poolXYK.depositLiquidity])
    • poolXYK.withdrawLiquidity
  • Rewards page

    • vestedRewards.claimRewards
    • vestedRewards.claimCrowdloanRewards
    • pswapDistribution.claimIncentive
    • rewards.claim
    • batch of these TXs above like CLAIM ALL
  • XOR Validator staking (need to check which one we want to make XORless)

    • taking.bond
    • utility.batchAll([staking.bond, staking.nominate])
    • staking.bondExtra
    • staking.rebond
    • staking.unbond
    • staking.withdrawUnbonded
    • staking.setPayee
    • staking.setController
    • staking.payoutStakers
  • Demeter farming & CERES based features

    • demeterFarmingPlatform.deposit
    • demeterFarmingPlatform.withdraw
    • demeterFarmingPlatform.getRewards
    • ceresLiquidityLocker.lockLiquidity
  • Trade page

    • orderBook.placeLimitOrder
  • Swap page, ADAR

    • liquidityProxy.swap
    • liquidityProxy.swapTransfer
    • liquidityProxy.swapTransferBatch
  • Rest of parts

@AndreyKortosov AndreyKortosov added the feature Adding support for a new feature in the network label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding support for a new feature in the network
Projects
None yet
Development

No branches or pull requests

2 participants