Architecture
XCellMain
XCellMain upgradable contract (aka XCellMatic for MATIC or XCellGraph for GRT) is the core contract that acts as a liquid staking pool aggregator. It is responsible for token deposits, minting and burning liquid staking tokens (xcTokens), staking/unstaking funds to the validating nodes and applying fees.
On a regular basis an off-chain service calls the public method autobalance triggering the staking of funds into the validating nodes. Any contract or user can call this method.
Exchange Rate
The exchange rate of the underlying token to xcToken (e.g. MATIC to xcMATIC) is calculated as the total amount of tokens (deposits + rewards) divided by the supply of xcTokens. The value of the xcToken will increase over time with respect to the base token.
On some chains, where slashing is enabled, a particular validator may be penalized due to missing validation checkpoints or misbehaviour, and thus a portion of the staked funds on that given validator is slashed. This will in turn cause the exchange rate to decrease.
Rewards
As the staking rewards are distributed to the validators, XCell will account for such rewards, while a percentage will be transferred to the XCell treasury in accordance to the current fees.
Flash Exit & Liquidity Pool
As part of the staking process, the contract will reserve a portion of the funds to act as a liquidity pool, thus enabling the feature "Flash Exit". During a Flash Exit transaction, no unstaking from the validating nodes takes place, instead funds come directly from the contract's token balance.
Nodes
Nodes are pre-approved by XCell as trusted validators. Their selection is based on their performance record validating transactions, their fees and their SLA.
xcToken
xcToken is a standard non-upgradable ERC20 token. At deployment time, ownership is set to XCellMain, and thus XCellMain is the only contract or entity allowed to mint and burn xcTokens.
RoleManager
The protocol implements Openzeppelin's AccessControl contract to determine roles and limit access on methods to XCellMain. The roles implemented are:
TIMELOCK_UPGRADES_ROLE: Role to upgrade XCellMain through a TimeLock contract
TIMELOCK_ROLE: Role to execute XCellMain operations functions through a TimeLock contract
XC_SERVICE_ROLE: Role to execute daily operations on XCellMain without the need of TimeLock
TimeLock
Implements Openzeppelin's TimelockController to introduce time delay on some given functions in XCellMain.
Last updated