Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | ||||
|---|---|---|---|---|---|---|---|
| 16103450 | 25 mins ago | 0 ETH | |||||
| 16101650 | 1 hr ago | 0 ETH | |||||
| 16099851 | 2 hrs ago | 0 ETH | |||||
| 16098051 | 3 hrs ago | 0 ETH | |||||
| 16096939 | 4 hrs ago | 0 ETH | |||||
| 16096251 | 4 hrs ago | 0 ETH | |||||
| 16094450 | 5 hrs ago | 0 ETH | |||||
| 16092651 | 6 hrs ago | 0 ETH | |||||
| 16090850 | 7 hrs ago | 0 ETH | |||||
| 16089051 | 8 hrs ago | 0 ETH | |||||
| 16087251 | 9 hrs ago | 0 ETH | |||||
| 16085451 | 10 hrs ago | 0 ETH | |||||
| 16083650 | 11 hrs ago | 0 ETH | |||||
| 16081851 | 12 hrs ago | 0 ETH | |||||
| 16080051 | 13 hrs ago | 0 ETH | |||||
| 16079232 | 13 hrs ago | 0 ETH | |||||
| 16078250 | 14 hrs ago | 0 ETH | |||||
| 16076451 | 15 hrs ago | 0 ETH | |||||
| 16074651 | 16 hrs ago | 0 ETH | |||||
| 16072851 | 17 hrs ago | 0 ETH | |||||
| 16071051 | 18 hrs ago | 0 ETH | |||||
| 16069251 | 19 hrs ago | 0 ETH | |||||
| 16067451 | 20 hrs ago | 0 ETH | |||||
| 16066860 | 20 hrs ago | 0 ETH | |||||
| 16065651 | 21 hrs ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
Metrom
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity 0.8.28;
import {IERC20} from "oz/token/ERC20/IERC20.sol";
import {SafeERC20} from "oz/token/ERC20/utils/SafeERC20.sol";
import {MerkleProof} from "oz/utils/cryptography/MerkleProof.sol";
import {UUPSUpgradeable} from "oz-up/proxy/utils/UUPSUpgradeable.sol";
import {BaseCampaignsUtils} from "./libraries/BaseCampaignsUtils.sol";
import {RewardsCampaignsV1, RewardsCampaignsV1Utils} from "./libraries/RewardsCampaignsV1Utils.sol";
import {
RewardsCampaignsV2,
RewardsCampaignsV2Utils,
MAX_REWARDS_PER_CAMPAIGN
} from "./libraries/RewardsCampaignsV2Utils.sol";
import {PointsCampaignsV1, PointsCampaignsV1Utils} from "./libraries/PointsCampaignsV1Utils.sol";
import {PointsCampaignsV2, PointsCampaignsV2Utils} from "./libraries/PointsCampaignsV2Utils.sol";
import {
IMetrom,
RewardsCampaignV1,
RewardsCampaignV2,
Reward,
PointsCampaignV1,
PointsCampaignV2,
ReadonlyRewardsCampaign,
ReadonlyPointsCampaign,
CreateRewardsCampaignBundle,
CreatePointsCampaignBundle,
RewardAmount,
CreatedCampaignReward,
DistributeRewardsBundle,
SetMinimumTokenRateBundle,
ClaimRewardBundle,
ClaimFeeBundle,
UNIT
} from "./IMetrom.sol";
/// SPDX-License-Identifier: GPL-3.0-or-later
/// @title Metrom
/// @notice The contract handling all Metrom entities and interactions. It supports
/// creation and update of campaigns as well as claims and recoveries of unassigned
/// rewards for each one of them.
/// @author Federico Luzzi - <[email protected]>
contract Metrom is IMetrom, UUPSUpgradeable {
using SafeERC20 for IERC20;
using RewardsCampaignsV1Utils for RewardsCampaignsV1;
using RewardsCampaignsV2Utils for RewardsCampaignsV2;
using PointsCampaignsV1Utils for PointsCampaignsV1;
using PointsCampaignsV2Utils for PointsCampaignsV2;
/// @inheritdoc IMetrom
bool public override ossified;
/// @inheritdoc IMetrom
address public override owner;
/// @inheritdoc IMetrom
address public override pendingOwner;
/// @inheritdoc IMetrom
address public override updater;
/// @inheritdoc IMetrom
uint32 public override fee;
/// @inheritdoc IMetrom
uint32 public override minimumCampaignDuration;
/// @inheritdoc IMetrom
uint32 public override maximumCampaignDuration;
RewardsCampaignsV1 internal rewardsCampaignsV1;
/// @inheritdoc IMetrom
mapping(address account => uint32 rebate) public override feeRebate;
/// @inheritdoc IMetrom
mapping(address token => uint256 amount) public override claimableFees;
/// @inheritdoc IMetrom
mapping(address token => uint256 minimumRate) public override minimumRewardTokenRate;
/// @inheritdoc IMetrom
mapping(address token => uint256 minimumRate) public override minimumFeeTokenRate;
PointsCampaignsV1 internal pointsCampaignsV1;
RewardsCampaignsV2 internal rewardsCampaignsV2;
PointsCampaignsV2 internal pointsCampaignsV2;
constructor() {
_disableInitializers();
}
/// @inheritdoc IMetrom
function initialize(
address _owner,
address _updater,
uint32 _fee,
uint32 _minimumCampaignDuration,
uint32 _maximumCampaignDuration
) external override initializer {
if (_owner == address(0)) revert ZeroAddressOwner();
if (_updater == address(0)) revert ZeroAddressUpdater();
if (_fee >= UNIT) revert InvalidFee();
if (_minimumCampaignDuration >= _maximumCampaignDuration) revert InvalidMinimumCampaignDuration();
owner = _owner;
updater = _updater;
minimumCampaignDuration = _minimumCampaignDuration;
maximumCampaignDuration = _maximumCampaignDuration;
fee = _fee;
emit Initialize(_owner, _updater, _fee, _minimumCampaignDuration, _maximumCampaignDuration);
}
/// @inheritdoc IMetrom
function ossify() external {
if (msg.sender != owner) revert Forbidden();
ossified = true;
emit Ossify();
}
function _authorizeUpgrade(address) internal view override {
if (msg.sender != owner) revert Forbidden();
if (ossified) revert Ossified();
}
/// @inheritdoc IMetrom
function rewardsCampaignById(bytes32 _id) external view override returns (ReadonlyRewardsCampaign memory) {
RewardsCampaignV1 storage campaignV1 = rewardsCampaignsV1.get(_id);
return campaignV1.from != 0
? ReadonlyRewardsCampaign({
owner: campaignV1.owner,
pendingOwner: campaignV1.pendingOwner,
from: campaignV1.from,
to: campaignV1.to,
kind: 1,
data: abi.encode(campaignV1.pool),
specificationHash: campaignV1.specificationHash,
dataHash: campaignV1.dataHash,
root: campaignV1.root
})
: rewardsCampaignsV2.getExistingReadonly(_id);
}
/// @inheritdoc IMetrom
function pointsCampaignById(bytes32 _id) external view override returns (ReadonlyPointsCampaign memory) {
PointsCampaignV1 storage campaignV1 = pointsCampaignsV1.get(_id);
return campaignV1.from != 0
? ReadonlyPointsCampaign({
owner: campaignV1.owner,
pendingOwner: campaignV1.pendingOwner,
from: campaignV1.from,
to: campaignV1.to,
kind: 1,
data: abi.encode(campaignV1.pool),
specificationHash: campaignV1.specificationHash,
points: campaignV1.points
})
: pointsCampaignsV2.getExistingReadonly(_id);
}
/// @inheritdoc IMetrom
function campaignReward(bytes32 _id, address _token) external view override returns (uint256) {
RewardsCampaignV1 storage campaignV1 = rewardsCampaignsV1.get(_id);
return campaignV1.from != 0
? campaignV1.reward[_token].amount
: rewardsCampaignsV2.getRewardOnExistingCampaign(_id, _token).amount;
}
/// @inheritdoc IMetrom
function claimedCampaignReward(bytes32 _id, address _token, address _account)
external
view
override
returns (uint256)
{
RewardsCampaignV1 storage campaignV1 = rewardsCampaignsV1.get(_id);
return campaignV1.from != 0
? campaignV1.reward[_token].claimed[_account]
: rewardsCampaignsV2.getRewardOnExistingCampaign(_id, _token).claimed[_account];
}
/// @inheritdoc IMetrom
function createCampaigns(
CreateRewardsCampaignBundle[] calldata _rewardsCampaignBundles,
CreatePointsCampaignBundle[] calldata _pointsCampaignBundles
) external {
uint32 _fee = fee;
uint32 _feeRebate = feeRebate[msg.sender];
uint32 _resolvedRewardsCampaignFee = uint32(uint64(_fee) * (UNIT - _feeRebate) / UNIT);
uint32 _minimumCampaignDuration = minimumCampaignDuration;
uint32 _maximumCampaignDuration = maximumCampaignDuration;
for (uint256 _i = 0; _i < _rewardsCampaignBundles.length; _i++) {
CreateRewardsCampaignBundle calldata _rewardsCampaignBundle = _rewardsCampaignBundles[_i];
(bytes32 _id, CreatedCampaignReward[] memory _createdCampaignRewards) = createRewardsCampaign(
_rewardsCampaignBundle, _minimumCampaignDuration, _maximumCampaignDuration, _resolvedRewardsCampaignFee
);
emit CreateRewardsCampaign(
_id,
msg.sender,
_rewardsCampaignBundle.from,
_rewardsCampaignBundle.to,
_rewardsCampaignBundle.kind,
_rewardsCampaignBundle.data,
_rewardsCampaignBundle.specificationHash,
_createdCampaignRewards
);
}
for (uint256 _i = 0; _i < _pointsCampaignBundles.length; _i++) {
CreatePointsCampaignBundle calldata _pointsCampaignBundle = _pointsCampaignBundles[_i];
(bytes32 _id, uint256 _feeAmount) = createPointsCampaign(
_pointsCampaignBundle, _minimumCampaignDuration, _maximumCampaignDuration, _feeRebate
);
emit CreatePointsCampaign(
_id,
msg.sender,
_pointsCampaignBundle.from,
_pointsCampaignBundle.to,
_pointsCampaignBundle.kind,
_pointsCampaignBundle.data,
_pointsCampaignBundle.specificationHash,
_pointsCampaignBundle.points,
_pointsCampaignBundle.feeToken,
_feeAmount
);
}
}
function createRewardsCampaign(
CreateRewardsCampaignBundle memory _bundle,
uint32 _minimumCampaignDuration,
uint32 _maximumCampaignDuration,
uint32 _resolvedFee
) internal returns (bytes32, CreatedCampaignReward[] memory) {
uint32 _duration =
BaseCampaignsUtils.validate(_bundle.from, _bundle.to, _minimumCampaignDuration, _maximumCampaignDuration);
if (_bundle.rewards.length == 0) revert NoRewards();
if (_bundle.rewards.length > MAX_REWARDS_PER_CAMPAIGN) revert TooManyRewards();
(bytes32 _id, RewardsCampaignV2 storage campaign) = rewardsCampaignsV2.getNew(_bundle);
campaign.owner = msg.sender;
campaign.from = _bundle.from;
campaign.to = _bundle.to;
campaign.kind = _bundle.kind;
campaign.data = _bundle.data;
campaign.specificationHash = _bundle.specificationHash;
CreatedCampaignReward[] memory _createdCampaignRewards = new CreatedCampaignReward[](_bundle.rewards.length);
for (uint256 _j = 0; _j < _bundle.rewards.length; _j++) {
RewardAmount memory _reward = _bundle.rewards[_j];
address _token = _reward.token;
if (_token == address(0)) revert ZeroAddressRewardToken();
uint256 _amount = _reward.amount;
if (_amount == 0) revert ZeroRewardAmount();
{
// avoids stack too deep
uint256 _minimumRewardTokenRate = minimumRewardTokenRate[_token];
if (_minimumRewardTokenRate == 0) revert DisallowedRewardToken();
if (_amount * 1 hours / _duration < _minimumRewardTokenRate) revert RewardAmountTooLow();
}
uint256 _balanceBefore = IERC20(_token).balanceOf(address(this));
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
_amount = IERC20(_token).balanceOf(address(this)) - _balanceBefore;
if (_amount == 0) revert ZeroRewardAmount();
uint256 _feeAmount = _amount * _resolvedFee / UNIT;
uint256 _rewardAmountMinusFees = _amount - _feeAmount;
claimableFees[_token] += _feeAmount;
_createdCampaignRewards[_j] =
CreatedCampaignReward({token: _token, amount: _rewardAmountMinusFees, fee: _feeAmount});
campaign.reward[_token].amount += _rewardAmountMinusFees;
}
return (_id, _createdCampaignRewards);
}
function createPointsCampaign(
CreatePointsCampaignBundle memory _bundle,
uint32 _minimumCampaignDuration,
uint32 _maximumCampaignDuration,
uint32 _feeRebate
) internal returns (bytes32, uint256) {
uint32 _duration =
BaseCampaignsUtils.validate(_bundle.from, _bundle.to, _minimumCampaignDuration, _maximumCampaignDuration);
if (_bundle.points == 0) revert NoPoints();
uint256 _minimumFeeTokenRate = minimumFeeTokenRate[_bundle.feeToken];
if (_minimumFeeTokenRate == 0) revert DisallowedFeeToken();
uint256 _fullRequiredFeeAmount = _minimumFeeTokenRate * _duration / 1 hours;
uint256 _requiredFeeAmount = _fullRequiredFeeAmount * (UNIT - _feeRebate) / UNIT;
(bytes32 _id, PointsCampaignV2 storage campaign) = pointsCampaignsV2.getNew(_bundle);
campaign.owner = msg.sender;
campaign.from = _bundle.from;
campaign.to = _bundle.to;
campaign.kind = _bundle.kind;
campaign.data = _bundle.data;
campaign.specificationHash = _bundle.specificationHash;
campaign.points = _bundle.points;
uint256 _feeAmount = collectPointsCampaignFee(_bundle.feeToken, _requiredFeeAmount);
return (_id, _feeAmount);
}
function collectPointsCampaignFee(address _feeToken, uint256 _requiredFeeAmount) internal returns (uint256) {
uint256 _balanceBefore = IERC20(_feeToken).balanceOf(address(this));
IERC20(_feeToken).safeTransferFrom(msg.sender, address(this), _requiredFeeAmount);
uint256 _collectedFeeAmount = IERC20(_feeToken).balanceOf(address(this)) - _balanceBefore;
if (_collectedFeeAmount < _requiredFeeAmount) revert FeeAmountTooLow();
claimableFees[_feeToken] += _collectedFeeAmount;
return _collectedFeeAmount;
}
/// @inheritdoc IMetrom
function distributeRewards(DistributeRewardsBundle[] calldata _bundles) external override {
if (msg.sender != updater) revert Forbidden();
for (uint256 _i; _i < _bundles.length; _i++) {
DistributeRewardsBundle calldata _bundle = _bundles[_i];
if (_bundle.root == bytes32(0)) revert ZeroRoot();
if (_bundle.dataHash == bytes32(0)) revert ZeroData();
RewardsCampaignV1 storage campaignV1 = rewardsCampaignsV1.get(_bundle.campaignId);
if (campaignV1.from != 0) {
campaignV1.root = _bundle.root;
campaignV1.dataHash = _bundle.dataHash;
} else {
RewardsCampaignV2 storage campaignV2 = rewardsCampaignsV2.getExisting(_bundle.campaignId);
campaignV2.root = _bundle.root;
campaignV2.dataHash = _bundle.dataHash;
}
emit DistributeReward(_bundle.campaignId, _bundle.root, _bundle.dataHash);
}
}
/// @inheritdoc IMetrom
function setMinimumTokenRates(
SetMinimumTokenRateBundle[] calldata _rewardTokenBundles,
SetMinimumTokenRateBundle[] calldata _feeTokenBundles
) external override {
if (msg.sender != updater) revert Forbidden();
for (uint256 _i; _i < _rewardTokenBundles.length; _i++) {
SetMinimumTokenRateBundle calldata _bundle = _rewardTokenBundles[_i];
if (_bundle.token == address(0)) revert ZeroAddressRewardToken();
minimumRewardTokenRate[_bundle.token] = _bundle.minimumRate;
emit SetMinimumRewardTokenRate(_bundle.token, _bundle.minimumRate);
}
for (uint256 _i; _i < _feeTokenBundles.length; _i++) {
SetMinimumTokenRateBundle calldata _bundle = _feeTokenBundles[_i];
if (_bundle.token == address(0)) revert ZeroAddressFeeToken();
minimumFeeTokenRate[_bundle.token] = _bundle.minimumRate;
emit SetMinimumFeeTokenRate(_bundle.token, _bundle.minimumRate);
}
}
function _processRewardClaim(
bytes32 _campaignRoot,
Reward storage reward,
ClaimRewardBundle calldata _bundle,
address _claimOwner
) internal returns (uint256) {
if (_bundle.receiver == address(0)) revert ZeroAddressReceiver();
if (_bundle.token == address(0)) revert ZeroAddressRewardToken();
if (_bundle.amount == 0) revert ZeroAmount();
bytes32 _leaf = keccak256(bytes.concat(keccak256(abi.encode(_claimOwner, _bundle.token, _bundle.amount))));
if (!MerkleProof.verifyCalldata(_bundle.proof, _campaignRoot, _leaf)) revert InvalidProof();
uint256 _claimAmount = _bundle.amount - reward.claimed[_claimOwner];
if (_claimAmount == 0) revert ZeroAmount();
if (_claimAmount > reward.amount) revert TooMuchClaimedAmount();
reward.claimed[_claimOwner] += _claimAmount;
reward.amount -= _claimAmount;
IERC20(_bundle.token).safeTransfer(_bundle.receiver, _claimAmount);
return _claimAmount;
}
function _claimableRewardAndRoot(ClaimRewardBundle calldata _bundle, bool _checkOwner)
internal
view
returns (bytes32, Reward storage)
{
RewardsCampaignV1 storage rewardsCampaignV1 = rewardsCampaignsV1.get(_bundle.campaignId);
if (rewardsCampaignV1.from != 0) {
if (_checkOwner && rewardsCampaignV1.owner != msg.sender) revert Forbidden();
return (rewardsCampaignV1.root, rewardsCampaignV1.reward[_bundle.token]);
}
RewardsCampaignV2 storage rewardsCampaignV2 = rewardsCampaignsV2.getExisting(_bundle.campaignId);
if (_checkOwner && rewardsCampaignV2.owner != msg.sender) revert Forbidden();
return (rewardsCampaignV2.root, rewardsCampaignV2.reward[_bundle.token]);
}
/// @inheritdoc IMetrom
function claimRewards(ClaimRewardBundle[] calldata _bundles) external override {
for (uint256 _i; _i < _bundles.length; _i++) {
ClaimRewardBundle calldata _bundle = _bundles[_i];
(bytes32 _root, Reward storage claimableReward) = _claimableRewardAndRoot(_bundle, false);
uint256 _claimedAmount = _processRewardClaim(_root, claimableReward, _bundle, msg.sender);
emit ClaimReward(_bundle.campaignId, _bundle.token, _claimedAmount, _bundle.receiver);
}
}
/// @inheritdoc IMetrom
function recoverRewards(ClaimRewardBundle[] calldata _bundles) external override {
for (uint256 _i; _i < _bundles.length; _i++) {
ClaimRewardBundle calldata _bundle = _bundles[_i];
(bytes32 _root, Reward storage claimableReward) = _claimableRewardAndRoot(_bundle, true);
uint256 _claimedAmount = _processRewardClaim(_root, claimableReward, _bundle, address(0));
emit RecoverReward(_bundle.campaignId, _bundle.token, _claimedAmount, _bundle.receiver);
}
}
/// @inheritdoc IMetrom
function claimFees(ClaimFeeBundle[] calldata _bundles) external {
if (msg.sender != owner) revert Forbidden();
for (uint256 _i = 0; _i < _bundles.length; _i++) {
ClaimFeeBundle calldata _bundle = _bundles[_i];
if (_bundle.token == address(0)) revert ZeroAddressRewardToken();
if (_bundle.receiver == address(0)) revert ZeroAddressReceiver();
uint256 _claimAmount = claimableFees[_bundle.token];
if (_claimAmount == 0) revert ZeroAmount();
delete claimableFees[_bundle.token];
IERC20(_bundle.token).safeTransfer(_bundle.receiver, _claimAmount);
emit ClaimFee(_bundle.token, _claimAmount, _bundle.receiver);
}
}
/// @inheritdoc IMetrom
function campaignOwner(bytes32 _id) external view override returns (address) {
address _owner = rewardsCampaignsV1.get(_id).owner;
if (_owner == address(0)) _owner = rewardsCampaignsV2.get(_id).owner;
if (_owner == address(0)) _owner = pointsCampaignsV1.get(_id).owner;
if (_owner == address(0)) _owner = pointsCampaignsV2.get(_id).owner;
return _owner;
}
/// @inheritdoc IMetrom
function campaignPendingOwner(bytes32 _id) external view override returns (address) {
address _pendingOwner = rewardsCampaignsV1.get(_id).pendingOwner;
if (_pendingOwner == address(0)) _pendingOwner = rewardsCampaignsV2.get(_id).pendingOwner;
if (_pendingOwner == address(0)) _pendingOwner = pointsCampaignsV1.get(_id).pendingOwner;
if (_pendingOwner == address(0)) _pendingOwner = pointsCampaignsV2.get(_id).pendingOwner;
return _pendingOwner;
}
/// @inheritdoc IMetrom
function transferCampaignOwnership(bytes32 _id, address _owner) external override {
if (_owner == address(0)) revert ZeroAddressOwner();
RewardsCampaignV1 storage rewardsCampaignV1 = rewardsCampaignsV1.get(_id);
if (rewardsCampaignV1.from != 0) {
if (msg.sender != rewardsCampaignV1.owner) revert Forbidden();
rewardsCampaignV1.pendingOwner = _owner;
emit TransferCampaignOwnership(_id, _owner);
return;
}
RewardsCampaignV2 storage rewardsCampaignV2 = rewardsCampaignsV2.get(_id);
if (rewardsCampaignV2.from != 0) {
if (msg.sender != rewardsCampaignV2.owner) revert Forbidden();
rewardsCampaignV2.pendingOwner = _owner;
emit TransferCampaignOwnership(_id, _owner);
return;
}
PointsCampaignV1 storage pointsCampaignV1 = pointsCampaignsV1.get(_id);
if (pointsCampaignV1.owner != address(0)) {
if (msg.sender != pointsCampaignV1.owner) revert Forbidden();
pointsCampaignV1.pendingOwner = _owner;
emit TransferCampaignOwnership(_id, _owner);
return;
}
PointsCampaignV2 storage pointsCampaignV2 = pointsCampaignsV2.get(_id);
if (pointsCampaignV2.owner != address(0)) {
if (msg.sender != pointsCampaignV2.owner) revert Forbidden();
pointsCampaignV2.pendingOwner = _owner;
emit TransferCampaignOwnership(_id, _owner);
return;
}
revert NonExistentCampaign();
}
/// @inheritdoc IMetrom
function acceptCampaignOwnership(bytes32 _id) external override {
RewardsCampaignV1 storage rewardsCampaignV1 = rewardsCampaignsV1.get(_id);
if (rewardsCampaignV1.owner != address(0)) {
if (msg.sender != rewardsCampaignV1.pendingOwner) revert Forbidden();
delete rewardsCampaignV1.pendingOwner;
rewardsCampaignV1.owner = msg.sender;
emit AcceptCampaignOwnership(_id, msg.sender);
return;
}
RewardsCampaignV2 storage rewardsCampaignV2 = rewardsCampaignsV2.get(_id);
if (rewardsCampaignV2.owner != address(0)) {
if (msg.sender != rewardsCampaignV2.pendingOwner) revert Forbidden();
delete rewardsCampaignV2.pendingOwner;
rewardsCampaignV2.owner = msg.sender;
emit AcceptCampaignOwnership(_id, msg.sender);
return;
}
PointsCampaignV1 storage pointsCampaignV1 = pointsCampaignsV1.get(_id);
if (pointsCampaignV1.owner != address(0)) {
if (msg.sender != pointsCampaignV1.pendingOwner) revert Forbidden();
delete pointsCampaignV1.pendingOwner;
pointsCampaignV1.owner = msg.sender;
emit AcceptCampaignOwnership(_id, msg.sender);
return;
}
PointsCampaignV2 storage pointsCampaignV2 = pointsCampaignsV2.get(_id);
if (pointsCampaignV2.owner != address(0)) {
if (msg.sender != pointsCampaignV2.pendingOwner) revert Forbidden();
delete pointsCampaignV2.pendingOwner;
pointsCampaignV2.owner = msg.sender;
emit AcceptCampaignOwnership(_id, msg.sender);
return;
}
revert NonExistentCampaign();
}
/// @inheritdoc IMetrom
function transferOwnership(address _owner) external override {
if (_owner == address(0)) revert ZeroAddressOwner();
if (msg.sender != owner) revert Forbidden();
pendingOwner = _owner;
emit TransferOwnership(_owner);
}
/// @inheritdoc IMetrom
function acceptOwnership() external override {
if (msg.sender != pendingOwner) revert Forbidden();
delete pendingOwner;
owner = msg.sender;
emit AcceptOwnership(msg.sender);
}
/// @inheritdoc IMetrom
function setUpdater(address _updater) external override {
if (msg.sender != owner) revert Forbidden();
if (_updater == address(0)) revert ZeroAddressUpdater();
updater = _updater;
emit SetUpdater(_updater);
}
/// @inheritdoc IMetrom
function setFee(uint32 _fee) external override {
if (_fee >= UNIT) revert InvalidFee();
if (msg.sender != owner) revert Forbidden();
fee = _fee;
emit SetFee(_fee);
}
/// @inheritdoc IMetrom
function setFeeRebate(address _account, uint32 _rebate) external override {
if (_account == address(0)) revert ZeroAddressAccount();
if (_rebate > UNIT) revert RebateTooHigh();
if (msg.sender != owner) revert Forbidden();
feeRebate[_account] = _rebate;
emit SetFeeRebate(_account, _rebate);
}
/// @inheritdoc IMetrom
function setMinimumCampaignDuration(uint32 _minimumCampaignDuration) external override {
if (_minimumCampaignDuration >= maximumCampaignDuration) revert InvalidMinimumCampaignDuration();
if (msg.sender != owner) revert Forbidden();
minimumCampaignDuration = _minimumCampaignDuration;
emit SetMinimumCampaignDuration(_minimumCampaignDuration);
}
/// @inheritdoc IMetrom
function setMaximumCampaignDuration(uint32 _maximumCampaignDuration) external override {
if (_maximumCampaignDuration <= minimumCampaignDuration) revert InvalidMaximumCampaignDuration();
if (msg.sender != owner) revert Forbidden();
maximumCampaignDuration = _maximumCampaignDuration;
emit SetMaximumCampaignDuration(_maximumCampaignDuration);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 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 {
/**
* @dev An operation with an ERC-20 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.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
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.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
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.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
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 silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MerkleProof.sol)
// This file was procedurally generated from scripts/generate/templates/MerkleProof.js.
pragma solidity ^0.8.20;
import {Hashes} from "./Hashes.sol";
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the Merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates Merkle trees that are safe
* against this attack out of the box.
*
* IMPORTANT: Consider memory side-effects when using custom hashing functions
* that access memory in an unsafe way.
*
* NOTE: This library supports proof verification for merkle trees built using
* custom _commutative_ hashing functions (i.e. `H(a, b) == H(b, a)`). Proving
* leaf inclusion in trees built using non-commutative hashing functions requires
* additional logic that is not supported by this library.
*/
library MerkleProof {
/**
*@dev The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*
* This version handles proofs in memory with the default hashing function.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in memory with the default hashing function.
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*
* This version handles proofs in memory with a custom hashing function.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processProof(proof, leaf, hasher) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in memory with a custom hashing function.
*/
function processProof(
bytes32[] memory proof,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = hasher(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with the default hashing function.
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with the default hashing function.
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with a custom hashing function.
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processProofCalldata(proof, leaf, hasher) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with a custom hashing function.
*/
function processProofCalldata(
bytes32[] calldata proof,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = hasher(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in memory with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProof}.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in memory with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = Hashes.commutativeKeccak256(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in memory with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProof}.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processMultiProof(proof, proofFlags, leaves, hasher) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in memory with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = hasher(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in calldata with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProofCalldata}.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in calldata with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = Hashes.commutativeKeccak256(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in calldata with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProofCalldata}.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves, hasher) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in calldata with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = hasher(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.22;
import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*/
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address private immutable __self = address(this);
/**
* @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
* and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
* while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
* If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
* be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
* during an upgrade.
*/
string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";
/**
* @dev The call is from an unauthorized context.
*/
error UUPSUnauthorizedCallContext();
/**
* @dev The storage `slot` is unsupported as a UUID.
*/
error UUPSUnsupportedProxiableUUID(bytes32 slot);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
_checkProxy();
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
_checkNotDelegated();
_;
}
function __UUPSUpgradeable_init() internal onlyInitializing {
}
function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
}
/**
* @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual notDelegated returns (bytes32) {
return ERC1967Utils.IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data);
}
/**
* @dev Reverts if the execution is not performed via delegatecall or the execution
* context is not of a proxy with an ERC-1967 compliant implementation pointing to self.
* See {_onlyProxy}.
*/
function _checkProxy() internal view virtual {
if (
address(this) == __self || // Must be called through delegatecall
ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
) {
revert UUPSUnauthorizedCallContext();
}
}
/**
* @dev Reverts if the execution is performed via delegatecall.
* See {notDelegated}.
*/
function _checkNotDelegated() internal view virtual {
if (address(this) != __self) {
// Must not be called through delegatecall
revert UUPSUnauthorizedCallContext();
}
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
/**
* @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
*
* As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
* is expected to be the implementation slot in ERC-1967.
*
* Emits an {IERC1967-Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
revert UUPSUnsupportedProxiableUUID(slot);
}
ERC1967Utils.upgradeToAndCall(newImplementation, data);
} catch {
// The implementation is not UUPS
revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
}
}
}pragma solidity 0.8.28;
import {IMetrom} from "../IMetrom.sol";
/// SPDX-License-Identifier: GPL-3.0-or-later
/// @title BasesCampaignsUtils
/// @notice Utility functions to be applied to all campaign types.
/// @author Federico Luzzi - <[email protected]>
library BaseCampaignsUtils {
/// @notice Validates the base parameters used to create a Metrom campaign.
/// @param _from The starting timestamp for the campaign.
/// @param _to The ending timestamp for the campaign.
/// @param _minimumCampaignDuration The minimum allowed campaign duration.
/// @param _maximumCampaignDuration The maximum allowed campaign duration.
/// @return The overall campaign duration.
function validate(uint32 _from, uint32 _to, uint32 _minimumCampaignDuration, uint32 _maximumCampaignDuration)
internal
view
returns (uint32)
{
if (_from <= block.timestamp) revert IMetrom.StartTimeInThePast();
if (_to < _from + _minimumCampaignDuration) revert IMetrom.DurationTooShort();
uint32 _duration = _to - _from;
if (_duration > _maximumCampaignDuration) revert IMetrom.DurationTooLong();
return _duration;
}
}pragma solidity 0.8.28;
import {BaseCampaignsUtils} from "./BaseCampaignsUtils.sol";
import {IMetrom, RewardsCampaignV1, ReadonlyRewardsCampaign, Reward} from "../IMetrom.sol";
/// @notice Holds the created rewards based campaigns.
struct RewardsCampaignsV1 {
mapping(bytes32 id => RewardsCampaignV1) campaigns;
}
/// SPDX-License-Identifier: GPL-3.0-or-later
/// @title RewardsCampaignsV1Utils
/// @notice Utility functions to be applied to rewards based campaigns.
/// @author Federico Luzzi - <[email protected]>
library RewardsCampaignsV1Utils {
/// @notice Given a campaign id returns a storage pointer to that campaign in the registry.
/// This function does not check if the referenced pointer has previously been populated or
/// not.
/// @param _self The rewards based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A storage pointer to the campaign with the given id.
function get(RewardsCampaignsV1 storage _self, bytes32 _id) internal view returns (RewardsCampaignV1 storage) {
return _self.campaigns[_id];
}
/// @notice Given a campaign id returns a storage pointer to that campaign in the registry.
/// This function reverts if the given campaign pointer does not have any prepopulated data.
/// @param _self The rewards based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A storage pointer to the campaign with the given id.
function getExisting(RewardsCampaignsV1 storage _self, bytes32 _id)
internal
view
returns (RewardsCampaignV1 storage)
{
RewardsCampaignV1 storage campaign = _self.campaigns[_id];
if (campaign.from == 0) revert IMetrom.NonExistentCampaign();
return campaign;
}
/// @notice Given a campaign id and a token address returns a storage pointer to the reward
/// linked to the campaign with the given id and with the given token address. This function
/// reverts if no campaign with the given id has been created.
/// @param _self The rewards based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @param _token The token address of the targeted reward.
/// @return A storage pointer to the reward with the given token address for the campaign with
/// the given id.
function getRewardOnExistingCampaign(RewardsCampaignsV1 storage _self, bytes32 _id, address _token)
internal
view
returns (Reward storage)
{
return getExisting(_self, _id).reward[_token];
}
}pragma solidity 0.8.28;
import {
IMetrom, RewardsCampaignV2, CreateRewardsCampaignBundle, ReadonlyRewardsCampaign, Reward
} from "../IMetrom.sol";
/// @dev Represents the maximum number of different rewards allowed for a
/// single campaign.
uint256 constant MAX_REWARDS_PER_CAMPAIGN = 5;
/// @notice Holds the created points based campaigns.
struct RewardsCampaignsV2 {
mapping(bytes32 id => RewardsCampaignV2) campaigns;
}
/// SPDX-License-Identifier: GPL-3.0-or-later
/// @title RewardsCampaignsV2Utils
/// @notice Utility functions to be applied to points based campaigns.
/// @author Federico Luzzi - <[email protected]>
library RewardsCampaignsV2Utils {
/// @notice Given a creation bundle, returns the id of the campaign that would
/// be created with the bundle if no errors were to be thrown.
/// @param _bundle The points based campaign creation bundle.
/// @return The generated campaign id.
function generateId(CreateRewardsCampaignBundle memory _bundle) internal view returns (bytes32) {
return keccak256(
abi.encode(
msg.sender,
_bundle.from,
_bundle.to,
_bundle.kind,
_bundle.data,
_bundle.specificationHash,
_bundle.rewards
)
);
}
/// @notice Given a campaign id returns a storage pointer to that campaign in the registry.
/// This function does not check if the referenced pointer has previously been populated or
/// not.
/// @param _self The points based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A storage pointer to the campaign with the given id.
function get(RewardsCampaignsV2 storage _self, bytes32 _id) internal view returns (RewardsCampaignV2 storage) {
return _self.campaigns[_id];
}
/// @notice Given a campaign creation bundle returns a storage pointer to that campaign in
/// the registry. This function reverts if the derived campaign pointer has prepopulated data.
/// @param _self The points based campaigns registry.
/// @param _bundle The creation bundle.
/// @return The new campaign id.
/// @return A storage pointer to the campaign with the given id.
function getNew(RewardsCampaignsV2 storage _self, CreateRewardsCampaignBundle memory _bundle)
internal
view
returns (bytes32, RewardsCampaignV2 storage)
{
bytes32 _id = generateId(_bundle);
RewardsCampaignV2 storage campaign = _self.campaigns[_id];
if (campaign.from != 0) revert IMetrom.AlreadyExists();
return (_id, campaign);
}
/// @notice Given a campaign id returns a storage pointer to that campaign in the registry.
/// This function reverts if the given campaign pointer does not have any prepopulated data.
/// @param _self The points based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A storage pointer to the campaign with the given id.
function getExisting(RewardsCampaignsV2 storage _self, bytes32 _id)
internal
view
returns (RewardsCampaignV2 storage)
{
RewardsCampaignV2 storage campaign = _self.campaigns[_id];
if (campaign.from == 0) revert IMetrom.NonExistentCampaign();
return campaign;
}
/// @notice Given a campaign id and a token address returns a storage pointer to the reward
/// linked to the campaign with the given id and with the given token address. This function
/// reverts if no campaign with the given id has been created.
/// @param _self The rewards based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @param _token The token address of the targeted reward.
/// @return A storage pointer to the reward with the given token address for the campaign with
/// the given id.
function getRewardOnExistingCampaign(RewardsCampaignsV2 storage _self, bytes32 _id, address _token)
internal
view
returns (Reward storage)
{
return getExisting(_self, _id).reward[_token];
}
/// @notice Given a campaign id returns a readonly version of it. This function reverts
/// if the given campaign pointer does not have any prepopulated data.
/// @param _self The points based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A readonly version of the campaign with the given id.
function getExistingReadonly(RewardsCampaignsV2 storage _self, bytes32 _id)
internal
view
returns (ReadonlyRewardsCampaign memory)
{
RewardsCampaignV2 storage campaign = getExisting(_self, _id);
return ReadonlyRewardsCampaign({
owner: campaign.owner,
pendingOwner: campaign.pendingOwner,
from: campaign.from,
to: campaign.to,
kind: campaign.kind,
data: campaign.data,
specificationHash: campaign.specificationHash,
root: campaign.root,
dataHash: campaign.dataHash
});
}
}pragma solidity 0.8.28;
import {IMetrom, PointsCampaignV1, ReadonlyPointsCampaign} from "../IMetrom.sol";
/// @notice Holds the created points based campaigns.
struct PointsCampaignsV1 {
mapping(bytes32 id => PointsCampaignV1) campaigns;
}
/// SPDX-License-Identifier: GPL-3.0-or-later
/// @title PointsCampaignsV1Utils
/// @notice Utility functions to be applied to points based campaigns.
/// @author Federico Luzzi - <[email protected]>
library PointsCampaignsV1Utils {
/// @notice Given a campaign id returns a storage pointer to that campaign in the registry.
/// This function does not check if the referenced pointer has previously been populated or
/// not.
/// @param _self The points based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A storage pointer to the campaign with the given id.
function get(PointsCampaignsV1 storage _self, bytes32 _id) internal view returns (PointsCampaignV1 storage) {
return _self.campaigns[_id];
}
/// @notice Given a campaign id returns a storage pointer to that campaign in the registry.
/// This function reverts if the given campaign pointer does not have any prepopulated data.
/// @param _self The points based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A storage pointer to the campaign with the given id.
function getExisting(PointsCampaignsV1 storage _self, bytes32 _id)
internal
view
returns (PointsCampaignV1 storage)
{
PointsCampaignV1 storage campaign = _self.campaigns[_id];
if (campaign.from == 0) revert IMetrom.NonExistentCampaign();
return campaign;
}
}pragma solidity 0.8.28;
import {IMetrom, PointsCampaignV2, CreatePointsCampaignBundle, ReadonlyPointsCampaign} from "../IMetrom.sol";
/// @notice Holds the created points based campaigns.
struct PointsCampaignsV2 {
mapping(bytes32 id => PointsCampaignV2) campaigns;
}
/// SPDX-License-Identifier: GPL-3.0-or-later
/// @title PointsCampaignsV2Utils
/// @notice Utility functions to be applied to points based campaigns.
/// @author Federico Luzzi - <[email protected]>
library PointsCampaignsV2Utils {
/// @notice Given a creation bundle, returns the id of the campaign that would
/// be created with the bundle if no errors were to be thrown.
/// @param _bundle The points based campaign creation bundle.
/// @return The generated campaign id.
function generateId(CreatePointsCampaignBundle memory _bundle) internal view returns (bytes32) {
return keccak256(
abi.encode(
msg.sender,
_bundle.from,
_bundle.to,
_bundle.kind,
_bundle.data,
_bundle.specificationHash,
_bundle.points
)
);
}
/// @notice Given a campaign id returns a storage pointer to that campaign in the registry.
/// This function does not check if the referenced pointer has previously been populated or
/// not.
/// @param _self The points based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A storage pointer to the campaign with the given id.
function get(PointsCampaignsV2 storage _self, bytes32 _id) internal view returns (PointsCampaignV2 storage) {
return _self.campaigns[_id];
}
/// @notice Given a campaign creation bundle returns a storage pointer to that campaign in
/// the registry. This function reverts if the derived campaign pointer has prepopulated data.
/// @param _self The points based campaigns registry.
/// @param _bundle The creation bundle.
/// @return The new campaign id.
/// @return A storage pointer to the campaign with the given id.
function getNew(PointsCampaignsV2 storage _self, CreatePointsCampaignBundle memory _bundle)
internal
view
returns (bytes32, PointsCampaignV2 storage)
{
bytes32 _id = generateId(_bundle);
PointsCampaignV2 storage campaign = _self.campaigns[_id];
if (campaign.from != 0) revert IMetrom.AlreadyExists();
return (_id, campaign);
}
/// @notice Given a campaign id returns a storage pointer to that campaign in the registry.
/// This function reverts if the given campaign pointer does not have any prepopulated data.
/// @param _self The points based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A storage pointer to the campaign with the given id.
function getExisting(PointsCampaignsV2 storage _self, bytes32 _id)
internal
view
returns (PointsCampaignV2 storage)
{
PointsCampaignV2 storage campaign = _self.campaigns[_id];
if (campaign.from == 0) revert IMetrom.NonExistentCampaign();
return campaign;
}
/// @notice Given a campaign id returns a readonly version of it. This function reverts
/// if the given campaign pointer does not have any prepopulated data.
/// @param _self The points based campaigns registry.
/// @param _id The id of the targeted campaign.
/// @return A readonly version of the campaign with the given id.
function getExistingReadonly(PointsCampaignsV2 storage _self, bytes32 _id)
internal
view
returns (ReadonlyPointsCampaign memory)
{
PointsCampaignV2 storage campaign = getExisting(_self, _id);
return ReadonlyPointsCampaign({
owner: campaign.owner,
pendingOwner: campaign.pendingOwner,
from: campaign.from,
to: campaign.to,
kind: campaign.kind,
data: campaign.data,
specificationHash: campaign.specificationHash,
points: campaign.points
});
}
}pragma solidity >=0.8.0;
/// @dev Represents the maximum value for fee percentages (100%).
uint32 constant UNIT = 1_000_000;
/// @notice Represents a reward in the contract's state.
/// It keeps track of the remaining amount after fees
/// as well as a mapping of claimed amounts for each user.
struct Reward {
uint256 amount;
mapping(address user => uint256 amount) claimed;
}
/// @notice Represents a rewards based campaign in the contract's state, with its owner,
/// target pool, running period, specification hash, root and data hash links, as well
/// as rewards information. A particular note must be made for the `specificationHash` and
/// `data` fields. These can optionally contain a SHA256 hash of some JSON content stored
/// on IPFS such that a CID can be constructed from them. `specificationHash` can point
/// to an IPFS JSON file with additional information/parameters on the campaign, while
/// the `data` field must point to a JSON file containing the raw leaves from which the
/// current campaign's Merkle tree and root was calculated.
struct RewardsCampaignV1 {
address owner;
address pendingOwner;
address pool;
uint32 from;
uint32 to;
bytes32 specificationHash;
bytes32 root;
bytes32 dataHash;
mapping(address token => Reward) reward;
}
/// @notice Represents a points based campaign in the contract's state, with its owner,
/// target pool, running period, specification hash and root, as well as points information.
/// A particular note must be made for the `specificationHash` field. This can optionally
/// contain a SHA256 hash of some JSON content stored on IPFS such that a CID can be
/// constructed from it. `specificationHash` can point to an IPFS JSON file with additional
/// information/parameters on the campaign.
struct PointsCampaignV1 {
address owner;
address pendingOwner;
address pool;
uint32 from;
uint32 to;
bytes32 specificationHash;
uint256 points;
}
/// @notice Represents a rewards based campaign in the contract's state, with its owner,
/// running period, type, data, specification hash, root and data hash links, as well as rewards
/// information. A particular note must be made for the `specificationHash` and `dataHash` fields.
/// These can optionally contain a SHA256 hash of some JSON content stored on IPFS such that
/// a CID can be constructed from them. `specificationHash` can point to an IPFS JSON file with
/// additional information/parameters on the campaign, while the `data` field must point
/// to a JSON file containing the raw leaves from which the current campaign's Merkle
/// tree and root was calculated.
struct RewardsCampaignV2 {
address owner;
address pendingOwner;
uint32 from;
uint32 to;
uint32 kind;
bytes data;
bytes32 specificationHash;
bytes32 dataHash;
bytes32 root;
mapping(address token => Reward) reward;
}
/// @notice Represents a points based campaign in the contract's state, with its owner,
/// running period, type, data, specification hash, root and points information.
/// A particular note must be made for the `specificationHash` field. This can optionally
/// contain a SHA256 hash of some JSON content stored on IPFS such that a CID can be
/// constructed from it. `specificationHash` can point to an IPFS JSON file with additional
/// information/parameters on the campaign.
struct PointsCampaignV2 {
address owner;
address pendingOwner;
uint32 from;
uint32 to;
uint32 kind;
bytes data;
bytes32 specificationHash;
uint256 points;
}
/// @notice Represents a readonly rewards based campaign.
struct ReadonlyRewardsCampaign {
address owner;
address pendingOwner;
uint32 from;
uint32 to;
uint32 kind;
bytes data;
bytes32 specificationHash;
bytes32 dataHash;
bytes32 root;
}
/// @notice Represents a readonly points based campaign
struct ReadonlyPointsCampaign {
address owner;
address pendingOwner;
uint32 from;
uint32 to;
uint32 kind;
bytes data;
bytes32 specificationHash;
uint256 points;
}
struct RewardAmount {
address token;
uint256 amount;
}
struct CreatedCampaignReward {
address token;
uint256 amount;
uint256 fee;
}
/// @notice Contains data that can be used by anyone to create a rewards based campaign.
struct CreateRewardsCampaignBundle {
uint32 from;
uint32 to;
uint32 kind;
bytes data;
bytes32 specificationHash;
RewardAmount[] rewards;
}
/// @notice Contains data that can be used by anyone to create a points based campaign.
struct CreatePointsCampaignBundle {
uint32 from;
uint32 to;
uint32 kind;
bytes data;
bytes32 specificationHash;
uint256 points;
address feeToken;
}
/// @notice Contains data that can be used by the current `updater` to
/// distribute rewards on a campaign by specifying a Merkle root and a data link.
struct DistributeRewardsBundle {
bytes32 campaignId;
bytes32 root;
bytes32 dataHash;
}
/// @notice Contains data that can be used by the current `updater` or the
/// `owner` to update the minimum required rate to be emitted in a campaign for
/// a certain reward token or the minimum fee token rate.
struct SetMinimumTokenRateBundle {
address token;
uint256 minimumRate;
}
/// @notice Contains data that can be used by eligible LPs to claim rewards assigned to them
/// on a campaign by specifying data necessary to build a valid Merkle leaf and an inclusion
/// proof.
struct ClaimRewardBundle {
bytes32 campaignId;
bytes32[] proof;
address token;
uint256 amount;
address receiver;
}
/// @notice Contains data that can be used by the contract's owner to claim accrued fees.
struct ClaimFeeBundle {
address token;
address receiver;
}
/// SPDX-License-Identifier: GPL-3.0-or-later
/// @title Metrom
/// @notice The interface for the contract handling all Metrom entities and interactions.
/// It supports creation and update of campaigns as well as claims and recoveries of unassigned
/// rewards for each one of them.
/// @author Federico Luzzi - <[email protected]>
interface IMetrom {
/// @notice Emitted at initialization time.
/// @param owner The initial contract's owner.
/// @param updater The initial contract's updater.
/// @param fee The initial contract's rewards campaign fee.
/// @param minimumCampaignDuration The initial contract's minimum campaign duration.
/// @param maximumCampaignDuration The initial contract's maximum campaign duration.
event Initialize(
address indexed owner,
address updater,
uint32 fee,
uint32 minimumCampaignDuration,
uint32 maximumCampaignDuration
);
/// @notice Emitted when the contract is ossified.
event Ossify();
/// @notice Emitted when a rewards based campaign is created.
/// @param id The id of the campaign.
/// @param owner The initial owner of the campaign.
/// @param from From when the campaign will run.
/// @param to To when the campaign will run.
/// @param kind The campaign's kind.
/// @param data ABI-encoded campaign-specific data.
/// @param specificationHash The campaign's specification hash.
/// @param rewards A list of the reward tokens deposited in the campaign. Each list
/// item contains the used reward token address along with the after-fee amount and
/// the fee amount paid.
event CreateRewardsCampaign(
bytes32 indexed id,
address indexed owner,
uint32 from,
uint32 to,
uint32 kind,
bytes data,
bytes32 specificationHash,
CreatedCampaignReward[] rewards
);
/// @notice Emitted when a points based campaign is created.
/// @param id The id of the campaign.
/// @param owner The initial owner of the campaign.
/// @param from From when the campaign will run.
/// @param to To when the campaign will run.
/// @param kind The campaign's kind.
/// @param data ABI-encoded campaign-specific data.
/// @param specificationHash The campaign's specification data hash.
/// @param points The amount of points to distribute (scaled to account for 18 decimals).
/// @param feeToken The token used to pay the creation fee.
/// @param fee The creation fee amount.
event CreatePointsCampaign(
bytes32 indexed id,
address indexed owner,
uint32 from,
uint32 to,
uint32 kind,
bytes data,
bytes32 specificationHash,
uint256 points,
address feeToken,
uint256 fee
);
/// @notice Emitted when the campaigns updater distributes rewards on a campaign.
/// @param campaignId The id of the campaign. on which the rewards were distributed.
/// @param root The updated Merkle root for the campaign.
/// @param data The updated data content hash for the campaign. This can be used to
/// contruct an IPFS CID for a file that will contain the raw data used to get the raw
/// data used to contruct the campaign's Merkle tree and verify the Merkle root.
event DistributeReward(bytes32 indexed campaignId, bytes32 root, bytes32 data);
/// @notice Emitted when the rates updater or the owner updates the minimum emission
/// rate of a certain whitelisted reward token required in order to create a rewards based
/// campaign.
/// @param token The address of the whitelisted reward token to update.
/// @param minimumRate The new minimum rate required in order to create a
/// campaign.
event SetMinimumRewardTokenRate(address indexed token, uint256 minimumRate);
/// @notice Emitted when the rates updater or the owner updates the minimum rate for a
/// certain whitelisted fee token required in order to create a points based campaign.
/// @param token The address of the whitelisted fee token to update.
/// @param minimumRate The new minimum rate required in order to create a
/// campaign.
event SetMinimumFeeTokenRate(address indexed token, uint256 minimumRate);
/// @notice Emitted when an eligible LP claims a reward.
/// @param campaignId The id of the campaign on which the claim is performed.
/// @param token The claimed token.
/// @param amount The claimed amount.
/// @param receiver The claim's receiver.
event ClaimReward(bytes32 indexed campaignId, address token, uint256 amount, address indexed receiver);
/// @notice Emitted when the campaign's owner recovers unassigned rewards.
/// @param campaignId The id of the campaign on which the recovery was performed.
/// @param token The recovered token.
/// @param amount The recovered amount.
/// @param receiver The recovery's receiver.
event RecoverReward(bytes32 indexed campaignId, address token, uint256 amount, address indexed receiver);
/// @notice Emitted when Metrom's contract owner claims accrued fees.
/// @param token The claimed token.
/// @param amount The claimed amount.
/// @param receiver The claims's receiver.
event ClaimFee(address token, uint256 amount, address indexed receiver);
/// @notice Emitted when a campaign's ownership transfer is initiated.
/// @param id The targete campaign's id.
/// @param owner The new desired owner.
event TransferCampaignOwnership(bytes32 indexed id, address indexed owner);
/// @notice Emitted when a campaign's current pending owner accepts its ownership.
/// @param id The targete campaign's id.
/// @param owner The targete campaign's new owner.
event AcceptCampaignOwnership(bytes32 indexed id, address indexed owner);
/// @notice Emitted when Metrom's ownership transfer is initiated.
/// @param owner The new desired owner.
event TransferOwnership(address indexed owner);
/// @notice Emitted when Metrom's current pending owner accepts its ownership.
/// @param owner The new owner.
event AcceptOwnership(address indexed owner);
/// @notice Emitted when Metrom's owner sets a new allowed updater address.
/// @param updater The new updater.
event SetUpdater(address indexed updater);
/// @notice Emitted when Metrom's owner sets a new rewards based campaign fee.
/// @param fee The new rewards campaign fee.
event SetFee(uint32 fee);
/// @notice Emitted when Metrom's owner sets a new address-specific
/// rebate for the protocol rewards based campaign fees.
/// @param account The account for which the rebate was set.
/// @param rebate The rebate.
event SetFeeRebate(address account, uint32 rebate);
/// @notice Emitted when Metrom's owner sets a new minimum campaign duration.
/// @param minimumCampaignDuration The new minimum campaign duration.
event SetMinimumCampaignDuration(uint32 minimumCampaignDuration);
/// @notice Emitted when Metrom's owner sets a new maximum campaign duration.
/// @param maximumCampaignDuration The new maximum campaign duration.
event SetMaximumCampaignDuration(uint32 maximumCampaignDuration);
/// @notice Thrown when trying to create a campaign that already exists.
error AlreadyExists();
/// @notice Thrown when trying to create a campaign with a non-whitelisted reward token.
error DisallowedRewardToken();
/// @notice Thrown when trying to create a campaign with a duration that is too long.
error DurationTooLong();
/// @notice Thrown when trying to create a campaign with a duration that is too short.
error DurationTooShort();
/// @notice Thrown when the desired operation's execution is forbidden to the caller.
error Forbidden();
/// @notice Thrown when the specified fee goes over the maximum allowed amount.
error InvalidFee();
/// @notice Thrown when the specified maximum campaign duration is less or equal to
/// the current minimum campaign duration.
error InvalidMaximumCampaignDuration();
/// @notice Thrown when the specified minimum campaign duration is greater than or
/// equal to the current maximum campaign duration.
error InvalidMinimumCampaignDuration();
/// @notice Thrown at claim procession time when the provided Merkle proof is invalid.
error InvalidProof();
/// @notice Thrown when creating a points based campaign if a zero points amount was specified.
error NoPoints();
/// @notice Thrown when creating a campaign if no rewards were specified.
error NoRewards();
/// @notice Thrown when a campaign that was required to exists does not exist.
error NonExistentCampaign();
/// @notice Thrown when a campaign reward that was required to exists does not exist.
error NonExistentReward();
/// @notice Thrown when trying to upgrade the contract while ossified.
error Ossified();
/// @notice Thrown when trying to set a fee rebate that is too high.
error RebateTooHigh();
/// @notice Thrown when trying to create a campaign when the specified reward amount is too low.
error RewardAmountTooLow();
/// @notice Thrown when trying to create a campaign with a from timestamp in the past.
error StartTimeInThePast();
/// @notice Thrown when trying to create a campaign when too many rewards are specified.
error TooManyRewards();
/// @notice Thrown when trying to claim a reward that is too much to be claimed.
error TooMuchClaimedAmount();
/// @notice Thrown when trying to set the updater to the zero address.
error ZeroAddressUpdater();
/// @notice Thrown when trying to set the fee rebate for a zero address account.
error ZeroAddressAccount();
/// @notice Thrown when trying to transfer Metrom's or a campaign's ownership to the zero address.
error ZeroAddressOwner();
/// @notice Thrown when processing a claim with a zero address receiver or when claiming
/// fees for a zero address receiver.
error ZeroAddressReceiver();
/// @notice Thrown when trying to create a points based campaign with a zero address fee token.
error ZeroAddressFeeToken();
/// @notice Thrown when trying to create a points based campaign with a disallowed fee token.
error DisallowedFeeToken();
/// @notice Thrown when trying to create a points based campaign with a non adequate fee.
error FeeAmountTooLow();
/// @notice Thrown when trying to create a campaign with a zero address reward token or
/// when trying to set the minimum reward token rate for a zero address reward token.
error ZeroAddressRewardToken();
/// @notice Thrown at claim processing time when the requested claim amount is 0.
error ZeroAmount();
/// @notice Thrown at rewards distribution time when 0-bytes data is specified.
error ZeroData();
/// @notice Thrown when trying to create a campaign with a zero reward amount.
error ZeroRewardAmount();
/// @notice Thrown at rewards distribution time when the specified root is 0-bytes.
error ZeroRoot();
/// @notice Initializes the contract.
/// @param owner The initial owner.
/// @param updater The initial updater.
/// @param fee The initial fee.
/// @param minimumCampaignDuration The initial minimum campaign duration.
/// @param maximumCampaignDuration The initial maximum campaign duration.
function initialize(
address owner,
address updater,
uint32 fee,
uint32 minimumCampaignDuration,
uint32 maximumCampaignDuration
) external;
/// @notice Returns whether the contract is upgradeable or not.
/// @return ossified The upgradeability state of the contract.
function ossified() external returns (bool ossified);
/// @notice Makes the contract immutable, de-facto disallowing
/// any future upgrade. Can only be called by Metrom's owner.
function ossify() external;
/// @notice Returns the current owner.
/// @return owner The current owner.
function owner() external view returns (address owner);
/// @notice Returns the current pending owner.
/// @return pendingOwner The current pending owner.
function pendingOwner() external view returns (address pendingOwner);
/// @notice Returns the currently allowed updater.
/// @return updater The currently allowed updater.
function updater() external view returns (address updater);
/// @notice Returns the current fee.
/// @return fee The current fee.
function fee() external view returns (uint32 fee);
/// @notice Returns the current fee rebate for a provided account.
/// @param account The account for which to fetch the fee rebate.
/// @return rebate The fee rebate for the provided account.
function feeRebate(address account) external view returns (uint32 rebate);
/// @notice Returns the currently enforced minimum campaign duration.
/// @return minimumCampaignDuration The currently enforced minimum campaign duration.
function minimumCampaignDuration() external view returns (uint32 minimumCampaignDuration);
/// @notice Returns the currently enforced minimum campaign duration.
/// @return maximumCampaignDuration The currently enforced minimum campaign duration.
function maximumCampaignDuration() external view returns (uint32 maximumCampaignDuration);
/// @notice Returns the currently claimable fees amount for a specified token.
/// @param token The token for which to fetch the currently claimable amount.
/// @return claimable The amount of the specified token that is currently claimable.
function claimableFees(address token) external returns (uint256 claimable);
/// @notice Returns the minimum emission rate required in order to create a
/// campaign with the passed token. Returns 0 if the token is not whitelisted and it
/// cannot be used to create a campaign.
/// @param token The reward token's address.
/// @return minimumRate The reward token's minimum required emission rate.
function minimumRewardTokenRate(address token) external view returns (uint256 minimumRate);
/// @notice Returns the minimum fee token rate required in order to create a
/// points-based campaign with the given token. Returns 0 if the token is not
/// whitelisted and it cannot be used to create a campaign.
/// @param token The fee token's address.
/// @return minimumRate The reward token's minimum required rate.
function minimumFeeTokenRate(address token) external view returns (uint256 minimumRate);
/// @notice Returns a points based campaign in readonly format.
/// @param id The wanted campaign id.
/// @return campaign The points based campaign in readonly format.
function pointsCampaignById(bytes32 id) external view returns (ReadonlyPointsCampaign memory campaign);
/// @notice Returns a rewards based campaign in readonly format.
/// @param id The wanted campaign id.
/// @return campaign The rewards based campaign in readonly format.
function rewardsCampaignById(bytes32 id) external view returns (ReadonlyRewardsCampaign memory campaign);
/// @notice Returns the reward amount for a campaign and a reward token.
/// @param id The id of the campaign to query.
/// @param token The reward token to query.
/// @return reward The reward amount.
function campaignReward(bytes32 id, address token) external view returns (uint256 reward);
/// @notice Returns the amount of claimed reward token for a campaign and a user.
/// @param id The id of the campaign to query.
/// @param token The reward token to query.
/// @param account The claimer account.
/// @return claimed The claimed amount.
function claimedCampaignReward(bytes32 id, address token, address account)
external
view
returns (uint256 claimed);
/// @notice Creates one or more campaigns. The transaction will revert even if one
/// of the specified bundles results in a creation failure (all or none).
/// @param rewardsCampaignBundles The bundles containing the data used to create new rewards
/// based campaigns.
/// @param pointsCampaignBundles The bundles containing the data used to create new points
/// based campaigns.
function createCampaigns(
CreateRewardsCampaignBundle[] calldata rewardsCampaignBundles,
CreatePointsCampaignBundle[] calldata pointsCampaignBundles
) external;
/// @notice Distributes rewards on one or more campaigns. The transaction will revert
/// even if only one of the specified bundles results in a distribution failure (all or none).
/// @param bundles The bundles containing the data used to distribute the rewards.
function distributeRewards(DistributeRewardsBundle[] calldata bundles) external;
/// @notice Sets the minimum rates for both reward and fee tokens.
/// @param rewardTokenBundles The bundles containing the data used to update the minimum whitelisted
/// reward token rates.
/// @param feeTokenBundles The bundles containing the data used to update the minimum fee token rates.
function setMinimumTokenRates(
SetMinimumTokenRateBundle[] calldata rewardTokenBundles,
SetMinimumTokenRateBundle[] calldata feeTokenBundles
) external;
/// @notice Claims outstanding rewards on one or more campaigns. The transaction will revert
/// even if only one of the specified bundles results in a claim failure (all or none).
/// @param bundles The bundles containing the data used to claim the rewards.
function claimRewards(ClaimRewardBundle[] calldata bundles) external;
/// @notice Can be used by a campaign owner to recover unassigned rewards on one or more
/// campaigns. The transaction will revert even if only one of the specified bundles results
/// in a recovery failure (all or none).
/// @param bundles The bundles containing the data used to claim the recoverable rewards.
function recoverRewards(ClaimRewardBundle[] calldata bundles) external;
/// @notice Returns the current owner of a campaign.
/// @param id The id of the targeted campaign.
/// @return owner The current owner of the campaign.
function campaignOwner(bytes32 id) external view returns (address owner);
/// @notice Returns the current pending owner of a campaign.
/// @param id The id of the targeted campaign.
/// @return pendingOwner The current pending owner of the campaign.
function campaignPendingOwner(bytes32 id) external view returns (address pendingOwner);
/// @notice Initiates an ownership transfer operation for a campaign. This can only be
/// called by the current campaign owner.
/// @param id The id of the targeted campaign.
/// @param owner The desired new owner of the campaign.
function transferCampaignOwnership(bytes32 id, address owner) external;
/// @notice Finalized an ownership transfer operation for a campaign. This can only be
/// called by the current campaign pending owner to accept ownership of it.
/// @param id The id of the targeted campaign.
function acceptCampaignOwnership(bytes32 id) external;
/// @notice Initiates an ownership transfer operation for the Metrom contract. This can
/// only be called by the current Metrom owner.
/// @param owner The desired new owner of Metrom.
function transferOwnership(address owner) external;
/// @notice Finalizes an ownership transfer operation for the Metrom contract. This can
/// only be called by the current Metrom pending owner.
function acceptOwnership() external;
/// @notice Can be called by Metrom's owner to claim one or more outstanding fees.
/// @param bundles The bundles containing the data used to claim the fees.
function claimFees(ClaimFeeBundle[] calldata bundles) external;
/// @notice Can be called by Metrom's owner to set a new allowed updater address.
/// @param updater The new updater address.
function setUpdater(address updater) external;
/// @notice Can be called by Metrom's owner to set a new fee value.
function setFee(uint32 fee) external;
/// @notice Can be called by Metrom's owner to set a new specific protocol fee
/// rebate for an account.
/// @param account The account for which to set the rebate value.
/// @param rebate The rebate.
function setFeeRebate(address account, uint32 rebate) external;
/// @notice Can be called by Metrom's owner to set a new minimum allowed campaign duration.
/// @param minimumCampaignDuration The new minimum allowed campaign duration.
function setMinimumCampaignDuration(uint32 minimumCampaignDuration) external;
/// @notice Can be called by Metrom's owner to set a new maximum allowed campaign duration.
/// @param maximumCampaignDuration The new maximum allowed campaign duration.
function setMaximumCampaignDuration(uint32 maximumCampaignDuration) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/Hashes.sol)
pragma solidity ^0.8.20;
/**
* @dev Library of standard hash functions.
*
* _Available since v5.1._
*/
library Hashes {
/**
* @dev Commutative Keccak256 hash of a sorted pair of bytes32. Frequently used when working with merkle proofs.
*
* NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
*/
function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) {
return a < b ? _efficientKeccak256(a, b) : _efficientKeccak256(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
function _efficientKeccak256(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly ("memory-safe") {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.20;
/**
* @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (proxy/ERC1967/ERC1967Utils.sol)
pragma solidity ^0.8.22;
import {IBeacon} from "../beacon/IBeacon.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";
/**
* @dev This library provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
*/
library ERC1967Utils {
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev The `implementation` of the proxy is invalid.
*/
error ERC1967InvalidImplementation(address implementation);
/**
* @dev The `admin` of the proxy is invalid.
*/
error ERC1967InvalidAdmin(address admin);
/**
* @dev The `beacon` of the proxy is invalid.
*/
error ERC1967InvalidBeacon(address beacon);
/**
* @dev An upgrade function sees `msg.value > 0` that may be lost.
*/
error ERC1967NonPayable();
/**
* @dev Returns the current implementation address.
*/
function getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the ERC-1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
if (newImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(newImplementation);
}
StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Performs implementation upgrade with additional setup call if data is nonempty.
* This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
* to avoid stuck value in the contract.
*
* Emits an {IERC1967-Upgraded} event.
*/
function upgradeToAndCall(address newImplementation, bytes memory data) internal {
_setImplementation(newImplementation);
emit IERC1967.Upgraded(newImplementation);
if (data.length > 0) {
Address.functionDelegateCall(newImplementation, data);
} else {
_checkNonPayable();
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
* the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the ERC-1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
if (newAdmin == address(0)) {
revert ERC1967InvalidAdmin(address(0));
}
StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {IERC1967-AdminChanged} event.
*/
function changeAdmin(address newAdmin) internal {
emit IERC1967.AdminChanged(getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the ERC-1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
if (newBeacon.code.length == 0) {
revert ERC1967InvalidBeacon(newBeacon);
}
StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;
address beaconImplementation = IBeacon(newBeacon).implementation();
if (beaconImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(beaconImplementation);
}
}
/**
* @dev Change the beacon and trigger a setup call if data is nonempty.
* This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
* to avoid stuck value in the contract.
*
* Emits an {IERC1967-BeaconUpgraded} event.
*
* CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
* it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
* efficiency.
*/
function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
_setBeacon(newBeacon);
emit IERC1967.BeaconUpgraded(newBeacon);
if (data.length > 0) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
} else {
_checkNonPayable();
}
}
/**
* @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
* if an upgrade doesn't perform an initialization call.
*/
function _checkNonPayable() private {
if (msg.value > 0) {
revert ERC1967NonPayable();
}
}
}// 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) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.20;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {UpgradeableBeacon} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.20;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*/
interface IERC1967 {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @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 Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert Errors.FailedCall();
}
}
/**
* @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
* {Errors.FailedCall} 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 Errors.InsufficientBalance(address(this).balance, value);
}
(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 {Errors.FailedCall}) 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 {Errors.FailedCall} 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 {Errors.FailedCall}.
*/
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
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}{
"remappings": [
"forge-std/=lib/forge-std/src/",
"oz/=lib/openzeppelin-contracts/contracts/",
"oz-up/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 1000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": true,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"AlreadyExists","type":"error"},{"inputs":[],"name":"DisallowedFeeToken","type":"error"},{"inputs":[],"name":"DisallowedRewardToken","type":"error"},{"inputs":[],"name":"DurationTooLong","type":"error"},{"inputs":[],"name":"DurationTooShort","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"FeeAmountTooLow","type":"error"},{"inputs":[],"name":"Forbidden","type":"error"},{"inputs":[],"name":"InvalidFee","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidMaximumCampaignDuration","type":"error"},{"inputs":[],"name":"InvalidMinimumCampaignDuration","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"NoPoints","type":"error"},{"inputs":[],"name":"NoRewards","type":"error"},{"inputs":[],"name":"NonExistentCampaign","type":"error"},{"inputs":[],"name":"NonExistentReward","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"Ossified","type":"error"},{"inputs":[],"name":"RebateTooHigh","type":"error"},{"inputs":[],"name":"RewardAmountTooLow","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StartTimeInThePast","type":"error"},{"inputs":[],"name":"TooManyRewards","type":"error"},{"inputs":[],"name":"TooMuchClaimedAmount","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"inputs":[],"name":"ZeroAddressAccount","type":"error"},{"inputs":[],"name":"ZeroAddressFeeToken","type":"error"},{"inputs":[],"name":"ZeroAddressOwner","type":"error"},{"inputs":[],"name":"ZeroAddressReceiver","type":"error"},{"inputs":[],"name":"ZeroAddressRewardToken","type":"error"},{"inputs":[],"name":"ZeroAddressUpdater","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"ZeroData","type":"error"},{"inputs":[],"name":"ZeroRewardAmount","type":"error"},{"inputs":[],"name":"ZeroRoot","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"AcceptCampaignOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"AcceptOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"}],"name":"ClaimFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"campaignId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"}],"name":"ClaimReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint32","name":"from","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"to","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"kind","type":"uint32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"specificationHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"points","type":"uint256"},{"indexed":false,"internalType":"address","name":"feeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"CreatePointsCampaign","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint32","name":"from","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"to","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"kind","type":"uint32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"specificationHash","type":"bytes32"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"indexed":false,"internalType":"struct CreatedCampaignReward[]","name":"rewards","type":"tuple[]"}],"name":"CreateRewardsCampaign","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"campaignId","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"data","type":"bytes32"}],"name":"DistributeReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"updater","type":"address"},{"indexed":false,"internalType":"uint32","name":"fee","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"minimumCampaignDuration","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"maximumCampaignDuration","type":"uint32"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[],"name":"Ossify","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"campaignId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"}],"name":"RecoverReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"fee","type":"uint32"}],"name":"SetFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint32","name":"rebate","type":"uint32"}],"name":"SetFeeRebate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"maximumCampaignDuration","type":"uint32"}],"name":"SetMaximumCampaignDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"minimumCampaignDuration","type":"uint32"}],"name":"SetMinimumCampaignDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"minimumRate","type":"uint256"}],"name":"SetMinimumFeeTokenRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"minimumRate","type":"uint256"}],"name":"SetMinimumRewardTokenRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"updater","type":"address"}],"name":"SetUpdater","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"TransferCampaignOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"TransferOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"acceptCampaignOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"campaignOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"campaignPendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"internalType":"address","name":"_token","type":"address"}],"name":"campaignReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"}],"internalType":"struct ClaimFeeBundle[]","name":"_bundles","type":"tuple[]"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"campaignId","type":"bytes32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"internalType":"struct ClaimRewardBundle[]","name":"_bundles","type":"tuple[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"claimableFees","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_account","type":"address"}],"name":"claimedCampaignReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"from","type":"uint32"},{"internalType":"uint32","name":"to","type":"uint32"},{"internalType":"uint32","name":"kind","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"specificationHash","type":"bytes32"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct RewardAmount[]","name":"rewards","type":"tuple[]"}],"internalType":"struct CreateRewardsCampaignBundle[]","name":"_rewardsCampaignBundles","type":"tuple[]"},{"components":[{"internalType":"uint32","name":"from","type":"uint32"},{"internalType":"uint32","name":"to","type":"uint32"},{"internalType":"uint32","name":"kind","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"specificationHash","type":"bytes32"},{"internalType":"uint256","name":"points","type":"uint256"},{"internalType":"address","name":"feeToken","type":"address"}],"internalType":"struct CreatePointsCampaignBundle[]","name":"_pointsCampaignBundles","type":"tuple[]"}],"name":"createCampaigns","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"campaignId","type":"bytes32"},{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"internalType":"struct DistributeRewardsBundle[]","name":"_bundles","type":"tuple[]"}],"name":"distributeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"feeRebate","outputs":[{"internalType":"uint32","name":"rebate","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_updater","type":"address"},{"internalType":"uint32","name":"_fee","type":"uint32"},{"internalType":"uint32","name":"_minimumCampaignDuration","type":"uint32"},{"internalType":"uint32","name":"_maximumCampaignDuration","type":"uint32"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maximumCampaignDuration","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumCampaignDuration","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"minimumFeeTokenRate","outputs":[{"internalType":"uint256","name":"minimumRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"minimumRewardTokenRate","outputs":[{"internalType":"uint256","name":"minimumRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ossified","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ossify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"pointsCampaignById","outputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingOwner","type":"address"},{"internalType":"uint32","name":"from","type":"uint32"},{"internalType":"uint32","name":"to","type":"uint32"},{"internalType":"uint32","name":"kind","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"specificationHash","type":"bytes32"},{"internalType":"uint256","name":"points","type":"uint256"}],"internalType":"struct ReadonlyPointsCampaign","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"campaignId","type":"bytes32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"internalType":"struct ClaimRewardBundle[]","name":"_bundles","type":"tuple[]"}],"name":"recoverRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"rewardsCampaignById","outputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingOwner","type":"address"},{"internalType":"uint32","name":"from","type":"uint32"},{"internalType":"uint32","name":"to","type":"uint32"},{"internalType":"uint32","name":"kind","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"specificationHash","type":"bytes32"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"internalType":"struct ReadonlyRewardsCampaign","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_fee","type":"uint32"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint32","name":"_rebate","type":"uint32"}],"name":"setFeeRebate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_maximumCampaignDuration","type":"uint32"}],"name":"setMaximumCampaignDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_minimumCampaignDuration","type":"uint32"}],"name":"setMinimumCampaignDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minimumRate","type":"uint256"}],"internalType":"struct SetMinimumTokenRateBundle[]","name":"_rewardTokenBundles","type":"tuple[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minimumRate","type":"uint256"}],"internalType":"struct SetMinimumTokenRateBundle[]","name":"_feeTokenBundles","type":"tuple[]"}],"name":"setMinimumTokenRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_updater","type":"address"}],"name":"setUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"internalType":"address","name":"_owner","type":"address"}],"name":"transferCampaignOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]Contract Creation Code
60a080604052346100ea57306080527ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460ff8160401c166100d9576002600160401b03196001600160401b03821601610073575b60405161501f90816100f08239608051818181612ad50152612bb80152f35b6001600160401b0319166001600160401b039081177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005581527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a13880610054565b63f92ee8a960e01b60005260046000fd5b600080fdfe61014080604052600436101561001457600080fd5b60003560e01c908163050f4a751461416d57508063052fe61e146140205780630668045c14613d5b57806318833b1714613cf65780631ab971ab14613c145780631bf844e0146139875780631dc37ed9146135a95780632c8d7bc5146133b457806339f3680814612fdc5780634a74c98614612ecd5780634f1ef28614612b4f57806352d1902d14612a8f5780636b9c439d146127e65780637271518a14612744578063753097d3146126155780637746436c146125d057806379ba5097146124ef5780637e0b24921461248a57806382134cb814612344578063857a6fe314612105578063875745101461203e5780638da5cb5b14611fe957806393efdfb114611ed45780639582d0b014611e6f5780639d54f41914611d7f5780639dc714a914611d45578063ad3cb1cc14611cc4578063af576f1e14611c82578063d498fbbb14611b47578063ddca3f4314611b02578063df034cd014611ab0578063e30c397814611a5e578063ed11125914610514578063ee0cf00814610382578063f2fde38b14610268578063f88cc1d3146102275763feba1ed2146101b757600080fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff6102036141a9565b166000526004602052602063ffffffff60406000205416604051908152f35b600080fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602060ff600054166040519015158152f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff6102b46141a9565b1680156103585773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e57807fffffffffffffffffffffffff000000000000000000000000000000000000000060015416176001557fcfaaa26691e16e66e73290fc725eee1a6b4e0e693a1640484937aac25ffb55a4600080a2005b7fee90c4680000000000000000000000000000000000000000000000000000000060005260046000fd5b7f5ee32a240000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff8111610222573660238201121561022257806004013567ffffffffffffffff81116102225736602460608302840101116102225773ffffffffffffffffffffffffffffffffffffffff60025416330361032e5760005b8181101561051257600060608202840160448101359081156104ea5760648101359081156104c2576001949392827f23751ab362cbd3dea851dbf2e3f3517528ad9aa61b62acc00d2c113dce0b5d619360406024819501359687815260036020522063ffffffff600282015460a01c1615156000146104a95780846004600593015501555b82519182526020820152a201610413565b5060046104b587614d2d565b8460058201550155610498565b6004847fc922446b000000000000000000000000000000000000000000000000000000008152fd5b6004837fb263ae73000000000000000000000000000000000000000000000000000000008152fd5b005b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff811161022257610563903690600401614234565b60243567ffffffffffffffff811161022257610583903690600401614234565b91906002549233600052600460205263ffffffff604060002054169163ffffffff6105ad846148fb565b1663ffffffff8660a01c160267ffffffffffffffff811660e05260e05103611a2f5785849286926000935b8585101561012052610120516111fd576000610120528460051b840135957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4185360301871215610ce35760c0878601360312610ce3576040516101005260c0610100510161010051811067ffffffffffffffff8211176110b857604052610660878601614223565b6101005152610673602088870101614223565b6020610100510152610689604088870101614223565b604061010051015267ffffffffffffffff6060888701013511610ce3576106b8368689016060810135016143f5565b606061010051015260808786010135608061010051015260a0878601013567ffffffffffffffff8111610ce35736601f828a890101011215610ce357610702818988010135614914565b90610710604051928361437a565b86890181018035808452602080850193923660069390931b010111610ce3576020818b8a010101915b888b018201803560061b0160200183106111b15750505060a061010051015261078a63ffffffff6101005151168360e01c9063ffffffff8560c01c169063ffffffff60206101005101511690614e11565b60a05260a0610100510151511561118357600560a061010051015151116111555763ffffffff61010051511663ffffffff6020610100510151169063ffffffff6040610100510151169060606101005101519161081f60806101005101519360a06101005101519260405196879533602088015260408701526060860152608085015260e060a0850152610100840190614265565b9260c08301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08284030160e08301526020808251948581520191019261012051905b80821061111957505061089c9250037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261437a565b602081519101209788610120515260096020526040610120512060c05263ffffffff600160c051015460a01c166110eb5760c0805180547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317815561010051805160019092018054602083015160408401517fffffffff0000000000000000000000000000000000000000000000000000000060e09190911b167bffffffff0000000000000000000000000000000000000000000000009190961b1660a09490941b77ffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90911617929092179290921790556060015180519067ffffffffffffffff82116110b85781906109c4600260c0510154614b65565b601f811161105d575b506020906001601f841114610f88576101205192610f7d575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c191617600260c05101555b6080610100510151600360c05101557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0610a7d60a061010051015151610a73610a6582614914565b60405160805260805161437a565b8060805152614914565b01610120515b818110610f49575050610120515b60a06101005101518051821015610e255781610aac91614d06565b519073ffffffffffffffffffffffffffffffffffffffff825116918215610df757602001518015610c8a57826101205152600660205260406101205120548015610dc95781610e10810204610e1003610d965760a05163ffffffff1615610d635763ffffffff60a05116610e1083020410610d3557604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481875afa918215610cf2576101205192610d00575b50610b7590303386614ee4565b604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481875afa8015610cf2576101205190610cb8575b610bc59250614b4b565b8015610c8a5773ffffffffffffffffffffffffffffffffffffffff600193610c07620f4240610bfe63ffffffff8260e051041686614d1a565b04938490614b4b565b92816101205152600560205260406101205120610c25828254614b58565b905560405190610c348261435e565b8282528460208301526040820152610c4e85608051614d06565b52610c5b84608051614d06565b506101205150166101205152600660c05101602052610c8260406101205120918254614b58565b905501610a91565b7fea1083a7000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b506020823d8211610cea575b81610cd16020938361437a565b81010312610ce357610bc59151610bbb565b6101205180fd5b3d9150610cc4565b6040513d61012051823e3d90fd5b9091506020813d8211610d2d575b81610d1b6020938361437a565b81010312610ce3575190610b75610b68565b3d9150610d0e565b7f1552aa13000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b7f4e487b710000000000000000000000000000000000000000000000000000000061012051526012600452602461012051fd5b7f4e487b710000000000000000000000000000000000000000000000000000000061012051526011600452602461012051fd5b7ff19162c8000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b7f8bc1b2d9000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b505094979690959196610e39828a0161492c565b6080610e9a8b63ffffffff80610e5360208985010161492c565b92610e72610e6560408b84010161492c565b918a01606081019061493d565b939094816040519916895216602088015216604086015260c0606086015260c085019161498e565b938b010135608082015280830360a08201526020608051519384815201926020608051019061012051905b808210610f0757505050907f0efde060d5a9444064df062f955bb37a49a4d4b6728fdb160e9534f8f6fd35f082600195949333940390a30193949592956105d8565b909194602060606001926040895173ffffffffffffffffffffffffffffffffffffffff8151168352848101518584015201516040820152019601920190610ec5565b602090604051610f588161435e565b6101205181526101205183820152610120516040820152828260805101015201610a83565b015190508b806109e6565b9250600260c0510161012051528061012051209061012051935b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0841685106110425760019450837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081161061100b575b505050811b01600260c0510155610a1d565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c191690558b8080610ff9565b81810151835560209485019460019093019290910190610fa2565b909150600260c05101610120515260206101205120601f840160051c8101602085106110b1575b90849392915b601f830160051c820181106110a05750506109cd565b61012051815585945060010161108a565b5080611084565b7f4e487b710000000000000000000000000000000000000000000000000000000061012051526041600452602461012051fd5b7f23369fa6000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b916001919350604060209182875173ffffffffffffffffffffffffffffffffffffffff8151168352015183820152019401920184929391610862565b7f850d01c2000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b7f3fb087f4000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b604083360312610ce35760405190604082019082821067ffffffffffffffff8311176110b85760409260209284526111e8866141ef565b81528286013583820152815201920191610739565b86935060005b838110156105125760008160051b840135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff21853603018212156119ff5760e08286013603126119ff576040519060e0820182811067ffffffffffffffff821117611a0257604052611276838701614223565b8252611286602084880101614223565b6020830152611299604084880101614223565b604083015267ffffffffffffffff60608488010135116119ff576112c5368785016060810135016143f5565b60608301528583016080818101359084015260a080820135908401526112ed9060c0016141ef565b60c083015261131e63ffffffff8351168660e01c9063ffffffff8860c01c169063ffffffff60208701511690614e11565b60a0830151156119d75773ffffffffffffffffffffffffffffffffffffffff60c0840151168252600760205260408220549081156119af57610e10611371620f42409363ffffffff611387941690614d1a565b0463ffffffff6113808c6148fb565b1690614d1a565b049063ffffffff83511663ffffffff60208501511661142563ffffffff6040870151169160608701516080880151906113ee60a08a0151916040519687956020870199338b5260408801526060870152608086015260e060a0860152610100850190614265565b9160c084015260e0830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261437a565b51902092838252600a6020526040822063ffffffff600182015460a01c166119875780547fffffffffffffffffffffffff00000000000000000000000000000000000000001633178155815160018201805460208501517bffffffff00000000000000000000000000000000000000000000000060c09190911b1660a09390931b77ffffffff0000000000000000000000000000000000000000167fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff9091161791909117905561154a63ffffffff60408401511660018301907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffff0000000000000000000000000000000000000000000000000000000083549260e01b169116179055565b60608201518051600283019167ffffffffffffffff821161195a5761156f8354614b65565b601f8111611915575b50602090601f831160011461185457918073ffffffffffffffffffffffffffffffffffffffff96949260c096948992611849575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790555b60808201516003820155600460a08301519101550151166040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa90811561183e578391611809575b5061164584303385614ee4565b604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481865afa80156117fe5784906117c5575b6116929250614b4b565b92831061179d578152600560205260409020818154906116b191614b58565b90556116be86840161492c565b906116cd60208886010161492c565b6116db60408987010161492c565b6116eb868a01606081019061493d565b90916116fb60c08c8a01016144ab565b936040519663ffffffff16875263ffffffff16602087015263ffffffff1660408601526060850161010090526101008501906117369261498e565b94808901608001356080850152880160a0013560a084015273ffffffffffffffffffffffffffffffffffffffff1660c083015260e0820152803393037f2fafd63d31ff9c46627f7b322dc27dac620bf76f6594cf9c2f2f1146b9a8180291a3600101611203565b6004827fdebabab5000000000000000000000000000000000000000000000000000000008152fd5b50906020813d82116117f6575b816117df6020938361437a565b810103126117f257906116929151611688565b8380fd5b3d91506117d2565b6040513d86823e3d90fd5b90506020813d8211611836575b816118236020938361437a565b8101031261183257518b611638565b8280fd5b3d9150611816565b6040513d85823e3d90fd5b0151905038806115ac565b8387528187209c9e9d9c91907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08416885b8181106118fd5750929e9f9d9e600192859260c0989673ffffffffffffffffffffffffffffffffffffffff9a9896106118c6575b505050811b0190556115de565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c191690553880806118b9565b92936020600181928786015181550195019301611885565b83875260208720601f840160051c81019160208510611950575b601f0160051c01905b8181106119455750611578565b878155600101611938565b909150819061192f565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6004837f23369fa6000000000000000000000000000000000000000000000000000000008152fd5b6004837fc4e3f981000000000000000000000000000000000000000000000000000000008152fd5b6004827f02f46144000000000000000000000000000000000000000000000000000000008152fd5b80fd5b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602063ffffffff60025460a01c16604051908152f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043580600052600360205273ffffffffffffffffffffffffffffffffffffffff604060002054168015611c57575b73ffffffffffffffffffffffffffffffffffffffff811615611c2c575b73ffffffffffffffffffffffffffffffffffffffff811615611c00575b60209073ffffffffffffffffffffffffffffffffffffffff60405191168152f35b50600052600a602052602073ffffffffffffffffffffffffffffffffffffffff60406000205416611bdf565b5080600052600860205273ffffffffffffffffffffffffffffffffffffffff60406000205416611bc2565b5080600052600960205273ffffffffffffffffffffffffffffffffffffffff60406000205416611ba5565b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257610512611cbc6141cc565b6004356146e2565b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257611d416040805190611d05818361437a565b600582527f352e302e30000000000000000000000000000000000000000000000000000000602083015251918291602083526020830190614265565b0390f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225761051260043561455f565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257611db66141a9565b73ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e5773ffffffffffffffffffffffffffffffffffffffff168015611e4557807fffffffffffffffffffffffff000000000000000000000000000000000000000060025416176002557fab7cdaa9124eb37f7ce2c2a0733d8da0aded711ef366856b758d42288db39608600080a2005b7f314be0410000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff611ebb6141a9565b1660005260076020526020604060002054604051908152f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257611f0b614210565b6002549063ffffffff811663ffffffff8360c01c16811115611fbf5773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e577fb7ac6fa77a86c0d5c6535cf95824472c583dc3d685abb9073ee47a3a80c58dc8927bffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffff0000000000000000000000000000000000000000000000000000000060209460e01b16911617600255604051908152a1005b7fc121eafd0000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602073ffffffffffffffffffffffffffffffffffffffff60005460081c16604051908152f35b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610222576004356120786141cc565b600082815260036020526040812060028101549293909260a01c63ffffffff16156120d057505073ffffffffffffffffffffffffffffffffffffffff600692166000520160205260206040600020545b604051908152f35b604092509273ffffffffffffffffffffffffffffffffffffffff60066120f7602096614d2d565b0191168252835220546120c8565b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff8111610222576121549036906004016142c4565b9060243567ffffffffffffffff8111610222576121759036906004016142c4565b91909273ffffffffffffffffffffffffffffffffffffffff60025416330361032e5760005b81811061227a5750505060005b8181106121b057005b6121bb818385614511565b9073ffffffffffffffffffffffffffffffffffffffff6121da836144ab565b161561225057817f3d38439713a3af86a496adf9d3098044ff419709caf9c869bd883dd4ef3603ab602073ffffffffffffffffffffffffffffffffffffffff612241826001970135948261222d826144ab565b1660005260078452856040600020556144ab565b1692604051908152a2016121a7565b7f98cbacf40000000000000000000000000000000000000000000000000000000060005260046000fd5b612285818385614511565b9073ffffffffffffffffffffffffffffffffffffffff6122a4836144ab565b161561231a57817fa75af3afb29424186de45575e8791e7f3cbcdcdaca644d37f8ae1a83884ce504602073ffffffffffffffffffffffffffffffffffffffff61230b82600197013594826122f7826144ab565b1660005260068452856040600020556144ab565b1692604051908152a20161219a565b7f8bc1b2d90000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043580600052600360205273ffffffffffffffffffffffffffffffffffffffff60016040600020015416801561245c575b73ffffffffffffffffffffffffffffffffffffffff81161561242e575b73ffffffffffffffffffffffffffffffffffffffff8116156123ff5760209073ffffffffffffffffffffffffffffffffffffffff60405191168152f35b50600052600a602052602073ffffffffffffffffffffffffffffffffffffffff60016040600020015416611bdf565b5080600052600860205273ffffffffffffffffffffffffffffffffffffffff600160406000200154166123c2565b5080600052600960205273ffffffffffffffffffffffffffffffffffffffff600160406000200154166123a5565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff6124d66141a9565b1660005260056020526020604060002054604051908152f35b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760015473ffffffffffffffffffffffffffffffffffffffff8116330361032e577fffffffffffffffffffffffff0000000000000000000000000000000000000000166001556000547fffffffffffffffffffffff0000000000000000000000000000000000000000ff74ffffffffffffffffffffffffffffffffffffffff003360081b16911617600055337f7f877120c72766f4eac00144c86c9e57ed52f31bac01ef5c4c223c4768a87673600080a2005b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602063ffffffff60025460c01c16604051908152f35b346102225760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043561264f6141cc565b6044359073ffffffffffffffffffffffffffffffffffffffff82168203610222576000838152600360205260408120600281015490949060a01c63ffffffff16156126ec57505060019273ffffffffffffffffffffffffffffffffffffffff600692166000520160205273ffffffffffffffffffffffffffffffffffffffff60406000209116600052016020526020604060002054604051908152f35b60209450926001919273ffffffffffffffffffffffffffffffffffffffff6006612717604097614d2d565b0191168452855273ffffffffffffffffffffffffffffffffffffffff8484209116835201835220546120c8565b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760005473ffffffffffffffffffffffffffffffffffffffff8160081c16330361032e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060019116176000557fa3aea98f3e0c1ad37415094751fd63facd254081ba9f95e0354ca75a56f001a8600080a1005b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257600435612820614521565b506000818152600860205260408120600281015460a081901c63ffffffff169390929084156129a157505073ffffffffffffffffffffffffffffffffffffffff8154169263ffffffff73ffffffffffffffffffffffffffffffffffffffff600184015416936040519273ffffffffffffffffffffffffffffffffffffffff82166020850152602084526128b460408561437a565b6004600386015495015495604051976128cc89614341565b88526020880152604087015260c01c1660608501526001608085015260a084015260c083015260e08201525b60405180916020825273ffffffffffffffffffffffffffffffffffffffff815116602083015273ffffffffffffffffffffffffffffffffffffffff602082015116604083015263ffffffff604082015116606083015263ffffffff606082015116608083015263ffffffff60808201511660a083015260e061298b60a083015161010060c0860152610120850190614265565b9160c08101518285015201516101008301520390f35b92509250506129ae614521565b508152600a60205260408120600181019163ffffffff835460a01c1615612a67575073ffffffffffffffffffffffffffffffffffffffff815416915490612a53600260038301549260048101549460405196612a0988614341565b875273ffffffffffffffffffffffffffffffffffffffff8116602088015263ffffffff8160a01c16604088015263ffffffff8160c01c16606088015260e01c608087015201614bb8565b60a084015260c083015260e08201526128f8565b807ff456b6590000000000000000000000000000000000000000000000000000000060049252fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003612b255760206040517f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8152f35b7fe07c8dba0000000000000000000000000000000000000000000000000000000060005260046000fd5b60407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257612b816141a9565b60243567ffffffffffffffff811161022257612ba19036906004016143f5565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803014908115612e8b575b50612b255760005473ffffffffffffffffffffffffffffffffffffffff8160081c16330361032e5760ff16612e615773ffffffffffffffffffffffffffffffffffffffff8216916040517f52d1902d000000000000000000000000000000000000000000000000000000008152602081600481875afa60009181612e2d575b50612c9557837f4c9c8ce30000000000000000000000000000000000000000000000000000000060005260045260246000fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc859203612e005750813b15612dd357807fffffffffffffffffffffffff00000000000000000000000000000000000000007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416177f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115612da05760008083602061051295519101845af43d15612d98573d91612d7b836143bb565b92612d89604051948561437a565b83523d6000602085013e614f4c565b606091614f4c565b505034612da957005b7fb398979f0000000000000000000000000000000000000000000000000000000060005260046000fd5b7f4c9c8ce30000000000000000000000000000000000000000000000000000000060005260045260246000fd5b7faa1d49a40000000000000000000000000000000000000000000000000000000060005260045260246000fd5b9091506020813d602011612e59575b81612e496020938361437a565b8101031261022257519085612c62565b3d9150612e3c565b7fbadff5aa0000000000000000000000000000000000000000000000000000000060005260046000fd5b905073ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416141583612be3565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257612f04614210565b6002549063ffffffff81168260e01c811015612fb25773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e577f4f244688ec43896a794ca98fe032b2e2c185ba37f6096270287c6fdbfb8bac80927fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff7bffffffff00000000000000000000000000000000000000000000000060209460c01b16911617600255604051908152a1005b7fbe7612750000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff81116102225761302b903690600401614234565b3391600091905b81831061303b57005b61304683838361443c565b9261305084614a9a565b600095919596608083019173ffffffffffffffffffffffffffffffffffffffff613079846144ab565b161561338c57604084019073ffffffffffffffffffffffffffffffffffffffff6130a2836144ab565b1615613364576060850135801561330c576130bc836144ab565b604051613128816130fc856020830195338773ffffffffffffffffffffffffffffffffffffffff6040929594938160608401971683521660208201520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261437a565b519020604051602081019182526020815261314460408261437a565b5190209960208701357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1883603018112156133605787019889359b67ffffffffffffffff8d1161335c578c60051b360360208c011361335c57908d8d9281935b8410156131e357600191604091600586901b8f016020013590818110156131d7578252602052205b9201918e908e6131a4565b908252602052206131cc565b9394979c9b50509b5050036133345761320c6001820193898c528460205260408c205490614b4b565b92831561330c57815484116132e4576132aa7f3fa6b189a815480521fe4e23f131707277c85fc420963a3302bae180a88e7c76949373ffffffffffffffffffffffffffffffffffffffff9360408e8d9e9f9560019d9e6132b09750825260205220613278878254614b58565b9055613285868254614b4b565b90556132a58585613295846144ab565b1661329f8a6144ab565b90614c7a565b6144ab565b946144ab565b6040805173ffffffffffffffffffffffffffffffffffffffff969096168652602086019390935216933592a3019192613032565b60048b7fd98dd18a000000000000000000000000000000000000000000000000000000008152fd5b60048b7f1f2a2005000000000000000000000000000000000000000000000000000000008152fd5b60048a7f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8d80fd5b8c80fd5b60048a7f8bc1b2d9000000000000000000000000000000000000000000000000000000008152fd5b6004897f96bbcf1e000000000000000000000000000000000000000000000000000000008152fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff8111610222576134039036906004016142c4565b73ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e5760005b81811061343157005b61343c818385614511565b9073ffffffffffffffffffffffffffffffffffffffff61345b836144ab565b161561231a576020820173ffffffffffffffffffffffffffffffffffffffff613483826144ab565b161561357f5773ffffffffffffffffffffffffffffffffffffffff6134a7846144ab565b1660005260056020526040600020549283156135555760019373ffffffffffffffffffffffffffffffffffffffff6135256132aa84836135077f41dea50ce5a7d417f4aae9d7ca5faa6c6f8934bd2a9581495ddd9a309d215c38976144ab565b166000526005602052600060408120556132a58585613295846144ab565b6040805173ffffffffffffffffffffffffffffffffffffffff96909616865260208601939093521692a201613428565b7f1f2a20050000000000000000000000000000000000000000000000000000000060005260046000fd5b7f96bbcf1e0000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610222576135e06141a9565b6135e86141cc565b6044359163ffffffff8316808403610222576064359063ffffffff821690818303610222576084359163ffffffff831691828403610222577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00549760ff8960401c16159867ffffffffffffffff81168015908161397f575b6001149081613975575b15908161396c575b50613942578960017fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008316177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00556138ed575b5073ffffffffffffffffffffffffffffffffffffffff87169788156103585773ffffffffffffffffffffffffffffffffffffffff16948515611e4557620f42408310156138c35784841015612fb2577fffffffff000000000000000000000000000000000000000000000000000000006080977f91ce78817967eee157b4513c68d41b1d338199e48dc2156ba719a5aa5e7a3f0e997fffffffffffffffffffffff0000000000000000000000000000000000000000ff74ffffffffffffffffffffffffffffffffffffffff006000549260081b169116176000557bffffffff0000000000000000000000000000000000000000000000007fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff8977ffffffff0000000000000000000000000000000000000000806002549860a01b16971617169160c01b16179160e01b161717600255604051938452602084015260408301526060820152a261383057005b7fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054167ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b7f58d620b30000000000000000000000000000000000000000000000000000000060005260046000fd5b7fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001668010000000000000001177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055896136c5565b7ff92ee8a90000000000000000000000000000000000000000000000000000000060005260046000fd5b9050158b613672565b303b15915061366a565b8b9150613660565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610222576004356139c16144cc565b50806000526003602052604060002060028101549063ffffffff8260a01c1692831515600014613b59575073ffffffffffffffffffffffffffffffffffffffff8154169273ffffffffffffffffffffffffffffffffffffffff6001830154169263ffffffff6040519173ffffffffffffffffffffffffffffffffffffffff8116602084015260208352613a5560408461437a565b600385015493600460058701549601549660405198613a738a6142f5565b89526020890152604088015260c01c1660608601526001608086015260a085015260c084015260e08301526101008201525b60405180916020825273ffffffffffffffffffffffffffffffffffffffff815116602083015273ffffffffffffffffffffffffffffffffffffffff602082015116604083015263ffffffff604082015116606083015263ffffffff606082015116608083015263ffffffff60808201511660a0830152610100613b3960a083015161012060c0860152610140850190614265565b9160c081015160e085015260e08101518285015201516101208301520390f35b915050613b6f9150613b696144cc565b50614d2d565b73ffffffffffffffffffffffffffffffffffffffff8154169060018101546003820154613bfa600260058501549460048101549460405197613bb0896142f5565b885273ffffffffffffffffffffffffffffffffffffffff8116602089015263ffffffff8160a01c16604089015263ffffffff8160c01c16606089015260e01c608088015201614bb8565b60a085015260c084015260e0830152610100820152613aa5565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257613c4b614210565b63ffffffff811690620f42408210156138c35773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e577f30dc86d30347102db8696c3066af2ceb70df72cdadb040dda215116f82d542e3916020917fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff77ffffffff00000000000000000000000000000000000000006002549260a01b16911617600255604051908152a1005b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff613d426141a9565b1660005260066020526020604060002054604051908152f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff811161022257613daa903690600401614234565b6000918291905b818410613dba57005b613dc584838361443c565b93613dcf856149cd565b60009691608083019173ffffffffffffffffffffffffffffffffffffffff613df6846144ab565b161561338c57604084019073ffffffffffffffffffffffffffffffffffffffff613e1f836144ab565b161561336457606085013592831561330c578a73ffffffffffffffffffffffffffffffffffffffff613e9f613e53866144ab565b8d60405193849260208401965060608701928752166020860152886040860152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261437a565b5190206040516020810191825260208152613ebb60408261437a565b5190209960208701357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1883603018112156133605787019889359b67ffffffffffffffff8d1161335c578c60051b360360208c011361335c57918d8d9381945b851015613f5a57600191604091600587901b8f01602001359081811015613f4e578252602052205b9301928e908e613f1b565b90825260205220613f43565b9350509a99509a500361333457613f8160018201938b80528460205260408c205490614b4b565b92831561330c57815484116132e4576132aa7f03c5002e770148ba7c24b504bb299021b4fe653920794a028690d23afaf5a4e5949373ffffffffffffffffffffffffffffffffffffffff9360408e60019c9d9e9f95613fed965081805260205220613278878254614b58565b6040805173ffffffffffffffffffffffffffffffffffffffff969096168652602086019390935216933592a30192613db1565b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610222576140576141a9565b6024359063ffffffff82168092036102225773ffffffffffffffffffffffffffffffffffffffff1690811561414357620f424081116141195773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e57816040917f9aeadd7d8692e2850dbe9380d1382a551843165e6d34174fa471c18b329ed0cc93600052600460205282600020817fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000082541617905582519182526020820152a1005b7f8360a59d0000000000000000000000000000000000000000000000000000000060005260046000fd5b7f595fdd890000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760209060025460e01c8152f35b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361022257565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361022257565b359073ffffffffffffffffffffffffffffffffffffffff8216820361022257565b6004359063ffffffff8216820361022257565b359063ffffffff8216820361022257565b9181601f840112156102225782359167ffffffffffffffff8311610222576020808501948460051b01011161022257565b919082519283825260005b8481106142af5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b80602080928401015182828601015201614270565b9181601f840112156102225782359167ffffffffffffffff8311610222576020808501948460061b01011161022257565b610120810190811067ffffffffffffffff82111761431257604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610100810190811067ffffffffffffffff82111761431257604052565b6060810190811067ffffffffffffffff82111761431257604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761431257604052565b67ffffffffffffffff811161431257601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f820112156102225780359061440c826143bb565b9261441a604051948561437a565b8284526020838301011161022257816000926020809301838601378301015290565b919081101561447c5760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6181360301821215610222570190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b3573ffffffffffffffffffffffffffffffffffffffff811681036102225790565b604051906144d9826142f5565b600061010083828152826020820152826040820152826060820152826080820152606060a08201528260c08201528260e08201520152565b919081101561447c5760061b0190565b6040519061452e82614341565b600060e083828152826020820152826040820152826060820152826080820152606060a08201528260c08201520152565b806000526003602052604060002073ffffffffffffffffffffffffffffffffffffffff8154166146345750806000526009602052604060002073ffffffffffffffffffffffffffffffffffffffff8154166146345750806000526008602052604060002073ffffffffffffffffffffffffffffffffffffffff815416614634575080600052600a602052604060002073ffffffffffffffffffffffffffffffffffffffff815416614634577ff456b6590000000000000000000000000000000000000000000000000000000060005260046000fd5b60018101805473ffffffffffffffffffffffffffffffffffffffff8116330361032e577fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff33167fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905533907f68f4d4d7a7c798d3a589e9f6941fe62fa592974dd92d57b5f46717bc8c5af810600080a3565b9073ffffffffffffffffffffffffffffffffffffffff1690811561035857806000526003602052604060002063ffffffff600282015460a01c1661488b57508060005260096020526040600020600181019063ffffffff825460a01c1661481f575050806000526008602052604060002073ffffffffffffffffffffffffffffffffffffffff815416806147c757505080600052600a602052604060002073ffffffffffffffffffffffffffffffffffffffff815416806147c7577ff456b6590000000000000000000000000000000000000000000000000000000060005260046000fd5b330361032e57600101827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f9aaa5d10320026fef8f3a55fb68f716786b4d73994a246e46bd8883144fec3de600080a3565b5473ffffffffffffffffffffffffffffffffffffffff16330361032e57827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f9aaa5d10320026fef8f3a55fb68f716786b4d73994a246e46bd8883144fec3de600080a3565b73ffffffffffffffffffffffffffffffffffffffff815416330361032e57600101827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f9aaa5d10320026fef8f3a55fb68f716786b4d73994a246e46bd8883144fec3de600080a3565b63ffffffff16620f4240039063ffffffff8211611a2f57565b67ffffffffffffffff81116143125760051b60200190565b3563ffffffff811681036102225790565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610222570180359067ffffffffffffffff82116102225760200191813603831361022257565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b90813580600052600360205260406000209063ffffffff600283015460a01c16614a52576149fb9150614d2d565b73ffffffffffffffffffffffffffffffffffffffff815416330361032e578073ffffffffffffffffffffffffffffffffffffffff614a4260406005600695015496016144ab565b1660005201602052604060002090565b5073ffffffffffffffffffffffffffffffffffffffff815416330361032e578073ffffffffffffffffffffffffffffffffffffffff614a4260406004600695015496016144ab565b906000823580825260036020526040822063ffffffff600282015460a01c16614b1f5750614ac88291614d2d565b91614af757508073ffffffffffffffffffffffffffffffffffffffff614a4260406005600695015496016144ab565b807fee90c4680000000000000000000000000000000000000000000000000000000060049252fd5b90506006915073ffffffffffffffffffffffffffffffffffffffff614a426040600484015496016144ab565b91908203918211611a2f57565b91908201809211611a2f57565b90600182811c92168015614bae575b6020831014614b7f57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691614b74565b9060405191826000825492614bcc84614b65565b8084529360018116908115614c3a5750600114614bf3575b50614bf19250038361437a565b565b90506000929192526020600020906000915b818310614c1e575050906020614bf19282010138614be4565b6020919350806001915483858901015201910190918492614c05565b60209350614bf19592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b82010138614be4565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff90921660248301526044820192909252614bf191614d0182606481015b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810184528361437a565b614d7a565b805182101561447c5760209160051b010190565b81810292918115918404141715611a2f57565b6000526009602052604060002063ffffffff600182015460a01c1615614d505790565b7ff456b6590000000000000000000000000000000000000000000000000000000060005260046000fd5b906000602091828151910182855af115614e05576000513d614dfc575073ffffffffffffffffffffffffffffffffffffffff81163b155b614db85750565b73ffffffffffffffffffffffffffffffffffffffff907f5274afe7000000000000000000000000000000000000000000000000000000006000521660045260246000fd5b60011415614db1565b6040513d6000823e3d90fd5b63ffffffff169142831115614eba5763ffffffff1682019063ffffffff8211611a2f5763ffffffff80911691168110614e9057039063ffffffff8211611a2f5763ffffffff1663ffffffff821611614e665790565b7f9529f5060000000000000000000000000000000000000000000000000000000060005260046000fd5b7f25c363670000000000000000000000000000000000000000000000000000000060005260046000fd5b7fccfcc0ce0000000000000000000000000000000000000000000000000000000060005260046000fd5b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff92831660248201529290911660448301526064820192909252614bf191614d018260848101614cd5565b90614f8b5750805115614f6157805190602001fd5b7fd6bda2750000000000000000000000000000000000000000000000000000000060005260046000fd5b81511580614fe0575b614f9c575090565b73ffffffffffffffffffffffffffffffffffffffff907f9996b315000000000000000000000000000000000000000000000000000000006000521660045260246000fd5b50803b15614f9456fea2646970667358221220f53524f3cb21e2017c71feb3081a3de49ac1c13ffe0e72a166ef2851b4b97e5864736f6c634300081c0033
Deployed Bytecode
0x61014080604052600436101561001457600080fd5b60003560e01c908163050f4a751461416d57508063052fe61e146140205780630668045c14613d5b57806318833b1714613cf65780631ab971ab14613c145780631bf844e0146139875780631dc37ed9146135a95780632c8d7bc5146133b457806339f3680814612fdc5780634a74c98614612ecd5780634f1ef28614612b4f57806352d1902d14612a8f5780636b9c439d146127e65780637271518a14612744578063753097d3146126155780637746436c146125d057806379ba5097146124ef5780637e0b24921461248a57806382134cb814612344578063857a6fe314612105578063875745101461203e5780638da5cb5b14611fe957806393efdfb114611ed45780639582d0b014611e6f5780639d54f41914611d7f5780639dc714a914611d45578063ad3cb1cc14611cc4578063af576f1e14611c82578063d498fbbb14611b47578063ddca3f4314611b02578063df034cd014611ab0578063e30c397814611a5e578063ed11125914610514578063ee0cf00814610382578063f2fde38b14610268578063f88cc1d3146102275763feba1ed2146101b757600080fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff6102036141a9565b166000526004602052602063ffffffff60406000205416604051908152f35b600080fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602060ff600054166040519015158152f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff6102b46141a9565b1680156103585773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e57807fffffffffffffffffffffffff000000000000000000000000000000000000000060015416176001557fcfaaa26691e16e66e73290fc725eee1a6b4e0e693a1640484937aac25ffb55a4600080a2005b7fee90c4680000000000000000000000000000000000000000000000000000000060005260046000fd5b7f5ee32a240000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff8111610222573660238201121561022257806004013567ffffffffffffffff81116102225736602460608302840101116102225773ffffffffffffffffffffffffffffffffffffffff60025416330361032e5760005b8181101561051257600060608202840160448101359081156104ea5760648101359081156104c2576001949392827f23751ab362cbd3dea851dbf2e3f3517528ad9aa61b62acc00d2c113dce0b5d619360406024819501359687815260036020522063ffffffff600282015460a01c1615156000146104a95780846004600593015501555b82519182526020820152a201610413565b5060046104b587614d2d565b8460058201550155610498565b6004847fc922446b000000000000000000000000000000000000000000000000000000008152fd5b6004837fb263ae73000000000000000000000000000000000000000000000000000000008152fd5b005b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff811161022257610563903690600401614234565b60243567ffffffffffffffff811161022257610583903690600401614234565b91906002549233600052600460205263ffffffff604060002054169163ffffffff6105ad846148fb565b1663ffffffff8660a01c160267ffffffffffffffff811660e05260e05103611a2f5785849286926000935b8585101561012052610120516111fd576000610120528460051b840135957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4185360301871215610ce35760c0878601360312610ce3576040516101005260c0610100510161010051811067ffffffffffffffff8211176110b857604052610660878601614223565b6101005152610673602088870101614223565b6020610100510152610689604088870101614223565b604061010051015267ffffffffffffffff6060888701013511610ce3576106b8368689016060810135016143f5565b606061010051015260808786010135608061010051015260a0878601013567ffffffffffffffff8111610ce35736601f828a890101011215610ce357610702818988010135614914565b90610710604051928361437a565b86890181018035808452602080850193923660069390931b010111610ce3576020818b8a010101915b888b018201803560061b0160200183106111b15750505060a061010051015261078a63ffffffff6101005151168360e01c9063ffffffff8560c01c169063ffffffff60206101005101511690614e11565b60a05260a0610100510151511561118357600560a061010051015151116111555763ffffffff61010051511663ffffffff6020610100510151169063ffffffff6040610100510151169060606101005101519161081f60806101005101519360a06101005101519260405196879533602088015260408701526060860152608085015260e060a0850152610100840190614265565b9260c08301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08284030160e08301526020808251948581520191019261012051905b80821061111957505061089c9250037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261437a565b602081519101209788610120515260096020526040610120512060c05263ffffffff600160c051015460a01c166110eb5760c0805180547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317815561010051805160019092018054602083015160408401517fffffffff0000000000000000000000000000000000000000000000000000000060e09190911b167bffffffff0000000000000000000000000000000000000000000000009190961b1660a09490941b77ffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90911617929092179290921790556060015180519067ffffffffffffffff82116110b85781906109c4600260c0510154614b65565b601f811161105d575b506020906001601f841114610f88576101205192610f7d575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c191617600260c05101555b6080610100510151600360c05101557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0610a7d60a061010051015151610a73610a6582614914565b60405160805260805161437a565b8060805152614914565b01610120515b818110610f49575050610120515b60a06101005101518051821015610e255781610aac91614d06565b519073ffffffffffffffffffffffffffffffffffffffff825116918215610df757602001518015610c8a57826101205152600660205260406101205120548015610dc95781610e10810204610e1003610d965760a05163ffffffff1615610d635763ffffffff60a05116610e1083020410610d3557604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481875afa918215610cf2576101205192610d00575b50610b7590303386614ee4565b604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481875afa8015610cf2576101205190610cb8575b610bc59250614b4b565b8015610c8a5773ffffffffffffffffffffffffffffffffffffffff600193610c07620f4240610bfe63ffffffff8260e051041686614d1a565b04938490614b4b565b92816101205152600560205260406101205120610c25828254614b58565b905560405190610c348261435e565b8282528460208301526040820152610c4e85608051614d06565b52610c5b84608051614d06565b506101205150166101205152600660c05101602052610c8260406101205120918254614b58565b905501610a91565b7fea1083a7000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b506020823d8211610cea575b81610cd16020938361437a565b81010312610ce357610bc59151610bbb565b6101205180fd5b3d9150610cc4565b6040513d61012051823e3d90fd5b9091506020813d8211610d2d575b81610d1b6020938361437a565b81010312610ce3575190610b75610b68565b3d9150610d0e565b7f1552aa13000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b7f4e487b710000000000000000000000000000000000000000000000000000000061012051526012600452602461012051fd5b7f4e487b710000000000000000000000000000000000000000000000000000000061012051526011600452602461012051fd5b7ff19162c8000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b7f8bc1b2d9000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b505094979690959196610e39828a0161492c565b6080610e9a8b63ffffffff80610e5360208985010161492c565b92610e72610e6560408b84010161492c565b918a01606081019061493d565b939094816040519916895216602088015216604086015260c0606086015260c085019161498e565b938b010135608082015280830360a08201526020608051519384815201926020608051019061012051905b808210610f0757505050907f0efde060d5a9444064df062f955bb37a49a4d4b6728fdb160e9534f8f6fd35f082600195949333940390a30193949592956105d8565b909194602060606001926040895173ffffffffffffffffffffffffffffffffffffffff8151168352848101518584015201516040820152019601920190610ec5565b602090604051610f588161435e565b6101205181526101205183820152610120516040820152828260805101015201610a83565b015190508b806109e6565b9250600260c0510161012051528061012051209061012051935b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0841685106110425760019450837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081161061100b575b505050811b01600260c0510155610a1d565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c191690558b8080610ff9565b81810151835560209485019460019093019290910190610fa2565b909150600260c05101610120515260206101205120601f840160051c8101602085106110b1575b90849392915b601f830160051c820181106110a05750506109cd565b61012051815585945060010161108a565b5080611084565b7f4e487b710000000000000000000000000000000000000000000000000000000061012051526041600452602461012051fd5b7f23369fa6000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b916001919350604060209182875173ffffffffffffffffffffffffffffffffffffffff8151168352015183820152019401920184929391610862565b7f850d01c2000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b7f3fb087f4000000000000000000000000000000000000000000000000000000006101205152600461012051fd5b604083360312610ce35760405190604082019082821067ffffffffffffffff8311176110b85760409260209284526111e8866141ef565b81528286013583820152815201920191610739565b86935060005b838110156105125760008160051b840135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff21853603018212156119ff5760e08286013603126119ff576040519060e0820182811067ffffffffffffffff821117611a0257604052611276838701614223565b8252611286602084880101614223565b6020830152611299604084880101614223565b604083015267ffffffffffffffff60608488010135116119ff576112c5368785016060810135016143f5565b60608301528583016080818101359084015260a080820135908401526112ed9060c0016141ef565b60c083015261131e63ffffffff8351168660e01c9063ffffffff8860c01c169063ffffffff60208701511690614e11565b60a0830151156119d75773ffffffffffffffffffffffffffffffffffffffff60c0840151168252600760205260408220549081156119af57610e10611371620f42409363ffffffff611387941690614d1a565b0463ffffffff6113808c6148fb565b1690614d1a565b049063ffffffff83511663ffffffff60208501511661142563ffffffff6040870151169160608701516080880151906113ee60a08a0151916040519687956020870199338b5260408801526060870152608086015260e060a0860152610100850190614265565b9160c084015260e0830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261437a565b51902092838252600a6020526040822063ffffffff600182015460a01c166119875780547fffffffffffffffffffffffff00000000000000000000000000000000000000001633178155815160018201805460208501517bffffffff00000000000000000000000000000000000000000000000060c09190911b1660a09390931b77ffffffff0000000000000000000000000000000000000000167fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff9091161791909117905561154a63ffffffff60408401511660018301907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffff0000000000000000000000000000000000000000000000000000000083549260e01b169116179055565b60608201518051600283019167ffffffffffffffff821161195a5761156f8354614b65565b601f8111611915575b50602090601f831160011461185457918073ffffffffffffffffffffffffffffffffffffffff96949260c096948992611849575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790555b60808201516003820155600460a08301519101550151166040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa90811561183e578391611809575b5061164584303385614ee4565b604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481865afa80156117fe5784906117c5575b6116929250614b4b565b92831061179d578152600560205260409020818154906116b191614b58565b90556116be86840161492c565b906116cd60208886010161492c565b6116db60408987010161492c565b6116eb868a01606081019061493d565b90916116fb60c08c8a01016144ab565b936040519663ffffffff16875263ffffffff16602087015263ffffffff1660408601526060850161010090526101008501906117369261498e565b94808901608001356080850152880160a0013560a084015273ffffffffffffffffffffffffffffffffffffffff1660c083015260e0820152803393037f2fafd63d31ff9c46627f7b322dc27dac620bf76f6594cf9c2f2f1146b9a8180291a3600101611203565b6004827fdebabab5000000000000000000000000000000000000000000000000000000008152fd5b50906020813d82116117f6575b816117df6020938361437a565b810103126117f257906116929151611688565b8380fd5b3d91506117d2565b6040513d86823e3d90fd5b90506020813d8211611836575b816118236020938361437a565b8101031261183257518b611638565b8280fd5b3d9150611816565b6040513d85823e3d90fd5b0151905038806115ac565b8387528187209c9e9d9c91907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08416885b8181106118fd5750929e9f9d9e600192859260c0989673ffffffffffffffffffffffffffffffffffffffff9a9896106118c6575b505050811b0190556115de565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c191690553880806118b9565b92936020600181928786015181550195019301611885565b83875260208720601f840160051c81019160208510611950575b601f0160051c01905b8181106119455750611578565b878155600101611938565b909150819061192f565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6004837f23369fa6000000000000000000000000000000000000000000000000000000008152fd5b6004837fc4e3f981000000000000000000000000000000000000000000000000000000008152fd5b6004827f02f46144000000000000000000000000000000000000000000000000000000008152fd5b80fd5b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602063ffffffff60025460a01c16604051908152f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043580600052600360205273ffffffffffffffffffffffffffffffffffffffff604060002054168015611c57575b73ffffffffffffffffffffffffffffffffffffffff811615611c2c575b73ffffffffffffffffffffffffffffffffffffffff811615611c00575b60209073ffffffffffffffffffffffffffffffffffffffff60405191168152f35b50600052600a602052602073ffffffffffffffffffffffffffffffffffffffff60406000205416611bdf565b5080600052600860205273ffffffffffffffffffffffffffffffffffffffff60406000205416611bc2565b5080600052600960205273ffffffffffffffffffffffffffffffffffffffff60406000205416611ba5565b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257610512611cbc6141cc565b6004356146e2565b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257611d416040805190611d05818361437a565b600582527f352e302e30000000000000000000000000000000000000000000000000000000602083015251918291602083526020830190614265565b0390f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225761051260043561455f565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257611db66141a9565b73ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e5773ffffffffffffffffffffffffffffffffffffffff168015611e4557807fffffffffffffffffffffffff000000000000000000000000000000000000000060025416176002557fab7cdaa9124eb37f7ce2c2a0733d8da0aded711ef366856b758d42288db39608600080a2005b7f314be0410000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff611ebb6141a9565b1660005260076020526020604060002054604051908152f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257611f0b614210565b6002549063ffffffff811663ffffffff8360c01c16811115611fbf5773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e577fb7ac6fa77a86c0d5c6535cf95824472c583dc3d685abb9073ee47a3a80c58dc8927bffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffff0000000000000000000000000000000000000000000000000000000060209460e01b16911617600255604051908152a1005b7fc121eafd0000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602073ffffffffffffffffffffffffffffffffffffffff60005460081c16604051908152f35b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610222576004356120786141cc565b600082815260036020526040812060028101549293909260a01c63ffffffff16156120d057505073ffffffffffffffffffffffffffffffffffffffff600692166000520160205260206040600020545b604051908152f35b604092509273ffffffffffffffffffffffffffffffffffffffff60066120f7602096614d2d565b0191168252835220546120c8565b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff8111610222576121549036906004016142c4565b9060243567ffffffffffffffff8111610222576121759036906004016142c4565b91909273ffffffffffffffffffffffffffffffffffffffff60025416330361032e5760005b81811061227a5750505060005b8181106121b057005b6121bb818385614511565b9073ffffffffffffffffffffffffffffffffffffffff6121da836144ab565b161561225057817f3d38439713a3af86a496adf9d3098044ff419709caf9c869bd883dd4ef3603ab602073ffffffffffffffffffffffffffffffffffffffff612241826001970135948261222d826144ab565b1660005260078452856040600020556144ab565b1692604051908152a2016121a7565b7f98cbacf40000000000000000000000000000000000000000000000000000000060005260046000fd5b612285818385614511565b9073ffffffffffffffffffffffffffffffffffffffff6122a4836144ab565b161561231a57817fa75af3afb29424186de45575e8791e7f3cbcdcdaca644d37f8ae1a83884ce504602073ffffffffffffffffffffffffffffffffffffffff61230b82600197013594826122f7826144ab565b1660005260068452856040600020556144ab565b1692604051908152a20161219a565b7f8bc1b2d90000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043580600052600360205273ffffffffffffffffffffffffffffffffffffffff60016040600020015416801561245c575b73ffffffffffffffffffffffffffffffffffffffff81161561242e575b73ffffffffffffffffffffffffffffffffffffffff8116156123ff5760209073ffffffffffffffffffffffffffffffffffffffff60405191168152f35b50600052600a602052602073ffffffffffffffffffffffffffffffffffffffff60016040600020015416611bdf565b5080600052600860205273ffffffffffffffffffffffffffffffffffffffff600160406000200154166123c2565b5080600052600960205273ffffffffffffffffffffffffffffffffffffffff600160406000200154166123a5565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff6124d66141a9565b1660005260056020526020604060002054604051908152f35b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760015473ffffffffffffffffffffffffffffffffffffffff8116330361032e577fffffffffffffffffffffffff0000000000000000000000000000000000000000166001556000547fffffffffffffffffffffff0000000000000000000000000000000000000000ff74ffffffffffffffffffffffffffffffffffffffff003360081b16911617600055337f7f877120c72766f4eac00144c86c9e57ed52f31bac01ef5c4c223c4768a87673600080a2005b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257602063ffffffff60025460c01c16604051908152f35b346102225760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043561264f6141cc565b6044359073ffffffffffffffffffffffffffffffffffffffff82168203610222576000838152600360205260408120600281015490949060a01c63ffffffff16156126ec57505060019273ffffffffffffffffffffffffffffffffffffffff600692166000520160205273ffffffffffffffffffffffffffffffffffffffff60406000209116600052016020526020604060002054604051908152f35b60209450926001919273ffffffffffffffffffffffffffffffffffffffff6006612717604097614d2d565b0191168452855273ffffffffffffffffffffffffffffffffffffffff8484209116835201835220546120c8565b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760005473ffffffffffffffffffffffffffffffffffffffff8160081c16330361032e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060019116176000557fa3aea98f3e0c1ad37415094751fd63facd254081ba9f95e0354ca75a56f001a8600080a1005b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257600435612820614521565b506000818152600860205260408120600281015460a081901c63ffffffff169390929084156129a157505073ffffffffffffffffffffffffffffffffffffffff8154169263ffffffff73ffffffffffffffffffffffffffffffffffffffff600184015416936040519273ffffffffffffffffffffffffffffffffffffffff82166020850152602084526128b460408561437a565b6004600386015495015495604051976128cc89614341565b88526020880152604087015260c01c1660608501526001608085015260a084015260c083015260e08201525b60405180916020825273ffffffffffffffffffffffffffffffffffffffff815116602083015273ffffffffffffffffffffffffffffffffffffffff602082015116604083015263ffffffff604082015116606083015263ffffffff606082015116608083015263ffffffff60808201511660a083015260e061298b60a083015161010060c0860152610120850190614265565b9160c08101518285015201516101008301520390f35b92509250506129ae614521565b508152600a60205260408120600181019163ffffffff835460a01c1615612a67575073ffffffffffffffffffffffffffffffffffffffff815416915490612a53600260038301549260048101549460405196612a0988614341565b875273ffffffffffffffffffffffffffffffffffffffff8116602088015263ffffffff8160a01c16604088015263ffffffff8160c01c16606088015260e01c608087015201614bb8565b60a084015260c083015260e08201526128f8565b807ff456b6590000000000000000000000000000000000000000000000000000000060049252fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003325a167da3130d7788e41f614c725c11dceb5e7163003612b255760206040517f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8152f35b7fe07c8dba0000000000000000000000000000000000000000000000000000000060005260046000fd5b60407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257612b816141a9565b60243567ffffffffffffffff811161022257612ba19036906004016143f5565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003325a167da3130d7788e41f614c725c11dceb5e716803014908115612e8b575b50612b255760005473ffffffffffffffffffffffffffffffffffffffff8160081c16330361032e5760ff16612e615773ffffffffffffffffffffffffffffffffffffffff8216916040517f52d1902d000000000000000000000000000000000000000000000000000000008152602081600481875afa60009181612e2d575b50612c9557837f4c9c8ce30000000000000000000000000000000000000000000000000000000060005260045260246000fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc859203612e005750813b15612dd357807fffffffffffffffffffffffff00000000000000000000000000000000000000007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416177f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115612da05760008083602061051295519101845af43d15612d98573d91612d7b836143bb565b92612d89604051948561437a565b83523d6000602085013e614f4c565b606091614f4c565b505034612da957005b7fb398979f0000000000000000000000000000000000000000000000000000000060005260046000fd5b7f4c9c8ce30000000000000000000000000000000000000000000000000000000060005260045260246000fd5b7faa1d49a40000000000000000000000000000000000000000000000000000000060005260045260246000fd5b9091506020813d602011612e59575b81612e496020938361437a565b8101031261022257519085612c62565b3d9150612e3c565b7fbadff5aa0000000000000000000000000000000000000000000000000000000060005260046000fd5b905073ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416141583612be3565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257612f04614210565b6002549063ffffffff81168260e01c811015612fb25773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e577f4f244688ec43896a794ca98fe032b2e2c185ba37f6096270287c6fdbfb8bac80927fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff7bffffffff00000000000000000000000000000000000000000000000060209460c01b16911617600255604051908152a1005b7fbe7612750000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff81116102225761302b903690600401614234565b3391600091905b81831061303b57005b61304683838361443c565b9261305084614a9a565b600095919596608083019173ffffffffffffffffffffffffffffffffffffffff613079846144ab565b161561338c57604084019073ffffffffffffffffffffffffffffffffffffffff6130a2836144ab565b1615613364576060850135801561330c576130bc836144ab565b604051613128816130fc856020830195338773ffffffffffffffffffffffffffffffffffffffff6040929594938160608401971683521660208201520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261437a565b519020604051602081019182526020815261314460408261437a565b5190209960208701357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1883603018112156133605787019889359b67ffffffffffffffff8d1161335c578c60051b360360208c011361335c57908d8d9281935b8410156131e357600191604091600586901b8f016020013590818110156131d7578252602052205b9201918e908e6131a4565b908252602052206131cc565b9394979c9b50509b5050036133345761320c6001820193898c528460205260408c205490614b4b565b92831561330c57815484116132e4576132aa7f3fa6b189a815480521fe4e23f131707277c85fc420963a3302bae180a88e7c76949373ffffffffffffffffffffffffffffffffffffffff9360408e8d9e9f9560019d9e6132b09750825260205220613278878254614b58565b9055613285868254614b4b565b90556132a58585613295846144ab565b1661329f8a6144ab565b90614c7a565b6144ab565b946144ab565b6040805173ffffffffffffffffffffffffffffffffffffffff969096168652602086019390935216933592a3019192613032565b60048b7fd98dd18a000000000000000000000000000000000000000000000000000000008152fd5b60048b7f1f2a2005000000000000000000000000000000000000000000000000000000008152fd5b60048a7f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8d80fd5b8c80fd5b60048a7f8bc1b2d9000000000000000000000000000000000000000000000000000000008152fd5b6004897f96bbcf1e000000000000000000000000000000000000000000000000000000008152fd5b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff8111610222576134039036906004016142c4565b73ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e5760005b81811061343157005b61343c818385614511565b9073ffffffffffffffffffffffffffffffffffffffff61345b836144ab565b161561231a576020820173ffffffffffffffffffffffffffffffffffffffff613483826144ab565b161561357f5773ffffffffffffffffffffffffffffffffffffffff6134a7846144ab565b1660005260056020526040600020549283156135555760019373ffffffffffffffffffffffffffffffffffffffff6135256132aa84836135077f41dea50ce5a7d417f4aae9d7ca5faa6c6f8934bd2a9581495ddd9a309d215c38976144ab565b166000526005602052600060408120556132a58585613295846144ab565b6040805173ffffffffffffffffffffffffffffffffffffffff96909616865260208601939093521692a201613428565b7f1f2a20050000000000000000000000000000000000000000000000000000000060005260046000fd5b7f96bbcf1e0000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610222576135e06141a9565b6135e86141cc565b6044359163ffffffff8316808403610222576064359063ffffffff821690818303610222576084359163ffffffff831691828403610222577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00549760ff8960401c16159867ffffffffffffffff81168015908161397f575b6001149081613975575b15908161396c575b50613942578960017fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008316177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00556138ed575b5073ffffffffffffffffffffffffffffffffffffffff87169788156103585773ffffffffffffffffffffffffffffffffffffffff16948515611e4557620f42408310156138c35784841015612fb2577fffffffff000000000000000000000000000000000000000000000000000000006080977f91ce78817967eee157b4513c68d41b1d338199e48dc2156ba719a5aa5e7a3f0e997fffffffffffffffffffffff0000000000000000000000000000000000000000ff74ffffffffffffffffffffffffffffffffffffffff006000549260081b169116176000557bffffffff0000000000000000000000000000000000000000000000007fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff8977ffffffff0000000000000000000000000000000000000000806002549860a01b16971617169160c01b16179160e01b161717600255604051938452602084015260408301526060820152a261383057005b7fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054167ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b7f58d620b30000000000000000000000000000000000000000000000000000000060005260046000fd5b7fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001668010000000000000001177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0055896136c5565b7ff92ee8a90000000000000000000000000000000000000000000000000000000060005260046000fd5b9050158b613672565b303b15915061366a565b8b9150613660565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610222576004356139c16144cc565b50806000526003602052604060002060028101549063ffffffff8260a01c1692831515600014613b59575073ffffffffffffffffffffffffffffffffffffffff8154169273ffffffffffffffffffffffffffffffffffffffff6001830154169263ffffffff6040519173ffffffffffffffffffffffffffffffffffffffff8116602084015260208352613a5560408461437a565b600385015493600460058701549601549660405198613a738a6142f5565b89526020890152604088015260c01c1660608601526001608086015260a085015260c084015260e08301526101008201525b60405180916020825273ffffffffffffffffffffffffffffffffffffffff815116602083015273ffffffffffffffffffffffffffffffffffffffff602082015116604083015263ffffffff604082015116606083015263ffffffff606082015116608083015263ffffffff60808201511660a0830152610100613b3960a083015161012060c0860152610140850190614265565b9160c081015160e085015260e08101518285015201516101208301520390f35b915050613b6f9150613b696144cc565b50614d2d565b73ffffffffffffffffffffffffffffffffffffffff8154169060018101546003820154613bfa600260058501549460048101549460405197613bb0896142f5565b885273ffffffffffffffffffffffffffffffffffffffff8116602089015263ffffffff8160a01c16604089015263ffffffff8160c01c16606089015260e01c608088015201614bb8565b60a085015260c084015260e0830152610100820152613aa5565b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022257613c4b614210565b63ffffffff811690620f42408210156138c35773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e577f30dc86d30347102db8696c3066af2ceb70df72cdadb040dda215116f82d542e3916020917fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff77ffffffff00000000000000000000000000000000000000006002549260a01b16911617600255604051908152a1005b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225773ffffffffffffffffffffffffffffffffffffffff613d426141a9565b1660005260066020526020604060002054604051908152f35b346102225760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760043567ffffffffffffffff811161022257613daa903690600401614234565b6000918291905b818410613dba57005b613dc584838361443c565b93613dcf856149cd565b60009691608083019173ffffffffffffffffffffffffffffffffffffffff613df6846144ab565b161561338c57604084019073ffffffffffffffffffffffffffffffffffffffff613e1f836144ab565b161561336457606085013592831561330c578a73ffffffffffffffffffffffffffffffffffffffff613e9f613e53866144ab565b8d60405193849260208401965060608701928752166020860152886040860152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261437a565b5190206040516020810191825260208152613ebb60408261437a565b5190209960208701357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1883603018112156133605787019889359b67ffffffffffffffff8d1161335c578c60051b360360208c011361335c57918d8d9381945b851015613f5a57600191604091600587901b8f01602001359081811015613f4e578252602052205b9301928e908e613f1b565b90825260205220613f43565b9350509a99509a500361333457613f8160018201938b80528460205260408c205490614b4b565b92831561330c57815484116132e4576132aa7f03c5002e770148ba7c24b504bb299021b4fe653920794a028690d23afaf5a4e5949373ffffffffffffffffffffffffffffffffffffffff9360408e60019c9d9e9f95613fed965081805260205220613278878254614b58565b6040805173ffffffffffffffffffffffffffffffffffffffff969096168652602086019390935216933592a30192613db1565b346102225760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610222576140576141a9565b6024359063ffffffff82168092036102225773ffffffffffffffffffffffffffffffffffffffff1690811561414357620f424081116141195773ffffffffffffffffffffffffffffffffffffffff60005460081c16330361032e57816040917f9aeadd7d8692e2850dbe9380d1382a551843165e6d34174fa471c18b329ed0cc93600052600460205282600020817fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000082541617905582519182526020820152a1005b7f8360a59d0000000000000000000000000000000000000000000000000000000060005260046000fd5b7f595fdd890000000000000000000000000000000000000000000000000000000060005260046000fd5b346102225760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102225760209060025460e01c8152f35b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361022257565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361022257565b359073ffffffffffffffffffffffffffffffffffffffff8216820361022257565b6004359063ffffffff8216820361022257565b359063ffffffff8216820361022257565b9181601f840112156102225782359167ffffffffffffffff8311610222576020808501948460051b01011161022257565b919082519283825260005b8481106142af5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b80602080928401015182828601015201614270565b9181601f840112156102225782359167ffffffffffffffff8311610222576020808501948460061b01011161022257565b610120810190811067ffffffffffffffff82111761431257604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610100810190811067ffffffffffffffff82111761431257604052565b6060810190811067ffffffffffffffff82111761431257604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761431257604052565b67ffffffffffffffff811161431257601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f820112156102225780359061440c826143bb565b9261441a604051948561437a565b8284526020838301011161022257816000926020809301838601378301015290565b919081101561447c5760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6181360301821215610222570190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b3573ffffffffffffffffffffffffffffffffffffffff811681036102225790565b604051906144d9826142f5565b600061010083828152826020820152826040820152826060820152826080820152606060a08201528260c08201528260e08201520152565b919081101561447c5760061b0190565b6040519061452e82614341565b600060e083828152826020820152826040820152826060820152826080820152606060a08201528260c08201520152565b806000526003602052604060002073ffffffffffffffffffffffffffffffffffffffff8154166146345750806000526009602052604060002073ffffffffffffffffffffffffffffffffffffffff8154166146345750806000526008602052604060002073ffffffffffffffffffffffffffffffffffffffff815416614634575080600052600a602052604060002073ffffffffffffffffffffffffffffffffffffffff815416614634577ff456b6590000000000000000000000000000000000000000000000000000000060005260046000fd5b60018101805473ffffffffffffffffffffffffffffffffffffffff8116330361032e577fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff33167fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905533907f68f4d4d7a7c798d3a589e9f6941fe62fa592974dd92d57b5f46717bc8c5af810600080a3565b9073ffffffffffffffffffffffffffffffffffffffff1690811561035857806000526003602052604060002063ffffffff600282015460a01c1661488b57508060005260096020526040600020600181019063ffffffff825460a01c1661481f575050806000526008602052604060002073ffffffffffffffffffffffffffffffffffffffff815416806147c757505080600052600a602052604060002073ffffffffffffffffffffffffffffffffffffffff815416806147c7577ff456b6590000000000000000000000000000000000000000000000000000000060005260046000fd5b330361032e57600101827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f9aaa5d10320026fef8f3a55fb68f716786b4d73994a246e46bd8883144fec3de600080a3565b5473ffffffffffffffffffffffffffffffffffffffff16330361032e57827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f9aaa5d10320026fef8f3a55fb68f716786b4d73994a246e46bd8883144fec3de600080a3565b73ffffffffffffffffffffffffffffffffffffffff815416330361032e57600101827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f9aaa5d10320026fef8f3a55fb68f716786b4d73994a246e46bd8883144fec3de600080a3565b63ffffffff16620f4240039063ffffffff8211611a2f57565b67ffffffffffffffff81116143125760051b60200190565b3563ffffffff811681036102225790565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610222570180359067ffffffffffffffff82116102225760200191813603831361022257565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b90813580600052600360205260406000209063ffffffff600283015460a01c16614a52576149fb9150614d2d565b73ffffffffffffffffffffffffffffffffffffffff815416330361032e578073ffffffffffffffffffffffffffffffffffffffff614a4260406005600695015496016144ab565b1660005201602052604060002090565b5073ffffffffffffffffffffffffffffffffffffffff815416330361032e578073ffffffffffffffffffffffffffffffffffffffff614a4260406004600695015496016144ab565b906000823580825260036020526040822063ffffffff600282015460a01c16614b1f5750614ac88291614d2d565b91614af757508073ffffffffffffffffffffffffffffffffffffffff614a4260406005600695015496016144ab565b807fee90c4680000000000000000000000000000000000000000000000000000000060049252fd5b90506006915073ffffffffffffffffffffffffffffffffffffffff614a426040600484015496016144ab565b91908203918211611a2f57565b91908201809211611a2f57565b90600182811c92168015614bae575b6020831014614b7f57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691614b74565b9060405191826000825492614bcc84614b65565b8084529360018116908115614c3a5750600114614bf3575b50614bf19250038361437a565b565b90506000929192526020600020906000915b818310614c1e575050906020614bf19282010138614be4565b6020919350806001915483858901015201910190918492614c05565b60209350614bf19592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b82010138614be4565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff90921660248301526044820192909252614bf191614d0182606481015b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810184528361437a565b614d7a565b805182101561447c5760209160051b010190565b81810292918115918404141715611a2f57565b6000526009602052604060002063ffffffff600182015460a01c1615614d505790565b7ff456b6590000000000000000000000000000000000000000000000000000000060005260046000fd5b906000602091828151910182855af115614e05576000513d614dfc575073ffffffffffffffffffffffffffffffffffffffff81163b155b614db85750565b73ffffffffffffffffffffffffffffffffffffffff907f5274afe7000000000000000000000000000000000000000000000000000000006000521660045260246000fd5b60011415614db1565b6040513d6000823e3d90fd5b63ffffffff169142831115614eba5763ffffffff1682019063ffffffff8211611a2f5763ffffffff80911691168110614e9057039063ffffffff8211611a2f5763ffffffff1663ffffffff821611614e665790565b7f9529f5060000000000000000000000000000000000000000000000000000000060005260046000fd5b7f25c363670000000000000000000000000000000000000000000000000000000060005260046000fd5b7fccfcc0ce0000000000000000000000000000000000000000000000000000000060005260046000fd5b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff92831660248201529290911660448301526064820192909252614bf191614d018260848101614cd5565b90614f8b5750805115614f6157805190602001fd5b7fd6bda2750000000000000000000000000000000000000000000000000000000060005260046000fd5b81511580614fe0575b614f9c575090565b73ffffffffffffffffffffffffffffffffffffffff907f9996b315000000000000000000000000000000000000000000000000000000006000521660045260246000fd5b50803b15614f9456fea2646970667358221220f53524f3cb21e2017c71feb3081a3de49ac1c13ffe0e72a166ef2851b4b97e5864736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.