| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x3d602d80 | 21429529 | 437 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Minimal Proxy Contract for 0x747c4f7d3fc02b7975779effdf5d1c77105109cb
Contract Name:
MainChainGaugeInjectorV2
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@chainlink/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/balancer/IMainChainGauge.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
/**
* @title The MainChainGaugeInjectorV2 Contract
* @author 0xtritium.eth
* @notice This contract is a chainlink automation compatible interface to automate regular payment of non-BAL tokens to a main chain gauge.
* @notice This contract is meant to run/manage a single token. This is almost always the case for a DAO trying to use such a thing.
* @notice This contract will only function if it is configured as the distributor for a token/gauge it is operating on.
* @notice This contract is Ownable and has lots of sweep functionality to allow the owner to work with the contract or get tokens out should there be a problem.
* @dev This contract is intended to be a helper to aid an incentives manager in working with Balancer gauges.
* @dev It's intent is to provide maximum flexibility to the owner, not make any guarantees about the future on-chain.
* @dev A number of safeguards are available to help the owner from making mistakes.
* @dev Any contract that will be an owner of this contract should either have passthrough functions to change owner, or sweep all funds.
* see https://docs.chain.link/chainlink-automation/utility-contracts/
*/
contract MainChainGaugeInjectorV2 is Ownable2Step, Pausable, Initializable, KeeperCompatibleInterface {
using EnumerableSet for EnumerableSet.AddressSet;
event KeeperRegistryAddressUpdated(address[] oldAddresses, address[] newAddresses);
event MinWaitPeriodUpdated(uint256 oldMinWaitPeriod, uint256 newMinWaitPeriod);
event MaxInjectionAmountUpdated(uint256 oldAmount, uint256 newAmount);
event MaxGlobalAmountPerPeriodUpdated(uint256 oldAmount, uint256 newAmount);
event MaxTotalDueUpdated(uint256 oldAmount, uint256 newAmount);
event ERC20Swept(address indexed token, address recipient, uint256 amount);
event EmissionsInjection(address gauge, address token, uint256 amount);
event SetHandlingToken(address token);
event PerformedUpkeep(address[] needsFunding);
event RecipientAdded(
address gaugeAddress,
uint256 amountPerPeriod,
uint256 maxPeriods,
uint256 periodsExecutedLastProgram,
uint56 doNotStartBeforeTimestamp,
bool seenBefore
);
event RecipientRemoved(address gaugeAddress);
event InjectorInitialized(
address[] keeperAddresses, uint256 minWaitPeriodSeconds, address injectTokenAddress, uint256 maxInjectionAmount
);
error OnlyKeepers(address sender);
error ZeroAddress();
error RewardTokenError();
error RemoveNonexistentRecipient(address gaugeAddress);
error ExceedsMaxInjectionAmount(address gaugeAddress, uint256 amountsPerPeriod, uint256 maxInjectionAmount);
error ExceedsWeeklySpend(uint256 weeklySpend);
error ExceedsTotalInjectorProgramBudget(uint256 totalDue);
error InjectorNotDistributor(address gauge, address InjectTokenAddress);
struct Target {
uint256 amountPerPeriod;
bool isActive;
uint8 maxPeriods;
uint8 periodNumber;
uint56 lastInjectionTimestamp; // enough space for 2 trillion years
uint56 programStartTimestamp;
}
EnumerableSet.AddressSet internal ActiveGauges;
mapping(address => Target) internal GaugeConfigs;
/**
* /* @notice The addresses that can call performUpkeep,the 0 address anywhere in this list is a wildcard, in this case anyone can keep.
*/
address[] public KeeperAddresses;
/**
* /* @notice The max amount any 1 schedule can inject in any one round
*/
uint256 public MaxInjectionAmount;
/**
* /* @notice The max amount that can be programmed fire over 1 run on all active periods, add will not work if this is exceed. 0 for unlimited.
*/
uint256 public MaxGlobalAmountPerPeriod;
/**
* /* @notice The max total amount due over all active programs. New program adds will not be allowed if they exceed this number. 0 for unlimited.
*/
uint256 public MaxTotalDue;
/**
* /* @notice Regardless of other logic, wait at least this long on each gauge between injections.
*/
uint256 public MinWaitPeriodSeconds;
/**
* /* @notice The token this injector operates on.
*/
address public InjectTokenAddress;
constructor() Ownable(msg.sender) {}
/*
* @notice Initializes the MainChainGaugeInjector logic contract.
* @param owner of the injector. Has special privileges.
* @param keeperAddresses The addresses of the keeper contracts
* @param minWaitPeriodSeconds The minimum wait period for address between funding (for security)
* @param injectTokenAddress The ERC20 token this contract should mange
* @param maxInjectionAmount The max amount of tokens that should be injected to a single gauge in a single week by this injector.
*/
function initialize(
address owner,
address[] memory keeperAddresses,
uint256 minWaitPeriodSeconds,
address injectTokenAddress,
uint256 maxInjectionAmount
) external initializer {
_transferOwnership(owner);
KeeperAddresses = keeperAddresses;
MinWaitPeriodSeconds = minWaitPeriodSeconds;
InjectTokenAddress = injectTokenAddress;
MaxInjectionAmount = maxInjectionAmount;
emit InjectorInitialized(keeperAddresses, minWaitPeriodSeconds, injectTokenAddress, maxInjectionAmount);
}
/**
* @notice Injects funds into the gauges provided
* @param gauges the list of gauges to fund (addresses must be pre-approved)
*/
function _injectFunds(address[] memory gauges) internal whenNotPaused {
uint256 minWaitPeriodSeconds = MinWaitPeriodSeconds;
IERC20 token = IERC20(InjectTokenAddress);
uint256 balance = token.balanceOf(address(this));
for (uint256 idx = 0; idx < gauges.length; idx++) {
address gaugeAddress = gauges[idx];
Target storage targetConfig = GaugeConfigs[gaugeAddress];
IMainChainGauge gauge = IMainChainGauge(gaugeAddress);
uint256 current_gauge_emissions_end = gauge.reward_data(address(token)).period_finish;
if (
targetConfig.lastInjectionTimestamp + minWaitPeriodSeconds <= block.timestamp // Not too recent based on minWaitPeriodSeconds
&& targetConfig.programStartTimestamp <= block.timestamp // Not before program start time
&& current_gauge_emissions_end <= block.timestamp // This token is currently not streaming on this gauge
&& targetConfig.periodNumber < targetConfig.maxPeriods // We have not already executed the last period
&& balance >= targetConfig.amountPerPeriod // We have enough coins to pay
&& targetConfig.amountPerPeriod <= MaxInjectionAmount // We are not trying to inject more than the global max for 1 injection
&& targetConfig.isActive // The gauge is marked active in the injector
) {
SafeERC20.forceApprove(token, gaugeAddress, targetConfig.amountPerPeriod);
gauge.deposit_reward_token(address(token), targetConfig.amountPerPeriod);
balance -= targetConfig.amountPerPeriod;
targetConfig.lastInjectionTimestamp = uint56(block.timestamp);
targetConfig.periodNumber++;
emit EmissionsInjection(gaugeAddress, address(token), targetConfig.amountPerPeriod);
}
}
}
/**
* @notice This is to allow the owner to manually trigger an injection of funds in place of the keeper
* @notice without abi encoding the gauge list
* @param gauges array of gauges to inject tokens to
*/
function injectFunds(address[] memory gauges) external onlyOwner {
_injectFunds(gauges);
}
/**
* @notice Get list of addresses that are ready for new token injections and return keeper-compatible payload
* @notice calldata required by the chainlink interface but not used in this case, use 0x
* @return upkeepNeeded signals if upkeep is needed
* @return performData is an abi encoded list of addresses that need funds
*/
function checkUpkeep(bytes calldata)
external
view
override
whenNotPaused
returns (bool upkeepNeeded, bytes memory performData)
{
address[] memory ready = getReadyGauges();
upkeepNeeded = ready.length > 0;
performData = abi.encode(ready);
return (upkeepNeeded, performData);
}
/**
* @notice Called by keeper to send funds to underfunded addresses
* @param performData The abi encoded list of addresses to fund
*/
function performUpkeep(bytes calldata performData) external override onlyKeeper whenNotPaused {
address[] memory needsFunding = abi.decode(performData, (address[]));
_injectFunds(needsFunding);
emit PerformedUpkeep(needsFunding);
}
/**
* @notice Adds/updates a list of recipients with the same configuration
* @param recipients A list of gauges to be setup with the defined params amounts
* @param amountPerPeriod the wei amount of tokens per period that each listed gauge should receive
* @param maxPeriods The number of weekly periods the specified amount should be paid to the specified gauge over
* @param doNotStartBeforeTimestamp A timestamp that injections should not start before. Use 0 to start as soon as gauges are ready.
*/
function addRecipients(
address[] calldata recipients,
uint256 amountPerPeriod,
uint8 maxPeriods,
uint56 doNotStartBeforeTimestamp
) public onlyOwner {
bool update;
uint8 executedPeriods;
// Check that we are not violating MaxInjectionAmount - we use recipients[0] here as address because in this
// case all added gauges violate MaxInjectionAmount and the event takes a single address, so the first one breaks it.
if (MaxInjectionAmount > 0 && MaxInjectionAmount < amountPerPeriod) {
revert ExceedsMaxInjectionAmount(recipients[0], amountPerPeriod, MaxInjectionAmount);
}
for (uint256 i = 0; i < recipients.length; i++) {
// Check that this is a gauge and it is ready for us to inject to it
IMainChainGauge gauge = IMainChainGauge(recipients[i]);
if (gauge.reward_data(InjectTokenAddress).distributor != address(this)) {
revert InjectorNotDistributor(address(gauge), InjectTokenAddress);
}
// enumerableSet returns false if Already Exists
update = ActiveGauges.add(recipients[i]);
executedPeriods = 0;
if (!update && GaugeConfigs[recipients[i]].isActive) {
executedPeriods = GaugeConfigs[recipients[i]].periodNumber;
}
Target memory target = GaugeConfigs[recipients[i]]; // Preserve lastInjectionTimestamp
target.isActive = true;
target.amountPerPeriod = amountPerPeriod;
target.maxPeriods = maxPeriods;
target.periodNumber = 0;
target.programStartTimestamp = doNotStartBeforeTimestamp;
GaugeConfigs[recipients[i]] = target;
if (MaxGlobalAmountPerPeriod > 0 && MaxGlobalAmountPerPeriod < getWeeklySpend()) {
revert ExceedsWeeklySpend(getWeeklySpend());
}
if (MaxTotalDue > 0 && MaxTotalDue < getTotalDue()) {
revert ExceedsTotalInjectorProgramBudget(getTotalDue());
}
emit RecipientAdded(
recipients[i], amountPerPeriod, maxPeriods, executedPeriods, doNotStartBeforeTimestamp, update
);
}
}
/**
* @notice Removes Recipients
* @param recipients A list of recipients to remove
*/
function removeRecipients(address[] calldata recipients) public onlyOwner {
for (uint256 i = 0; i < recipients.length; i++) {
if (ActiveGauges.remove(recipients[i])) {
GaugeConfigs[recipients[i]].isActive = false;
emit RecipientRemoved(recipients[i]);
} else {
revert RemoveNonexistentRecipient(recipients[i]);
}
}
}
/**
* @notice Sweep the full contract's balance for a given ERC-20 token
* @param token The ERC-20 token which needs to be swept
*/
function sweep(address token, address dest) external onlyOwner {
uint256 balance = IERC20(token).balanceOf(address(this));
SafeERC20.safeTransfer(IERC20(token), dest, balance);
emit ERC20Swept(token, owner(), balance);
}
/**
* @notice Manually deposit an amount of tokens to the gauge - Does not check MaxInjectionAmount
* @param gauge The Gauge to set distributor to injector owner
* @param reward_token Reward token you are seeding
* @param amount Amount to deposit
*/
function manualDeposit(address gauge, address reward_token, uint256 amount) external onlyOwner {
IMainChainGauge gaugeContract = IMainChainGauge(gauge);
IERC20 token = IERC20(reward_token);
SafeERC20.forceApprove(token, gauge, amount);
gaugeContract.deposit_reward_token(reward_token, amount);
emit EmissionsInjection(gauge, reward_token, amount);
}
/**
* @notice Get's the full injector schedule in 1 call. All lists are ordered such that the same member across all arrays represents one program.
* @return gauges Currently scheduled gauges
* @return amountsPerPeriod how much token in wei is paid to the gauge per period
* @return maxPeriods the max number of periods this program will run for
* @return lastTimestamps the last timestamp the injector ran for this gauge
* @return doNotStartBeforeTimestamps a timestamp this schedule should not start before
*/
/**
* @notice Gets all current schedule information as a set of arrays
*/
function getFullSchedule()
external
view
returns (address[] memory, uint256[] memory, uint8[] memory, uint8[] memory, uint56[] memory, uint56[] memory)
{
address[] memory gauges = getActiveGaugeList();
uint256 len = gauges.length;
uint256[] memory amountsPerPeriod = new uint256[](len);
uint8[] memory currentPeriods = new uint8[](len);
uint8[] memory maxPeriods = new uint8[](len);
uint56[] memory lastTimestamps = new uint56[](len);
uint56[] memory doNotStartBeforeTimestamps = new uint56[](len);
for (uint256 i = 0; i < gauges.length; i++) {
Target memory target = GaugeConfigs[gauges[i]];
amountsPerPeriod[i] = target.amountPerPeriod;
maxPeriods[i] = target.maxPeriods;
currentPeriods[i] = target.periodNumber;
lastTimestamps[i] = target.lastInjectionTimestamp;
doNotStartBeforeTimestamps[i] = target.programStartTimestamp;
}
return (gauges, amountsPerPeriod, maxPeriods, currentPeriods, lastTimestamps, doNotStartBeforeTimestamps);
}
/**
* @notice Gets the total amount of tokens due to complete the program.
* @return totalDue The total amount of tokens required in the contract balance to pay out all programmed injections across all gauges.
*/
function getTotalDue() public view returns (uint256 totalDue) {
address[] memory gaugeList = getActiveGaugeList();
for (uint256 idx = 0; idx < gaugeList.length; idx++) {
Target memory target = GaugeConfigs[gaugeList[idx]];
totalDue += (target.maxPeriods - target.periodNumber) * target.amountPerPeriod;
}
return totalDue;
}
/**
* @notice Gets the total weekly spend
* @return weeklySpend The total amount of tokens required to fulfil all active programs for 1 period.
*/
function getWeeklySpend() public view returns (uint256 weeklySpend) {
address[] memory gauges = getActiveGaugeList();
for (uint256 i = 0; i < gauges.length; i++) {
Target memory target = GaugeConfigs[gauges[i]];
if (target.periodNumber < target.maxPeriods) {
weeklySpend += target.amountPerPeriod;
}
}
return weeklySpend;
}
/**
* @notice Gets the difference between the total amount scheduled and the balance in the contract.
* @return delta is 0 if balances match, negative if injector balance is in deficit to service all loaded programs, and positive if there is a surplus.
*/
function getBalanceDelta() public view returns (int256 delta) {
uint256 balance = IERC20(InjectTokenAddress).balanceOf(address(this));
uint256 totalDue = getTotalDue();
if (balance >= totalDue) {
delta = int256(balance) - int256(totalDue);
} else {
delta = -1 * int256(totalDue - balance);
}
}
/**
* @notice Gets a list of addresses that are ready to inject
* @notice This is done by checking if the current period has ended, and should inject new funds directly after the end of each period.
* @return list of addresses that are ready to inject
*/
function getReadyGauges() public view returns (address[] memory) {
address[] memory gaugeList = getActiveGaugeList();
address[] memory ready = new address[](gaugeList.length);
uint256 maxInjectionAmount = MaxInjectionAmount;
address tokenAddress = InjectTokenAddress;
uint256 count = 0;
uint256 minWaitPeriod = MinWaitPeriodSeconds;
uint256 balance = IERC20(tokenAddress).balanceOf(address(this));
Target memory target;
for (uint256 idx = 0; idx < gaugeList.length; idx++) {
target = GaugeConfigs[gaugeList[idx]];
IMainChainGauge gauge = IMainChainGauge(gaugeList[idx]);
uint256 current_gauge_emissions_end = gauge.reward_data(tokenAddress).period_finish;
if (target.amountPerPeriod > maxInjectionAmount) {
revert ExceedsMaxInjectionAmount(gaugeList[idx], target.amountPerPeriod, maxInjectionAmount);
}
if (
target.lastInjectionTimestamp + minWaitPeriod <= block.timestamp
&& target.programStartTimestamp <= block.timestamp && current_gauge_emissions_end <= block.timestamp
&& balance >= target.amountPerPeriod && target.periodNumber < target.maxPeriods
&& target.amountPerPeriod <= maxInjectionAmount
&& gauge.reward_data(tokenAddress).distributor == address(this)
) {
ready[count] = gaugeList[idx];
count++;
balance -= target.amountPerPeriod;
}
}
if (count != gaugeList.length) {
// ready is a list large enough to hold all possible gauges
// count is the number of ready gauges that were inserted into ready
// this assembly shrinks ready to length count such that it removes empty elements
assembly {
mstore(ready, count)
}
}
return ready;
}
/**
* @notice Return a list of active gauges
*/
function getActiveGaugeList() public view returns (address[] memory) {
return ActiveGauges.values();
}
/**
* @notice Gets configuration information for an address on the gauge list
* @param targetAddress return Target struct for a given gauge according to the current scheduled distributions
*/
function getGaugeInfo(address targetAddress)
external
view
returns (
uint256 amountPerPeriod,
bool isActive,
uint8 maxPeriods,
uint8 periodNumber,
uint56 lastInjectionTimestamp,
uint56 doNotStartBeforeTimestamp
)
{
Target memory target = GaugeConfigs[targetAddress];
return (
target.amountPerPeriod,
target.isActive,
target.maxPeriods,
target.periodNumber,
target.lastInjectionTimestamp,
target.programStartTimestamp
);
}
/**
* @notice Set distributor from the injector to a specified distributor.
* @notice This injector will only function for gauges it is distributor on
* @notice be aware that the only addresses able to call set_reward_distributor is the current distributor, so make the right person has control over the new address.
* @param gauge address The Gauge to set distributor for
* @param reward_token address Token you are setting the distributor for
* @param distributor address The new distributor
*/
function changeDistributor(address gauge, address reward_token, address distributor) external onlyOwner {
IMainChainGauge(gauge).set_reward_distributor(reward_token, distributor);
}
function getKeeperAddresses() external view returns (address[] memory) {
return KeeperAddresses;
}
/**
* @notice Sets the keeper addresses
* @dev Setting the keeper to address(0) will make `performUpkeep` permissionless
* @param keeperAddresses The array of addresses of the keeper contracts
*/
function setKeeperAddresses(address[] memory keeperAddresses) external onlyOwner {
emit KeeperRegistryAddressUpdated(KeeperAddresses, keeperAddresses);
KeeperAddresses = keeperAddresses;
}
/**
* @notice Sets the minimum wait period (in seconds) for addresses between injections
*/
function setMinWaitPeriodSeconds(uint256 period) external onlyOwner {
emit MinWaitPeriodUpdated(MinWaitPeriodSeconds, period);
MinWaitPeriodSeconds = period;
}
/**
* @notice Sets global MaxInjectionAmount for the injector which will be checked on each injection.
* @param amount The max amount that the injector will allow to be paid to a single gauge in single programmed injection
*/
function setMaxInjectionAmount(uint256 amount) external onlyOwner {
emit MaxInjectionAmountUpdated(MaxInjectionAmount, amount);
MaxInjectionAmount = amount;
}
/**
* @notice Sets global MaxGlobalAmountPerPeriod for the injector, which will prevent schedules from being added that increases the spend of a single round of all active periods from exceeding this amount.
* @param amount The max amount that should be allowed to be scheduled in 1 period across all active programs.
*/
function setMaxGlobalAmountPerPeriod(uint256 amount) external onlyOwner {
emit MaxGlobalAmountPerPeriodUpdated(MaxGlobalAmountPerPeriod, amount);
MaxGlobalAmountPerPeriod = amount;
}
/**
* @notice Sets global MaxTotalDue for the injector, which will prevent schedules from being added that increases the the total spend of all active programs over all remaining periods from exceeding this amount.
* @param amount The max amount that should be allowed to be scheduled across all remaining periods of all active programs.
*/
function setMaxTotalDue(uint256 amount) external onlyOwner {
emit MaxTotalDueUpdated(MaxTotalDue, amount);
MaxTotalDue = amount;
}
/**
* @notice Pauses the contract, which prevents executing performUpkeep
*/
function pause() external onlyOwner {
_pause();
}
/**
* @notice Unpauses the contract
*/
function unpause() external onlyOwner {
_unpause();
}
modifier onlyKeeper() {
if (KeeperAddresses.length > 0) {
bool isKeeper = false;
for (uint256 i = 0; i < KeeperAddresses.length; i++) {
if (msg.sender == KeeperAddresses[i] || KeeperAddresses[i] == address(0)) {
isKeeper = true;
break;
}
}
if (!isKeeper) {
revert OnlyKeepers(msg.sender);
}
}
_;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
/**
* @notice This is a deprecated interface. Please use AutomationCompatibleInterface directly.
*/
pragma solidity ^0.8.0;
// solhint-disable-next-line no-unused-import
import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "./AutomationCompatibleInterface.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IMainChainGauge {
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Deposit(address indexed provider, uint256 value);
event RelativeWeightCapChanged(uint256 new_relative_weight_cap);
event RewardDistributorUpdated(address indexed reward_token, address distributor);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event UpdateLiquidityLimit(
address indexed user,
uint256 original_balance,
uint256 original_supply,
uint256 working_balance,
uint256 working_supply
);
event Withdraw(address indexed provider, uint256 value);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function add_reward(address _reward_token, address _distributor) external;
function allowance(address owner, address spender) external view returns (uint256);
function approve(address _spender, uint256 _value) external returns (bool);
function balanceOf(address arg0) external view returns (uint256);
function claim_rewards() external;
function claim_rewards(address _addr) external;
function claim_rewards(address _addr, address _receiver) external;
function claimable_reward(address _user, address _reward_token) external view returns (uint256);
function claimable_tokens(address addr) external returns (uint256);
function claimed_reward(address _addr, address _token) external view returns (uint256);
function decimals() external view returns (uint256);
function decreaseAllowance(address _spender, uint256 _subtracted_value) external returns (bool);
function deposit(uint256 _value) external;
function deposit(uint256 _value, address _addr) external;
function deposit(uint256 _value, address _addr, bool _claim_rewards) external;
function deposit_reward_token(address _reward_token, uint256 _amount) external;
function future_epoch_time() external view returns (uint256);
function getCappedRelativeWeight(uint256 time) external view returns (uint256);
function getMaxRelativeWeightCap() external pure returns (uint256);
function getRelativeWeightCap() external view returns (uint256);
function increaseAllowance(address _spender, uint256 _added_value) external returns (bool);
function inflation_rate() external view returns (uint256);
function initialize(address _lp_token, uint256 relative_weight_cap) external;
function integrate_checkpoint() external view returns (uint256);
function integrate_checkpoint_of(address arg0) external view returns (uint256);
function integrate_fraction(address arg0) external view returns (uint256);
function integrate_inv_supply(uint256 arg0) external view returns (uint256);
function integrate_inv_supply_of(address arg0) external view returns (uint256);
function is_killed() external view returns (bool);
function kick(address addr) external;
function killGauge() external;
function lp_token() external view returns (address);
function name() external view returns (string memory);
function nonces(address arg0) external view returns (uint256);
function period() external view returns (int128);
function period_timestamp(uint256 arg0) external view returns (uint256);
function permit(
address _owner,
address _spender,
uint256 _value,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external returns (bool);
function reward_count() external view returns (uint256);
function reward_data(address arg0) external view returns (Reward memory);
function reward_integral_for(address arg0, address arg1) external view returns (uint256);
function reward_tokens(uint256 arg0) external view returns (address);
function rewards_receiver(address arg0) external view returns (address);
function setRelativeWeightCap(uint256 relative_weight_cap) external;
function set_reward_distributor(address _reward_token, address _distributor) external;
function set_rewards_receiver(address _receiver) external;
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool);
function unkillGauge() external;
function user_checkpoint(address addr) external returns (bool);
function version() external view returns (string memory);
function withdraw(uint256 _value) external;
function withdraw(uint256 _value, bool _claim_rewards) external;
function working_balances(address arg0) external view returns (uint256);
function working_supply() external view returns (uint256);
}
struct Reward {
address token;
address distributor;
uint256 period_finish;
uint256 rate;
uint256 last_update;
uint256 integral;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// solhint-disable-next-line interface-starts-with-i
interface AutomationCompatibleInterface {
/**
* @notice method that is simulated by the keepers to see if any work actually
* needs to be performed. This method does does not actually need to be
* executable, and since it is only ever simulated it can consume lots of gas.
* @dev To ensure that it is never called, you may want to add the
* cannotExecute modifier from KeeperBase to your implementation of this
* method.
* @param checkData specified in the upkeep registration so it is always the
* same for a registered upkeep. This can easily be broken down into specific
* arguments using `abi.decode`, so multiple upkeeps can be registered on the
* same contract and easily differentiated by the contract.
* @return upkeepNeeded boolean to indicate whether the keeper should call
* performUpkeep or not.
* @return performData bytes that the keeper should call performUpkeep with, if
* upkeep is needed. If you would like to encode data to decode later, try
* `abi.encode`.
*/
function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData);
/**
* @notice method that is actually executed by the keepers, via the registry.
* The data returned by the checkUpkeep simulation will be passed into
* this method to actually be executed.
* @dev The input to this method should not be trusted, and the caller of the
* method should not even be restricted to any single registry. Anyone should
* be able call it, and the input should be validated, there is no guarantee
* that the data passed in is the performData returned from checkUpkeep. This
* could happen due to malicious keepers, racing keepers, or simply a state
* change while the performUpkeep transaction is waiting for confirmation.
* Always validate the data passed in.
* @param performData is the data which was passed back from the checkData
* simulation. If it is encoded, it can easily be decoded into other types by
* calling `abi.decode`. This data should not be trusted, and should be
* validated against the contract's current state.
*/
function performUpkeep(bytes calldata performData) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}{
"remappings": [
"@chainlink/=node_modules/@chainlink/",
"@eth-optimism/=node_modules/@chainlink/contracts/node_modules/@eth-optimism/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@scroll-tech/=node_modules/@scroll-tech/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"forge-std/=lib/forge-std/src/",
"hardhat/=node_modules/hardhat/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {}
}Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[{"internalType":"address","name":"gaugeAddress","type":"address"},{"internalType":"uint256","name":"amountsPerPeriod","type":"uint256"},{"internalType":"uint256","name":"maxInjectionAmount","type":"uint256"}],"name":"ExceedsMaxInjectionAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalDue","type":"uint256"}],"name":"ExceedsTotalInjectorProgramBudget","type":"error"},{"inputs":[{"internalType":"uint256","name":"weeklySpend","type":"uint256"}],"name":"ExceedsWeeklySpend","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"InjectTokenAddress","type":"address"}],"name":"InjectorNotDistributor","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"OnlyKeepers","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"gaugeAddress","type":"address"}],"name":"RemoveNonexistentRecipient","type":"error"},{"inputs":[],"name":"RewardTokenError","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20Swept","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmissionsInjection","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"keeperAddresses","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"minWaitPeriodSeconds","type":"uint256"},{"indexed":false,"internalType":"address","name":"injectTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"maxInjectionAmount","type":"uint256"}],"name":"InjectorInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"oldAddresses","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"newAddresses","type":"address[]"}],"name":"KeeperRegistryAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"MaxGlobalAmountPerPeriodUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"MaxInjectionAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"MaxTotalDueUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMinWaitPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMinWaitPeriod","type":"uint256"}],"name":"MinWaitPeriodUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"needsFunding","type":"address[]"}],"name":"PerformedUpkeep","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"gaugeAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountPerPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxPeriods","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodsExecutedLastProgram","type":"uint256"},{"indexed":false,"internalType":"uint56","name":"doNotStartBeforeTimestamp","type":"uint56"},{"indexed":false,"internalType":"bool","name":"seenBefore","type":"bool"}],"name":"RecipientAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"gaugeAddress","type":"address"}],"name":"RecipientRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"SetHandlingToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"InjectTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"KeeperAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MaxGlobalAmountPerPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MaxInjectionAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MaxTotalDue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MinWaitPeriodSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256","name":"amountPerPeriod","type":"uint256"},{"internalType":"uint8","name":"maxPeriods","type":"uint8"},{"internalType":"uint56","name":"doNotStartBeforeTimestamp","type":"uint56"}],"name":"addRecipients","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"reward_token","type":"address"},{"internalType":"address","name":"distributor","type":"address"}],"name":"changeDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveGaugeList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBalanceDelta","outputs":[{"internalType":"int256","name":"delta","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFullSchedule","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint8[]","name":"","type":"uint8[]"},{"internalType":"uint8[]","name":"","type":"uint8[]"},{"internalType":"uint56[]","name":"","type":"uint56[]"},{"internalType":"uint56[]","name":"","type":"uint56[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"targetAddress","type":"address"}],"name":"getGaugeInfo","outputs":[{"internalType":"uint256","name":"amountPerPeriod","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint8","name":"maxPeriods","type":"uint8"},{"internalType":"uint8","name":"periodNumber","type":"uint8"},{"internalType":"uint56","name":"lastInjectionTimestamp","type":"uint56"},{"internalType":"uint56","name":"doNotStartBeforeTimestamp","type":"uint56"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getKeeperAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReadyGauges","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalDue","outputs":[{"internalType":"uint256","name":"totalDue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWeeklySpend","outputs":[{"internalType":"uint256","name":"weeklySpend","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address[]","name":"keeperAddresses","type":"address[]"},{"internalType":"uint256","name":"minWaitPeriodSeconds","type":"uint256"},{"internalType":"address","name":"injectTokenAddress","type":"address"},{"internalType":"uint256","name":"maxInjectionAmount","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"gauges","type":"address[]"}],"name":"injectFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"reward_token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"manualDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"performUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"removeRecipients","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"keeperAddresses","type":"address[]"}],"name":"setKeeperAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxGlobalAmountPerPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxInjectionAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxTotalDue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"setMinWaitPeriodSeconds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"dest","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.