Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 166 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 19131488 | 341 days ago | IN | 0 ETH | 0.00049152 | ||||
Store Svg Layer | 19102501 | 345 days ago | IN | 0 ETH | 0.00331997 | ||||
Delete Svg Layer | 19102499 | 345 days ago | IN | 0 ETH | 0.00029075 | ||||
Store Svg Layer | 19100464 | 345 days ago | IN | 0 ETH | 0.00334077 | ||||
Delete Svg Layer | 19100463 | 345 days ago | IN | 0 ETH | 0.000297 | ||||
Store Svg Layer | 19100421 | 345 days ago | IN | 0 ETH | 0.00227718 | ||||
Delete Svg Layer | 19100419 | 345 days ago | IN | 0 ETH | 0.00030607 | ||||
Store Svg Layer | 19100313 | 345 days ago | IN | 0 ETH | 0.00225808 | ||||
Delete Svg Layer | 19100310 | 345 days ago | IN | 0 ETH | 0.00029333 | ||||
Store Svg Layer | 19099768 | 345 days ago | IN | 0 ETH | 0.00420382 | ||||
Store Svg Layer | 19099689 | 345 days ago | IN | 0 ETH | 0.08979911 | ||||
Store Svg Layer | 19099686 | 345 days ago | IN | 0 ETH | 0.10371634 | ||||
Store Svg Layer | 19046676 | 353 days ago | IN | 0 ETH | 0.00722072 | ||||
Store Svg Layer | 19046673 | 353 days ago | IN | 0 ETH | 0.00254809 | ||||
Store Svg Layer | 19046671 | 353 days ago | IN | 0 ETH | 0.00249296 | ||||
Store Svg Layer | 19046669 | 353 days ago | IN | 0 ETH | 0.00399094 | ||||
Store Svg Layer | 19046666 | 353 days ago | IN | 0 ETH | 0.00456681 | ||||
Store Svg Layer | 19046664 | 353 days ago | IN | 0 ETH | 0.00434236 | ||||
Store Svg Layer | 19046661 | 353 days ago | IN | 0 ETH | 0.00622027 | ||||
Store Svg Layer | 19046658 | 353 days ago | IN | 0 ETH | 0.00429133 | ||||
Store Svg Layer | 19046648 | 353 days ago | IN | 0 ETH | 0.00607174 | ||||
Store Svg Layer | 19046646 | 353 days ago | IN | 0 ETH | 0.00354911 | ||||
Store Svg Layer | 19046644 | 353 days ago | IN | 0 ETH | 0.00424784 | ||||
Store Svg Layer | 19046641 | 353 days ago | IN | 0 ETH | 0.0044066 | ||||
Store Svg Layer | 19046639 | 353 days ago | IN | 0 ETH | 0.00567075 |
Latest 25 internal transactions (View All)
Advanced mode:
Loading...
Loading
Contract Name:
LayerStore
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // Simple contract to store large strings of text for use in other contracts. // 1. Owner has the ability to store text strings of any size by writing to the same layer multiple times. // 2. Max write size per write is 24kb. // 3. Layers can be deleted and re-written if necessary. // Credit to 0xsequence for SSTORE2 utilized in this contract. pragma solidity >=0.8.19 <0.9.0; import "./Base64.sol"; import "./SSTORE2.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; contract LayerStore is Ownable { mapping(uint256 => address[]) public svgLayers; constructor() Ownable(msg.sender) {} function storeSvgLayer(uint256 _layerId, string calldata _svgLayer) external onlyOwner { address layerPointer = SSTORE2.write(bytes(_svgLayer)); svgLayers[_layerId].push(layerPointer); } function getSvgLayer(uint256 _layerId) public view returns (string memory) { require(svgLayers[_layerId].length > 0, "LayerStore: Nonexistent layer"); bytes memory svgLayer; for (uint256 i = 0; i < svgLayers[_layerId].length; i++) { svgLayer = abi.encodePacked(svgLayer, SSTORE2.read(svgLayers[_layerId][i])); } return string(svgLayer); } function deleteSvgLayer(uint256 _layerId) external onlyOwner { // Clear the existing array of addresses for this layerId require(svgLayers[_layerId].length > 0, "LayerStore: Nonexistent layer"); delete svgLayers[_layerId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @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), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(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) { uint256 localValue = value; 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] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } 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 bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Bytecode.sol"; /** @title A key-value storage with auto-generated keys for storing chunks of data with a lower write & read cost. @author Agustin Aguilar <[email protected]> Readme: https://github.com/0xsequence/sstore2#readme */ library SSTORE2 { error WriteError(); /** @notice Stores `_data` and returns `pointer` as key for later retrieval @dev The pointer is a contract address with `_data` as code @param _data to be written @return pointer Pointer to the written `_data` */ function write(bytes memory _data) internal returns (address pointer) { // Append 00 to _data so contract can't be called // Build init code bytes memory code = Bytecode.creationCodeFor( abi.encodePacked(hex"00", _data) ); // Deploy contract using create assembly { pointer := create(0, add(code, 32), mload(code)) } // Address MUST be non-zero if (pointer == address(0)) revert WriteError(); } /** @notice Reads the contents of the `_pointer` code as data, skips the first byte @dev The function is intended for reading pointers generated by `write` @param _pointer to be read @return data read from `_pointer` contract */ function read(address _pointer) internal view returns (bytes memory) { return Bytecode.codeAt(_pointer, 1, type(uint256).max); } /** @notice Reads the contents of the `_pointer` code as data, skips the first byte @dev The function is intended for reading pointers generated by `write` @param _pointer to be read @param _start number of bytes to skip @return data read from `_pointer` contract */ function read( address _pointer, uint256 _start ) internal view returns (bytes memory) { return Bytecode.codeAt(_pointer, _start + 1, type(uint256).max); } /** @notice Reads the contents of the `_pointer` code as data, skips the first byte @dev The function is intended for reading pointers generated by `write` @param _pointer to be read @param _start number of bytes to skip @param _end index before which to end extraction @return data read from `_pointer` contract */ function read( address _pointer, uint256 _start, uint256 _end ) internal view returns (bytes memory) { return Bytecode.codeAt(_pointer, _start + 1, _end + 1); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title Base64 /// @author Brecht Devos - <[email protected]> /// @notice Provides a function for encoding some bytes in base64 library Base64 { string internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ""; // load the table into memory string memory table = TABLE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for { } lt(dataPtr, endPtr) { } { dataPtr := add(dataPtr, 3) // read 3 bytes let input := mload(dataPtr) // write 4 characters mstore( resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F)))) ) resultPtr := add(resultPtr, 1) mstore( resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F)))) ) resultPtr := add(resultPtr, 1) mstore( resultPtr, shl(248, mload(add(tablePtr, and(shr(6, input), 0x3F)))) ) resultPtr := add(resultPtr, 1) mstore( resultPtr, shl(248, mload(add(tablePtr, and(input, 0x3F)))) ) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Bytecode { error InvalidCodeAtRange(uint256 _size, uint256 _start, uint256 _end); /** @notice Generate a creation code that results on a contract with `_code` as bytecode @param _code The returning value of the resulting `creationCode` @return creationCode (constructor) for new contract */ function creationCodeFor( bytes memory _code ) internal pure returns (bytes memory) { /* 0x00 0x63 0x63XXXXXX PUSH4 _code.length size 0x01 0x80 0x80 DUP1 size size 0x02 0x60 0x600e PUSH1 14 14 size size 0x03 0x60 0x6000 PUSH1 00 0 14 size size 0x04 0x39 0x39 CODECOPY size 0x05 0x60 0x6000 PUSH1 00 0 size 0x06 0xf3 0xf3 RETURN <CODE> */ return abi.encodePacked( hex"63", uint32(_code.length), hex"80_60_0E_60_00_39_60_00_F3", _code ); } /** @notice Returns the size of the code on a given address @param _addr Address that may or may not contain code @return size of the code on the given `_addr` */ function codeSize(address _addr) internal view returns (uint256 size) { assembly { size := extcodesize(_addr) } } /** @notice Returns the code of a given address @dev It will fail if `_end < _start` @param _addr Address that may or may not contain code @param _start number of bytes of code to skip on read @param _end index before which to end extraction @return oCode read from `_addr` deployed bytecode Forked from: https://gist.github.com/KardanovIR/fe98661df9338c842b4a30306d507fbd */ function codeAt( address _addr, uint256 _start, uint256 _end ) internal view returns (bytes memory oCode) { uint256 csize = codeSize(_addr); if (csize == 0) return bytes(""); if (_start > csize) return bytes(""); if (_end < _start) revert InvalidCodeAtRange(csize, _start, _end); unchecked { uint256 reqSize = _end - _start; uint256 maxSize = csize - _start; uint256 size = maxSize < reqSize ? maxSize : reqSize; assembly { // allocate output byte array - this could also be done without assembly // by using o_code = new bytes(size) oCode := mload(0x40) // new "memory end" including padding mstore( 0x40, add(oCode, and(add(add(size, 0x20), 0x1f), not(0x1f))) ) // store length in memory mstore(oCode, size) // actually retrieve the code, this needs assembly extcodecopy(_addr, add(oCode, 0x20), _start, size) } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @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 (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
{ "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"_size","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"InvalidCodeAtRange","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"WriteError","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"_layerId","type":"uint256"}],"name":"deleteSvgLayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_layerId","type":"uint256"}],"name":"getSvgLayer","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_layerId","type":"uint256"},{"internalType":"string","name":"_svgLayer","type":"string"}],"name":"storeSvgLayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"svgLayers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561000f575f80fd5b50335f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610081575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016100789190610196565b60405180910390fd5b6100908161009660201b60201c565b506101af565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61018082610157565b9050919050565b61019081610176565b82525050565b5f6020820190506101a95f830184610187565b92915050565b610db9806101bc5f395ff3fe608060405234801561000f575f80fd5b506004361061007b575f3560e01c80638da5cb5b116100595780638da5cb5b146100d55780638f2e03a4146100f3578063e64882bc1461010f578063f2fde38b1461013f5761007b565b80633007f4c21461007f57806365f95e2b146100af578063715018a6146100cb575b5f80fd5b6100996004803603810190610094919061085c565b61015b565b6040516100a691906108d9565b60405180910390f35b6100c960048036038101906100c49190610953565b6101a3565b005b6100d361026f565b005b6100dd610282565b6040516100ea91906108d9565b60405180910390f35b61010d600480360381019061010891906109b0565b6102a9565b005b610129600480360381019061012491906109b0565b610326565b6040516101369190610a65565b60405180910390f35b61015960048036038101906101549190610aaf565b61042b565b005b6001602052815f5260405f208181548110610174575f80fd5b905f5260205f20015f915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6101ab6104af565b5f6101f883838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f82011690508083019250505050505050610536565b905060015f8581526020019081526020015f2081908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b6102776104af565b6102805f6105d7565b565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6102b16104af565b5f60015f8381526020019081526020015f208054905011610307576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102fe90610b24565b60405180910390fd5b60015f8281526020019081526020015f205f61032391906107e8565b50565b60605f60015f8481526020019081526020015f20805490501161037e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037590610b24565b60405180910390fd5b60605f5b60015f8581526020019081526020015f208054905081101561042157816103f260015f8781526020019081526020015f2083815481106103c5576103c4610b42565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610698565b604051602001610403929190610bb3565b60405160208183030381529060405291508080600101915050610382565b5080915050919050565b6104336104af565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036104a3575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161049a91906108d9565b60405180910390fd5b6104ac816105d7565b50565b6104b76106cd565b73ffffffffffffffffffffffffffffffffffffffff166104d5610282565b73ffffffffffffffffffffffffffffffffffffffff1614610534576104f86106cd565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161052b91906108d9565b60405180910390fd5b565b5f806105608360405160200161054c9190610c0a565b6040516020818303038152906040526106d4565b90508051602082015ff091505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036105d1576040517f08d4abb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50919050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60606106c68260017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610700565b9050919050565b5f33905090565b60608151826040516020016106ea929190610d02565b6040516020818303038152906040529050919050565b60605f61070c856107de565b90505f810361072c5760405180602001604052805f8152509150506107d7565b8084111561074b5760405180602001604052805f8152509150506107d7565b83831015610794578084846040517f2c4a89fa00000000000000000000000000000000000000000000000000000000815260040161078b93929190610d4e565b60405180910390fd5b5f84840390505f85830390505f8282106107ae57826107b0565b815b90506040519450601f19601f60208301011685016040528085528087602087018a3c505050505b9392505050565b5f813b9050919050565b5080545f8255905f5260205f20908101906108039190610806565b50565b5b8082111561081d575f815f905550600101610807565b5090565b5f80fd5b5f80fd5b5f819050919050565b61083b81610829565b8114610845575f80fd5b50565b5f8135905061085681610832565b92915050565b5f806040838503121561087257610871610821565b5b5f61087f85828601610848565b925050602061089085828601610848565b9150509250929050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6108c38261089a565b9050919050565b6108d3816108b9565b82525050565b5f6020820190506108ec5f8301846108ca565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112610913576109126108f2565b5b8235905067ffffffffffffffff8111156109305761092f6108f6565b5b60208301915083600182028301111561094c5761094b6108fa565b5b9250929050565b5f805f6040848603121561096a57610969610821565b5b5f61097786828701610848565b935050602084013567ffffffffffffffff81111561099857610997610825565b5b6109a4868287016108fe565b92509250509250925092565b5f602082840312156109c5576109c4610821565b5b5f6109d284828501610848565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610a125780820151818401526020810190506109f7565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610a37826109db565b610a4181856109e5565b9350610a518185602086016109f5565b610a5a81610a1d565b840191505092915050565b5f6020820190508181035f830152610a7d8184610a2d565b905092915050565b610a8e816108b9565b8114610a98575f80fd5b50565b5f81359050610aa981610a85565b92915050565b5f60208284031215610ac457610ac3610821565b5b5f610ad184828501610a9b565b91505092915050565b7f4c6179657253746f72653a204e6f6e6578697374656e74206c617965720000005f82015250565b5f610b0e601d836109e5565b9150610b1982610ada565b602082019050919050565b5f6020820190508181035f830152610b3b81610b02565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050919050565b5f81905092915050565b5f610b8d82610b6f565b610b978185610b79565b9350610ba78185602086016109f5565b80840191505092915050565b5f610bbe8285610b83565b9150610bca8284610b83565b91508190509392505050565b5f81905092915050565b5f8082015250565b5f610bf4600183610bd6565b9150610bff82610be0565b600182019050919050565b5f610c1482610be8565b9150610c208284610b83565b915081905092915050565b7f63000000000000000000000000000000000000000000000000000000000000005f82015250565b5f610c5f600183610bd6565b9150610c6a82610c2b565b600182019050919050565b5f63ffffffff82169050919050565b5f8160e01b9050919050565b5f610c9a82610c84565b9050919050565b610cb2610cad82610c75565b610c90565b82525050565b7f80600e6000396000f300000000000000000000000000000000000000000000005f82015250565b5f610cec600983610bd6565b9150610cf782610cb8565b600982019050919050565b5f610d0c82610c53565b9150610d188285610ca1565b600482019150610d2782610ce0565b9150610d338284610b83565b91508190509392505050565b610d4881610829565b82525050565b5f606082019050610d615f830186610d3f565b610d6e6020830185610d3f565b610d7b6040830184610d3f565b94935050505056fea2646970667358221220693f32787d74a6dfb68e43265ba03fe993bd823694eedaf3836215d6388905de64736f6c63430008160033
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061007b575f3560e01c80638da5cb5b116100595780638da5cb5b146100d55780638f2e03a4146100f3578063e64882bc1461010f578063f2fde38b1461013f5761007b565b80633007f4c21461007f57806365f95e2b146100af578063715018a6146100cb575b5f80fd5b6100996004803603810190610094919061085c565b61015b565b6040516100a691906108d9565b60405180910390f35b6100c960048036038101906100c49190610953565b6101a3565b005b6100d361026f565b005b6100dd610282565b6040516100ea91906108d9565b60405180910390f35b61010d600480360381019061010891906109b0565b6102a9565b005b610129600480360381019061012491906109b0565b610326565b6040516101369190610a65565b60405180910390f35b61015960048036038101906101549190610aaf565b61042b565b005b6001602052815f5260405f208181548110610174575f80fd5b905f5260205f20015f915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6101ab6104af565b5f6101f883838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f82011690508083019250505050505050610536565b905060015f8581526020019081526020015f2081908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b6102776104af565b6102805f6105d7565b565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6102b16104af565b5f60015f8381526020019081526020015f208054905011610307576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102fe90610b24565b60405180910390fd5b60015f8281526020019081526020015f205f61032391906107e8565b50565b60605f60015f8481526020019081526020015f20805490501161037e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037590610b24565b60405180910390fd5b60605f5b60015f8581526020019081526020015f208054905081101561042157816103f260015f8781526020019081526020015f2083815481106103c5576103c4610b42565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610698565b604051602001610403929190610bb3565b60405160208183030381529060405291508080600101915050610382565b5080915050919050565b6104336104af565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036104a3575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161049a91906108d9565b60405180910390fd5b6104ac816105d7565b50565b6104b76106cd565b73ffffffffffffffffffffffffffffffffffffffff166104d5610282565b73ffffffffffffffffffffffffffffffffffffffff1614610534576104f86106cd565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161052b91906108d9565b60405180910390fd5b565b5f806105608360405160200161054c9190610c0a565b6040516020818303038152906040526106d4565b90508051602082015ff091505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036105d1576040517f08d4abb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50919050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60606106c68260017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610700565b9050919050565b5f33905090565b60608151826040516020016106ea929190610d02565b6040516020818303038152906040529050919050565b60605f61070c856107de565b90505f810361072c5760405180602001604052805f8152509150506107d7565b8084111561074b5760405180602001604052805f8152509150506107d7565b83831015610794578084846040517f2c4a89fa00000000000000000000000000000000000000000000000000000000815260040161078b93929190610d4e565b60405180910390fd5b5f84840390505f85830390505f8282106107ae57826107b0565b815b90506040519450601f19601f60208301011685016040528085528087602087018a3c505050505b9392505050565b5f813b9050919050565b5080545f8255905f5260205f20908101906108039190610806565b50565b5b8082111561081d575f815f905550600101610807565b5090565b5f80fd5b5f80fd5b5f819050919050565b61083b81610829565b8114610845575f80fd5b50565b5f8135905061085681610832565b92915050565b5f806040838503121561087257610871610821565b5b5f61087f85828601610848565b925050602061089085828601610848565b9150509250929050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6108c38261089a565b9050919050565b6108d3816108b9565b82525050565b5f6020820190506108ec5f8301846108ca565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112610913576109126108f2565b5b8235905067ffffffffffffffff8111156109305761092f6108f6565b5b60208301915083600182028301111561094c5761094b6108fa565b5b9250929050565b5f805f6040848603121561096a57610969610821565b5b5f61097786828701610848565b935050602084013567ffffffffffffffff81111561099857610997610825565b5b6109a4868287016108fe565b92509250509250925092565b5f602082840312156109c5576109c4610821565b5b5f6109d284828501610848565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610a125780820151818401526020810190506109f7565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610a37826109db565b610a4181856109e5565b9350610a518185602086016109f5565b610a5a81610a1d565b840191505092915050565b5f6020820190508181035f830152610a7d8184610a2d565b905092915050565b610a8e816108b9565b8114610a98575f80fd5b50565b5f81359050610aa981610a85565b92915050565b5f60208284031215610ac457610ac3610821565b5b5f610ad184828501610a9b565b91505092915050565b7f4c6179657253746f72653a204e6f6e6578697374656e74206c617965720000005f82015250565b5f610b0e601d836109e5565b9150610b1982610ada565b602082019050919050565b5f6020820190508181035f830152610b3b81610b02565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050919050565b5f81905092915050565b5f610b8d82610b6f565b610b978185610b79565b9350610ba78185602086016109f5565b80840191505092915050565b5f610bbe8285610b83565b9150610bca8284610b83565b91508190509392505050565b5f81905092915050565b5f8082015250565b5f610bf4600183610bd6565b9150610bff82610be0565b600182019050919050565b5f610c1482610be8565b9150610c208284610b83565b915081905092915050565b7f63000000000000000000000000000000000000000000000000000000000000005f82015250565b5f610c5f600183610bd6565b9150610c6a82610c2b565b600182019050919050565b5f63ffffffff82169050919050565b5f8160e01b9050919050565b5f610c9a82610c84565b9050919050565b610cb2610cad82610c75565b610c90565b82525050565b7f80600e6000396000f300000000000000000000000000000000000000000000005f82015250565b5f610cec600983610bd6565b9150610cf782610cb8565b600982019050919050565b5f610d0c82610c53565b9150610d188285610ca1565b600482019150610d2782610ce0565b9150610d338284610b83565b91508190509392505050565b610d4881610829565b82525050565b5f606082019050610d615f830186610d3f565b610d6e6020830185610d3f565b610d7b6040830184610d3f565b94935050505056fea2646970667358221220693f32787d74a6dfb68e43265ba03fe993bd823694eedaf3836215d6388905de64736f6c63430008160033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.