Verified contractExactBUSL-1.1
RootMultiCall
Address0x76a3eb63a20d656bcd1ce03e740d3d4691d29078
- Balance
0 ETH
- Transactions
5
- Compiler
solc 0.8.16
- Same code
Only this contract
Details
- Compiler
- solc 0.8.16+commit.07a7930e
- Language
- solidity
- Optimization
- Yes, 9,999 runs
- License
- BUSL-1.1
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 20,672,993
- Creation transaction
- 0x7520a937f3…8bf4579ac4
contracts/multichain/modules/RootMultiCall.sol
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗
//██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║
//██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║
//██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║
//██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║
//╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.16;
/** @title Warden Quest Root Multi Call Proxy */
/// @author Paladin
/*
Simple contract to checkpoint the gauges on mainnet and call calculateBiasPeriod on RootProxy
for multiple Quests at once
*/
import "../../utils/Owner.sol";
import "../../interfaces/IGaugeController.sol";
import "../../libraries/QuestDataTypes.sol";
interface IRootQuestProxy {
struct QuestParams {
address rootGauge;
QuestDataTypes.QuestVoteType voteType;
}
function questParams(uint256 _questID) external view returns(QuestParams memory);
function calculateBiasPeriod(uint256 period, uint256 questID) external;
function GAUGE_CONTROLLER() external view returns(address);
}
contract RootMultiCall is Owner {
/** @notice Mapping of addresses allowed to call manager methods */
mapping(address => bool) public approvedManagers;
/** @notice Event emitted when a new manager is approved */
event ApprovedManager(address indexed manager);
/** @notice Event emitted when a manager is removed */
event RemovedManager(address indexed manager);
/** @notice Check the caller is either the admin or an approved manager */
modifier onlyAllowed(){
if(!approvedManagers[msg.sender] && msg.sender != owner()) revert Errors.CallerNotAllowed();
_;
}
function multiCalculateBiasPeriod(address rootProxy, uint256 period, uint256[] calldata questIDs) external onlyAllowed {
address controller = IRootQuestProxy(rootProxy).GAUGE_CONTROLLER();
uint256 length = questIDs.length;
for(uint256 i = 0; i < length; i++){
address rootGauge = IRootQuestProxy(rootProxy).questParams(questIDs[i]).rootGauge;
IGaugeController(controller).checkpoint_gauge(rootGauge);
IRootQuestProxy(rootProxy).calculateBiasPeriod(period, questIDs[i]);
}
}
/**
* @notice Approves a new address as manager
* @dev Approves a new address as manager
* @param newManager Address to add
*/
function approveManager(address newManager) external onlyOwner {
if(newManager == address(0)) revert Errors.AddressZero();
approvedManagers[newManager] = true;
emit ApprovedManager(newManager);
}
/**
* @notice Removes an address from the managers
* @dev Removes an address from the managers
* @param manager Address to remove
*/
function removeManager(address manager) external onlyOwner {
if(manager == address(0)) revert Errors.AddressZero();
approvedManagers[manager] = false;
emit RemovedManager(manager);
}
}contracts/interfaces/IGaugeController.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
/**
* @dev Interface made for the Curve's GaugeController contract
*/
interface IGaugeController {
struct VotedSlope {
uint slope;
uint power;
uint end;
}
struct Point {
uint bias;
uint slope;
}
function vote_user_slopes(address, address) external view returns(VotedSlope memory);
function last_user_vote(address, address) external view returns(uint);
function points_weight(address, uint256) external view returns(Point memory);
function checkpoint_gauge(address) external;
function gauge_types(address _addr) external view returns(int128);
}contracts/libraries/Errors.sol
pragma solidity 0.8.16;
//SPDX-License-Identifier: MIT
library Errors {
// Common Errors
error AddressZero();
error NullAmount();
error CallerNotAllowed();
error IncorrectRewardToken();
error SameAddress();
error InequalArraySizes();
error EmptyArray();
error EmptyParameters();
error AlreadyInitialized();
error InvalidParameter();
error CannotRecoverToken();
error ForbiddenCall();
error CannotBeOwner();
error CallerNotPendingOwner();
error Killed();
error AlreadyKilled();
error NotKilled();
error KillDelayExpired();
error KillDelayNotExpired();
// Merkle Errors
error MerkleRootNotUpdated();
error AlreadyClaimed();
error InvalidProof();
error EmptyMerkleRoot();
error IncorrectRewardAmount();
error MerkleRootFrozen();
error NotFrozen();
error AlreadyFrozen();
// Quest Errors
error CallerNotQuestBoard();
error IncorrectQuestID();
error IncorrectPeriod();
error TokenNotWhitelisted();
error QuestAlreadyListed();
error QuestNotListed();
error PeriodAlreadyUpdated();
error PeriodNotClosed();
error PeriodStillActive();
error PeriodNotListed();
error EmptyQuest();
error EmptyPeriod();
error ExpiredQuest();
error QuestNotStarted();
error NotInitialized();
error NoDistributorSet();
error DisitributorFail();
error InvalidGauge();
error InvalidQuestID();
error InvalidPeriod();
error ObjectiveTooLow();
error NewObjectiveTooLow();
error RewardPerVoteTooLow();
error MinValueOverMaxValue();
error IncorrectDuration();
error IncorrectAddDuration();
error IncorrectTotalRewardAmount();
error IncorrectAddedRewardAmount();
error IncorrectFeeAmount();
error InvalidQuestType();
error QuestTypesIncompatible();
error CalletNotQuestCreator();
error LowerRewardPerVote();
error LowerObjective();
error CreatorNotAllowed();
error AlreadyListed();
error NotListed();
error MaxListSize();
error BoardIsNotAllowedDistributor();
// Proxy
error InvalidChainID();
error InvalidCaller();
error PeriodBiasNotUpdated();
error GaugeAlreadyAdded();
error AmountExceedsBalance();
error RecoverFailed();
//Math
error NumberExceed48Bits();
}contracts/libraries/QuestDataTypes.sol
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.16;
/** @title Data Types fo Quest Board V2 */
/// @author Paladin
library QuestDataTypes {
// Enums
/** @notice State of each Period for each Quest */
enum PeriodState { ZERO, ACTIVE, CLOSED, DISTRIBUTED }
// All Periods are ACTIVE at creation since the voters from past periods are also accounted for the future period
/** @notice Types of Vote logic for Quests */
enum QuestVoteType { NORMAL, BLACKLIST, WHITELIST }
// NORMAL: basic vote logic
// BLACKLIST: remove the blacklisted voters bias from the gauge biases
// WHITELIST: only sum up the whitelisted voters biases
/** @notice Types of Rewards logic for Quests */
enum QuestRewardsType { FIXED, RANGE }
// FIXED: reward per vote is fixed
// RANGE: reward per vote is a range between min and max, based on the Quest completion between min objective and max objective
/** @notice Types of logic for undistributed rewards when closing Quest periods */
enum QuestCloseType { NORMAL, ROLLOVER, DISTRIBUTE }
// NORMAL: undistributed rewards are avaialble to be withdrawn by the creator
// ROLLOVER: undistributed rewards are added to the next period, increasing the reward/vote parameter
// DISTRIBUTE: undistributed rewards are sent to the gauge for direct distribution
}
contracts/oz/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}contracts/oz/utils/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "./Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}contracts/utils/Owner.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import "../oz/utils/Ownable.sol";
import "../libraries/Errors.sol";
/** @title 2-step Ownership */
/// @author Paladin
/*
Extends OZ Ownable contract to add 2-step ownership transfer
*/
contract Owner is Ownable {
address public pendingOwner;
event NewPendingOwner(address indexed previousPendingOwner, address indexed newPendingOwner);
function transferOwnership(address newOwner) public override virtual onlyOwner {
if(newOwner == address(0)) revert Errors.AddressZero();
if(newOwner == owner()) revert Errors.CannotBeOwner();
address oldPendingOwner = pendingOwner;
pendingOwner = newOwner;
emit NewPendingOwner(oldPendingOwner, newOwner);
}
function acceptOwnership() public virtual {
if(msg.sender != pendingOwner) revert Errors.CallerNotPendingOwner();
address newOwner = pendingOwner;
_transferOwnership(pendingOwner);
pendingOwner = address(0);
emit NewPendingOwner(newOwner, address(0));
}
}Compiler settingsShow
{
"viaIR": false,
"libraries": {},
"optimizer": {
"runs": 9999,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.