Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x6101c060 | 19451970 | 710 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PushSplit
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 5000000 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
import { SplitV2Lib } from "../../libraries/SplitV2.sol";
import { SplitWalletV2 } from "../SplitWalletV2.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeTransferLib } from "solady/utils/SafeTransferLib.sol";
/**
* @title Push Split Wallet
* @author Splits
* @notice The implementation logic for a splitter that distributes directly to the recipients.
* @dev `SplitProxy` handles `receive()` itself to avoid the gas cost with `DELEGATECALL`.
*/
contract PushSplit is SplitWalletV2 {
using SplitV2Lib for SplitV2Lib.Split;
using SafeERC20 for IERC20;
using SafeTransferLib for address;
/* -------------------------------------------------------------------------- */
/* CONSTRUCTOR & INITIALIZER */
/* -------------------------------------------------------------------------- */
constructor(address _splitWarehouse) SplitWalletV2(_splitWarehouse) { }
/* -------------------------------------------------------------------------- */
/* PUBLIC/EXTERNAL FUNCTIONS */
/* -------------------------------------------------------------------------- */
/**
* @notice Distributes the tokens in the split & Warehouse to the recipients.
* @dev The split must be initialized and the hash of _split must match splitHash.
* @param _split The split struct containing the split data that gets distributed.
* @param _token The token to distribute.
* @param _distributor The distributor of the split.
*/
function distribute(
SplitV2Lib.Split calldata _split,
address _token,
address _distributor
)
external
override
pausable
{
if (splitHash != _split.getHash()) revert InvalidSplit();
(uint256 splitBalance, uint256 warehouseBalance) = getSplitBalance(_token);
if (warehouseBalance > 1) withdrawFromWarehouse(_token);
// @solidity memory-safe-assembly
assembly {
// splitBalance -= uint(splitBalance > 0);
splitBalance := sub(splitBalance, iszero(iszero(splitBalance)))
// warehouseBalance -= uint(warehouseBalance > 0);
warehouseBalance := sub(warehouseBalance, iszero(iszero(warehouseBalance)))
}
_distribute({
_split: _split,
_token: _token,
_amount: warehouseBalance + splitBalance,
_distributor: _distributor
});
}
/**
* @notice Distributes a specific amount of tokens in the split & Warehouse to the recipients.
* @dev The split must be initialized and the hash of _split must match splitHash.
* @dev Will revert if the amount of tokens to transfer or distribute doesn't exist.
* @param _split The split struct containing the split data that gets distributed.
* @param _token The token to distribute.
* @param _distributeAmount The amount of tokens to distribute.
* @param _performWarehouseTransfer if true, withdraws all but 1 amount of tokens from the warehouse.
* @param _distributor The distributor of the split.
*/
function distribute(
SplitV2Lib.Split calldata _split,
address _token,
uint256 _distributeAmount,
bool _performWarehouseTransfer,
address _distributor
)
external
override
pausable
{
if (splitHash != _split.getHash()) revert InvalidSplit();
if (_performWarehouseTransfer) withdrawFromWarehouse(_token);
_distribute({ _split: _split, _token: _token, _amount: _distributeAmount, _distributor: _distributor });
}
/**
* @notice Withdraws tokens from the warehouse to the split wallet.
* @param _token The token to withdraw.
*/
function withdrawFromWarehouse(address _token) public {
SPLITS_WAREHOUSE.withdraw(address(this), _token);
}
/* -------------------------------------------------------------------------- */
/* INTERNAL/PRIVATE */
/* -------------------------------------------------------------------------- */
/// @dev Assumes the amount is already present in the split wallet.
function _distribute(
SplitV2Lib.Split calldata _split,
address _token,
uint256 _amount,
address _distributor
)
internal
{
uint256 allocatedAmount;
uint256 numOfRecipients = _split.recipients.length;
uint256 distributorReward = _split.calculateDistributorReward(_amount);
uint256 amountToDistribute = _amount - distributorReward;
if (_token == NATIVE_TOKEN) {
for (uint256 i; i < numOfRecipients; ++i) {
allocatedAmount = _split.calculateAllocatedAmount(amountToDistribute, i);
if (!_split.recipients[i].trySafeTransferETH(allocatedAmount, SafeTransferLib.GAS_STIPEND_NO_GRIEF)) {
SPLITS_WAREHOUSE.deposit{ value: allocatedAmount }(_split.recipients[i], _token, allocatedAmount);
}
}
if (distributorReward > 0) _distributor.safeTransferETH(distributorReward);
} else {
for (uint256 i; i < numOfRecipients; ++i) {
allocatedAmount = _split.calculateAllocatedAmount(amountToDistribute, i);
IERC20(_token).safeTransfer(_split.recipients[i], allocatedAmount);
}
if (distributorReward > 0) IERC20(_token).safeTransfer(_distributor, distributorReward);
}
emit SplitDistributed({ token: _token, distributor: _distributor, amount: _amount });
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
library SplitV2Lib {
/* -------------------------------------------------------------------------- */
/* ERRORS */
/* -------------------------------------------------------------------------- */
error InvalidSplit_TotalAllocationMismatch();
error InvalidSplit_LengthMismatch();
/* -------------------------------------------------------------------------- */
/* STRUCTS */
/* -------------------------------------------------------------------------- */
/**
* @notice Split struct
* @dev This struct is used to store the split information.
* @dev There are no hard caps on the number of recipients/totalAllocation/allocation unit. Thus the chain and its
* gas limits will dictate these hard caps. Please double check if the split you are creating can be distributed on
* the chain.
* @param recipients The recipients of the split.
* @param allocations The allocations of the split.
* @param totalAllocation The total allocation of the split.
* @param distributionIncentive The incentive for distribution. Limits max incentive to 6.5%.
*/
struct Split {
address[] recipients;
uint256[] allocations;
uint256 totalAllocation;
uint16 distributionIncentive;
}
/* -------------------------------------------------------------------------- */
/* CONSTANTS */
/* -------------------------------------------------------------------------- */
uint256 internal constant PERCENTAGE_SCALE = 1e6;
/* -------------------------------------------------------------------------- */
/* FUNCTIONS */
/* -------------------------------------------------------------------------- */
function getHash(Split calldata _split) internal pure returns (bytes32) {
return keccak256(abi.encode(_split));
}
function getHashMem(Split memory _split) internal pure returns (bytes32) {
return keccak256(abi.encode(_split));
}
function validate(Split calldata _split) internal pure {
uint256 numOfRecipients = _split.recipients.length;
if (_split.allocations.length != numOfRecipients) {
revert InvalidSplit_LengthMismatch();
}
uint256 totalAllocation;
for (uint256 i; i < numOfRecipients; ++i) {
totalAllocation += _split.allocations[i];
}
if (totalAllocation != _split.totalAllocation) revert InvalidSplit_TotalAllocationMismatch();
}
function getDistributions(
Split calldata _split,
uint256 _amount
)
internal
pure
returns (uint256[] memory amounts, uint256 distributorReward)
{
uint256 numOfRecipients = _split.recipients.length;
amounts = new uint256[](numOfRecipients);
distributorReward = calculateDistributorReward(_split, _amount);
_amount -= distributorReward;
for (uint256 i; i < numOfRecipients; ++i) {
amounts[i] = calculateAllocatedAmount(_split, _amount, i);
}
}
function calculateAllocatedAmount(
Split calldata _split,
uint256 _amount,
uint256 _index
)
internal
pure
returns (uint256 allocatedAmount)
{
allocatedAmount = _amount * _split.allocations[_index] / _split.totalAllocation;
}
function calculateDistributorReward(
Split calldata _split,
uint256 _amount
)
internal
pure
returns (uint256 distributorReward)
{
distributorReward = _amount * _split.distributionIncentive / PERCENTAGE_SCALE;
}
// only used in tests
function getDistributionsMem(
Split memory _split,
uint256 _amount
)
internal
pure
returns (uint256[] memory amounts, uint256 distributorReward)
{
uint256 numOfRecipients = _split.recipients.length;
amounts = new uint256[](numOfRecipients);
distributorReward = _amount * _split.distributionIncentive / PERCENTAGE_SCALE;
_amount -= distributorReward;
for (uint256 i; i < numOfRecipients; ++i) {
amounts[i] = _amount * _split.allocations[i] / _split.totalAllocation;
}
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
import { ISplitsWarehouse } from "../interfaces/ISplitsWarehouse.sol";
import { Cast } from "../libraries/Cast.sol";
import { SplitV2Lib } from "../libraries/SplitV2.sol";
import { ERC1271 } from "../utils/ERC1271.sol";
import { Wallet } from "../utils/Wallet.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Split Wallet V2
* @author Splits
* @notice Base splitter contract.
* @dev `SplitProxy` handles `receive()` itself to avoid the gas cost with `DELEGATECALL`.
*/
abstract contract SplitWalletV2 is Wallet, ERC1271 {
using SplitV2Lib for SplitV2Lib.Split;
using Cast for address;
/* -------------------------------------------------------------------------- */
/* ERRORS */
/* -------------------------------------------------------------------------- */
error UnauthorizedInitializer();
error InvalidSplit();
/* -------------------------------------------------------------------------- */
/* EVENTS */
/* -------------------------------------------------------------------------- */
event SplitUpdated(SplitV2Lib.Split _split);
event SplitDistributed(address indexed token, address indexed distributor, uint256 amount);
/* -------------------------------------------------------------------------- */
/* CONSTANTS/IMMUTABLES */
/* -------------------------------------------------------------------------- */
/// @notice address of Splits Warehouse
ISplitsWarehouse public immutable SPLITS_WAREHOUSE;
/// @notice address of Split Wallet V2 factory
address public immutable FACTORY;
/// @notice address of native token
address public immutable NATIVE_TOKEN;
/* -------------------------------------------------------------------------- */
/* STORAGE */
/* -------------------------------------------------------------------------- */
/// @notice the split hash - Keccak256 hash of the split struct
bytes32 public splitHash;
/* -------------------------------------------------------------------------- */
/* CONSTRUCTOR & INITIALIZER */
/* -------------------------------------------------------------------------- */
constructor(address _splitWarehouse) ERC1271("splitWallet", "2") {
SPLITS_WAREHOUSE = ISplitsWarehouse(_splitWarehouse);
NATIVE_TOKEN = SPLITS_WAREHOUSE.NATIVE_TOKEN();
FACTORY = msg.sender;
}
/**
* @notice Initializes the split wallet with a split and its corresponding data.
* @dev Only the factory can call this function.
* @param _split The split struct containing the split data that gets initialized.
*/
function initialize(SplitV2Lib.Split calldata _split, address _owner) external {
if (msg.sender != FACTORY) revert UnauthorizedInitializer();
_split.validate();
splitHash = _split.getHash();
Wallet.__initWallet(_owner);
}
/* -------------------------------------------------------------------------- */
/* PUBLIC/EXTERNAL FUNCTIONS */
/* -------------------------------------------------------------------------- */
function distribute(SplitV2Lib.Split calldata _split, address _token, address _distributor) external virtual;
function distribute(
SplitV2Lib.Split calldata _split,
address _token,
uint256 _distributeAmount,
bool _performWarehouseTransfer,
address _distributor
)
external
virtual;
/**
* @notice Gets the total token balance of the split wallet and the warehouse.
* @param _token The token to get the balance of.
* @return splitBalance The token balance in the split wallet.
* @return warehouseBalance The token balance in the warehouse of the split wallet.
*/
function getSplitBalance(address _token) public view returns (uint256 splitBalance, uint256 warehouseBalance) {
splitBalance = (_token == NATIVE_TOKEN) ? address(this).balance : IERC20(_token).balanceOf(address(this));
warehouseBalance = SPLITS_WAREHOUSE.balanceOf(address(this), _token.toUint256());
}
/**
* @notice Updates the split.
* @dev Only the owner can call this function.
* @param _split The new split struct.
*/
function updateSplit(SplitV2Lib.Split calldata _split) external onlyOwner {
// throws error if invalid
_split.validate();
splitHash = _split.getHash();
emit SplitUpdated(_split);
}
/* -------------------------------------------------------------------------- */
/* INTERNAL FUNCTIONS */
/* -------------------------------------------------------------------------- */
function getSigner() internal view override returns (address) {
return owner;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
///
/// @dev Note:
/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
/// - For ERC20s, this implementation won't check that a token has code,
/// responsibility is delegated to the caller.
library SafeTransferLib {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ETH transfer has failed.
error ETHTransferFailed();
/// @dev The ERC20 `transferFrom` has failed.
error TransferFromFailed();
/// @dev The ERC20 `transfer` has failed.
error TransferFailed();
/// @dev The ERC20 `approve` has failed.
error ApproveFailed();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;
/// @dev Suggested gas stipend for contract receiving ETH to perform a few
/// storage reads and writes, but low enough to prevent griefing.
uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ETH OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
//
// The regular variants:
// - Forwards all remaining gas to the target.
// - Reverts if the target reverts.
// - Reverts if the current contract has insufficient balance.
//
// The force variants:
// - Forwards with an optional gas stipend
// (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
// - If the target reverts, or if the gas stipend is exhausted,
// creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
// Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
// - Reverts if the current contract has insufficient balance.
//
// The try variants:
// - Forwards with a mandatory gas stipend.
// - Instead of reverting, returns whether the transfer succeeded.
/// @dev Sends `amount` (in wei) ETH to `to`.
function safeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Sends all the ETH in the current contract to `to`.
function safeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// Transfer all the ETH and check if it succeeded or not.
if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// forgefmt: disable-next-item
if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
}
}
/// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
function trySafeTransferAllETH(address to, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ERC20 OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for
/// the current contract to manage.
function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends all of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have their entire balance approved for
/// the current contract to manage.
function safeTransferAllFrom(address token, address from, address to)
internal
returns (uint256 amount)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransfer(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sends all of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransferAll(address token, address to) internal returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
mstore(0x20, address()) // Store the address of the current contract.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x14, to) // Store the `to` argument.
amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// Reverts upon failure.
function safeApprove(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
// Perform the approval, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
/// then retries the approval again (some tokens, e.g. USDT, requires this).
/// Reverts upon failure.
function safeApproveWithRetry(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
// Perform the approval, retrying upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x34, 0) // Store 0 for the `amount`.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
mstore(0x34, amount) // Store back the original `amount`.
// Retry the approval, reverting upon failure.
if iszero(
and(
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Returns the amount of ERC20 `token` owned by `account`.
/// Returns zero if the `token` does not exist.
function balanceOf(address token, address account) internal view returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, account) // Store the `account` argument.
mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
amount :=
mul(
mload(0x20),
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
)
)
}
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
import { IERC6909 } from "./IERC6909.sol";
interface ISplitsWarehouse is IERC6909 {
function NATIVE_TOKEN() external view returns (address);
function deposit(address receiver, address token, uint256 amount) external payable;
function batchDeposit(address[] calldata receivers, address token, uint256[] calldata amounts) external;
function batchTransfer(address[] calldata receivers, address token, uint256[] calldata amounts) external;
function withdraw(address owner, address token) external;
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
library Cast {
error Overflow();
function toAddress(uint256 _value) internal pure returns (address) {
return address(toUint160(_value));
}
function toUint256(address _value) internal pure returns (uint256) {
return uint256(uint160(_value));
}
function toUint160(uint256 _x) internal pure returns (uint160 y) {
if (_x >> 160 != 0) revert Overflow();
// solhint-disable-next-line no-inline-assembly
assembly {
y := _x
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
/**
* @notice ERC-1271 with guards for same signer being used on multiple splits
* @author Splits
* Based on coinbase (https://github.com/coinbase/smart-wallet/blob/main/src/ERC1271.sol)
*/
abstract contract ERC1271 is EIP712 {
/* -------------------------------------------------------------------------- */
/* CONSTANTS */
/* -------------------------------------------------------------------------- */
/**
* @dev We use `bytes32 hash` rather than `bytes message`
* In the EIP-712 context, `bytes message` would be useful for showing users a full message
* they are signing in some wallet preview. But in this case, to prevent replay
* across accounts, we are always dealing with nested messages, and so the
* input should be a EIP-191 or EIP-712 output hash.
* E.g. The input hash would be result of
*
* keccak256("\x19\x01" || someDomainSeparator || hashStruct(someStruct))
*
* OR
*
* keccak256("\x19Ethereum Signed Message:\n" || len(someMessage) || someMessage),
*/
bytes32 private constant _MESSAGE_TYPEHASH = keccak256("SplitWalletMessage(bytes32 hash)");
/* -------------------------------------------------------------------------- */
/* CONSTRUCTOR */
/* -------------------------------------------------------------------------- */
/**
* @dev Initializes the {EIP712} domain separator.
*/
constructor(string memory _name, string memory _version) EIP712(_name, _version) { }
/* -------------------------------------------------------------------------- */
/* PUBLIC FUNCTIONS */
/* -------------------------------------------------------------------------- */
/**
* @notice Validates the signature with ERC1271 return, so that this account can also be used as a signer.
*/
function isValidSignature(bytes32 hash, bytes calldata signature) public view virtual returns (bytes4 result) {
if (
SignatureChecker.isValidSignatureNow({
signer: getSigner(),
hash: replaySafeHash(hash),
signature: signature
})
) {
// bytes4(keccak256("isValidSignature(bytes32,bytes)"))
return 0x1626ba7e;
}
return 0xffffffff;
}
/**
* @dev Returns an EIP-712-compliant hash of `hash`,
* where the domainSeparator includes address(this) and block.chainId
* to protect against the same signature being used for many accounts.
* @return
* keccak256(\x19\x01 || this.domainSeparator ||
* hashStruct(SplitWalletMessage({
* hash: `hash`
* }))
* )
*/
function replaySafeHash(bytes32 hash) public view virtual returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(_MESSAGE_TYPEHASH, hash)));
}
/// @dev returns the ERC1271 signer.
function getSigner() internal view virtual returns (address);
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
import { Pausable } from "./Pausable.sol";
import { ERC1155Holder } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import { ERC721Holder } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
/**
* @title Wallet Implementation
* @author Splits
* @notice Minimal smart wallet clone-implementation.
*/
abstract contract Wallet is Pausable, ERC721Holder, ERC1155Holder {
/* -------------------------------------------------------------------------- */
/* ERRORS */
/* -------------------------------------------------------------------------- */
error InvalidCalldataForEOA(Call call);
/* -------------------------------------------------------------------------- */
/* STRUCTS */
/* -------------------------------------------------------------------------- */
struct Call {
address to;
uint256 value;
bytes data;
}
/* -------------------------------------------------------------------------- */
/* EVENTS */
/* -------------------------------------------------------------------------- */
event ExecCalls(Call[] calls);
/* -------------------------------------------------------------------------- */
/* CONSTRUCTOR & INITIALIZER */
/* -------------------------------------------------------------------------- */
function __initWallet(address _owner) internal {
__initPausable(_owner, false);
}
/* -------------------------------------------------------------------------- */
/* FUNCTONS */
/* -------------------------------------------------------------------------- */
/**
* @notice Execute a batch of calls.
* @dev The calls are executed in order, reverting if any of them fails. Can
* only be called by the owner.
* @param _calls The calls to execute
*/
function execCalls(Call[] calldata _calls)
external
payable
returns (uint256 blockNumber, bytes[] memory returnData)
{
address caller = msg.sender;
blockNumber = block.number;
uint256 length = _calls.length;
returnData = new bytes[](length);
bool success;
for (uint256 i; i < length; ++i) {
// prevent user from executing calls after transferring ownership.
if (caller != owner) revert Unauthorized();
Call calldata calli = _calls[i];
if (calli.to.code.length == 0) {
// When the call is to an EOA, the calldata must be empty.
if (calli.data.length > 0) revert InvalidCalldataForEOA({ call: calli });
}
(success, returnData[i]) = calli.to.call{ value: calli.value }(calli.data);
// solhint-disable-next-line
require(success, string(returnData[i]));
}
emit ExecCalls({ calls: _calls });
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated 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: GPL-3.0-or-later
pragma solidity ^0.8.23;
import { IERC165 } from "./IERC165.sol";
/// @title ERC6909 Core Interface
/// @author jtriley.eth
interface IERC6909 is IERC165 {
/// @notice The event emitted when a transfer occurs.
/// @param caller The caller of the transfer.
/// @param sender The address of the sender.
/// @param receiver The address of the receiver.
/// @param id The id of the token.
/// @param amount The amount of the token.
event Transfer(
address caller, address indexed sender, address indexed receiver, uint256 indexed id, uint256 amount
);
/// @notice The event emitted when an operator is set.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param approved The approval status.
event OperatorSet(address indexed owner, address indexed spender, bool approved);
/// @notice The event emitted when an approval occurs.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param id The id of the token.
/// @param amount The amount of the token.
event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount);
/// @notice Owner balance of an id.
/// @param owner The address of the owner.
/// @param id The id of the token.
/// @return amount The balance of the token.
function balanceOf(address owner, uint256 id) external view returns (uint256 amount);
/// @notice Spender allowance of an id.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param id The id of the token.
/// @return amount The allowance of the token.
function allowance(address owner, address spender, uint256 id) external view returns (uint256 amount);
/// @notice Checks if a spender is approved by an owner as an operator
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @return approved The approval status.
function isOperator(address owner, address spender) external view returns (bool approved);
/// @notice Transfers an amount of an id from the caller to a receiver.
/// @param receiver The address of the receiver.
/// @param id The id of the token.
/// @param amount The amount of the token.
function transfer(address receiver, uint256 id, uint256 amount) external returns (bool);
/// @notice Transfers an amount of an id from a sender to a receiver.
/// @param sender The address of the sender.
/// @param receiver The address of the receiver.
/// @param id The id of the token.
/// @param amount The amount of the token.
function transferFrom(address sender, address receiver, uint256 id, uint256 amount) external returns (bool);
/// @notice Approves an amount of an id to a spender.
/// @param spender The address of the spender.
/// @param id The id of the token.
/// @param amount The amount of the token.
function approve(address spender, uint256 id, uint256 amount) external returns (bool);
/// @notice Sets or removes a spender as an operator for the caller.
/// @param spender The address of the spender.
/// @param approved The approval status.
function setOperator(address spender, bool approved) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.8;
import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
* separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
*
* _Available since v3.4._
*
* @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
*/
abstract contract EIP712 is IERC5267 {
using ShortStrings for *;
bytes32 private constant _TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _cachedDomainSeparator;
uint256 private immutable _cachedChainId;
address private immutable _cachedThis;
bytes32 private immutable _hashedName;
bytes32 private immutable _hashedVersion;
ShortString private immutable _name;
ShortString private immutable _version;
string private _nameFallback;
string private _versionFallback;
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
_name = name.toShortStringWithFallback(_nameFallback);
_version = version.toShortStringWithFallback(_versionFallback);
_hashedName = keccak256(bytes(name));
_hashedVersion = keccak256(bytes(version));
_cachedChainId = block.chainid;
_cachedDomainSeparator = _buildDomainSeparator();
_cachedThis = address(this);
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
} else {
return _buildDomainSeparator();
}
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
/**
* @dev See {EIP-5267}.
*
* _Available since v4.9._
*/
function eip712Domain()
public
view
virtual
override
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
{
return (
hex"0f", // 01111
_name.toStringWithFallback(_nameFallback),
_version.toStringWithFallback(_versionFallback),
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)
pragma solidity ^0.8.0;
import "./ECDSA.sol";
import "../../interfaces/IERC1271.sol";
/**
* @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
* signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
* Argent and Gnosis Safe.
*
* _Available since v4.1._
*/
library SignatureChecker {
/**
* @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
* signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
(address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
return
(error == ECDSA.RecoverError.NoError && recovered == signer) ||
isValidERC1271SignatureNow(signer, hash, signature);
}
/**
* @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
* against the signer smart contract using ERC1271.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidERC1271SignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(bool success, bytes memory result) = signer.staticcall(
abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
);
return (success &&
result.length >= 32 &&
abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
import { Ownable } from "./Ownable.sol";
/**
* @title Pausable Implementation
* @author Splits
* @notice Pausable clone-implementation
*/
abstract contract Pausable is Ownable {
/* -------------------------------------------------------------------------- */
/* ERRORS */
/* -------------------------------------------------------------------------- */
error Paused();
/* -------------------------------------------------------------------------- */
/* EVENTS */
/* -------------------------------------------------------------------------- */
event SetPaused(bool paused);
/* -------------------------------------------------------------------------- */
/* STORAGE */
/* -------------------------------------------------------------------------- */
bool public paused;
/* -------------------------------------------------------------------------- */
/* CONSTRUCTOR & INITIALIZER */
/* -------------------------------------------------------------------------- */
function __initPausable(address _owner, bool _paused) internal virtual {
__initOwnable(_owner);
paused = _paused;
}
/* -------------------------------------------------------------------------- */
/* MODIFIERS */
/* -------------------------------------------------------------------------- */
modifier pausable() virtual {
address owner_ = owner;
if (paused) {
// solhint-disable-next-line avoid-tx-origin
if (msg.sender != owner_ && tx.origin != owner_ && msg.sender != address(this)) {
revert Paused();
}
}
_;
}
/* -------------------------------------------------------------------------- */
/* PUBLIC/EXTERNAL FUNCTIONS */
/* -------------------------------------------------------------------------- */
function setPaused(bool _paused) public virtual onlyOwner {
paused = _paused;
emit SetPaused({ paused: _paused });
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)
pragma solidity ^0.8.0;
import "./ERC1155Receiver.sol";
/**
* Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
*
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
* stuck.
*
* @dev _Available since v3.1._
*/
contract ERC1155Holder is ERC1155Receiver {
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.0;
import "../IERC721Receiver.sol";
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
*/
contract ERC721Holder is IERC721Receiver {
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
interface IERC165 {
/// @notice Checks if a contract implements an interface.
/// @param interfaceId The interface identifier, as specified in ERC-165.
/// @return supported True if the contract implements `interfaceId` and
/// `interfaceId` is not 0xffffffff, false otherwise.
function supportsInterface(bytes4 interfaceId) external view returns (bool supported);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)
pragma solidity ^0.8.8;
import "./StorageSlot.sol";
// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
// | length | 0x BB |
type ShortString is bytes32;
/**
* @dev This library provides functions to convert short memory strings
* into a `ShortString` type that can be used as an immutable variable.
*
* Strings of arbitrary length can be optimized using this library if
* they are short enough (up to 31 bytes) by packing them with their
* length (1 byte) in a single EVM word (32 bytes). Additionally, a
* fallback mechanism can be used for every other case.
*
* Usage example:
*
* ```solidity
* contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns (string memory) {
* return _name.toStringWithFallback(_nameFallback);
* }
* }
* ```
*/
library ShortStrings {
// Used as an identifier for strings longer than 31 bytes.
bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;
error StringTooLong(string str);
error InvalidShortString();
/**
* @dev Encode a string of at most 31 chars into a `ShortString`.
*
* This will trigger a `StringTooLong` error is the input string is too long.
*/
function toShortString(string memory str) internal pure returns (ShortString) {
bytes memory bstr = bytes(str);
if (bstr.length > 31) {
revert StringTooLong(str);
}
return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
}
/**
* @dev Decode a `ShortString` back to a "normal" string.
*/
function toString(ShortString sstr) internal pure returns (string memory) {
uint256 len = byteLength(sstr);
// using `new string(len)` would work locally but is not memory safe.
string memory str = new string(32);
/// @solidity memory-safe-assembly
assembly {
mstore(str, len)
mstore(add(str, 0x20), sstr)
}
return str;
}
/**
* @dev Return the length of a `ShortString`.
*/
function byteLength(ShortString sstr) internal pure returns (uint256) {
uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
if (result > 31) {
revert InvalidShortString();
}
return result;
}
/**
* @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
*/
function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
if (bytes(value).length < 32) {
return toShortString(value);
} else {
StorageSlot.getStringSlot(store).value = value;
return ShortString.wrap(_FALLBACK_SENTINEL);
}
}
/**
* @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
*/
function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
return toString(value);
} else {
return store;
}
}
/**
* @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
*
* WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
* actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
*/
function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
return byteLength(value);
} else {
return bytes(store).length;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)
pragma solidity ^0.8.0;
interface IERC5267 {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*
* _Available since v4.1._
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.23;
/// @title Ownable Implementation
/// @author Splits
/// @notice Ownable clone-implementation
abstract contract Ownable {
/* -------------------------------------------------------------------------- */
/* ERRORS */
/* -------------------------------------------------------------------------- */
error Unauthorized();
/* -------------------------------------------------------------------------- */
/* EVENTS */
/* -------------------------------------------------------------------------- */
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
/* -------------------------------------------------------------------------- */
/* STORAGE */
/* -------------------------------------------------------------------------- */
address public owner;
/* -------------------------------------------------------------------------- */
/* CONSTRUCTOR & INITIALIZER */
/* -------------------------------------------------------------------------- */
function __initOwnable(address _owner) internal virtual {
emit OwnershipTransferred({ oldOwner: address(0), newOwner: _owner });
owner = _owner;
}
/* -------------------------------------------------------------------------- */
/* MODIFIERS */
/* -------------------------------------------------------------------------- */
modifier onlyOwner() virtual {
if (msg.sender != owner && msg.sender != address(this)) revert Unauthorized();
_;
}
/* -------------------------------------------------------------------------- */
/* FUNCTIONS */
/* -------------------------------------------------------------------------- */
function transferOwnership(address _owner) public virtual onlyOwner {
emit OwnershipTransferred({ oldOwner: owner, newOwner: _owner });
owner = _owner;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";
/**
* @dev _Available since v3.1._
*/
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"@prb/test/=node_modules/@prb/test/src/",
"forge-std/=node_modules/forge-std/src/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"solady/=node_modules/solady/src/",
"multicaller/=node_modules/multicaller/"
],
"optimizer": {
"enabled": true,
"runs": 5000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "shanghai",
"viaIR": true,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_splitWarehouse","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Wallet.Call","name":"call","type":"tuple"}],"name":"InvalidCalldataForEOA","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"InvalidSplit","type":"error"},{"inputs":[],"name":"InvalidSplit_LengthMismatch","type":"error"},{"inputs":[],"name":"InvalidSplit_TotalAllocationMismatch","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnauthorizedInitializer","type":"error"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct Wallet.Call[]","name":"calls","type":"tuple[]"}],"name":"ExecCalls","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"SetPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"distributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SplitDistributed","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"allocations","type":"uint256[]"},{"internalType":"uint256","name":"totalAllocation","type":"uint256"},{"internalType":"uint16","name":"distributionIncentive","type":"uint16"}],"indexed":false,"internalType":"struct SplitV2Lib.Split","name":"_split","type":"tuple"}],"name":"SplitUpdated","type":"event"},{"inputs":[],"name":"FACTORY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SPLITS_WAREHOUSE","outputs":[{"internalType":"contract ISplitsWarehouse","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"allocations","type":"uint256[]"},{"internalType":"uint256","name":"totalAllocation","type":"uint256"},{"internalType":"uint16","name":"distributionIncentive","type":"uint16"}],"internalType":"struct SplitV2Lib.Split","name":"_split","type":"tuple"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_distributor","type":"address"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"allocations","type":"uint256[]"},{"internalType":"uint256","name":"totalAllocation","type":"uint256"},{"internalType":"uint16","name":"distributionIncentive","type":"uint16"}],"internalType":"struct SplitV2Lib.Split","name":"_split","type":"tuple"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_distributeAmount","type":"uint256"},{"internalType":"bool","name":"_performWarehouseTransfer","type":"bool"},{"internalType":"address","name":"_distributor","type":"address"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Wallet.Call[]","name":"_calls","type":"tuple[]"}],"name":"execCalls","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getSplitBalance","outputs":[{"internalType":"uint256","name":"splitBalance","type":"uint256"},{"internalType":"uint256","name":"warehouseBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"allocations","type":"uint256[]"},{"internalType":"uint256","name":"totalAllocation","type":"uint256"},{"internalType":"uint16","name":"distributionIncentive","type":"uint16"}],"internalType":"struct SplitV2Lib.Split","name":"_split","type":"tuple"},{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"result","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"replaySafeHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"splitHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"allocations","type":"uint256[]"},{"internalType":"uint256","name":"totalAllocation","type":"uint256"},{"internalType":"uint16","name":"distributionIncentive","type":"uint16"}],"internalType":"struct SplitV2Lib.Split","name":"_split","type":"tuple"}],"name":"updateSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"withdrawFromWarehouse","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6101c0604090808252346200024357620000339062002df6803803809162000028828562000263565b833981019062000287565b908051620000418162000247565b600b8152602091828201926a1cdc1b1a5d15d85b1b195d60aa1b84528151926200006b8462000247565b60018452818401601960f91b81526200008482620002a8565b95610120968752620000968662000471565b92610140938452519020948560e05251902093610100968588524660a052845195848701927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f84528688015260608701524660808701523060a087015260a0865260c086019186831060018060401b038411176200022f57828652865190206080523060c0526001600160a01b0316610160818152630c7df65960e21b835293908190839060049082905afa95861562000225575f96620001e9575b5050506101a09384526101809233845251946127d796876200061f88396080518761255b015260a05187612627015260c0518761252c015260e051876125aa015251866125d001525185610adb01525184610b0501525183818161066e01528181611716015281816119c70152611f4c0152518281816109540152610d4e015251818181610ce00152818161193c0152611e7b0152f35b620002129396509060c091813d106200021c575b62000209828562000263565b01019062000287565b925f808062000152565b3d9150620001fd565b85513d5f823e3d90fd5b634e487b7160e01b5f52604160045260245ffd5b5f80fd5b604081019081106001600160401b038211176200022f57604052565b601f909101601f19168101906001600160401b038211908210176200022f57604052565b908160209103126200024357516001600160a01b0381168103620002435790565b805160209081811015620003425750601f825111620002e35780825192015190808310620002d557501790565b825f19910360031b1b161790565b90604051809263305a27a960e01b82528060048301528251908160248401525f935b82851062000328575050604492505f838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935062000305565b9192916001600160401b0381116200022f5760019182548381811c9116801562000466575b828210146200045257601f81116200041c575b5080601f8311600114620003b85750819293945f92620003ac575b50505f19600383901b1c191690821b17905560ff90565b015190505f8062000395565b90601f19831695845f52825f20925f905b888210620004045750508385969710620003eb575b505050811b01905560ff90565b01515f1960f88460031b161c191690555f8080620003de565b808785968294968601518155019501930190620003c9565b835f5283601f835f20920160051c820191601f850160051c015b828110620004465750506200037a565b5f815501849062000436565b634e487b7160e01b5f52602260045260245ffd5b90607f169062000367565b805160209081811015620004fd5750601f8251116200049e5780825192015190808310620002d557501790565b90604051809263305a27a960e01b82528060048301528251908160248401525f935b828510620004e3575050604492505f838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350620004c0565b906001600160401b0382116200022f57600254926001938481811c9116801562000613575b838210146200045257601f8111620005dc575b5081601f84116001146200057457509282939183925f9462000568575b50501b915f199060031b1c19161760025560ff90565b015192505f8062000552565b919083601f19811660025f52845f20945f905b88838310620005c15750505010620005a8575b505050811b0160025560ff90565b01515f1960f88460031b161c191690555f80806200059a565b85870151885590960195948501948793509081019062000587565b60025f5284601f845f20920160051c820191601f860160051c015b8281106200060757505062000535565b5f8155018590620005f7565b90607f16906200052256fe6080604081815260049182361015610015575f80fd5b5f3560e01c90816301ffc9a71461123157508063150b7a02146111a75780631626ba7e1461110757806316c38b3c14611004578063254689f514610fc5578063286617de14610ed25780632d3f553714610d725780632dd3100014610d0457806331f7d96414610c965780635c975abb14610c535780636d22448914610c1757806384b0196e14610aa65780638da5cb5b14610a55578063b8d63f4514610a09578063baa7fda4146108e0578063bc197c8114610825578063ce1506be146107e2578063d47b287e14610692578063dfb7ce8314610624578063f23a6e611461059a578063f2fde38b146104b35763f69e64b214610111575f80fd5b602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57803567ffffffffffffffff80821161032c573660238301121561032c578183013590811161032c5760246005918060051b3683828701011161032c57869592826101888a97946114db565b95610195895197886113b0565b8187527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06101c2836114db565b015f5b8181106104a45750505f957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7d86360301965b838110610330575050508751948188870189885252888087019487010194838101945f925b8484106102cb578b8b8b7f79dfcb184c75a8c53199ae76930d72ffcdac408a45ea4b710dfe3f2d35a45a268c8c038da18251918383019343845281840152815180945260608301938160608260051b8601019301915f955b8287106102815785850386f35b9091929382806102bb837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08a60019603018652885161147f565b9601920196019592919092610274565b909192939495967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc089829d9c9d0301835287358281121561032c578c6103186001938a8884950101611bb3565b9901930194019291959493909a999a61021c565b5f80fd5b73ffffffffffffffffffffffffffffffffffffffff5f9b9a9b989798969495965416330361047c578581841b890101358781121561032c5788018a87820161037781611b41565b3b15610426575b915f929182604461039d6103928796611b41565b926064860190611b62565b8094519485928337810186815203930135905af16103b9611c77565b6103c3838c611ca6565b526103ce828b611ca6565b5190156103e85750600101999899969596949392946101f7565b826104228d92898e519485947f08c379a000000000000000000000000000000000000000000000000000000000865285015283019061147f565b0390fd5b90506104356064830182611b62565b9050610442578b9061037e565b836104228e928a8f519485947fa6335651000000000000000000000000000000000000000000000000000000008652850152830190611bb3565b5088517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b60608982018b015289016101c5565b503461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576104eb6112ec565b5f549073ffffffffffffffffffffffffffffffffffffffff90818316938433141580610590575b61056857507fffffffffffffffffffffffff00000000000000000000000000000000000000009394501680937f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a316175f55005b8590517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b5030331415610512565b503461032c5760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576105d26112ec565b506105db61130f565b5060843567ffffffffffffffff811161032c576020926105fd91369101611461565b50517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461032c577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60a08136011261032c5782359067ffffffffffffffff821161032c57608090828501923603011261032c576106ec61130f565b606435801515810361032c576084359373ffffffffffffffffffffffffffffffffffffffff808616860361032c5760ff5f549182169160a01c16610789575b5060035461073885611e0a565b0361076157506107519450610753575b60443591611e25565b005b61075c816116fd565b610748565b8590517fbcd55b0f000000000000000000000000000000000000000000000000000000008152fd5b8033141590816107d7575b50806107cd575b6107a5575f61072b565b8590517f9e87fac8000000000000000000000000000000000000000000000000000000008152fd5b503033141561079b565b90503214155f610794565b503461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5761081e60209235611aad565b9051908152f35b503461032c5760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5761085d6112ec565b5061086661130f565b5067ffffffffffffffff60443581811161032c5761088790369085016114f3565b5060643581811161032c5761089f90369085016114f3565b5060843590811161032c576020926108b991369101611461565b50517fbc197c81000000000000000000000000000000000000000000000000000000008152f35b50903461032c577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc828136011261032c5781359067ffffffffffffffff821161032c57608090828401923603011261032c5761093a61130f565b9173ffffffffffffffffffffffffffffffffffffffff93847f00000000000000000000000000000000000000000000000000000000000000001633036109e35750508061098961098e92611d4b565b611e0a565b60035516805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a37fffffffffffffffffffffff0000000000000000000000000000000000000000005f5416175f555f80f35b517f0d622feb000000000000000000000000000000000000000000000000000000008152fd5b503461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57610a49610a446112ec565b611921565b82519182526020820152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5760209073ffffffffffffffffffffffffffffffffffffffff5f54169051908152f35b50903461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57610aff7f000000000000000000000000000000000000000000000000000000000000000061207e565b91610b297f00000000000000000000000000000000000000000000000000000000000000006121f0565b815191602091602084019484861067ffffffffffffffff871117610beb5750610ba08260209287610b9399989795525f855281519889987f0f000000000000000000000000000000000000000000000000000000000000008a5260e0868b015260e08a019061147f565b918883039089015261147f565b914660608701523060808701525f60a087015285830360c087015251918281520192915f5b828110610bd457505050500390f35b835185528695509381019392810192600101610bc5565b6041907f4e487b71000000000000000000000000000000000000000000000000000000005f525260245ffd5b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020906003549051908152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5760209060ff5f5460a01c1690519015158152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461032c577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60608136011261032c5782359067ffffffffffffffff821161032c57608090828501923603011261032c57610dcc61130f565b6044359273ffffffffffffffffffffffffffffffffffffffff808516850361032c5760ff5f549182169160a01c16610e79575b50600354610e0c84611e0a565b03610e5157506107519350610e3d610e2382611921565b9060018211610e43575b80151590039080151590036118e7565b91611e25565b610e4c846116fd565b610e2d565b8490517fbcd55b0f000000000000000000000000000000000000000000000000000000008152fd5b803314159081610ec7575b5080610ebd575b610e95575f610dff565b8490517f9e87fac8000000000000000000000000000000000000000000000000000000008152fd5b5030331415610e8b565b90503214155f610e84565b503461032c577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc9160208336011261032c5780359267ffffffffffffffff841161032c57608090848301943603011261032c5773ffffffffffffffffffffffffffffffffffffffff5f541633141580610fbb575b610f94577f52cd08e805db808b670064dedc5cf97374a918fc17c82d7097753189550e8d51610f8f8484610f7982611d4b565b610f8282611e0a565b60035551918291826117f2565b0390a1005b90517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b5030331415610f46565b3461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57610751610fff6112ec565b6116fd565b503461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5781359182151580930361032c575f549073ffffffffffffffffffffffffffffffffffffffff8216331415806110fd575b6110d6577f3c70af01296aef045b2f5c9d3c30b05d4428fd257145b9c7fcd76418e65b598060208585857fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff00000000000000000000000000000000000000008460a01b169116175f5551908152a1005b82517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b5030331415611064565b503461032c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5767ffffffffffffffff9160243583811161032c573660238201121561032c578082013593841161032c57366024858301011161032c576020937fffffffff0000000000000000000000000000000000000000000000000000000092602461119f93019035611553565b915191168152f35b503461032c5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576111df6112ec565b506111e861130f565b5060643567ffffffffffffffff811161032c5760209261120a91369101611461565b50517f150b7a02000000000000000000000000000000000000000000000000000000008152f35b833461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5735907fffffffff00000000000000000000000000000000000000000000000000000000821680920361032c57817f4e2312e000000000000000000000000000000000000000000000000000000000602093149081156112c2575b5015158152f35b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014836112bb565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361032c57565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361032c57565b359073ffffffffffffffffffffffffffffffffffffffff8216820361032c57565b67ffffffffffffffff811161136757604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff82111761136757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761136757604052565b67ffffffffffffffff811161136757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b929192611437826113f1565b9161144560405193846113b0565b82948184528183011161032c578281602093845f960137010152565b9080601f8301121561032c5781602061147c9335910161142b565b90565b91908251928382525f5b8481106114c75750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6020809697860101520116010190565b602081830181015184830182015201611489565b67ffffffffffffffff81116113675760051b60200190565b9080601f8301121561032c57602090823561150d816114db565b9361151b60405195866113b0565b81855260208086019260051b82010192831161032c57602001905b828210611544575050505090565b81358152908301908301611536565b91909161158473ffffffffffffffffffffffffffffffffffffffff9361157c855f541693611aad565b93369161142b565b61158e81846122c3565b60058196929610156116d0571594856116c4575b505083156115fa575b5050506115d6577fffffffff0000000000000000000000000000000000000000000000000000000090565b7f1626ba7e0000000000000000000000000000000000000000000000000000000090565b5f9293509082916040516116778161164b60208201947f1626ba7e00000000000000000000000000000000000000000000000000000000998a8752602484015260406044840152606483019061147f565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018352826113b0565b51915afa90611684611c77565b826116b6575b8261169a575b50505f80806115ab565b90915060208180518101031261032c5760200151145f80611690565b91506020825110159161168a565b16821493505f806115a2565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff90817f00000000000000000000000000000000000000000000000000000000000000001691823b1561032c5760445f928360405195869485937ff940e3850000000000000000000000000000000000000000000000000000000085523060048601521660248401525af18015611794576117895750565b61179290611353565b565b6040513d5f823e3d90fd5b90357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561032c57016020813591019167ffffffffffffffff821161032c578160051b3603831361032c57565b9060209182815260a0810190611808838061179f565b6080838701529283905260c08201925f5b868282106118b457915050611831915084018461179f565b90937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08385030160408401528184527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821161032c5760609160051b80958786013760408101358284015201359061ffff821680920361032c5760800152010190565b80849673ffffffffffffffffffffffffffffffffffffffff6118d96001959697611332565b168152019501929101611819565b919082018092116118f457565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff919082167f000000000000000000000000000000000000000000000000000000000000000083168103611a295760206119c391475b9460405180809581947efdd58e00000000000000000000000000000000000000000000000000000000835230600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03917f0000000000000000000000000000000000000000000000000000000000000000165afa908115611794575f916119fa575090565b90506020813d602011611a21575b81611a15602093836113b0565b8101031261032c575190565b3d9150611a08565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa908115611794575f91611a79575b506119c39160209161196b565b90506020813d602011611aa5575b81611a94602093836113b0565b8101031261032c57516119c3611a6c565b3d9150611a87565b6040519060208201907f27494ec45ae688e7b2451f36d0c95ff88538e2aeba4442f5a7a84fb2268f97348252604083015260408252606082019180831067ffffffffffffffff84111761136757604292604052519020611b0b612515565b90604051917f19010000000000000000000000000000000000000000000000000000000000008352600283015260228201522090565b3573ffffffffffffffffffffffffffffffffffffffff8116810361032c5790565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561032c570180359067ffffffffffffffff821161032c5760200191813603831361032c57565b73ffffffffffffffffffffffffffffffffffffffff611bd182611332565b1682526020810135602083015260408101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561032c5701906020823592019167ffffffffffffffff811161032c57803603831361032c57601f817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09260809560606040870152816060870152868601375f8582860101520116010190565b3d15611ca1573d90611c88826113f1565b91611c9660405193846113b0565b82523d5f602084013e565b606090565b8051821015611cba5760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561032c570180359067ffffffffffffffff821161032c57602001918160051b3603831361032c57565b9190811015611cba5760051b0190565b611d558180611ce7565b6020830192915080611d678484611ce7565b905003611de057915f925f915b818310611db3575050506040013503611d8957565b60046040517f123c9c81000000000000000000000000000000000000000000000000000000008152fd5b909193611dd7600191611dd087611dca8689611ce7565b90611d3b565b35906118e7565b94019190611d74565b60046040517f40fa044d000000000000000000000000000000000000000000000000000000008152fd5b604051611e1f8161164b6020820194856117f2565b51902090565b9192611e318380611ce7565b939050606081013561ffff811680910361032c57611e53620f424091876122f8565b0490818603948686116118f45773ffffffffffffffffffffffffffffffffffffffff948516957f000000000000000000000000000000000000000000000000000000000000000086168703611ffd575f5b828110611f08575050505080611ee7575b507f562c19c0e7b3493417e3cf5103baa939f4d0e9c1087be236aebb46b84e09c7d9916020915b6040519586521693a3565b5f9081803892855af115611efb575f611eb5565b63b12d13eb5f526004601cfd5b611f1381838661230b565b5f82818084611f35611f30611f288c80611ce7565b389791611d3b565b611b41565b620186a0f115611f49575b50600101611ea4565b877f000000000000000000000000000000000000000000000000000000000000000016611f7d611f3084611dca8980611ce7565b91813b1561032c578960648c945f93604095865197889586947f8340f54900000000000000000000000000000000000000000000000000000000865216600485015260248401528160448401525af1908115611ff457509060019291611fe5575b5090611f40565b611fee90611353565b5f611fde565b513d5f823e3d90fd5b5f9291925b838110612050575050505091602091837f562c19c0e7b3493417e3cf5103baa939f4d0e9c1087be236aebb46b84e09c7d99461203f575b50611edc565b61204a908287612365565b5f612039565b80612078612061600193858761230b565b612072611f3084611dca8980611ce7565b8b612365565b01612002565b60ff81146120d45760ff811690601f82116120aa57604051916120a083611394565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b506040515f60018054918260011c600184169283156121e6575b60209485831085146121b957828752869490811561217a575060011461211d575b505061147c925003826113b0565b9093915060015f527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6935f915b81831061216257505061147c93508201015f8061210f565b8554878401850152948501948694509183019161214a565b905061147c9593507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201015f8061210f565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b90607f16906120ee565b60ff81146122125760ff811690601f82116120aa57604051916120a083611394565b506040515f600254906001908260011c600184169283156122b9575b60209485831085146121b957828752869490811561217a575060011461225c57505061147c925003826113b0565b9093915060025f527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace935f915b8183106122a157505061147c93508201015f8061210f565b85548784018501529485019486945091830191612289565b90607f169061222e565b9060418151145f146122ef576122eb91602082015190606060408401519301515f1a9061264d565b9091565b50505f90600290565b818102929181159184041417156118f457565b9160409161232361232a92611dca6020870187611ce7565b35906122f8565b910135908115612338570490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b612458915f8073ffffffffffffffffffffffffffffffffffffffff6040519461240d866123e160209a8b8301987fa9059cbb000000000000000000000000000000000000000000000000000000008a52602484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018852876113b0565b16926040519461241c86611394565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af1612452611c77565b916126d5565b80518281159182156124f5575b50509050156124715750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b838092935001031261032c57810151801515810361032c5780825f612465565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480612624575b1561257d577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176113675760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000004614612554565b7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084116126ca576020935f9360ff60809460405194855216868401526040830152606082015282805260015afa15611794575f5173ffffffffffffffffffffffffffffffffffffffff8116156126c257905f90565b505f90600190565b505050505f90600390565b9192901561275057508151156126e9575090565b3b156126f25790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156127635750805190602001fd5b610422906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260206004840152602483019061147f56fea26469706673582212201c6eae63bea3227251939ccf147055e644b4cfcfe6ccc78470ec64e706be457f64736f6c634300081700330000000000000000000000008fb66f38cf86a3d5e8768f8f1754a24a6c661fb8
Deployed Bytecode
0x6080604081815260049182361015610015575f80fd5b5f3560e01c90816301ffc9a71461123157508063150b7a02146111a75780631626ba7e1461110757806316c38b3c14611004578063254689f514610fc5578063286617de14610ed25780632d3f553714610d725780632dd3100014610d0457806331f7d96414610c965780635c975abb14610c535780636d22448914610c1757806384b0196e14610aa65780638da5cb5b14610a55578063b8d63f4514610a09578063baa7fda4146108e0578063bc197c8114610825578063ce1506be146107e2578063d47b287e14610692578063dfb7ce8314610624578063f23a6e611461059a578063f2fde38b146104b35763f69e64b214610111575f80fd5b602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57803567ffffffffffffffff80821161032c573660238301121561032c578183013590811161032c5760246005918060051b3683828701011161032c57869592826101888a97946114db565b95610195895197886113b0565b8187527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06101c2836114db565b015f5b8181106104a45750505f957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7d86360301965b838110610330575050508751948188870189885252888087019487010194838101945f925b8484106102cb578b8b8b7f79dfcb184c75a8c53199ae76930d72ffcdac408a45ea4b710dfe3f2d35a45a268c8c038da18251918383019343845281840152815180945260608301938160608260051b8601019301915f955b8287106102815785850386f35b9091929382806102bb837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08a60019603018652885161147f565b9601920196019592919092610274565b909192939495967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc089829d9c9d0301835287358281121561032c578c6103186001938a8884950101611bb3565b9901930194019291959493909a999a61021c565b5f80fd5b73ffffffffffffffffffffffffffffffffffffffff5f9b9a9b989798969495965416330361047c578581841b890101358781121561032c5788018a87820161037781611b41565b3b15610426575b915f929182604461039d6103928796611b41565b926064860190611b62565b8094519485928337810186815203930135905af16103b9611c77565b6103c3838c611ca6565b526103ce828b611ca6565b5190156103e85750600101999899969596949392946101f7565b826104228d92898e519485947f08c379a000000000000000000000000000000000000000000000000000000000865285015283019061147f565b0390fd5b90506104356064830182611b62565b9050610442578b9061037e565b836104228e928a8f519485947fa6335651000000000000000000000000000000000000000000000000000000008652850152830190611bb3565b5088517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b60608982018b015289016101c5565b503461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576104eb6112ec565b5f549073ffffffffffffffffffffffffffffffffffffffff90818316938433141580610590575b61056857507fffffffffffffffffffffffff00000000000000000000000000000000000000009394501680937f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a316175f55005b8590517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b5030331415610512565b503461032c5760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576105d26112ec565b506105db61130f565b5060843567ffffffffffffffff811161032c576020926105fd91369101611461565b50517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000008fb66f38cf86a3d5e8768f8f1754a24a6c661fb8168152f35b503461032c577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60a08136011261032c5782359067ffffffffffffffff821161032c57608090828501923603011261032c576106ec61130f565b606435801515810361032c576084359373ffffffffffffffffffffffffffffffffffffffff808616860361032c5760ff5f549182169160a01c16610789575b5060035461073885611e0a565b0361076157506107519450610753575b60443591611e25565b005b61075c816116fd565b610748565b8590517fbcd55b0f000000000000000000000000000000000000000000000000000000008152fd5b8033141590816107d7575b50806107cd575b6107a5575f61072b565b8590517f9e87fac8000000000000000000000000000000000000000000000000000000008152fd5b503033141561079b565b90503214155f610794565b503461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5761081e60209235611aad565b9051908152f35b503461032c5760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5761085d6112ec565b5061086661130f565b5067ffffffffffffffff60443581811161032c5761088790369085016114f3565b5060643581811161032c5761089f90369085016114f3565b5060843590811161032c576020926108b991369101611461565b50517fbc197c81000000000000000000000000000000000000000000000000000000008152f35b50903461032c577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc828136011261032c5781359067ffffffffffffffff821161032c57608090828401923603011261032c5761093a61130f565b9173ffffffffffffffffffffffffffffffffffffffff93847f000000000000000000000000adc87646f736d6a82e9a6539cddc488b2aa07f381633036109e35750508061098961098e92611d4b565b611e0a565b60035516805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a37fffffffffffffffffffffff0000000000000000000000000000000000000000005f5416175f555f80f35b517f0d622feb000000000000000000000000000000000000000000000000000000008152fd5b503461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57610a49610a446112ec565b611921565b82519182526020820152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5760209073ffffffffffffffffffffffffffffffffffffffff5f54169051908152f35b50903461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57610aff7f73706c697457616c6c657400000000000000000000000000000000000000000b61207e565b91610b297f32000000000000000000000000000000000000000000000000000000000000016121f0565b815191602091602084019484861067ffffffffffffffff871117610beb5750610ba08260209287610b9399989795525f855281519889987f0f000000000000000000000000000000000000000000000000000000000000008a5260e0868b015260e08a019061147f565b918883039089015261147f565b914660608701523060808701525f60a087015285830360c087015251918281520192915f5b828110610bd457505050500390f35b835185528695509381019392810192600101610bc5565b6041907f4e487b71000000000000000000000000000000000000000000000000000000005f525260245ffd5b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020906003549051908152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5760209060ff5f5460a01c1690519015158152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee168152f35b503461032c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000adc87646f736d6a82e9a6539cddc488b2aa07f38168152f35b503461032c577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60608136011261032c5782359067ffffffffffffffff821161032c57608090828501923603011261032c57610dcc61130f565b6044359273ffffffffffffffffffffffffffffffffffffffff808516850361032c5760ff5f549182169160a01c16610e79575b50600354610e0c84611e0a565b03610e5157506107519350610e3d610e2382611921565b9060018211610e43575b80151590039080151590036118e7565b91611e25565b610e4c846116fd565b610e2d565b8490517fbcd55b0f000000000000000000000000000000000000000000000000000000008152fd5b803314159081610ec7575b5080610ebd575b610e95575f610dff565b8490517f9e87fac8000000000000000000000000000000000000000000000000000000008152fd5b5030331415610e8b565b90503214155f610e84565b503461032c577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc9160208336011261032c5780359267ffffffffffffffff841161032c57608090848301943603011261032c5773ffffffffffffffffffffffffffffffffffffffff5f541633141580610fbb575b610f94577f52cd08e805db808b670064dedc5cf97374a918fc17c82d7097753189550e8d51610f8f8484610f7982611d4b565b610f8282611e0a565b60035551918291826117f2565b0390a1005b90517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b5030331415610f46565b3461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c57610751610fff6112ec565b6116fd565b503461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5781359182151580930361032c575f549073ffffffffffffffffffffffffffffffffffffffff8216331415806110fd575b6110d6577f3c70af01296aef045b2f5c9d3c30b05d4428fd257145b9c7fcd76418e65b598060208585857fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff00000000000000000000000000000000000000008460a01b169116175f5551908152a1005b82517f82b42900000000000000000000000000000000000000000000000000000000008152fd5b5030331415611064565b503461032c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5767ffffffffffffffff9160243583811161032c573660238201121561032c578082013593841161032c57366024858301011161032c576020937fffffffff0000000000000000000000000000000000000000000000000000000092602461119f93019035611553565b915191168152f35b503461032c5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c576111df6112ec565b506111e861130f565b5060643567ffffffffffffffff811161032c5760209261120a91369101611461565b50517f150b7a02000000000000000000000000000000000000000000000000000000008152f35b833461032c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032c5735907fffffffff00000000000000000000000000000000000000000000000000000000821680920361032c57817f4e2312e000000000000000000000000000000000000000000000000000000000602093149081156112c2575b5015158152f35b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014836112bb565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361032c57565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361032c57565b359073ffffffffffffffffffffffffffffffffffffffff8216820361032c57565b67ffffffffffffffff811161136757604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff82111761136757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761136757604052565b67ffffffffffffffff811161136757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b929192611437826113f1565b9161144560405193846113b0565b82948184528183011161032c578281602093845f960137010152565b9080601f8301121561032c5781602061147c9335910161142b565b90565b91908251928382525f5b8481106114c75750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f845f6020809697860101520116010190565b602081830181015184830182015201611489565b67ffffffffffffffff81116113675760051b60200190565b9080601f8301121561032c57602090823561150d816114db565b9361151b60405195866113b0565b81855260208086019260051b82010192831161032c57602001905b828210611544575050505090565b81358152908301908301611536565b91909161158473ffffffffffffffffffffffffffffffffffffffff9361157c855f541693611aad565b93369161142b565b61158e81846122c3565b60058196929610156116d0571594856116c4575b505083156115fa575b5050506115d6577fffffffff0000000000000000000000000000000000000000000000000000000090565b7f1626ba7e0000000000000000000000000000000000000000000000000000000090565b5f9293509082916040516116778161164b60208201947f1626ba7e00000000000000000000000000000000000000000000000000000000998a8752602484015260406044840152606483019061147f565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018352826113b0565b51915afa90611684611c77565b826116b6575b8261169a575b50505f80806115ab565b90915060208180518101031261032c5760200151145f80611690565b91506020825110159161168a565b16821493505f806115a2565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff90817f0000000000000000000000008fb66f38cf86a3d5e8768f8f1754a24a6c661fb81691823b1561032c5760445f928360405195869485937ff940e3850000000000000000000000000000000000000000000000000000000085523060048601521660248401525af18015611794576117895750565b61179290611353565b565b6040513d5f823e3d90fd5b90357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561032c57016020813591019167ffffffffffffffff821161032c578160051b3603831361032c57565b9060209182815260a0810190611808838061179f565b6080838701529283905260c08201925f5b868282106118b457915050611831915084018461179f565b90937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08385030160408401528184527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821161032c5760609160051b80958786013760408101358284015201359061ffff821680920361032c5760800152010190565b80849673ffffffffffffffffffffffffffffffffffffffff6118d96001959697611332565b168152019501929101611819565b919082018092116118f457565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff919082167f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee83168103611a295760206119c391475b9460405180809581947efdd58e00000000000000000000000000000000000000000000000000000000835230600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03917f0000000000000000000000008fb66f38cf86a3d5e8768f8f1754a24a6c661fb8165afa908115611794575f916119fa575090565b90506020813d602011611a21575b81611a15602093836113b0565b8101031261032c575190565b3d9150611a08565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa908115611794575f91611a79575b506119c39160209161196b565b90506020813d602011611aa5575b81611a94602093836113b0565b8101031261032c57516119c3611a6c565b3d9150611a87565b6040519060208201907f27494ec45ae688e7b2451f36d0c95ff88538e2aeba4442f5a7a84fb2268f97348252604083015260408252606082019180831067ffffffffffffffff84111761136757604292604052519020611b0b612515565b90604051917f19010000000000000000000000000000000000000000000000000000000000008352600283015260228201522090565b3573ffffffffffffffffffffffffffffffffffffffff8116810361032c5790565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561032c570180359067ffffffffffffffff821161032c5760200191813603831361032c57565b73ffffffffffffffffffffffffffffffffffffffff611bd182611332565b1682526020810135602083015260408101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561032c5701906020823592019167ffffffffffffffff811161032c57803603831361032c57601f817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09260809560606040870152816060870152868601375f8582860101520116010190565b3d15611ca1573d90611c88826113f1565b91611c9660405193846113b0565b82523d5f602084013e565b606090565b8051821015611cba5760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561032c570180359067ffffffffffffffff821161032c57602001918160051b3603831361032c57565b9190811015611cba5760051b0190565b611d558180611ce7565b6020830192915080611d678484611ce7565b905003611de057915f925f915b818310611db3575050506040013503611d8957565b60046040517f123c9c81000000000000000000000000000000000000000000000000000000008152fd5b909193611dd7600191611dd087611dca8689611ce7565b90611d3b565b35906118e7565b94019190611d74565b60046040517f40fa044d000000000000000000000000000000000000000000000000000000008152fd5b604051611e1f8161164b6020820194856117f2565b51902090565b9192611e318380611ce7565b939050606081013561ffff811680910361032c57611e53620f424091876122f8565b0490818603948686116118f45773ffffffffffffffffffffffffffffffffffffffff948516957f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee86168703611ffd575f5b828110611f08575050505080611ee7575b507f562c19c0e7b3493417e3cf5103baa939f4d0e9c1087be236aebb46b84e09c7d9916020915b6040519586521693a3565b5f9081803892855af115611efb575f611eb5565b63b12d13eb5f526004601cfd5b611f1381838661230b565b5f82818084611f35611f30611f288c80611ce7565b389791611d3b565b611b41565b620186a0f115611f49575b50600101611ea4565b877f0000000000000000000000008fb66f38cf86a3d5e8768f8f1754a24a6c661fb816611f7d611f3084611dca8980611ce7565b91813b1561032c578960648c945f93604095865197889586947f8340f54900000000000000000000000000000000000000000000000000000000865216600485015260248401528160448401525af1908115611ff457509060019291611fe5575b5090611f40565b611fee90611353565b5f611fde565b513d5f823e3d90fd5b5f9291925b838110612050575050505091602091837f562c19c0e7b3493417e3cf5103baa939f4d0e9c1087be236aebb46b84e09c7d99461203f575b50611edc565b61204a908287612365565b5f612039565b80612078612061600193858761230b565b612072611f3084611dca8980611ce7565b8b612365565b01612002565b60ff81146120d45760ff811690601f82116120aa57604051916120a083611394565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b506040515f60018054918260011c600184169283156121e6575b60209485831085146121b957828752869490811561217a575060011461211d575b505061147c925003826113b0565b9093915060015f527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6935f915b81831061216257505061147c93508201015f8061210f565b8554878401850152948501948694509183019161214a565b905061147c9593507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201015f8061210f565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b90607f16906120ee565b60ff81146122125760ff811690601f82116120aa57604051916120a083611394565b506040515f600254906001908260011c600184169283156122b9575b60209485831085146121b957828752869490811561217a575060011461225c57505061147c925003826113b0565b9093915060025f527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace935f915b8183106122a157505061147c93508201015f8061210f565b85548784018501529485019486945091830191612289565b90607f169061222e565b9060418151145f146122ef576122eb91602082015190606060408401519301515f1a9061264d565b9091565b50505f90600290565b818102929181159184041417156118f457565b9160409161232361232a92611dca6020870187611ce7565b35906122f8565b910135908115612338570490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b612458915f8073ffffffffffffffffffffffffffffffffffffffff6040519461240d866123e160209a8b8301987fa9059cbb000000000000000000000000000000000000000000000000000000008a52602484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018852876113b0565b16926040519461241c86611394565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af1612452611c77565b916126d5565b80518281159182156124f5575b50509050156124715750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b838092935001031261032c57810151801515810361032c5780825f612465565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000285b37453f73f8de94de0caef8108bc8431be3416301480612624575b1561257d577fc827f4faa739b869ce0f02b11810dddd770324c1cc339e55110d19f62737900790565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f1ef5ae2056c96599e7b4da01dd20d60b1c82598696408a14cef21f71ad27d7dc60408201527fad7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a560608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176113675760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000014614612554565b7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084116126ca576020935f9360ff60809460405194855216868401526040830152606082015282805260015afa15611794575f5173ffffffffffffffffffffffffffffffffffffffff8116156126c257905f90565b505f90600190565b505050505f90600390565b9192901561275057508151156126e9575090565b3b156126f25790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156127635750805190602001fd5b610422906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260206004840152602483019061147f56fea26469706673582212201c6eae63bea3227251939ccf147055e644b4cfcfe6ccc78470ec64e706be457f64736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000008fb66f38cf86a3d5e8768f8f1754a24a6c661fb8
-----Decoded View---------------
Arg [0] : _splitWarehouse (address): 0x8fb66F38cF86A3d5e8768f8F1754A24A6c661Fb8
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000008fb66f38cf86a3d5e8768f8f1754a24a6c661fb8
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 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.