# Smart Contract

## Methods :

### Events :&#x20;

**Registred**

`event Registred(address indexed user, uint256 price)`

Emitted when an user registers a new BoostOffer

**UpdateOffer**

`event UpdateOffer(address indexed user, uint256 newPrice)`

Emitted when an user updates its BoostOffer

**UpdateOfferPrice**

`event UpdateOfferPrice(address indexed user, uint256 newPrice)`

Emitted when an user updates its BoostOffer price

**Quit**

`event Quit(address indexed user)`

Emitted when an user removes its BoostOffer

**BoostPurchase**

`event BoostPurchase (address indexed delegator, address indexed receiver, uint256 tokenId, uint256 amount, uint256 price, uint256 paidFeeAmount, uint256 expiryTime)`

Emitted when a Boost is purchased

**Claim**

`event Claim(address indexed user, uint256 amount)`

Emitted when an user claims the fees earned

**NewAdvisedPrice**

`event NewAdvisedPrice(uint256 newPrice)`

Emitted when the advised price is updated

### Read-only methods :

**struct BoostOffer**

<table><thead><tr><th width="150.28068096137451">type</th><th width="150">name</th><th width="426.03974357814207">desc</th></tr></thead><tbody><tr><td>address</td><td>user</td><td>Address of the user making the offer</td></tr><tr><td>uint256</td><td>pricePerVote</td><td>Price per vote per second, set by the user</td></tr><tr><td>uint64</td><td>maxDuration</td><td>Max duration a Boost from this offer can last</td></tr><tr><td>uint64</td><td>expiryTime</td><td>Timestamp of expiry of the Offer</td></tr><tr><td>uint16</td><td>minPerc</td><td>Minimum percent of users voting token balance to buy for a Boost (in BPS)</td></tr><tr><td>uint16</td><td>maxPerc</td><td>Maximum percent of users total voting token balance available to delegate (in BPS)</td></tr><tr><td>bool</td><td>useAdvicePrice</td><td>Use the advised price instead of the Offer one</td></tr></tbody></table>

**feeToken**

`function feeToken() public view returns(address)`

ERC20 used to pay for DelegationBoost

**votingEscrow**

`function votingEscrow() public view returns(address)`

Address of the votingEscrowToken to delegate

**delegationBoost**

`function delegationBoost() public view returns(address)`

Address of the Delegation Boost contract (veBoost)

**feeReserveRatio**

`function feeReserveRatio() public view returns(address)`

Ratio of fees to be set as Reserve (in BPS)

**minPercRequired**

`function minPercRequired() public view returns(address)`

Min Percent of delegator votes to buy required to purchase a Delegation Boost (in BPS)

**minDelegationTime**

`function minDelegationTime() public view returns(address)`

Minimum delegation time, taken from veBoost contract (currently 1 week)

**advisedPrice**

`function` advisedPrice`() public view returns(uint256)`

Price per vote advised by the managers for users that don't handle their pricing themselves

**offers**

`function offers(uint256 index) public view returns(BoostOffer)`

Returns the BoostOffer for a given index

**userIndex**

`function userIndex(address user) public view returns(uint256)`

Index of the user in the offers array

**earnedFees**

`function earnedFees(address user) public view returns(uint256)`

Amount of fees earned by users through Boost selling

**canDelegate**

`function canDelegate(address delegator, uint256 amount) external view returns(bool)`

Checks if the delegator has enough available balance & the Offer allows to delegate the given amount

**canDelegatePercent**

`function canDelegatePercent(address delegator, uint256 percent) external view returns(bool)`

Checks if the delegator has enough available balance & the Offer allows to delegate the given amount (for a given percent of the Offer)

**offersIndex**

`function offersIndex() external view returns(uint256)`

Total amount of BoostOffers currently in the list

**estimateFees**

`function estimateFees( address delegator, uint256 amount, uint256 duration) external view returns (uint256)`

