-
Notifications
You must be signed in to change notification settings - Fork 0
/
Post Auction Launcher
72 lines (48 loc) · 2.66 KB
/
Post Auction Launcher
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//Post Auction Launcher
/Post Auction Launcher as name says, is a contract for creation and migration of liquidity pools to Sushiswap exchange. To launch the Liquidity Pool we deposit the auction token and payment token and call finalize function./
//Address
//Launch a liquidity pool
function depositETH() public payable
//Deposits WETH to the contract to build a pair with a token for launching a pool.
function depositToken1(uint256 _amount) external
/Deposit token 1 where, token 1 is the payment currency through which we buy the auctioned token. Typically ETH otherwise, any existing ERC20 Token that is used as Payment Currency for the market/
function depositToken2(uint256 _amount) external
//Deposit token 2 where, token 2 is the auction token that is to be auctioned.
function finalize() external nonReentrant returns (uint256 liquidity)
/Launches a liquidity pool. First it checks whether a market has been finalized, if not finalized it finalizes the market! Once called, it launches token1/token2 paired liquidity pool.It intializes the period till which we want the LP tokens to be locked in the contract/
//Withdraw functions
function withdrawDeposits() external
/After the liquidity has been launched, there can be remaining token1 and token2 balance in the contract. This function withdraws the remaining balance to the respective wallet/
function withdrawLPTokens() external returns (uint256 liquidity)
//All the lp tokens from liquidity pool is transferred to the wallet by the account having operator role after the lock period
//Init Function
function initAuctionLauncher(
address _market,
address _factneedsory,
address _admin,
address _wallet,
uint256 _liquidityPercent,
uint256 _locktime
)
public
/Name
Description
_market
Address of the market for which we want to have post auction launcher
_factory
Uniswap V2 factory
_admin
Address with admin priviledges
_wallet
The address that gets the remaining fund and LP tokens after locktime
_liquidityPercent
Percent of initial auction token liquidity you want to launch.
_locktime
Period that we want to lock the liquidity pool before withdrawing/
//Read Only Functions
function getTokenAmounts() public view returns (uint256 token1Amount, uint256 token2Amount)
//Returns balanced amounts of token1 and token2 to be launched. It performs calculations so that, the relationship between both the token is normal and not skewed.
function getLPBalance() public view returns (uint256)
//Returns amount of LP token generated and locked in the contract
function getLPTokenAddress() public view returns (address)
//Returns token1 token2 paired LP token