Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/banteg/seed-liquidity
Pool funds to bootstrap a Uniswap pair
https://github.com/banteg/seed-liquidity
ethereum liquidity uniswap vyper
Last synced: 25 days ago
JSON representation
Pool funds to bootstrap a Uniswap pair
- Host: GitHub
- URL: https://github.com/banteg/seed-liquidity
- Owner: banteg
- License: mit
- Created: 2020-12-18T13:49:05.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-20T18:59:08.000Z (almost 4 years ago)
- Last Synced: 2024-10-04T11:37:53.349Z (about 1 month ago)
- Topics: ethereum, liquidity, uniswap, vyper
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 77
- Watchers: 7
- Forks: 28
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Seed liquidity
A contract to pool funds which are then used to boostrap a new Uniswap liquidity pair.
## Specification
1. A new `SeedLiquidity` contract is deployed for non-existent or non-liquid Uniswap pair. The initial price is specified using `target` amounts.
2. Users `deposit` tokens into the contract until both targets are reached.
3. A user calls `provide` to supply liquidity to Uniswap.
4. Users can `claim` their pro-rata share of the LP received LP token.
5. If the target amounts are not raised or the liquidity is not provided before expiry, users can `bail` their deposits and the contract becomes void.## Interface
### `__init__(address,address[2],uint256[2],uint256,uint256)`
Set up a new seed liquidity contract- `router` UniswapRouter address, e.g. 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
- `tokens` Tokens which comprise a pair
- `target` Amounts of tokens to provide, also determines the initial price
- `duration` Duration over which the contract accepts deposits, in seconds
- `locktime` How 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.
- `amounts` Token amounts to deposit### `provide()`
Bootstrap a new Uniswap pair using the assets in the contractThis 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 tokensCan 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 liquidityCan be called after expiry given no liquidity has been provided.