Gives an estimate of fees to pay for a given Boost Delegation

***Parameters :***&#x20;

<table data-header-hidden><thead><tr><th width="150">name</th><th width="150">type</th><th width="363.2">desc</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong>type</strong></td><td><strong>desc</strong></td></tr><tr><td>delegator</td><td>address</td><td>Address of the delegator for the Boost</td></tr><tr><td>amount</td><td>uint256</td><td>Amount to delegate</td></tr><tr><td>duration</td><td>uint256</td><td>Duration (in weeks) of the Boost to purchase</td></tr></tbody></table>

**estimateFeesPercent**

`function estimateFeesPercent( address delegator, uint256 percent, uint256 duration) external view returns (uint256)`

Gives an estimate of fees to pay for a given Boost Delegation

***Parameters :***&#x20;

<table data-header-hidden><thead><tr><th width="150">name</th><th width="150">type</th><th width="363.2">desc</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong>type</strong></td><td><strong>desc</strong></td></tr><tr><td>delegator</td><td>address</td><td>Address of the delegator for the Boost</td></tr><tr><td>percent</td><td>uint256</td><td>Percent of the delegator balance to delegate (in BPS)</td></tr><tr><td>duration</td><td>uint256</td><td>Duration (in weeks) of the Boost to purchase</td></tr></tbody></table>

**claimable**

`function claimable(address user) external view returns (uint256)`

Returns the amount of fees earned by the user that can be claimed

### **State-changing methods :**&#x20;

#### **register**

`function register( uint256 pricePerVote, uint16 minPerc, uint16 maxPerc ) external returns(bool)`

Registers a new user wanting to sell its delegation

***Parameters :***&#x20;

<table data-header-hidden><thead><tr><th width="189.17973462002413">name</th><th width="150">type</th><th width="363.2">desc</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong>type</strong></td><td><strong>desc</strong></td></tr><tr><td>pricePerVote</td><td>uint256</td><td>Price of 1 vote per second (in wei)</td></tr><tr><td>maxDuration</td><td>uint64</td><td>Maximum duration (in weeks) that a Boost can last when taken from this Offer</td></tr><tr><td>expiryTime</td><td>uint64</td><td>Timestamp when this Offer is not longer valid</td></tr><tr><td>minPerc</td><td>uint16</td><td>Minimum percent of users voting token balance to buy for a Boost (in BPS)</td></tr><tr><td>maxPerc</td><td>uint16</td><td>Maximum percent of users total voting token balance available to delegate (in BPS)</td></tr><tr><td>useAdvicePrice</td><td>bool</td><td>True to use the advice Price instead of the given pricePerVote</td></tr></tbody></table>

***Returns :*** bool : success

**updateOffer**

`function updateOffer( uint256 pricePerVote, uint64 maxDuration, uint64 expiryTime, uint16 minPerc, uint16 maxPerc, bool useAdvicePrice) external returns(bool)`

Updates an user BoostOffer parameters

***Parameters :***&#x20;

<table data-header-hidden><thead><tr><th>name</th><th width="150">type</th><th width="363.2">desc</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong>type</strong></td><td><strong>desc</strong></td></tr><tr><td>pricePerVote</td><td>uint256</td><td>Price of 1 vote per second (in wei)</td></tr><tr><td>maxDuration</td><td>uint64</td><td>Maximum duration (in weeks) that a Boost can last when taken from this Offer</td></tr><tr><td>expiryTime</td><td>uint64</td><td>Timestamp when this Offer is not longer valid</td></tr><tr><td>minPerc</td><td>uint16</td><td>Minimum percent of users voting token balance to buy for a Boost (in BPS)</td></tr><tr><td>maxPerc</td><td>uint16</td><td>Maximum percent of users total voting token balance available to delegate (in BPS)</td></tr><tr><td>useAdvicePrice</td><td>bool</td><td>True to use the advice Price instead of the given pricePerVote</td></tr></tbody></table>

