You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pain is a suite of contracts to be deployed on EVM L2 and achieve what pump.fun is doing but more. Other than launching any unruggable ERC20 tokens with bonding curve which will trigger LP promotion when the token reaches a certain Market Cap. More features like Lottery, Donation, Token buy back & burn etc are also supported on Pain.
Contract Strcuture
Contract
Description
Pain
Main entry for users to launch unruggable PainBCToken with 1B fixed supply, collects protocol fee, supports admin operations e.g. token buy back & burn
PainBCToken
Immutable ERC20 token deployed as minimal proxy, minted and burnt via bonding curve, will be migrated to Uniswap V2 0.3% Pool when reaches target MC
PainLottery
Collects the lottery fee, supports setup and distribution of daily & weekly Lottery
External Contracts Dependency
Chain
Contract
Address
Base
Uniswap V2 Factory
0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6
Base
Uniswap V2 Router
0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24
Base
WETH
0x4200000000000000000000000000000000000006
Base
Pyth Oracle
0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a
Glossary
Basis Points - A basis point is one hundredth of 1 percentage point, so 1000 BP means 10%
Proxy - A proxy contract is an intermediary contract that delegates calls to another smart contract known as the 'implementation' contract. Commonly there are two kinds of proxies which are UUPS and Transparent Proxy. In UUPS proxies the upgrade is handled by the implementation, and can eventually be removed. Transparent proxies on the other hand, include the upgrade and admin logic in the proxy itself.
Technical Reference
Pain.sol
Deployment
Input
Usage
Example
address painLottery
The address of the deployed painLottery.sol
0x...
address painTokenImplementation
The "interface" for newly deployed token to use as the codebase
0x...
uint256 reserveRatioBP
The percentage for reserve ratio in Basis Points
1000
uint16 protocolFeeBP
The percentage for protocol fee in Basis Points
1000
uint16 lotteryFeeBP
The percentage for lottery fee in Basis Points
5000
uint16 buyBackBP
The percentage taken from protocol fee in Basis Points to buy back tokens
1000
uint16 donationBP
The percentage taken from migrated liquidity in Basis Points to donate
Deploy a new token as a minimal proxy with Bonding Curve applied, a protocol fee on top of _INITIAL_PURCHASE_ETH should be passed in when calling, a signature signed by our signer with token information is needed in order to have users launch new token via platform only
For example a message could be deploy-new-token_id-0_name-hello world_symbol-HW_isDonating-false, the way of constructing the signature can be referenced from signTokenDeploymentMessage on PainTestHelpers.t.sol.
P.S.: There could be spacing between the letters of the name, or checkings could be enforced externally via backend
Getter functions
Method
Usage
Return
getReserveRatioBP()
Get the reserve ratio for bonding curve calulcation in Basis Points
uint256 _RESERVE_RATIO_BP
getProtocolFeeBP()
Get the percentage for protocol fee in Basis Points
uint16 protocolFeeBP
getLotteryFeeBP()
Get the percentage for lottery fee in Basis Points
uint16 lotteryFeeBP
getBuyBackBP()
Get the percentage taken from protocol fee in Basis Points to buy back tokens
uint16 buyBackBP
getDonationBP()
Get the percentage taken from migrated liquidity in Basis Points to donate
Emitted when a token reached the target MC to promote to LP
PainLottery.sol
Specific data types
/// @param prizeToken the token address for the lottery prize/// @param bonusPrizeToken the token address for the lottery bonus prize if there is any/// @param interval enum of `LotteryInterval`, this is saved for reference and is not used against any verifications/// @param drawnAt the timestamp when the lottery is drawn/// @param totalPrizeAmount the total amount of prize for the lottery, to be checked against the actual total amount swapped out/// @param merkleRoot the merkle root of the merkle tree used to verify the lottery winnersstruct Lottery {
address prizeToken;
address bonusPrizeToken;
LotteryInterval interval;
uint40 drawnAt;
uint256 totalPrizeAmount;
bytes32 merkleRoot;
}
struct LotteryClaim {
uint256 lotteryId;
LotteryInterval interval;
uint256 prizeAmount;
uint256 bonusAmount;
bytes32[] proof;
}
struct LotteryConfig {
uint256 lotteryId;
address prizeToken;
address bonusPrizeToken;
LotteryInterval interval;
uint40 drawnAt;
uint256 totalPrizeAmount;
SwapParams swapParams;
bytes32 merkleRoot;
}
/// @param poolFee fee tier chosen for the Uniswap pool to swap, e.g. 3000 means 0.3% pool/// @param exactAmountOutForPrize the exact amount of token needed for the lottery prize/// @param exactAmountOutForBonus the exact amount of token needed for the lottery bonus prize if there is any/// @param amountInMaximumForPrize the maximum amount of token we will use to swap for the `exactAmountOutForPrize`/// @param amountInMaximumForBonus the maximum amount of token we will use to swap for the `exactAmountOutForBonus`struct SwapParams {
uint24 poolFee;
uint256 exactAmountOutForPrize;
uint256 exactAmountOutForBonus;
uint256 amountInMaximumForPrize;
uint256 amountInMaximumForBonus;
}
Deployment
Input
Usage
Example
uint256 dailyLotteryFeeBP
The percentage for daily lottery fee in Basis Points
1000
User functions
Method
Usage
claimLotteryPrize(LotteryClaim claim)
Claim lottery prize, will also claim the bonus prize if there is any