Using CarbonVortex
The CarbonVortex
is a contract designed to auction off fees collected within a Carbon DeFi ecosystem. It incentivizes arbitrageurs and public callers to interact with it and facilitates token trading through an auction mechanism.
This guide explains how to deploy and interact with the contract effectively.
1. Deploying the CarbonVortex
Contract
CarbonVortex
ContractSteps to Deploy:
Obtain the Source Code Download the verified
CarbonVortex.sol
from the official Bancor GitHub repository.Configure Deployment Parameters
Token Address: Define the token for which fees will be auctioned.
CarbonVortex
supports 2 dimentional auction for increased flexibility:targetToken
: This token will be the destination to which all fees collected in multiple different and unique tokens (stables such as USDC and USDT, popular such as wETH, wBTC, or meme such as PEPE, SHIB) will be auctions for. The result is that all tokens collected would be auctioned and traded for thistargetToken
eventually.finalTargetToken
: This 2nd destination token allows the deployer to define another token in which thetargetToken
will be auctions for. This structure enables a secondary auction that can work for less liquid tokens yet allow consolidation. Deployer can decide to leave this address blank and avoid this step altogether.
Auction Parameters: Allow flexibility in auction flow and speed as well as the process in which the auction price reacts to trades and restart the auction price as a result.
Caller Incentive: Define the public incentive to encourage community engagement and interaction with the contract and auctions.
Deploy the Contract
Ensure deployment is on the intended blockchain network (e.g., Ethereum, Polygon).
Verify Deployment
Check the deployed contract address.
Verify the deployment on a block explorer to ensure all constructor arguments are set correctly.
2. Caller Incentive: When and Why to Trigger execute()
execute()
The execute()
function plays a central role in the lifecycle of the CarbonVortex
:
Transfers Collected Fees: Aggregates fees from the protocol into the CarbonVortex contract.
Initiates an Auction: Starts an auction to consolidate various tokens into the
targetToken
.Provides Caller Incentives: Rewards the caller of the function to encourage execution.
Caller Incentive:
Caller Rewards: Callers are rewarded with a portion of the auction proceeds as defined in the contract.
Profit Opportunity: Callers may profit by executing when they can acquire tokens below market value.
Steps to Identify Profitability and Use execute()
execute()
Evaluate Tokens Collected by the Contract
Before calling
execute()
, assess the amount of tokens currently held by theCarbonVortex
contract. These tokens represent fees accumulated by the system.
Identify the Collected Tokens:
The contract incentivizes execution by offering rewards to the caller. This incentive is derived from the collected tokens that will be transferred and auctions when calling the
execute()
function.Use
availableTokens()
to identify the available balance of the token at hand.Calculate caller incentives by multiplying this value by the returned value from
rewardsPPM()
.
Trigger
execute()
Once the incentive is profitable, call theexecute()
function.
What Happens After execute()
is Called?
execute()
is Called?Auction Initialization:
The contract sets up a new auction or restart an existing one, with parameters such as:
Starting price.
Auction duration.
Token amount for auction.
Auction details are typically emitted as an event for external tracking.
Caller Reward:
The caller receives their incentive, as calculated earlier, immediately upon execution.
3. Identifying Auction Prices and Trading Tokens
Fetching Auction Data
This process requires retrieving some information from the contract
Call the
amountAvailableForTrading()
to identify the amount of tokens that are currently being auctions. This call requires passing the token address.Call the
tokenPrice()
to know the current price for the tokenCall
tradingEnabled()
andpairDisabled()
to verify the token auction is enabledCall
expectedTradeReturn()
orexpectedTradeInput()
to confirm the required amount for the trade (this can also help in defining the minReturn correctly to avoid loses)Execute
trade()
to trade against the active auction in the contract
Alternatively, once can calculate the prices off-chain by analyzing the price dynamics:
Auctions have a decaying price model half life (Dutch auction).
As time progresses, prices decrease, incentivizing early bids.
Executing a Trade
Use the trade()
function to buy tokens:
Specify the amount you wish to trade.
Ensure sufficient token allowance or ETH (if applicable).
Specify the maxInput (commonly known as minReturn) to avoid loses as a result of MEV activity.
Conclusion
The CarbonVortex
contract is a powerful tool for decentralized fee auctions. By understanding its mechanisms and incentives, teams can effectively deploy, maintain, and interact with it to maximize utility and ensure a seamless auction process.
Last updated