***Returns :*** bool : success

**updateOfferPrice**

`function updateOfferPrice( uint256 pricePerVote, bool useAdvicePrice) external returns(bool)`

Updates an user BoostOffer Price parameters

***Parameters :***&#x20;

<table data-header-hidden><thead><tr><th>name</th><th width="150">type</th><th width="363.2">desc</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong>type</strong></td><td><strong>desc</strong></td></tr><tr><td>pricePerVote</td><td>uint256</td><td>Price of 1 vote per second (in wei)</td></tr><tr><td>useAdvicePrice</td><td>bool</td><td>True to use the advice Price instead of the given pricePerVote</td></tr></tbody></table>

**quit**

`function quit() external returns(bool)`

Remove the BoostOffer of the user, and claim any remaining fees earned

***Returns :*** bool : success

#### **buyDelegationBoost**

`function buyDelegationBoost( address delegator, address receiver, uint256 percent, uint256 duration, uint256 maxFeeAmount ) external returns(uint256)`

Buy a Delegation Boost from a Delegator BoostOffer

***Parameters :***&#x20;

<table data-header-hidden><thead><tr><th width="182.17973462002413">name</th><th width="150">type</th><th width="363.2">desc</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong>type</strong></td><td><strong>desc</strong></td></tr><tr><td>delegator</td><td>address</td><td>Address of the delegator for the Boost</td></tr><tr><td>receiver</td><td>address</td><td>Address of the receiver of the Boost</td></tr><tr><td>amount</td><td>uint256</td><td>Amount to delegate</td></tr><tr><td>duration</td><td>uint256</td><td>Duration (in weeks) of the Boost to purchase</td></tr><tr><td>maxFeeAmount</td><td>uint256</td><td>Maximum amount of feeToken available to pay to cover the Boost Duration (in wei)</td></tr></tbody></table>

***Returns :*** uint256 : tokenId of the newly minted veBoost

{% hint style="info" %}
The maxFeeAmount value must be approved in the feeToken ERC20 for Warden before this transaction
{% endhint %}

{% hint style="danger" %}
The Buyer will then need to call the user\_checkpoint() method on all Curve V4 & Factory Gauges currently farming, to apply the newly received Boost
{% endhint %}

#### **buyDelegationBoost**Percent

`function buyDelegationBoost( address delegator, address receiver, uint256 percent, uint256 duration, uint256 maxFeeAmount ) external returns(uint256)`

Buy a Delegation Boost from a Delegator BoostOffer

***Parameters :***&#x20;

<table data-header-hidden><thead><tr><th width="182.17973462002413">name</th><th width="150">type</th><th width="363.2">desc</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong>type</strong></td><td><strong>desc</strong></td></tr><tr><td>delegator</td><td>address</td><td>Address of the delegator for the Boost</td></tr><tr><td>receiver</td><td>address</td><td>Address of the receiver of the Boost</td></tr><tr><td>percent</td><td>uint256</td><td>Percent of the delegator balance to delegate (in BPS)</td></tr><tr><td>duration</td><td>uint256</td><td>Duration (in weeks) of the Boost to purchase</td></tr><tr><td>maxFeeAmount</td><td>uint256</td><td>Maximum amount of feeToken available to pay to cover the Boost Duration (in wei)</td></tr></tbody></table>

***Returns :*** uint256 : tokenId of the newly minted veBoost

{% hint style="info" %}
The maxFeeAmount value must be approved in the feeToken ERC20 for Warden before this transaction
{% endhint %}

{% hint style="danger" %}
The Buyer will then need to call the user\_checkpoint() method on all Curve V4 & Factory Gauges currently farming, to apply the newly received Boost
{% endhint %}

**claim**

`function claim() external returns(bool)`

Claims all earned fees

***Returns :*** bool : success


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.paladin.vote/warden-boost/smart-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
