This nametag was submitted by Kleros Scout.
Latest 25 from a total of 79,943 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Execute | 24585427 | 2 mins ago | IN | 0 ETH | 0.00030904 | ||||
| Execute | 24585423 | 3 mins ago | IN | 0 ETH | 0.0001238 | ||||
| Execute | 24585393 | 9 mins ago | IN | 0 ETH | 0.0003211 | ||||
| Execute | 24585388 | 10 mins ago | IN | 0 ETH | 0.00016619 | ||||
| Execute | 24585354 | 17 mins ago | IN | 0 ETH | 0.0002859 | ||||
| Execute | 24585345 | 19 mins ago | IN | 0 ETH | 0.00014837 | ||||
| Execute | 24585336 | 20 mins ago | IN | 0 ETH | 0.00037626 | ||||
| Execute | 24585326 | 22 mins ago | IN | 0 ETH | 0.00036172 | ||||
| Execute | 24585250 | 38 mins ago | IN | 0 ETH | 0.0008745 | ||||
| Execute | 24585232 | 41 mins ago | IN | 0 ETH | 0.00095442 | ||||
| Execute | 24585229 | 42 mins ago | IN | 0 ETH | 0.00035864 | ||||
| Execute | 24585200 | 48 mins ago | IN | 0 ETH | 0.00079138 | ||||
| Execute | 24585196 | 48 mins ago | IN | 0 ETH | 0.00107194 | ||||
| Execute | 24585165 | 55 mins ago | IN | 0 ETH | 0.00052443 | ||||
| Execute | 24585162 | 55 mins ago | IN | 0 ETH | 0.00049054 | ||||
| Execute | 24584898 | 1 hr ago | IN | 0 ETH | 0.00025543 | ||||
| Execute | 24584895 | 1 hr ago | IN | 0 ETH | 0.00014139 | ||||
| Execute | 24584811 | 2 hrs ago | IN | 0 ETH | 0.00047023 | ||||
| Execute | 24584802 | 2 hrs ago | IN | 0 ETH | 0.00017644 | ||||
| Execute | 24584716 | 2 hrs ago | IN | 0 ETH | 0.00018278 | ||||
| Execute | 24584702 | 2 hrs ago | IN | 0 ETH | 0.0000586 | ||||
| Execute | 24584700 | 2 hrs ago | IN | 0 ETH | 0.0001329 | ||||
| Execute | 24584694 | 2 hrs ago | IN | 0 ETH | 0.00008017 | ||||
| Execute | 24584691 | 2 hrs ago | IN | 0 ETH | 0.00006277 | ||||
| Execute | 24584504 | 3 hrs ago | IN | 0 ETH | 0.0000579 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 24585427 | 2 mins ago | 0.00035017 ETH | ||||
| Transfer | 24585423 | 3 mins ago | 0.00014716 ETH | ||||
| Transfer | 24585388 | 10 mins ago | 0.00019267 ETH | ||||
| Transfer | 24585354 | 17 mins ago | 0.00033369 ETH | ||||
| Transfer | 24585345 | 19 mins ago | 0.00017611 ETH | ||||
| Transfer | 24585336 | 20 mins ago | 0.0004171 ETH | ||||
| Transfer | 24585326 | 22 mins ago | 0.00043237 ETH | ||||
| Transfer | 24585250 | 38 mins ago | 0.00101364 ETH | ||||
| Transfer | 24585232 | 41 mins ago | 0.00108005 ETH | ||||
| Transfer | 24585229 | 42 mins ago | 0.00042631 ETH | ||||
| Transfer | 24585200 | 48 mins ago | 0.0008772 ETH | ||||
| Transfer | 24585196 | 48 mins ago | 0.00125861 ETH | ||||
| Transfer | 24585165 | 55 mins ago | 0.000588 ETH | ||||
| Transfer | 24585162 | 55 mins ago | 0.00054074 ETH | ||||
| Transfer | 24584898 | 1 hr ago | 0.00028536 ETH | ||||
| Transfer | 24584895 | 1 hr ago | 0.00015454 ETH | ||||
| Transfer | 24584811 | 2 hrs ago | 0.00052618 ETH | ||||
| Transfer | 24584802 | 2 hrs ago | 0.00020922 ETH | ||||
| Transfer | 24584716 | 2 hrs ago | 0.000206 ETH | ||||
| Transfer | 24584702 | 2 hrs ago | 0.00006957 ETH | ||||
| Transfer | 24584700 | 2 hrs ago | 0.00015078 ETH | ||||
| Transfer | 24584694 | 2 hrs ago | 0.00009466 ETH | ||||
| Transfer | 24584691 | 2 hrs ago | 0.00006912 ETH | ||||
| Transfer | 24584504 | 3 hrs ago | 0.00006536 ETH | ||||
| Transfer | 24584499 | 3 hrs ago | 0.00006136 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Relayer
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@mimic-fi/v3-smart-vault/contracts/interfaces/ISmartVault.sol';
import '@mimic-fi/v3-tasks/contracts/interfaces/ITask.sol';
import './interfaces/IRelayer.sol';
/**
* @title Relayer
* @dev Relayer used to execute relayed tasks
*/
contract Relayer is IRelayer, Ownable {
using SafeERC20 for IERC20;
// Gas amount charged to cover base costs
uint256 public constant BASE_GAS = 70.5e3;
// Default collector address
address public override defaultCollector;
// List of allowed executors
mapping (address => bool) public override isExecutorAllowed;
// List of native token balances per smart vault
mapping (address => uint256) public override getSmartVaultBalance;
// List of custom collector address per smart vault
mapping (address => address) public override getSmartVaultCollector;
// List of maximum quota to be used per smart vault
mapping (address => uint256) public override getSmartVaultMaxQuota;
// List of used quota per smart vault
mapping (address => uint256) public override getSmartVaultUsedQuota;
/**
* @dev Creates a new Relayer contract
* @param executor Address of the executor that will be allowed to call the relayer
* @param collector Address of the default collector to be set
* @param owner Address that will own the fee collector
*/
constructor(address executor, address collector, address owner) {
_setExecutor(executor, true);
_setDefaultCollector(collector);
_transferOwnership(owner);
}
/**
* @dev Tells the collector address applicable for a smart vault
* @param smartVault Address of the smart vault being queried
*/
function getApplicableCollector(address smartVault) public view override returns (address) {
address customCollector = getSmartVaultCollector[smartVault];
return customCollector != address(0) ? customCollector : defaultCollector;
}
/**
* @dev Configures an external executor
* @param executor Address of the executor to be set
* @param allowed Whether the given executor should be allowed or not
*/
function setExecutor(address executor, bool allowed) external override onlyOwner {
_setExecutor(executor, allowed);
}
/**
* @dev Sets the default collector
* @param collector Address of the new default collector to be set
*/
function setDefaultCollector(address collector) external override onlyOwner {
_setDefaultCollector(collector);
}
/**
* @dev Sets a custom collector for a smart vault
* @param smartVault Address of smart vault to set a collector for
* @param collector Address of the collector to be set for the given smart vault
*/
function setSmartVaultCollector(address smartVault, address collector) external override onlyOwner {
getSmartVaultCollector[smartVault] = collector;
emit SmartVaultCollectorSet(smartVault, collector);
}
/**
* @dev Sets a maximum quota for a smart vault
* @param smartVault Address of smart vault to set a maximum quota for
* @param maxQuota Maximum quota to be set for the given smart vault
*/
function setSmartVaultMaxQuota(address smartVault, uint256 maxQuota) external override onlyOwner {
getSmartVaultMaxQuota[smartVault] = maxQuota;
emit SmartVaultMaxQuotaSet(smartVault, maxQuota);
}
/**
* @dev Deposits native tokens for a given smart vault. First, it will pay part of the quota if any.
* @param smartVault Address of smart vault to deposit balance for
* @param amount Amount of native tokens to be deposited, must match msg.value
*/
function deposit(address smartVault, uint256 amount) external payable override {
if (msg.value != amount) revert RelayerValueDoesNotMatchAmount(msg.value, amount);
uint256 amountPaid = _payQuota(smartVault, amount);
uint256 toDeposit = amount - amountPaid;
getSmartVaultBalance[smartVault] += toDeposit;
emit Deposited(smartVault, toDeposit);
}
/**
* @dev Withdraws native tokens from the sender
* @param amount Amount of native tokens to be withdrawn
*/
function withdraw(uint256 amount) external override {
uint256 balance = getSmartVaultBalance[msg.sender];
if (amount > balance) revert RelayerWithdrawInsufficientBalance(msg.sender, balance, amount);
getSmartVaultBalance[msg.sender] = balance - amount;
emit Withdrawn(msg.sender, amount);
(bool success, ) = payable(msg.sender).call{ value: amount }('');
if (!success) revert RelayerWithdrawFailed(msg.sender, amount);
}
/**
* @dev Executes a list of tasks
* @param tasks Addresses of the tasks to execute
* @param data List of calldata to execute each of the given tasks
* @param continueIfFailed Whether the execution should fail in case one of the tasks fail
*/
function execute(address[] memory tasks, bytes[] memory data, bool continueIfFailed) external override {
_execute(tasks, data, continueIfFailed);
}
/**
* @dev Simulates an execution.
* WARNING: THIS METHOD IS MEANT TO BE USED AS A VIEW FUNCTION
* This method will always revert. Successful results or task execution errors are returned as
* `RelayerSimulationResult` errors. Any other error should be treated as failure.
* @param tasks Addresses of the tasks to simulate the execution of
* @param data List of calldata to simulate each of the given tasks execution
* @param continueIfFailed Whether the simulation should fail in case one of the tasks execution fails
*/
function simulate(address[] memory tasks, bytes[] memory data, bool continueIfFailed) external override {
revert RelayerSimulationResult(_execute(tasks, data, continueIfFailed));
}
/**
* @dev Withdraw ERC20 tokens to an external account. To be used in case of accidental token transfers.
* @param token Address of the token to be withdrawn
* @param recipient Address where the tokens will be transferred to
* @param amount Amount of tokens to withdraw
*/
function rescueFunds(address token, address recipient, uint256 amount) external override onlyOwner {
if (token == address(0)) revert RelayerTokenZero();
if (recipient == address(0)) revert RelayerRecipientZero();
if (amount == 0) revert RelayerAmountZero();
IERC20(token).safeTransfer(recipient, amount);
emit FundsRescued(token, recipient, amount);
}
/**
* @dev Configures an external executor
* @param executor Address of the executor to be set
* @param allowed Whether the given executor should be allowed or not
*/
function _setExecutor(address executor, bool allowed) internal {
if (executor == address(0)) revert RelayerExecutorZero();
isExecutorAllowed[executor] = allowed;
emit ExecutorSet(executor, allowed);
}
/**
* @dev Sets the default collector
* @param collector Default fee collector to be set
*/
function _setDefaultCollector(address collector) internal {
if (collector == address(0)) revert RelayerCollectorZero();
defaultCollector = collector;
emit DefaultCollectorSet(collector);
}
/**
* @dev Executes a list of tasks
* @param tasks Addresses of the tasks to execute
* @param data List of calldata to execute each of the given tasks
* @param continueIfFailed Whether the execution should fail in case one of the tasks fail
* @return taskResults List of task execution results
*/
function _execute(address[] memory tasks, bytes[] memory data, bool continueIfFailed)
internal
returns (TaskResult[] memory taskResults)
{
if (!isExecutorAllowed[msg.sender]) revert RelayerExecutorNotAllowed(msg.sender);
if (tasks.length == 0) revert RelayerNoTaskGiven();
if (tasks.length != data.length) revert RelayerInputLengthMismatch();
uint256 totalGasUsed = BASE_GAS;
address smartVault = ITask(tasks[0]).smartVault();
taskResults = new TaskResult[](tasks.length);
for (uint256 i = 0; i < tasks.length; i++) {
uint256 initialGas = gasleft();
address task = tasks[i];
// Note the line below prevents `task` from being an EOA or a contract that does not implement ITask (e.g. a token contract)
address taskSmartVault = ITask(task).smartVault();
if (taskSmartVault != smartVault) revert RelayerMultipleTaskSmartVaults(task, taskSmartVault, smartVault);
// Note the validation below is the only one made on task, by checking that the smart vault that will pay for the gas is somehow related to it.
// This check is critical since the smart vault is not referenced again inside this function.
bool hasPermissions = ISmartVault(smartVault).hasPermissions(task);
if (!hasPermissions) revert RelayerTaskDoesNotHavePermissions(task, smartVault);
// Note if `task` were an EOA the line below would succeed, resulting in a false positive. This is prevented a few lines above by making sure `task` is a contract that implements ITask.
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory result) = task.call(data[i]);
taskResults[i] = TaskResult(success, result);
uint256 gasUsed = initialGas - gasleft();
// Does not charge gas if the task was not executed successfully
if (success) totalGasUsed += gasUsed;
emit TaskExecuted(smartVault, task, data[i], success, result, gasUsed, i);
if (!success && !continueIfFailed) break;
}
// Does not charge gas if no task was executed successfully
if (totalGasUsed == BASE_GAS) return taskResults;
uint256 totalGasCost = totalGasUsed * tx.gasprice;
_payTransactionGasToRelayer(smartVault, totalGasCost);
}
/**
* @dev Pays transaction gas to the relayer withdrawing native tokens from a given smart vault
* @param smartVault Address of smart vault to withdraw balance of
* @param amount Amount of native tokens to be withdrawn
*/
function _payTransactionGasToRelayer(address smartVault, uint256 amount) internal {
uint256 balance = getSmartVaultBalance[smartVault];
uint256 maxQuota = getSmartVaultMaxQuota[smartVault];
uint256 usedQuota = getSmartVaultUsedQuota[smartVault];
uint256 availableQuota = usedQuota >= maxQuota ? 0 : (maxQuota - usedQuota);
bool hasEnoughBalance = amount <= balance + availableQuota;
if (!hasEnoughBalance) revert RelayerPaymentInsufficientBalance(smartVault, balance, availableQuota, amount);
uint256 valueToSend;
uint256 quota = 0;
if (balance >= amount) {
getSmartVaultBalance[smartVault] = balance - amount;
valueToSend = amount;
} else {
quota = amount - balance;
getSmartVaultBalance[smartVault] = 0;
getSmartVaultUsedQuota[smartVault] = usedQuota + quota;
valueToSend = balance;
}
if (valueToSend > 0) {
(bool paySuccess, ) = getApplicableCollector(smartVault).call{ value: valueToSend }('');
if (!paySuccess) revert RelayerPaymentFailed(smartVault, amount, quota);
}
emit GasPaid(smartVault, amount, quota);
}
/**
* @dev Pays part of the quota for a given smart vault, if applicable
* @param smartVault Address of smart vault to pay quota for
* @param toDeposit Amount of native tokens to be deposited for the smart vault
* @return quotaPaid Amount of native tokens used to pay the quota
*/
function _payQuota(address smartVault, uint256 toDeposit) internal returns (uint256 quotaPaid) {
uint256 usedQuota = getSmartVaultUsedQuota[smartVault];
if (usedQuota == 0) return 0;
if (toDeposit > usedQuota) {
getSmartVaultUsedQuota[smartVault] = 0;
quotaPaid = usedQuota;
} else {
getSmartVaultUsedQuota[smartVault] = usedQuota - toDeposit;
quotaPaid = toDeposit;
}
(bool paySuccess, ) = getApplicableCollector(smartVault).call{ value: quotaPaid }('');
if (!paySuccess) revert RelayerQuotaPaymentFailed(smartVault, quotaPaid);
emit QuotaPaid(smartVault, quotaPaid);
}
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
/**
* @dev Authorized interface
*/
interface IAuthorized {
/**
* @dev Sender `who` is not allowed to call `what` with `how`
*/
error AuthSenderNotAllowed(address who, bytes4 what, uint256[] how);
/**
* @dev Tells the address of the authorizer reference
*/
function authorizer() external view returns (address);
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
import '@mimic-fi/v3-authorizer/contracts/interfaces/IAuthorized.sol';
/**
* @dev Smart Vault interface
*/
interface ISmartVault is IAuthorized {
/**
* @dev The smart vault is paused
*/
error SmartVaultPaused();
/**
* @dev The smart vault is unpaused
*/
error SmartVaultUnpaused();
/**
* @dev The token is zero
*/
error SmartVaultTokenZero();
/**
* @dev The amount is zero
*/
error SmartVaultAmountZero();
/**
* @dev The recipient is zero
*/
error SmartVaultRecipientZero();
/**
* @dev The connector is deprecated
*/
error SmartVaultConnectorDeprecated(address connector);
/**
* @dev The connector is not registered
*/
error SmartVaultConnectorNotRegistered(address connector);
/**
* @dev The connector is not stateless
*/
error SmartVaultConnectorNotStateless(address connector);
/**
* @dev The connector ID is zero
*/
error SmartVaultBalanceConnectorIdZero();
/**
* @dev The balance connector's balance is lower than the requested amount to be deducted
*/
error SmartVaultBalanceConnectorInsufficientBalance(bytes32 id, address token, uint256 balance, uint256 amount);
/**
* @dev The smart vault's native token balance is lower than the requested amount to be deducted
*/
error SmartVaultInsufficientNativeTokenBalance(uint256 balance, uint256 amount);
/**
* @dev Emitted every time a smart vault is paused
*/
event Paused();
/**
* @dev Emitted every time a smart vault is unpaused
*/
event Unpaused();
/**
* @dev Emitted every time the price oracle is set
*/
event PriceOracleSet(address indexed priceOracle);
/**
* @dev Emitted every time a connector check is overridden
*/
event ConnectorCheckOverridden(address indexed connector, bool ignored);
/**
* @dev Emitted every time a balance connector is updated
*/
event BalanceConnectorUpdated(bytes32 indexed id, address indexed token, uint256 amount, bool added);
/**
* @dev Emitted every time `execute` is called
*/
event Executed(address indexed connector, bytes data, bytes result);
/**
* @dev Emitted every time `call` is called
*/
event Called(address indexed target, bytes data, uint256 value, bytes result);
/**
* @dev Emitted every time `wrap` is called
*/
event Wrapped(uint256 amount);
/**
* @dev Emitted every time `unwrap` is called
*/
event Unwrapped(uint256 amount);
/**
* @dev Emitted every time `collect` is called
*/
event Collected(address indexed token, address indexed from, uint256 amount);
/**
* @dev Emitted every time `withdraw` is called
*/
event Withdrawn(address indexed token, address indexed recipient, uint256 amount, uint256 fee);
/**
* @dev Tells if the smart vault is paused or not
*/
function isPaused() external view returns (bool);
/**
* @dev Tells the address of the price oracle
*/
function priceOracle() external view returns (address);
/**
* @dev Tells the address of the Mimic's registry
*/
function registry() external view returns (address);
/**
* @dev Tells the address of the Mimic's fee controller
*/
function feeController() external view returns (address);
/**
* @dev Tells the address of the wrapped native token
*/
function wrappedNativeToken() external view returns (address);
/**
* @dev Tells if a connector check is ignored
* @param connector Address of the connector being queried
*/
function isConnectorCheckIgnored(address connector) external view returns (bool);
/**
* @dev Tells the balance to a balance connector for a token
* @param id Balance connector identifier
* @param token Address of the token querying the balance connector for
*/
function getBalanceConnector(bytes32 id, address token) external view returns (uint256);
/**
* @dev Tells whether someone has any permission over the smart vault
*/
function hasPermissions(address who) external view returns (bool);
/**
* @dev Pauses a smart vault
*/
function pause() external;
/**
* @dev Unpauses a smart vault
*/
function unpause() external;
/**
* @dev Sets the price oracle
* @param newPriceOracle Address of the new price oracle to be set
*/
function setPriceOracle(address newPriceOracle) external;
/**
* @dev Overrides connector checks
* @param connector Address of the connector to override its check
* @param ignored Whether the connector check should be ignored
*/
function overrideConnectorCheck(address connector, bool ignored) external;
/**
* @dev Updates a balance connector
* @param id Balance connector identifier to be updated
* @param token Address of the token to update the balance connector for
* @param amount Amount to be updated to the balance connector
* @param add Whether the balance connector should be increased or decreased
*/
function updateBalanceConnector(bytes32 id, address token, uint256 amount, bool add) external;
/**
* @dev Executes a connector inside of the Smart Vault context
* @param connector Address of the connector that will be executed
* @param data Call data to be used for the delegate-call
* @return result Call response if it was successful, otherwise it reverts
*/
function execute(address connector, bytes memory data) external returns (bytes memory result);
/**
* @dev Executes an arbitrary call from the Smart Vault
* @param target Address where the call will be sent
* @param data Call data to be used for the call
* @param value Value in wei that will be attached to the call
* @return result Call response if it was successful, otherwise it reverts
*/
function call(address target, bytes memory data, uint256 value) external returns (bytes memory result);
/**
* @dev Wrap an amount of native tokens to the wrapped ERC20 version of it
* @param amount Amount of native tokens to be wrapped
*/
function wrap(uint256 amount) external;
/**
* @dev Unwrap an amount of wrapped native tokens
* @param amount Amount of wrapped native tokens to unwrapped
*/
function unwrap(uint256 amount) external;
/**
* @dev Collect tokens from an external account to the Smart Vault
* @param token Address of the token to be collected
* @param from Address where the tokens will be transferred from
* @param amount Amount of tokens to be transferred
*/
function collect(address token, address from, uint256 amount) external;
/**
* @dev Withdraw tokens to an external account
* @param token Address of the token to be withdrawn
* @param recipient Address where the tokens will be transferred to
* @param amount Amount of tokens to withdraw
*/
function withdraw(address token, address recipient, uint256 amount) external;
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
import '@mimic-fi/v3-authorizer/contracts/interfaces/IAuthorized.sol';
/**
* @dev Base task interface
*/
interface IBaseTask is IAuthorized {
// Execution type serves for relayers in order to distinguish how each task must be executed
// solhint-disable-next-line func-name-mixedcase
function EXECUTION_TYPE() external view returns (bytes32);
/**
* @dev The balance connectors are the same
*/
error TaskSameBalanceConnectors(bytes32 connectorId);
/**
* @dev The smart vault's price oracle is not set
*/
error TaskSmartVaultPriceOracleNotSet(address smartVault);
/**
* @dev Emitted every time a task is executed
*/
event Executed();
/**
* @dev Emitted every time the balance connectors are set
*/
event BalanceConnectorsSet(bytes32 indexed previous, bytes32 indexed next);
/**
* @dev Tells the address of the Smart Vault tied to it, it cannot be changed
*/
function smartVault() external view returns (address);
/**
* @dev Tells the balance connector id of the previous task in the workflow
*/
function previousBalanceConnectorId() external view returns (bytes32);
/**
* @dev Tells the balance connector id of the next task in the workflow
*/
function nextBalanceConnectorId() external view returns (bytes32);
/**
* @dev Tells the address from where the token amounts to execute this task are fetched.
* This address must the the Smart Vault in case the previous balance connector is set.
*/
function getTokensSource() external view returns (address);
/**
* @dev Tells the amount a task should use for a token
* @param token Address of the token being queried
*/
function getTaskAmount(address token) external view returns (uint256);
/**
* @dev Sets the balance connector IDs
* @param previous Balance connector id of the previous task in the workflow
* @param next Balance connector id of the next task in the workflow
*/
function setBalanceConnectors(bytes32 previous, bytes32 next) external;
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
import './IBaseTask.sol';
/**
* @dev Gas limited task interface
*/
interface IGasLimitedTask is IBaseTask {
/**
* @dev The tx initial gas cache has not been initialized
*/
error TaskGasNotInitialized();
/**
* @dev The gas price used is greater than the limit
*/
error TaskGasPriceLimitExceeded(uint256 gasPrice, uint256 gasPriceLimit);
/**
* @dev The priority fee used is greater than the priority fee limit
*/
error TaskPriorityFeeLimitExceeded(uint256 priorityFee, uint256 priorityFeeLimit);
/**
* @dev The transaction cost is greater than the transaction cost limit
*/
error TaskTxCostLimitExceeded(uint256 txCost, uint256 txCostLimit);
/**
* @dev The transaction cost percentage is greater than the transaction cost limit percentage
*/
error TaskTxCostLimitPctExceeded(uint256 txCostPct, uint256 txCostLimitPct);
/**
* @dev The new transaction cost limit percentage is greater than one
*/
error TaskTxCostLimitPctAboveOne();
/**
* @dev Emitted every time the gas price limit is set
*/
event GasPriceLimitSet(uint256 gasPriceLimit);
/**
* @dev Emitted every time the priority fee limit is set
*/
event PriorityFeeLimitSet(uint256 priorityFeeLimit);
/**
* @dev Emitted every time the transaction cost limit is set
*/
event TxCostLimitSet(uint256 txCostLimit);
/**
* @dev Emitted every time the transaction cost limit percentage is set
*/
event TxCostLimitPctSet(uint256 txCostLimitPct);
/**
* @dev Tells the gas price limit
*/
function gasPriceLimit() external view returns (uint256);
/**
* @dev Tells the priority fee limit
*/
function priorityFeeLimit() external view returns (uint256);
/**
* @dev Tells the transaction cost limit
*/
function txCostLimit() external view returns (uint256);
/**
* @dev Tells the transaction cost limit percentage
*/
function txCostLimitPct() external view returns (uint256);
/**
* @dev Sets the gas price limit
* @param newGasPriceLimit New gas price limit to be set
*/
function setGasPriceLimit(uint256 newGasPriceLimit) external;
/**
* @dev Sets the priority fee limit
* @param newPriorityFeeLimit New priority fee limit to be set
*/
function setPriorityFeeLimit(uint256 newPriorityFeeLimit) external;
/**
* @dev Sets the transaction cost limit
* @param newTxCostLimit New transaction cost limit to be set
*/
function setTxCostLimit(uint256 newTxCostLimit) external;
/**
* @dev Sets the transaction cost limit percentage
* @param newTxCostLimitPct New transaction cost limit percentage to be set
*/
function setTxCostLimitPct(uint256 newTxCostLimitPct) external;
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
import './IBaseTask.sol';
/**
* @dev Time-locked task interface
*/
interface ITimeLockedTask is IBaseTask {
/**
* @dev The time-lock has not expired
*/
error TaskTimeLockNotExpired(uint256 expiration, uint256 currentTimestamp);
/**
* @dev The execution period has expired
*/
error TaskTimeLockWaitNextPeriod(uint256 offset, uint256 executionPeriod);
/**
* @dev The execution period is greater than the time-lock delay
*/
error TaskExecutionPeriodGtDelay(uint256 executionPeriod, uint256 delay);
/**
* @dev Emitted every time a new time-lock delay is set
*/
event TimeLockDelaySet(uint256 delay);
/**
* @dev Emitted every time a new expiration timestamp is set
*/
event TimeLockExpirationSet(uint256 expiration);
/**
* @dev Emitted every time a new execution period is set
*/
event TimeLockExecutionPeriodSet(uint256 period);
/**
* @dev Tells the time-lock delay in seconds
*/
function timeLockDelay() external view returns (uint256);
/**
* @dev Tells the time-lock expiration timestamp
*/
function timeLockExpiration() external view returns (uint256);
/**
* @dev Tells the time-lock execution period
*/
function timeLockExecutionPeriod() external view returns (uint256);
/**
* @dev Sets the time-lock delay
* @param delay New delay to be set
*/
function setTimeLockDelay(uint256 delay) external;
/**
* @dev Sets the time-lock expiration timestamp
* @param expiration New expiration timestamp to be set
*/
function setTimeLockExpiration(uint256 expiration) external;
/**
* @dev Sets the time-lock execution period
* @param period New execution period to be set
*/
function setTimeLockExecutionPeriod(uint256 period) external;
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
import './IBaseTask.sol';
/**
* @dev Token indexed task interface
*/
interface ITokenIndexedTask is IBaseTask {
/**
* @dev Acceptance list types: either deny-list to express "all except" or allow-list to express "only"
*/
enum TokensAcceptanceType {
DenyList,
AllowList
}
/**
* @dev The acceptance token is zero
*/
error TaskAcceptanceTokenZero();
/**
* @dev The tokens acceptance input length mismatch
*/
error TaskAcceptanceInputLengthMismatch();
/**
* @dev The token is not allowed
*/
error TaskTokenNotAllowed(address token);
/**
* @dev Emitted every time a tokens acceptance type is set
*/
event TokensAcceptanceTypeSet(TokensAcceptanceType acceptanceType);
/**
* @dev Emitted every time a token is added or removed from the acceptance list
*/
event TokensAcceptanceListSet(address indexed token, bool added);
/**
* @dev Tells the acceptance type of the config
*/
function tokensAcceptanceType() external view returns (TokensAcceptanceType);
/**
* @dev Sets the tokens acceptance type of the task
* @param newTokensAcceptanceType New token acceptance type to be set
*/
function setTokensAcceptanceType(TokensAcceptanceType newTokensAcceptanceType) external;
/**
* @dev Updates the list of tokens of the tokens acceptance list
* @param tokens List of tokens to be updated from the acceptance list
* @param added Whether each of the given tokens should be added or removed from the list
*/
function setTokensAcceptanceList(address[] memory tokens, bool[] memory added) external;
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General External License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General External License for more details.
// You should have received a copy of the GNU General External License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
import './IBaseTask.sol';
/**
* @dev Token threshold task interface
*/
interface ITokenThresholdTask is IBaseTask {
/**
* @dev Threshold defined by a token address and min/max values
*/
struct Threshold {
address token;
uint256 min;
uint256 max;
}
/**
* @dev The token threshold token is zero
*/
error TaskThresholdTokenZero();
/**
* @dev The token threshold to be set is invalid
*/
error TaskInvalidThresholdInput(address token, uint256 min, uint256 max);
/**
* @dev The token threshold has not been met
*/
error TaskTokenThresholdNotMet(address token, uint256 amount, uint256 min, uint256 max);
/**
* @dev Emitted every time a default threshold is set
*/
event DefaultTokenThresholdSet(address token, uint256 min, uint256 max);
/**
* @dev Emitted every time a token threshold is set
*/
event CustomTokenThresholdSet(address indexed token, address thresholdToken, uint256 min, uint256 max);
/**
* @dev Tells the default token threshold
*/
function defaultTokenThreshold() external view returns (Threshold memory);
/**
* @dev Tells the custom threshold defined for a specific token
* @param token Address of the token being queried
*/
function customTokenThreshold(address token) external view returns (Threshold memory);
/**
* @dev Tells the threshold that should be used for a token
* @param token Address of the token being queried
*/
function getTokenThreshold(address token) external view returns (Threshold memory);
/**
* @dev Sets a new default threshold config
* @param thresholdToken New threshold token to be set
* @param thresholdMin New threshold minimum to be set
* @param thresholdMax New threshold maximum to be set
*/
function setDefaultTokenThreshold(address thresholdToken, uint256 thresholdMin, uint256 thresholdMax) external;
/**
* @dev Sets a custom token threshold
* @param token Address of the token to set a custom threshold
* @param thresholdToken New custom threshold token to be set
* @param thresholdMin New custom threshold minimum to be set
* @param thresholdMax New custom threshold maximum to be set
*/
function setCustomTokenThreshold(address token, address thresholdToken, uint256 thresholdMin, uint256 thresholdMax)
external;
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
import './IBaseTask.sol';
/**
* @dev Volume limited task interface
*/
interface IVolumeLimitedTask is IBaseTask {
/**
* @dev Volume limit config
* @param token Address to measure the volume limit
*/
struct VolumeLimit {
address token;
uint256 amount;
uint256 accrued;
uint256 period;
uint256 nextResetTime;
}
/**
* @dev The volume limit token is zero
*/
error TaskVolumeLimitTokenZero();
/**
* @dev The volume limit to be set is invalid
*/
error TaskInvalidVolumeLimitInput(address token, uint256 amount, uint256 period);
/**
* @dev The volume limit has been exceeded
*/
error TaskVolumeLimitExceeded(address token, uint256 limit, uint256 volume);
/**
* @dev Emitted every time a default volume limit is set
*/
event DefaultVolumeLimitSet(address indexed token, uint256 amount, uint256 period);
/**
* @dev Emitted every time a custom volume limit is set
*/
event CustomVolumeLimitSet(address indexed token, address indexed limitToken, uint256 amount, uint256 period);
/**
* @dev Tells the default volume limit set
*/
function defaultVolumeLimit() external view returns (VolumeLimit memory);
/**
* @dev Tells the custom volume limit set for a specific token
* @param token Address of the token being queried
*/
function customVolumeLimit(address token) external view returns (VolumeLimit memory);
/**
* @dev Tells the volume limit that should be used for a token
* @param token Address of the token being queried
*/
function getVolumeLimit(address token) external view returns (VolumeLimit memory);
/**
* @dev Sets a the default volume limit config
* @param limitToken Address of the token to measure the volume limit
* @param limitAmount Amount of tokens to be applied for the volume limit
* @param limitPeriod Frequency to Amount of tokens to be applied for the volume limit
*/
function setDefaultVolumeLimit(address limitToken, uint256 limitAmount, uint256 limitPeriod) external;
/**
* @dev Sets a custom volume limit
* @param token Address of the token to set a custom volume limit for
* @param limitToken Address of the token to measure the volume limit
* @param limitAmount Amount of tokens to be applied for the volume limit
* @param limitPeriod Frequency to Amount of tokens to be applied for the volume limit
*/
function setCustomVolumeLimit(address token, address limitToken, uint256 limitAmount, uint256 limitPeriod) external;
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
import './base/IBaseTask.sol';
import './base/IGasLimitedTask.sol';
import './base/ITimeLockedTask.sol';
import './base/ITokenIndexedTask.sol';
import './base/ITokenThresholdTask.sol';
import './base/IVolumeLimitedTask.sol';
// solhint-disable no-empty-blocks
/**
* @dev Task interface
*/
interface ITask is
IBaseTask,
IGasLimitedTask,
ITimeLockedTask,
ITokenIndexedTask,
ITokenThresholdTask,
IVolumeLimitedTask
{
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` 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 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev 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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @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, it is bubbled up by this
* function (like regular Solidity function calls).
*
* 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.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @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`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.8.0;
/**
* @dev Relayer interface
*/
interface IRelayer {
/**
* @dev The token is zero
*/
error RelayerTokenZero();
/**
* @dev The amount is zero
*/
error RelayerAmountZero();
/**
* @dev The collector is zero
*/
error RelayerCollectorZero();
/**
* @dev The recipient is zero
*/
error RelayerRecipientZero();
/**
* @dev The executor is zero
*/
error RelayerExecutorZero();
/**
* @dev Relayer no task given to execute
*/
error RelayerNoTaskGiven();
/**
* @dev Relayer input length mismatch
*/
error RelayerInputLengthMismatch();
/**
* @dev The sender is not allowed
*/
error RelayerExecutorNotAllowed(address sender);
/**
* @dev Trying to execute tasks from different smart vaults
*/
error RelayerMultipleTaskSmartVaults(address task, address taskSmartVault, address expectedSmartVault);
/**
* @dev The task to execute does not have permissions on the associated smart vault
*/
error RelayerTaskDoesNotHavePermissions(address task, address smartVault);
/**
* @dev The smart vault balance plus the available quota are lower than the amount to pay the relayer
*/
error RelayerPaymentInsufficientBalance(address smartVault, uint256 balance, uint256 quota, uint256 amount);
/**
* @dev It failed to send amount minus quota to the smart vault's collector
*/
error RelayerPaymentFailed(address smartVault, uint256 amount, uint256 quota);
/**
* @dev It failed to send owed quota to the smart vault's collector
*/
error RelayerQuotaPaymentFailed(address smartVault, uint256 quota);
/**
* @dev The smart vault balance is lower than the amount to withdraw
*/
error RelayerWithdrawInsufficientBalance(address sender, uint256 balance, uint256 amount);
/**
* @dev It failed to send the amount to the sender
*/
error RelayerWithdrawFailed(address sender, uint256 amount);
/**
* @dev The value sent and the amount differ
*/
error RelayerValueDoesNotMatchAmount(uint256 value, uint256 amount);
/**
* @dev The simulation executed properly
*/
error RelayerSimulationResult(TaskResult[] taskResults);
/**
* @dev Emitted every time an executor is configured
*/
event ExecutorSet(address indexed executor, bool allowed);
/**
* @dev Emitted every time the default collector is set
*/
event DefaultCollectorSet(address indexed collector);
/**
* @dev Emitted every time a collector is set for a smart vault
*/
event SmartVaultCollectorSet(address indexed smartVault, address indexed collector);
/**
* @dev Emitted every time a smart vault's maximum quota is set
*/
event SmartVaultMaxQuotaSet(address indexed smartVault, uint256 maxQuota);
/**
* @dev Emitted every time a smart vault's task is executed
*/
event TaskExecuted(
address indexed smartVault,
address indexed task,
bytes data,
bool success,
bytes result,
uint256 gas,
uint256 index
);
/**
* @dev Emitted every time some native tokens are deposited for the smart vault's balance
*/
event Deposited(address indexed smartVault, uint256 amount);
/**
* @dev Emitted every time some native tokens are withdrawn from the smart vault's balance
*/
event Withdrawn(address indexed smartVault, uint256 amount);
/**
* @dev Emitted every time some ERC20 tokens are withdrawn from the relayer to an external account
*/
event FundsRescued(address indexed token, address indexed recipient, uint256 amount);
/**
* @dev Emitted every time a smart vault's quota is paid
*/
event QuotaPaid(address indexed smartVault, uint256 amount);
/**
* @dev Emitted every time a smart vault pays for transaction gas to the relayer
*/
event GasPaid(address indexed smartVault, uint256 amount, uint256 quota);
/**
* @dev Task result
* @param success Whether the task execution succeeds or not
* @param result Result of the task execution
*/
struct TaskResult {
bool success;
bytes result;
}
/**
* @dev Tells the default collector address
*/
function defaultCollector() external view returns (address);
/**
* @dev Tells whether an executor is allowed
* @param executor Address of the executor being queried
*/
function isExecutorAllowed(address executor) external view returns (bool);
/**
* @dev Tells the smart vault available balance to relay transactions
* @param smartVault Address of the smart vault being queried
*/
function getSmartVaultBalance(address smartVault) external view returns (uint256);
/**
* @dev Tells the custom collector address set for a smart vault
* @param smartVault Address of the smart vault being queried
*/
function getSmartVaultCollector(address smartVault) external view returns (address);
/**
* @dev Tells the smart vault maximum quota to be used
* @param smartVault Address of the smart vault being queried
*/
function getSmartVaultMaxQuota(address smartVault) external view returns (uint256);
/**
* @dev Tells the smart vault used quota
* @param smartVault Address of the smart vault being queried
*/
function getSmartVaultUsedQuota(address smartVault) external view returns (uint256);
/**
* @dev Tells the collector address applicable for a smart vault
* @param smartVault Address of the smart vault being queried
*/
function getApplicableCollector(address smartVault) external view returns (address);
/**
* @dev Configures an external executor
* @param executor Address of the executor to be set
* @param allowed Whether the given executor should be allowed or not
*/
function setExecutor(address executor, bool allowed) external;
/**
* @dev Sets the default collector
* @param collector Address of the new default collector to be set
*/
function setDefaultCollector(address collector) external;
/**
* @dev Sets a custom collector for a smart vault
* @param smartVault Address of smart vault to set a collector for
* @param collector Address of the collector to be set for the given smart vault
*/
function setSmartVaultCollector(address smartVault, address collector) external;
/**
* @dev Sets a maximum quota for a smart vault
* @param smartVault Address of smart vault to set a maximum quota for
* @param maxQuota Maximum quota to be set for the given smart vault
*/
function setSmartVaultMaxQuota(address smartVault, uint256 maxQuota) external;
/**
* @dev Deposits native tokens for a given smart vault
* @param smartVault Address of smart vault to deposit balance for
* @param amount Amount of native tokens to be deposited, must match msg.value
*/
function deposit(address smartVault, uint256 amount) external payable;
/**
* @dev Withdraws native tokens from a given smart vault
* @param amount Amount of native tokens to be withdrawn
*/
function withdraw(uint256 amount) external;
/**
* @dev Executes a list of tasks
* @param tasks Addresses of the tasks to execute
* @param data List of calldata to execute each of the given tasks
* @param continueIfFailed Whether the execution should fail in case one of the tasks fail
*/
function execute(address[] memory tasks, bytes[] memory data, bool continueIfFailed) external;
/**
* @dev Simulates an execution.
* WARNING: THIS METHOD IS MEANT TO BE USED AS A VIEW FUNCTION
* This method will always revert. Successful results or task execution errors are returned as
* `RelayerSimulationResult` errors. Any other error should be treated as failure.
* @param tasks Addresses of the tasks to simulate the execution of
* @param data List of calldata to simulate each of the given tasks execution
* @param continueIfFailed Whether the simulation should fail in case one of the tasks execution fails
*/
function simulate(address[] memory tasks, bytes[] memory data, bool continueIfFailed) external;
/**
* @dev Withdraw ERC20 tokens to an external account. To be used in case of accidental token transfers.
* @param token Address of the token to be withdrawn
* @param recipient Address where the tokens will be transferred to
* @param amount Amount of tokens to withdraw
*/
function rescueFunds(address token, address recipient, uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract TaskMock {
event Succeeded();
address public smartVault;
constructor(address _smartVault) {
smartVault = _smartVault;
}
function succeed() external returns (uint256) {
emit Succeeded();
return 1;
}
function fail() external pure {
revert('TASK_FAILED');
}
}{
"optimizer": {
"enabled": true,
"runs": 10000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"executor","type":"address"},{"internalType":"address","name":"collector","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"RelayerAmountZero","type":"error"},{"inputs":[],"name":"RelayerCollectorZero","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"RelayerExecutorNotAllowed","type":"error"},{"inputs":[],"name":"RelayerExecutorZero","type":"error"},{"inputs":[],"name":"RelayerInputLengthMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"task","type":"address"},{"internalType":"address","name":"taskSmartVault","type":"address"},{"internalType":"address","name":"expectedSmartVault","type":"address"}],"name":"RelayerMultipleTaskSmartVaults","type":"error"},{"inputs":[],"name":"RelayerNoTaskGiven","type":"error"},{"inputs":[{"internalType":"address","name":"smartVault","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"quota","type":"uint256"}],"name":"RelayerPaymentFailed","type":"error"},{"inputs":[{"internalType":"address","name":"smartVault","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"quota","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RelayerPaymentInsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"smartVault","type":"address"},{"internalType":"uint256","name":"quota","type":"uint256"}],"name":"RelayerQuotaPaymentFailed","type":"error"},{"inputs":[],"name":"RelayerRecipientZero","type":"error"},{"inputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"result","type":"bytes"}],"internalType":"struct IRelayer.TaskResult[]","name":"taskResults","type":"tuple[]"}],"name":"RelayerSimulationResult","type":"error"},{"inputs":[{"internalType":"address","name":"task","type":"address"},{"internalType":"address","name":"smartVault","type":"address"}],"name":"RelayerTaskDoesNotHavePermissions","type":"error"},{"inputs":[],"name":"RelayerTokenZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RelayerValueDoesNotMatchAmount","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RelayerWithdrawFailed","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RelayerWithdrawInsufficientBalance","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collector","type":"address"}],"name":"DefaultCollectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"smartVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"executor","type":"address"},{"indexed":false,"internalType":"bool","name":"allowed","type":"bool"}],"name":"ExecutorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundsRescued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"smartVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quota","type":"uint256"}],"name":"GasPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"smartVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"QuotaPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"smartVault","type":"address"},{"indexed":true,"internalType":"address","name":"collector","type":"address"}],"name":"SmartVaultCollectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"smartVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"maxQuota","type":"uint256"}],"name":"SmartVaultMaxQuotaSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"smartVault","type":"address"},{"indexed":true,"internalType":"address","name":"task","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"bytes","name":"result","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"gas","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"TaskExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"smartVault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"BASE_GAS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"smartVault","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tasks","type":"address[]"},{"internalType":"bytes[]","name":"data","type":"bytes[]"},{"internalType":"bool","name":"continueIfFailed","type":"bool"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"smartVault","type":"address"}],"name":"getApplicableCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getSmartVaultBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getSmartVaultCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getSmartVaultMaxQuota","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getSmartVaultUsedQuota","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isExecutorAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collector","type":"address"}],"name":"setDefaultCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"executor","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"setExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"smartVault","type":"address"},{"internalType":"address","name":"collector","type":"address"}],"name":"setSmartVaultCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"smartVault","type":"address"},{"internalType":"uint256","name":"maxQuota","type":"uint256"}],"name":"setSmartVaultMaxQuota","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tasks","type":"address[]"},{"internalType":"bytes[]","name":"data","type":"bytes[]"},{"internalType":"bool","name":"continueIfFailed","type":"bool"}],"name":"simulate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b50604051620020e3380380620020e38339810160408190526200003491620001d1565b6200003f336200006b565b6200004c836001620000bb565b620000578262000142565b62000062816200006b565b5050506200021b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038216620000e357604051632b26eb8b60e21b815260040160405180910390fd5b6001600160a01b038216600081815260026020908152604091829020805460ff191685151590811790915591519182527f278b09622564dd3991fe7744514513d64ea2c8ed2b2b9ec1150ad964fde80a99910160405180910390a25050565b6001600160a01b0381166200016a5760405163e044c84560e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fc0021c55037758881ecb38510bbc7a75898649236006215fa3ee18e3ac8c718e90600090a250565b80516001600160a01b0381168114620001cc57600080fd5b919050565b600080600060608486031215620001e757600080fd5b620001f284620001b4565b92506200020260208501620001b4565b91506200021260408501620001b4565b90509250925092565b611eb8806200022b6000396000f3fe60806040526004361061015f5760003560e01c80637d701102116100c0578063d629123411610074578063e976479911610059578063e9764799146103eb578063f2fde38b1461040b578063f46ca4e41461042b57600080fd5b8063d62912341461039e578063dc9fc0d2146103cb57600080fd5b8063b3120853116100a5578063b312085314610331578063d05c2c9414610351578063d581ae931461037157600080fd5b80637d701102146102d35780638da5cb5b1461031357600080fd5b8063389aa34211610117578063586171a0116100fc578063586171a01461027e5780636ccae0541461029e578063715018a6146102be57600080fd5b8063389aa3421461025457806347e7ef241461026b57600080fd5b80631e1bff3f116101485780631e1bff3f146101f25780632e1a7d4d146102145780633738ea521461023457600080fd5b8063151ac3a81461016457806316f91b8f146101a4575b600080fd5b34801561017057600080fd5b5061019161017f36600461185f565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101b057600080fd5b506101da6101bf36600461185f565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161019b565b3480156101fe57600080fd5b5061021261020d36600461189a565b61044b565b005b34801561022057600080fd5b5061021261022f3660046118d3565b610461565b34801561024057600080fd5b5061021261024f3660046118ec565b6105a8565b34801561026057600080fd5b506101916201136481565b61021261027936600461191a565b61061f565b34801561028a57600080fd5b506101da61029936600461185f565b6106f1565b3480156102aa57600080fd5b506102126102b9366004611946565b61072d565b3480156102ca57600080fd5b50610212610855565b3480156102df57600080fd5b506103036102ee36600461185f565b60026020526000908152604090205460ff1681565b604051901515815260200161019b565b34801561031f57600080fd5b506000546001600160a01b03166101da565b34801561033d57600080fd5b5061021261034c36600461185f565b610869565b34801561035d57600080fd5b5061021261036c366004611b30565b61087d565b34801561037d57600080fd5b5061019161038c36600461185f565b60036020526000908152604090205481565b3480156103aa57600080fd5b506101916103b936600461185f565b60066020526000908152604090205481565b3480156103d757600080fd5b506102126103e636600461191a565b61088e565b3480156103f757600080fd5b50610212610406366004611b30565b6108ef565b34801561041757600080fd5b5061021261042636600461185f565b61092d565b34801561043757600080fd5b506001546101da906001600160a01b031681565b6104536109d4565b61045d8282610a48565b5050565b33600090815260036020526040902054808211156104c0576040517f4e4cd2e600000000000000000000000000000000000000000000000000000000815233600482015260248101829052604481018390526064015b60405180910390fd5b6104ca8282611c31565b33600081815260036020526040908190209290925590517f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906105109085815260200190565b60405180910390a2604051600090339084908381818185875af1925050503d806000811461055a576040519150601f19603f3d011682016040523d82523d6000602084013e61055f565b606091505b50509050806105a3576040517f9e2673b3000000000000000000000000000000000000000000000000000000008152336004820152602481018490526044016104b7565b505050565b6105b06109d4565b6001600160a01b0382811660008181526004602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517f0d446d315256b8ce0010028b95bcdb8f8ff5534f0a7546c573296f8d8ccfeab79190a35050565b803414610661576040517f40062810000000000000000000000000000000000000000000000000000000008152346004820152602481018290526044016104b7565b600061066d8383610afe565b9050600061067b8284611c31565b6001600160a01b0385166000908152600360205260408120805492935083929091906106a8908490611c44565b90915550506040518181526001600160a01b038516907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c49060200160405180910390a250505050565b6001600160a01b0380821660009081526004602052604081205490911680610724576001546001600160a01b0316610726565b805b9392505050565b6107356109d4565b6001600160a01b038316610775576040517ff179a02100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382166107b5576040517f0a38b94900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000036107ef576040517f26b97ea400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108036001600160a01b0384168383610c6b565b816001600160a01b0316836001600160a01b03167fed2837b80b3489773c5f1ed30dd2884b4c90dbf7b87428ea03c49b24ef59a8058360405161084891815260200190565b60405180910390a3505050565b61085d6109d4565b6108676000610ceb565b565b6108716109d4565b61087a81610d53565b50565b610888838383610df5565b50505050565b6108966109d4565b6001600160a01b03821660008181526005602052604090819020839055517fac2d1a21b245ceb74d21ba8d4bbe0ae6d14473563f17aae4958afe3253ed603f906108e39084815260200190565b60405180910390a25050565b6108fa838383610df5565b6040517ff7dce3930000000000000000000000000000000000000000000000000000000081526004016104b79190611cc5565b6109356109d4565b6001600160a01b0381166109cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016104b7565b61087a81610ceb565b6000546001600160a01b03163314610867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104b7565b6001600160a01b038216610a88576040517fac9bae2c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821660008181526002602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f278b09622564dd3991fe7744514513d64ea2c8ed2b2b9ec1150ad964fde80a9991016108e3565b6001600160a01b038216600090815260066020526040812054808203610b28576000915050610c65565b80831115610b51576001600160a01b038416600090815260066020526040812055905080610b78565b610b5b8382611c31565b6001600160a01b0385166000908152600660205260409020558291505b6000610b83856106f1565b6001600160a01b03168360405160006040518083038185875af1925050503d8060008114610bcd576040519150601f19603f3d011682016040523d82523d6000602084013e610bd2565b606091505b5050905080610c1f576040517fd57342330000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152602481018490526044016104b7565b846001600160a01b03167fadde402c2cbae39776ebbb17c3619b0df48792f0ae294012433667cc4f30aa9084604051610c5a91815260200190565b60405180910390a250505b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526105a390849061131a565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116610d93576040517fe044c84500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517fc0021c55037758881ecb38510bbc7a75898649236006215fa3ee18e3ac8c718e90600090a250565b3360009081526002602052604090205460609060ff16610e43576040517f8b8ed3d40000000000000000000000000000000000000000000000000000000081523360048201526024016104b7565b8351600003610e7e576040517f0e4bc11400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8251845114610eb9576040517f9c2136e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000620113649050600085600081518110610ed657610ed6611d59565b60200260200101516001600160a01b0316634fd49efd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3f9190611d88565b9050855167ffffffffffffffff811115610f5b57610f5b611987565b604051908082528060200260200182016040528015610fa157816020015b604080518082019091526000815260606020820152815260200190600190039081610f795790505b50925060005b86518110156112e65760005a90506000888381518110610fc957610fc9611d59565b602002602001015190506000816001600160a01b0316634fd49efd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611013573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110379190611d88565b9050846001600160a01b0316816001600160a01b03161461109f576040517fb6bc94370000000000000000000000000000000000000000000000000000000081526001600160a01b0380841660048301528083166024830152861660448201526064016104b7565b6040517f1ffa27f90000000000000000000000000000000000000000000000000000000081526001600160a01b03838116600483015260009190871690631ffa27f990602401602060405180830381865afa158015611102573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111269190611da5565b905080611172576040517f0482fe140000000000000000000000000000000000000000000000000000000081526001600160a01b038085166004830152871660248201526044016104b7565b600080846001600160a01b03168c888151811061119157611191611d59565b60200260200101516040516111a69190611dc2565b6000604051808303816000865af19150503d80600081146111e3576040519150601f19603f3d011682016040523d82523d6000602084013e6111e8565b606091505b509150915060405180604001604052808315158152602001828152508a888151811061121657611216611d59565b602002602001018190525060005a61122e9088611c31565b9050821561124357611240818b611c44565b99505b856001600160a01b0316896001600160a01b03167f20e6470760a122f57acdfd383093a746ee742adcbc9ffbbdd00f4d29aff426128f8b8151811061128a5761128a611d59565b60200260200101518686868e6040516112a7959493929190611dde565b60405180910390a3821580156112bb57508b155b156112cc57505050505050506112e6565b5050505050505080806112de90611e20565b915050610fa7565b506201136482036112f8575050610726565b60006113043a84611e58565b9050611310828261141c565b5050509392505050565b600061136f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116559092919063ffffffff16565b90508051600014806113905750808060200190518101906113909190611da5565b6105a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016104b7565b6001600160a01b03821660009081526003602090815260408083205460058352818420546006909352908320549092828210156114625761145d8284611c31565b611465565b60005b905060006114738286611c44565b8611159050806114cf576040517f836df07f0000000000000000000000000000000000000000000000000000000081526001600160a01b03881660048201526024810186905260448101839052606481018790526084016104b7565b600080878710611504576114e38888611c31565b6001600160a01b038a16600090815260036020526040902055879150611550565b61150e8789611c31565b6001600160a01b038a1660009081526003602052604081205590506115338186611c44565b6001600160a01b038a166000908152600660205260409020558691505b81156116065760006115618a6106f1565b6001600160a01b03168360405160006040518083038185875af1925050503d80600081146115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b606091505b5050905080611604576040517f236adc760000000000000000000000000000000000000000000000000000000081526001600160a01b038b166004820152602481018a9052604481018390526064016104b7565b505b60408051898152602081018390526001600160a01b038b16917fc34a4660c18505a3cc0299553e73cd78f1de9b3ae9714a1dddd2fea59fa50f8f910160405180910390a2505050505050505050565b6060611664848460008561166c565b949350505050565b6060824710156116fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016104b7565b600080866001600160a01b0316858760405161171a9190611dc2565b60006040518083038185875af1925050503d8060008114611757576040519150601f19603f3d011682016040523d82523d6000602084013e61175c565b606091505b509150915061176d87838387611778565b979650505050505050565b606083156118015782516000036117fa576001600160a01b0385163b6117fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104b7565b5081611664565b61166483838151156118165781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b79190611e6f565b6001600160a01b038116811461087a57600080fd5b60006020828403121561187157600080fd5b81356107268161184a565b801515811461087a57600080fd5b80356118958161187c565b919050565b600080604083850312156118ad57600080fd5b82356118b88161184a565b915060208301356118c88161187c565b809150509250929050565b6000602082840312156118e557600080fd5b5035919050565b600080604083850312156118ff57600080fd5b823561190a8161184a565b915060208301356118c88161184a565b6000806040838503121561192d57600080fd5b82356119388161184a565b946020939093013593505050565b60008060006060848603121561195b57600080fd5b83356119668161184a565b925060208401356119768161184a565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156119fd576119fd611987565b604052919050565b600067ffffffffffffffff821115611a1f57611a1f611987565b5060051b60200190565b6000601f8381840112611a3b57600080fd5b82356020611a50611a4b83611a05565b6119b6565b82815260059290921b85018101918181019087841115611a6f57600080fd5b8287015b84811015611b2457803567ffffffffffffffff80821115611a945760008081fd5b818a0191508a603f830112611aa95760008081fd5b85820135604082821115611abf57611abf611987565b611aee887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08c850116016119b6565b92508183528c81838601011115611b055760008081fd5b8181850189850137506000908201870152845250918301918301611a73565b50979650505050505050565b600080600060608486031215611b4557600080fd5b833567ffffffffffffffff80821115611b5d57600080fd5b818601915086601f830112611b7157600080fd5b81356020611b81611a4b83611a05565b82815260059290921b8401810191818101908a841115611ba057600080fd5b948201945b83861015611bc7578535611bb88161184a565b82529482019490820190611ba5565b97505087013592505080821115611bdd57600080fd5b50611bea86828701611a29565b925050611bf96040850161188a565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610c6557610c65611c02565b80820180821115610c6557610c65611c02565b60005b83811015611c72578181015183820152602001611c5a565b50506000910152565b60008151808452611c93816020860160208601611c57565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611d4b578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805115158452870151878401879052611d3887850182611c7b565b9588019593505090860190600101611cec565b509098975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611d9a57600080fd5b81516107268161184a565b600060208284031215611db757600080fd5b81516107268161187c565b60008251611dd4818460208701611c57565b9190910192915050565b60a081526000611df160a0830188611c7b565b86151560208401528281036040840152611e0b8187611c7b565b60608401959095525050608001529392505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611e5157611e51611c02565b5060010190565b8082028115828204841417610c6557610c65611c02565b6020815260006107266020830184611c7b56fea2646970667358221220b47159ab60bbf5e08b6da04c7489ee399e0b0b199b763f8740aebf29394b37ac64736f6c63430008110033000000000000000000000000b3afb6db38a8e72905165c1fbb96772e63560790000000000000000000000000b3afb6db38a8e72905165c1fbb96772e635607900000000000000000000000006c0542daee8cc6866529d4a68163eb157fb78999
Deployed Bytecode
0x60806040526004361061015f5760003560e01c80637d701102116100c0578063d629123411610074578063e976479911610059578063e9764799146103eb578063f2fde38b1461040b578063f46ca4e41461042b57600080fd5b8063d62912341461039e578063dc9fc0d2146103cb57600080fd5b8063b3120853116100a5578063b312085314610331578063d05c2c9414610351578063d581ae931461037157600080fd5b80637d701102146102d35780638da5cb5b1461031357600080fd5b8063389aa34211610117578063586171a0116100fc578063586171a01461027e5780636ccae0541461029e578063715018a6146102be57600080fd5b8063389aa3421461025457806347e7ef241461026b57600080fd5b80631e1bff3f116101485780631e1bff3f146101f25780632e1a7d4d146102145780633738ea521461023457600080fd5b8063151ac3a81461016457806316f91b8f146101a4575b600080fd5b34801561017057600080fd5b5061019161017f36600461185f565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101b057600080fd5b506101da6101bf36600461185f565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161019b565b3480156101fe57600080fd5b5061021261020d36600461189a565b61044b565b005b34801561022057600080fd5b5061021261022f3660046118d3565b610461565b34801561024057600080fd5b5061021261024f3660046118ec565b6105a8565b34801561026057600080fd5b506101916201136481565b61021261027936600461191a565b61061f565b34801561028a57600080fd5b506101da61029936600461185f565b6106f1565b3480156102aa57600080fd5b506102126102b9366004611946565b61072d565b3480156102ca57600080fd5b50610212610855565b3480156102df57600080fd5b506103036102ee36600461185f565b60026020526000908152604090205460ff1681565b604051901515815260200161019b565b34801561031f57600080fd5b506000546001600160a01b03166101da565b34801561033d57600080fd5b5061021261034c36600461185f565b610869565b34801561035d57600080fd5b5061021261036c366004611b30565b61087d565b34801561037d57600080fd5b5061019161038c36600461185f565b60036020526000908152604090205481565b3480156103aa57600080fd5b506101916103b936600461185f565b60066020526000908152604090205481565b3480156103d757600080fd5b506102126103e636600461191a565b61088e565b3480156103f757600080fd5b50610212610406366004611b30565b6108ef565b34801561041757600080fd5b5061021261042636600461185f565b61092d565b34801561043757600080fd5b506001546101da906001600160a01b031681565b6104536109d4565b61045d8282610a48565b5050565b33600090815260036020526040902054808211156104c0576040517f4e4cd2e600000000000000000000000000000000000000000000000000000000815233600482015260248101829052604481018390526064015b60405180910390fd5b6104ca8282611c31565b33600081815260036020526040908190209290925590517f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906105109085815260200190565b60405180910390a2604051600090339084908381818185875af1925050503d806000811461055a576040519150601f19603f3d011682016040523d82523d6000602084013e61055f565b606091505b50509050806105a3576040517f9e2673b3000000000000000000000000000000000000000000000000000000008152336004820152602481018490526044016104b7565b505050565b6105b06109d4565b6001600160a01b0382811660008181526004602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517f0d446d315256b8ce0010028b95bcdb8f8ff5534f0a7546c573296f8d8ccfeab79190a35050565b803414610661576040517f40062810000000000000000000000000000000000000000000000000000000008152346004820152602481018290526044016104b7565b600061066d8383610afe565b9050600061067b8284611c31565b6001600160a01b0385166000908152600360205260408120805492935083929091906106a8908490611c44565b90915550506040518181526001600160a01b038516907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c49060200160405180910390a250505050565b6001600160a01b0380821660009081526004602052604081205490911680610724576001546001600160a01b0316610726565b805b9392505050565b6107356109d4565b6001600160a01b038316610775576040517ff179a02100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382166107b5576040517f0a38b94900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000036107ef576040517f26b97ea400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108036001600160a01b0384168383610c6b565b816001600160a01b0316836001600160a01b03167fed2837b80b3489773c5f1ed30dd2884b4c90dbf7b87428ea03c49b24ef59a8058360405161084891815260200190565b60405180910390a3505050565b61085d6109d4565b6108676000610ceb565b565b6108716109d4565b61087a81610d53565b50565b610888838383610df5565b50505050565b6108966109d4565b6001600160a01b03821660008181526005602052604090819020839055517fac2d1a21b245ceb74d21ba8d4bbe0ae6d14473563f17aae4958afe3253ed603f906108e39084815260200190565b60405180910390a25050565b6108fa838383610df5565b6040517ff7dce3930000000000000000000000000000000000000000000000000000000081526004016104b79190611cc5565b6109356109d4565b6001600160a01b0381166109cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016104b7565b61087a81610ceb565b6000546001600160a01b03163314610867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104b7565b6001600160a01b038216610a88576040517fac9bae2c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821660008181526002602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f278b09622564dd3991fe7744514513d64ea2c8ed2b2b9ec1150ad964fde80a9991016108e3565b6001600160a01b038216600090815260066020526040812054808203610b28576000915050610c65565b80831115610b51576001600160a01b038416600090815260066020526040812055905080610b78565b610b5b8382611c31565b6001600160a01b0385166000908152600660205260409020558291505b6000610b83856106f1565b6001600160a01b03168360405160006040518083038185875af1925050503d8060008114610bcd576040519150601f19603f3d011682016040523d82523d6000602084013e610bd2565b606091505b5050905080610c1f576040517fd57342330000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152602481018490526044016104b7565b846001600160a01b03167fadde402c2cbae39776ebbb17c3619b0df48792f0ae294012433667cc4f30aa9084604051610c5a91815260200190565b60405180910390a250505b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526105a390849061131a565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116610d93576040517fe044c84500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517fc0021c55037758881ecb38510bbc7a75898649236006215fa3ee18e3ac8c718e90600090a250565b3360009081526002602052604090205460609060ff16610e43576040517f8b8ed3d40000000000000000000000000000000000000000000000000000000081523360048201526024016104b7565b8351600003610e7e576040517f0e4bc11400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8251845114610eb9576040517f9c2136e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000620113649050600085600081518110610ed657610ed6611d59565b60200260200101516001600160a01b0316634fd49efd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3f9190611d88565b9050855167ffffffffffffffff811115610f5b57610f5b611987565b604051908082528060200260200182016040528015610fa157816020015b604080518082019091526000815260606020820152815260200190600190039081610f795790505b50925060005b86518110156112e65760005a90506000888381518110610fc957610fc9611d59565b602002602001015190506000816001600160a01b0316634fd49efd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611013573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110379190611d88565b9050846001600160a01b0316816001600160a01b03161461109f576040517fb6bc94370000000000000000000000000000000000000000000000000000000081526001600160a01b0380841660048301528083166024830152861660448201526064016104b7565b6040517f1ffa27f90000000000000000000000000000000000000000000000000000000081526001600160a01b03838116600483015260009190871690631ffa27f990602401602060405180830381865afa158015611102573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111269190611da5565b905080611172576040517f0482fe140000000000000000000000000000000000000000000000000000000081526001600160a01b038085166004830152871660248201526044016104b7565b600080846001600160a01b03168c888151811061119157611191611d59565b60200260200101516040516111a69190611dc2565b6000604051808303816000865af19150503d80600081146111e3576040519150601f19603f3d011682016040523d82523d6000602084013e6111e8565b606091505b509150915060405180604001604052808315158152602001828152508a888151811061121657611216611d59565b602002602001018190525060005a61122e9088611c31565b9050821561124357611240818b611c44565b99505b856001600160a01b0316896001600160a01b03167f20e6470760a122f57acdfd383093a746ee742adcbc9ffbbdd00f4d29aff426128f8b8151811061128a5761128a611d59565b60200260200101518686868e6040516112a7959493929190611dde565b60405180910390a3821580156112bb57508b155b156112cc57505050505050506112e6565b5050505050505080806112de90611e20565b915050610fa7565b506201136482036112f8575050610726565b60006113043a84611e58565b9050611310828261141c565b5050509392505050565b600061136f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116559092919063ffffffff16565b90508051600014806113905750808060200190518101906113909190611da5565b6105a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016104b7565b6001600160a01b03821660009081526003602090815260408083205460058352818420546006909352908320549092828210156114625761145d8284611c31565b611465565b60005b905060006114738286611c44565b8611159050806114cf576040517f836df07f0000000000000000000000000000000000000000000000000000000081526001600160a01b03881660048201526024810186905260448101839052606481018790526084016104b7565b600080878710611504576114e38888611c31565b6001600160a01b038a16600090815260036020526040902055879150611550565b61150e8789611c31565b6001600160a01b038a1660009081526003602052604081205590506115338186611c44565b6001600160a01b038a166000908152600660205260409020558691505b81156116065760006115618a6106f1565b6001600160a01b03168360405160006040518083038185875af1925050503d80600081146115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b606091505b5050905080611604576040517f236adc760000000000000000000000000000000000000000000000000000000081526001600160a01b038b166004820152602481018a9052604481018390526064016104b7565b505b60408051898152602081018390526001600160a01b038b16917fc34a4660c18505a3cc0299553e73cd78f1de9b3ae9714a1dddd2fea59fa50f8f910160405180910390a2505050505050505050565b6060611664848460008561166c565b949350505050565b6060824710156116fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016104b7565b600080866001600160a01b0316858760405161171a9190611dc2565b60006040518083038185875af1925050503d8060008114611757576040519150601f19603f3d011682016040523d82523d6000602084013e61175c565b606091505b509150915061176d87838387611778565b979650505050505050565b606083156118015782516000036117fa576001600160a01b0385163b6117fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104b7565b5081611664565b61166483838151156118165781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b79190611e6f565b6001600160a01b038116811461087a57600080fd5b60006020828403121561187157600080fd5b81356107268161184a565b801515811461087a57600080fd5b80356118958161187c565b919050565b600080604083850312156118ad57600080fd5b82356118b88161184a565b915060208301356118c88161187c565b809150509250929050565b6000602082840312156118e557600080fd5b5035919050565b600080604083850312156118ff57600080fd5b823561190a8161184a565b915060208301356118c88161184a565b6000806040838503121561192d57600080fd5b82356119388161184a565b946020939093013593505050565b60008060006060848603121561195b57600080fd5b83356119668161184a565b925060208401356119768161184a565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156119fd576119fd611987565b604052919050565b600067ffffffffffffffff821115611a1f57611a1f611987565b5060051b60200190565b6000601f8381840112611a3b57600080fd5b82356020611a50611a4b83611a05565b6119b6565b82815260059290921b85018101918181019087841115611a6f57600080fd5b8287015b84811015611b2457803567ffffffffffffffff80821115611a945760008081fd5b818a0191508a603f830112611aa95760008081fd5b85820135604082821115611abf57611abf611987565b611aee887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08c850116016119b6565b92508183528c81838601011115611b055760008081fd5b8181850189850137506000908201870152845250918301918301611a73565b50979650505050505050565b600080600060608486031215611b4557600080fd5b833567ffffffffffffffff80821115611b5d57600080fd5b818601915086601f830112611b7157600080fd5b81356020611b81611a4b83611a05565b82815260059290921b8401810191818101908a841115611ba057600080fd5b948201945b83861015611bc7578535611bb88161184a565b82529482019490820190611ba5565b97505087013592505080821115611bdd57600080fd5b50611bea86828701611a29565b925050611bf96040850161188a565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610c6557610c65611c02565b80820180821115610c6557610c65611c02565b60005b83811015611c72578181015183820152602001611c5a565b50506000910152565b60008151808452611c93816020860160208601611c57565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611d4b578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805115158452870151878401879052611d3887850182611c7b565b9588019593505090860190600101611cec565b509098975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611d9a57600080fd5b81516107268161184a565b600060208284031215611db757600080fd5b81516107268161187c565b60008251611dd4818460208701611c57565b9190910192915050565b60a081526000611df160a0830188611c7b565b86151560208401528281036040840152611e0b8187611c7b565b60608401959095525050608001529392505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611e5157611e51611c02565b5060010190565b8082028115828204841417610c6557610c65611c02565b6020815260006107266020830184611c7b56fea2646970667358221220b47159ab60bbf5e08b6da04c7489ee399e0b0b199b763f8740aebf29394b37ac64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b3afb6db38a8e72905165c1fbb96772e63560790000000000000000000000000b3afb6db38a8e72905165c1fbb96772e635607900000000000000000000000006c0542daee8cc6866529d4a68163eb157fb78999
-----Decoded View---------------
Arg [0] : executor (address): 0xB3AfB6DB38a8E72905165c1fBB96772e63560790
Arg [1] : collector (address): 0xB3AfB6DB38a8E72905165c1fBB96772e63560790
Arg [2] : owner (address): 0x6c0542DAeE8Cc6866529D4a68163eb157Fb78999
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000b3afb6db38a8e72905165c1fbb96772e63560790
Arg [1] : 000000000000000000000000b3afb6db38a8e72905165c1fbb96772e63560790
Arg [2] : 0000000000000000000000006c0542daee8cc6866529d4a68163eb157fb78999
Loading...
Loading
Loading...
Loading
Net Worth in USD
$24,968.83
Net Worth in ETH
11.625588
Token Allocations
ETH
93.09%
BNB
6.27%
AVAX
0.60%
Others
0.04%
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 88.74% | $2,146.42 | 10.3225 | $22,156.43 | |
| BSC | 6.27% | $659.73 | 2.3737 | $1,566.01 | |
| ARB | 3.42% | $2,146.72 | 0.3979 | $854.13 | |
| OP | 0.75% | $2,147.16 | 0.0875 | $187.85 | |
| AVAX | 0.60% | $9.59 | 15.7118 | $150.63 | |
| BASE | 0.18% | $2,146.39 | 0.0209 | $44.81 | |
| POL | 0.03% | $0.104448 | 74.9498 | $7.83 | |
| GNO | <0.01% | $0.999982 | 0.8659 | $0.865864 | |
| SONIC | <0.01% | $0.042833 | 6.6893 | $0.286524 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.