Get Started

Last modified:

In the current version of the CenturionDEX Protocol Fee system, searchers can permissionlessly capture value from the system by receiving assets valued greater than the CTN tokens provided to the system.

The simplest way to interact with the system is calling Firepit.release() from a wallet

[!IMPORTANT] Replace all placeholder values (<FIREPIT_ADDRESS>, <CTN_TOKEN_ADDRESS>, <RPC_URL>, <CURRENT_NONCE>, <ASSET_ADDRESSES>, <RECEIVER_ADDRESS>) before running any command. Use deployment values from the Deployments page and set <RECEIVER_ADDRESS> to an address you control.

It is possible to interact with the Firepit contract via a custom smart contract to enable:

  • slippage / balance checks
  • CenturionDEX v3 Fee collection
  • CenturionDEX v2 LP Token redemptions
  • CTN token flash loans

Acquire a sufficient amount of CTN

The Firepit contract requires integrators to hold a minimum amount of CTN to call release(). Participants can view the threshold by calling Firepit.threshold()

solidity

address firepit = 0x0000000000000000000000000000000000000000; // replace with deployed Firepit
uint256 threshold = IFirepit(firepit).threshold();

bash

cast call <FIREPIT_ADDRESS> "threshold()(uint256)" --rpc-url <RPC_URL>

Approve the Firepit to spend CTN

Because the Firepit contract transfers CTN to address(0xdead), integrating addresses must first approve the contract to spend their CTN

Approve only the CTN amount you intend to burn for the current release() call.

solidity

address ctn = 0x0000000000000000000000000000000000000000; // replace with CTN token address
address firepit = 0x0000000000000000000000000000000000000000; // replace with deployed Firepit
 
uint256 burnAmount = 0; // replace with intended CTN burn amount
 
ICRC20(ctn).approve(
    firepit,
    burnAmount
);

bash

cast send <CTN_TOKEN_ADDRESS> \
    "approve(address,uint256)(bool)" \
    --rpc-url <RPC_URL> \
    <FIREPIT_ADDRESS> \
    <BURN_AMOUNT>

Read the Nonce

The Firepit contract uses a nonce as a safety mechanism to avoid malicious front-running. The value is provided to release(...) must be equal to the value in contract storage

solidity

address firepit = 0x0000000000000000000000000000000000000000; // replace with deployed Firepit
uint256 nonce = IFirepit(firepit).nonce();

bash

cast call <FIREPIT_ADDRESS> "nonce()(uint256)" --rpc-url <RPC_URL>

Call Firepit.release()

Once the value of the assets exceeds the value of the CTN tokens, integrators should call Firepit.release()

solidity

address firepit = 0x0000000000000000000000000000000000000000; // replace with deployed Firepit
 
uint256 _nonce = 0; // replace with nonce fetched off-chain right before submission
address recipient = msg.sender; // replace with address you control
 
Currency[] memory _assets = new Currency[](3);
_assets[0] = Currency.wrap(address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)); // USDC
_assets[1] = Currency.wrap(address(0xdAC17F958D2ee523a2206206994597C13D831ec7)); // USDT
_assets[2] = Currency.wrap(address(0x0000000000000000000000000000000000000000)); // CTN
 
IFirepit(firepit).release(_nonce, _assets, recipient);

bash

cast send <FIREPIT_ADDRESS> "release(uint256,address[],address)" --rpc-url <RPC_URL> \
    <CURRENT_NONCE> <ASSET_ADDRESSES> <RECEIVER_ADDRESS>
 
# example: release USDC, USDT, and CTN to receiver
cast send <FIREPIT_ADDRESS> "release(uint256,address[],address)" --rpc-url <RPC_URL> \
    <CURRENT_NONCE> \
    <ASSET_ADDRESSES> \
    <RECEIVER_ADDRESS>