Source Code
Latest 22 from a total of 22 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Stake For | 24427313 | 24 days ago | IN | 0 ETH | 0.00002909 | ||||
| Stake For | 24427308 | 24 days ago | IN | 0 ETH | 0.00002452 | ||||
| Stake For | 24427296 | 24 days ago | IN | 0 ETH | 0.00003208 | ||||
| Stake For | 24427226 | 24 days ago | IN | 0 ETH | 0.00003075 | ||||
| Stake For | 19874130 | 660 days ago | IN | 0 ETH | 0.00139587 | ||||
| Stake For | 19586309 | 701 days ago | IN | 0 ETH | 0.00180661 | ||||
| Stake For | 19533478 | 708 days ago | IN | 0 ETH | 0.00545561 | ||||
| Stake For | 19074598 | 772 days ago | IN | 0 ETH | 0.0012577 | ||||
| Stake For | 18958147 | 789 days ago | IN | 0 ETH | 0.00490678 | ||||
| Stake For | 18812631 | 809 days ago | IN | 0 ETH | 0.00548121 | ||||
| Stake For | 18642520 | 833 days ago | IN | 0 ETH | 0.0064568 | ||||
| Stake For | 18391437 | 868 days ago | IN | 0 ETH | 0.00323834 | ||||
| Stake For | 18391426 | 868 days ago | IN | 0 ETH | 0.00340849 | ||||
| Stake For | 18391410 | 868 days ago | IN | 0 ETH | 0.00368563 | ||||
| Stake For | 18391398 | 868 days ago | IN | 0 ETH | 0.00279019 | ||||
| Stake For | 18391389 | 868 days ago | IN | 0 ETH | 0.00257765 | ||||
| Stake For | 18391378 | 868 days ago | IN | 0 ETH | 0.00260841 | ||||
| Stake For | 18391356 | 868 days ago | IN | 0 ETH | 0.00251732 | ||||
| Stake For | 18391348 | 868 days ago | IN | 0 ETH | 0.00360402 | ||||
| Stake For | 18391328 | 868 days ago | IN | 0 ETH | 0.00070483 | ||||
| Register Child C... | 18391045 | 868 days ago | IN | 0 ETH | 0.00206148 | ||||
| Initialize | 18391040 | 868 days ago | IN | 0 ETH | 0.00060968 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
StakeManager
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 115 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../lib/ChildManagerLib.sol";
import "../../lib/StakeManagerLib.sol";
contract StakeManager is IStakeManager, Initializable {
using ChildManagerLib for ChildChains;
using StakeManagerLib for Stakes;
using SafeERC20 for IERC20;
IERC20 internal matic;
ChildChains private _chains;
Stakes private _stakes;
function initialize(address newMatic) public initializer {
matic = IERC20(newMatic);
}
/**
* @inheritdoc IStakeManager
*/
function registerChildChain(address manager) external returns (uint256 id) {
require(_chains.ids[manager] == 0, "StakeManager: ID_ALREADY_SET");
id = _chains.registerChild(manager);
ISupernetManager(manager).onInit(id);
// slither-disable-next-line reentrancy-events
emit ChildManagerRegistered(id, manager);
}
/**
* @inheritdoc IStakeManager
*/
function stakeFor(uint256 id, uint256 amount) external {
require(id != 0 && id <= _chains.counter, "StakeManager: INVALID_ID");
// slither-disable-next-line reentrancy-benign,reentrancy-events
matic.safeTransferFrom(msg.sender, address(this), amount);
// calling the library directly once fixes the coverage issue
// https://github.com/foundry-rs/foundry/issues/4854#issuecomment-1528897219
StakeManagerLib.addStake(_stakes, msg.sender, id, amount);
ISupernetManager manager = managerOf(id);
manager.onStake(msg.sender, amount);
// slither-disable-next-line reentrancy-events
emit StakeAdded(id, msg.sender, amount);
}
/**
* @inheritdoc IStakeManager
*/
function releaseStakeOf(address validator, uint256 amount) external {
uint256 id = idFor(msg.sender);
_stakes.removeStake(validator, id, amount);
// slither-disable-next-line reentrancy-events
emit StakeRemoved(id, validator, amount);
}
/**
* @inheritdoc IStakeManager
*/
function withdrawStake(address to, uint256 amount) external {
_withdrawStake(msg.sender, to, amount);
}
/**
* @inheritdoc IStakeManager
*/
function slashStakeOf(address validator, uint256 amount) external {
uint256 id = idFor(msg.sender);
uint256 stake = stakeOf(validator, id);
if (amount > stake) amount = stake;
_stakes.removeStake(validator, id, stake);
_withdrawStake(validator, msg.sender, amount);
emit StakeRemoved(id, validator, stake);
emit ValidatorSlashed(id, validator, amount);
}
/**
* @inheritdoc IStakeManager
*/
function withdrawableStake(address validator) external view returns (uint256 amount) {
amount = _stakes.withdrawableStakeOf(validator);
}
/**
* @inheritdoc IStakeManager
*/
function totalStake() external view returns (uint256 amount) {
amount = _stakes.totalStake;
}
/**
* @inheritdoc IStakeManager
*/
function totalStakeOfChild(uint256 id) external view returns (uint256 amount) {
amount = _stakes.totalStakeOfChild(id);
}
/**
* @inheritdoc IStakeManager
*/
function totalStakeOf(address validator) external view returns (uint256 amount) {
amount = _stakes.totalStakeOf(validator);
}
/**
* @inheritdoc IStakeManager
*/
function stakeOf(address validator, uint256 id) public view returns (uint256 amount) {
amount = _stakes.stakeOf(validator, id);
}
/**
* @inheritdoc IStakeManager
*/
function managerOf(uint256 id) public view returns (ISupernetManager manager) {
manager = ISupernetManager(_chains.managerOf(id));
}
/**
* @inheritdoc IStakeManager
*/
function idFor(address manager) public view returns (uint256 id) {
id = ChildManagerLib.idFor(_chains, manager);
}
function _withdrawStake(address validator, address to, uint256 amount) private {
_stakes.withdrawStake(validator, amount);
// slither-disable-next-line reentrancy-events
matic.safeTransfer(to, amount);
emit StakeWithdrawn(validator, to, amount);
}
// slither-disable-next-line unused-state,naming-convention
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @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 Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_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 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_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() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @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 {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "../../../interfaces/root/staking/ISupernetManager.sol";
/**
@title IStakeManager
@author Polygon Technology (@gretzke)
@notice Manages stakes for all child chains
*/
interface IStakeManager {
event ChildManagerRegistered(uint256 indexed id, address indexed manager);
event StakeAdded(uint256 indexed id, address indexed validator, uint256 amount);
event StakeRemoved(uint256 indexed id, address indexed validator, uint256 amount);
event StakeWithdrawn(address indexed validator, address indexed recipient, uint256 amount);
event ValidatorSlashed(uint256 indexed id, address indexed validator, uint256 amount);
/// @notice registers a new child chain with the staking contract
/// @return id of the child chain
function registerChildChain(address manager) external returns (uint256 id);
/// @notice called by a validator to stake for a child chain
function stakeFor(uint256 id, uint256 amount) external;
/// @notice called by child manager contract to release a validator's stake
function releaseStakeOf(address validator, uint256 amount) external;
/// @notice allows a validator to withdraw released stake
function withdrawStake(address to, uint256 amount) external;
/// @notice called by child manager contract to slash a validator's stake
/// @notice manager collects slashed amount
function slashStakeOf(address validator, uint256 amount) external;
/// @notice returns the amount of stake a validator can withdraw
function withdrawableStake(address validator) external view returns (uint256 amount);
/// @notice returns the total amount staked for all child chains
function totalStake() external view returns (uint256 amount);
/// @notice returns the total amount staked for a child chain
function totalStakeOfChild(uint256 id) external view returns (uint256 amount);
/// @notice returns the total amount staked of a validator for all child chains
function totalStakeOf(address validator) external view returns (uint256 amount);
/// @notice returns the amount staked by a validator for a child chain
function stakeOf(address validator, uint256 id) external view returns (uint256 amount);
/// @notice returns the child chain manager contract for a child chain
function managerOf(uint256 id) external view returns (ISupernetManager manager);
/// @notice returns the child id for a child chain manager contract
function idFor(address manager) external view returns (uint256 id);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
/**
@title ISupernetManager
@author Polygon Technology (@gretzke)
@notice Abstract contract for managing supernets
@dev Should be implemented with custom desired functionality
*/
interface ISupernetManager {
/// @notice called when a new child chain is registered
function onInit(uint256 id) external;
/// @notice called when a validator stakes
function onStake(address validator, uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
struct ChildChains {
uint256 counter;
mapping(uint256 => address) managers;
mapping(address => uint256) ids;
}
library ChildManagerLib {
function registerChild(ChildChains storage self, address manager) internal returns (uint256 id) {
require(manager != address(0), "ChildManagerLib: INVALID_ADDRESS");
id = ++self.counter;
self.managers[id] = manager;
self.ids[manager] = id;
}
function managerOf(ChildChains storage self, uint256 id) internal view returns (address manager) {
manager = self.managers[id];
require(manager != address(0), "ChildManagerLib: INVALID_ID");
}
function idFor(ChildChains storage self, address manager) internal view returns (uint256 id) {
id = self.ids[manager];
require(id != 0, "ChildManagerLib: INVALID_MANAGER");
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "../interfaces/root/staking/IStakeManager.sol";
struct Stakes {
uint256 totalStake;
// validator => child => amount
mapping(address => mapping(uint256 => uint256)) stakes;
// child chain => total stake
mapping(uint256 => uint256) totalStakePerChild;
mapping(address => uint256) totalStakes;
mapping(address => uint256) withdrawableStakes;
}
library StakeManagerLib {
function addStake(Stakes storage self, address validator, uint256 id, uint256 amount) internal {
self.stakes[validator][id] += amount;
self.totalStakePerChild[id] += amount;
self.totalStakes[validator] += amount;
self.totalStake += amount;
}
function removeStake(Stakes storage self, address validator, uint256 id, uint256 amount) internal {
self.stakes[validator][id] -= amount;
self.totalStakePerChild[id] -= amount;
self.totalStakes[validator] -= amount;
self.totalStake -= amount;
self.withdrawableStakes[validator] += amount;
}
function withdrawStake(Stakes storage self, address validator, uint256 amount) internal {
self.withdrawableStakes[validator] -= amount;
}
function withdrawableStakeOf(Stakes storage self, address validator) internal view returns (uint256 amount) {
amount = self.withdrawableStakes[validator];
}
function totalStakeOfChild(Stakes storage self, uint256 id) internal view returns (uint256 amount) {
amount = self.totalStakePerChild[id];
}
function stakeOf(Stakes storage self, address validator, uint256 id) internal view returns (uint256 amount) {
amount = self.stakes[validator][id];
}
function totalStakeOf(Stakes storage self, address validator) internal view returns (uint256 amount) {
amount = self.totalStakes[validator];
}
}{
"optimizer": {
"enabled": true,
"runs": 115
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"manager","type":"address"}],"name":"ChildManagerRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"validator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"validator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakeRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"validator","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakeWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"validator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ValidatorSlashed","type":"event"},{"inputs":[{"internalType":"address","name":"manager","type":"address"}],"name":"idFor","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newMatic","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"managerOf","outputs":[{"internalType":"contract ISupernetManager","name":"manager","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"manager","type":"address"}],"name":"registerChildChain","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validator","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"releaseStakeOf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validator","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"slashStakeOf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validator","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"stakeOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStake","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validator","type":"address"}],"name":"totalStakeOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalStakeOfChild","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validator","type":"address"}],"name":"withdrawableStake","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b50610f7d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100bf5760003560e01c8063c60662721161007c578063c606627214610140578063c73a7a1f14610153578063d5364bbf14610166578063d7fbee3d14610179578063e3f56eaa146101a4578063ed87169c146101b7578063f90423fe146101ca57600080fd5b80633651bb1d146100c457806339ed8c90146100d95780638028a6db146100ff5780638b0e9f3f14610112578063b64ddbf61461011a578063c4d66de81461012d575b600080fd5b6100d76100d2366004610ddd565b6101dd565b005b6100ec6100e7366004610e07565b610240565b6040519081526020015b60405180910390f35b6100d761010d366004610ddd565b610256565b6004546100ec565b6100ec610128366004610e20565b610323565b6100d761013b366004610e20565b610431565b6100d761014e366004610ddd565b61055d565b6100d7610161366004610e3b565b610568565b6100ec610174366004610e20565b61068d565b61018c610187366004610e07565b6106ab565b6040516001600160a01b0390911681526020016100f6565b6100ec6101b2366004610e20565b6106b8565b6100ec6101c5366004610ddd565b6106d6565b6100ec6101d8366004610e20565b610702565b60006101e833610702565b90506101f7600484838561070f565b826001600160a01b0316817fcbc2141407acdf7a77731afda2c1369f3c46e04194b90a9d527385c17608eb0d8460405161023391815260200190565b60405180910390a3505050565b6000818152600660205260408120545b92915050565b600061026133610702565b9050600061026f84836106d6565b90508083111561027d578092505b61028a600485848461070f565b6102958433856107eb565b836001600160a01b0316827fcbc2141407acdf7a77731afda2c1369f3c46e04194b90a9d527385c17608eb0d836040516102d191815260200190565b60405180910390a3836001600160a01b0316827fff61f9c95b299671af1bb01c9888e344ed74c6fdff2b1c98eeed2be18714aac08560405161031591815260200190565b60405180910390a350505050565b6001600160a01b0381166000908152600360205260408120541561038e5760405162461bcd60e51b815260206004820152601c60248201527f5374616b654d616e616765723a2049445f414c52454144595f5345540000000060448201526064015b60405180910390fd5b610399600183610859565b604051630d12979960e21b8152600481018290529091506001600160a01b0383169063344a5e6490602401600060405180830381600087803b1580156103de57600080fd5b505af11580156103f2573d6000803e3d6000fd5b50506040516001600160a01b03851692508391507f64566eaf28160aee8cce7464dbf8eb54939f81ac929a8ebeea66865ff57963c490600090a3919050565b600054610100900460ff16158080156104515750600054600160ff909116105b8061046b5750303b15801561046b575060005460ff166001145b6104ce5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610385565b6000805460ff1916600117905580156104f1576000805461ff0019166101001790555b6000805462010000600160b01b031916620100006001600160a01b038516021790558015610559576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6105593383836107eb565b811580159061057957506001548211155b6105c05760405162461bcd60e51b815260206004820152601860248201527714dd185ad953585b9859d95c8e881253959053125117d25160421b6044820152606401610385565b6000546105de906201000090046001600160a01b031633308461090e565b6105eb600433848461097f565b60006105f6836106ab565b6040516323021ec760e21b8152336004820152602481018490529091506001600160a01b03821690638c087b1c90604401600060405180830381600087803b15801561064157600080fd5b505af1158015610655573d6000803e3d6000fd5b50506040518481523392508591507fc1d3c31619aec7561f6fa519052617aed252a25edaddc5d7428681180516837a90602001610233565b6001600160a01b038116600090815260086020526040812054610250565b6000610250600183610a21565b6001600160a01b038116600090815260076020526040812054610250565b6001600160a01b03821660009081526005602090815260408083208484529091528120545b9392505050565b6000610250600183610a88565b6001600160a01b0383166000908152600185016020908152604080832085845290915281208054839290610744908490610e73565b9091555050600082815260028501602052604081208054839290610769908490610e73565b90915550506001600160a01b038316600090815260038501602052604081208054839290610798908490610e73565b90915550508354819085906000906107b1908490610e73565b90915550506001600160a01b0383166000908152600485016020526040812080548392906107e0908490610e86565b909155505050505050565b6107f760048483610af3565b600054610814906201000090046001600160a01b03168383610b27565b816001600160a01b0316836001600160a01b03167fb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda38360405161023391815260200190565b60006001600160a01b0382166108b15760405162461bcd60e51b815260206004820181905260248201527f4368696c644d616e616765724c69623a20494e56414c49445f414444524553536044820152606401610385565b82600001600081546108c290610e99565b91829055506000818152600185016020908152604080832080546001600160a01b039097166001600160a01b031990971687179055948252600290950190945291909220819055919050565b6040516001600160a01b03808516602483015283166044820152606481018290526109799085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b5c565b50505050565b6001600160a01b03831660009081526001850160209081526040808320858452909152812080548392906109b4908490610e86565b90915550506000828152600285016020526040812080548392906109d9908490610e86565b90915550506001600160a01b038316600090815260038501602052604081208054839290610a08908490610e86565b90915550508354819085906000906107e0908490610e86565b60008181526001830160205260409020546001600160a01b0316806102505760405162461bcd60e51b815260206004820152601b60248201527f4368696c644d616e616765724c69623a20494e56414c49445f494400000000006044820152606401610385565b6001600160a01b0381166000908152600283016020526040812054908190036102505760405162461bcd60e51b815260206004820181905260248201527f4368696c644d616e616765724c69623a20494e56414c49445f4d414e414745526044820152606401610385565b6001600160a01b038216600090815260048401602052604081208054839290610b1d908490610e73565b9091555050505050565b6040516001600160a01b038316602482015260448101829052610b5790849063a9059cbb60e01b90606401610942565b505050565b6000610bb1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c319092919063ffffffff16565b9050805160001480610bd2575080806020019051810190610bd29190610eb2565b610b575760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610385565b6060610c408484600085610c48565b949350505050565b606082471015610ca95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610385565b600080866001600160a01b03168587604051610cc59190610ef8565b60006040518083038185875af1925050503d8060008114610d02576040519150601f19603f3d011682016040523d82523d6000602084013e610d07565b606091505b5091509150610d1887838387610d23565b979650505050505050565b60608315610d92578251600003610d8b576001600160a01b0385163b610d8b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610385565b5081610c40565b610c408383815115610da75781518083602001fd5b8060405162461bcd60e51b81526004016103859190610f14565b80356001600160a01b0381168114610dd857600080fd5b919050565b60008060408385031215610df057600080fd5b610df983610dc1565b946020939093013593505050565b600060208284031215610e1957600080fd5b5035919050565b600060208284031215610e3257600080fd5b6106fb82610dc1565b60008060408385031215610e4e57600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b8181038181111561025057610250610e5d565b8082018082111561025057610250610e5d565b600060018201610eab57610eab610e5d565b5060010190565b600060208284031215610ec457600080fd5b815180151581146106fb57600080fd5b60005b83811015610eef578181015183820152602001610ed7565b50506000910152565b60008251610f0a818460208701610ed4565b9190910192915050565b6020815260008251806020840152610f33816040850160208701610ed4565b601f01601f1916919091016040019291505056fea264697066735822122023b0a75ec2b5e9f66ad966a88679ad7eee0eb952b3bfc7f6dbd5b2adfa2ee0c164736f6c63430008130033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100bf5760003560e01c8063c60662721161007c578063c606627214610140578063c73a7a1f14610153578063d5364bbf14610166578063d7fbee3d14610179578063e3f56eaa146101a4578063ed87169c146101b7578063f90423fe146101ca57600080fd5b80633651bb1d146100c457806339ed8c90146100d95780638028a6db146100ff5780638b0e9f3f14610112578063b64ddbf61461011a578063c4d66de81461012d575b600080fd5b6100d76100d2366004610ddd565b6101dd565b005b6100ec6100e7366004610e07565b610240565b6040519081526020015b60405180910390f35b6100d761010d366004610ddd565b610256565b6004546100ec565b6100ec610128366004610e20565b610323565b6100d761013b366004610e20565b610431565b6100d761014e366004610ddd565b61055d565b6100d7610161366004610e3b565b610568565b6100ec610174366004610e20565b61068d565b61018c610187366004610e07565b6106ab565b6040516001600160a01b0390911681526020016100f6565b6100ec6101b2366004610e20565b6106b8565b6100ec6101c5366004610ddd565b6106d6565b6100ec6101d8366004610e20565b610702565b60006101e833610702565b90506101f7600484838561070f565b826001600160a01b0316817fcbc2141407acdf7a77731afda2c1369f3c46e04194b90a9d527385c17608eb0d8460405161023391815260200190565b60405180910390a3505050565b6000818152600660205260408120545b92915050565b600061026133610702565b9050600061026f84836106d6565b90508083111561027d578092505b61028a600485848461070f565b6102958433856107eb565b836001600160a01b0316827fcbc2141407acdf7a77731afda2c1369f3c46e04194b90a9d527385c17608eb0d836040516102d191815260200190565b60405180910390a3836001600160a01b0316827fff61f9c95b299671af1bb01c9888e344ed74c6fdff2b1c98eeed2be18714aac08560405161031591815260200190565b60405180910390a350505050565b6001600160a01b0381166000908152600360205260408120541561038e5760405162461bcd60e51b815260206004820152601c60248201527f5374616b654d616e616765723a2049445f414c52454144595f5345540000000060448201526064015b60405180910390fd5b610399600183610859565b604051630d12979960e21b8152600481018290529091506001600160a01b0383169063344a5e6490602401600060405180830381600087803b1580156103de57600080fd5b505af11580156103f2573d6000803e3d6000fd5b50506040516001600160a01b03851692508391507f64566eaf28160aee8cce7464dbf8eb54939f81ac929a8ebeea66865ff57963c490600090a3919050565b600054610100900460ff16158080156104515750600054600160ff909116105b8061046b5750303b15801561046b575060005460ff166001145b6104ce5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610385565b6000805460ff1916600117905580156104f1576000805461ff0019166101001790555b6000805462010000600160b01b031916620100006001600160a01b038516021790558015610559576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6105593383836107eb565b811580159061057957506001548211155b6105c05760405162461bcd60e51b815260206004820152601860248201527714dd185ad953585b9859d95c8e881253959053125117d25160421b6044820152606401610385565b6000546105de906201000090046001600160a01b031633308461090e565b6105eb600433848461097f565b60006105f6836106ab565b6040516323021ec760e21b8152336004820152602481018490529091506001600160a01b03821690638c087b1c90604401600060405180830381600087803b15801561064157600080fd5b505af1158015610655573d6000803e3d6000fd5b50506040518481523392508591507fc1d3c31619aec7561f6fa519052617aed252a25edaddc5d7428681180516837a90602001610233565b6001600160a01b038116600090815260086020526040812054610250565b6000610250600183610a21565b6001600160a01b038116600090815260076020526040812054610250565b6001600160a01b03821660009081526005602090815260408083208484529091528120545b9392505050565b6000610250600183610a88565b6001600160a01b0383166000908152600185016020908152604080832085845290915281208054839290610744908490610e73565b9091555050600082815260028501602052604081208054839290610769908490610e73565b90915550506001600160a01b038316600090815260038501602052604081208054839290610798908490610e73565b90915550508354819085906000906107b1908490610e73565b90915550506001600160a01b0383166000908152600485016020526040812080548392906107e0908490610e86565b909155505050505050565b6107f760048483610af3565b600054610814906201000090046001600160a01b03168383610b27565b816001600160a01b0316836001600160a01b03167fb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda38360405161023391815260200190565b60006001600160a01b0382166108b15760405162461bcd60e51b815260206004820181905260248201527f4368696c644d616e616765724c69623a20494e56414c49445f414444524553536044820152606401610385565b82600001600081546108c290610e99565b91829055506000818152600185016020908152604080832080546001600160a01b039097166001600160a01b031990971687179055948252600290950190945291909220819055919050565b6040516001600160a01b03808516602483015283166044820152606481018290526109799085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b5c565b50505050565b6001600160a01b03831660009081526001850160209081526040808320858452909152812080548392906109b4908490610e86565b90915550506000828152600285016020526040812080548392906109d9908490610e86565b90915550506001600160a01b038316600090815260038501602052604081208054839290610a08908490610e86565b90915550508354819085906000906107e0908490610e86565b60008181526001830160205260409020546001600160a01b0316806102505760405162461bcd60e51b815260206004820152601b60248201527f4368696c644d616e616765724c69623a20494e56414c49445f494400000000006044820152606401610385565b6001600160a01b0381166000908152600283016020526040812054908190036102505760405162461bcd60e51b815260206004820181905260248201527f4368696c644d616e616765724c69623a20494e56414c49445f4d414e414745526044820152606401610385565b6001600160a01b038216600090815260048401602052604081208054839290610b1d908490610e73565b9091555050505050565b6040516001600160a01b038316602482015260448101829052610b5790849063a9059cbb60e01b90606401610942565b505050565b6000610bb1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c319092919063ffffffff16565b9050805160001480610bd2575080806020019051810190610bd29190610eb2565b610b575760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610385565b6060610c408484600085610c48565b949350505050565b606082471015610ca95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610385565b600080866001600160a01b03168587604051610cc59190610ef8565b60006040518083038185875af1925050503d8060008114610d02576040519150601f19603f3d011682016040523d82523d6000602084013e610d07565b606091505b5091509150610d1887838387610d23565b979650505050505050565b60608315610d92578251600003610d8b576001600160a01b0385163b610d8b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610385565b5081610c40565b610c408383815115610da75781518083602001fd5b8060405162461bcd60e51b81526004016103859190610f14565b80356001600160a01b0381168114610dd857600080fd5b919050565b60008060408385031215610df057600080fd5b610df983610dc1565b946020939093013593505050565b600060208284031215610e1957600080fd5b5035919050565b600060208284031215610e3257600080fd5b6106fb82610dc1565b60008060408385031215610e4e57600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b8181038181111561025057610250610e5d565b8082018082111561025057610250610e5d565b600060018201610eab57610eab610e5d565b5060010190565b600060208284031215610ec457600080fd5b815180151581146106fb57600080fd5b60005b83811015610eef578181015183820152602001610ed7565b50506000910152565b60008251610f0a818460208701610ed4565b9190910192915050565b6020815260008251806020840152610f33816040850160208701610ed4565b601f01601f1916919091016040019291505056fea264697066735822122023b0a75ec2b5e9f66ad966a88679ad7eee0eb952b3bfc7f6dbd5b2adfa2ee0c164736f6c63430008130033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.