Smart contracts

WAR Token

The WAR token contract is an ERC20 allowing the MINTER Role to mint tokens (Role given to the Minter contract) and the BURNER Role to burn tokens (Role given to the Redeemer contract)

User methods :

Basic ERC20 methods :

function approve(address spender, uint256 amount) public virtual returns (bool)
function transfer(address to, uint256 amount) public virtual returns (bool)
function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool)
function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual

Minter

The Minter contracts allows to send CVX and/or AURA tokens (and later, any new other token listed in Warlord) to mint WAR tokens. The tokens received by the Minter are directly sent to the Lockers to be locked into vlTokens.

User methods :

mint

mintMultiple

Ratios

The Ratios contract handle the calculations between WAR and the underlying token (currently CVX & AURA). Ratios are defined when listing an asset, allowing to calculate how many WAR to mint for a given amount of tokens, or how many tokens to return when burning WAR.

The current ratios are:

  • CVX 1:1 WAR

  • AURA 2:1 WAR

User methods :

getTokenRatio

getMintAmount

getBurnAmount

Zap

The Zap contract allows users to mint WAR using CVX and/or AURA, and directly stake them into stkWAR in one transaction.

User methods :

zap

zapMultiple

Lockers

The lockers contract receive tokens allowed in to Warlord (ex: CVX, AURA) and lock them into their vlToken (vlCVX, vlAURA) when received from the Minter.

All yield generated by those vlTokens are harvest and sent to the Controller to be process and distributed.

The Lockers delegate their voting power to be used to received maximized Gauge vote incentives (currently delegating to the Paladin Delegation address), and all the incentives received are also send to the Controller to be processed and distributed.

External methods :

getCurrentLockedTokens

processUnlocks

(Sends the unlocked token to the Redeemer if needed, otherwise re-locks them)

harvest

(Sends all harvested rewards to the Controller)

Farmers

The Farmers contracts are set for some specific tokens received as rewards from the Lockers : cvxCRV and auraBAL, to be staked inot their specific staking contract, so it can farm more rewards while not claimed by stkWAR stakers.

When the cvxCRV or auraBAL are claimed by stkWAR stakers, their are directly unstaked and sent to the claimer.

All rewards farmed by the Farmers are harvested and sent to the Controller to be process and distributed.

External methods :

getCurrentIndex

harvest

(Sends all harvested rewards to the Controller)

Controller

The Controller contracts receives rewards from different sources from the Warlord system:

  • Lockers (vlToken rewards & vote incentives)

  • Farmers

  • Redeemer fees

All rewards received are then processed, following the logic:

  • CVX & AURA are sent to the Minter to mint more WAR, and the WAR is distributed to the Stakers

  • auraBAL & cvxCRV are sent to the Farmers. An index is updated allowing to track the rewards stkWAR stakers have accrued in those tokens

  • WAR & PAL are directly sent to the Staker to be distributed as is

  • All the other rewards are set available for the Swapper to pull, swap into WETH and distribute the WETH via the Staker contract

External methods :

harvest

harvestMultiple

harvestAll

process

processMultiple

harvestAndProcess

harvestAllAndProcessAll

Redeemer

The Redeemer contract allows WAR holders to burn their WAR tokens to redeem CVX & AURA. The weights of CVX and AURA redeemed depend on the current holding in the Lockers at the time of the redeem, and the state of the redeem queues for each token.

When redeeming, Redeem Tickets are created for the user, indicating when the user will be able to execute the tickets and receive the CVX and AURA tokens. Tickets are organized as a queue, summing up the amount of CVX and AURA needed to be unlocked from the Lockers. Each period, when the Lockers are able to unlocks tokens, they are sent to the Redeemer (based on the needed amount in the Redeem queues), allowing the 1st tickets in the queue to be executed and the tokens to be received by the user.

User methods :

queuedForWithdrawal

getUserRedeemTickets

getUserActiveRedeemTickets

getTokenWeights

joinQueue

redeem

Staker

The Staker is a contract allowing users to stake WAR token to receive stkWAR shares. the stkWAR shares are receiving the rewards generated from the Warlord protocol (rewards from Lockers, Farmers, Gauge vote incentives & Reddem fees).

All the rewards (expect from the Farmers) are distributed over a 1 week period.

Users can unstake their WAR token with no cooldown.

User methods :

getRewardTokens

getUserRewardState

getUserAccruedRewards

getUserTotalClaimableRewards

stake

unstake

claimRewards

claimAllRewards

updateRewardState

updateAllRewardStates

Audit :

At the current stage, Warlord has not undergone a formal security audit. However, the contracts have undergone extensive internal testing & external reviews, giving confidence in the existing security measures implemented. We acknowledge the importance of security audits and will consider conducting them as the project evolves. We strongly advise users to conduct their own research and make informed decisions based on their individual risk tolerance.

Last updated

Was this helpful?