🛡️Compliance with Our Presale Platform's 314 Protocol Standard
Below is the code and explanation for meeting the 314 protocol standard of our presale platform:
IERC314
Interface
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
interface IERC314 {
function addLiquidity(
uint256 unlockTime,
uint256 tokenAmount
) external payable;
function liquidityAdded() external view returns (bool);
function getReserves()
external
view
returns (uint256 ethReserve, uint256 tokenReserve);
function getAmountOut(
uint256 inputAmount,
bool isBuy
) external view returns (uint256 outputAmount);
}
Explanation:
addLiquidity(uint256 unlockTime, uint256 tokenAmount) external payable
: Method to add liquidity, specifying the unlock time and token amount while receiving ETH.liquidityAdded() external view returns (bool)
: Method to check if liquidity has been added, returns a boolean value.getReserves() external view returns (uint256 ethReserve, uint256 tokenReserve)
: Method to get the current ETH and token reserves.getAmountOut(uint256 inputAmount, bool isBuy) external view returns (uint256 outputAmount)
: Method to calculate the output amount when buying or selling tokens.
IERC314Events
Interface
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
interface IERC314Events {
event AddLiquidity(
uint256 timeToUnlockLiquidity,
uint256 ethValue,
uint256 tokenValue
);
event RemoveLiquidity(uint256 ethValue, uint256 tokenValue);
event ExtendLiquidityLock(uint256 timeToUnlockLiquidity);
event Swap(
address indexed sender,
uint256 amountETHIn,
uint256 amountTokenIn,
uint256 amountETHOut,
uint256 amountTokenOut
);
}
Explanation:
event AddLiquidity(uint256 timeToUnlockLiquidity, uint256 ethValue, uint256 tokenValue)
: Event for adding liquidity, recording the unlock time, ETH value, and token value.event RemoveLiquidity(uint256 ethValue, uint256 tokenValue)
: Event for removing liquidity, recording the ETH and token values.event ExtendLiquidityLock(uint256 timeToUnlockLiquidity)
: Event for extending the liquidity lock time, recording the new unlock time.event Swap(address indexed sender, uint256 amountETHIn, uint256 amountTokenIn, uint256 amountETHOut, uint256 amountTokenOut)
: Swap event, recording the sender, input, and output amounts of ETH and tokens.
Last updated