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

Develop new UniswapRouter-like contract #247

Open
hieronx opened this issue Mar 8, 2024 · 0 comments
Open

Develop new UniswapRouter-like contract #247

hieronx opened this issue Mar 8, 2024 · 0 comments
Assignees
Labels
I8-enhancement An additional feature. Q5-hard Can be done by an experienced coder with a good knowledge of the codebase.

Comments

@hieronx
Copy link
Contributor

hieronx commented Mar 8, 2024

Permissionless claiming
Why: removes 1 transaction required for Prime users

Lock tokens before added as member
Why: allows Prime users to submit the investment transaction before they have fully finished the legal onboarding steps

Multicall support
Add https://github.com/Uniswap/v4-periphery/blob/main/contracts/base/Multicall.sol to Router.

Why: claiming investment and submitting investment or redemption should be possible in 1 tx

contract LiquidityPoolRouter is Multicall {
 
  // --- Interactions ---
  function requestDeposit(address liquidityPool, uint256 assets) external {
    asset.transferFrom(msg.sender, address(this), assets);
    liquidityPool.requestDeposit(...);
  }

  function claimDeposit(address liquidityPool, address investor) external {
    // TODO: claim deposit, send tranche tokens to investor
  }

  function requestRedeem(address liquidityPool, uint256 shares) external {
    share.transferFrom(msg.sender, address(this), shares);
    liquidityPool.requestRedeem(...);
  }

  function claimRedeem(address liquidityPool, address investor) external {
    // TODO: claim deposit, send currency to investor
  }

  // --- Lock before member ---
  mapping (address investor => mapping (address liquidityPool => uint256 amount)) lockedRequests;

  function lockRequestDeposit(address liquidityPool, uint256 assets) external {
    asset.transferFrom(msg.sender, address(this), assets);
    lockedRequests[msg.sender][liquidityPool] += assets;
  }

  function executeLockedRequestDeposit(address liquidityPool, address investor) external {
    liquidityPool.requestDeposit(assets, address(this), investor, "");
    lockedRequests[msg.sender][liquidityPool] -= assets;
  }

  // --- View methods ---
  function getLiquidityPool(uint64 poolId, bytes16 trancheId, address currency) external view returns (address) {
    // TODO
  }

}
@hieronx hieronx added I8-enhancement An additional feature. Q5-hard Can be done by an experienced coder with a good knowledge of the codebase. labels Mar 8, 2024
@AStox AStox mentioned this issue May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I8-enhancement An additional feature. Q5-hard Can be done by an experienced coder with a good knowledge of the codebase.
Projects
None yet
Development

No branches or pull requests

2 participants