numotrade / numo2

🤖 Leverage on long-tail tokens.
Other
0 stars 0 forks source link

Change approach to token transfers #7

Open robertleifke opened 1 week ago

robertleifke commented 1 week ago

Description:

The functions in the LendgineRouter and LiquidityManager contracts always use the to address, instead of msg.sender, as the tracked owner of funds.

The contract requires the following steps for minting in LendgineRouter:

  1. Deposit collateral into LendgineRouter.
  2. Call the burn function on the Pair contract, which will do the following:
  1. Mint PowerTokens for the user in an equivalent number of shares.
  2. Execute the safeTransfer function to transfer both tokens into the Pair contract .
  3. Call the pairMintCallback function in LendgineRouter, which will do the following:
    • Swap token1 for token0.
    • Transfer token1 to the Lendgine contract.
    • Transfer collateral to Lendgine.

The flow of tokens above is hard to follow, is error-prone, and can lead to issues in accounting or to token transfer mistakes.

Actions Items: