MultiBuy

Smart contract allowing to purchase multiple veBoosts on Warden through one transaction

The Warden MultiBuy system allows any Buyer to purchase multiple veBoosts at once, by giving a total amount of veCRV directly.

This system can either be used through the Warden UI, or directly through smart contracts.

The MultiBuy system also allows the Buyer to set parameters to better fit the Order to its needs and to the maximum price willing to be paid for veBoosts.

The available parameters are:

  • boostAmount: The total of veCRV Boost to purchase.

  • maxPrice: The maximum price to pay for a veBoost. All Offers listing a higher price will be ignored.

  • minRequiredAmount: The minimum size in veCRV a veBoost should have, allowing the purchase of less but bigger veBoosts.

  • acceptableSlippage: The percentage of slippage acceptable on the total purchase of veBoosts. Because all veBoosts size are calculated in BPS, the total veCRV Boost purchased might not be exactly equal to the given boostAmount. This parameter allows to revert the execution is the total Boost received is too far from the asked amount.

The system currently offers 3 methods to purchase multiple veBoosts:

  • The Simple Multi Buy: This method will go over all the Offers listed on Warden, without any sorting, to purchase veBoosts on any Offer fitting the given parameters (price & minRequiredAmount).

  • The PreSorted MultiBuy: This method takes an array of Offer indexes in parameters, allowing to loop over a selection of Offers (sorted through any method) to purchase veBoost on valid Offers that fit the given parameters.

  • The Sorted MultiBuy: This method will sort all the Offers listed on Warden, to loop over them from the lowest price to the highest, to purchase veBoosts on Offers that fit the given parameters.

The smart contract current internal sorting method is the Quicksort. Optimizations on this method, and on all of the MultiBuy system, are always considered, to bring the most efficient method to purchase multiple veBoosts.

For any integration of this system in external smart contracts, it is advised to set the multiBuy address as an updatable parameter, as it could be replaced by an optimized version in the future.

Smart contract methods:

After any type of MultiBuy, 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

simpleMultiBuy

function simpleMultiBuy(address receiver, uint256 duration, uint256 boostAmount, uint256 maxPrice, uint256 minRequiredAmount, uint256 totalFeesAmount, uint256 acceptableSlippage) external returns (bool)

Loops over Warden Offers to purchase veBoosts depending on given parameters

Parameters :

name

type

desc

receiver

address

Address of the veBoosts receiver

duration

uint256

Duration (in weeks) for the veBoosts to purchase

boostAmount

uint256

Total Amount of veCRV boost to purchase

maxPrice

uint256

Maximum price for veBoost purchase, any Offer with a higher price will be skipped

minRequiredAmount

uint256

Minimum size of the Boost to buy, smaller will be skipped

totalFeesAmount

uint256

Maximum total amount of feeToken available to pay to for veBoost purchases (in wei)

acceptableSlippage

uint256

Maximum acceptable slippage for the total Boost amount purchased (in BPS)

preSortedMultiBuy

function preSortedMultiBuy(address receiver, uint256 duration, uint256 boostAmount, uint256 maxPrice, uint256 minRequiredAmount, uint256 totalFeesAmount, uint256 acceptableSlippage, uint256[] memory sortedOfferIndexes) external returns (bool)

Loops over a given Array of Warden Offers (pre-sorted if possible) to purchase veBoosts depending on given parameters

Parameters :

name

type

desc

receiver

address

Address of the veBoosts receiver

duration

uint256

Duration (in weeks) for the veBoosts to purchase

boostAmount

uint256

Total Amount of veCRV boost to purchase

maxPrice

uint256

Maximum price for veBoost purchase, any Offer with a higher price will be skipped

minRequiredAmount

uint256

Minimum size of the Boost to buy, smaller will be skipped

totalFeesAmount

uint256

Maximum total amount of feeToken available to pay to for veBoost purchases (in wei)

acceptableSlippage

uint256

Maximum acceptable slippage for the total Boost amount purchased (in BPS)

sortedOfferIndexes

uint256[]

Array of Warden Offer indexes (that can be sorted/only containing a given set or Orders)

sortingMultiBuy

function sortingMultiBuy(address receiver, uint256 duration, uint256 boostAmount, uint256 maxPrice, uint256 minRequiredAmount, uint256 totalFeesAmount, uint256 acceptableSlippage) external returns (bool)

Loops over Warden Offers sorted through the Quicksort method, sorted by price, to purchase veBoosts depending on given parameters

Parameters :

name

type

desc

receiver

address

Address of the veBoosts receiver

duration

uint256

Duration (in weeks) for the veBoosts to purchase

boostAmount

uint256

Total Amount of veCRV boost to purchase

maxPrice

uint256

Maximum price for veBoost purchase, any Offer with a higher price will be skipped

minRequiredAmount

uint256

Minimum size of the Boost to buy, smaller will be skipped

totalFeesAmount

uint256

Maximum total amount of feeToken available to pay to for veBoost purchases (in wei)

acceptableSlippage

uint256

Maximum acceptable slippage for the total Boost amount purchased (in BPS)

Last updated