Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Latest 5 from a total of 5 transactions
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
OrderPayable
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "../access-control-registry/AccessControlRegistryAdminnedWithManager.sol";
import "./interfaces/IOrderPayable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
/// @title Contract used to pay for orders denoted in the native currency
/// @notice OrderPayable is managed by an account that designates order signers
/// and withdrawers. Only orders for which a signature is issued for by an
/// order signer can be paid for. Order signers have to be EOAs to be able to
/// issue ERC191 signatures. The manager is responsible with reverting unwanted
/// signatures (for example, if a compromised order signer issues an
/// underpriced order and the order is paid for, the manager should revoke the
/// role, refund the payment and consider the order void).
/// Withdrawers can be EOAs or contracts. For example, one can implement a
/// withdrawer contract that withdraws funds automatically to a Funder
/// contract.
contract OrderPayable is
AccessControlRegistryAdminnedWithManager,
IOrderPayable
{
using ECDSA for bytes32;
/// @notice Order signer role description
string public constant override ORDER_SIGNER_ROLE_DESCRIPTION =
"Order signer";
/// @notice Withdrawer role description
string public constant override WITHDRAWER_ROLE_DESCRIPTION = "Withdrawer";
/// @notice Order signer role
bytes32 public immutable override orderSignerRole;
/// @notice Withdrawer role
bytes32 public immutable override withdrawerRole;
/// @notice Returns if the order with ID is paid for
mapping(bytes32 => bool) public override orderIdToPaymentStatus;
/// @param _accessControlRegistry AccessControlRegistry contract address
/// @param _adminRoleDescription Admin role description
/// @param _manager Manager address
constructor(
address _accessControlRegistry,
string memory _adminRoleDescription,
address _manager
)
AccessControlRegistryAdminnedWithManager(
_accessControlRegistry,
_adminRoleDescription,
_manager
)
{
orderSignerRole = _deriveRole(
_deriveAdminRole(manager),
ORDER_SIGNER_ROLE_DESCRIPTION
);
withdrawerRole = _deriveRole(
_deriveAdminRole(manager),
WITHDRAWER_ROLE_DESCRIPTION
);
}
/// @notice Called with value to pay for an order
/// @dev The sender must set `msg.value` to cover the exact amount
/// specified by the order.
/// Input arguments are provided in encoded form to improve the UX for
/// using ABI-based, automatically generated contract GUIs such as ones
/// from Safe and Etherscan. Given that OrderPayable is verified, the user
/// is only required to provide the OrderPayable address, select
/// `payForOrder()`, copy-paste `encodedData` (instead of 4 separate
/// fields) and enter `msg.value`.
/// @param encodedData The order ID, expiration timestamp, order signer
/// address and signature in ABI-encoded form
function payForOrder(bytes calldata encodedData) external payable override {
// Do not care if `encodedData` has trailing data
(
bytes32 orderId,
uint256 expirationTimestamp,
address orderSigner,
bytes memory signature
) = abi.decode(encodedData, (bytes32, uint256, address, bytes));
// We do not allow invalid orders even if they are signed by an
// authorized order signer
require(orderId != bytes32(0), "Order ID zero");
require(expirationTimestamp > block.timestamp, "Order expired");
require(
orderSigner == manager ||
IAccessControlRegistry(accessControlRegistry).hasRole(
orderSignerRole,
orderSigner
),
"Invalid order signer"
);
require(msg.value > 0, "Payment amount zero");
require(!orderIdToPaymentStatus[orderId], "Order already paid for");
require(
(
keccak256(
abi.encodePacked(
block.chainid,
address(this),
orderId,
expirationTimestamp,
msg.value
)
).toEthSignedMessageHash()
).recover(signature) == orderSigner,
"Signature mismatch"
);
orderIdToPaymentStatus[orderId] = true;
emit PaidForOrder(
orderId,
expirationTimestamp,
orderSigner,
msg.value,
msg.sender
);
}
/// @notice Called by a withdrawer to withdraw the entire balance of
/// OrderPayable to `recipient`
/// @param recipient Recipient address
/// @return amount Withdrawal amount
function withdraw(
address recipient
) external override returns (uint256 amount) {
require(
msg.sender == manager ||
IAccessControlRegistry(accessControlRegistry).hasRole(
withdrawerRole,
msg.sender
),
"Sender cannot withdraw"
);
amount = address(this).balance;
emit Withdrew(recipient, amount);
(bool success, ) = recipient.call{value: amount}("");
require(success, "Transfer unsuccessful");
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @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) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 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 10, 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 * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.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 `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);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/SelfMulticall.sol";
import "./RoleDeriver.sol";
import "./interfaces/IAccessControlRegistryAdminned.sol";
import "./interfaces/IAccessControlRegistry.sol";
/// @title Contract to be inherited by contracts whose adminship functionality
/// will be implemented using AccessControlRegistry
contract AccessControlRegistryAdminned is
SelfMulticall,
RoleDeriver,
IAccessControlRegistryAdminned
{
/// @notice AccessControlRegistry contract address
address public immutable override accessControlRegistry;
/// @notice Admin role description
string public override adminRoleDescription;
bytes32 internal immutable adminRoleDescriptionHash;
/// @dev Contracts deployed with the same admin role descriptions will have
/// the same roles, meaning that granting an account a role will authorize
/// it in multiple contracts. Unless you want your deployed contract to
/// share the role configuration of another contract, use a unique admin
/// role description.
/// @param _accessControlRegistry AccessControlRegistry contract address
/// @param _adminRoleDescription Admin role description
constructor(
address _accessControlRegistry,
string memory _adminRoleDescription
) {
require(_accessControlRegistry != address(0), "ACR address zero");
require(
bytes(_adminRoleDescription).length > 0,
"Admin role description empty"
);
accessControlRegistry = _accessControlRegistry;
adminRoleDescription = _adminRoleDescription;
adminRoleDescriptionHash = keccak256(
abi.encodePacked(_adminRoleDescription)
);
}
/// @notice Derives the admin role for the specific manager address
/// @param manager Manager address
/// @return adminRole Admin role
function _deriveAdminRole(
address manager
) internal view returns (bytes32 adminRole) {
adminRole = _deriveRole(
_deriveRootRole(manager),
adminRoleDescriptionHash
);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./AccessControlRegistryAdminned.sol";
import "./interfaces/IAccessControlRegistryAdminnedWithManager.sol";
/// @title Contract to be inherited by contracts with manager whose adminship
/// functionality will be implemented using AccessControlRegistry
/// @notice The manager address here is expected to belong to an
/// AccessControlRegistry user that is a multisig/DAO
contract AccessControlRegistryAdminnedWithManager is
AccessControlRegistryAdminned,
IAccessControlRegistryAdminnedWithManager
{
/// @notice Address of the manager that manages the related
/// AccessControlRegistry roles
/// @dev The mutability of the manager role can be implemented by
/// designating an OwnableCallForwarder contract as the manager. The
/// ownership of this contract can then be transferred, effectively
/// transferring managership.
address public immutable override manager;
/// @notice Admin role
/// @dev Since `manager` is immutable, so is `adminRole`
bytes32 public immutable override adminRole;
/// @param _accessControlRegistry AccessControlRegistry contract address
/// @param _adminRoleDescription Admin role description
/// @param _manager Manager address
constructor(
address _accessControlRegistry,
string memory _adminRoleDescription,
address _manager
)
AccessControlRegistryAdminned(
_accessControlRegistry,
_adminRoleDescription
)
{
require(_manager != address(0), "Manager address zero");
manager = _manager;
adminRole = _deriveAdminRole(_manager);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/IAccessControl.sol";
import "../../utils/interfaces/ISelfMulticall.sol";
interface IAccessControlRegistry is IAccessControl, ISelfMulticall {
event InitializedManager(
bytes32 indexed rootRole,
address indexed manager,
address sender
);
event InitializedRole(
bytes32 indexed role,
bytes32 indexed adminRole,
string description,
address sender
);
function initializeManager(address manager) external;
function initializeRoleAndGrantToSender(
bytes32 adminRole,
string calldata description
) external returns (bytes32 role);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/interfaces/ISelfMulticall.sol";
interface IAccessControlRegistryAdminned is ISelfMulticall {
function accessControlRegistry() external view returns (address);
function adminRoleDescription() external view returns (string memory);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlRegistryAdminned.sol";
interface IAccessControlRegistryAdminnedWithManager is
IAccessControlRegistryAdminned
{
function manager() external view returns (address);
function adminRole() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Contract to be inherited by contracts that will derive
/// AccessControlRegistry roles
/// @notice If a contract interfaces with AccessControlRegistry and needs to
/// derive roles, it should inherit this contract instead of re-implementing
/// the logic
contract RoleDeriver {
/// @notice Derives the root role of the manager
/// @param manager Manager address
/// @return rootRole Root role
function _deriveRootRole(
address manager
) internal pure returns (bytes32 rootRole) {
rootRole = keccak256(abi.encodePacked(manager));
}
/// @notice Derives the role using its admin role and description
/// @dev This implies that roles adminned by the same role cannot have the
/// same description
/// @param adminRole Admin role
/// @param description Human-readable description of the role
/// @return role Role
function _deriveRole(
bytes32 adminRole,
string memory description
) internal pure returns (bytes32 role) {
role = _deriveRole(adminRole, keccak256(abi.encodePacked(description)));
}
/// @notice Derives the role using its admin role and description hash
/// @dev This implies that roles adminned by the same role cannot have the
/// same description
/// @param adminRole Admin role
/// @param descriptionHash Hash of the human-readable description of the
/// role
/// @return role Role
function _deriveRole(
bytes32 adminRole,
bytes32 descriptionHash
) internal pure returns (bytes32 role) {
role = keccak256(abi.encodePacked(adminRole, descriptionHash));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IOrderPayable {
event PaidForOrder(
bytes32 indexed orderId,
uint256 expirationTimestamp,
address orderSigner,
uint256 amount,
address sender
);
event Withdrew(address recipient, uint256 amount);
function payForOrder(bytes calldata encodedData) external payable;
function withdraw(address recipient) external returns (uint256 amount);
// solhint-disable-next-line func-name-mixedcase
function ORDER_SIGNER_ROLE_DESCRIPTION()
external
view
returns (string memory);
// solhint-disable-next-line func-name-mixedcase
function WITHDRAWER_ROLE_DESCRIPTION()
external
view
returns (string memory);
function orderSignerRole() external view returns (bytes32);
function withdrawerRole() external view returns (bytes32);
function orderIdToPaymentStatus(
bytes32 orderId
) external view returns (bool paymentStatus);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ISelfMulticall {
function multicall(
bytes[] calldata data
) external returns (bytes[] memory returndata);
function tryMulticall(
bytes[] calldata data
) external returns (bool[] memory successes, bytes[] memory returndata);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/ISelfMulticall.sol";
/// @title Contract that enables calls to the inheriting contract to be batched
/// @notice Implements two ways of batching, one requires none of the calls to
/// revert and the other tolerates individual calls reverting
/// @dev This implementation uses delegatecall for individual function calls.
/// Since delegatecall is a message call, it can only be made to functions that
/// are externally visible. This means that a contract cannot multicall its own
/// functions that use internal/private visibility modifiers.
/// Refer to OpenZeppelin's Multicall.sol for a similar implementation.
contract SelfMulticall is ISelfMulticall {
/// @notice Batches calls to the inheriting contract and reverts as soon as
/// one of the batched calls reverts
/// @param data Array of calldata of batched calls
/// @return returndata Array of returndata of batched calls
function multicall(
bytes[] calldata data
) external override returns (bytes[] memory returndata) {
uint256 callCount = data.length;
returndata = new bytes[](callCount);
for (uint256 ind = 0; ind < callCount; ) {
bool success;
// solhint-disable-next-line avoid-low-level-calls
(success, returndata[ind]) = address(this).delegatecall(data[ind]);
if (!success) {
bytes memory returndataWithRevertData = returndata[ind];
if (returndataWithRevertData.length > 0) {
// Adapted from OpenZeppelin's Address.sol
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndataWithRevertData)
revert(
add(32, returndataWithRevertData),
returndata_size
)
}
} else {
revert("Multicall: No revert string");
}
}
unchecked {
ind++;
}
}
}
/// @notice Batches calls to the inheriting contract but does not revert if
/// any of the batched calls reverts
/// @param data Array of calldata of batched calls
/// @return successes Array of success conditions of batched calls
/// @return returndata Array of returndata of batched calls
function tryMulticall(
bytes[] calldata data
)
external
override
returns (bool[] memory successes, bytes[] memory returndata)
{
uint256 callCount = data.length;
successes = new bool[](callCount);
returndata = new bytes[](callCount);
for (uint256 ind = 0; ind < callCount; ) {
// solhint-disable-next-line avoid-low-level-calls
(successes[ind], returndata[ind]) = address(this).delegatecall(
data[ind]
);
unchecked {
ind++;
}
}
}
}{
"optimizer": {
"enabled": true,
"runs": 1000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_accessControlRegistry","type":"address"},{"internalType":"string","name":"_adminRoleDescription","type":"string"},{"internalType":"address","name":"_manager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"expirationTimestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"orderSigner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"PaidForOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrew","type":"event"},{"inputs":[],"name":"ORDER_SIGNER_ROLE_DESCRIPTION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAWER_ROLE_DESCRIPTION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accessControlRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminRole","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminRoleDescription","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"manager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"returndata","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"orderIdToPaymentStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"orderSignerRole","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedData","type":"bytes"}],"name":"payForOrder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"tryMulticall","outputs":[{"internalType":"bool[]","name":"successes","type":"bool[]"},{"internalType":"bytes[]","name":"returndata","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawerRole","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6101406040523480156200001257600080fd5b5060405162001a5338038062001a53833981016040819052620000359162000368565b82828282826001600160a01b038216620000895760405162461bcd60e51b815260206004820152601060248201526f4143522061646472657373207a65726f60801b60448201526064015b60405180910390fd5b6000815111620000dc5760405162461bcd60e51b815260206004820152601c60248201527f41646d696e20726f6c65206465736372697074696f6e20656d70747900000000604482015260640162000080565b6001600160a01b0382166080526000620000f78282620004d7565b50806040516020016200010b9190620005a3565b60408051601f19818403018152919052805160209091012060a05250506001600160a01b038116620001805760405162461bcd60e51b815260206004820152601460248201527f4d616e616765722061646472657373207a65726f000000000000000000000000604482015260640162000080565b6001600160a01b03811660c052620001988162000226565b60e052505060c051620001da9150620001b19062000226565b60408051808201909152600c81526b27b93232b91039b4b3b732b960a11b6020820152620002a0565b6101005260c0516200021890620001f19062000226565b60408051808201909152600a8152692bb4ba34323930bbb2b960b11b6020820152620002a0565b6101205250620005c1915050565b60006200029a6200026b836040516001600160601b0319606083901b166020820152600090603401604051602081830303815290604052805190602001209050919050565b60a051604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92915050565b6000620002dc8383604051602001620002ba9190620005a3565b60405160208183030381529060405280519060200120620002e360201b60201c565b9392505050565b604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b80516001600160a01b03811681146200032757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200035f57818101518382015260200162000345565b50506000910152565b6000806000606084860312156200037e57600080fd5b62000389846200030f565b60208501519093506001600160401b0380821115620003a757600080fd5b818601915086601f830112620003bc57600080fd5b815181811115620003d157620003d16200032c565b604051601f8201601f19908116603f01168101908382118183101715620003fc57620003fc6200032c565b816040528281528960208487010111156200041657600080fd5b6200042983602083016020880162000342565b80965050505050506200043f604085016200030f565b90509250925092565b600181811c908216806200045d57607f821691505b6020821081036200047e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004d257600081815260208120601f850160051c81016020861015620004ad5750805b601f850160051c820191505b81811015620004ce57828155600101620004b9565b5050505b505050565b81516001600160401b03811115620004f357620004f36200032c565b6200050b8162000504845462000448565b8462000484565b602080601f8311600181146200054357600084156200052a5750858301515b600019600386901b1c1916600185901b178555620004ce565b600085815260208120601f198616915b82811015620005745788860151825594840194600190910190840162000553565b5085821015620005935787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251620005b781846020870162000342565b9190910192915050565b60805160a05160c05160e051610100516101205161141c620006376000396000818161031e01526105c0015260008181610274015261089f0152600060e80152600081816101e90152818161058a01526108570152600050506000818161016f015281816105ec01526108d5015261141c6000f3fe6080604052600436106100d15760003560e01c806351cff8d91161007f578063a6c2b00b11610059578063a6c2b00b14610296578063ac9650d8146102df578063e8597c371461030c578063f1939bd01461034057600080fd5b806351cff8d91461022d5780639407d9481461024d578063a0205fd51461026257600080fd5b8063437b9116116100b0578063437b9116146101a9578063481c6a75146101d75780634c8f1d8d1461020b57600080fd5b80629f2f3c146100d65780630b383b351461011d5780631ce9ae071461015d575b600080fd5b3480156100e257600080fd5b5061010a7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b34801561012957600080fd5b5061014d610138366004610fdc565b60016020526000908152604090205460ff1681565b6040519015158152602001610114565b34801561016957600080fd5b506101917f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610114565b3480156101b557600080fd5b506101c96101c4366004610ff5565b610389565b604051610114929190611108565b3480156101e357600080fd5b506101917f000000000000000000000000000000000000000000000000000000000000000081565b34801561021757600080fd5b506102206104ef565b6040516101149190611161565b34801561023957600080fd5b5061010a610248366004611190565b61057d565b61026061025b3660046111ad565b61079e565b005b34801561026e57600080fd5b5061010a7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a257600080fd5b506102206040518060400160405280600c81526020017f4f72646572207369676e6572000000000000000000000000000000000000000081525081565b3480156102eb57600080fd5b506102ff6102fa366004610ff5565b610bc6565b604051610114919061120d565b34801561031857600080fd5b5061010a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561034c57600080fd5b506102206040518060400160405280600a81526020017f576974686472617765720000000000000000000000000000000000000000000081525081565b606080828067ffffffffffffffff8111156103a6576103a6611220565b6040519080825280602002602001820160405280156103cf578160200160208202803683370190505b5092508067ffffffffffffffff8111156103eb576103eb611220565b60405190808252806020026020018201604052801561041e57816020015b60608152602001906001900390816104095790505b50915060005b818110156104e6573086868381811061043f5761043f611236565b9050602002810190610451919061124c565b60405161045f929190611293565b600060405180830381855af49150503d806000811461049a576040519150601f19603f3d011682016040523d82523d6000602084013e61049f565b606091505b508583815181106104b2576104b2611236565b602002602001018584815181106104cb576104cb611236565b60209081029190910101919091529015159052600101610424565b50509250929050565b600080546104fc906112a3565b80601f0160208091040260200160405190810160405280929190818152602001828054610528906112a3565b80156105755780601f1061054a57610100808354040283529160200191610575565b820191906000526020600020905b81548152906001019060200180831161055857829003601f168201915b505050505081565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061065f5750604051632474521560e21b81527f000000000000000000000000000000000000000000000000000000000000000060048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906391d1485490604401602060405180830381865afa15801561063b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f91906112d7565b6106b05760405162461bcd60e51b815260206004820152601660248201527f53656e6465722063616e6e6f742077697468647261770000000000000000000060448201526064015b60405180910390fd5b50604080516001600160a01b03831681524760208201819052917fb244b9a17ad633c6e83b7983ee04320484956a68ddbe96a0b70dfca1cf19d723910160405180910390a16000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610742576040519150601f19603f3d011682016040523d82523d6000602084013e610747565b606091505b50509050806107985760405162461bcd60e51b815260206004820152601560248201527f5472616e7366657220756e7375636365737366756c000000000000000000000060448201526064016106a7565b50919050565b60008080806107af858701876112f9565b92965090945092509050836108065760405162461bcd60e51b815260206004820152600d60248201527f4f72646572204944207a65726f0000000000000000000000000000000000000060448201526064016106a7565b4283116108555760405162461bcd60e51b815260206004820152600d60248201527f4f7264657220657870697265640000000000000000000000000000000000000060448201526064016106a7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614806109405750604051632474521560e21b81527f000000000000000000000000000000000000000000000000000000000000000060048201526001600160a01b0383811660248301527f000000000000000000000000000000000000000000000000000000000000000016906391d1485490604401602060405180830381865afa15801561091c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094091906112d7565b61098c5760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964206f72646572207369676e657200000000000000000000000060448201526064016106a7565b600034116109dc5760405162461bcd60e51b815260206004820152601360248201527f5061796d656e7420616d6f756e74207a65726f0000000000000000000000000060448201526064016106a7565b60008481526001602052604090205460ff1615610a3b5760405162461bcd60e51b815260206004820152601660248201527f4f7264657220616c7265616479207061696420666f720000000000000000000060448201526064016106a7565b604080514660208201526bffffffffffffffffffffffff193060601b169181019190915260548101859052607481018490523460948201526001600160a01b03831690610afa908390610af49060b401604051602081830303815290604052805190602001206040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90610d47565b6001600160a01b031614610b505760405162461bcd60e51b815260206004820152601260248201527f5369676e6174757265206d69736d61746368000000000000000000000000000060448201526064016106a7565b600084815260016020818152604092839020805460ff191690921790915581518581526001600160a01b038516918101919091523481830152336060820152905185917fcea2cefca5c9f04181778e454977dc18ae35a22f8bb78043f2edb63a0adf4e9f919081900360800190a2505050505050565b6060818067ffffffffffffffff811115610be257610be2611220565b604051908082528060200260200182016040528015610c1557816020015b6060815260200190600190039081610c005790505b50915060005b81811015610d3f57600030868684818110610c3857610c38611236565b9050602002810190610c4a919061124c565b604051610c58929190611293565b600060405180830381855af49150503d8060008114610c93576040519150601f19603f3d011682016040523d82523d6000602084013e610c98565b606091505b50858481518110610cab57610cab611236565b6020908102919091010152905080610d36576000848381518110610cd157610cd1611236565b60200260200101519050600081511115610cee5780518082602001fd5b60405162461bcd60e51b815260206004820152601b60248201527f4d756c746963616c6c3a204e6f2072657665727420737472696e67000000000060448201526064016106a7565b50600101610c1b565b505092915050565b6000806000610d568585610d6b565b91509150610d6381610db0565b509392505050565b6000808251604103610da15760208301516040840151606085015160001a610d9587828585610f18565b94509450505050610da9565b506000905060025b9250929050565b6000816004811115610dc457610dc46113d0565b03610dcc5750565b6001816004811115610de057610de06113d0565b03610e2d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106a7565b6002816004811115610e4157610e416113d0565b03610e8e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106a7565b6003816004811115610ea257610ea26113d0565b03610f155760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016106a7565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610f4f5750600090506003610fd3565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610fa3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610fcc57600060019250925050610fd3565b9150600090505b94509492505050565b600060208284031215610fee57600080fd5b5035919050565b6000806020838503121561100857600080fd5b823567ffffffffffffffff8082111561102057600080fd5b818501915085601f83011261103457600080fd5b81358181111561104357600080fd5b8660208260051b850101111561105857600080fd5b60209290920196919550909350505050565b6000815180845260005b8181101561109057602081850181015186830182015201611074565b506000602082860101526020601f19601f83011685010191505092915050565b600082825180855260208086019550808260051b84010181860160005b848110156110fb57601f198684030189526110e983835161106a565b988401989250908301906001016110cd565b5090979650505050505050565b604080825283519082018190526000906020906060840190828701845b82811015611143578151151584529284019290840190600101611125565b5050508381038285015261115781866110b0565b9695505050505050565b602081526000611174602083018461106a565b9392505050565b6001600160a01b0381168114610f1557600080fd5b6000602082840312156111a257600080fd5b81356111748161117b565b600080602083850312156111c057600080fd5b823567ffffffffffffffff808211156111d857600080fd5b818501915085601f8301126111ec57600080fd5b8135818111156111fb57600080fd5b86602082850101111561105857600080fd5b60208152600061117460208301846110b0565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261126357600080fd5b83018035915067ffffffffffffffff82111561127e57600080fd5b602001915036819003821315610da957600080fd5b8183823760009101908152919050565b600181811c908216806112b757607f821691505b60208210810361079857634e487b7160e01b600052602260045260246000fd5b6000602082840312156112e957600080fd5b8151801515811461117457600080fd5b6000806000806080858703121561130f57600080fd5b843593506020850135925060408501356113288161117b565b9150606085013567ffffffffffffffff8082111561134557600080fd5b818701915087601f83011261135957600080fd5b81358181111561136b5761136b611220565b604051601f8201601f19908116603f0116810190838211818310171561139357611393611220565b816040528281528a60208487010111156113ac57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b634e487b7160e01b600052602160045260246000fdfea26469706673582212201c8673f767e549a40a2e58f8c4b6bdaed945704b7e938b6dab7e0537b628038864736f6c63430008110033000000000000000000000000cd7df573b0f0bb4f2f8dfff6650cde8c77431730000000000000000000000000000000000000000000000000000000000000006000000000000000000000000081bc85f329cdb28936fbb239f734ae495121f9a600000000000000000000000000000000000000000000000000000000000000204f7264657250617961626c652061646d696e202841504933204d61726b657429
Deployed Bytecode
0x6080604052600436106100d15760003560e01c806351cff8d91161007f578063a6c2b00b11610059578063a6c2b00b14610296578063ac9650d8146102df578063e8597c371461030c578063f1939bd01461034057600080fd5b806351cff8d91461022d5780639407d9481461024d578063a0205fd51461026257600080fd5b8063437b9116116100b0578063437b9116146101a9578063481c6a75146101d75780634c8f1d8d1461020b57600080fd5b80629f2f3c146100d65780630b383b351461011d5780631ce9ae071461015d575b600080fd5b3480156100e257600080fd5b5061010a7ff3dec9a56e5e1ac92752f7dc5546a8a67e62c4f1e23cb4693148efa2250e092981565b6040519081526020015b60405180910390f35b34801561012957600080fd5b5061014d610138366004610fdc565b60016020526000908152604090205460ff1681565b6040519015158152602001610114565b34801561016957600080fd5b506101917f000000000000000000000000cd7df573b0f0bb4f2f8dfff6650cde8c7743173081565b6040516001600160a01b039091168152602001610114565b3480156101b557600080fd5b506101c96101c4366004610ff5565b610389565b604051610114929190611108565b3480156101e357600080fd5b506101917f00000000000000000000000081bc85f329cdb28936fbb239f734ae495121f9a681565b34801561021757600080fd5b506102206104ef565b6040516101149190611161565b34801561023957600080fd5b5061010a610248366004611190565b61057d565b61026061025b3660046111ad565b61079e565b005b34801561026e57600080fd5b5061010a7fb88ff5baa36e036e8a9b2fe011af455b5d44f6302c9a635dffb4ad5c587186d881565b3480156102a257600080fd5b506102206040518060400160405280600c81526020017f4f72646572207369676e6572000000000000000000000000000000000000000081525081565b3480156102eb57600080fd5b506102ff6102fa366004610ff5565b610bc6565b604051610114919061120d565b34801561031857600080fd5b5061010a7f836efdc9d1d1fafff18fbe353b685c10abdd69a135a1a659172226a91fa8133881565b34801561034c57600080fd5b506102206040518060400160405280600a81526020017f576974686472617765720000000000000000000000000000000000000000000081525081565b606080828067ffffffffffffffff8111156103a6576103a6611220565b6040519080825280602002602001820160405280156103cf578160200160208202803683370190505b5092508067ffffffffffffffff8111156103eb576103eb611220565b60405190808252806020026020018201604052801561041e57816020015b60608152602001906001900390816104095790505b50915060005b818110156104e6573086868381811061043f5761043f611236565b9050602002810190610451919061124c565b60405161045f929190611293565b600060405180830381855af49150503d806000811461049a576040519150601f19603f3d011682016040523d82523d6000602084013e61049f565b606091505b508583815181106104b2576104b2611236565b602002602001018584815181106104cb576104cb611236565b60209081029190910101919091529015159052600101610424565b50509250929050565b600080546104fc906112a3565b80601f0160208091040260200160405190810160405280929190818152602001828054610528906112a3565b80156105755780601f1061054a57610100808354040283529160200191610575565b820191906000526020600020905b81548152906001019060200180831161055857829003601f168201915b505050505081565b6000336001600160a01b037f00000000000000000000000081bc85f329cdb28936fbb239f734ae495121f9a616148061065f5750604051632474521560e21b81527f836efdc9d1d1fafff18fbe353b685c10abdd69a135a1a659172226a91fa8133860048201523360248201527f000000000000000000000000cd7df573b0f0bb4f2f8dfff6650cde8c774317306001600160a01b0316906391d1485490604401602060405180830381865afa15801561063b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f91906112d7565b6106b05760405162461bcd60e51b815260206004820152601660248201527f53656e6465722063616e6e6f742077697468647261770000000000000000000060448201526064015b60405180910390fd5b50604080516001600160a01b03831681524760208201819052917fb244b9a17ad633c6e83b7983ee04320484956a68ddbe96a0b70dfca1cf19d723910160405180910390a16000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610742576040519150601f19603f3d011682016040523d82523d6000602084013e610747565b606091505b50509050806107985760405162461bcd60e51b815260206004820152601560248201527f5472616e7366657220756e7375636365737366756c000000000000000000000060448201526064016106a7565b50919050565b60008080806107af858701876112f9565b92965090945092509050836108065760405162461bcd60e51b815260206004820152600d60248201527f4f72646572204944207a65726f0000000000000000000000000000000000000060448201526064016106a7565b4283116108555760405162461bcd60e51b815260206004820152600d60248201527f4f7264657220657870697265640000000000000000000000000000000000000060448201526064016106a7565b7f00000000000000000000000081bc85f329cdb28936fbb239f734ae495121f9a66001600160a01b0316826001600160a01b031614806109405750604051632474521560e21b81527fb88ff5baa36e036e8a9b2fe011af455b5d44f6302c9a635dffb4ad5c587186d860048201526001600160a01b0383811660248301527f000000000000000000000000cd7df573b0f0bb4f2f8dfff6650cde8c7743173016906391d1485490604401602060405180830381865afa15801561091c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094091906112d7565b61098c5760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964206f72646572207369676e657200000000000000000000000060448201526064016106a7565b600034116109dc5760405162461bcd60e51b815260206004820152601360248201527f5061796d656e7420616d6f756e74207a65726f0000000000000000000000000060448201526064016106a7565b60008481526001602052604090205460ff1615610a3b5760405162461bcd60e51b815260206004820152601660248201527f4f7264657220616c7265616479207061696420666f720000000000000000000060448201526064016106a7565b604080514660208201526bffffffffffffffffffffffff193060601b169181019190915260548101859052607481018490523460948201526001600160a01b03831690610afa908390610af49060b401604051602081830303815290604052805190602001206040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90610d47565b6001600160a01b031614610b505760405162461bcd60e51b815260206004820152601260248201527f5369676e6174757265206d69736d61746368000000000000000000000000000060448201526064016106a7565b600084815260016020818152604092839020805460ff191690921790915581518581526001600160a01b038516918101919091523481830152336060820152905185917fcea2cefca5c9f04181778e454977dc18ae35a22f8bb78043f2edb63a0adf4e9f919081900360800190a2505050505050565b6060818067ffffffffffffffff811115610be257610be2611220565b604051908082528060200260200182016040528015610c1557816020015b6060815260200190600190039081610c005790505b50915060005b81811015610d3f57600030868684818110610c3857610c38611236565b9050602002810190610c4a919061124c565b604051610c58929190611293565b600060405180830381855af49150503d8060008114610c93576040519150601f19603f3d011682016040523d82523d6000602084013e610c98565b606091505b50858481518110610cab57610cab611236565b6020908102919091010152905080610d36576000848381518110610cd157610cd1611236565b60200260200101519050600081511115610cee5780518082602001fd5b60405162461bcd60e51b815260206004820152601b60248201527f4d756c746963616c6c3a204e6f2072657665727420737472696e67000000000060448201526064016106a7565b50600101610c1b565b505092915050565b6000806000610d568585610d6b565b91509150610d6381610db0565b509392505050565b6000808251604103610da15760208301516040840151606085015160001a610d9587828585610f18565b94509450505050610da9565b506000905060025b9250929050565b6000816004811115610dc457610dc46113d0565b03610dcc5750565b6001816004811115610de057610de06113d0565b03610e2d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106a7565b6002816004811115610e4157610e416113d0565b03610e8e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106a7565b6003816004811115610ea257610ea26113d0565b03610f155760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016106a7565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610f4f5750600090506003610fd3565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610fa3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610fcc57600060019250925050610fd3565b9150600090505b94509492505050565b600060208284031215610fee57600080fd5b5035919050565b6000806020838503121561100857600080fd5b823567ffffffffffffffff8082111561102057600080fd5b818501915085601f83011261103457600080fd5b81358181111561104357600080fd5b8660208260051b850101111561105857600080fd5b60209290920196919550909350505050565b6000815180845260005b8181101561109057602081850181015186830182015201611074565b506000602082860101526020601f19601f83011685010191505092915050565b600082825180855260208086019550808260051b84010181860160005b848110156110fb57601f198684030189526110e983835161106a565b988401989250908301906001016110cd565b5090979650505050505050565b604080825283519082018190526000906020906060840190828701845b82811015611143578151151584529284019290840190600101611125565b5050508381038285015261115781866110b0565b9695505050505050565b602081526000611174602083018461106a565b9392505050565b6001600160a01b0381168114610f1557600080fd5b6000602082840312156111a257600080fd5b81356111748161117b565b600080602083850312156111c057600080fd5b823567ffffffffffffffff808211156111d857600080fd5b818501915085601f8301126111ec57600080fd5b8135818111156111fb57600080fd5b86602082850101111561105857600080fd5b60208152600061117460208301846110b0565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261126357600080fd5b83018035915067ffffffffffffffff82111561127e57600080fd5b602001915036819003821315610da957600080fd5b8183823760009101908152919050565b600181811c908216806112b757607f821691505b60208210810361079857634e487b7160e01b600052602260045260246000fd5b6000602082840312156112e957600080fd5b8151801515811461117457600080fd5b6000806000806080858703121561130f57600080fd5b843593506020850135925060408501356113288161117b565b9150606085013567ffffffffffffffff8082111561134557600080fd5b818701915087601f83011261135957600080fd5b81358181111561136b5761136b611220565b604051601f8201601f19908116603f0116810190838211818310171561139357611393611220565b816040528281528a60208487010111156113ac57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b634e487b7160e01b600052602160045260246000fdfea26469706673582212201c8673f767e549a40a2e58f8c4b6bdaed945704b7e938b6dab7e0537b628038864736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000cd7df573b0f0bb4f2f8dfff6650cde8c77431730000000000000000000000000000000000000000000000000000000000000006000000000000000000000000081bc85f329cdb28936fbb239f734ae495121f9a600000000000000000000000000000000000000000000000000000000000000204f7264657250617961626c652061646d696e202841504933204d61726b657429
-----Decoded View---------------
Arg [0] : _accessControlRegistry (address): 0xcD7Df573B0F0bb4F2f8dFFF6650cDe8C77431730
Arg [1] : _adminRoleDescription (string): OrderPayable admin (API3 Market)
Arg [2] : _manager (address): 0x81bc85f329cDB28936FbB239f734AE495121F9A6
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000cd7df573b0f0bb4f2f8dfff6650cde8c77431730
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 00000000000000000000000081bc85f329cdb28936fbb239f734ae495121f9a6
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [4] : 4f7264657250617961626c652061646d696e202841504933204d61726b657429
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.