Duel V1 (obsolete)

The duel V1 feature is disabled. All tokens on Flap will directly be listed On Pancakeswap once their supply reaches the dex threshold.

Parameters

In the smart contract, we implement most of the milestones as the current supply of a token:

  • When the current supply of a token reaches 71087 \cdot 10^8, it will be added to the game queue.

  • When the current supply of a token reaches 91089 \cdot 10^8 after winning a duel, it will be listed on DEX

At most, five tokens will be taken out of the game queue for a duel each day. If the last winner has yet to be listed on DEX, there will be at most six tokens in total to have duels each day. The tokens for the next day's duels are automatically determined at the end of today's duel. For each day, the first duel starts at 1 PM UTC and each duel lasts for 30 min.

Game ON/OFF

When launching on mainnet, the game must be first manually started. After that the duels will be automatically organized each day. And the game may also be paused and resumed if something goes wrong.

/// @notice emitted when the game started
event GameStarted();

/// @notice emitted when the game resumes
event GameResumed();

/// @notice emitted when the game pauses
event GamePaused();

Core Events

When a token reaches the milestone to be added to the game queue, the GameJoined event would be emitted:

/// @notice emitted when a new token has been added to the game
/// @param id The id of the token
/// @param seq The sequence of the token in the game
event GameJoined(uint256 id, uint256 seq);

When a new duel starts, the RoundStarted event would be emitted:

/// @notice emitted when a round in the game started
///         For each round, two tokens will be in a duel
/// @param ts The timestamp of the event
/// @param roundID The id of the round
/// @param tokenA The address of the first token in the round
/// @param tokenB The address of the second token in the round
/// @param endBlock The block number when the round ends
/// @param nextSeq The next sequence of the token in the game (after this round)
event RoundStarted(uint256 ts, uint256 roundID, address tokenA, address tokenB, uint256 endBlock, uint256 nextSeq);

The duel ends when the block number reaches the endBlock . However, the on-chain state can only be changed when a transaction is sent to the contract. That is why the duel's state only change one chain after the first transaction after the duel ends. When the duel's state is resolved, a RoundResultResolved event would emitted:

/// @notice emitted when a round resolved
/// @param ts The timestamp of the event
/// @param roundID The id of the round
/// @param winner The address of the winner
/// @param loser The address of the loser
/// @param rate The rate for redeeming loser coin for winner
/// @param eth The amount of ETH used to pump the winner (i.e, the loser's reserve)
/// @param amount The amount of winner token bought by the losers
/// @param postPrice The price of the winner after the duel is resolved
event RoundResultResolved(
    uint256 ts,
    uint256 roundID,
    address winner,
    address loser,
    uint256 rate,
    uint256 eth,
    uint256 amount,
    uint256 postPrice
);

If the winner token reaches the milestone to be listed on DEX. After being listed on DEX, a LaunchedOnDEX event would be emitted:

/// @notice emitted when adding liquidity to DEX
/// @param token The address of the token
/// @param pool The address of the pool
/// @param amount The amount of token added
/// @param eth The amount of ETH added
event LaunchedToDEX(address token, address pool, uint256 amount, uint256 eth);

When today's last duel is resolved, the duels for the next day is automatically scheduled, a GameDayStarted event would be emitted:

/// @notice emitted when a new game day started
/// @param startTs The timestamp of the start of the day
/// @param startSeq The start sequence of the tokens that can be put into duels today
/// @param endSeq The end sequence (not included) of the tokens that can be put into duels today
event GameDayStarted(uint256 startTs, uint256 startSeq, uint256 endSeq);

Redeem Loser Token For Winner Token

/// @notice If tokenA is killed in a battle by tokenB, redeem tokenA for tokenB
/// @dev But this interface is more general, it may be used to redeem any killed token for another token.
///      However, it would revert if the pair is not valid.
///
/// @param srcToken The address of the token to redeem
/// @param dstToken The address of the token to receive
/// @param srcAmount The amount of srcToken to redeem
/// @return dstAmount The amount of dstToken to receive
function redeem(address srcToken, address dstToken, uint256 srcAmount) external returns (uint256 dstAmount);


/// @notice preview redeem
/// @param srcToken The address of the token to redeem
/// @param dstToken The address of the token to receive
/// @param srcAmount The amount of srcToken to redeem
/// @return dstAmount The amount of dstToken to receive
function previewRedeem(address srcToken, address dstToken, uint256 srcAmount)
    external
    view
    returns (uint256 dstAmount);

Last updated