Seed liquidity
A contract to pool funds which are then used to boostrap a new Uniswap liquidity pair.
Specification
- A new
SeedLiquiditycontract is deployed for non-existent or non-liquid Uniswap pair. The initial price is specified usingtargetamounts. - Users
deposittokens into the contract until both targets are reached. - A user calls
provideto supply liquidity to Uniswap. - Users can
claimtheir pro-rata share of the LP received LP token. - If the target amounts are not raised or the liquidity is not provided before expiry, users can
bailtheir deposits and the contract becomes void.
Interface
__init__(address,address[2],uint256[2],uint256,uint256)
Set up a new seed liquidity contract
routerUniswapRouter address, e.g. 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488DtokensTokens which comprise a pairtargetAmounts of tokens to provide, also determines the initial pricedurationDuration over which the contract accepts deposits, in secondslocktimeHow long the liquidity will stay locked, in seconds
deposit(uint256[2])
Deposit token amounts into the contract.
A user must have approved the contract to spend both tokens. The token amounts are clamped to not exceed their targets. This function only works up to the moment when liquidity is provided or the contract has expired, whichever comes first.
amountsToken amounts to deposit
provide()
Bootstrap a new Uniswap pair using the assets in the contract
This function can only be called once and before the contract has expired. Requires the target to be reached for both tokens. Requires the pool to have no liquidity in it.
claim()
Claim the received LP tokens
Can be called after liquidity is provided and the locktime has expired. The token amount is distributed pro-rata to the contribution.
bail()
Withdraw the tokens if the contract has expired without providing liquidity
Can be called after expiry given no liquidity has been provided.