Source Code
Overview
HYPE Balance
HYPE Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
DnCoreWriter
Compiler Version
v0.8.29+commit.ab55807c
Optimization Enabled:
Yes with 10000 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.29;
import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ICoreWriter } from "./interfaces/ICoreWriter.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { WETH } from "solmate/tokens/WETH.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
contract DnCoreWriter is AccessControlUpgradeable {
using SafeERC20 for IERC20Metadata;
struct HyperCoreTokenConfig {
uint64 tokenId;
address systemAddress;
uint8 hyperEVMDecimals;
uint8 hypercoreDecimals;
}
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
bytes32 public constant BRIDGE_ROLE = keccak256("BRIDGE_ROLE");
bytes32 public constant WITHDRAWAL_ROLE = keccak256("WITHDRAWAL_ROLE");
bytes32 public constant TRADING_AGENT_ROLE = keccak256("TRADING_AGENT_ROLE");
address public constant SYSTEM_ADDRESS = 0x2222222222222222222222222222222222222222;
address public constant CORE_WRITER = 0x3333333333333333333333333333333333333333;
address public constant HYPE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
WETH public constant WHYPE = WETH(payable(0x5555555555555555555555555555555555555555));
address public midasReceiver;
mapping(address => HyperCoreTokenConfig) public tokenConfig;
mapping(address => bool) public isWithdrawalToken;
mapping(uint32 => bool) public isTradeableAsset;
uint256 public accumulatedFees;
address public feeRecipient;
address public feeToken;
address public navOracle;
error DnCoreWriter__TokenNotRegistered(address token);
error DnCoreWriter__APIWalletAlreadyRegistered(address walletAddress);
error DnCoreWriter__TokenNotWithdrawalToken(address token);
error DnCoreWriter__MidasReceiverNotSet();
error DnCoreWriter__AssetNotTradeable(uint32 asset);
error DnCoreWriter__AmountMismatch(uint256 amount);
error DnCoreWriter_NotNavOracle();
error DnCoreWriter__FeeRecipientOrFeeTokenNotSet();
event BridgeERC20Hypercore(address indexed token, address indexed systemAddress, uint256 amount);
event BridgeHYPE(uint256 amount);
event APIWalletAdded(address indexed walletAddress, string walletName);
event WithdrawTokenFromHyperCore(
address indexed destination, address indexed token, uint64 tokenId, uint256 amount
);
event ReleaseTokensForWithdrawals(address indexed receiver, address indexed token, uint256 amount);
event APIWalletRemoved(string walletName);
event LimitOrderPlaced(
uint32 indexed asset, bool indexed isBuy, uint64 limitPx, uint64 sz, bool reduceOnly, uint8 tif, uint128 cloid
);
event USDClassTransfer(uint64 indexed ntl, bool indexed toPerp);
event OrderCancelledByOid(uint32 indexed asset, uint64 indexed oid);
event OrderCancelledByCloid(uint32 indexed asset, uint128 indexed cloid);
event FeesAccumulated(uint256 amount);
event MidasReceiverSet(address indexed midasReceiver);
event FeeRecipientSet(address indexed feeRecipient);
event FeeTokenSet(address indexed feeToken);
event NavOracleSet(address indexed navOracle);
event TradeableAssetToggled(uint32 indexed asset, bool indexed isTradeable);
event WithdrawalTokenToggled(address indexed token, bool indexed isWithdrawalToken);
event FeesTransferred(address indexed feeRecipient, address indexed feeToken, uint256 amount);
modifier onlyNavOracle() {
if (msg.sender != navOracle) {
revert DnCoreWriter_NotNavOracle();
}
_;
}
constructor() {
_disableInitializers();
}
function initialize() external initializer {
__AccessControl_init_unchained();
_grantRole(ADMIN_ROLE, msg.sender);
_setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
_setRoleAdmin(BRIDGE_ROLE, ADMIN_ROLE);
_setRoleAdmin(WITHDRAWAL_ROLE, ADMIN_ROLE);
_setRoleAdmin(TRADING_AGENT_ROLE, ADMIN_ROLE);
}
/**
* @notice Bridges an ERC20 token to HyperCore
* @dev Only callable by addresses with BRIDGE_ROLE
* @param token The address of the ERC20 token to bridge
* @param amount The amount of tokens to bridge
*/
function bridgeERC20ToHypercore(address token, uint256 amount) external onlyRole(BRIDGE_ROLE) {
HyperCoreTokenConfig memory config = tokenConfig[token];
uint256 truncatedAmount = _truncateAmount(amount, config.hyperEVMDecimals, config.hypercoreDecimals);
if (truncatedAmount != amount) {
revert DnCoreWriter__AmountMismatch(amount);
}
if (config.systemAddress == address(0)) {
revert DnCoreWriter__TokenNotRegistered(token);
}
IERC20Metadata(token).safeTransfer(config.systemAddress, amount);
emit BridgeERC20Hypercore(token, config.systemAddress, amount);
}
/**
* @notice Bridges HYPE to HyperCore
* @dev Only callable by addresses with BRIDGE_ROLE
* @param amount The amount of HYPE to bridge
*/
function bridgeHYPE(uint256 amount) external onlyRole(BRIDGE_ROLE) {
uint256 truncatedAmount = _truncateAmount(amount, 18, 8);
if (truncatedAmount != amount) {
revert DnCoreWriter__AmountMismatch(amount);
}
payable(SYSTEM_ADDRESS).transfer(truncatedAmount);
emit BridgeHYPE(truncatedAmount);
}
/**
* @notice Withdraws tokens from HyperCore using spot send
* @dev Only callable by addresses with BRIDGE_ROLE
* @param token The address of the ERC20 token to withdraw
* @param amount The amount of tokens to withdraw (in token's native decimals)
*/
function withdrawTokenFromHyperCore(address token, uint64 amount) external onlyRole(BRIDGE_ROLE) {
HyperCoreTokenConfig memory config = tokenConfig[token];
if (config.systemAddress == address(0)) {
revert DnCoreWriter__TokenNotRegistered(token);
}
// Encode the spot send action parameters
bytes memory encodedAction = abi.encode(config.systemAddress, config.tokenId, amount);
_sendAction(6, encodedAction);
// Emit withdrawal event
emit WithdrawTokenFromHyperCore(config.systemAddress, token, config.tokenId, amount);
}
/**
* @notice Releases tokens for withdrawal
* @dev Only callable by addresses with WITHDRAWAL_ROLE
* @param token The address of the ERC20 token to release
* @param amount The amount of tokens to release
*/
function releaseTokensForWithdrawals(address token, uint256 amount) external onlyRole(WITHDRAWAL_ROLE) {
if (midasReceiver == address(0)) {
revert DnCoreWriter__MidasReceiverNotSet();
}
if (!isWithdrawalToken[token]) {
revert DnCoreWriter__TokenNotWithdrawalToken(token);
}
if (token == HYPE) {
payable(midasReceiver).transfer(amount);
} else {
IERC20Metadata(token).safeTransfer(midasReceiver, amount);
}
emit ReleaseTokensForWithdrawals(midasReceiver, token, amount);
}
/**
* @notice Wraps HYPE to HyperCore
* @dev Only callable by addresses with WITHDRAWAL_ROLE
* @param amount The amount of HYPE to wrap
*/
function wrapHype(uint256 amount) external onlyRole(WITHDRAWAL_ROLE) {
WHYPE.deposit{ value: amount }();
}
/**
* @notice Unwraps HYPE from HyperCore
* @dev Only callable by addresses with WITHDRAWAL_ROLE
* @param amount The amount of HYPE to unwrap
*/
function unwrapHype(uint256 amount) external onlyRole(WITHDRAWAL_ROLE) {
WHYPE.withdraw(amount);
}
/**
* @notice Places a limit order on HyperCore
* @dev Only callable by addresses with TRADING_AGENT_ROLE
* @param asset The asset ID for the perpetual
* @param isBuy True for buy order, false for sell order
* @param limitPx Limit price as 10^8 * human readable value
* @param sz Size as 10^8 * human readable value
* @param reduceOnly Whether this is a reduce-only order
* @param tif Time in force: 1=Alo, 2=Gtc, 3=Ioc
* @param cloid Client order ID (0 means no cloid)
*/
function placeLimitOrder(
uint32 asset,
bool isBuy,
uint64 limitPx,
uint64 sz,
bool reduceOnly,
uint8 tif,
uint128 cloid
)
external
onlyRole(TRADING_AGENT_ROLE)
{
if (!isTradeableAsset[asset]) {
revert DnCoreWriter__AssetNotTradeable(asset);
}
// Encode the limit order action parameters
bytes memory encodedAction = abi.encode(asset, isBuy, limitPx, sz, reduceOnly, tif, cloid);
_sendAction(1, encodedAction);
// Emit order placement event
emit LimitOrderPlaced(asset, isBuy, limitPx, sz, reduceOnly, tif, cloid);
}
/**
* @notice Transfers USD between spot and perp accounts on HyperCore
* @dev Only callable by addresses with TRADING_AGENT_ROLE
* @param ntl The amount to transfer (in native token units)
* @param toPerp True to transfer from spot to perp, false to transfer from perp to spot
*/
function usdClassTransfer(uint64 ntl, bool toPerp) external onlyRole(TRADING_AGENT_ROLE) {
// Encode the USD class transfer action parameters
bytes memory encodedAction = abi.encode(ntl, toPerp);
_sendAction(7, encodedAction);
// Emit USD class transfer event
emit USDClassTransfer(ntl, toPerp);
}
/**
* @notice Cancels an order by order ID (oid) on HyperCore
* @dev Only callable by addresses with TRADING_AGENT_ROLE
* @param asset The asset ID for the perpetual
* @param oid The order ID to cancel
*/
function cancelOrderByOid(uint32 asset, uint64 oid) external onlyRole(TRADING_AGENT_ROLE) {
// Encode the cancel order by oid action parameters
bytes memory encodedAction = abi.encode(asset, oid);
_sendAction(10, encodedAction);
// Emit order cancellation event
emit OrderCancelledByOid(asset, oid);
}
/**
* @notice Cancels an order by client order ID (cloid) on HyperCore
* @dev Only callable by addresses with TRADING_AGENT_ROLE
* @param asset The asset ID for the perpetual
* @param cloid The client order ID to cancel
*/
function cancelOrderByCloid(uint32 asset, uint128 cloid) external onlyRole(TRADING_AGENT_ROLE) {
// Encode the cancel order by cloid action parameters
bytes memory encodedAction = abi.encode(asset, cloid);
_sendAction(11, encodedAction);
// Emit order cancellation event
emit OrderCancelledByCloid(asset, cloid);
}
/**
* @notice Adds an API wallet to HyperCore
* @dev Only callable by addresses with ADMIN_ROLE
* @param walletAddress The address of the API wallet to add
* @param walletName The name of the API wallet (empty string makes it the main API wallet)
*/
function addAPIWallet(address walletAddress, string calldata walletName) external onlyRole(ADMIN_ROLE) {
bytes memory encodedAction = abi.encode(walletAddress, walletName);
_sendAction(9, encodedAction);
emit APIWalletAdded(walletAddress, walletName);
}
/**
* @notice Removes an API wallet from HyperCore
* @dev Only callable by addresses with ADMIN_ROLE
* @param walletName The name of the API wallet to remove
*/
function removeAPIWallet(string calldata walletName) external onlyRole(ADMIN_ROLE) {
bytes memory encodedAction = abi.encode(address(0), walletName);
_sendAction(9, encodedAction);
emit APIWalletRemoved(walletName);
}
/**
* @notice Sends an action to HyperCore
* @dev Only callable by addresses with ADMIN_ROLE
* @param actionId The ID of the action to send
* @param encodedAction The encoded action data
*/
function _sendAction(uint8 actionId, bytes memory encodedAction) internal {
bytes memory data = new bytes(4 + encodedAction.length);
data[0] = 0x01; // Version 1
data[1] = 0x00; // Action ID (big-endian)
data[2] = 0x00;
data[3] = bytes1(actionId);
// Copy encoded action data
for (uint256 i = 0; i < encodedAction.length; i++) {
data[4 + i] = encodedAction[i];
}
// Send the action to CoreWriter
ICoreWriter(CORE_WRITER).sendRawAction(data);
}
/**
* @notice Sets the receiver for tokens released for withdrawals
* @dev Only callable by addresses with ADMIN_ROLE
* @param _midasReceiver The address of the receiver
*/
function setMidasReceiver(address _midasReceiver) external onlyRole(ADMIN_ROLE) {
midasReceiver = _midasReceiver;
emit MidasReceiverSet(_midasReceiver);
}
/**
* @notice Registers a token to HyperCore
* @dev Only callable by addresses with ADMIN_ROLE
* @param token The address of the token to register
* @param systemAddress The address of the system to register the token to
* @param tokenId The ID of the token
*/
function registerToken(
address token,
address systemAddress,
uint64 tokenId,
uint8 hyperEVMDecimals,
uint8 hypercoreDecimals
)
external
onlyRole(ADMIN_ROLE)
{
tokenConfig[token] = HyperCoreTokenConfig({
tokenId: tokenId,
systemAddress: systemAddress,
hyperEVMDecimals: hyperEVMDecimals,
hypercoreDecimals: hypercoreDecimals
});
}
/**
* @notice Transfers fees
* @dev Only callable by addresses with ADMIN_ROLE
*/
function transferFees() external onlyRole(ADMIN_ROLE) {
if (feeRecipient == address(0) || feeToken == address(0)) {
revert DnCoreWriter__FeeRecipientOrFeeTokenNotSet();
}
uint256 accumulatedFeesCache = accumulatedFees;
accumulatedFees = 0;
IERC20Metadata(feeToken).safeTransfer(feeRecipient, accumulatedFeesCache);
emit FeesTransferred(feeRecipient, feeToken, accumulatedFeesCache);
}
/**
* @notice Accumulates fees
* @dev Only callable by addresses with NAV_ORACLE
* @param amount The amount of fees to accumulate
*/
function accumulateFees(uint256 amount) external onlyNavOracle {
accumulatedFees += amount;
emit FeesAccumulated(amount);
}
/**
* @notice Toggles the withdrawal token status
* @dev Only callable by addresses with ADMIN_ROLE
* @param token The address of the token to toggle
*/
function toggleWithdrawalToken(address token) external onlyRole(ADMIN_ROLE) {
isWithdrawalToken[token] = !isWithdrawalToken[token];
emit WithdrawalTokenToggled(token, isWithdrawalToken[token]);
}
/**
* @notice Sets the fee recipient
* @dev Only callable by addresses with ADMIN_ROLE
* @param _feeRecipient The address of the fee recipient
*/
function setFeeRecipient(address _feeRecipient) external onlyRole(ADMIN_ROLE) {
feeRecipient = _feeRecipient;
emit FeeRecipientSet(_feeRecipient);
}
/**
* @notice Sets the fee token
* @dev Only callable by addresses with ADMIN_ROLE
* @param _feeToken The address of the fee token
*/
function setFeeToken(address _feeToken) external onlyRole(ADMIN_ROLE) {
feeToken = _feeToken;
emit FeeTokenSet(_feeToken);
}
/**
* @notice Sets the NAV oracle
* @dev Only callable by addresses with ADMIN_ROLE
* @param _navOracle The address of the NAV oracle
*/
function setNavOracle(address _navOracle) external onlyRole(ADMIN_ROLE) {
navOracle = _navOracle;
emit NavOracleSet(_navOracle);
}
/**
* @notice Toggles the tradeable asset status
* @dev Only callable by addresses with ADMIN_ROLE
* @param asset The asset ID to toggle trading permissions for
*/
function toggleTradeableAsset(uint32 asset) external onlyRole(ADMIN_ROLE) {
isTradeableAsset[asset] = !isTradeableAsset[asset];
emit TradeableAssetToggled(asset, isTradeableAsset[asset]);
}
function _truncateAmount(uint256 amount, uint8 fromDecimals, uint8 toDecimals) internal pure returns (uint256) {
if (toDecimals >= fromDecimals) {
return amount;
}
return amount / 10 ** (fromDecimals - toDecimals) * 10 ** (fromDecimals - toDecimals);
}
receive() external payable { }
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ICoreWriter {
function sendRawAction(bytes calldata data) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
struct AccessControlStorage {
mapping(bytes32 role => RoleData) _roles;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;
function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
assembly {
$.slot := AccessControlStorageLocation
}
}
/**
* @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);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/// @inheritdoc IERC165
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) {
AccessControlStorage storage $ = _getAccessControlStorage();
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) {
AccessControlStorage storage $ = _getAccessControlStorage();
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 {
AccessControlStorage storage $ = _getAccessControlStorage();
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) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (!hasRole(role, account)) {
$._roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` from `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) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (hasRole(role, account)) {
$._roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import {ERC20} from "./ERC20.sol";
import {SafeTransferLib} from "../utils/SafeTransferLib.sol";
/// @notice Minimalist and modern Wrapped Ether implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/WETH.sol)
/// @author Inspired by WETH9 (https://github.com/dapphub/ds-weth/blob/master/src/weth9.sol)
contract WETH is ERC20("Wrapped Ether", "WETH", 18) {
using SafeTransferLib for address;
event Deposit(address indexed from, uint256 amount);
event Withdrawal(address indexed to, uint256 amount);
function deposit() public payable virtual {
_mint(msg.sender, msg.value);
emit Deposit(msg.sender, msg.value);
}
function withdraw(uint256 amount) public virtual {
_burn(msg.sender, amount);
emit Withdrawal(msg.sender, amount);
msg.sender.safeTransferETH(amount);
}
receive() external payable virtual {
deposit();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reinitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.
*
* NOTE: Consider following the ERC-7201 formula to derive storage locations.
*/
function _initializableStorageSlot() internal pure virtual returns (bytes32) {
return INITIALIZABLE_STORAGE;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
bytes32 slot = _initializableStorageSlot();
assembly {
$.slot := slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC-165 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 to signal 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. This account bears the admin role (for the granted role).
* Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
*/
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.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
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.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 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 ERC165Upgradeable is Initializable, IERC165 {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reinitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.
*
* NOTE: Consider following the ERC-7201 formula to derive storage locations.
*/
function _initializableStorageSlot() internal pure virtual returns (bytes32) {
return INITIALIZABLE_STORAGE;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
bytes32 slot = _initializableStorageSlot();
assembly {
$.slot := slot
}
}
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
/*//////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public immutable decimals;
/*//////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/*//////////////////////////////////////////////////////////////
EIP-2612 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
}
/*//////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
return true;
}
/*//////////////////////////////////////////////////////////////
EIP-2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
// Unchecked because the only math done is incrementing
// the owner's nonce which cannot realistically overflow.
unchecked {
address recoveredAddress = ecrecover(
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
),
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
),
v,
r,
s
);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
}
function computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256("1"),
block.chainid,
address(this)
)
);
}
/*//////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// Cannot underflow because a user's balance
// will never be larger than the total supply.
unchecked {
totalSupply -= amount;
}
emit Transfer(from, address(0), amount);
}
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import {ERC20} from "../tokens/ERC20.sol";
/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
library SafeTransferLib {
/*//////////////////////////////////////////////////////////////
ETH OPERATIONS
//////////////////////////////////////////////////////////////*/
function safeTransferETH(address to, uint256 amount) internal {
bool success;
/// @solidity memory-safe-assembly
assembly {
// Transfer the ETH and store if it succeeded or not.
success := call(gas(), to, amount, 0, 0, 0, 0)
}
require(success, "ETH_TRANSFER_FAILED");
}
/*//////////////////////////////////////////////////////////////
ERC20 OPERATIONS
//////////////////////////////////////////////////////////////*/
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 amount
) internal {
bool success;
/// @solidity memory-safe-assembly
assembly {
// Get a pointer to some free memory.
let freeMemoryPointer := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument.
mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.
// We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
success := call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
success := iszero(or(iszero(extcodesize(token)), returndatasize()))
}
}
require(success, "TRANSFER_FROM_FAILED");
}
function safeTransfer(
ERC20 token,
address to,
uint256 amount
) internal {
bool success;
/// @solidity memory-safe-assembly
assembly {
// Get a pointer to some free memory.
let freeMemoryPointer := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.
// We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
success := iszero(or(iszero(extcodesize(token)), returndatasize()))
}
}
require(success, "TRANSFER_FAILED");
}
function safeApprove(
ERC20 token,
address to,
uint256 amount
) internal {
bool success;
/// @solidity memory-safe-assembly
assembly {
// Get a pointer to some free memory.
let freeMemoryPointer := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.
// We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
success := iszero(or(iszero(extcodesize(token)), returndatasize()))
}
}
require(success, "APPROVE_FAILED");
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";{
"remappings": [
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/",
"forge-std/=lib/forge-std/",
"solmate/=node_modules/solmate/src/",
"solady/=node_modules/solady/"
],
"optimizer": {
"enabled": true,
"runs": 10000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "shanghai",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"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":[],"name":"DnCoreWriter_NotNavOracle","type":"error"},{"inputs":[{"internalType":"address","name":"walletAddress","type":"address"}],"name":"DnCoreWriter__APIWalletAlreadyRegistered","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DnCoreWriter__AmountMismatch","type":"error"},{"inputs":[{"internalType":"uint32","name":"asset","type":"uint32"}],"name":"DnCoreWriter__AssetNotTradeable","type":"error"},{"inputs":[],"name":"DnCoreWriter__FeeRecipientOrFeeTokenNotSet","type":"error"},{"inputs":[],"name":"DnCoreWriter__MidasReceiverNotSet","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"DnCoreWriter__TokenNotRegistered","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"DnCoreWriter__TokenNotWithdrawalToken","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"walletAddress","type":"address"},{"indexed":false,"internalType":"string","name":"walletName","type":"string"}],"name":"APIWalletAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"walletName","type":"string"}],"name":"APIWalletRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"systemAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeERC20Hypercore","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeHYPE","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeRecipient","type":"address"}],"name":"FeeRecipientSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeToken","type":"address"}],"name":"FeeTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesAccumulated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeRecipient","type":"address"},{"indexed":true,"internalType":"address","name":"feeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"asset","type":"uint32"},{"indexed":true,"internalType":"bool","name":"isBuy","type":"bool"},{"indexed":false,"internalType":"uint64","name":"limitPx","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"sz","type":"uint64"},{"indexed":false,"internalType":"bool","name":"reduceOnly","type":"bool"},{"indexed":false,"internalType":"uint8","name":"tif","type":"uint8"},{"indexed":false,"internalType":"uint128","name":"cloid","type":"uint128"}],"name":"LimitOrderPlaced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"midasReceiver","type":"address"}],"name":"MidasReceiverSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"navOracle","type":"address"}],"name":"NavOracleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"asset","type":"uint32"},{"indexed":true,"internalType":"uint128","name":"cloid","type":"uint128"}],"name":"OrderCancelledByCloid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"asset","type":"uint32"},{"indexed":true,"internalType":"uint64","name":"oid","type":"uint64"}],"name":"OrderCancelledByOid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReleaseTokensForWithdrawals","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":"uint32","name":"asset","type":"uint32"},{"indexed":true,"internalType":"bool","name":"isTradeable","type":"bool"}],"name":"TradeableAssetToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"ntl","type":"uint64"},{"indexed":true,"internalType":"bool","name":"toPerp","type":"bool"}],"name":"USDClassTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint64","name":"tokenId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawTokenFromHyperCore","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"bool","name":"isWithdrawalToken","type":"bool"}],"name":"WithdrawalTokenToggled","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BRIDGE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CORE_WRITER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HYPE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SYSTEM_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRADING_AGENT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WHYPE","outputs":[{"internalType":"contract WETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAWAL_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"accumulateFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accumulatedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"walletAddress","type":"address"},{"internalType":"string","name":"walletName","type":"string"}],"name":"addAPIWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bridgeERC20ToHypercore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bridgeHYPE","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"asset","type":"uint32"},{"internalType":"uint128","name":"cloid","type":"uint128"}],"name":"cancelOrderByCloid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"asset","type":"uint32"},{"internalType":"uint64","name":"oid","type":"uint64"}],"name":"cancelOrderByOid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"isTradeableAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWithdrawalToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"midasReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"navOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"asset","type":"uint32"},{"internalType":"bool","name":"isBuy","type":"bool"},{"internalType":"uint64","name":"limitPx","type":"uint64"},{"internalType":"uint64","name":"sz","type":"uint64"},{"internalType":"bool","name":"reduceOnly","type":"bool"},{"internalType":"uint8","name":"tif","type":"uint8"},{"internalType":"uint128","name":"cloid","type":"uint128"}],"name":"placeLimitOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"systemAddress","type":"address"},{"internalType":"uint64","name":"tokenId","type":"uint64"},{"internalType":"uint8","name":"hyperEVMDecimals","type":"uint8"},{"internalType":"uint8","name":"hypercoreDecimals","type":"uint8"}],"name":"registerToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"releaseTokensForWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"walletName","type":"string"}],"name":"removeAPIWallet","outputs":[],"stateMutability":"nonpayable","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":"address","name":"_feeRecipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeToken","type":"address"}],"name":"setFeeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_midasReceiver","type":"address"}],"name":"setMidasReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_navOracle","type":"address"}],"name":"setNavOracle","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":"uint32","name":"asset","type":"uint32"}],"name":"toggleTradeableAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"toggleWithdrawalToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenConfig","outputs":[{"internalType":"uint64","name":"tokenId","type":"uint64"},{"internalType":"address","name":"systemAddress","type":"address"},{"internalType":"uint8","name":"hyperEVMDecimals","type":"uint8"},{"internalType":"uint8","name":"hypercoreDecimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unwrapHype","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"ntl","type":"uint64"},{"internalType":"bool","name":"toPerp","type":"bool"}],"name":"usdClassTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint64","name":"amount","type":"uint64"}],"name":"withdrawTokenFromHyperCore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"wrapHype","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052348015600e575f5ffd5b5060156019565b60c9565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161560685760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b039081161460c65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b612eae806100d65f395ff3fe6080604052600436106102e5575f3560e01c80636a22a00511610186578063b5bfddea116100dc578063db9949ce11610087578063e74b981b11610062578063e74b981b14610916578063f4caaa7b14610935578063fe136c4e14610954575f5ffd5b8063db9949ce146108a5578063df019044146108c4578063dfccd8e5146108f7575f5ffd5b8063c2fbe7bc116100b7578063c2fbe7bc14610853578063c99d682f14610867578063d547741f14610886575f5ffd5b8063b5bfddea146107e3578063b9ba6a3c14610816578063c00f857414610835575f5ffd5b80638129fc1c1161013c5780639d896a13116101175780639d896a1314610792578063a1263cb0146107b1578063a217fddf146107d0575f5ffd5b80638129fc1c146106fc5780638fd437931461071057806391d148541461072f575f5ffd5b806375b238fc1161016c57806375b238fc1461068357806376e86e72146106b65780637b8aebf1146106dd575f5ffd5b80636a22a005146106365780636baa7fa114610655575f5ffd5b806336568abe1161023b57806346904840116101f157806359f613a4116101cc57806359f613a4146105bd578063647846a5146105e457806367db90c214610603575f5ffd5b8063469048401461056a57806349d4640d14610589578063587f5ed7146105a8575f5ffd5b8063369e2aeb11610221578063369e2aeb1461050d57806342ba64ff1461052c578063435354d31461054b575f5ffd5b806336568abe146104cf57806336998c05146104ee575f5ffd5b8063252b0b261161029b5780632f2ff15d116102765780632f2ff15d1461046a578063300b19eb146104895780633434735f146104a8575f5ffd5b8063252b0b26146103de578063268243561461040c57806327c37b3d1461042b575f5ffd5b80631b04d88b116102cb5780631b04d88b146103455780631e9ee55f14610364578063248a9ca314610383575f5ffd5b806301ffc9a7146102f057806315cce22414610324575f5ffd5b366102ec57005b5f5ffd5b3480156102fb575f5ffd5b5061030f61030a3660046127de565b610a24565b60405190151581526020015b60405180910390f35b34801561032f575f5ffd5b5061034361033e366004612838565b610abc565b005b348015610350575f5ffd5b5061034361035f366004612851565b610b48565b34801561036f575f5ffd5b5061034361037e366004612838565b610c3a565b34801561038e575f5ffd5b506103d061039d366004612851565b5f9081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b60405190815260200161031b565b3480156103e9575f5ffd5b5061030f6103f836600461287b565b60036020525f908152604090205460ff1681565b348015610417575f5ffd5b506103436104263660046128ab565b610cc6565b348015610436575f5ffd5b5061045273333333333333333333333333333333333333333381565b6040516001600160a01b03909116815260200161031b565b348015610475575f5ffd5b506103436104843660046128dc565b610e9c565b348015610494575f5ffd5b506103436104a336600461287b565b610ee5565b3480156104b3575f5ffd5b5061045273222222222222222222222222222222222222222281565b3480156104da575f5ffd5b506103436104e93660046128dc565b610f84565b3480156104f9575f5ffd5b50610343610508366004612942565b610fd5565b348015610518575f5ffd5b506103436105273660046129a1565b61107b565b348015610537575f5ffd5b50610343610546366004612851565b6111d9565b348015610556575f5ffd5b50610343610565366004612a21565b611280565b348015610575575f5ffd5b50600554610452906001600160a01b031681565b348015610594575f5ffd5b50600754610452906001600160a01b031681565b3480156105b3575f5ffd5b506103d060045481565b3480156105c8575f5ffd5b5061045273555555555555555555555555555555555555555581565b3480156105ef575f5ffd5b50600654610452906001600160a01b031681565b34801561060e575f5ffd5b506103d07f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef81565b348015610641575f5ffd5b50610343610650366004612851565b611337565b348015610660575f5ffd5b5061030f61066f366004612838565b60026020525f908152604090205460ff1681565b34801561068e575f5ffd5b506103d07fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b3480156106c1575f5ffd5b5061045273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3480156106e8575f5ffd5b506103436106f7366004612a49565b6113c9565b348015610707575f5ffd5b50610343611464565b34801561071b575f5ffd5b5061034361072a366004612a88565b6116fe565b34801561073a575f5ffd5b5061030f6107493660046128dc565b5f9182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561079d575f5ffd5b506103436107ac366004612a88565b611892565b3480156107bc575f5ffd5b506103436107cb366004612838565b611a58565b3480156107db575f5ffd5b506103d05f81565b3480156107ee575f5ffd5b506103d07f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f81565b348015610821575f5ffd5b50610343610830366004612ab0565b611afa565b348015610840575f5ffd5b505f54610452906001600160a01b031681565b34801561085e575f5ffd5b50610343611ba1565b348015610872575f5ffd5b50610343610881366004612ad9565b611c95565b348015610891575f5ffd5b506103436108a03660046128dc565b611e16565b3480156108b0575f5ffd5b506103436108bf366004612838565b611e59565b3480156108cf575f5ffd5b506103d07f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a781565b348015610902575f5ffd5b50610343610911366004612b5a565b611ee3565b348015610921575f5ffd5b50610343610930366004612838565b611f82565b348015610940575f5ffd5b5061034361094f366004612851565b61200e565b34801561095f575f5ffd5b506109e861096e366004612838565b60016020525f908152604090205467ffffffffffffffff8116906001600160a01b03680100000000000000008204169060ff7c010000000000000000000000000000000000000000000000000000000082048116917d01000000000000000000000000000000000000000000000000000000000090041684565b6040805167ffffffffffffffff90951685526001600160a01b03909316602085015260ff9182169284019290925216606082015260800161031b565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610ab657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610ae68161209e565b600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040517f722ff84c1234b2482061def5c82c6b5080c117b3cbb69d686844a051e4b8e7f3905f90a25050565b7f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f610b728161209e565b5f610b8083601260086120ab565b9050828114610bc3576040517f71f0ef38000000000000000000000000000000000000000000000000000000008152600481018490526024015b60405180910390fd5b6040517322222222222222222222222222222222222222229082156108fc029083905f818181858888f19350505050158015610c01573d5f5f3e3d5ffd5b506040518181527f44f12180006f58db60d06642e3b3b5a4bc054fa1b9ad3a3d146b8465afad06cb9060200160405180910390a1505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610c648161209e565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040517f7e6fc713d21f76a2005d4601bc2837a45e0c8f3ffc922d9e681e1d7a4a1c489e905f90a25050565b7f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f610cf08161209e565b6001600160a01b038084165f908152600160209081526040918290208251608081018452905467ffffffffffffffff8116825268010000000000000000810490941691810182905260ff7c010000000000000000000000000000000000000000000000000000000085048116938201939093527d0100000000000000000000000000000000000000000000000000000000009093049091166060830152610dce576040517f8f62e3a50000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401610bba565b60208082015182516040515f93610e0f9392918891016001600160a01b0393909316835267ffffffffffffffff918216602084015216604082015260600190565b6040516020818303038152906040529050610e2b600682612108565b846001600160a01b031682602001516001600160a01b03167f767dad4a0ad62b90576dca50c0d6eed89b671cb029b6225b05620b988e6282c2845f015187604051610e8d92919067ffffffffffffffff92831681529116602082015260400190565b60405180910390a35050505050565b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610ed58161209e565b610edf838361236e565b50505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610f0f8161209e565b63ffffffff82165f8181526003602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00811660ff9182161590811790925591519116151592917f3a457154a006c153583f065b75412b9aae6423f393b9c65b6429fe7e1f28a18f91a35050565b6001600160a01b0381163314610fc6576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fd08282612458565b505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610fff8161209e565b5f84848460405160200161101593929190612bc9565b6040516020818303038152906040529050611031600982612108565b846001600160a01b03167fbf6053c1845ca06fbf5dedd70f0c2df5ea40dc2202254c9dbc6ebf4e949dec79858560405161106c929190612bf4565b60405180910390a25050505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756110a58161209e565b506040805160808101825267ffffffffffffffff94851681526001600160a01b03958616602080830191825260ff958616838501908152948616606084019081529888165f9081526001909152929092209051815492519351975195167fffffffff0000000000000000000000000000000000000000000000000000000090921691909117680100000000000000009290951691909102939093177fffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c0100000000000000000000000000000000000000000000000000000000948216949094027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16939093177d0100000000000000000000000000000000000000000000000000000000009190931602919091179055565b7f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef6112038161209e565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273555555555555555555555555555555555555555590632e1a7d4d906024015f604051808303815f87803b158015611266575f5ffd5b505af1158015611278573d5f5f3e3d5ffd5b505050505050565b7f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a76112aa8161209e565b6040805163ffffffff851660208201526fffffffffffffffffffffffffffffffff84168183015281518082038301815260609091019091526112ed600b82612108565b6040516fffffffffffffffffffffffffffffffff84169063ffffffff8616907fe7351c94502e2f8610a1304af2f9615275f1de78b3d4e79236b8ebf962381bdd905f90a350505050565b7f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef6113618161209e565b7355555555555555555555555555555555555555556001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004015f604051808303818588803b1580156113ae575f5ffd5b505af11580156113c0573d5f5f3e3d5ffd5b50505050505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756113f38161209e565b5f5f848460405160200161140993929190612bc9565b6040516020818303038152906040529050611425600982612108565b7f5f9762349ba942c26844414c1f2d9e2a8ba101a84da5ec0c9fe088536aba87c78484604051611456929190612bf4565b60405180910390a150505050565b5f61146d61251a565b805490915060ff68010000000000000000820416159067ffffffffffffffff165f811580156114995750825b90505f8267ffffffffffffffff1660011480156114b55750303b155b9050811580156114c3575080155b156114fa576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000166001178555831561155b5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b611563612542565b61158d7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217753361236e565b506115b87fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758061254c565b6116027f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561254c565b61164c7f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561254c565b6116967f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a77fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561254c565b83156116f75784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050565b7f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef6117288161209e565b5f546001600160a01b0316611769576040517f7d16405700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383165f9081526002602052604090205460ff166117c5576040517fe8aac4140000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401610bba565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611831575f80546040516001600160a01b039091169184156108fc02918591818181858888f1935050505015801561182b573d5f5f3e3d5ffd5b5061184a565b5f5461184a906001600160a01b038581169116846125ed565b5f546040518381526001600160a01b038581169216907f8cd64ecc144270754328f3119e8a12eaa2f73b93e326557f7cf82bd994e465dc9060200160405180910390a3505050565b7f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f6118bc8161209e565b6001600160a01b038084165f9081526001602090815260408083208151608081018352905467ffffffffffffffff811682526801000000000000000081049095169281019290925260ff7c0100000000000000000000000000000000000000000000000000000000850481169183018290527d010000000000000000000000000000000000000000000000000000000000909404909316606082018190529092611968918691906120ab565b90508381146119a6576040517f71f0ef3800000000000000000000000000000000000000000000000000000000815260048101859052602401610bba565b60208201516001600160a01b03166119f5576040517f8f62e3a50000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152602401610bba565b6020820151611a0f906001600160a01b03871690866125ed565b81602001516001600160a01b0316856001600160a01b03167f7dd19c11dd9df45a9260341d6a193dcb289a2bf0c67214a58fe8068268c0aba786604051610e8d91815260200190565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611a828161209e565b6001600160a01b0382165f8181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00811660ff9182161590811790925591519116151592917fe406f60b28a66090c343cbc7d9a4ddde2ac773e6416da08a3dc65f325c5c714f91a35050565b7f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a7611b248161209e565b6040805163ffffffff8516602082015267ffffffffffffffff8416818301528151808203830181526060909101909152611b5f600a82612108565b60405167ffffffffffffffff84169063ffffffff8616907f81836da2d4e5f15e411ffc12350d5ce8808e8a166c9779d06407b259c927a11f905f90a350505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611bcb8161209e565b6005546001600160a01b03161580611bec57506006546001600160a01b0316155b15611c23576040517f5d6970f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600480545f909155600554600654611c48916001600160a01b039182169116836125ed565b6006546005546040518381526001600160a01b0392831692909116907ffd2f5d3811ae7b8af2bd567683c6265c793894aa361eb932658effcf52d635a29060200160405180910390a35050565b7f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a7611cbf8161209e565b63ffffffff88165f9081526003602052604090205460ff16611d15576040517f994d28e600000000000000000000000000000000000000000000000000000000815263ffffffff89166004820152602401610bba565b6040805163ffffffff8a1660208201528815159181019190915267ffffffffffffffff80881660608301528616608082015284151560a082015260ff841660c08201526fffffffffffffffffffffffffffffffff831660e08201525f90610100016040516020818303038152906040529050611d92600182612108565b6040805167ffffffffffffffff8981168252881660208201528615158183015260ff861660608201526fffffffffffffffffffffffffffffffff8516608082015290518915159163ffffffff8c16917fee1b13260de26f305713cbdb186fa9ab0c8532a987e12f4d69685ff1b3e6dd1d9181900360a00190a3505050505050505050565b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154611e4f8161209e565b610edf8383612458565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611e838161209e565b5f80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038416908117825560405190917f2e7f5840ca775e68e38f91973defad7192cfbe3305c04368e9b6a13b129168ed91a25050565b7f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a7611f0d8161209e565b6040805167ffffffffffffffff85166020820152831515818301528151808203830181526060909101909152611f44600782612108565b6040518315159067ffffffffffffffff8616907f1057cab8d454b00d00404f5dd914e4660824208af64067949b90982969f9be5e905f90a350505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611fac8161209e565b600580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040517fbf9a9534339a9d6b81696e05dcfb614b7dc518a31d48be3cfb757988381fb323905f90a25050565b6007546001600160a01b03163314612052576040517f11ead70500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060045f8282546120639190612c34565b90915550506040518181527f2f04c48df6b8a02be452f59a593d58188cbb6d54db36234e058642cc48fb110e9060200160405180910390a150565b6120a8813361266d565b50565b5f8260ff168260ff16106120c0575082612101565b6120ca8284612c47565b6120d590600a612d81565b6120df8385612c47565b6120ea90600a612d81565b6120f49086612d8f565b6120fe9190612dc7565b90505b9392505050565b5f815160046121179190612c34565b67ffffffffffffffff81111561212f5761212f612dde565b6040519080825280601f01601f191660200182016040528015612159576020820181803683370190505b509050600160f81b815f8151811061217357612173612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f60f81b816001815181106121b8576121b8612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f60f81b816002815181106121fd576121fd612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053508260f81b8160038151811061224257612242612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f5b82518110156123065782818151811061228d5761228d612e0b565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016826122c0836004612c34565b815181106122d0576122d0612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a905350600101612272565b506040517f17938e13000000000000000000000000000000000000000000000000000000008152733333333333333333333333333333333333333333906317938e1390612357908490600401612e38565b5f604051808303815f87803b1580156113ae575f5ffd5b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602081815260408084206001600160a01b038616855290915282205460ff1661244f575f848152602082815260408083206001600160a01b0387168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556124053390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610ab6565b5f915050610ab6565b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602081815260408084206001600160a01b038616855290915282205460ff161561244f575f848152602082815260408083206001600160a01b038716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610ab6565b5f807ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00610ab6565b61254a6126fd565b565b7f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268005f6125a5845f9081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b5f85815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610fd090849061273b565b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602090815260408083206001600160a01b038516845290915290205460ff166126f9576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101839052604401610bba565b5050565b6127056127c0565b61254a576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f60205f8451602086015f885af18061275a576040513d5f823e3d81fd5b50505f513d9150811561277157806001141561277e565b6001600160a01b0384163b155b15610edf576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401610bba565b5f6127c961251a565b5468010000000000000000900460ff16919050565b5f602082840312156127ee575f5ffd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114612101575f5ffd5b80356001600160a01b0381168114612833575f5ffd5b919050565b5f60208284031215612848575f5ffd5b6121018261281d565b5f60208284031215612861575f5ffd5b5035919050565b803563ffffffff81168114612833575f5ffd5b5f6020828403121561288b575f5ffd5b61210182612868565b803567ffffffffffffffff81168114612833575f5ffd5b5f5f604083850312156128bc575f5ffd5b6128c58361281d565b91506128d360208401612894565b90509250929050565b5f5f604083850312156128ed575f5ffd5b823591506128d36020840161281d565b5f5f83601f84011261290d575f5ffd5b50813567ffffffffffffffff811115612924575f5ffd5b60208301915083602082850101111561293b575f5ffd5b9250929050565b5f5f5f60408486031215612954575f5ffd5b61295d8461281d565b9250602084013567ffffffffffffffff811115612978575f5ffd5b612984868287016128fd565b9497909650939450505050565b803560ff81168114612833575f5ffd5b5f5f5f5f5f60a086880312156129b5575f5ffd5b6129be8661281d565b94506129cc6020870161281d565b93506129da60408701612894565b92506129e860608701612991565b91506129f660808701612991565b90509295509295909350565b80356fffffffffffffffffffffffffffffffff81168114612833575f5ffd5b5f5f60408385031215612a32575f5ffd5b612a3b83612868565b91506128d360208401612a02565b5f5f60208385031215612a5a575f5ffd5b823567ffffffffffffffff811115612a70575f5ffd5b612a7c858286016128fd565b90969095509350505050565b5f5f60408385031215612a99575f5ffd5b612aa28361281d565b946020939093013593505050565b5f5f60408385031215612ac1575f5ffd5b6128c583612868565b80358015158114612833575f5ffd5b5f5f5f5f5f5f5f60e0888a031215612aef575f5ffd5b612af888612868565b9650612b0660208901612aca565b9550612b1460408901612894565b9450612b2260608901612894565b9350612b3060808901612aca565b9250612b3e60a08901612991565b9150612b4c60c08901612a02565b905092959891949750929550565b5f5f60408385031215612b6b575f5ffd5b612b7483612894565b91506128d360208401612aca565b81835281816020850137505f602082840101525f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6001600160a01b0384168152604060208201525f612beb604083018486612b82565b95945050505050565b602081525f6120fe602083018486612b82565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b80820180821115610ab657610ab6612c07565b60ff8281168282160390811115610ab657610ab6612c07565b6001815b6001841115612c9b57808504811115612c7f57612c7f612c07565b6001841615612c8d57908102905b60019390931c928002612c64565b935093915050565b5f82612cb157506001610ab6565b81612cbd57505f610ab6565b8160018114612cd35760028114612cdd57612cf9565b6001915050610ab6565b60ff841115612cee57612cee612c07565b50506001821b610ab6565b5060208310610133831016604e8410600b8410161715612d1c575081810a610ab6565b612d477fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612c60565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612d7957612d79612c07565b029392505050565b5f61210160ff841683612ca3565b5f82612dc2577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b8082028115828204841417610ab657610ab6612c07565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b602081525f82518060208401525f5b81811015612e645760208186018101516040868401015201612e47565b505f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168401019150509291505056fea164736f6c634300081d000a
Deployed Bytecode
0x6080604052600436106102e5575f3560e01c80636a22a00511610186578063b5bfddea116100dc578063db9949ce11610087578063e74b981b11610062578063e74b981b14610916578063f4caaa7b14610935578063fe136c4e14610954575f5ffd5b8063db9949ce146108a5578063df019044146108c4578063dfccd8e5146108f7575f5ffd5b8063c2fbe7bc116100b7578063c2fbe7bc14610853578063c99d682f14610867578063d547741f14610886575f5ffd5b8063b5bfddea146107e3578063b9ba6a3c14610816578063c00f857414610835575f5ffd5b80638129fc1c1161013c5780639d896a13116101175780639d896a1314610792578063a1263cb0146107b1578063a217fddf146107d0575f5ffd5b80638129fc1c146106fc5780638fd437931461071057806391d148541461072f575f5ffd5b806375b238fc1161016c57806375b238fc1461068357806376e86e72146106b65780637b8aebf1146106dd575f5ffd5b80636a22a005146106365780636baa7fa114610655575f5ffd5b806336568abe1161023b57806346904840116101f157806359f613a4116101cc57806359f613a4146105bd578063647846a5146105e457806367db90c214610603575f5ffd5b8063469048401461056a57806349d4640d14610589578063587f5ed7146105a8575f5ffd5b8063369e2aeb11610221578063369e2aeb1461050d57806342ba64ff1461052c578063435354d31461054b575f5ffd5b806336568abe146104cf57806336998c05146104ee575f5ffd5b8063252b0b261161029b5780632f2ff15d116102765780632f2ff15d1461046a578063300b19eb146104895780633434735f146104a8575f5ffd5b8063252b0b26146103de578063268243561461040c57806327c37b3d1461042b575f5ffd5b80631b04d88b116102cb5780631b04d88b146103455780631e9ee55f14610364578063248a9ca314610383575f5ffd5b806301ffc9a7146102f057806315cce22414610324575f5ffd5b366102ec57005b5f5ffd5b3480156102fb575f5ffd5b5061030f61030a3660046127de565b610a24565b60405190151581526020015b60405180910390f35b34801561032f575f5ffd5b5061034361033e366004612838565b610abc565b005b348015610350575f5ffd5b5061034361035f366004612851565b610b48565b34801561036f575f5ffd5b5061034361037e366004612838565b610c3a565b34801561038e575f5ffd5b506103d061039d366004612851565b5f9081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b60405190815260200161031b565b3480156103e9575f5ffd5b5061030f6103f836600461287b565b60036020525f908152604090205460ff1681565b348015610417575f5ffd5b506103436104263660046128ab565b610cc6565b348015610436575f5ffd5b5061045273333333333333333333333333333333333333333381565b6040516001600160a01b03909116815260200161031b565b348015610475575f5ffd5b506103436104843660046128dc565b610e9c565b348015610494575f5ffd5b506103436104a336600461287b565b610ee5565b3480156104b3575f5ffd5b5061045273222222222222222222222222222222222222222281565b3480156104da575f5ffd5b506103436104e93660046128dc565b610f84565b3480156104f9575f5ffd5b50610343610508366004612942565b610fd5565b348015610518575f5ffd5b506103436105273660046129a1565b61107b565b348015610537575f5ffd5b50610343610546366004612851565b6111d9565b348015610556575f5ffd5b50610343610565366004612a21565b611280565b348015610575575f5ffd5b50600554610452906001600160a01b031681565b348015610594575f5ffd5b50600754610452906001600160a01b031681565b3480156105b3575f5ffd5b506103d060045481565b3480156105c8575f5ffd5b5061045273555555555555555555555555555555555555555581565b3480156105ef575f5ffd5b50600654610452906001600160a01b031681565b34801561060e575f5ffd5b506103d07f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef81565b348015610641575f5ffd5b50610343610650366004612851565b611337565b348015610660575f5ffd5b5061030f61066f366004612838565b60026020525f908152604090205460ff1681565b34801561068e575f5ffd5b506103d07fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b3480156106c1575f5ffd5b5061045273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3480156106e8575f5ffd5b506103436106f7366004612a49565b6113c9565b348015610707575f5ffd5b50610343611464565b34801561071b575f5ffd5b5061034361072a366004612a88565b6116fe565b34801561073a575f5ffd5b5061030f6107493660046128dc565b5f9182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561079d575f5ffd5b506103436107ac366004612a88565b611892565b3480156107bc575f5ffd5b506103436107cb366004612838565b611a58565b3480156107db575f5ffd5b506103d05f81565b3480156107ee575f5ffd5b506103d07f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f81565b348015610821575f5ffd5b50610343610830366004612ab0565b611afa565b348015610840575f5ffd5b505f54610452906001600160a01b031681565b34801561085e575f5ffd5b50610343611ba1565b348015610872575f5ffd5b50610343610881366004612ad9565b611c95565b348015610891575f5ffd5b506103436108a03660046128dc565b611e16565b3480156108b0575f5ffd5b506103436108bf366004612838565b611e59565b3480156108cf575f5ffd5b506103d07f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a781565b348015610902575f5ffd5b50610343610911366004612b5a565b611ee3565b348015610921575f5ffd5b50610343610930366004612838565b611f82565b348015610940575f5ffd5b5061034361094f366004612851565b61200e565b34801561095f575f5ffd5b506109e861096e366004612838565b60016020525f908152604090205467ffffffffffffffff8116906001600160a01b03680100000000000000008204169060ff7c010000000000000000000000000000000000000000000000000000000082048116917d01000000000000000000000000000000000000000000000000000000000090041684565b6040805167ffffffffffffffff90951685526001600160a01b03909316602085015260ff9182169284019290925216606082015260800161031b565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610ab657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610ae68161209e565b600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040517f722ff84c1234b2482061def5c82c6b5080c117b3cbb69d686844a051e4b8e7f3905f90a25050565b7f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f610b728161209e565b5f610b8083601260086120ab565b9050828114610bc3576040517f71f0ef38000000000000000000000000000000000000000000000000000000008152600481018490526024015b60405180910390fd5b6040517322222222222222222222222222222222222222229082156108fc029083905f818181858888f19350505050158015610c01573d5f5f3e3d5ffd5b506040518181527f44f12180006f58db60d06642e3b3b5a4bc054fa1b9ad3a3d146b8465afad06cb9060200160405180910390a1505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610c648161209e565b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040517f7e6fc713d21f76a2005d4601bc2837a45e0c8f3ffc922d9e681e1d7a4a1c489e905f90a25050565b7f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f610cf08161209e565b6001600160a01b038084165f908152600160209081526040918290208251608081018452905467ffffffffffffffff8116825268010000000000000000810490941691810182905260ff7c010000000000000000000000000000000000000000000000000000000085048116938201939093527d0100000000000000000000000000000000000000000000000000000000009093049091166060830152610dce576040517f8f62e3a50000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401610bba565b60208082015182516040515f93610e0f9392918891016001600160a01b0393909316835267ffffffffffffffff918216602084015216604082015260600190565b6040516020818303038152906040529050610e2b600682612108565b846001600160a01b031682602001516001600160a01b03167f767dad4a0ad62b90576dca50c0d6eed89b671cb029b6225b05620b988e6282c2845f015187604051610e8d92919067ffffffffffffffff92831681529116602082015260400190565b60405180910390a35050505050565b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610ed58161209e565b610edf838361236e565b50505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610f0f8161209e565b63ffffffff82165f8181526003602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00811660ff9182161590811790925591519116151592917f3a457154a006c153583f065b75412b9aae6423f393b9c65b6429fe7e1f28a18f91a35050565b6001600160a01b0381163314610fc6576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fd08282612458565b505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610fff8161209e565b5f84848460405160200161101593929190612bc9565b6040516020818303038152906040529050611031600982612108565b846001600160a01b03167fbf6053c1845ca06fbf5dedd70f0c2df5ea40dc2202254c9dbc6ebf4e949dec79858560405161106c929190612bf4565b60405180910390a25050505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756110a58161209e565b506040805160808101825267ffffffffffffffff94851681526001600160a01b03958616602080830191825260ff958616838501908152948616606084019081529888165f9081526001909152929092209051815492519351975195167fffffffff0000000000000000000000000000000000000000000000000000000090921691909117680100000000000000009290951691909102939093177fffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c0100000000000000000000000000000000000000000000000000000000948216949094027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16939093177d0100000000000000000000000000000000000000000000000000000000009190931602919091179055565b7f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef6112038161209e565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273555555555555555555555555555555555555555590632e1a7d4d906024015f604051808303815f87803b158015611266575f5ffd5b505af1158015611278573d5f5f3e3d5ffd5b505050505050565b7f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a76112aa8161209e565b6040805163ffffffff851660208201526fffffffffffffffffffffffffffffffff84168183015281518082038301815260609091019091526112ed600b82612108565b6040516fffffffffffffffffffffffffffffffff84169063ffffffff8616907fe7351c94502e2f8610a1304af2f9615275f1de78b3d4e79236b8ebf962381bdd905f90a350505050565b7f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef6113618161209e565b7355555555555555555555555555555555555555556001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004015f604051808303818588803b1580156113ae575f5ffd5b505af11580156113c0573d5f5f3e3d5ffd5b50505050505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756113f38161209e565b5f5f848460405160200161140993929190612bc9565b6040516020818303038152906040529050611425600982612108565b7f5f9762349ba942c26844414c1f2d9e2a8ba101a84da5ec0c9fe088536aba87c78484604051611456929190612bf4565b60405180910390a150505050565b5f61146d61251a565b805490915060ff68010000000000000000820416159067ffffffffffffffff165f811580156114995750825b90505f8267ffffffffffffffff1660011480156114b55750303b155b9050811580156114c3575080155b156114fa576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000166001178555831561155b5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b611563612542565b61158d7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217753361236e565b506115b87fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758061254c565b6116027f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561254c565b61164c7f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561254c565b6116967f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a77fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561254c565b83156116f75784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050565b7f0744af9828f5bfd2e0f842fd62674fe7c160a394d457c33e1a56eeae3a44a9ef6117288161209e565b5f546001600160a01b0316611769576040517f7d16405700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383165f9081526002602052604090205460ff166117c5576040517fe8aac4140000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401610bba565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611831575f80546040516001600160a01b039091169184156108fc02918591818181858888f1935050505015801561182b573d5f5f3e3d5ffd5b5061184a565b5f5461184a906001600160a01b038581169116846125ed565b5f546040518381526001600160a01b038581169216907f8cd64ecc144270754328f3119e8a12eaa2f73b93e326557f7cf82bd994e465dc9060200160405180910390a3505050565b7f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f6118bc8161209e565b6001600160a01b038084165f9081526001602090815260408083208151608081018352905467ffffffffffffffff811682526801000000000000000081049095169281019290925260ff7c0100000000000000000000000000000000000000000000000000000000850481169183018290527d010000000000000000000000000000000000000000000000000000000000909404909316606082018190529092611968918691906120ab565b90508381146119a6576040517f71f0ef3800000000000000000000000000000000000000000000000000000000815260048101859052602401610bba565b60208201516001600160a01b03166119f5576040517f8f62e3a50000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152602401610bba565b6020820151611a0f906001600160a01b03871690866125ed565b81602001516001600160a01b0316856001600160a01b03167f7dd19c11dd9df45a9260341d6a193dcb289a2bf0c67214a58fe8068268c0aba786604051610e8d91815260200190565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611a828161209e565b6001600160a01b0382165f8181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00811660ff9182161590811790925591519116151592917fe406f60b28a66090c343cbc7d9a4ddde2ac773e6416da08a3dc65f325c5c714f91a35050565b7f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a7611b248161209e565b6040805163ffffffff8516602082015267ffffffffffffffff8416818301528151808203830181526060909101909152611b5f600a82612108565b60405167ffffffffffffffff84169063ffffffff8616907f81836da2d4e5f15e411ffc12350d5ce8808e8a166c9779d06407b259c927a11f905f90a350505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611bcb8161209e565b6005546001600160a01b03161580611bec57506006546001600160a01b0316155b15611c23576040517f5d6970f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600480545f909155600554600654611c48916001600160a01b039182169116836125ed565b6006546005546040518381526001600160a01b0392831692909116907ffd2f5d3811ae7b8af2bd567683c6265c793894aa361eb932658effcf52d635a29060200160405180910390a35050565b7f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a7611cbf8161209e565b63ffffffff88165f9081526003602052604090205460ff16611d15576040517f994d28e600000000000000000000000000000000000000000000000000000000815263ffffffff89166004820152602401610bba565b6040805163ffffffff8a1660208201528815159181019190915267ffffffffffffffff80881660608301528616608082015284151560a082015260ff841660c08201526fffffffffffffffffffffffffffffffff831660e08201525f90610100016040516020818303038152906040529050611d92600182612108565b6040805167ffffffffffffffff8981168252881660208201528615158183015260ff861660608201526fffffffffffffffffffffffffffffffff8516608082015290518915159163ffffffff8c16917fee1b13260de26f305713cbdb186fa9ab0c8532a987e12f4d69685ff1b3e6dd1d9181900360a00190a3505050505050505050565b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154611e4f8161209e565b610edf8383612458565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611e838161209e565b5f80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038416908117825560405190917f2e7f5840ca775e68e38f91973defad7192cfbe3305c04368e9b6a13b129168ed91a25050565b7f62034f15d91196decf840a242dc30e9083c47bff6cc169c629cb5d592a01b5a7611f0d8161209e565b6040805167ffffffffffffffff85166020820152831515818301528151808203830181526060909101909152611f44600782612108565b6040518315159067ffffffffffffffff8616907f1057cab8d454b00d00404f5dd914e4660824208af64067949b90982969f9be5e905f90a350505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775611fac8161209e565b600580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091556040517fbf9a9534339a9d6b81696e05dcfb614b7dc518a31d48be3cfb757988381fb323905f90a25050565b6007546001600160a01b03163314612052576040517f11ead70500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060045f8282546120639190612c34565b90915550506040518181527f2f04c48df6b8a02be452f59a593d58188cbb6d54db36234e058642cc48fb110e9060200160405180910390a150565b6120a8813361266d565b50565b5f8260ff168260ff16106120c0575082612101565b6120ca8284612c47565b6120d590600a612d81565b6120df8385612c47565b6120ea90600a612d81565b6120f49086612d8f565b6120fe9190612dc7565b90505b9392505050565b5f815160046121179190612c34565b67ffffffffffffffff81111561212f5761212f612dde565b6040519080825280601f01601f191660200182016040528015612159576020820181803683370190505b509050600160f81b815f8151811061217357612173612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f60f81b816001815181106121b8576121b8612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f60f81b816002815181106121fd576121fd612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053508260f81b8160038151811061224257612242612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f5b82518110156123065782818151811061228d5761228d612e0b565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016826122c0836004612c34565b815181106122d0576122d0612e0b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a905350600101612272565b506040517f17938e13000000000000000000000000000000000000000000000000000000008152733333333333333333333333333333333333333333906317938e1390612357908490600401612e38565b5f604051808303815f87803b1580156113ae575f5ffd5b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602081815260408084206001600160a01b038616855290915282205460ff1661244f575f848152602082815260408083206001600160a01b0387168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556124053390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610ab6565b5f915050610ab6565b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602081815260408084206001600160a01b038616855290915282205460ff161561244f575f848152602082815260408083206001600160a01b038716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610ab6565b5f807ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00610ab6565b61254a6126fd565b565b7f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268005f6125a5845f9081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b5f85815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610fd090849061273b565b5f8281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602090815260408083206001600160a01b038516845290915290205460ff166126f9576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101839052604401610bba565b5050565b6127056127c0565b61254a576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f60205f8451602086015f885af18061275a576040513d5f823e3d81fd5b50505f513d9150811561277157806001141561277e565b6001600160a01b0384163b155b15610edf576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401610bba565b5f6127c961251a565b5468010000000000000000900460ff16919050565b5f602082840312156127ee575f5ffd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114612101575f5ffd5b80356001600160a01b0381168114612833575f5ffd5b919050565b5f60208284031215612848575f5ffd5b6121018261281d565b5f60208284031215612861575f5ffd5b5035919050565b803563ffffffff81168114612833575f5ffd5b5f6020828403121561288b575f5ffd5b61210182612868565b803567ffffffffffffffff81168114612833575f5ffd5b5f5f604083850312156128bc575f5ffd5b6128c58361281d565b91506128d360208401612894565b90509250929050565b5f5f604083850312156128ed575f5ffd5b823591506128d36020840161281d565b5f5f83601f84011261290d575f5ffd5b50813567ffffffffffffffff811115612924575f5ffd5b60208301915083602082850101111561293b575f5ffd5b9250929050565b5f5f5f60408486031215612954575f5ffd5b61295d8461281d565b9250602084013567ffffffffffffffff811115612978575f5ffd5b612984868287016128fd565b9497909650939450505050565b803560ff81168114612833575f5ffd5b5f5f5f5f5f60a086880312156129b5575f5ffd5b6129be8661281d565b94506129cc6020870161281d565b93506129da60408701612894565b92506129e860608701612991565b91506129f660808701612991565b90509295509295909350565b80356fffffffffffffffffffffffffffffffff81168114612833575f5ffd5b5f5f60408385031215612a32575f5ffd5b612a3b83612868565b91506128d360208401612a02565b5f5f60208385031215612a5a575f5ffd5b823567ffffffffffffffff811115612a70575f5ffd5b612a7c858286016128fd565b90969095509350505050565b5f5f60408385031215612a99575f5ffd5b612aa28361281d565b946020939093013593505050565b5f5f60408385031215612ac1575f5ffd5b6128c583612868565b80358015158114612833575f5ffd5b5f5f5f5f5f5f5f60e0888a031215612aef575f5ffd5b612af888612868565b9650612b0660208901612aca565b9550612b1460408901612894565b9450612b2260608901612894565b9350612b3060808901612aca565b9250612b3e60a08901612991565b9150612b4c60c08901612a02565b905092959891949750929550565b5f5f60408385031215612b6b575f5ffd5b612b7483612894565b91506128d360208401612aca565b81835281816020850137505f602082840101525f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6001600160a01b0384168152604060208201525f612beb604083018486612b82565b95945050505050565b602081525f6120fe602083018486612b82565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b80820180821115610ab657610ab6612c07565b60ff8281168282160390811115610ab657610ab6612c07565b6001815b6001841115612c9b57808504811115612c7f57612c7f612c07565b6001841615612c8d57908102905b60019390931c928002612c64565b935093915050565b5f82612cb157506001610ab6565b81612cbd57505f610ab6565b8160018114612cd35760028114612cdd57612cf9565b6001915050610ab6565b60ff841115612cee57612cee612c07565b50506001821b610ab6565b5060208310610133831016604e8410600b8410161715612d1c575081810a610ab6565b612d477fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612c60565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612d7957612d79612c07565b029392505050565b5f61210160ff841683612ca3565b5f82612dc2577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b8082028115828204841417610ab657610ab6612c07565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b602081525f82518060208401525f5b81811015612e645760208186018101516040868401015201612e47565b505f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168401019150509291505056fea164736f6c634300081d000a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in HYPE
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.