Source Code
Latest 17 from a total of 17 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Create Transfer ... | 6690414 | 570 days ago | IN | 0 FRAX | 0.00000121 | ||||
| Create DCA Order | 6689879 | 570 days ago | IN | 0 FRAX | 0.00000104 | ||||
| Swap Tokens | 6689621 | 570 days ago | IN | 0 FRAX | 0.00000096 | ||||
| Swap Tokens | 6686501 | 570 days ago | IN | 0 FRAX | 0.00000105 | ||||
| Swap Tokens | 6686455 | 570 days ago | IN | 0 FRAX | 0.00000103 | ||||
| Swap Tokens | 6686425 | 570 days ago | IN | 0 FRAX | 0.00000111 | ||||
| Create Transfer ... | 6664426 | 571 days ago | IN | 0 FRAX | 0.00000125 | ||||
| Create Transfer ... | 6664082 | 571 days ago | IN | 0 FRAX | 0.00000134 | ||||
| Create DCA Order | 6663638 | 571 days ago | IN | 0 FRAX | 0.00000262 | ||||
| Cancel Limit Ord... | 6662742 | 571 days ago | IN | 0 FRAX | 0.00000074 | ||||
| Create Limit Ord... | 6662408 | 571 days ago | IN | 0 FRAX | 0.000001 | ||||
| Swap Tokens | 6662255 | 571 days ago | IN | 0 FRAX | 0.00000081 | ||||
| Swap Tokens | 6662214 | 571 days ago | IN | 0 FRAX | 0.00000077 | ||||
| Cancel Swap Orde... | 6662193 | 571 days ago | IN | 0 FRAX | 0.00000062 | ||||
| Swap Tokens | 6662100 | 571 days ago | IN | 0 FRAX | 0.00000066 | ||||
| Cancel Swap Orde... | 6661648 | 571 days ago | IN | 0 FRAX | 0.00000045 | ||||
| Swap Tokens | 6661621 | 571 days ago | IN | 0 FRAX | 0.00000064 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Magenta
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;
import {Data} from "./timely/libraries/Data.sol";
import {IMagenta} from "./interfaces/IMagenta.sol";
import {ITimely} from "./timely/interfaces/ITimely.sol";
import {TimelyReceiver} from "./timely/TimelyReceiver.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {IUniswapV2Router01} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol";
import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import {IUniswapV2Factory} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
contract Magenta is TimelyReceiver, AccessControl, Pausable, IMagenta {
using SafeERC20 for IERC20;
using Math for uint256;
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
ITimely private _timely;
IUniswapV2Router01 private _router;
uint256 private _totalEarnedFees = 0;
uint256 private _magentaFee;
uint256 private _count;
bytes32 private _identifier;
// === Mappings ===
mapping(bytes32 => SwapOrder) private _swapOrders;
mapping(bytes32 => DCAOrder) private _dcaOrders;
mapping(bytes32 => LimitOrder) private _limitOrders;
mapping(bytes32 => TransferOrder) private _transferOrders;
mapping(bytes32 => OrderType) private _orderTypes;
constructor(
address timely,
address router,
uint256 magentaFee
) TimelyReceiver(timely) {
_timely = ITimely(getTimely());
_router = IUniswapV2Router01(router);
_magentaFee = magentaFee;
_grantRole(ADMIN_ROLE, _msgSender());
_grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
IERC20(_timely.getTimelyToken()).approve(
getTimely(),
type(uint256).max
);
}
// === Mutative Functions ===
function swapTokens(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOutMin,
uint64 startDelay,
uint256 deadline
) external payable override whenNotPaused returns (bytes32) {
IERC20(tokenIn).safeTransferFrom(_msgSender(), address(this), amountIn);
if (startDelay > 0) {
require(msg.value >= _magentaFee, "Insufficient fee");
_totalEarnedFees += _magentaFee;
uint256 numberOfExecution = 1;
uint256 timelyFee = _timely.estimateFee(numberOfExecution);
IERC20(_timely.getTimelyToken()).safeTransferFrom(
_msgSender(),
address(this),
timelyFee
);
_timely.deposit(timelyFee);
// Create the time function param.
Data.TimePayload memory timePayload = Data.TimePayload({
delay: startDelay,
iSchedule: Data.Schedule.ONCE,
iMinutes: Data.Minutes.INGORE,
iHours: Data.Hours.INGORE,
middleware: Data.Middleware.INGORE
});
// Publish the time function to timely network.
// And update the identifier.
bytes32 identifier = _timely.publish(timePayload);
_swapOrders[identifier] = SwapOrder({
actor: _msgSender(),
tokenIn: tokenIn,
tokenOut: tokenOut,
amountIn: amountIn,
amountOutMin: amountOutMin,
timestamp: block.timestamp,
deadline: deadline,
completed: false
});
_orderTypes[identifier] = OrderType.SwapOrder;
emit SwapOrderCreated(
_msgSender(),
identifier,
tokenIn,
tokenOut,
amountIn,
amountOutMin,
startDelay,
deadline
);
return identifier;
}
address[] memory path = new address[](2);
path[0] = tokenIn;
path[1] = tokenOut;
IERC20(tokenIn).approve(address(_router), amountIn);
_router.swapExactTokensForTokens(
amountIn,
amountOutMin,
path,
_msgSender(),
deadline
);
bytes32 nullIdentifier = bytes32(
keccak256(
abi.encode(
_msgSender(),
tokenIn,
tokenOut,
amountIn,
block.timestamp
)
)
);
emit SwapOrderCreated(
_msgSender(),
nullIdentifier,
tokenIn,
tokenOut,
amountIn,
amountOutMin,
startDelay,
deadline
);
emit SwapOrderExecuted(nullIdentifier);
return nullIdentifier;
}
function cancelSwapOrder(bytes32 identifier) external whenNotPaused {
SwapOrder storage order = _swapOrders[identifier];
require(!order.completed, "Order was completed");
require(order.actor == _msgSender());
IERC20(order.tokenIn).safeTransfer(order.actor, order.amountIn);
// mark as completed
order.completed = true;
_timely.cancel(identifier);
emit SwapOrderCancelled(identifier);
}
function createLimitOrder(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOutMin,
uint64 startDelay,
uint256 deadline
) external payable override whenNotPaused returns (bytes32) {
IERC20(tokenIn).safeTransferFrom(_msgSender(), address(this), amountIn);
require(msg.value >= _magentaFee, "Insufficient fee");
_totalEarnedFees += _magentaFee;
uint256 numberOfExecution = 1;
uint256 timelyFee = _timely.estimateFee(numberOfExecution);
IERC20(_timely.getTimelyToken()).safeTransferFrom(
_msgSender(),
address(this),
timelyFee
);
_timely.deposit(timelyFee);
// Create the time function param.
Data.TimePayload memory timePayload = Data.TimePayload({
delay: startDelay,
iSchedule: Data.Schedule.REPEAT,
iMinutes: Data.Minutes.ONE_MINUTES,
iHours: Data.Hours.INGORE,
middleware: Data.Middleware.EXISTS
});
// Publish the time function to timely network.
// And update the identifier.
bytes32 identifier = _timely.publish(timePayload);
_limitOrders[identifier] = LimitOrder({
actor: _msgSender(),
tokenIn: tokenIn,
tokenOut: tokenOut,
amountIn: amountIn,
amountOutMin: amountOutMin,
timestamp: block.timestamp,
deadline: deadline,
completed: false
});
_orderTypes[identifier] = OrderType.DCAOrder;
emit LimitOrderCreated(
_msgSender(),
identifier,
tokenIn,
tokenOut,
amountIn,
amountOutMin,
startDelay,
deadline
);
return identifier;
}
function cancelLimitOrder(
bytes32 identifier
) external override whenNotPaused {
LimitOrder storage order = _limitOrders[identifier];
require(!order.completed, "Order was completed");
require(order.actor == _msgSender());
IERC20(order.tokenIn).safeTransfer(order.actor, order.amountIn);
// mark as completed
order.completed = true;
_timely.cancel(identifier);
emit LimitOrdeCancelled(identifier);
}
function createDCAOrder(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint64 startDelay,
uint256 numOfOrders,
Data.Minutes iMinutes,
Data.Hours iHours
) external payable override whenNotPaused returns (bytes32) {
IERC20(tokenIn).safeTransferFrom(_msgSender(), address(this), amountIn);
require(msg.value >= _magentaFee, "Insufficient fee");
_totalEarnedFees += _magentaFee;
uint256 numberOfExecution = numOfOrders;
uint256 timelyFee = _timely.estimateFee(numberOfExecution);
IERC20(_timely.getTimelyToken()).safeTransferFrom(
_msgSender(),
address(this),
timelyFee
);
_timely.deposit(timelyFee);
// Create the time function param.
Data.TimePayload memory timePayload = Data.TimePayload({
delay: startDelay,
iSchedule: Data.Schedule.REPEAT,
iMinutes: iMinutes,
iHours: iHours,
middleware: Data.Middleware.INGORE
});
// Publish the time function to timely network.
// And update the identifier.
bytes32 identifier = _timely.publish(timePayload);
_dcaOrders[identifier] = DCAOrder({
actor: _msgSender(),
tokenIn: tokenIn,
tokenOut: tokenOut,
amountIn: amountIn,
numOfOrders: numOfOrders,
iMinutes: iMinutes,
iHours: iHours,
amountInBalance: amountIn,
timestamp: block.timestamp,
completed: false
});
_orderTypes[identifier] = OrderType.DCAOrder;
emit DCAOrderCreated(
_msgSender(),
identifier,
tokenIn,
tokenOut,
amountIn,
startDelay,
numOfOrders,
iMinutes,
iHours
);
return identifier;
}
function cancelDCAOrder(
bytes32 identifier
) external override whenNotPaused {
DCAOrder storage order = _dcaOrders[identifier];
require(!order.completed, "Order was completed");
require(order.actor == _msgSender());
IERC20(order.tokenIn).safeTransfer(order.actor, order.amountInBalance);
// mark as completed
order.completed = true;
_timely.cancel(identifier);
emit DCAOrderCancelled(identifier);
}
function createTransferOrder(
address receiver,
address tokenIn,
uint256 amountIn,
uint64 startDelay,
uint256 numOfOrders,
Data.Minutes iMinutes,
Data.Hours iHours
) external payable override whenNotPaused returns (bytes32) {
require(_msgSender() != receiver, "Can't do self transfer");
IERC20(tokenIn).safeTransferFrom(_msgSender(), address(this), amountIn);
uint256 numberOfExecution = numOfOrders;
require(msg.value >= _magentaFee, "Insufficient fee");
_totalEarnedFees += _magentaFee;
uint256 timelyFee = _timely.estimateFee(numberOfExecution);
IERC20(_timely.getTimelyToken()).safeTransferFrom(
_msgSender(),
address(this),
timelyFee
);
_timely.deposit(timelyFee);
// Create the time function param.
Data.TimePayload memory timePayload = Data.TimePayload({
delay: startDelay,
iSchedule: Data.Schedule.REPEAT,
iMinutes: iMinutes,
iHours: iHours,
middleware: Data.Middleware.INGORE
});
// Publish the time function to timely network.
// And update the identifier.
bytes32 identifier = _timely.publish(timePayload);
_transferOrders[identifier] = TransferOrder({
actor: _msgSender(),
receiver: receiver,
tokenIn: tokenIn,
amountIn: amountIn,
numOfOrders: numOfOrders,
iMinutes: iMinutes,
iHours: iHours,
amountInBalance: amountIn,
timestamp: block.timestamp,
completed: false
});
_orderTypes[identifier] = OrderType.TransferOrder;
emit TransferOrderCreated(
_msgSender(),
identifier,
receiver,
tokenIn,
amountIn,
startDelay,
numOfOrders,
iMinutes,
iHours
);
return identifier;
}
function cancelTranferOrder(
bytes32 identifier
) external override whenNotPaused {
TransferOrder storage order = _transferOrders[identifier];
require(!order.completed, "TransferOrder was completed");
require(order.actor == _msgSender());
IERC20(order.tokenIn).safeTransfer(order.actor, order.amountInBalance);
// mark as completed
order.completed = true;
_timely.cancel(identifier);
emit TransferOrderCancelled(identifier);
}
// === Internal Callback Functions ===
function _timelyCallback(
Data.TimePayloadIn calldata timePayload
) internal virtual override {
bytes32 identifier = timePayload.identifier;
OrderType orderType = _orderTypes[identifier];
if (orderType == OrderType.SwapOrder) {
_executeSwapOrderInternal(identifier);
}
if (orderType == OrderType.LimitOrder) {
_executeLimitOrderInternal(identifier);
}
if (orderType == OrderType.DCAOrder) {
_executeDCAOrderInternal(identifier);
}
if (orderType == OrderType.TransferOrder) {
_executeTransferInternal(identifier);
}
// Check if deposited amount will be enough for next iteration.
uint256 estimatedFee = _timely.estimateFee(1);
if (_timely.balanceOf(address(this)) < estimatedFee) {
// pay for next five iteration.
_timely.deposit(estimatedFee * 5);
}
}
function _timelyMiddleware(
bytes32 identifier
) internal view virtual override returns (bool) {
OrderType orderType = _orderTypes[identifier];
if (orderType == OrderType.LimitOrder) {
LimitOrder memory order = _limitOrders[identifier];
uint256 amountOut = getAmountOut(
order.tokenIn,
order.tokenOut,
order.amountIn,
0
);
return amountOut >= order.amountOutMin;
}
return true;
}
// === Internal Functions ===
function _executeSwapOrderInternal(bytes32 identifier) internal {
SwapOrder storage order = _swapOrders[identifier];
require(!order.completed, "Order has been completed");
address[] memory path = new address[](2);
path[0] = order.tokenIn;
path[1] = order.tokenOut;
IERC20(order.tokenIn).approve(address(_router), order.amountIn);
_router.swapExactTokensForTokens(
order.amountIn,
order.amountOutMin,
path,
order.actor,
order.deadline
);
// mark as completed
order.completed = true;
_timely.cancel(identifier);
emit SwapOrderExecuted(identifier);
}
function _executeLimitOrderInternal(bytes32 identifier) internal {
LimitOrder storage order = _limitOrders[identifier];
require(!order.completed, "Order has been completed");
address[] memory path = new address[](2);
path[0] = order.tokenIn;
path[1] = order.tokenOut;
IERC20(order.tokenIn).approve(address(_router), order.amountIn);
_router.swapExactTokensForTokens(
order.amountIn,
order.amountOutMin,
path,
order.actor,
order.deadline
);
// mark as completed
order.completed = true;
_timely.cancel(identifier);
emit LimitOrderExecuted(identifier);
}
function _executeDCAOrderInternal(bytes32 identifier) internal {
DCAOrder storage order = _dcaOrders[identifier];
require(!order.completed, "Order has been completed");
uint256 amountPerSwap = order.amountIn / order.numOfOrders;
address[] memory path = new address[](2);
path[0] = order.tokenIn;
path[1] = order.tokenOut;
IERC20(order.tokenIn).approve(address(_router), amountPerSwap);
_router.swapExactTokensForTokens(
amountPerSwap,
0, // amountOutMin
path,
order.actor,
block.timestamp + 10 // deadline
);
order.amountInBalance -= amountPerSwap;
// clean up before completing
if (amountPerSwap > order.amountInBalance) {
if (order.amountInBalance > 0) {
IERC20(order.tokenIn).safeTransfer(
order.actor,
order.amountInBalance
);
order.amountInBalance = 0;
}
// mark as completed
order.completed = true;
_timely.cancel(identifier);
}
emit DCAOrderExecuted(identifier, order.amountInBalance);
}
function _executeTransferInternal(bytes32 identifier) internal {
TransferOrder storage order = _transferOrders[identifier];
require(!order.completed, "TransferOrder has been completed");
uint256 amountPerTransfer = order.amountIn / order.numOfOrders;
IERC20(order.tokenIn).safeTransfer(order.receiver, amountPerTransfer);
order.amountInBalance -= amountPerTransfer;
// clean up before completing
if (amountPerTransfer > order.amountInBalance) {
if (order.amountInBalance > 0) {
IERC20(order.tokenIn).safeTransfer(
order.receiver,
order.amountInBalance
);
order.amountInBalance = 0;
}
// mark as completed
order.completed = true;
_timely.cancel(identifier);
}
emit TransferOrderExecuted(identifier, order.amountInBalance);
}
// === Public Functions ===
function getAmountOut(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 fee
) public view override returns (uint256) {
address pair = IUniswapV2Factory(_router.factory()).getPair(
tokenIn,
tokenOut
);
(uint112 reserve0, uint112 reserve1, ) = IUniswapV2Pair(pair)
.getReserves();
address token0 = IUniswapV2Pair(pair).token0();
(uint112 reserveIn, uint112 reserveOut) = tokenIn == token0
? (reserve0, reserve1)
: (reserve1, reserve0);
uint256 amountOut = _getAmountOut(amountIn, reserveIn, reserveOut, fee);
return amountOut;
}
// === Private Functions ===
function _getAmountOut(
uint256 amountIn,
uint112 reserveIn,
uint256 reserveOut,
uint256 fee
) private pure returns (uint256) {
uint256 usedFee = fee > 0 ? fee : 9_970;
require(amountIn > 0 && reserveIn > 0 && reserveOut > 0); // INSUFFICIENT_INPUT_AMOUNT, INSUFFICIENT_LIQUIDITY
uint256 amountInWithFee = amountIn * usedFee;
uint256 numerator = amountInWithFee * reserveOut;
uint256 denominator = (reserveIn * 10_000) + amountInWithFee;
return numerator / denominator;
}
// === Admin Functions ===
function depositFunds(uint256 amount) external onlyRole(ADMIN_ROLE) {
_timely.deposit(amount);
}
function withdrawFees(
address receiver,
uint256 amount
) external onlyRole(ADMIN_ROLE) {
require(amount <= _totalEarnedFees, "Insufficient amount");
payable(receiver).transfer(amount);
_totalEarnedFees -= amount;
}
function updateMagentaFee(uint256 newFee) external onlyRole(ADMIN_ROLE) {
_magentaFee = newFee;
}
function pause() external onlyRole(ADMIN_ROLE) {
_pause();
}
function unPause() external onlyRole(ADMIN_ROLE) {
_unpause();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;
import {Data} from "../timely/libraries/Data.sol";
interface IMagenta {
// === Enums ===
enum OrderType {
SwapOrder,
LimitOrder,
DCAOrder,
TransferOrder
}
// === Structs ===
struct SwapOrder {
address actor;
address tokenIn;
address tokenOut;
uint256 amountIn;
uint256 amountOutMin;
uint256 timestamp;
uint256 deadline;
bool completed;
}
struct LimitOrder {
address actor;
address tokenIn;
address tokenOut;
uint256 amountIn;
uint256 amountOutMin;
uint256 timestamp;
uint256 deadline;
bool completed;
}
struct DCAOrder {
address actor;
address tokenIn;
address tokenOut;
uint256 amountIn;
uint256 numOfOrders;
Data.Minutes iMinutes;
Data.Hours iHours;
uint256 amountInBalance;
uint256 timestamp;
bool completed;
}
struct TransferOrder {
address actor;
address receiver;
address tokenIn;
uint256 amountIn;
uint256 numOfOrders;
Data.Minutes iMinutes;
Data.Hours iHours;
uint256 amountInBalance;
uint256 timestamp;
bool completed;
}
// === Events ===
event SwapOrderCreated(
address indexed actor,
bytes32 indexed identifier,
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOutMin,
uint64 startDelay,
uint256 deadline
);
event SwapOrderCancelled(bytes32 indexed identifier);
event SwapOrderExecuted(bytes32 indexed identifier);
event LimitOrderCreated(
address indexed actor,
bytes32 indexed identifier,
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOutMin,
uint64 startDelay,
uint256 deadline
);
event LimitOrdeCancelled(bytes32 indexed identifier);
event LimitOrderExecuted(bytes32 indexed identifier);
event DCAOrderCreated(
address indexed actor,
bytes32 indexed identifier,
address tokenIn,
address tokenOut,
uint256 amountIn,
uint64 startDelay,
uint256 numOfOrders,
Data.Minutes iMinutes,
Data.Hours iHours
);
event DCAOrderCancelled(bytes32 indexed identifier);
event DCAOrderExecuted(bytes32 indexed identifier, uint256 amountInBalance);
event TransferOrderCreated(
address indexed actor,
bytes32 indexed identifier,
address receiver,
address tokenIn,
uint256 amountIn,
uint64 startDelay,
uint256 numOfOrders,
Data.Minutes iMinutes,
Data.Hours iHours
);
event TransferOrderCancelled(bytes32 indexed identifier);
event TransferOrderExecuted(
bytes32 indexed identifier,
uint256 amountInBalance
);
// === Functions ===
function swapTokens(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOutMin,
uint64 startDelay,
uint256 deadline
) external payable returns (bytes32);
function cancelSwapOrder(bytes32 identifier) external;
function createLimitOrder(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOutMin,
uint64 startDelay,
uint256 deadline
) external payable returns (bytes32);
function cancelLimitOrder(bytes32 identifier) external;
function createDCAOrder(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint64 startDelay,
uint256 numOfOrders,
Data.Minutes iMinutes,
Data.Hours iHours
) external payable returns (bytes32);
function cancelDCAOrder(bytes32 identifier) external;
function createTransferOrder(
address receiver,
address tokenIn,
uint256 amountIn,
uint64 startDelay,
uint256 numOfOrders,
Data.Minutes iMinutes,
Data.Hours iHours
) external payable returns (bytes32);
function cancelTranferOrder(bytes32 identifier) external;
function getAmountOut(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 fee
) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;
import {Data} from "../libraries/Data.sol";
interface ITimely {
error IndexAlreadyExecuted(bytes32 identifier, uint64 index);
error InsufficientFee();
error InsufficientAmount(uint256 amount);
error UnAuthorize();
error IdentifierAlreadyCancelled();
event Published(
uint64 indexed nonce,
bytes32 indexed identifier,
address sender,
uint64 delay,
Data.Schedule iSchedule,
Data.Minutes iMinutes,
Data.Hours iHours,
Data.Middleware middleware
);
event Deposited(address sender, uint256 amount);
event Withdrawn(address sender, uint256 amount);
event Cancelled(bytes32 identifier);
event ClaimedTokens(address tokenId, uint256 amount);
function publish(
Data.TimePayload calldata timePayload
) external returns (bytes32);
function cancel(bytes32 identifier) external;
function deposit(uint256 amount) external;
function withdraw(uint256 amount) external;
function balanceOf(address sender) external view returns (uint256);
function getTimelyToken() external view returns (address);
function claimTokens(address tokenId, uint256 amount) external;
function estimateFee(uint256 indexCount) external view returns (uint256);
function isExecuted(
bytes32 identifier,
uint64 index
) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;
import {Data} from "../libraries/Data.sol";
interface ITimelyReceiver {
function timelyCallback(Data.TimePayloadIn calldata timePayload) external;
function timelyMiddleware(bytes32 identifier) external view returns (bool);
function getTimely() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;
library Data {
enum Minutes {
ONE_MINUTES,
TWO_MINUTES,
FIVE_MINUTES,
TEN_MINUTES,
FIFTEEN_MINUTES,
TWENTY_MINUTES,
TWENTY_FIVE_MINUTES,
THIRTY_MINUTES,
THIRTY_FIVE_MINUTES,
FORTY_MINUTES,
FORTY_FIVE_MINUTES,
FIFTY_MINUTES,
FIFTY_FIVE_MINUTES,
SIXTY_MINUTES,
INGORE
}
enum Hours {
ZERO_HOUR,
ONE_HOUR,
TWO_HOUR,
THREE_HOUR,
FOUR_HOUR,
FIVE_HOUR,
SIX_HOUR,
SEVEN_HOUR,
EIGHT_HOUR,
NINE_HOUR,
TEN_HOUR,
ELEVEN_HOUR,
TWELVE_HOUR,
THIRTEEN_HOUR,
FOURTEEN_HOUR,
FIFTEEN_HOUR,
SIXTEEN_HOUR,
SEVENTEEN_HOUR,
EIGHTEEN_HOUR,
NINETEEN_HOUR,
TWENTY_HOUR,
TWENTY_ONE_HOUR,
TWENTY_TWO_HOUR,
TWENTY_THREE_HOUR,
INGORE
}
enum Schedule {
ONCE,
REPEAT
}
enum Middleware {
EXISTS,
INGORE
}
struct TimePayload {
uint64 delay;
Schedule iSchedule;
Minutes iMinutes;
Hours iHours;
Middleware middleware;
}
struct TimePayloadIn {
bytes32 identifier;
uint64 index;
}
}// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;
import {Data} from "./libraries/Data.sol";
import {ITimelyReceiver} from "./interfaces/ITimelyReceiver.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
abstract contract TimelyReceiver is ITimelyReceiver, Context {
address private immutable _timely;
constructor(address timely_) {
if (timely_ == address(0)) revert InvalidRouter(address(0));
_timely = timely_;
}
function timelyCallback(
Data.TimePayloadIn calldata timePayload
) external virtual override onlyTimely {
_timelyCallback(timePayload);
}
function timelyMiddleware(
bytes32 identifier
) external view virtual override returns (bool) {
return _timelyMiddleware(identifier);
}
function _timelyCallback(
Data.TimePayloadIn calldata timePayload
) internal virtual;
function _timelyMiddleware(
bytes32 identifier
) internal view virtual returns (bool);
function getTimely() public view override returns (address) {
return _timely;
}
error InvalidRouter(address router);
modifier onlyTimely() {
if (_timely != _msgSender()) revert InvalidRouter(_msgSender());
_;
}
}{
"optimizer": {
"enabled": true,
"runs": 1000
},
"viaIR": true,
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"timely","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"magentaFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"router","type":"address"}],"name":"InvalidRouter","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"DCAOrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"actor","type":"address"},{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startDelay","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"numOfOrders","type":"uint256"},{"indexed":false,"internalType":"enum Data.Minutes","name":"iMinutes","type":"uint8"},{"indexed":false,"internalType":"enum Data.Hours","name":"iHours","type":"uint8"}],"name":"DCAOrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountInBalance","type":"uint256"}],"name":"DCAOrderExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"LimitOrdeCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"actor","type":"address"},{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startDelay","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"LimitOrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"LimitOrderExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"SwapOrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"actor","type":"address"},{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startDelay","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"SwapOrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"SwapOrderExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"TransferOrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"actor","type":"address"},{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startDelay","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"numOfOrders","type":"uint256"},{"indexed":false,"internalType":"enum Data.Minutes","name":"iMinutes","type":"uint8"},{"indexed":false,"internalType":"enum Data.Hours","name":"iHours","type":"uint8"}],"name":"TransferOrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountInBalance","type":"uint256"}],"name":"TransferOrderExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"cancelDCAOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"cancelLimitOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"cancelSwapOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"cancelTranferOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint64","name":"startDelay","type":"uint64"},{"internalType":"uint256","name":"numOfOrders","type":"uint256"},{"internalType":"enum Data.Minutes","name":"iMinutes","type":"uint8"},{"internalType":"enum Data.Hours","name":"iHours","type":"uint8"}],"name":"createDCAOrder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint64","name":"startDelay","type":"uint64"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"createLimitOrder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint64","name":"startDelay","type":"uint64"},{"internalType":"uint256","name":"numOfOrders","type":"uint256"},{"internalType":"enum Data.Minutes","name":"iMinutes","type":"uint8"},{"internalType":"enum Data.Hours","name":"iHours","type":"uint8"}],"name":"createTransferOrder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimely","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint64","name":"startDelay","type":"uint64"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokens","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"identifier","type":"bytes32"},{"internalType":"uint64","name":"index","type":"uint64"}],"internalType":"struct Data.TimePayloadIn","name":"timePayload","type":"tuple"}],"name":"timelyCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"timelyMiddleware","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"updateMagentaFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a060409080825234620001fa576060816200362b8038038091620000258285620001ff565b833981010312620001fa576200003b8162000239565b906020836200004c82840162000239565b9201516001600160a01b039284841615620001e257608085905260018054600060038190556001600160a81b031990911660089790971b610100600160a81b0316969096179055600280546001600160a01b031916918516919091179055600455620000b8336200024e565b50620000c433620002f0565b506004818360015460081c168651928380926322f0122b60e21b82525afa908115620001d857908291859162000196575b5060448460805116868851968794859363095ea7b360e01b855260048501526000196024850152165af180156200018c576200014b575b835161329a90816200037182396080518181816101e40152610e6d0152f35b81813d831162000184575b620001628183620001ff565b81010312620001805751801515036200017d5780806200012c565b80fd5b5080fd5b503d62000156565b84513d85823e3d90fd5b82819392503d8311620001d0575b620001b08183620001ff565b81010312620001cc57620001c5829162000239565b38620000f5565b8380fd5b503d620001a4565b85513d86823e3d90fd5b85516335fdcccd60e21b815260006004820152602490fd5b600080fd5b601f909101601f19168101906001600160401b038211908210176200022357604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620001fa57565b6001600160a01b031660008181527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60205260408120549091907fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff16620002eb57808352826020526040832082845260205260408320600160ff198254161790556000805160206200360b833981519152339380a4600190565b505090565b6001600160a01b031660008181527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604081205490919060ff166200036c57818052816020526040822081835260205260408220600160ff1982541617905533916000805160206200360b8339815191528180a4600190565b509056fe608080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a714611f205750806313cb1f8314611ccc5780631f691f3a14611a01578063244719b51461191c578063248a9ca3146118f05780632f2ff15d146118b35780632f4be9d0146118905780633076315a14611867578063308d6c9614610e5057806336568abe14610df05780633b76594d14610d7f5780634584eff614610c9a57806346662d0f14610b7457806349488f0e14610b4a5780635c975abb14610b275780636e45bb571461083857806375b238fc146107fd5780638456cb59146107a3578063892037e8146106ab57806391d148541461065f578063a217fddf14610643578063ad3b1b4714610595578063b7649f4814610249578063d547741f14610208578063efc48f06146101c45763f7b188a51461013f57600080fd5b346101c157806003193601126101c157610157612bf9565b60015460ff8116156101975760ff19166001557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60046040517f8dfc202b000000000000000000000000000000000000000000000000000000008152fd5b80fd5b50346101c157806003193601126101c15760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101c15760403660031901126101c157610245600435610228611fd6565b90808452836020526102406001604086200154612c8c565b613030565b5080f35b5061025336611fec565b919096959492610261612b11565b6102768530336001600160a01b038a16612b47565b6102906004546102888134101561219e565b6003546121e9565b6003556001600160a01b0360015460081c166040519063127e8e4d60e01b8252836004830152602082602481845afa918215610555578992610560575b506020600491604051928380926322f0122b60e21b82525afa9081156105555761030d9183918b91610526575b5030906001600160a01b03339116612b47565b6001600160a01b0360015460081c1690813b1561052257889160248392604051948593849263b6b55f2560e01b845260048401525af18015610517579088916104ff575b5060206103c2604051610363816120d0565b67ffffffffffffffff851681526001838201526103838c6040830161222c565b6103908760608301612238565b600160808201526001600160a01b0360015460081c16906040519b8c8094819362bf4e7760e21b83526004830161225e565b03925af19788156104f25781986104aa575b50926020987f9565ca896f98673a0cb29eba8400d67ee0868e732ad92006209d426521012228959361049f9360408b9a999761047e8251610414816120ec565b3381526001600160a01b038d1660208201526001600160a01b038a16848201528a606082015285608082015261044d8760a0830161222c565b61045a8860c08301612238565b8a60e082015242610100820152826101208201528d83528f600890528383206122be565b8b8152600b8e5220600260ff19825416179055604051968796339a88612393565b0390a3604051908152f35b91949297509594926020823d6020116104ea575b816104cb60209383612142565b810103126104e557905196949592949193909260206103d4565b600080fd5b3d91506104be565b50604051903d90823e3d90fd5b610508906120a6565b610513578638610351565b8680fd5b6040513d8a823e3d90fd5b8880fd5b610548915060203d60201161054e575b6105408183612142565b810190612164565b386102fa565b503d610536565b6040513d8b823e3d90fd5b9091506020813d60201161058d575b8161057c60209383612142565b810103126104e557519060206102cd565b3d915061056f565b50346101c15760403660031901126101c1576105af611fc0565b602435906105bb612bf9565b60035482116105ff57828080848194829082156105f5575b6001600160a01b031690f1156104f2576105ef90600354612ad1565b60035580f35b6108fc91506105d3565b606460405162461bcd60e51b815260206004820152601360248201527f496e73756666696369656e7420616d6f756e74000000000000000000000000006044820152fd5b50346101c157806003193601126101c157602090604051908152f35b50346101c15760403660031901126101c1576001600160a01b036040610683611fd6565b92600435815280602052209116600052602052602060ff604060002054166040519015158152f35b50346101c15760203660031901126101c1576004356106c8612b11565b80825260076020528160408120600781016106e760ff825416156123e6565b6001600160a01b0391828154169033820361079f576107129160038560018401541692015491612ba4565b600160ff1982541617905560015460081c16803b156107905781809160246040518094819363c4d252f560e01b83528860048401525af180156107945761077c575b50807fa5372cfc0abf52b270bfc1f8b9afac84cb49534155cb8d3a47decc2dc80e597a91a280f35b610785906120a6565b610790578138610754565b5080fd5b6040513d84823e3d90fd5b8480fd5b50346101c157806003193601126101c1576107bc612bf9565b6107c4612b11565b600160ff19815416176001557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b50346101c157806003193601126101c15760206040517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b5061084236612054565b6108529694919695939295612b11565b6001600160a01b03968785169661086b8530338b612b47565b61087d6004546102888134101561219e565b6003558860015460081c16986040519963127e8e4d60e01b8b52600160048c015260209a8b81602481855afa908115610aee578c908b92610af9575b5060049192604051928380926322f0122b60e21b82525afa908115610aee576108f39183918e8d92610ad1575b5050309085339116612b47565b8160015460081c1690813b15610acd57899160248392604051948593849263b6b55f2560e01b845260048401525af1801561055557908991610ab5575b50908a61098c604051610942816120d0565b67ffffffffffffffff87168152600183820152846040820152601860608201528460808201528360015460081c16906040519c8d8094819362bf4e7760e21b83526004830161225e565b03925af198891561079457908b91839a610a72575b5061049f9492610a1a8b9c60097f881d8b2d13db5f16a1eb42b207685769fa2b66d31ffb425d3c4cc1c09fd4cd2e9b9a9997958e6040968751946109e486612109565b338652838601528c16878501528c60608501528760808501524260a08501528960c08501528560e0850152855252838320612431565b600b8d5220600260ff19825416179055604051958695339987929360a09467ffffffffffffffff939897969260c08601996001600160a01b038092168752166020860152604085015260608401521660808201520152565b828196949998979593929b503d8311610aae575b610a908183612142565b810103126104e5579251979495939491939092918a9061049f6109a1565b503d610a86565b610abe906120a6565b610ac9578738610930565b8780fd5b8980fd5b610ae79250803d1061054e576105408183612142565b388e6108e6565b6040513d8c823e3d90fd5b809250813d8311610b20575b610b0f8183612142565b810103126104e557518b60046108b9565b503d610b05565b50346101c157806003193601126101c157602060ff600154166040519015158152f35b6020610b6c610b5836612054565b94610b67949194939293612b11565b612602565b604051908152f35b50346101c15760203660031901126101c157600435610b91612b11565b808252600a60205260408220600881019060ff825416610c565783916001600160a01b0391828154169033820361079f57610bd89160068560028401541692015491612ba4565b600160ff1982541617905560015460081c16803b156107905781809160246040518094819363c4d252f560e01b83528860048401525af1801561079457610c42575b50807f0c848505d086791e836af5bd9381a53f86e3621daa7c04dca2c00e4f9a4939e791a280f35b610c4b906120a6565b610790578138610c1a565b606460405162461bcd60e51b815260206004820152601b60248201527f5472616e736665724f726465722077617320636f6d706c6574656400000000006044820152fd5b50346101c15760203660031901126101c157600435610cb7612b11565b8082526009602052816040812060078101610cd660ff825416156123e6565b6001600160a01b0391828154169033820361079f57610d019160038560018401541692015491612ba4565b600160ff1982541617905560015460081c16803b156107905781809160246040518094819363c4d252f560e01b83528860048401525af1801561079457610d6b575b50807fa90c1ea1f8bf26cf5f70d9b0fd7716e41f4c34e97aef5ab1aba7088fdbf766c791a280f35b610d74906120a6565b610790578138610d43565b50346101c15760203660031901126101c157610d99612bf9565b806001600160a01b0360015460081c16803b15610ded5781809160246040518094819363b6b55f2560e01b835260043560048401525af1801561079457610ddd5750f35b610de6906120a6565b6101c15780f35b50fd5b50346101c15760403660031901126101c157610e0a611fd6565b336001600160a01b03821603610e265761024590600435613030565b60046040517f6697b232000000000000000000000000000000000000000000000000000000008152fd5b50346101c15760403660031901126101c157336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001603611837576004358152600b60205260ff6040822054166004811015611823578015611655575b6001811461147c575b600281146111c4575b600314611041575b6001600160a01b0360015460081c16906040519163127e8e4d60e01b835260016004840152602083602481845afa92831561079457829361100d575b506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa908115611002579084918491610fcd575b5010610f5b575080f35b600583029280840460051490151715610fb9578192813b15610fb557829160248392604051948593849263b6b55f2560e01b845260048401525af1801561079457610fa4575080f35b610fad906120a6565b6101c1578080f35b5050fd5b602482634e487b7160e01b81526011600452fd5b9150506020813d602011610ffa575b81610fe960209383612142565b810103126104e55783905138610f51565b3d9150610fdc565b6040513d85823e3d90fd5b9092506020813d602011611039575b8161102960209383612142565b810103126104e557519138610f0a565b3d915061101c565b6004358152600a602052604081206008810160ff8154166111805761106f6003830154600484015490612af1565b600283019060066001600160a01b038354169461109c8360018301976001600160a01b0389541690612ba4565b01936110a9828654612ad1565b8092818755116110ec575b50505050546040519081527f54b285b8a6ab0d6f347202ca2858b0846dd6fb4e2970d757469805726c5ada92602060043592a2610ece565b8161115d575b505050600160ff19825416179055816001600160a01b0360015460081c16803b156107905781809160246040518094819363c4d252f560e01b835260043560048401525af1801561079457611149575b80806110b4565b611152906120a6565b610790578138611142565b6001600160a01b038061117594541691541690612ba4565b8282553880806110f2565b606460405162461bcd60e51b815260206004820152602060248201527f5472616e736665724f7264657220686173206265656e20636f6d706c657465646044820152fd5b6004358252600860205260408220906111e460ff60088401541615613186565b6111f76003830154600484015490612af1565b9160405161120481612126565b6002815260403660208301376112866020856001600160a01b036001860154168061122e866124c6565b526001600160a01b03600287015416611246866124e9565b526001600160a01b03600254168960405180968195829463095ea7b360e01b845260048401602090939291936001600160a01b0360408201951681520152565b03925af1801561147157611442575b506001600160a01b03600254166001600160a01b0383541691600a4201421161142e5786916112ef91836040518096819582946338ed173960e01b84528c600485015284602485015260a0604485015260a484019061258d565b906064830152600a4201608483015203925af1801561142357611401575b50600681019261131e818554612ad1565b809181865511611364575b5050600391546040519081527f48ba250ae62c1335c72d7f362e2c3d651b0e9bcd3e38326dbac1e52d0562834c602060043592a29050610ec6565b806113d5575b506008600160ff19828401541617910155826001600160a01b0360015460081c16803b156107905781809160246040518094819363c4d252f560e01b835260043560048401525af180156107945715611329576113c6906120a6565b6113d1578238611329565b8280fd5b6113f8906001600160a01b036001840154166001600160a01b0384541690612ba4565b8383553861136a565b61141c903d8087833e6114148183612142565b810190612511565b503861130d565b6040513d87823e3d90fd5b602487634e487b7160e01b81526011600452fd5b6114639060203d60201161146a575b61145b8183612142565b8101906124f9565b5038611295565b503d611451565b6040513d88823e3d90fd5b6004358252600960205260408220600781019061149d60ff83541615613186565b836040516114aa81612126565b6002815260403660208301376001600160a01b03600184015416806114ce836124c6565b526001600160a01b036002850154166114e6836124e9565b5260025460038501805460405163095ea7b360e01b81526001600160a01b0390931660048401526024830152916020908290604490829088905af1801561162b57611636575b506001600160a01b036002541690548360048601549161157260066001600160a01b03895416980154604051988997889687956338ed173960e01b8752600487016125ca565b03925af1801561162b57611611575b50600160ff19825416179055816001600160a01b0360015460081c16803b156107905781809160246040518094819363c4d252f560e01b835260043560048401525af18015610794576115fd575b50506004357f9fb1132030bbdb5134b7c78b7fff2a49745433acfa0aae4a4fb481813bb8d87c8380a2610ebd565b611606906120a6565b6107905781386115cf565b611624903d8086833e6114148183612142565b5038611581565b6040513d86823e3d90fd5b61164e9060203d60201161146a5761145b8183612142565b503861152c565b6004358252600760205260408220600781019061167660ff83541615613186565b8360405161168381612126565b6002815260403660208301376001600160a01b03600184015416806116a7836124c6565b526001600160a01b036002850154166116bf836124e9565b5260025460038501805460405163095ea7b360e01b81526001600160a01b0390931660048401526024830152916020908290604490829088905af1801561162b57611804575b506001600160a01b036002541690548360048601549161174b60066001600160a01b03895416980154604051988997889687956338ed173960e01b8752600487016125ca565b03925af1801561162b576117ea575b50600160ff19825416179055816001600160a01b0360015460081c16803b156107905781809160246040518094819363c4d252f560e01b835260043560048401525af18015610794576117d6575b50506004357f2248d3a7ef2c2079b1fdd5ae3de854c74f65a50086908f1f30435ebc99812a128380a2610eb4565b6117df906120a6565b6107905781386117a8565b6117fd903d8086833e6114148183612142565b503861175a565b61181c9060203d60201161146a5761145b8183612142565b5038611705565b602482634e487b7160e01b81526021600452fd5b60246040517fd7f73334000000000000000000000000000000000000000000000000000000008152336004820152fd5b50346101c15760203660031901126101c1576020611886600435612d31565b6040519015158152f35b50346101c15760203660031901126101c1576118aa612bf9565b60043560045580f35b50346101c15760403660031901126101c1576102456004356118d3611fd6565b90808452836020526118eb6001604086200154612c8c565b612cb2565b50346101c15760203660031901126101c157600160406020926004358152808452200154604051908152f35b50346101c15760203660031901126101c157600435611939612b11565b808252600860205281604081206008810161195860ff825416156123e6565b6001600160a01b0391828154169033820361079f576119839160068560018401541692015491612ba4565b600160ff1982541617905560015460081c16803b156107905781809160246040518094819363c4d252f560e01b83528860048401525af18015610794576119ed575b50807fbbde28112400eaee5df97f22c92d999734e40e3e72e4418c370f49161128947191a280f35b6119f6906120a6565b6107905781386119c5565b50611a0b36611fec565b919096959492611a19612b11565b6001600160a01b0386163314611c8857611a3e8530336001600160a01b038816612b47565b611a506004546102888134101561219e565b6003556001600160a01b0360015460081c166040519063127e8e4d60e01b8252836004830152602082602481845afa918215610555578992611c53575b506020600491604051928380926322f0122b60e21b82525afa90811561055557611acc9183918b91610526575030906001600160a01b03339116612b47565b6001600160a01b0360015460081c1690813b1561052257889160248392604051948593849263b6b55f2560e01b845260048401525af1801561051757611c40575b50866020611b20604051610363816120d0565b03925af19788156104f2578198611bfd575b50926020987f15a702fd8f005a309638a801aee50874761962676cd3a81b1eef8388847b796c959361049f9360408b9a9997611bdc8251611b72816120ec565b3381526001600160a01b038d1660208201526001600160a01b038a16848201528a6060820152856080820152611bab8760a0830161222c565b611bb88860c08301612238565b8a60e082015242610100820152826101208201528d83528f600a90528383206122be565b8b8152600b8e5220600360ff19825416179055604051968796339a88612393565b91949297509594926020823d602011611c38575b81611c1e60209383612142565b810103126104e55790519694959294919390926020611b32565b3d9150611c11565b611c4c909791976120a6565b9538611b0d565b9091506020813d602011611c80575b81611c6f60209383612142565b810103126105225751906020611a8d565b3d9150611c62565b606460405162461bcd60e51b815260206004820152601660248201527f43616e277420646f2073656c66207472616e73666572000000000000000000006044820152fd5b50346101c15760803660031901126101c157611ce6611fc0565b90611cef611fd6565b90604435606435916001600160a01b03806002541695604051809763c45a015560e01b825281600460209a8b935afa90811561162b5760448493848b9481948991611f03575b50604051968795869463e6a4390560e01b8652169c8d6004860152166024840152165afa908115611002579082918491611ee6575b50169460405191630240bc6b60e21b83526060836004818a5afa96871561162b57889085948699611e84575b509060049160405192838092630dfe168160e01b82525afa908115611423578591611e67575b501603611e615793915b6dffffffffffffffffffffffffffff928316938015611e5757905b80151580611e4c575b80611e43575b156113d157611e0d611e06612710938693612ade565b9586612ade565b951602918216918203611e2f5750610b6c9291611e29916121e9565b90612af1565b80634e487b7160e01b602492526011600452fd5b50841515611df0565b508386161515611dea565b506126f290611de1565b91611dc6565b611e7e9150893d8b1161054e576105408183612142565b38611dbc565b94509750506060833d606011611ede575b81611ea260609383612142565b81010312611eda57611eb383612183565b6040611ec08a8601612183565b94015163ffffffff81160361079f57929688906004611d96565b8380fd5b3d9150611e95565b611efd9150883d8a1161054e576105408183612142565b38611d6a565b611f1a9150863d881161054e576105408183612142565b38611d35565b905034610790576020366003190112610790576004357fffffffff0000000000000000000000000000000000000000000000000000000081168091036113d157602092507f7965db0b000000000000000000000000000000000000000000000000000000008114908115611f96575b5015158152f35b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501438611f8f565b600435906001600160a01b03821682036104e557565b602435906001600160a01b03821682036104e557565b60e09060031901126104e5576001600160a01b039060043582811681036104e5579160243590811681036104e557906044359060643567ffffffffffffffff811681036104e557906084359060a435600f8110156104e5579060c43560198110156104e55790565b60c09060031901126104e5576001600160a01b039060043582811681036104e5579160243590811681036104e55790604435906064359060843567ffffffffffffffff811681036104e5579060a43590565b67ffffffffffffffff81116120ba57604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176120ba57604052565b610140810190811067ffffffffffffffff8211176120ba57604052565b610100810190811067ffffffffffffffff8211176120ba57604052565b6060810190811067ffffffffffffffff8211176120ba57604052565b90601f8019910116810190811067ffffffffffffffff8211176120ba57604052565b908160209103126104e557516001600160a01b03811681036104e55790565b51906dffffffffffffffffffffffffffff821682036104e557565b156121a557565b606460405162461bcd60e51b815260206004820152601060248201527f496e73756666696369656e7420666565000000000000000000000000000000006044820152fd5b919082018092116121f657565b634e487b7160e01b600052601160045260246000fd5b6002111561221657565b634e487b7160e01b600052602160045260246000fd5b600f8210156122165752565b60198210156122165752565b90600f8210156122165752565b9060198210156122165752565b91909160808060a083019467ffffffffffffffff815116845260208101516122858161220c565b602085015261229c60408201516040860190612244565b6122ae60608201516060860190612251565b0151916122ba8361220c565b0152565b6001600160a01b038083511673ffffffffffffffffffffffffffffffffffffffff1990818454161783556001830182602086015116828254161790556002830191604085015116908254161790556060820151600382015560808201516004820155600581019160a081015192600f8410156122165780549160c0810151916019831015612216576123919560089460ff61ff0061012096881b1692169061ffff19161717905560e0810151600685015561010081015160078501550151151591019060ff801983541691151516179055565b565b929467ffffffffffffffff60c0956123df949a9997612391999460e088019c6001600160a01b0380921689521660208801526040870152166060850152608084015260a0830190612244565b0190612251565b156123ed57565b606460405162461bcd60e51b815260206004820152601360248201527f4f726465722077617320636f6d706c65746564000000000000000000000000006044820152fd5b600760e0612391936001600160a01b038082511673ffffffffffffffffffffffffffffffffffffffff199081875416178655600186018260208501511682825416179055600286019160408401511690825416179055606081015160038501556080810151600485015560a0810151600585015560c081015160068501550151151591019060ff801983541691151516179055565b8051156124d35760200190565b634e487b7160e01b600052603260045260246000fd5b8051600110156124d35760400190565b908160209103126104e5575180151581036104e55790565b9060209081838203126104e557825167ffffffffffffffff938482116104e5570181601f820112156104e55780519384116120ba578360051b906040519461255b85840187612142565b855283808601928201019283116104e5578301905b82821061257e575050505090565b81518152908301908301612570565b90815180825260208080930193019160005b8281106125ad575050505090565b83516001600160a01b03168552938101939281019260010161259f565b916080936125f7916001600160a01b0393989796988552602085015260a0604085015260a084019061258d565b951660608201520152565b9190949293946000926001600160a01b038082169161262385303386612b47565b67ffffffffffffffff91828a168061280c57506040805161264381612126565b600281528136602083013785612658826124c6565b52612662816124e9565b83881690819052600254835163095ea7b360e01b81529085166001600160a01b03166004820152602481018a90529093906020816044818e8c5af18015612802578c938c8f92948d9482966127e3575b5060025416926126d98851978896879586946338ed173960e01b86523392600487016125ca565b03925af180156127d9576127bf575b5080519160208301953387528284015260608301528660808301524260a083015260a0825260c0820193828510908511176120ba577f2248d3a7ef2c2079b1fdd5ae3de854c74f65a50086908f1f30435ebc99812a12987f553b73b35b99452e27a2dc1c1f730ffc524018aea251b967e30924736ebef37695856127b69352835190209b8c9b8c99339960bf199789929360a09467ffffffffffffffff939897969260c08601996001600160a01b038092168752166020860152604085015260608401521660808201520152565b030190a380a290565b6127d2903d808b833e6114148183612142565b50386126e8565b82513d8b823e3d90fd5b6127fb9060203d60201161146a5761145b8183612142565b50386126b2565b84513d8d823e3d90fd5b99939091979495969892506128296004546102888134101561219e565b6003558160015460081c169060409283519263127e8e4d60e01b8452600160048501526020938481602481855afa908115612a995785908e92612aa3575b50600491928751928380926322f0122b60e21b82525afa908115612a995761289e9183918f91612a7c575b50309085339116612b47565b8160015460081c1690813b15612a78578c91602483928851948593849263b6b55f2560e01b845260048401525af18015612a6e57612a57575b50826129288c9d8651906128ea826120d0565b81528d83820152600e8782015260186060820152600160808201528360015460081c169087519e8f8094819362bf4e7760e21b83526004830161225e565b03925af19a8b15612a4d578c9b612a0c575b50928a9b600b7f553b73b35b99452e27a2dc1c1f730ffc524018aea251b967e30924736ebef3769a999896946129b684958f612a069b9987519261297d84612109565b338452858401528d16878301528d60608301528860808301524260a08301528a60c08301528560e0830152855260078352858520612431565b522060ff19815416905551958695339987929360a09467ffffffffffffffff939897969260c08601996001600160a01b038092168752166020860152604085015260608401521660808201520152565b0390a390565b909593919897969492809b5081813d8311612a46575b612a2c8183612142565b810103126104e5578190519a92949697989193959061293a565b503d612a22565b84513d8e823e3d90fd5b6129289c9b612a6685926120a6565b9b9c506128d7565b85513d8e823e3d90fd5b8c80fd5b612a939150873d891161054e576105408183612142565b38612892565b86513d8f823e3d90fd5b809250813d8311612aca575b612ab98183612142565b81010312612a785751846004612867565b503d612aaf565b919082039182116121f657565b818102929181159184041417156121f657565b8115612afb570490565b634e487b7160e01b600052601260045260246000fd5b60ff60015416612b1d57565b60046040517fd93c0665000000000000000000000000000000000000000000000000000000008152fd5b909261239193604051937f23b872dd0000000000000000000000000000000000000000000000000000000060208601526001600160a01b038092166024860152166044840152606483015260648252612b9f826120d0565b6130a6565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0392909216602483015260448083019390935291815261239191612b9f606483612142565b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60205260409020547fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff1615612c555750565b604490604051907fe2517d3f0000000000000000000000000000000000000000000000000000000082523360048301526024820152fd5b80600052600060205260406000203360005260205260ff6040600020541615612c555750565b90600091808352826020526001600160a01b036040842092169182845260205260ff60408420541615600014612d2c57808352826020526040832082845260205260408320600160ff198254161790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a4600190565b505090565b6000908082526020600b815260409160ff8385205416906004918281101561301d57600114612d64575050505050600190565b8452600982528284209384928451612d7b81612109565b6001600160a01b0380865416825284816001880154169283858201528260028901541690818a82015260e060ff60078560038d01549c8d606087015201549d608085019e8f52600581015460a0860152600681015460c086015201541615159101528483600254168a519384809263c45a015560e01b82525afa9182156130135791859184938892612ff1575b506044908b51948593849263e6a4390560e01b8452898d8501526024840152165afa908115612fe7579082918691612fca575b501696805193630240bc6b60e21b855260608588818c5afa988915612fc0578695879a612f63575b5090808892845193848092630dfe168160e01b82525afa928315612f5a57508692612f3d575b50501603612f375793915b6dffffffffffffffffffffffffffff8093168415801580612f2c575b80612f23575b15611eda576126f2808702968704141715612f105783612ed96127109287612ade565b961602928316928303612efd575050612ef69291611e29916121e9565b9051111590565b906011602492634e487b7160e01b835252fd5b602483601184634e487b7160e01b835252fd5b50811515612eb6565b508487161515612eb0565b91612e94565b612f539250803d1061054e576105408183612142565b3880612e89565b513d88823e3d90fd5b955098506060853d606011612fb8575b81612f8060609383612142565b81010312612fb457612f9185612183565b82612f9d838801612183565b96015163ffffffff81160361051357949881612e63565b8580fd5b3d9150612f73565b82513d88823e3d90fd5b612fe19150853d871161054e576105408183612142565b38612e3b565b88513d87823e3d90fd5b604491925061300c90843d861161054e576105408183612142565b9190612e08565b89513d88823e3d90fd5b602486602185634e487b7160e01b835252fd5b90600091808352826020526001600160a01b036040842092169182845260205260ff604084205416600014612d2c5780835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b6001600160a01b031690600080826020829451910182865af13d15613179573d67ffffffffffffffff8111613165576040516131039392916130f2601f8201601f191660200183612142565b8152809260203d92013e5b836131d1565b805190811515918261314a575b50506131195750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b61315d92506020809183010191016124f9565b153880613110565b602483634e487b7160e01b81526041600452fd5b61310391506060906130fd565b1561318d57565b606460405162461bcd60e51b815260206004820152601860248201527f4f7264657220686173206265656e20636f6d706c6574656400000000000000006044820152fd5b9061321057508051156131e657805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b8151158061325b575b613221575090565b6024906001600160a01b03604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b1561321956fea2646970667358221220503931c556fe292aab6952cf85a739fd08b067b3325d61527b4f333ebe63621564736f6c634300081800332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d000000000000000000000000f2277ef211a646e18e4921b348f235b5239b83f000000000000000000000000039cd4db6460d8b5961f73e997e86ddbb7ca4d5f60000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a714611f205750806313cb1f8314611ccc5780631f691f3a14611a01578063244719b51461191c578063248a9ca3146118f05780632f2ff15d146118b35780632f4be9d0146118905780633076315a14611867578063308d6c9614610e5057806336568abe14610df05780633b76594d14610d7f5780634584eff614610c9a57806346662d0f14610b7457806349488f0e14610b4a5780635c975abb14610b275780636e45bb571461083857806375b238fc146107fd5780638456cb59146107a3578063892037e8146106ab57806391d148541461065f578063a217fddf14610643578063ad3b1b4714610595578063b7649f4814610249578063d547741f14610208578063efc48f06146101c45763f7b188a51461013f57600080fd5b346101c157806003193601126101c157610157612bf9565b60015460ff8116156101975760ff19166001557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60046040517f8dfc202b000000000000000000000000000000000000000000000000000000008152fd5b80fd5b50346101c157806003193601126101c15760206040516001600160a01b037f000000000000000000000000f2277ef211a646e18e4921b348f235b5239b83f0168152f35b50346101c15760403660031901126101c157610245600435610228611fd6565b90808452836020526102406001604086200154612c8c565b613030565b5080f35b5061025336611fec565b919096959492610261612b11565b6102768530336001600160a01b038a16612b47565b6102906004546102888134101561219e565b6003546121e9565b6003556001600160a01b0360015460081c166040519063127e8e4d60e01b8252836004830152602082602481845afa918215610555578992610560575b506020600491604051928380926322f0122b60e21b82525afa9081156105555761030d9183918b91610526575b5030906001600160a01b03339116612b47565b6001600160a01b0360015460081c1690813b1561052257889160248392604051948593849263b6b55f2560e01b845260048401525af18015610517579088916104ff575b5060206103c2604051610363816120d0565b67ffffffffffffffff851681526001838201526103838c6040830161222c565b6103908760608301612238565b600160808201526001600160a01b0360015460081c16906040519b8c8094819362bf4e7760e21b83526004830161225e565b03925af19788156104f25781986104aa575b50926020987f9565ca896f98673a0cb29eba8400d67ee0868e732ad92006209d426521012228959361049f9360408b9a999761047e8251610414816120ec565b3381526001600160a01b038d1660208201526001600160a01b038a16848201528a606082015285608082015261044d8760a0830161222c565b61045a8860c08301612238565b8a60e082015242610100820152826101208201528d83528f600890528383206122be565b8b8152600b8e5220600260ff19825416179055604051968796339a88612393565b0390a3604051908152f35b91949297509594926020823d6020116104ea575b816104cb60209383612142565b810103126104e557905196949592949193909260206103d4565b600080fd5b3d91506104be565b50604051903d90823e3d90fd5b610508906120a6565b610513578638610351565b8680fd5b6040513d8a823e3d90fd5b8880fd5b610548915060203d60201161054e575b6105408183612142565b810190612164565b386102fa565b503d610536565b6040513d8b823e3d90fd5b9091506020813d60201161058d575b8161057c60209383612142565b810103126104e557519060206102cd565b3d915061056f565b50346101c15760403660031901126101c1576105af611fc0565b602435906105bb612bf9565b60035482116105ff57828080848194829082156105f5575b6001600160a01b031690f1156104f2576105ef90600354612ad1565b60035580f35b6108fc91506105d3565b606460405162461bcd60e51b815260206004820152601360248201527f496e73756666696369656e7420616d6f756e74000000000000000000000000006044820152fd5b50346101c157806003193601126101c157602090604051908152f35b50346101c15760403660031901126101c1576001600160a01b036040610683611fd6565b92600435815280602052209116600052602052602060ff604060002054166040519015158152f35b50346101c15760203660031901126101c1576004356106c8612b11565b80825260076020528160408120600781016106e760ff825416156123e6565b6001600160a01b0391828154169033820361079f576107129160038560018401541692015491612ba4565b600160ff1982541617905560015460081c16803b156107905781809160246040518094819363c4d252f560e01b83528860048401525af180156107945761077c575b50807fa5372cfc0abf52b270bfc1f8b9afac84cb49534155cb8d3a47decc2dc80e597a91a280f35b610785906120a6565b610790578138610754565b5080fd5b6040513d84823e3d90fd5b8480fd5b50346101c157806003193601126101c1576107bc612bf9565b6107c4612b11565b600160ff19815416176001557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b50346101c157806003193601126101c15760206040517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b5061084236612054565b6108529694919695939295612b11565b6001600160a01b03968785169661086b8530338b612b47565b61087d6004546102888134101561219e565b6003558860015460081c16986040519963127e8e4d60e01b8b52600160048c015260209a8b81602481855afa908115610aee578c908b92610af9575b5060049192604051928380926322f0122b60e21b82525afa908115610aee576108f39183918e8d92610ad1575b5050309085339116612b47565b8160015460081c1690813b15610acd57899160248392604051948593849263b6b55f2560e01b845260048401525af1801561055557908991610ab5575b50908a61098c604051610942816120d0565b67ffffffffffffffff87168152600183820152846040820152601860608201528460808201528360015460081c16906040519c8d8094819362bf4e7760e21b83526004830161225e565b03925af198891561079457908b91839a610a72575b5061049f9492610a1a8b9c60097f881d8b2d13db5f16a1eb42b207685769fa2b66d31ffb425d3c4cc1c09fd4cd2e9b9a9997958e6040968751946109e486612109565b338652838601528c16878501528c60608501528760808501524260a08501528960c08501528560e0850152855252838320612431565b600b8d5220600260ff19825416179055604051958695339987929360a09467ffffffffffffffff939897969260c08601996001600160a01b038092168752166020860152604085015260608401521660808201520152565b828196949998979593929b503d8311610aae575b610a908183612142565b810103126104e5579251979495939491939092918a9061049f6109a1565b503d610a86565b610abe906120a6565b610ac9578738610930565b8780fd5b8980fd5b610ae79250803d1061054e576105408183612142565b388e6108e6565b6040513d8c823e3d90fd5b809250813d8311610b20575b610b0f8183612142565b810103126104e557518b60046108b9565b503d610b05565b50346101c157806003193601126101c157602060ff600154166040519015158152f35b6020610b6c610b5836612054565b94610b67949194939293612b11565b612602565b604051908152f35b50346101c15760203660031901126101c157600435610b91612b11565b808252600a60205260408220600881019060ff825416610c565783916001600160a01b0391828154169033820361079f57610bd89160068560028401541692015491612ba4565b600160ff1982541617905560015460081c16803b156107905781809160246040518094819363c4d252f560e01b83528860048401525af1801561079457610c42575b50807f0c848505d086791e836af5bd9381a53f86e3621daa7c04dca2c00e4f9a4939e791a280f35b610c4b906120a6565b610790578138610c1a565b606460405162461bcd60e51b815260206004820152601b60248201527f5472616e736665724f726465722077617320636f6d706c6574656400000000006044820152fd5b50346101c15760203660031901126101c157600435610cb7612b11565b8082526009602052816040812060078101610cd660ff825416156123e6565b6001600160a01b0391828154169033820361079f57610d019160038560018401541692015491612ba4565b600160ff1982541617905560015460081c16803b156107905781809160246040518094819363c4d252f560e01b83528860048401525af1801561079457610d6b575b50807fa90c1ea1f8bf26cf5f70d9b0fd7716e41f4c34e97aef5ab1aba7088fdbf766c791a280f35b610d74906120a6565b610790578138610d43565b50346101c15760203660031901126101c157610d99612bf9565b806001600160a01b0360015460081c16803b15610ded5781809160246040518094819363b6b55f2560e01b835260043560048401525af1801561079457610ddd5750f35b610de6906120a6565b6101c15780f35b50fd5b50346101c15760403660031901126101c157610e0a611fd6565b336001600160a01b03821603610e265761024590600435613030565b60046040517f6697b232000000000000000000000000000000000000000000000000000000008152fd5b50346101c15760403660031901126101c157336001600160a01b037f000000000000000000000000f2277ef211a646e18e4921b348f235b5239b83f01603611837576004358152600b60205260ff6040822054166004811015611823578015611655575b6001811461147c575b600281146111c4575b600314611041575b6001600160a01b0360015460081c16906040519163127e8e4d60e01b835260016004840152602083602481845afa92831561079457829361100d575b506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa908115611002579084918491610fcd575b5010610f5b575080f35b600583029280840460051490151715610fb9578192813b15610fb557829160248392604051948593849263b6b55f2560e01b845260048401525af1801561079457610fa4575080f35b610fad906120a6565b6101c1578080f35b5050fd5b602482634e487b7160e01b81526011600452fd5b9150506020813d602011610ffa575b81610fe960209383612142565b810103126104e55783905138610f51565b3d9150610fdc565b6040513d85823e3d90fd5b9092506020813d602011611039575b8161102960209383612142565b810103126104e557519138610f0a565b3d915061101c565b6004358152600a602052604081206008810160ff8154166111805761106f6003830154600484015490612af1565b600283019060066001600160a01b038354169461109c8360018301976001600160a01b0389541690612ba4565b01936110a9828654612ad1565b8092818755116110ec575b50505050546040519081527f54b285b8a6ab0d6f347202ca2858b0846dd6fb4e2970d757469805726c5ada92602060043592a2610ece565b8161115d575b505050600160ff19825416179055816001600160a01b0360015460081c16803b156107905781809160246040518094819363c4d252f560e01b835260043560048401525af1801561079457611149575b80806110b4565b611152906120a6565b610790578138611142565b6001600160a01b038061117594541691541690612ba4565b8282553880806110f2565b606460405162461bcd60e51b815260206004820152602060248201527f5472616e736665724f7264657220686173206265656e20636f6d706c657465646044820152fd5b6004358252600860205260408220906111e460ff60088401541615613186565b6111f76003830154600484015490612af1565b9160405161120481612126565b6002815260403660208301376112866020856001600160a01b036001860154168061122e866124c6565b526001600160a01b03600287015416611246866124e9565b526001600160a01b03600254168960405180968195829463095ea7b360e01b845260048401602090939291936001600160a01b0360408201951681520152565b03925af1801561147157611442575b506001600160a01b03600254166001600160a01b0383541691600a4201421161142e5786916112ef91836040518096819582946338ed173960e01b84528c600485015284602485015260a0604485015260a484019061258d565b906064830152600a4201608483015203925af1801561142357611401575b50600681019261131e818554612ad1565b809181865511611364575b5050600391546040519081527f48ba250ae62c1335c72d7f362e2c3d651b0e9bcd3e38326dbac1e52d0562834c602060043592a29050610ec6565b806113d5575b506008600160ff19828401541617910155826001600160a01b0360015460081c16803b156107905781809160246040518094819363c4d252f560e01b835260043560048401525af180156107945715611329576113c6906120a6565b6113d1578238611329565b8280fd5b6113f8906001600160a01b036001840154166001600160a01b0384541690612ba4565b8383553861136a565b61141c903d8087833e6114148183612142565b810190612511565b503861130d565b6040513d87823e3d90fd5b602487634e487b7160e01b81526011600452fd5b6114639060203d60201161146a575b61145b8183612142565b8101906124f9565b5038611295565b503d611451565b6040513d88823e3d90fd5b6004358252600960205260408220600781019061149d60ff83541615613186565b836040516114aa81612126565b6002815260403660208301376001600160a01b03600184015416806114ce836124c6565b526001600160a01b036002850154166114e6836124e9565b5260025460038501805460405163095ea7b360e01b81526001600160a01b0390931660048401526024830152916020908290604490829088905af1801561162b57611636575b506001600160a01b036002541690548360048601549161157260066001600160a01b03895416980154604051988997889687956338ed173960e01b8752600487016125ca565b03925af1801561162b57611611575b50600160ff19825416179055816001600160a01b0360015460081c16803b156107905781809160246040518094819363c4d252f560e01b835260043560048401525af18015610794576115fd575b50506004357f9fb1132030bbdb5134b7c78b7fff2a49745433acfa0aae4a4fb481813bb8d87c8380a2610ebd565b611606906120a6565b6107905781386115cf565b611624903d8086833e6114148183612142565b5038611581565b6040513d86823e3d90fd5b61164e9060203d60201161146a5761145b8183612142565b503861152c565b6004358252600760205260408220600781019061167660ff83541615613186565b8360405161168381612126565b6002815260403660208301376001600160a01b03600184015416806116a7836124c6565b526001600160a01b036002850154166116bf836124e9565b5260025460038501805460405163095ea7b360e01b81526001600160a01b0390931660048401526024830152916020908290604490829088905af1801561162b57611804575b506001600160a01b036002541690548360048601549161174b60066001600160a01b03895416980154604051988997889687956338ed173960e01b8752600487016125ca565b03925af1801561162b576117ea575b50600160ff19825416179055816001600160a01b0360015460081c16803b156107905781809160246040518094819363c4d252f560e01b835260043560048401525af18015610794576117d6575b50506004357f2248d3a7ef2c2079b1fdd5ae3de854c74f65a50086908f1f30435ebc99812a128380a2610eb4565b6117df906120a6565b6107905781386117a8565b6117fd903d8086833e6114148183612142565b503861175a565b61181c9060203d60201161146a5761145b8183612142565b5038611705565b602482634e487b7160e01b81526021600452fd5b60246040517fd7f73334000000000000000000000000000000000000000000000000000000008152336004820152fd5b50346101c15760203660031901126101c1576020611886600435612d31565b6040519015158152f35b50346101c15760203660031901126101c1576118aa612bf9565b60043560045580f35b50346101c15760403660031901126101c1576102456004356118d3611fd6565b90808452836020526118eb6001604086200154612c8c565b612cb2565b50346101c15760203660031901126101c157600160406020926004358152808452200154604051908152f35b50346101c15760203660031901126101c157600435611939612b11565b808252600860205281604081206008810161195860ff825416156123e6565b6001600160a01b0391828154169033820361079f576119839160068560018401541692015491612ba4565b600160ff1982541617905560015460081c16803b156107905781809160246040518094819363c4d252f560e01b83528860048401525af18015610794576119ed575b50807fbbde28112400eaee5df97f22c92d999734e40e3e72e4418c370f49161128947191a280f35b6119f6906120a6565b6107905781386119c5565b50611a0b36611fec565b919096959492611a19612b11565b6001600160a01b0386163314611c8857611a3e8530336001600160a01b038816612b47565b611a506004546102888134101561219e565b6003556001600160a01b0360015460081c166040519063127e8e4d60e01b8252836004830152602082602481845afa918215610555578992611c53575b506020600491604051928380926322f0122b60e21b82525afa90811561055557611acc9183918b91610526575030906001600160a01b03339116612b47565b6001600160a01b0360015460081c1690813b1561052257889160248392604051948593849263b6b55f2560e01b845260048401525af1801561051757611c40575b50866020611b20604051610363816120d0565b03925af19788156104f2578198611bfd575b50926020987f15a702fd8f005a309638a801aee50874761962676cd3a81b1eef8388847b796c959361049f9360408b9a9997611bdc8251611b72816120ec565b3381526001600160a01b038d1660208201526001600160a01b038a16848201528a6060820152856080820152611bab8760a0830161222c565b611bb88860c08301612238565b8a60e082015242610100820152826101208201528d83528f600a90528383206122be565b8b8152600b8e5220600360ff19825416179055604051968796339a88612393565b91949297509594926020823d602011611c38575b81611c1e60209383612142565b810103126104e55790519694959294919390926020611b32565b3d9150611c11565b611c4c909791976120a6565b9538611b0d565b9091506020813d602011611c80575b81611c6f60209383612142565b810103126105225751906020611a8d565b3d9150611c62565b606460405162461bcd60e51b815260206004820152601660248201527f43616e277420646f2073656c66207472616e73666572000000000000000000006044820152fd5b50346101c15760803660031901126101c157611ce6611fc0565b90611cef611fd6565b90604435606435916001600160a01b03806002541695604051809763c45a015560e01b825281600460209a8b935afa90811561162b5760448493848b9481948991611f03575b50604051968795869463e6a4390560e01b8652169c8d6004860152166024840152165afa908115611002579082918491611ee6575b50169460405191630240bc6b60e21b83526060836004818a5afa96871561162b57889085948699611e84575b509060049160405192838092630dfe168160e01b82525afa908115611423578591611e67575b501603611e615793915b6dffffffffffffffffffffffffffff928316938015611e5757905b80151580611e4c575b80611e43575b156113d157611e0d611e06612710938693612ade565b9586612ade565b951602918216918203611e2f5750610b6c9291611e29916121e9565b90612af1565b80634e487b7160e01b602492526011600452fd5b50841515611df0565b508386161515611dea565b506126f290611de1565b91611dc6565b611e7e9150893d8b1161054e576105408183612142565b38611dbc565b94509750506060833d606011611ede575b81611ea260609383612142565b81010312611eda57611eb383612183565b6040611ec08a8601612183565b94015163ffffffff81160361079f57929688906004611d96565b8380fd5b3d9150611e95565b611efd9150883d8a1161054e576105408183612142565b38611d6a565b611f1a9150863d881161054e576105408183612142565b38611d35565b905034610790576020366003190112610790576004357fffffffff0000000000000000000000000000000000000000000000000000000081168091036113d157602092507f7965db0b000000000000000000000000000000000000000000000000000000008114908115611f96575b5015158152f35b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501438611f8f565b600435906001600160a01b03821682036104e557565b602435906001600160a01b03821682036104e557565b60e09060031901126104e5576001600160a01b039060043582811681036104e5579160243590811681036104e557906044359060643567ffffffffffffffff811681036104e557906084359060a435600f8110156104e5579060c43560198110156104e55790565b60c09060031901126104e5576001600160a01b039060043582811681036104e5579160243590811681036104e55790604435906064359060843567ffffffffffffffff811681036104e5579060a43590565b67ffffffffffffffff81116120ba57604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176120ba57604052565b610140810190811067ffffffffffffffff8211176120ba57604052565b610100810190811067ffffffffffffffff8211176120ba57604052565b6060810190811067ffffffffffffffff8211176120ba57604052565b90601f8019910116810190811067ffffffffffffffff8211176120ba57604052565b908160209103126104e557516001600160a01b03811681036104e55790565b51906dffffffffffffffffffffffffffff821682036104e557565b156121a557565b606460405162461bcd60e51b815260206004820152601060248201527f496e73756666696369656e7420666565000000000000000000000000000000006044820152fd5b919082018092116121f657565b634e487b7160e01b600052601160045260246000fd5b6002111561221657565b634e487b7160e01b600052602160045260246000fd5b600f8210156122165752565b60198210156122165752565b90600f8210156122165752565b9060198210156122165752565b91909160808060a083019467ffffffffffffffff815116845260208101516122858161220c565b602085015261229c60408201516040860190612244565b6122ae60608201516060860190612251565b0151916122ba8361220c565b0152565b6001600160a01b038083511673ffffffffffffffffffffffffffffffffffffffff1990818454161783556001830182602086015116828254161790556002830191604085015116908254161790556060820151600382015560808201516004820155600581019160a081015192600f8410156122165780549160c0810151916019831015612216576123919560089460ff61ff0061012096881b1692169061ffff19161717905560e0810151600685015561010081015160078501550151151591019060ff801983541691151516179055565b565b929467ffffffffffffffff60c0956123df949a9997612391999460e088019c6001600160a01b0380921689521660208801526040870152166060850152608084015260a0830190612244565b0190612251565b156123ed57565b606460405162461bcd60e51b815260206004820152601360248201527f4f726465722077617320636f6d706c65746564000000000000000000000000006044820152fd5b600760e0612391936001600160a01b038082511673ffffffffffffffffffffffffffffffffffffffff199081875416178655600186018260208501511682825416179055600286019160408401511690825416179055606081015160038501556080810151600485015560a0810151600585015560c081015160068501550151151591019060ff801983541691151516179055565b8051156124d35760200190565b634e487b7160e01b600052603260045260246000fd5b8051600110156124d35760400190565b908160209103126104e5575180151581036104e55790565b9060209081838203126104e557825167ffffffffffffffff938482116104e5570181601f820112156104e55780519384116120ba578360051b906040519461255b85840187612142565b855283808601928201019283116104e5578301905b82821061257e575050505090565b81518152908301908301612570565b90815180825260208080930193019160005b8281106125ad575050505090565b83516001600160a01b03168552938101939281019260010161259f565b916080936125f7916001600160a01b0393989796988552602085015260a0604085015260a084019061258d565b951660608201520152565b9190949293946000926001600160a01b038082169161262385303386612b47565b67ffffffffffffffff91828a168061280c57506040805161264381612126565b600281528136602083013785612658826124c6565b52612662816124e9565b83881690819052600254835163095ea7b360e01b81529085166001600160a01b03166004820152602481018a90529093906020816044818e8c5af18015612802578c938c8f92948d9482966127e3575b5060025416926126d98851978896879586946338ed173960e01b86523392600487016125ca565b03925af180156127d9576127bf575b5080519160208301953387528284015260608301528660808301524260a083015260a0825260c0820193828510908511176120ba577f2248d3a7ef2c2079b1fdd5ae3de854c74f65a50086908f1f30435ebc99812a12987f553b73b35b99452e27a2dc1c1f730ffc524018aea251b967e30924736ebef37695856127b69352835190209b8c9b8c99339960bf199789929360a09467ffffffffffffffff939897969260c08601996001600160a01b038092168752166020860152604085015260608401521660808201520152565b030190a380a290565b6127d2903d808b833e6114148183612142565b50386126e8565b82513d8b823e3d90fd5b6127fb9060203d60201161146a5761145b8183612142565b50386126b2565b84513d8d823e3d90fd5b99939091979495969892506128296004546102888134101561219e565b6003558160015460081c169060409283519263127e8e4d60e01b8452600160048501526020938481602481855afa908115612a995785908e92612aa3575b50600491928751928380926322f0122b60e21b82525afa908115612a995761289e9183918f91612a7c575b50309085339116612b47565b8160015460081c1690813b15612a78578c91602483928851948593849263b6b55f2560e01b845260048401525af18015612a6e57612a57575b50826129288c9d8651906128ea826120d0565b81528d83820152600e8782015260186060820152600160808201528360015460081c169087519e8f8094819362bf4e7760e21b83526004830161225e565b03925af19a8b15612a4d578c9b612a0c575b50928a9b600b7f553b73b35b99452e27a2dc1c1f730ffc524018aea251b967e30924736ebef3769a999896946129b684958f612a069b9987519261297d84612109565b338452858401528d16878301528d60608301528860808301524260a08301528a60c08301528560e0830152855260078352858520612431565b522060ff19815416905551958695339987929360a09467ffffffffffffffff939897969260c08601996001600160a01b038092168752166020860152604085015260608401521660808201520152565b0390a390565b909593919897969492809b5081813d8311612a46575b612a2c8183612142565b810103126104e5578190519a92949697989193959061293a565b503d612a22565b84513d8e823e3d90fd5b6129289c9b612a6685926120a6565b9b9c506128d7565b85513d8e823e3d90fd5b8c80fd5b612a939150873d891161054e576105408183612142565b38612892565b86513d8f823e3d90fd5b809250813d8311612aca575b612ab98183612142565b81010312612a785751846004612867565b503d612aaf565b919082039182116121f657565b818102929181159184041417156121f657565b8115612afb570490565b634e487b7160e01b600052601260045260246000fd5b60ff60015416612b1d57565b60046040517fd93c0665000000000000000000000000000000000000000000000000000000008152fd5b909261239193604051937f23b872dd0000000000000000000000000000000000000000000000000000000060208601526001600160a01b038092166024860152166044840152606483015260648252612b9f826120d0565b6130a6565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0392909216602483015260448083019390935291815261239191612b9f606483612142565b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60205260409020547fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff1615612c555750565b604490604051907fe2517d3f0000000000000000000000000000000000000000000000000000000082523360048301526024820152fd5b80600052600060205260406000203360005260205260ff6040600020541615612c555750565b90600091808352826020526001600160a01b036040842092169182845260205260ff60408420541615600014612d2c57808352826020526040832082845260205260408320600160ff198254161790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a4600190565b505090565b6000908082526020600b815260409160ff8385205416906004918281101561301d57600114612d64575050505050600190565b8452600982528284209384928451612d7b81612109565b6001600160a01b0380865416825284816001880154169283858201528260028901541690818a82015260e060ff60078560038d01549c8d606087015201549d608085019e8f52600581015460a0860152600681015460c086015201541615159101528483600254168a519384809263c45a015560e01b82525afa9182156130135791859184938892612ff1575b506044908b51948593849263e6a4390560e01b8452898d8501526024840152165afa908115612fe7579082918691612fca575b501696805193630240bc6b60e21b855260608588818c5afa988915612fc0578695879a612f63575b5090808892845193848092630dfe168160e01b82525afa928315612f5a57508692612f3d575b50501603612f375793915b6dffffffffffffffffffffffffffff8093168415801580612f2c575b80612f23575b15611eda576126f2808702968704141715612f105783612ed96127109287612ade565b961602928316928303612efd575050612ef69291611e29916121e9565b9051111590565b906011602492634e487b7160e01b835252fd5b602483601184634e487b7160e01b835252fd5b50811515612eb6565b508487161515612eb0565b91612e94565b612f539250803d1061054e576105408183612142565b3880612e89565b513d88823e3d90fd5b955098506060853d606011612fb8575b81612f8060609383612142565b81010312612fb457612f9185612183565b82612f9d838801612183565b96015163ffffffff81160361051357949881612e63565b8580fd5b3d9150612f73565b82513d88823e3d90fd5b612fe19150853d871161054e576105408183612142565b38612e3b565b88513d87823e3d90fd5b604491925061300c90843d861161054e576105408183612142565b9190612e08565b89513d88823e3d90fd5b602486602185634e487b7160e01b835252fd5b90600091808352826020526001600160a01b036040842092169182845260205260ff604084205416600014612d2c5780835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b6001600160a01b031690600080826020829451910182865af13d15613179573d67ffffffffffffffff8111613165576040516131039392916130f2601f8201601f191660200183612142565b8152809260203d92013e5b836131d1565b805190811515918261314a575b50506131195750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b61315d92506020809183010191016124f9565b153880613110565b602483634e487b7160e01b81526041600452fd5b61310391506060906130fd565b1561318d57565b606460405162461bcd60e51b815260206004820152601860248201527f4f7264657220686173206265656e20636f6d706c6574656400000000000000006044820152fd5b9061321057508051156131e657805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b8151158061325b575b613221575090565b6024906001600160a01b03604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b1561321956fea2646970667358221220503931c556fe292aab6952cf85a739fd08b067b3325d61527b4f333ebe63621564736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f2277ef211a646e18e4921b348f235b5239b83f000000000000000000000000039cd4db6460d8b5961f73e997e86ddbb7ca4d5f60000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : timely (address): 0xf2277ef211a646e18E4921B348F235B5239b83F0
Arg [1] : router (address): 0x39cd4db6460d8B5961F73E997E86DdbB7Ca4D5F6
Arg [2] : magentaFee (uint256): 0
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000f2277ef211a646e18e4921b348f235b5239b83f0
Arg [1] : 00000000000000000000000039cd4db6460d8b5961f73e997e86ddbb7ca4d5f6
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.