Contract Overview
Balance:
0 FTM
FTM Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0xf4c20af01c7109a6b10c26d287a417ef884d0b8af51f736ded74481f57d6363b | 0x60a08060 | 63079859 | 8 days 10 hrs ago | PaintSwap Finance: Deployer | IN | Create: Clans | 0 FTM | 0.40601277 |
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0xf4c20af01c7109a6b10c26d287a417ef884d0b8af51f736ded74481f57d6363b | 63079859 | 8 days 10 hrs ago | PaintSwap Finance: Deployer | Contract Creation | 0 FTM |
[ Download CSV Export ]
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 Source Code Verified (Exact Match)
Contract Name:
Clans
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 9999999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {UnsafeMath} from '../UnsafeMath.sol'; using UnsafeMath for int256; type I256 is int256; using { add as +, sub as -, mul as *, div as /, mod as %, neq as !=, eq as ==, lt as <, lte as <=, gt as >, gte as >=, and as &, or as |, xor as ^, not as ~ } for I256 global; function add(I256 _i256, I256 _addend) pure returns (I256) { return I256.wrap(I256.unwrap(_i256).add(I256.unwrap(_addend))); } function sub(I256 _i256, I256 _subtrahend) pure returns (I256) { return I256.wrap(I256.unwrap(_i256).sub(I256.unwrap(_subtrahend))); } function mul(I256 _i256, I256 _multiplier) pure returns (I256) { return I256.wrap(I256.unwrap(_i256).mul(I256.unwrap(_multiplier))); } function div(I256 _i256, I256 _divisor) pure returns (I256) { return I256.wrap(I256.unwrap(_i256).div(I256.unwrap(_divisor))); } function mod(I256 _i256, I256 _divisor) pure returns (I256) { return I256.wrap(I256.unwrap(_i256).mod(I256.unwrap(_divisor))); } function and(I256 _i256, I256 _mask) pure returns (I256) { return I256.wrap(I256.unwrap(_i256) & I256.unwrap(_mask)); } function or(I256 _i256, I256 _mask) pure returns (I256) { return I256.wrap(I256.unwrap(_i256) | I256.unwrap(_mask)); } function xor(I256 _i256, I256 _mask) pure returns (I256) { return I256.wrap(I256.unwrap(_i256) ^ I256.unwrap(_mask)); } function not(I256 _i256) pure returns (I256) { return I256.wrap(~I256.unwrap(_i256)); } function neq(I256 _i256, I256 _bounds) pure returns (bool) { return I256.unwrap(_i256) != I256.unwrap(_bounds); } function eq(I256 _i256, I256 _bounds) pure returns (bool) { return I256.unwrap(_i256) == I256.unwrap(_bounds); } function lt(I256 _i256, I256 _bounds) pure returns (bool) { return I256.unwrap(_i256) < I256.unwrap(_bounds); } function lte(I256 _i256, I256 _bounds) pure returns (bool) { return I256.unwrap(_i256) <= I256.unwrap(_bounds); } function gt(I256 _i256, I256 _bounds) pure returns (bool) { return I256.unwrap(_i256) > I256.unwrap(_bounds); } function gte(I256 _i256, I256 _bounds) pure returns (bool) { return I256.unwrap(_i256) >= I256.unwrap(_bounds); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {UnsafeMath} from '../UnsafeMath.sol'; using UnsafeMath for uint256; type U256 is uint256; using { add as +, sub as -, mul as *, div as /, mod as %, neq as !=, eq as ==, lt as <, lte as <=, gt as >, gte as >=, and as &, or as |, xor as ^, not as ~ } for U256 global; function add(U256 _u256, U256 _addend) pure returns (U256) { return U256.wrap(U256.unwrap(_u256).add(U256.unwrap(_addend))); } function sub(U256 _u256, U256 _subtrahend) pure returns (U256) { return U256.wrap(U256.unwrap(_u256).sub(U256.unwrap(_subtrahend))); } function mul(U256 _u256, U256 _multiplier) pure returns (U256) { return U256.wrap(U256.unwrap(_u256).mul(U256.unwrap(_multiplier))); } function div(U256 _u256, U256 _divisor) pure returns (U256) { return U256.wrap(U256.unwrap(_u256).div(U256.unwrap(_divisor))); } function mod(U256 _u256, U256 _divisor) pure returns (U256) { return U256.wrap(U256.unwrap(_u256).mod(U256.unwrap(_divisor))); } function and(U256 _u256, U256 _mask) pure returns (U256) { return U256.wrap(U256.unwrap(_u256) & U256.unwrap(_mask)); } function or(U256 _u256, U256 _mask) pure returns (U256) { return U256.wrap(U256.unwrap(_u256) | U256.unwrap(_mask)); } function xor(U256 _u256, U256 _mask) pure returns (U256) { return U256.wrap(U256.unwrap(_u256) ^ U256.unwrap(_mask)); } function not(U256 _u256) pure returns (U256) { return U256.wrap(~U256.unwrap(_u256)); } function neq(U256 _u256, U256 _bounds) pure returns (bool) { return U256.unwrap(_u256) != U256.unwrap(_bounds); } function eq(U256 _u256, U256 _bounds) pure returns (bool) { return U256.unwrap(_u256) == U256.unwrap(_bounds); } function lt(U256 _u256, U256 _bounds) pure returns (bool) { return U256.unwrap(_u256) < U256.unwrap(_bounds); } function lte(U256 _u256, U256 _bounds) pure returns (bool) { return U256.unwrap(_u256) <= U256.unwrap(_bounds); } function gt(U256 _u256, U256 _bounds) pure returns (bool) { return U256.unwrap(_u256) > U256.unwrap(_bounds); } function gte(U256 _u256, U256 _bounds) pure returns (bool) { return U256.unwrap(_u256) >= U256.unwrap(_bounds); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // solhint-disable func-name-mixedcase import {I256} from './types/I256.sol'; import {U256} from './types/U256.sol'; library UnsafeMath { /********************* * uint256 -> *********************/ /// @dev Returns the addition of two unsigned integers /// @param _uint256 The first unsigned integer /// @param _addend The second unsigned integer /// @return The addition of the two unsigned integers function add(uint256 _uint256, uint256 _addend) internal pure returns (uint256) { unchecked { return _uint256 + _addend; } } /// @dev Returns the subtraction of two unsigned integers /// @param _uint256 The first unsigned integer /// @param _subtrahend The second unsigned integer /// @return The subtraction of the two unsigned integers function sub(uint256 _uint256, uint256 _subtrahend) internal pure returns (uint256) { unchecked { return _uint256 - _subtrahend; } } /// @dev Increments an unsigned integer by one /// @param _uint256 The unsigned integer /// @return The incremented unsigned integer function inc(uint256 _uint256) internal pure returns (uint256) { unchecked { return ++_uint256; } } /// @dev Decrements an unsigned integer by one /// @param _uint256 The unsigned integer /// @return The decremented unsigned integer function dec(uint256 _uint256) internal pure returns (uint256) { unchecked { return --_uint256; } } /// @dev Returns the multiplication of two unsigned integers /// @param _uint256 The first unsigned integer /// @param _multiplier The second unsigned integer /// @return The multiplication of the two unsigned integers function mul(uint256 _uint256, uint256 _multiplier) internal pure returns (uint256) { unchecked { return _uint256 * _multiplier; } } /// @dev Returns the exponentiation of two unsigned integers /// @param _uint256 The first unsigned integer /// @param _exponent The second unsigned integer /// @return The exponentiation of the two unsigned integers function exp(uint256 _uint256, uint256 _exponent) internal pure returns (uint256) { uint256 result; // solhint-disable-next-line no-inline-assembly assembly { result := exp(_uint256, _exponent) } return result; } /// @dev Returns the division of two unsigned integers /// @param _uint256 The first unsigned integer /// @param _divisor The second unsigned integer /// @return The division of the two unsigned integers function div(uint256 _uint256, uint256 _divisor) internal pure returns (uint256) { uint256 result; // solhint-disable-next-line no-inline-assembly assembly { result := div(_uint256, _divisor) } return result; } /// @dev Returns the remainder of the division of two unsigned integers /// @param _uint256 The first unsigned integer /// @param _divisor The second unsigned integer /// @return The remainder of the division of the two unsigned integers function mod(uint256 _uint256, uint256 _divisor) internal pure returns (uint256) { uint256 result; // solhint-disable-next-line no-inline-assembly assembly { result := mod(_uint256, _divisor) } return result; } /********************* * int256 -> *********************/ /// @dev Returns the addition of two signed integers /// @param _int256 The first signed integer /// @param _addend The second signed integer /// @return The addition of the two signed integers function add(int256 _int256, int256 _addend) internal pure returns (int256) { unchecked { return _int256 + _addend; } } /// @dev Returns the subtraction of two signed integers /// @param _int256 The first signed integer /// @param _subtrahend The second signed integer /// @return The subtraction of the two signed integers function sub(int256 _int256, int256 _subtrahend) internal pure returns (int256) { unchecked { return _int256 - _subtrahend; } } /// @dev Increments a signed integer by one /// @param _int256 The signed integer /// @return The incremented signed integer function inc(int256 _int256) internal pure returns (int256) { unchecked { return ++_int256; } } /// @dev Decrements a signed integer by one /// @param _int256 The signed integer /// @return The decremented signed integer function dec(int256 _int256) internal pure returns (int256) { unchecked { return --_int256; } } /// @dev Returns the multiplication of two signed integers /// @param _int256 The first signed integer /// @param _multiplier The second signed integer /// @return The multiplication of the two signed integers function mul(int256 _int256, int256 _multiplier) internal pure returns (int256) { unchecked { return _int256 * _multiplier; } } /// @dev Returns the division of two signed integers /// @param _int256 The first signed integer /// @param _divisor The second signed integer /// @return The division of the two signed integers function div(int256 _int256, int256 _divisor) internal pure returns (int256) { int256 result; // solhint-disable-next-line no-inline-assembly assembly { result := sdiv(_int256, _divisor) } return result; } /// @dev Returns the remainder of the division of two signed integers /// @param _int256 The first signed integer /// @param _divisor The second signed integer /// @return The remainder of the division of the two signed integers function mod(int256 _int256, int256 _divisor) internal pure returns (int256) { int256 result; // solhint-disable-next-line no-inline-assembly assembly { result := smod(_int256, _divisor) } return result; } /********************* * I256 -> *********************/ /// @dev Wraps an int256 into an I256 /// @param _i256 The int256 to wrap /// @return i256 The wrapped I256 function asI256(int256 _i256) internal pure returns (I256 i256) { return I256.wrap(_i256); } /// @dev Wraps a uint256 into an I256 /// @param _i256 The uint256 to wrap /// @return i256 The wrapped I256 function asI256(uint256 _i256) internal pure returns (I256 i256) { return I256.wrap(int256(_i256)); } /// @dev Converts an I256 to a signed int256 /// @param _i256 The I256 to convert /// @return signed The signed int256 function asInt256(I256 _i256) internal pure returns (int256 signed) { return I256.unwrap(_i256); } /// @dev Converts an I256 to a signed int248 /// @param _i256 The I256 to convert /// @return signed The signed int248 function asInt248(I256 _i256) internal pure returns (int248 signed) { return int248(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int240 /// @param _i256 The I256 to convert /// @return signed The signed int240 function asInt240(I256 _i256) internal pure returns (int240 signed) { return int240(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int232 /// @param _i256 The I256 to convert /// @return signed The signed int232 function asInt232(I256 _i256) internal pure returns (int232 signed) { return int232(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int224 /// @param _i256 The I256 to convert /// @return signed The signed int224 function asInt224(I256 _i256) internal pure returns (int224 signed) { return int224(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int216 /// @param _i256 The I256 to convert /// @return signed The signed int216 function asInt216(I256 _i256) internal pure returns (int216 signed) { return int216(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int208 /// @param _i256 The I256 to convert /// @return signed The signed int208 function asInt208(I256 _i256) internal pure returns (int208 signed) { return int208(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int200 /// @param _i256 The I256 to convert /// @return signed The signed int200 function asInt200(I256 _i256) internal pure returns (int200 signed) { return int200(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int192 /// @param _i256 The I256 to convert /// @return signed The signed int192 function asInt192(I256 _i256) internal pure returns (int192 signed) { return int192(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int184 /// @param _i256 The I256 to convert /// @return signed The signed int184 function asInt184(I256 _i256) internal pure returns (int184 signed) { return int184(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int176 /// @param _i256 The I256 to convert /// @return signed The signed int176 function asInt176(I256 _i256) internal pure returns (int176 signed) { return int176(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int168 /// @param _i256 The I256 to convert /// @return signed The signed int168 function asInt168(I256 _i256) internal pure returns (int168 signed) { return int168(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int160 /// @param _i256 The I256 to convert /// @return signed The signed int160 function asInt160(I256 _i256) internal pure returns (int160 signed) { return int160(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int152 /// @param _i256 The I256 to convert /// @return signed The signed int152 function asInt152(I256 _i256) internal pure returns (int152 signed) { return int152(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int144 /// @param _i256 The I256 to convert /// @return signed The signed int144 function asInt144(I256 _i256) internal pure returns (int144 signed) { return int144(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int136 /// @param _i256 The I256 to convert /// @return signed The signed int136 function asInt136(I256 _i256) internal pure returns (int136 signed) { return int136(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int128 /// @param _i256 The I256 to convert /// @return signed The signed int128 function asInt128(I256 _i256) internal pure returns (int128 signed) { return int128(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int120 /// @param _i256 The I256 to convert /// @return signed The signed int120 function asInt120(I256 _i256) internal pure returns (int120 signed) { return int120(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int112 /// @param _i256 The I256 to convert /// @return signed The signed int112 function asInt112(I256 _i256) internal pure returns (int112 signed) { return int112(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int104 /// @param _i256 The I256 to convert /// @return signed The signed int104 function asInt104(I256 _i256) internal pure returns (int104 signed) { return int104(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int96 /// @param _i256 The I256 to convert /// @return signed The signed int96 function asInt96(I256 _i256) internal pure returns (int96 signed) { return int96(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int88 /// @param _i256 The I256 to convert /// @return signed The signed int88 function asInt88(I256 _i256) internal pure returns (int88 signed) { return int88(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int80 /// @param _i256 The I256 to convert /// @return signed The signed int80 function asInt80(I256 _i256) internal pure returns (int80 signed) { return int80(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int72 /// @param _i256 The I256 to convert /// @return signed The signed int72 function asInt72(I256 _i256) internal pure returns (int72 signed) { return int72(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int64 /// @param _i256 The I256 to convert /// @return signed The signed int64 function asInt64(I256 _i256) internal pure returns (int64 signed) { return int64(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int56 /// @param _i256 The I256 to convert /// @return signed The signed int56 function asInt56(I256 _i256) internal pure returns (int56 signed) { return int56(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int48 /// @param _i256 The I256 to convert /// @return signed The signed int48 function asInt48(I256 _i256) internal pure returns (int48 signed) { return int48(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int40 /// @param _i256 The I256 to convert /// @return signed The signed int40 function asInt40(I256 _i256) internal pure returns (int40 signed) { return int40(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int32 /// @param _i256 The I256 to convert /// @return signed The signed int32 function asInt32(I256 _i256) internal pure returns (int32 signed) { return int32(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int24 /// @param _i256 The I256 to convert /// @return signed The signed int24 function asInt24(I256 _i256) internal pure returns (int24 signed) { return int24(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int16 /// @param _i256 The I256 to convert /// @return signed The signed int16 function asInt16(I256 _i256) internal pure returns (int16 signed) { return int16(I256.unwrap(_i256)); } /// @dev Converts an I256 to a signed int8 /// @param _i256 The I256 to convert /// @return signed The signed int8 function asInt8(I256 _i256) internal pure returns (int8 signed) { return int8(I256.unwrap(_i256)); } /// @dev Converts an I256 to an unsigned uint256 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint256 function asUint256(I256 _i256) internal pure returns (uint256 unsigned) { return uint256(I256.unwrap(_i256)); } /// @dev Converts an I256 to an unsigned uint248 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint248 function asUint248(I256 _i256) internal pure returns (uint248 unsigned) { return uint248(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint240 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint240 function asUint240(I256 _i256) internal pure returns (uint240 unsigned) { return uint240(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint232 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint232 function asUint232(I256 _i256) internal pure returns (uint232 unsigned) { return uint232(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint224 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint224 function asUint224(I256 _i256) internal pure returns (uint224 unsigned) { return uint224(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint216 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint216 function asUint216(I256 _i256) internal pure returns (uint216 unsigned) { return uint216(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint208 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint208 function asUint208(I256 _i256) internal pure returns (uint208 unsigned) { return uint208(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint200 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint200 function asUint200(I256 _i256) internal pure returns (uint200 unsigned) { return uint200(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint192 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint192 function asUint192(I256 _i256) internal pure returns (uint192 unsigned) { return uint192(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint184 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint184 function asUint184(I256 _i256) internal pure returns (uint184 unsigned) { return uint184(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint176 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint176 function asUint176(I256 _i256) internal pure returns (uint176 unsigned) { return uint176(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint168 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint168 function asUint168(I256 _i256) internal pure returns (uint168 unsigned) { return uint168(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint160 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint160 function asUint160(I256 _i256) internal pure returns (uint160 unsigned) { return uint160(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint152 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint152 function asUint152(I256 _i256) internal pure returns (uint152 unsigned) { return uint152(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint144 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint144 function asUint144(I256 _i256) internal pure returns (uint144 unsigned) { return uint144(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint136 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint136 function asUint136(I256 _i256) internal pure returns (uint136 unsigned) { return uint136(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint128 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint128 function asUint128(I256 _i256) internal pure returns (uint128 unsigned) { return uint128(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint120 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint120 function asUint120(I256 _i256) internal pure returns (uint120 unsigned) { return uint120(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint112 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint112 function asUint112(I256 _i256) internal pure returns (uint112 unsigned) { return uint112(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint104 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint104 function asUint104(I256 _i256) internal pure returns (uint104 unsigned) { return uint104(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint96 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint96 function asUint96(I256 _i256) internal pure returns (uint96 unsigned) { return uint96(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint88 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint88 function asUint88(I256 _i256) internal pure returns (uint88 unsigned) { return uint88(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint80 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint80 function asUint80(I256 _i256) internal pure returns (uint80 unsigned) { return uint80(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint72 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint72 function asUint72(I256 _i256) internal pure returns (uint72 unsigned) { return uint72(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint64 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint64 function asUint64(I256 _i256) internal pure returns (uint64 unsigned) { return uint64(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint56 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint56 function asUint56(I256 _i256) internal pure returns (uint56 unsigned) { return uint56(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint48 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint48 function asUint48(I256 _i256) internal pure returns (uint48 unsigned) { return uint48(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint40 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint40 function asUint40(I256 _i256) internal pure returns (uint40 unsigned) { return uint40(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint32 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint32 function asUint32(I256 _i256) internal pure returns (uint32 unsigned) { return uint32(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint24 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint24 function asUint24(I256 _i256) internal pure returns (uint24 unsigned) { return uint24(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint16 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint16 function asUint16(I256 _i256) internal pure returns (uint16 unsigned) { return uint16(uint256(I256.unwrap(_i256))); } /// @dev Converts an I256 to an unsigned uint8 /// @param _i256 The I256 to convert /// @return unsigned The unsigned uint8 function asUint8(I256 _i256) internal pure returns (uint8 unsigned) { return uint8(uint256(I256.unwrap(_i256))); } /// @dev Adds an int256 to an I256 /// @param _i256 The I256 to add to /// @param _addend The int256 to add /// @return i256 The result of the addition function add(I256 _i256, int256 _addend) internal pure returns (I256 i256) { return I256.wrap(add(I256.unwrap(_i256), _addend)); } /// @dev Subtracts an int256 from an I256 /// @param _i256 The I256 to subtract from /// @param _subtrahend The int256 to subtract /// @return i256 The result of the subtraction function sub(I256 _i256, int256 _subtrahend) internal pure returns (I256 i256) { return I256.wrap(sub(I256.unwrap(_i256), _subtrahend)); } /// @dev Increments an I256 /// @param _i256 The I256 to increment /// @return i256 The result of the increment function inc(I256 _i256) internal pure returns (I256 i256) { return I256.wrap(inc(I256.unwrap(_i256))); } /// @dev Decrements an I256 /// @param _i256 The I256 to decrement /// @return i256 The result of the decrement function dec(I256 _i256) internal pure returns (I256 i256) { return I256.wrap(dec(I256.unwrap(_i256))); } /// @dev Multiplies an I256 by an int256 /// @param _i256 The I256 to multiply /// @param _multiplier The int256 to multiply by /// @return i256 The result of the multiplication function mul(I256 _i256, int256 _multiplier) internal pure returns (I256 i256) { return I256.wrap(mul(I256.unwrap(_i256), _multiplier)); } /// @dev Divides an I256 by an int256 /// @param _i256 The I256 to divide /// @param _divisor The int256 to divide by /// @return i256 The result of the division function div(I256 _i256, int256 _divisor) internal pure returns (I256 i256) { return I256.wrap(div(I256.unwrap(_i256), _divisor)); } /// @dev Divides an I256 by an int256 and returns the remainder /// @param _i256 The I256 to divide /// @param _divisor The int256 to divide by /// @return i256 The remainder of the division function mod(I256 _i256, int256 _divisor) internal pure returns (I256 i256) { return I256.wrap(mod(I256.unwrap(_i256), _divisor)); } /// @dev Logical and of an I256 and an int256 /// @param _i256 The I256 to and /// @param _value The int256 to and with /// @return i256 The result of the and function and(I256 _i256, int256 _value) internal pure returns (I256 i256) { return I256.wrap(I256.unwrap(_i256) & _value); } /// @dev Logical or of an I256 and an int256 /// @param _i256 The I256 to or /// @param _value The int256 to or with /// @return i256 The result of the or function or(I256 _i256, int256 _value) internal pure returns (I256 i256) { return I256.wrap(I256.unwrap(_i256) | _value); } /// @dev Logical xor of an I256 and an int256 /// @param _i256 The I256 to xor /// @param _value The int256 to xor with /// @return i256 The result of the xor function xor(I256 _i256, int256 _value) internal pure returns (I256 i256) { return I256.wrap(I256.unwrap(_i256) ^ _value); } /// @dev Logical not of an I256 /// @param _i256 The I256 to not /// @return i256 The result of the not function not(I256 _i256) internal pure returns (I256 i256) { return I256.wrap(~I256.unwrap(_i256)); } /// @dev Compares an I256 to an int256 for equality /// @param _i256 The I256 to compare /// @param _value The int256 to compare to /// @return equal True if the I256 and int256 are equal function eq(I256 _i256, int256 _value) internal pure returns (bool) { return I256.unwrap(_i256) == _value; } /// @dev Compares an I256 to an int256 for inequality /// @param _i256 The I256 to compare /// @param _value The int256 to compare to /// @return equal True if the I256 and int256 are not equal function neq(I256 _i256, int256 _value) internal pure returns (bool) { return I256.unwrap(_i256) != _value; } /// @dev Compares an I256 to an int256 for greater than /// @param _i256 The I256 to compare /// @param _value The int256 to compare to /// @return equal True if the I256 is greater than the int256 function gt(I256 _i256, int256 _value) internal pure returns (bool) { return I256.unwrap(_i256) > _value; } /// @dev Compares an I256 to an int256 for greater than or equal to /// @param _i256 The I256 to compare /// @param _value The int256 to compare to /// @return equal True if the I256 is greater than or equal to the int256 function gte(I256 _i256, int256 _value) internal pure returns (bool) { return I256.unwrap(_i256) >= _value; } /// @dev Compares an I256 to an int256 for less than /// @param _i256 The I256 to compare /// @param _value The int256 to compare to /// @return equal True if the I256 is less than the int256 function lt(I256 _i256, int256 _value) internal pure returns (bool) { return I256.unwrap(_i256) < _value; } /// @dev Compares an I256 to an int256 for less than or equal to /// @param _i256 The I256 to compare /// @param _value The int256 to compare to /// @return equal True if the I256 is less than or equal to the int256 function lte(I256 _i256, int256 _value) internal pure returns (bool) { return I256.unwrap(_i256) <= _value; } /********************* * U256 -> *********************/ /// @dev Wraps an int256 into a U256. /// @param _i256 The int256 to wrap. /// @return u256 The wrapped U256. function asU256(int256 _i256) internal pure returns (U256 u256) { u256 = U256.wrap(uint256(_i256)); } /// @dev Wraps a uint256 into a U256. /// @param _u256 The uint256 to wrap. /// @return u256 The wrapped U256. function asU256(uint256 _u256) internal pure returns (U256 u256) { u256 = U256.wrap(_u256); } /// @dev Converts a U256 to a uint256. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint256 representation of the U256. function asUint256(U256 _u256) internal pure returns (uint256 unsigned) { return U256.unwrap(_u256); } /// @dev Converts a U256 to a uint224. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint224 representation of the U256. function asUint224(U256 _u256) internal pure returns (uint224 unsigned) { return uint224(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint216. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint216 representation of the U256. function asUint216(U256 _u256) internal pure returns (uint216 unsigned) { return uint216(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint208. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint208 representation of the U256. function asUint208(U256 _u256) internal pure returns (uint208 unsigned) { return uint208(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint200. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint200 representation of the U256. function asUint200(U256 _u256) internal pure returns (uint200 unsigned) { return uint200(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint192. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint192 representation of the U256. function asUint192(U256 _u256) internal pure returns (uint192 unsigned) { return uint192(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint184. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint184 representation of the U256. function asUint184(U256 _u256) internal pure returns (uint184 unsigned) { return uint184(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint176. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint176 representation of the U256. function asUint176(U256 _u256) internal pure returns (uint176 unsigned) { return uint176(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint168. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint168 representation of the U256. function asUint168(U256 _u256) internal pure returns (uint168 unsigned) { return uint168(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint160. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint160 representation of the U256. function asUint160(U256 _u256) internal pure returns (uint160 unsigned) { return uint160(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint152. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint152 representation of the U256. function asUint152(U256 _u256) internal pure returns (uint152 unsigned) { return uint152(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint144. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint144 representation of the U256. function asUint144(U256 _u256) internal pure returns (uint144 unsigned) { return uint144(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint136. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint136 representation of the U256. function asUint136(U256 _u256) internal pure returns (uint136 unsigned) { return uint136(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint128. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint128 representation of the U256. function asUint128(U256 _u256) internal pure returns (uint128 unsigned) { return uint128(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint120. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint120 representation of the U256. function asUint120(U256 _u256) internal pure returns (uint120 unsigned) { return uint120(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint112. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint112 representation of the U256. function asUint112(U256 _u256) internal pure returns (uint112 unsigned) { return uint112(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint104. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint104 representation of the U256. function asUint104(U256 _u256) internal pure returns (uint104 unsigned) { return uint104(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint96. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint96 representation of the U256. function asUint96(U256 _u256) internal pure returns (uint96 unsigned) { return uint96(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint88. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint88 representation of the U256. function asUint88(U256 _u256) internal pure returns (uint88 unsigned) { return uint88(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint80. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint80 representation of the U256. function asUint80(U256 _u256) internal pure returns (uint80 unsigned) { return uint80(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint72. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint72 representation of the U256. function asUint72(U256 _u256) internal pure returns (uint72 unsigned) { return uint72(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint64. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint64 representation of the U256. function asUint64(U256 _u256) internal pure returns (uint64 unsigned) { return uint64(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint56. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint56 representation of the U256. function asUint56(U256 _u256) internal pure returns (uint56 unsigned) { return uint56(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint48. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint48 representation of the U256. function asUint48(U256 _u256) internal pure returns (uint48 unsigned) { return uint48(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint40. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint40 representation of the U256. function asUint40(U256 _u256) internal pure returns (uint40 unsigned) { return uint40(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint32. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint32 representation of the U256. function asUint32(U256 _u256) internal pure returns (uint32 unsigned) { return uint32(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint24. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint24 representation of the U256. function asUint24(U256 _u256) internal pure returns (uint24 unsigned) { return uint24(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint16. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint16 representation of the U256. function asUint16(U256 _u256) internal pure returns (uint16 unsigned) { return uint16(U256.unwrap(_u256)); } /// @dev Converts a U256 to a uint8. /// @param _u256 The U256 to unwrap. /// @return unsigned The uint8 representation of the U256. function asUint8(U256 _u256) internal pure returns (uint8 unsigned) { return uint8(U256.unwrap(_u256)); } /// @dev Converts a U256 to an int256. /// @param _u256 The U256 to convert. /// @return signed The int256 representation of the U256. function asInt256(U256 _u256) internal pure returns (int256 signed) { return int256(U256.unwrap(_u256)); } /// @dev Converts a U256 to an int248. /// @param _u256 The U256 to convert. /// @return signed The int248 representation of the U256. function asInt248(U256 _u256) internal pure returns (int248 signed) { return int248(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int240. /// @param _u256 The U256 to convert. /// @return signed The int240 representation of the U256. function asInt240(U256 _u256) internal pure returns (int240 signed) { return int240(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int232. /// @param _u256 The U256 to convert. /// @return signed The int232 representation of the U256. function asInt232(U256 _u256) internal pure returns (int232 signed) { return int232(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int224. /// @param _u256 The U256 to convert. /// @return signed The int224 representation of the U256. function asInt224(U256 _u256) internal pure returns (int224 signed) { return int224(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int216. /// @param _u256 The U256 to convert. /// @return signed The int216 representation of the U256. function asInt216(U256 _u256) internal pure returns (int216 signed) { return int216(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int208. /// @param _u256 The U256 to convert. /// @return signed The int208 representation of the U256. function asInt208(U256 _u256) internal pure returns (int208 signed) { return int208(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int200. /// @param _u256 The U256 to convert. /// @return signed The int200 representation of the U256. function asInt200(U256 _u256) internal pure returns (int200 signed) { return int200(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int192. /// @param _u256 The U256 to convert. /// @return signed The int192 representation of the U256. function asInt192(U256 _u256) internal pure returns (int192 signed) { return int192(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int184. /// @param _u256 The U256 to convert. /// @return signed The int184 representation of the U256. function asInt184(U256 _u256) internal pure returns (int184 signed) { return int184(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int176. /// @param _u256 The U256 to convert. /// @return signed The int176 representation of the U256. function asInt176(U256 _u256) internal pure returns (int176 signed) { return int176(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int168. /// @param _u256 The U256 to convert. /// @return signed The int168 representation of the U256. function asInt168(U256 _u256) internal pure returns (int168 signed) { return int168(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int160. /// @param _u256 The U256 to convert. /// @return signed The int160 representation of the U256. function asInt160(U256 _u256) internal pure returns (int160 signed) { return int160(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int152. /// @param _u256 The U256 to convert. /// @return signed The int152 representation of the U256. function asInt152(U256 _u256) internal pure returns (int152 signed) { return int152(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int144. /// @param _u256 The U256 to convert. /// @return signed The int144 representation of the U256. function asInt144(U256 _u256) internal pure returns (int144 signed) { return int144(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int136. /// @param _u256 The U256 to convert. /// @return signed The int136 representation of the U256. function asInt136(U256 _u256) internal pure returns (int136 signed) { return int136(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int128. /// @param _u256 The U256 to convert. /// @return signed The int128 representation of the U256. function asInt128(U256 _u256) internal pure returns (int128 signed) { return int128(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int120. /// @param _u256 The U256 to convert. /// @return signed The int120 representation of the U256. function asInt120(U256 _u256) internal pure returns (int120 signed) { return int120(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int112. /// @param _u256 The U256 to convert. /// @return signed The int112 representation of the U256. function asInt112(U256 _u256) internal pure returns (int112 signed) { return int112(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int104. /// @param _u256 The U256 to convert. /// @return signed The int104 representation of the U256. function asInt104(U256 _u256) internal pure returns (int104 signed) { return int104(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int96. /// @param _u256 The U256 to convert. /// @return signed The int96 representation of the U256. function asInt96(U256 _u256) internal pure returns (int96 signed) { return int96(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int88. /// @param _u256 The U256 to convert. /// @return signed The int88 representation of the U256. function asInt88(U256 _u256) internal pure returns (int88 signed) { return int88(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int80. /// @param _u256 The U256 to convert. /// @return signed The int80 representation of the U256. function asInt80(U256 _u256) internal pure returns (int80 signed) { return int80(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int72. /// @param _u256 The U256 to convert. /// @return signed The int72 representation of the U256. function asInt72(U256 _u256) internal pure returns (int72 signed) { return int72(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int64. /// @param _u256 The U256 to convert. /// @return signed The int64 representation of the U256. function asInt64(U256 _u256) internal pure returns (int64 signed) { return int64(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int56. /// @param _u256 The U256 to convert. /// @return signed The int56 representation of the U256. function asInt56(U256 _u256) internal pure returns (int56 signed) { return int56(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int48. /// @param _u256 The U256 to convert. /// @return signed The int48 representation of the U256. function asInt48(U256 _u256) internal pure returns (int48 signed) { return int48(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int40. /// @param _u256 The U256 to convert. /// @return signed The int40 representation of the U256. function asInt40(U256 _u256) internal pure returns (int40 signed) { return int40(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int32. /// @param _u256 The U256 to convert. /// @return signed The int32 representation of the U256. function asInt32(U256 _u256) internal pure returns (int32 signed) { return int32(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int24. /// @param _u256 The U256 to convert. /// @return signed The int24 representation of the U256. function asInt24(U256 _u256) internal pure returns (int24 signed) { return int24(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int16. /// @param _u256 The U256 to convert. /// @return signed The int16 representation of the U256. function asInt16(U256 _u256) internal pure returns (int16 signed) { return int16(int256(U256.unwrap(_u256))); } /// @dev Converts a U256 to an int8. /// @param _u256 The U256 to convert. /// @return signed The int8 representation of the U256. function asInt8(U256 _u256) internal pure returns (int8 signed) { return int8(int256(U256.unwrap(_u256))); } /// @dev Adds a uint256 to a U256. /// @param _u256 The U256 to add to. /// @param _addend The uint256 to add. /// @return u256 The U256 result of the addition. function add(U256 _u256, uint256 _addend) internal pure returns (U256 u256) { u256 = U256.wrap(add(U256.unwrap(_u256), _addend)); } /// @dev Subtracts a uint256 from a U256. /// @param _u256 The U256 to subtract from. /// @param _subtrahend The uint256 to subtract. /// @return u256 The U256 result of the subtraction. function sub(U256 _u256, uint256 _subtrahend) internal pure returns (U256 u256) { return U256.wrap(sub(U256.unwrap(_u256), _subtrahend)); } /// @dev Increments a U256. /// @param _u256 The U256 to increment. /// @return u256 The U256 result of the increment. function inc(U256 _u256) internal pure returns (U256 u256) { return U256.wrap(inc(U256.unwrap(_u256))); } /// @dev Decrements a U256. /// @param _u256 The U256 to decrement. /// @return u256 The U256 result of the decrement. function dec(U256 _u256) internal pure returns (U256 u256) { return U256.wrap(dec(U256.unwrap(_u256))); } /// @notice Calculate the product of a U256 and a uint256 /// @param _u256 The U256 /// @param _multiplier The uint256 /// @return u256 The product of _u256 and _multiplier function mul(U256 _u256, uint256 _multiplier) internal pure returns (U256 u256) { return U256.wrap(mul(U256.unwrap(_u256), _multiplier)); } /** * @dev Divide a U256 number by a uint256 number. * @param _u256 The U256 number to divide. * @param _divisor The uint256 number to divide by. * @return u256 The result of dividing _u256 by _divisor. */ function div(U256 _u256, uint256 _divisor) internal pure returns (U256 u256) { return U256.wrap(div(U256.unwrap(_u256), _divisor)); } /// @dev Get the modulus of a U256 and a uint256 /// @param _u256 The U256 to be divided /// @param _divisor The divisor /// @return u256 The result of the modulo operation function mod(U256 _u256, uint256 _divisor) internal pure returns (U256 u256) { return U256.wrap(mod(U256.unwrap(_u256), _divisor)); } /// @notice Raise a U256 to the power of a uint256 /// @param _u256 The base /// @param _exponent The exponent /// @return u256 The result of raising `_u256` to the power of `_exponent` function exp(U256 _u256, uint256 _exponent) internal pure returns (U256 u256) { return U256.wrap(exp(U256.unwrap(_u256), _exponent)); } /// @dev Right shift a uint256 by a uint256. /// @param _u256 uint256 to right shift /// @param _shift uint256 to shift by /// @return u256 uint256 result of right shift function rshift(U256 _u256, U256 _shift) internal pure returns (U256 u256) { return U256.wrap(U256.unwrap(_u256) >> U256.unwrap(_shift)); } /// @dev Left shift a U256 by a U256. /// @param _u256 U256 to left shift /// @param _shift U256 to shift by /// @return u256 U256 result of left shift function lshift(U256 _u256, U256 _shift) internal pure returns (U256 u256) { return U256.wrap(U256.unwrap(_u256) << U256.unwrap(_shift)); } /// @dev Right shift a U256 by a uint256. /// @param _u256 U256 to right shift /// @param _shift uint256 to shift by /// @return u256 U256 result of right shift function rshift(U256 _u256, uint256 _shift) internal pure returns (U256 u256) { return U256.wrap(U256.unwrap(_u256) >> _shift); } /// @dev Left shift a U256 by a uint256. /// @param _u256 U256 to left shift /// @param _shift uint256 to shift by /// @return u256 U256 result of left shift function lshift(U256 _u256, uint256 _shift) internal pure returns (U256 u256) { return U256.wrap(U256.unwrap(_u256) << _shift); } /// @dev logical and between the input and the value /// @param _u256 input /// @param _value value /// @return u256 the result of the logical and function and(U256 _u256, uint256 _value) internal pure returns (U256 u256) { return _u256 & U256.wrap(_value); } /// @dev logical or between the input and the value /// @param _u256 input /// @param _value value /// @return u256 the result of the logical or function or(U256 _u256, uint256 _value) internal pure returns (U256 u256) { return _u256 | U256.wrap(_value); } /// @dev logical xor between the input and the value /// @param _u256 input /// @param _value value /// @return u256 the result of the logical xor function xor(U256 _u256, uint256 _value) internal pure returns (U256 u256) { return _u256 ^ U256.wrap(_value); } /// @dev logical not of the input /// @param _u256 input /// @return u256 the result of the logical not function not(U256 _u256) internal pure returns (U256 u256) { return ~_u256; } /// @dev Compare a U256 to a uint256 for equality /// @param _u256 The U256 to compare /// @param _value The uint256 to compare /// @return result True if the U256 is equal to the uint256 function eq(U256 _u256, uint256 _value) internal pure returns (bool result) { return U256.unwrap(_u256) == _value; } /// @dev Compare a U256 to a uint256 for inequality /// @param _u256 The U256 to compare /// @param _value The uint256 to compare /// @return result True if the U256 is not equal to the uint256 function neq(U256 _u256, uint256 _value) internal pure returns (bool result) { return U256.unwrap(_u256) != _value; } /// @dev Compare a U256 to a uint256 for greater than /// @param _u256 The U256 to compare /// @param _value The uint256 to compare /// @return result True if the U256 is greater than the uint256 function gt(U256 _u256, uint256 _value) internal pure returns (bool result) { return U256.unwrap(_u256) > _value; } /// @dev Compare a U256 to a uint256 for greater than or equal to /// @param _u256 The U256 to compare /// @param _value The uint256 to compare /// @return result True if the U256 is greater than or equal to the uint256 function gte(U256 _u256, uint256 _value) internal pure returns (bool result) { return U256.unwrap(_u256) >= _value; } /// @dev Compare a U256 to a uint256 for less than /// @param _u256 The U256 to compare /// @param _value The uint256 to compare /// @return result True if the U256 is less than the uint256 function lt(U256 _u256, uint256 _value) internal pure returns (bool result) { return U256.unwrap(_u256) < _value; } /// @dev Compare a U256 to a uint256 for less than or equal to /// @param _u256 The U256 to compare /// @param _value The uint256 to compare /// @return result True if the U256 is less than or equal to the uint256 function lte(U256 _u256, uint256 _value) internal pure returns (bool result) { return U256.unwrap(_u256) <= _value; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol) pragma solidity ^0.8.0; /** * @dev Provides a set of functions to operate with Base64 strings. * * _Available since v4.5._ */ library Base64 { /** * @dev Base64 Encoding/Decoding Table */ string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** * @dev Converts a `bytes` to its Bytes64 `string` representation. */ function encode(bytes memory data) internal pure returns (string memory) { /** * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol */ if (data.length == 0) return ""; // Loads the table into memory string memory table = _TABLE; // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter // and split into 4 numbers of 6 bits. // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up // - `data.length + 2` -> Round up // - `/ 3` -> Number of 3-bytes chunks // - `4 *` -> 4 characters for each chunk string memory result = new string(4 * ((data.length + 2) / 3)); /// @solidity memory-safe-assembly assembly { // Prepare the lookup table (skip the first "length" byte) let tablePtr := add(table, 1) // Prepare result pointer, jump over length let resultPtr := add(result, 32) // Run over the input, 3 bytes at a time for { let dataPtr := data let endPtr := add(data, mload(data)) } lt(dataPtr, endPtr) { } { // Advance 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // To write each character, shift the 3 bytes (18 bits) chunk // 4 times in blocks of 6 bits for each character (18, 12, 6, 0) // and apply logical AND with 0x3F which is the number of // the previous character in the ASCII table prior to the Base64 Table // The result is then added to the table to get the character to write, // and finally write it in the result pointer but with a left shift // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F)))) resultPtr := add(resultPtr, 1) // Advance } // When data `bytes` is not exactly 3 bytes long // it is padded with `=` characters at the end switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) } case 2 { mstore8(sub(resultPtr, 1), 0x3d) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// 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.20; import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {UUPSUpgradeable} from "../ozUpgradeable/proxy/utils/UUPSUpgradeable.sol"; import {OwnableUpgradeable} from "../ozUpgradeable/access/OwnableUpgradeable.sol"; import {UnsafeMath, U256} from "@0xdoublesharp/unsafe-math/contracts/UnsafeMath.sol"; import {IBrushToken} from "../interfaces/IBrushToken.sol"; import {IPlayers} from "../interfaces/IPlayers.sol"; import {IClans} from "../interfaces/IClans.sol"; import {IBankFactory} from "../interfaces/IBankFactory.sol"; import {EstforLibrary} from "../EstforLibrary.sol"; contract Clans is UUPSUpgradeable, OwnableUpgradeable, IClans { using UnsafeMath for U256; using UnsafeMath for uint16; using UnsafeMath for uint80; using UnsafeMath for uint256; event ClanCreated(uint clanId, uint playerId, string[] clanInfo, uint imageId, uint tierId); event SetClanRank(uint clanId, uint playerId, ClanRank clan); event InviteSent(uint clanId, uint playerId, uint fromPlayerId); event InviteAccepted(uint clanId, uint playerId); event MemberLeft(uint clanId, uint playerId); event JoinRequestSent(uint clanId, uint playerId); event JoinRequestAccepted(uint clanId, uint playerId, uint acceptedByPlayerId); event JoinRequestRemoved(uint clanId, uint playerId); event ClanOwnershipTransferred(uint clanId, uint playerId); event AddTiers(Tier[] tiers); event EditTiers(Tier[] tiers); event ClanOwnerLeft(uint clanId, uint playerId); event ClanEdited(uint clanId, uint playerId, string[] clanInfo, uint imageId); event ClanUpgraded(uint clanId, uint playerId, uint tierId); event ClanDestroyed(uint clanId); event PlayerRankUpdated(uint clanId, uint memberId, ClanRank rank, uint playerId); event InvitesDeletedByPlayer(uint[] clanIds, uint playerId); event InvitesDeletedByClan(uint clanId, uint[] invitedPlayerIds, uint deletedInvitesPlayerId); event EditNameCost(uint newCost); error AlreadyInClan(); error NotOwnerOfPlayer(); error NotOwnerOfPlayerAndActive(); error NotMemberOfClan(); error ClanIsFull(); error OwnerExists(); error InvalidImageId(); error NameTooShort(); error NameTooLong(); error NameInvalidCharacters(); error DiscordTooLong(); error DiscordTooShort(); error DiscordInvalidCharacters(); error TelegramTooLong(); error TelegramInvalidCharacters(); error ClanDoesNotExist(); error TierDoesNotExist(); error CannotDowngradeTier(); error TierAlreadyExists(); error NameAlreadyExists(); error ClanDestroyFailedHasMembers(); error PriceTooLow(); error MemberCapacityTooLow(); error BankCapacityTooLow(); error ImageIdTooLow(); error AlreadySentInvite(); error AlreadySentJoinRequest(); error NoJoinRequest(); error RankMustBeLowerRenounce(); error RankNotHighEnough(); error CannotSetSameRank(); error ChangingRankEqualOrHigherThanSelf(); error ChangingRankOfPlayerHigherThanSelf(); error ChangingRankOfPlayerEqualOrHigherThanSelf(); error CannotRenounceToSelf(); error InviteDoesNotExist(); error NoInvitesToDelete(); enum ClanRank { NONE, // Not in a clan COMMONER, // Member of the clan SCOUT, // Invite and kick commoners TREASURER, // Can withdraw from bank LEADER // Can edit clan details } struct Clan { uint80 owner; uint16 imageId; uint16 memberCount; uint40 createdTimestamp; uint8 tierId; string name; mapping(uint playerId => bool invited) inviteRequests; } struct PlayerInfo { uint32 clanId; // What clan they are in ClanRank rank; // Current clan rank uint32 requestedClanId; // What clan they have requested to join } struct Tier { uint8 id; uint16 maxMemberCapacity; uint16 maxBankCapacity; uint24 maxImageId; uint40 minimumAge; // How old the clan must be before it can be upgraded to this tier uint80 price; } modifier isOwnerOfPlayer(uint _playerId) { if (playerNFT.balanceOf(msg.sender, _playerId) == 0) { revert NotOwnerOfPlayer(); } _; } modifier isOwnerOfPlayerAndActive(uint _playerId) { if (!players.isOwnerOfPlayerAndActive(msg.sender, _playerId)) { revert NotOwnerOfPlayerAndActive(); } _; } modifier isMinimumRank( uint _clanId, uint _playerId, ClanRank _rank ) { PlayerInfo storage player = playerInfo[_playerId]; if (player.clanId != _clanId) { revert NotMemberOfClan(); } else if (playerInfo[_playerId].rank < _rank) { revert RankNotHighEnough(); } _; } modifier isMemberOfClan(uint _clanId, uint _playerId) { if (playerInfo[_playerId].clanId != _clanId) { revert NotMemberOfClan(); } _; } IBrushToken private brush; IPlayers private players; IBankFactory public bankFactory; IERC1155 private playerNFT; uint80 public nextClanId; address private pool; uint80 public editNameCost; address private dev; mapping(uint clanId => Clan clan) public clans; mapping(uint playerId => PlayerInfo) public playerInfo; mapping(uint id => Tier tier) public tiers; mapping(string name => bool exists) public lowercaseNames; mapping(uint clanId => uint40 timestampLeft) public ownerlessClanTimestamps; // timestamp /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( IBrushToken _brush, IERC1155 _playerNFT, address _pool, address _dev, uint80 _editNameCost ) external initializer { __UUPSUpgradeable_init(); __Ownable_init(); brush = _brush; playerNFT = _playerNFT; pool = _pool; dev = _dev; nextClanId = 1; editNameCost = _editNameCost; emit EditNameCost(_editNameCost); } function _checkTierExists(uint _tierId) private view { Tier storage tier = tiers[_tierId]; if (tier.id == 0) { revert TierDoesNotExist(); } } function createClan( uint _playerId, string calldata _name, string calldata _discord, string calldata _telegram, uint16 _imageId, uint8 _tierId ) external isOwnerOfPlayerAndActive(_playerId) { PlayerInfo storage player = playerInfo[_playerId]; if (isMemberOfAnyClan(_playerId)) { revert AlreadyInClan(); } Tier storage tier = tiers[_tierId]; _checkTierExists(_tierId); _checkClanImage(_imageId, tier.maxImageId); uint clanId = nextClanId; nextClanId = uint80(nextClanId.inc()); Clan storage clan = clans[clanId]; clan.owner = uint80(_playerId); clan.tierId = 1; // Updated later in _upgradeClan if it's > 1 clan.imageId = _imageId; clan.memberCount = 1; clan.createdTimestamp = uint40(block.timestamp); player.clanId = uint32(clanId); player.rank = ClanRank.LEADER; if (player.requestedClanId != 0) { removeJoinRequest(clanId, _playerId); } (string memory trimmedName, ) = _setName(clanId, _name); _checkSocials(_discord, _telegram); string[] memory clanInfo = _createClanInfo(trimmedName, _discord, _telegram); emit ClanCreated(clanId, _playerId, clanInfo, _imageId, _tierId); if (_tierId != 1) { _upgradeClan(clanId, _playerId, _tierId); } bankFactory.createBank(msg.sender, clanId); } function editClan( uint _clanId, string calldata _name, string calldata _discord, string calldata _telegram, uint _imageId ) external isOwnerOfPlayer(clans[_clanId].owner) { Clan storage clan = clans[_clanId]; Tier storage tier = tiers[clan.tierId]; _checkClanImage(_imageId, tier.maxImageId); (string memory trimmedName, bool nameChanged) = _setName(_clanId, _name); if (nameChanged) { _pay(editNameCost); } _checkSocials(_discord, _telegram); string[] memory clanInfo = _createClanInfo(trimmedName, _discord, _telegram); emit ClanEdited(_clanId, clans[_clanId].owner, clanInfo, _imageId); } function deleteInvitesAsPlayer(uint[] calldata _clanIds, uint _playerId) external isOwnerOfPlayer(_playerId) { if (_clanIds.length == 0) { revert NoInvitesToDelete(); } for (uint i = 0; i < _clanIds.length; ++i) { uint clanId = _clanIds[i]; if (!clans[clanId].inviteRequests[_playerId]) { revert InviteDoesNotExist(); } delete clans[clanId].inviteRequests[_playerId]; } emit InvitesDeletedByPlayer(_clanIds, _playerId); } function deleteInvitesAsClan( uint _clanId, uint[] calldata _invitedPlayerIds, uint _playerId ) external isOwnerOfPlayer(_playerId) isMinimumRank(_clanId, _playerId, ClanRank.SCOUT) { Clan storage clan = clans[_clanId]; if (_invitedPlayerIds.length == 0) { revert NoInvitesToDelete(); } for (uint i = 0; i < _invitedPlayerIds.length; ++i) { uint invitedPlayerId = _invitedPlayerIds[i]; if (!clan.inviteRequests[invitedPlayerId]) { revert InviteDoesNotExist(); } clan.inviteRequests[invitedPlayerId] = false; } emit InvitesDeletedByClan(_clanId, _invitedPlayerIds, _playerId); } function inviteMember( uint _clanId, uint _member, uint _playerId ) external isOwnerOfPlayer(_playerId) isMinimumRank(_clanId, _playerId, ClanRank.SCOUT) { Clan storage clan = clans[_clanId]; Tier storage tier = tiers[clan.tierId]; if (clan.memberCount >= tier.maxMemberCapacity) { revert ClanIsFull(); } if (clan.inviteRequests[_member]) { revert AlreadySentInvite(); } clan.inviteRequests[_member] = true; emit InviteSent(_clanId, _member, _playerId); } function acceptInvite(uint _clanId, uint _playerId) external isOwnerOfPlayerAndActive(_playerId) { Clan storage clan = clans[_clanId]; PlayerInfo storage player = playerInfo[_playerId]; if (!clan.inviteRequests[_playerId]) { revert InviteDoesNotExist(); } Tier storage tier = tiers[clan.tierId]; if (clan.memberCount >= tier.maxMemberCapacity) { revert ClanIsFull(); } clan.inviteRequests[_playerId] = false; clan.memberCount = uint16(clan.memberCount.inc()); player.clanId = uint32(_clanId); player.rank = ClanRank.COMMONER; player.requestedClanId = 0; emit InviteAccepted(_clanId, _playerId); } function requestToJoin(uint _clanId, uint _playerId) external isOwnerOfPlayerAndActive(_playerId) { Clan storage clan = clans[_clanId]; if (clan.createdTimestamp == 0) { revert ClanDoesNotExist(); } PlayerInfo storage player = playerInfo[_playerId]; if (isMemberOfAnyClan(_playerId)) { revert AlreadyInClan(); } uint playerRequestedClanId = player.requestedClanId; if (playerRequestedClanId != 0) { if (playerRequestedClanId == _clanId) { revert AlreadySentJoinRequest(); } emit JoinRequestRemoved(playerRequestedClanId, _playerId); } player.requestedClanId = uint32(_clanId); emit JoinRequestSent(_clanId, _playerId); } function removeJoinRequest(uint _clanId, uint _playerId) public isOwnerOfPlayer(_playerId) { playerInfo[_playerId].requestedClanId = 0; emit JoinRequestRemoved(_clanId, _playerId); } function acceptJoinRequest( uint _clanId, uint _member, uint _playerId ) public isOwnerOfPlayerAndActive(_playerId) isMinimumRank(_clanId, _playerId, ClanRank.SCOUT) { Clan storage clan = clans[_clanId]; PlayerInfo storage player = playerInfo[_member]; if (player.requestedClanId != _clanId) { revert NoJoinRequest(); } Tier storage tier = tiers[clan.tierId]; if (clan.memberCount >= tier.maxMemberCapacity) { revert ClanIsFull(); } clan.inviteRequests[_member] = false; clan.memberCount = uint16(clan.memberCount.inc()); player.clanId = uint32(_clanId); player.requestedClanId = 0; player.rank = ClanRank.COMMONER; emit JoinRequestAccepted(_clanId, _member, _playerId); } function changeRank( uint _clanId, uint _memberId, ClanRank _rank, uint _playerId ) external isOwnerOfPlayer(_playerId) isMemberOfClan(_clanId, _memberId) { ClanRank currentMemberRank = playerInfo[_memberId].rank; ClanRank callerRank = playerInfo[_playerId].rank; bool changingSelf = _memberId == _playerId; if (callerRank <= _rank) { revert ChangingRankEqualOrHigherThanSelf(); } // Cannot change Rank of someone higher or equal yourself if (changingSelf) { if (callerRank < currentMemberRank) { revert ChangingRankOfPlayerHigherThanSelf(); } } else { if (callerRank <= currentMemberRank) { revert ChangingRankOfPlayerEqualOrHigherThanSelf(); } } if (currentMemberRank == _rank) { revert CannotSetSameRank(); } bool isDemoting = currentMemberRank > _rank; if (isDemoting) { // Are they leaving? if (_rank == ClanRank.NONE) { _removeFromClan(_clanId, _memberId); } else { // If owner is leaving their post then we need to update the owned state if (currentMemberRank == ClanRank.LEADER) { _ownerCleared(_clanId); } _updateRank(_clanId, _memberId, _rank, _playerId); } } else { // Promoting _updateRank(_clanId, _memberId, _rank, _playerId); } } function renounceOwnershipTo( uint _clanId, uint _newOwner, ClanRank _newRank ) external isOwnerOfPlayer(clans[_clanId].owner) isMemberOfClan(_clanId, _newOwner) { Clan storage clan = clans[_clanId]; uint oldOwnerId = clan.owner; if (_newOwner == oldOwnerId) { revert CannotRenounceToSelf(); } if (_newRank != ClanRank.NONE) { if (_newRank >= ClanRank.LEADER) { revert RankMustBeLowerRenounce(); } // Change old owner to new rank _updateRank(_clanId, oldOwnerId, _newRank, oldOwnerId); } else { _removeFromClan(_clanId, oldOwnerId); } _claimOwnership(_clanId, _newOwner); } // Can claim a clan if there is no owner function claimOwnership( uint _clanId, uint _playerId ) external isOwnerOfPlayer(_playerId) isMemberOfClan(_clanId, _playerId) { Clan storage clan = clans[_clanId]; if (clan.owner != 0) { revert OwnerExists(); } _claimOwnership(_clanId, _playerId); } function upgradeClan(uint _clanId, uint _playerId, uint8 _newTierId) public isOwnerOfPlayer(_playerId) { _upgradeClan(_clanId, _playerId, _newTierId); } function getClanNameOfPlayer(uint _playerId) external view returns (string memory) { uint clanId = playerInfo[_playerId].clanId; return clans[clanId].name; } function canWithdraw(uint _clanId, uint _playerId) external view override returns (bool) { return playerInfo[_playerId].clanId == _clanId && playerInfo[_playerId].rank >= ClanRank.TREASURER; } function isClanMember(uint _clanId, uint _playerId) external view returns (bool) { return playerInfo[_playerId].clanId == _clanId; } function isMemberOfAnyClan(uint _playerId) public view returns (bool) { return playerInfo[_playerId].clanId != 0; } function getClanTierMembership(uint _playerId) external view returns (uint8) { return clans[playerInfo[_playerId].clanId].tierId; } function hasInviteRequest(uint _clanId, uint _playerId) external view returns (bool) { return clans[_clanId].inviteRequests[_playerId]; } function maxBankCapacity(uint _clanId) external view override returns (uint16) { Tier storage tier = tiers[clans[_clanId].tierId]; return tier.maxBankCapacity; } function maxMemberCapacity(uint _clanId) external view override returns (uint16) { Tier storage tier = tiers[clans[_clanId].tierId]; return tier.maxMemberCapacity; } function _checkClanImage(uint _imageId, uint _maxImageId) private pure { if (_imageId == 0 || _imageId > _maxImageId) { revert InvalidImageId(); } } function _setName(uint _clanId, string calldata _name) private returns (string memory trimmedName, bool nameChanged) { // Trimmed name cannot be empty trimmedName = EstforLibrary.trim(_name); if (bytes(trimmedName).length < 3) { revert NameTooShort(); } if (bytes(trimmedName).length > 20) { revert NameTooLong(); } if (!EstforLibrary.containsValidNameCharacters(trimmedName)) { revert NameInvalidCharacters(); } string memory trimmedAndLowercaseName = EstforLibrary.toLower(trimmedName); string memory oldName = EstforLibrary.toLower(clans[_clanId].name); nameChanged = keccak256(abi.encodePacked(oldName)) != keccak256(abi.encodePacked(trimmedAndLowercaseName)); if (nameChanged) { if (lowercaseNames[trimmedAndLowercaseName]) { revert NameAlreadyExists(); } if (bytes(oldName).length != 0) { delete lowercaseNames[oldName]; } lowercaseNames[trimmedAndLowercaseName] = true; clans[_clanId].name = trimmedName; } } function _checkSocials(string calldata _discord, string calldata _telegram) private pure { uint discordLength = bytes(_discord).length; if (discordLength > 25) { revert DiscordTooLong(); } if (discordLength > 0 && discordLength < 4) { revert DiscordTooShort(); } if (!EstforLibrary.containsValidDiscordCharacters(_discord)) { revert DiscordInvalidCharacters(); } uint telegramLength = bytes(_telegram).length; if (telegramLength > 25) { revert TelegramTooLong(); } if (!EstforLibrary.containsValidTelegramCharacters(_telegram)) { revert TelegramInvalidCharacters(); } } function _createClanInfo( string memory _trimmedName, string calldata _discord, string calldata _telegram ) private pure returns (string[] memory clanInfo) { clanInfo = new string[](3); clanInfo[0] = _trimmedName; clanInfo[1] = _discord; clanInfo[2] = _telegram; } function _ownerCleared(uint _clanId) private { uint oldOwnerId = clans[_clanId].owner; clans[_clanId].owner = 0; ownerlessClanTimestamps[_clanId] = uint40(block.timestamp); emit ClanOwnerLeft(_clanId, oldOwnerId); } function _updateRank(uint _clanId, uint _memberId, ClanRank _rank, uint _playerId) private { PlayerInfo storage player = playerInfo[_memberId]; player.rank = _rank; emit PlayerRankUpdated(_clanId, _memberId, _rank, _playerId); } function _destroyClan(uint _clanId) private { if (clans[_clanId].memberCount != 0) { // Defensive check revert ClanDestroyFailedHasMembers(); } lowercaseNames[EstforLibrary.toLower(clans[_clanId].name)] = false; // Name can be used again delete clans[_clanId]; // Delete the clan emit ClanDestroyed(_clanId); } function _removeFromClan(uint _clanId, uint _playerId) private { Clan storage clan = clans[_clanId]; if (clan.owner == _playerId) { _ownerCleared(_clanId); } --clan.memberCount; if (clan.memberCount == 0) { _destroyClan(_clanId); } else { emit MemberLeft(_clanId, _playerId); } PlayerInfo storage player = playerInfo[_playerId]; player.clanId = 0; player.rank = ClanRank.NONE; } function _claimOwnership(uint _clanId, uint _playerId) private { Clan storage clan = clans[_clanId]; clan.owner = uint80(_playerId); delete ownerlessClanTimestamps[_clanId]; playerInfo[_playerId].rank = ClanRank.LEADER; emit ClanOwnershipTransferred(_clanId, _playerId); } function _pay(uint _brushCost) private { // Pay brush.transferFrom(msg.sender, address(this), _brushCost); uint quarterCost = _brushCost / 4; // Send half to the pool (currently shop) brush.transfer(pool, _brushCost - quarterCost * 2); // Send 1 quarter to the dev address brush.transfer(dev, quarterCost); // Burn 1 quarter brush.burn(quarterCost); } function _upgradeClan(uint _clanId, uint _playerId, uint8 _newTierId) private { Tier storage oldTier = tiers[clans[_clanId].tierId]; if (oldTier.id == 0) { revert ClanDoesNotExist(); } if (_newTierId <= oldTier.id) { revert CannotDowngradeTier(); } _checkTierExists(_newTierId); Tier storage newTier = tiers[_newTierId]; uint priceDifference = newTier.price - oldTier.price; _pay(priceDifference); clans[_clanId].tierId = _newTierId; // Increase the tier emit ClanUpgraded(_clanId, _playerId, _newTierId); } function _setTier(Tier calldata _tier) private { uint tierId = _tier.id; // TODO: Some other checks // Price should be higher than the one prior if (tierId > 1) { if (_tier.price < tiers[tierId - 1].price) { revert PriceTooLow(); } if (_tier.maxMemberCapacity < tiers[tierId - 1].maxMemberCapacity) { revert MemberCapacityTooLow(); } if (_tier.maxBankCapacity < tiers[tierId - 1].maxBankCapacity) { revert BankCapacityTooLow(); } if (_tier.maxImageId < tiers[tierId - 1].maxImageId) { revert ImageIdTooLow(); } } tiers[tierId] = _tier; } function addTiers(Tier[] calldata _tiers) external onlyOwner { U256 bounds = _tiers.length.asU256(); for (U256 iter; iter < bounds; iter = iter.inc()) { uint i = iter.asUint256(); if (tiers[_tiers[i].id].id != 0 || _tiers[i].id == 0) { revert TierAlreadyExists(); } _setTier(_tiers[i]); } emit AddTiers(_tiers); } function editTiers(Tier[] calldata _tiers) external onlyOwner { U256 bounds = _tiers.length.asU256(); for (U256 iter; iter < bounds; iter = iter.inc()) { uint i = iter.asUint256(); _checkTierExists(_tiers[i].id); _setTier(_tiers[i]); } emit EditTiers(_tiers); } function setBankFactory(IBankFactory _bankFactory) external onlyOwner { bankFactory = _bankFactory; } function setPlayers(IPlayers _players) external onlyOwner { players = _players; } function setEditNameCost(uint72 _editNameCost) external onlyOwner { editNameCost = _editNameCost; emit EditNameCost(_editNameCost); } function _authorizeUpgrade(address) internal override onlyOwner {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {Base64} from "@openzeppelin/contracts/utils/Base64.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {UnsafeMath, U256} from "@0xdoublesharp/unsafe-math/contracts/UnsafeMath.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {IPlayers} from "./interfaces/IPlayers.sol"; // solhint-disable-next-line no-global-import import "./globals/all.sol"; // This file contains methods for interacting with generic functions like trimming strings, merkle proof whitelisting etc. library EstforLibrary { using UnsafeMath for U256; using UnsafeMath for uint; function isWhitespace(bytes1 _char) internal pure returns (bool) { return _char == 0x20 || // Space _char == 0x09 || // Tab _char == 0x0a || // Line feed _char == 0x0D || // Carriage return _char == 0x0B || // Vertical tab _char == 0x00; // empty byte } function leftTrim(string memory _str) internal pure returns (string memory) { bytes memory b = bytes(_str); uint strLen = b.length; uint start = type(uint).max; // Find the index of the first non-whitespace character for (uint i = 0; i < strLen; ++i) { bytes1 char = b[i]; if (!isWhitespace(char)) { start = i; break; } } if (start == type(uint).max) { return ""; } // Copy the remainder to a new string bytes memory trimmedBytes = new bytes(strLen - start); for (uint i = start; i < strLen; ++i) { trimmedBytes[i - start] = b[i]; } return string(trimmedBytes); } function rightTrim(string calldata _str) internal pure returns (string memory) { bytes memory b = bytes(_str); uint strLen = b.length; if (strLen == 0) { return ""; } int end = -1; // Find the index of the last non-whitespace character for (int i = int(strLen) - 1; i >= 0; --i) { bytes1 char = b[uint(i)]; if (!isWhitespace(char)) { end = i; break; } } if (end == -1) { return ""; } bytes memory trimmedBytes = new bytes(uint(end) + 1); for (uint i = 0; i <= uint(end); ++i) { trimmedBytes[i] = b[i]; } return string(trimmedBytes); } function trim(string calldata _str) external pure returns (string memory) { return leftTrim(rightTrim(_str)); } // Assumes the string is already trimmed function containsValidNameCharacters(string calldata _name) external pure returns (bool) { bytes memory b = bytes(_name); bool lastCharIsWhitespace; U256 iter = b.length.asU256(); while (iter.neq(0)) { iter = iter.dec(); uint i = iter.asUint256(); bytes1 char = b[i]; bool isUpperCaseLetter = (char >= 0x41) && (char <= 0x5A); // A-Z bool isLowerCaseLetter = (char >= 0x61) && (char <= 0x7A); // a-z bool isDigit = (char >= 0x30) && (char <= 0x39); // 0-9 bool isSpecialCharacter = (char == 0x2D) || (char == 0x5F) || (char == 0x2E) || (char == 0x20); // "-", "_", ".", and " " bool _isWhitespace = isWhitespace(char); bool hasMultipleWhitespaceInRow = lastCharIsWhitespace && _isWhitespace; lastCharIsWhitespace = _isWhitespace; if ((!isUpperCaseLetter && !isLowerCaseLetter && !isDigit && !isSpecialCharacter) || hasMultipleWhitespaceInRow) { return false; } } return true; } function containsValidDiscordCharacters(string calldata _discord) external pure returns (bool) { bytes memory discord = bytes(_discord); U256 iter = discord.length.asU256(); while (iter.neq(0)) { iter = iter.dec(); uint i = iter.asUint256(); bytes1 char = discord[i]; bool isUpperCaseLetter = (char >= 0x41) && (char <= 0x5A); // A-Z bool isLowerCaseLetter = (char >= 0x61) && (char <= 0x7A); // a-z bool isDigit = (char >= 0x30) && (char <= 0x39); // 0-9 if (!isUpperCaseLetter && !isLowerCaseLetter && !isDigit) { return false; } } return true; } function containsValidTelegramCharacters(string calldata _telegram) external pure returns (bool) { bytes memory telegram = bytes(_telegram); U256 iter = telegram.length.asU256(); while (iter.neq(0)) { iter = iter.dec(); uint i = iter.asUint256(); bytes1 char = telegram[i]; bool isUpperCaseLetter = (char >= 0x41) && (char <= 0x5A); // A-Z bool isLowerCaseLetter = (char >= 0x61) && (char <= 0x7A); // a-z bool isDigit = (char >= 0x30) && (char <= 0x39); // 0-9 bool isPlus = char == 0x2B; // "+" if (!isUpperCaseLetter && !isLowerCaseLetter && !isDigit && !isPlus) { return false; } } return true; } function toLower(string memory _str) internal pure returns (string memory) { bytes memory lowerStr = abi.encodePacked(_str); U256 iter = lowerStr.length.asU256(); while (iter.neq(0)) { iter = iter.dec(); uint i = iter.asUint256(); if ((uint8(lowerStr[i]) >= 65) && (uint8(lowerStr[i]) <= 90)) { // So we add 32 to make it lowercase lowerStr[i] = bytes1(uint8(lowerStr[i]) + 32); } } return string(lowerStr); } function merkleProofVerify( bytes32[] calldata _proof, bytes32 _merkleRoot, bytes32 _leaf ) external pure returns (bool) { return MerkleProof.verify(_proof, _merkleRoot, _leaf); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {Skill, Attire, CombatStyle, CombatStats} from "./misc.sol"; import {GuaranteedReward, RandomReward} from "./rewards.sol"; enum ActionQueueStatus { NONE, APPEND, KEEP_LAST_IN_PROGRESS } // The user chooses these struct QueuedActionInput { // Keep this first Attire attire; uint16 actionId; uint16 regenerateId; // Food (combat), maybe something for non-combat later uint16 choiceId; // Melee/Arrow/Magic (combat), logs, ore (non-combat) uint16 rightHandEquipmentTokenId; // Axe/Sword/bow, can be empty uint16 leftHandEquipmentTokenId; // Shield, can be empty uint24 timespan; // How long to queue the action for CombatStyle combatStyle; // specific style of combat, can also be used } struct QueuedAction { uint16 actionId; uint16 regenerateId; // Food (combat), maybe something for non-combat later uint16 choiceId; // Melee/Arrow/Magic (combat), logs, ore (non-combat) uint16 rightHandEquipmentTokenId; // Axe/Sword/bow, can be empty uint16 leftHandEquipmentTokenId; // Shield, can be empty uint24 timespan; // How long to queue the action for CombatStyle combatStyle; // specific style of combat, can also be used uint24 prevProcessedTime; // How long the action has been processed for previously uint24 prevProcessedXPTime; // How much XP has been gained for this action so far uint64 queueId; // id of this queued action bool isValid; // If we still have the item, TODO: Not used yet } // This is only used as an input arg struct Action { uint16 actionId; ActionInfo info; GuaranteedReward[] guaranteedRewards; RandomReward[] randomRewards; CombatStats combatStats; } struct ActionInfo { Skill skill; bool isAvailable; bool isDynamic; bool actionChoiceRequired; // If true, then the user must choose an action choice uint24 xpPerHour; uint32 minXP; uint24 numSpawned; // Mostly for combat, capped respawn rate for xp/drops. Per hour, base 10000 uint16 handItemTokenIdRangeMin; // Inclusive uint16 handItemTokenIdRangeMax; // Inclusive uint8 successPercent; // 0-100 } // Allows for 2, 4 or 8 hour respawn time uint constant SPAWN_MUL = 1000; uint constant RATE_MUL = 1000; uint constant GUAR_MUL = 10; // Guaranteeded reward multiplier (1 decimal, allows for 2 hour respawn time)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "./actions.sol"; import "./items.sol"; import "./misc.sol"; import "./players.sol"; import "./rewards.sol";
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; uint16 constant NONE = 0; // 1 - 255 (head) uint16 constant HEAD_BASE = 1; uint16 constant BRONZE_HELMET = HEAD_BASE; uint16 constant IRON_HELMET = HEAD_BASE + 1; uint16 constant MITHRIL_HELMET = HEAD_BASE + 2; uint16 constant ADAMANTINE_HELMET = HEAD_BASE + 3; uint16 constant RUNITE_HELMET = HEAD_BASE + 4; uint16 constant TITANIUM_HELMET = HEAD_BASE + 5; uint16 constant ORICHALCUM_HELMET = HEAD_BASE + 6; uint16 constant NATUOW_HOOD = HEAD_BASE + 7; uint16 constant BAT_WING_HAT = HEAD_BASE + 8; uint16 constant NATURE_MASK = HEAD_BASE + 9; uint16 constant APPRENTICE_HAT = HEAD_BASE + 10; uint16 constant MAGE_HOOD = HEAD_BASE + 11; uint16 constant SORCERER_HAT = HEAD_BASE + 12; uint16 constant SEERS_HOOD = HEAD_BASE + 13; uint16 constant SHAMAN_HOOD = HEAD_BASE + 14; uint16 constant MASTER_HAT = HEAD_BASE + 15; uint16 constant HEAD_MAX = HEAD_BASE + 254; // Inclusive // 257 - 511 (neck) uint16 constant NECK_BASE = 257; uint16 constant SAPPHIRE_AMULET = NECK_BASE; uint16 constant EMERALD_AMULET = NECK_BASE + 1; uint16 constant RUBY_AMULET = NECK_BASE + 2; uint16 constant AMETHYST_AMULET = NECK_BASE + 3; uint16 constant DIAMOND_AMULET = NECK_BASE + 4; uint16 constant DRAGONSTONE_AMULET = NECK_BASE + 5; uint16 constant NECK_MAX = NECK_BASE + 254; // 513 - 767 (body) uint16 constant BODY_BASE = 513; uint16 constant BRONZE_ARMOR = BODY_BASE; uint16 constant IRON_ARMOR = BODY_BASE + 1; uint16 constant MITHRIL_ARMOR = BODY_BASE + 2; uint16 constant ADAMANTINE_ARMOR = BODY_BASE + 3; uint16 constant RUNITE_ARMOR = BODY_BASE + 4; uint16 constant TITANIUM_ARMOR = BODY_BASE + 5; uint16 constant ORICHALCUM_ARMOR = BODY_BASE + 6; uint16 constant NATUOW_BODY = BODY_BASE + 7; uint16 constant BAT_WING_BODY = BODY_BASE + 8; uint16 constant NATURE_BODY = BODY_BASE + 9; uint16 constant APPRENTICE_BODY = BODY_BASE + 10; uint16 constant MAGE_BODY = BODY_BASE + 11; uint16 constant SORCERER_BODY = BODY_BASE + 12; uint16 constant SEERS_BODY = BODY_BASE + 13; uint16 constant SHAMAN_BODY = BODY_BASE + 14; uint16 constant MASTER_BODY = BODY_BASE + 15; uint16 constant BODY_MAX = BODY_BASE + 254; // 769 - 1023 (arms) uint16 constant ARMS_BASE = 769; uint16 constant BRONZE_GAUNTLETS = ARMS_BASE; uint16 constant IRON_GAUNTLETS = ARMS_BASE + 1; uint16 constant MITHRIL_GAUNTLETS = ARMS_BASE + 2; uint16 constant ADAMANTINE_GAUNTLETS = ARMS_BASE + 3; uint16 constant RUNITE_GAUNTLETS = ARMS_BASE + 4; uint16 constant TITANIUM_GAUNTLETS = ARMS_BASE + 5; uint16 constant ORICHALCUM_GAUNTLETS = ARMS_BASE + 6; uint16 constant NATUOW_BRACERS = ARMS_BASE + 7; uint16 constant BAT_WING_BRACERS = ARMS_BASE + 8; uint16 constant NATURE_BRACERS = ARMS_BASE + 9; uint16 constant APPRENTICE_GAUNTLETS = ARMS_BASE + 10; uint16 constant MAGE_BRACERS = ARMS_BASE + 11; uint16 constant SORCERER_GAUNTLETS = ARMS_BASE + 12; uint16 constant SEERS_BRACERS = ARMS_BASE + 13; uint16 constant SHAMAN_GAUNTLETS = ARMS_BASE + 14; uint16 constant MASTER_BRACERS = ARMS_BASE + 15; uint16 constant ARMS_MAX = ARMS_BASE + 254; // 1025 - 1279 (legs) uint16 constant LEGS_BASE = 1025; uint16 constant BRONZE_TASSETS = LEGS_BASE; uint16 constant IRON_TASSETS = LEGS_BASE + 1; uint16 constant MITHRIL_TASSETS = LEGS_BASE + 2; uint16 constant ADAMANTINE_TASSETS = LEGS_BASE + 3; uint16 constant RUNITE_TASSETS = LEGS_BASE + 4; uint16 constant TITANIUM_TASSETS = LEGS_BASE + 5; uint16 constant ORICHALCUM_TASSETS = LEGS_BASE + 6; uint16 constant NATUOW_TASSETS = LEGS_BASE + 7; uint16 constant BAT_WING_TROUSERS = LEGS_BASE + 8; uint16 constant NATURE_TROUSERS = LEGS_BASE + 9; uint16 constant APPRENTICE_TROUSERS = LEGS_BASE + 10; uint16 constant MAGE_TROUSERS = LEGS_BASE + 11; uint16 constant SORCERER_TROUSERS = LEGS_BASE + 12; uint16 constant SEERS_TROUSERS = LEGS_BASE + 13; uint16 constant SHAMAN_TROUSERS = LEGS_BASE + 14; uint16 constant MASTER_TROUSERS = LEGS_BASE + 15; uint16 constant LEGS_MAX = LEGS_BASE + 254; // 1281 - 1535 (feet) uint16 constant FEET_BASE = 1281; uint16 constant BRONZE_BOOTS = FEET_BASE; uint16 constant IRON_BOOTS = FEET_BASE + 1; uint16 constant MITHRIL_BOOTS = FEET_BASE + 2; uint16 constant ADAMANTINE_BOOTS = FEET_BASE + 3; uint16 constant RUNITE_BOOTS = FEET_BASE + 4; uint16 constant TITANIUM_BOOTS = FEET_BASE + 5; uint16 constant ORICHALCUM_BOOTS = FEET_BASE + 6; uint16 constant NATUOW_BOOTS = FEET_BASE + 7; uint16 constant BAT_WING_BOOTS = FEET_BASE + 8; uint16 constant NATURE_BOOTS = FEET_BASE + 9; uint16 constant APPRENTICE_BOOTS = FEET_BASE + 10; uint16 constant MAGE_BOOTS = FEET_BASE + 11; uint16 constant SORCERER_BOOTS = FEET_BASE + 12; uint16 constant SEERS_BOOTS = FEET_BASE + 13; uint16 constant SHAMAN_BOOTS = FEET_BASE + 14; uint16 constant MASTER_BOOTS = FEET_BASE + 15; uint16 constant BOOTS_MAX = FEET_BASE + 254; // 1536 - 1791 spare(1) // 1792 - 2047 spare(2) // Combat (right arm) (2048 - 2303) uint16 constant COMBAT_BASE = 2048; // Melee uint16 constant SWORD_BASE = COMBAT_BASE; uint16 constant BRONZE_SWORD = SWORD_BASE; uint16 constant IRON_SWORD = COMBAT_BASE + 1; uint16 constant MITHRIL_SWORD = COMBAT_BASE + 2; uint16 constant ADAMANTINE_SWORD = COMBAT_BASE + 3; uint16 constant RUNITE_SWORD = COMBAT_BASE + 4; uint16 constant TITANIUM_SWORD = COMBAT_BASE + 5; uint16 constant ORICHALCUM_SWORD = COMBAT_BASE + 6; uint16 constant SWORD_MAX = SWORD_BASE + 49; // Magic uint16 constant STAFF_BASE = COMBAT_BASE + 50; uint16 constant TOTEM_STAFF = STAFF_BASE; uint16 constant SAPPHIRE_STAFF = STAFF_BASE + 1; uint16 constant EMERALD_STAFF = STAFF_BASE + 2; uint16 constant RUBY_STAFF = STAFF_BASE + 3; uint16 constant AMETHYST_STAFF = STAFF_BASE + 4; uint16 constant DIAMOND_STAFF = STAFF_BASE + 5; uint16 constant DRAGONSTONE_STAFF = STAFF_BASE + 6; uint16 constant STAFF_MAX = STAFF_BASE + 49; // Ranged uint16 constant BOW_BASE = COMBAT_BASE + 100; uint16 constant BOW_MAX = BOW_BASE + 49; // Shields (left arm) uint16 constant SHIELD_BASE = COMBAT_BASE + 150; uint16 constant BRONZE_SHIELD = SHIELD_BASE; uint16 constant IRON_SHIELD = SHIELD_BASE + 1; uint16 constant MITHRIL_SHIELD = SHIELD_BASE + 2; uint16 constant ADAMANTINE_SHIELD = SHIELD_BASE + 3; uint16 constant RUNITE_SHIELD = SHIELD_BASE + 4; uint16 constant TITANIUM_SHIELD = SHIELD_BASE + 5; uint16 constant ORICHALCUM_SHIELD = SHIELD_BASE + 6; uint16 constant SHIELD_MAX = SHIELD_BASE + 49; uint16 constant COMBAT_MAX = COMBAT_BASE + 255; // Mining (2560 - 2815) uint16 constant MINING_BASE = 2560; uint16 constant BRONZE_PICKAXE = MINING_BASE; uint16 constant IRON_PICKAXE = MINING_BASE + 1; uint16 constant MITHRIL_PICKAXE = MINING_BASE + 2; uint16 constant ADAMANTINE_PICKAXE = MINING_BASE + 3; uint16 constant RUNITE_PICKAXE = MINING_BASE + 4; uint16 constant TITANIUM_PICKAXE = MINING_BASE + 5; uint16 constant ORICHALCUM_PICKAXE = MINING_BASE + 6; uint16 constant MINING_MAX = MINING_BASE + 255; // Woodcutting (2816 - 3071) uint16 constant WOODCUTTING_BASE = 2816; uint16 constant BRONZE_AXE = WOODCUTTING_BASE; uint16 constant IRON_AXE = WOODCUTTING_BASE + 1; uint16 constant MITHRIL_AXE = WOODCUTTING_BASE + 2; uint16 constant ADAMANTINE_AXE = WOODCUTTING_BASE + 3; uint16 constant RUNITE_AXE = WOODCUTTING_BASE + 4; uint16 constant TITANIUM_AXE = WOODCUTTING_BASE + 5; uint16 constant ORICHALCUM_AXE = WOODCUTTING_BASE + 6; uint16 constant WOODCUTTING_MAX = WOODCUTTING_BASE + 255; // Fishing (3072 - 3327) uint16 constant FISHING_BASE = 3072; uint16 constant NET_STICK = FISHING_BASE; uint16 constant MEDIUM_NET = FISHING_BASE + 1; uint16 constant WOOD_FISHING_ROD = FISHING_BASE + 2; uint16 constant TITANIUM_FISHING_ROD = FISHING_BASE + 3; uint16 constant HARPOON = FISHING_BASE + 4; uint16 constant LARGE_NET = FISHING_BASE + 5; uint16 constant MAGIC_NET = FISHING_BASE + 6; uint16 constant CAGE = FISHING_BASE + 7; uint16 constant FISHING_MAX = FISHING_BASE + 255; // Firemaking (3328 - 3583) uint16 constant FIRE_BASE = 3328; uint16 constant MAGIC_FIRE_STARTER = FIRE_BASE; uint16 constant FIRE_MAX = FIRE_BASE + 255; // Smithing (none needed) // Crafting (none needed) // Cooking (none needed) // 10000+ it'a all other items // Bars uint16 constant BAR_BASE = 10240; // (256 * 40) uint16 constant BRONZE_BAR = BAR_BASE; uint16 constant IRON_BAR = BAR_BASE + 1; uint16 constant MITHRIL_BAR = BAR_BASE + 2; uint16 constant ADAMANTINE_BAR = BAR_BASE + 3; uint16 constant RUNITE_BAR = BAR_BASE + 4; uint16 constant TITANIUM_BAR = BAR_BASE + 5; uint16 constant ORICHALCUM_BAR = BAR_BASE + 6; uint16 constant BAR_MAX = BAR_BASE + 255; // Logs uint16 constant LOG_BASE = 10496; uint16 constant LOG = LOG_BASE; uint16 constant OAK_LOG = LOG_BASE + 1; uint16 constant WILLOW_LOG = LOG_BASE + 2; uint16 constant MAPLE_LOG = LOG_BASE + 3; uint16 constant REDWOOD_LOG = LOG_BASE + 4; uint16 constant MAGICAL_LOG = LOG_BASE + 5; uint16 constant ASH_LOG = LOG_BASE + 6; uint16 constant ENCHANTED_LOG = LOG_BASE + 7; uint16 constant LIVING_LOG = LOG_BASE + 8; uint16 constant LOG_MAX = LOG_BASE + 255; // Fish uint16 constant RAW_FISH_BASE = 10752; uint16 constant RAW_MINNUS = RAW_FISH_BASE; uint16 constant RAW_BLEKK = RAW_FISH_BASE + 1; uint16 constant RAW_SKRIMP = RAW_FISH_BASE + 2; uint16 constant RAW_FEOLA = RAW_FISH_BASE + 3; uint16 constant RAW_ANCHO = RAW_FISH_BASE + 4; uint16 constant RAW_TROUT = RAW_FISH_BASE + 5; uint16 constant RAW_ROJJA = RAW_FISH_BASE + 6; uint16 constant RAW_BOWFISH = RAW_FISH_BASE + 7; uint16 constant RAW_GOLDFISH = RAW_FISH_BASE + 8; uint16 constant RAW_MYSTY_BLUE = RAW_FISH_BASE + 9; uint16 constant RAW_FLITFISH = RAW_FISH_BASE + 10; uint16 constant RAW_RAZORFISH = RAW_FISH_BASE + 11; uint16 constant RAW_QUAFFER = RAW_FISH_BASE + 12; uint16 constant RAW_ROXA = RAW_FISH_BASE + 13; uint16 constant RAW_AZACUDDA = RAW_FISH_BASE + 14; uint16 constant RAW_STONECLAW = RAW_FISH_BASE + 15; uint16 constant RAW_CRUSKAN = RAW_FISH_BASE + 16; uint16 constant RAW_CHODFISH = RAW_FISH_BASE + 17; uint16 constant RAW_DOUBTFISH = RAW_FISH_BASE + 18; uint16 constant RAW_ROSEFIN = RAW_FISH_BASE + 19; uint16 constant RAW_SPHINX_FISH = RAW_FISH_BASE + 20; uint16 constant RAW_SHAW = RAW_FISH_BASE + 21; uint16 constant RAW_VANISHING_PERCH = RAW_FISH_BASE + 22; uint16 constant RAW_VIPER_BASS = RAW_FISH_BASE + 23; uint16 constant RAW_WATER_SERPENT = RAW_FISH_BASE + 24; uint16 constant RAW_WHISKFIN = RAW_FISH_BASE + 25; uint16 constant RAW_MHARA = RAW_FISH_BASE + 26; uint16 constant RAW_GRAN_SQUIN = RAW_FISH_BASE + 27; uint16 constant RAW_LANCER = RAW_FISH_BASE + 28; uint16 constant RAW_OCTACLE = RAW_FISH_BASE + 29; uint16 constant RAW_DRAGONFISH = RAW_FISH_BASE + 30; uint16 constant RAW_YERESPATUM = RAW_FISH_BASE + 31; uint16 constant RAW_FISH_MAX = RAW_FISH_BASE + 255; // Cooked fish uint16 constant COOKED_FISH_BASE = 11008; uint16 constant COOKED_MINNUS = COOKED_FISH_BASE; uint16 constant COOKED_BLEKK = COOKED_FISH_BASE + 1; uint16 constant COOKED_SKRIMP = COOKED_FISH_BASE + 2; uint16 constant COOKED_FEOLA = COOKED_FISH_BASE + 3; uint16 constant COOKED_ANCHO = COOKED_FISH_BASE + 4; uint16 constant COOKED_TROUT = COOKED_FISH_BASE + 5; uint16 constant COOKED_ROJJA = COOKED_FISH_BASE + 6; uint16 constant COOKED_BOWFISH = COOKED_FISH_BASE + 7; uint16 constant COOKED_GOLDFISH = COOKED_FISH_BASE + 8; uint16 constant COOKED_MYSTY_BLUE = COOKED_FISH_BASE + 9; uint16 constant COOKED_FLITFISH = COOKED_FISH_BASE + 10; uint16 constant COOKED_RAZORFISH = COOKED_FISH_BASE + 11; uint16 constant COOKED_QUAFFER = COOKED_FISH_BASE + 12; uint16 constant COOKED_ROXA = COOKED_FISH_BASE + 13; uint16 constant COOKED_AZACUDDA = COOKED_FISH_BASE + 14; uint16 constant COOKED_STONECLAW = COOKED_FISH_BASE + 15; uint16 constant COOKED_CRUSKAN = COOKED_FISH_BASE + 16; uint16 constant COOKED_CHODFISH = COOKED_FISH_BASE + 17; uint16 constant COOKED_DOUBTFISH = COOKED_FISH_BASE + 18; uint16 constant COOKED_ROSEFIN = COOKED_FISH_BASE + 19; uint16 constant COOKED_SPHINX_FISH = COOKED_FISH_BASE + 20; uint16 constant COOKED_SHAW = COOKED_FISH_BASE + 21; uint16 constant COOKED_VANISHING_PERCH = COOKED_FISH_BASE + 22; uint16 constant COOKED_VIPER_BASS = COOKED_FISH_BASE + 23; uint16 constant COOKED_WATER_SERPENT = COOKED_FISH_BASE + 24; uint16 constant COOKED_WHISKFIN = COOKED_FISH_BASE + 25; uint16 constant COOKED_MHARA = COOKED_FISH_BASE + 26; uint16 constant COOKED_GRAN_SQUIN = COOKED_FISH_BASE + 27; uint16 constant COOKED_LANCER = COOKED_FISH_BASE + 28; uint16 constant COOKED_OCTACLE = COOKED_FISH_BASE + 29; uint16 constant COOKED_DRAGONFISH = COOKED_FISH_BASE + 30; uint16 constant COOKED_YERESPATUM = COOKED_FISH_BASE + 31; uint16 constant COOKED_FISH_MAX = COOKED_FISH_BASE + 255; // Farming uint16 constant FARMING_BASE = 11264; uint16 constant BONEMEAL = FARMING_BASE; uint16 constant FARMING_MAX = FARMING_BASE + 255; // Mining uint16 constant ORE_BASE = 11520; uint16 constant COPPER_ORE = ORE_BASE; uint16 constant TIN_ORE = ORE_BASE + 1; uint16 constant IRON_ORE = ORE_BASE + 2; uint16 constant SAPPHIRE = ORE_BASE + 3; uint16 constant COAL_ORE = ORE_BASE + 4; uint16 constant EMERALD = ORE_BASE + 5; uint16 constant MITHRIL_ORE = ORE_BASE + 6; uint16 constant RUBY = ORE_BASE + 7; uint16 constant ADAMANTINE_ORE = ORE_BASE + 8; uint16 constant AMETHYST = ORE_BASE + 9; uint16 constant DIAMOND = ORE_BASE + 10; uint16 constant RUNITE_ORE = ORE_BASE + 11; uint16 constant DRAGONSTONE = ORE_BASE + 12; uint16 constant TITANIUM_ORE = ORE_BASE + 13; uint16 constant ORICHALCUM_ORE = ORE_BASE + 14; uint16 constant ORE_MAX = ORE_BASE + 255; // Arrows uint16 constant ARROW_BASE = 11776; uint16 constant BRONZE_ARROW = ARROW_BASE; uint16 constant ARROW_MAX = ARROW_BASE + 255; // Scrolls uint16 constant SCROLL_BASE = 12032; uint16 constant SHADOW_SCROLL = SCROLL_BASE; uint16 constant NATURE_SCROLL = SCROLL_BASE + 1; uint16 constant AQUA_SCROLL = SCROLL_BASE + 2; uint16 constant HELL_SCROLL = SCROLL_BASE + 3; uint16 constant AIR_SCROLL = SCROLL_BASE + 4; uint16 constant BARRAGE_SCROLL = SCROLL_BASE + 5; uint16 constant FREEZE_SCROLL = SCROLL_BASE + 6; uint16 constant ANCIENT_SCROLL = SCROLL_BASE + 7; uint16 constant SCROLL_MAX = SCROLL_BASE + 255; // Free interval uint16 constant NOT_USED_BASE = 12544; uint16 constant NOT_USED_MAX = 12799; // Boosts uint16 constant BOOST_BASE = 12800; uint16 constant COMBAT_BOOST = BOOST_BASE; uint16 constant XP_BOOST = BOOST_BASE + 1; uint16 constant GATHERING_BOOST = BOOST_BASE + 2; uint16 constant SKILL_BOOST = BOOST_BASE + 3; uint16 constant ABSENCE_BOOST = BOOST_BASE + 4; uint16 constant PRAY_TO_THE_BEARDIE = BOOST_BASE + 5; uint16 constant GO_OUTSIDE = BOOST_BASE + 6; uint16 constant RAINING_RARES = BOOST_BASE + 7; uint16 constant BOOST_MAX = 13055; // MISC uint16 constant MISC_BASE = 65535; uint16 constant MYSTERY_BOX = MISC_BASE; uint16 constant RAID_PASS = MISC_BASE - 1; uint16 constant NATUOW_HIDE = MISC_BASE - 2; uint16 constant NATUOW_LEATHER = MISC_BASE - 3; uint16 constant SMALL_BONE = MISC_BASE - 4; uint16 constant MEDIUM_BONE = MISC_BASE - 5; uint16 constant LARGE_BONE = MISC_BASE - 6; uint16 constant DRAGON_BONE = MISC_BASE - 7; uint16 constant DRAGON_TEETH = MISC_BASE - 8; uint16 constant DRAGON_SCALE = MISC_BASE - 9; uint16 constant POISON = MISC_BASE - 10; uint16 constant STRING = MISC_BASE - 11; uint16 constant ROPE = MISC_BASE - 12; uint16 constant LEAF_FRAGMENTS = MISC_BASE - 13; uint16 constant VENOM_POUCH = MISC_BASE - 14; uint16 constant BAT_WING = MISC_BASE - 15; uint16 constant BAT_WING_PATCH = MISC_BASE - 16; uint16 constant THREAD_NEEDLE = MISC_BASE - 17; uint16 constant LOSSUTH_TEETH = MISC_BASE - 18; uint16 constant LOSSUTH_SCALE = MISC_BASE - 19; uint16 constant FEATHER = MISC_BASE - 20; uint16 constant QUARTZ_INFUSED_FEATHER = MISC_BASE - 21; uint16 constant BARK_CHUNK = MISC_BASE - 22; uint16 constant APPRENTICE_FABRIC = MISC_BASE - 23; uint16 constant MAGE_FABRIC = MISC_BASE - 24; uint16 constant SORCERER_FABRIC = MISC_BASE - 25; uint16 constant SEERS_FABRIC = MISC_BASE - 26; uint16 constant SHAMAN_FABRIC = MISC_BASE - 27; uint16 constant MASTER_FABRIC = MISC_BASE - 28; uint16 constant DRAGON_KEY = MISC_BASE - 29; uint16 constant BONE_KEY = MISC_BASE - 30; uint16 constant NATURE_KEY = MISC_BASE - 31; uint16 constant AQUA_KEY = MISC_BASE - 32; uint16 constant BLUECANAR = MISC_BASE - 33; uint16 constant ANURGAT = MISC_BASE - 34; uint16 constant RUFARUM = MISC_BASE - 35; uint16 constant WHITE_DEATH_SPORE = MISC_BASE - 36; uint16 constant ENCHANTED_ACORN = MISC_BASE - 37; uint16 constant ACORN_PATCH = MISC_BASE - 38; uint16 constant MISC_MIN = 32768;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; enum BoostType { NONE, ANY_XP, COMBAT_XP, NON_COMBAT_XP, GATHERING, ABSENCE } struct Equipment { uint16 itemTokenId; uint24 amount; } enum Skill { NONE, COMBAT, // This is a helper which incorporates all combat skills, attack <-> magic, defence, health etc MELEE, RANGE, MAGIC, DEFENCE, HEALTH, RESERVED_COMBAT, MINING, WOODCUTTING, FISHING, SMITHING, THIEVING, CRAFTING, COOKING, FIREMAKING } struct Attire { uint16 head; uint16 neck; uint16 body; uint16 arms; uint16 legs; uint16 feet; uint16 ring; uint16 reserved1; } struct CombatStats { // From skill points int16 melee; int16 magic; int16 range; int16 health; // These include equipment int16 meleeDefence; int16 magicDefence; int16 rangeDefence; } enum CombatStyle { NONE, ATTACK, DEFENCE }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {QueuedAction} from "./actions.sol"; import {Skill, BoostType, CombatStats, Equipment} from "./misc.sol"; // 4 bytes for each level. 0x00000000 is the first level, 0x00000054 is the second, etc. bytes constant XP_BYTES = hex"0000000000000054000000AE0000010E00000176000001E60000025E000002DE00000368000003FD0000049B00000546000005FC000006C000000792000008730000096400000A6600000B7B00000CA400000DE100000F36000010A200001229000013CB0000158B0000176B0000196E00001B9400001DE20000205A000022FF000025D5000028DD00002C1E00002F99000033540000375200003B9A000040300000451900004A5C00004FFF0000560900005C810000637000006ADD000072D100007B570000847900008E42000098BE0000A3F90000B0020000BCE70000CAB80000D9860000E9630000FA6200010C990001201D0001350600014B6F0001637300017D2E000198C10001B64E0001D5F80001F7E600021C430002433B00026CFD000299BE0002C9B30002FD180003342B00036F320003AE730003F23D00043AE3000488BE0004DC2F0005359B000595700005FC2400066A360006E02D00075E990007E6160008774C000912EB0009B9B4000A6C74000B2C06000BF956000CD561000DC134000EBDF3000FCCD40010EF24"; enum EquipPosition { NONE, HEAD, NECK, BODY, ARMS, LEGS, FEET, SPARE1, SPARE2, LEFT_HAND, RIGHT_HAND, BOTH_HANDS, ARROW_SATCHEL, MAGIC_BAG, FOOD, AUX, // wood, seeds etc.. BOOST_VIAL } struct Player { uint40 currentActionStartTime; // The start time of the first queued action Skill currentActionProcessedSkill1; // The skill that the queued action has already gained XP in uint24 currentActionProcessedXPGained1; // The amount of XP that the queued action has already gained Skill currentActionProcessedSkill2; uint24 currentActionProcessedXPGained2; uint16 currentActionProcessedFoodConsumed; uint16 currentActionProcessedBaseInputItemsConsumedNum; // e.g scrolls, crafting materials etc Skill skillBoosted1; // The skill that is boosted Skill skillBoosted2; // The second skill that is boosted uint56 totalXP; Skill currentActionProcessedSkill3; uint24 currentActionProcessedXPGained3; // TODO: Can be up to 7 QueuedAction[] actionQueue; string name; // Raw name } struct Item { EquipPosition equipPosition; bool exists; // Can it be transferred? bool isTransferable; // Food uint16 healthRestored; // Boost vial BoostType boostType; uint16 boostValue; // Varies, could be the % increase uint24 boostDuration; // How long the effect of the boost last // Combat stats int16 melee; int16 magic; int16 range; int16 meleeDefence; int16 magicDefence; int16 rangeDefence; int16 health; // Minimum requirements in this skill to use this item (can be NONE) Skill skill; uint32 minXP; } struct PlayerBoostInfo { uint40 startTime; uint24 duration; uint16 value; uint16 itemTokenId; // Get the effect of it BoostType boostType; } // This is effectively a ratio to produce 1 of outputTokenId. // Fixed based available actions that can be undertaken for an action struct ActionChoice { Skill skill; // Skill that this action choice is related to uint32 minXP; // Min XP in the skill to be able to do this action choice int16 skillDiff; // How much the skill is increased/decreased by this action choice uint24 rate; // Rate of output produced per hour (base 1000) 3 decimals uint24 xpPerHour; uint16 inputTokenId1; uint8 inputAmount1; uint16 inputTokenId2; uint8 inputAmount2; uint16 inputTokenId3; uint8 inputAmount3; uint16 outputTokenId; uint8 outputAmount; uint8 successPercent; // 0-100 } // Must be in the same order as Skill struct PackedXP { uint40 melee; uint40 range; uint40 magic; uint40 defence; uint40 health; uint40 reservedCombat; // Next slot uint40 mining; uint40 woodcutting; uint40 fishing; uint40 smithing; uint40 thieving; uint40 crafting; // Next slot uint40 cooking; uint40 firemaking; } struct AvatarInfo { string name; string description; string imageURI; Skill[2] startSkills; // Can be NONE } struct PastRandomRewardInfo { uint64 queueId; uint16 itemTokenId; uint24 amount; } struct PendingQueuedActionEquipmentState { uint[] consumedItemTokenIds; uint[] consumedAmounts; uint[] producedItemTokenIds; uint[] producedAmounts; } struct PendingQueuedActionMetadata { uint32 xpGained; // total xp gained uint32 rolls; bool died; uint16 actionId; uint64 queueId; uint24 elapsedTime; uint24 xpElapsedTime; } struct PendingQueuedActionData { // The amount of XP that the queued action has already gained Skill skill1; uint24 xpGained1; Skill skill2; // Most likely health uint24 xpGained2; Skill skill3; // Could come uint24 xpGained3; // How much food is consumed in the current action so far uint16 foodConsumed; // How many base consumables are consumed in the current action so far uint16 baseInputItemsConsumedNum; } struct PendingQueuedActionProcessed { // XP gained during this session Skill[] skills; uint32[] xpGainedSkills; // Data for the current action which has been previously processed, this is used to store on the Player PendingQueuedActionData currentAction; } struct QuestState { uint[] consumedItemTokenIds; uint[] consumedAmounts; uint[] rewardItemTokenIds; uint[] rewardAmounts; PlayerQuest[] activeQuestInfo; uint[] questsCompleted; Skill[] skills; // Skills gained XP in uint32[] xpGainedSkills; // XP gained in these skills } struct PendingQueuedActionState { // These 2 are in sync. Separated to reduce gas/deployment costs as these are passed down many layers. PendingQueuedActionEquipmentState[] equipmentStates; PendingQueuedActionMetadata[] actionMetadatas; QueuedAction[] remainingQueuedActions; PendingQueuedActionProcessed processedData; PastRandomRewardInfo[] producedPastRandomRewards; uint[] xpRewardItemTokenIds; uint[] xpRewardAmounts; uint[] dailyRewardItemTokenIds; uint[] dailyRewardAmounts; bytes32 dailyRewardMask; QuestState quests; uint numPastRandomRewardInstancesToRemove; } struct FullAttireBonusInput { Skill skill; uint8 bonusXPPercent; uint8 bonusRewardsPercent; // 3 = 3% uint16[5] itemTokenIds; // 0 = head, 1 = body, 2 arms, 3 body, 4 = feet } struct Quest { uint16 dependentQuestId; // The quest that must be completed before this one can be started uint16 actionId1; // action to do uint16 actionNum1; // how many (up to 65535) uint16 actionId2; // another action to do uint16 actionNum2; // how many (up to 65535) uint16 actionChoiceId; // actionChoice to perform uint16 actionChoiceNum; // how many to do (base number), (up to 65535) Skill skillReward; // The skill to reward XP to uint16 skillXPGained; // The amount of XP to give (up to 65535) uint16 rewardItemTokenId1; // Reward an item uint16 rewardAmount1; // amount of the reward (up to 65535) uint16 rewardItemTokenId2; // Reward another item uint16 rewardAmount2; // amount of the reward (up to 65535) uint16 burnItemTokenId; // Burn an item uint16 burnAmount; // amount of the burn (up to 65535) uint16 questId; // Unique id for this quest bool requireActionsCompletedBeforeBurning; // If true, the player must complete the actions before the item can be burnt } struct PlayerQuest { uint32 questId; uint16 actionCompletedNum1; uint16 actionCompletedNum2; uint16 actionChoiceCompletedNum; uint16 burnCompletedAmount; bool isFixed; } // Contains everything you need to create an item struct InputItem { CombatStats combatStats; uint16 tokenId; EquipPosition equipPosition; // Can it be transferred? bool isTransferable; // Minimum requirements in this skill Skill skill; uint32 minXP; // Food uint16 healthRestored; // Boost BoostType boostType; uint16 boostValue; // Varies, could be the % increase uint24 boostDuration; // How long the effect of the boost vial last // uri string metadataURI; string name; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {BoostType, Equipment} from "./misc.sol"; struct GuaranteedReward { uint16 itemTokenId; uint16 rate; // num per hour, base 10 (1 decimal) } struct RandomReward { uint16 itemTokenId; uint16 chance; // out of 65535 uint8 amount; // out of 255 } struct PendingRandomReward { uint16 actionId; uint40 startTime; uint24 xpElapsedTime; uint64 queueId; BoostType boostType; // Could be removed if necessary, just used as an optimization uint16 boostItemTokenId; uint24 elapsedTime; uint40 boostStartTime; // When the boost was started // Full equipment at the time this was generated uint8 fullAttireBonusRewardsPercent; } struct ActionRewards { uint16 guaranteedRewardTokenId1; uint16 guaranteedRewardRate1; // Num per hour, base 10 (1 decimal). Max 6553.5 per hour uint16 guaranteedRewardTokenId2; uint16 guaranteedRewardRate2; uint16 guaranteedRewardTokenId3; uint16 guaranteedRewardRate3; // Random chance rewards uint16 randomRewardTokenId1; uint16 randomRewardChance1; // out of 65335 uint8 randomRewardAmount1; // out of 255 uint16 randomRewardTokenId2; uint16 randomRewardChance2; uint8 randomRewardAmount2; uint16 randomRewardTokenId3; uint16 randomRewardChance3; uint8 randomRewardAmount3; uint16 randomRewardTokenId4; uint16 randomRewardChance4; uint8 randomRewardAmount4; // No more room! } struct XPThresholdReward { uint32 xpThreshold; Equipment[] rewards; } uint constant MAX_GUARANTEED_REWARDS_PER_ACTION = 3; uint constant MAX_RANDOM_REWARDS_PER_ACTION = 4; uint constant MAX_REWARDS_PER_ACTION = MAX_GUARANTEED_REWARDS_PER_ACTION + MAX_RANDOM_REWARDS_PER_ACTION; uint constant MAX_CONSUMED_PER_ACTION = 3; uint constant MAX_QUEST_REWARDS = 2; // 4 bytes for each threshold, starts at 500 xp in decimal bytes constant xpRewardBytes = hex"00000000000001F4000003E8000009C40000138800002710000075300000C350000186A00001D4C0000493E0000557300007A120000927C0000B71B0";
//SPDX-License-Identifier: MIT pragma solidity ^0.8.20; interface IBankFactory { function bankAddress(uint clanId) external view returns (address); function createdHere(address bank) external view returns (bool); function createBank(address from, uint clanId) external returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IBrushToken is IERC20 { function burn(uint256 _amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; interface IClans { function canWithdraw(uint _clanId, uint _playerId) external view returns (bool); function isClanMember(uint clanId, uint playerId) external view returns (bool); function maxBankCapacity(uint clanId) external view returns (uint16); function maxMemberCapacity(uint clanId) external view returns (uint16); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "../globals/misc.sol"; interface IPlayers { function clearEverythingBeforeTokenTransfer(address from, uint tokenId) external; function getURI( uint playerId, string calldata name, string calldata avatarName, string calldata avatarDescription, string calldata imageURI ) external view returns (string memory); function mintedPlayer( address from, uint playerId, Skill[2] calldata startSkills, bool makeActive, uint[] calldata startingItemTokenIds, uint[] calldata startingAmounts ) external; function isOwnerOfPlayerAndActive(address from, uint playerId) external view returns (bool); function activePlayer(address owner) external view returns (uint playerId); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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. * * By default, the owner account will be the one that deploys the contract. 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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); error CallerIsNotOwner(); error NewOwnerIsZeroAddress(); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @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 CallerIsNotOwner(); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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 NewOwnerIsZeroAddress(); } _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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.20; import "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { error NewImplementationIsNotAContract(); error NewImplementationNotUUPS(); error UnsupportedProxiableUUID(); error NewAdminIsZeroAddress(); error NewBeaconIsNotAContract(); error BeaconImplementationIsNotAContract(); error AddressIsNotContract(); function __ERC1967Upgrade_init() internal onlyInitializing {} function __ERC1967Upgrade_init_unchained() internal onlyInitializing {} // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (!AddressUpgradeable.isContract(newImplementation)) { revert NewImplementationIsNotAContract(); } StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != _IMPLEMENTATION_SLOT) { revert UnsupportedProxiableUUID(); } } catch { revert NewImplementationNotUUPS(); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert NewAdminIsZeroAddress(); } StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (!AddressUpgradeable.isContract(newBeacon)) { revert NewBeaconIsNotAContract(); } if (!AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation())) { revert BeaconImplementationIsNotAContract(); } StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) { if (!AddressUpgradeable.isContract(target)) { revert AddressIsNotContract(); } // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { error NotInitializing(); error IsInitializing(); error AlreadyInitialized(); /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; if ( !((isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1)) ) { revert AlreadyInitialized(); } _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { if (!(!_initializing && _initialized < version)) { revert AlreadyInitialized(); } _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { if (!_initializing) { revert NotInitializing(); } _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { if (_initializing) { revert IsInitializing(); } if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822ProxiableUpgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol"; import {ERC1967UpgradeUpgradeable} from "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { error FunctionMustBeCalledThroughDelegateCall(); error FunctionMustBeCalledThroughActiveProxy(); error FunctionMustNotBeCalledThroughDelegateCall(); function __UUPSUpgradeable_init() internal onlyInitializing {} function __UUPSUpgradeable_init_unchained() internal onlyInitializing {} /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { if (address(this) == __self) { revert FunctionMustBeCalledThroughDelegateCall(); } if (_getImplementation() != __self) { revert FunctionMustBeCalledThroughActiveProxy(); } _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { if (address(this) != __self) { revert FunctionMustNotBeCalledThroughDelegateCall(); } _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { error RecipientMayHaveReverted(); error CallToNonContract(); error InsufficientAllowance(); error InsufficientBalance(); /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert InsufficientBalance(); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert RecipientMayHaveReverted(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { if (address(this).balance < value) { revert InsufficientAllowance(); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (!isContract(target)) { revert CallToNonContract(); } } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.20; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing {} function __Context_init_unchained() internal onlyInitializing {} function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
{ "optimizer": { "enabled": true, "runs": 9999999, "details": { "yul": true } }, "evmVersion": "paris", "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": { "contracts/EstforLibrary.sol": { "EstforLibrary": "0x9bcb040b6ffc0adcedda870f0a8e18e4278c72de" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressIsNotContract","type":"error"},{"inputs":[],"name":"AlreadyInClan","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"AlreadySentInvite","type":"error"},{"inputs":[],"name":"AlreadySentJoinRequest","type":"error"},{"inputs":[],"name":"BankCapacityTooLow","type":"error"},{"inputs":[],"name":"BeaconImplementationIsNotAContract","type":"error"},{"inputs":[],"name":"CallerIsNotOwner","type":"error"},{"inputs":[],"name":"CannotDowngradeTier","type":"error"},{"inputs":[],"name":"CannotRenounceToSelf","type":"error"},{"inputs":[],"name":"CannotSetSameRank","type":"error"},{"inputs":[],"name":"ChangingRankEqualOrHigherThanSelf","type":"error"},{"inputs":[],"name":"ChangingRankOfPlayerEqualOrHigherThanSelf","type":"error"},{"inputs":[],"name":"ChangingRankOfPlayerHigherThanSelf","type":"error"},{"inputs":[],"name":"ClanDestroyFailedHasMembers","type":"error"},{"inputs":[],"name":"ClanDoesNotExist","type":"error"},{"inputs":[],"name":"ClanIsFull","type":"error"},{"inputs":[],"name":"DiscordInvalidCharacters","type":"error"},{"inputs":[],"name":"DiscordTooLong","type":"error"},{"inputs":[],"name":"DiscordTooShort","type":"error"},{"inputs":[],"name":"FunctionMustBeCalledThroughActiveProxy","type":"error"},{"inputs":[],"name":"FunctionMustBeCalledThroughDelegateCall","type":"error"},{"inputs":[],"name":"FunctionMustNotBeCalledThroughDelegateCall","type":"error"},{"inputs":[],"name":"ImageIdTooLow","type":"error"},{"inputs":[],"name":"InvalidImageId","type":"error"},{"inputs":[],"name":"InviteDoesNotExist","type":"error"},{"inputs":[],"name":"IsInitializing","type":"error"},{"inputs":[],"name":"MemberCapacityTooLow","type":"error"},{"inputs":[],"name":"NameAlreadyExists","type":"error"},{"inputs":[],"name":"NameInvalidCharacters","type":"error"},{"inputs":[],"name":"NameTooLong","type":"error"},{"inputs":[],"name":"NameTooShort","type":"error"},{"inputs":[],"name":"NewAdminIsZeroAddress","type":"error"},{"inputs":[],"name":"NewBeaconIsNotAContract","type":"error"},{"inputs":[],"name":"NewImplementationIsNotAContract","type":"error"},{"inputs":[],"name":"NewImplementationNotUUPS","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoInvitesToDelete","type":"error"},{"inputs":[],"name":"NoJoinRequest","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotMemberOfClan","type":"error"},{"inputs":[],"name":"NotOwnerOfPlayer","type":"error"},{"inputs":[],"name":"NotOwnerOfPlayerAndActive","type":"error"},{"inputs":[],"name":"OwnerExists","type":"error"},{"inputs":[],"name":"PriceTooLow","type":"error"},{"inputs":[],"name":"RankMustBeLowerRenounce","type":"error"},{"inputs":[],"name":"RankNotHighEnough","type":"error"},{"inputs":[],"name":"TelegramInvalidCharacters","type":"error"},{"inputs":[],"name":"TelegramTooLong","type":"error"},{"inputs":[],"name":"TierAlreadyExists","type":"error"},{"inputs":[],"name":"TierDoesNotExist","type":"error"},{"inputs":[],"name":"UnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint16","name":"maxMemberCapacity","type":"uint16"},{"internalType":"uint16","name":"maxBankCapacity","type":"uint16"},{"internalType":"uint24","name":"maxImageId","type":"uint24"},{"internalType":"uint40","name":"minimumAge","type":"uint40"},{"internalType":"uint80","name":"price","type":"uint80"}],"indexed":false,"internalType":"struct Clans.Tier[]","name":"tiers","type":"tuple[]"}],"name":"AddTiers","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"},{"indexed":false,"internalType":"string[]","name":"clanInfo","type":"string[]"},{"indexed":false,"internalType":"uint256","name":"imageId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tierId","type":"uint256"}],"name":"ClanCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"}],"name":"ClanDestroyed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"},{"indexed":false,"internalType":"string[]","name":"clanInfo","type":"string[]"},{"indexed":false,"internalType":"uint256","name":"imageId","type":"uint256"}],"name":"ClanEdited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"ClanOwnerLeft","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"ClanOwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tierId","type":"uint256"}],"name":"ClanUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newCost","type":"uint256"}],"name":"EditNameCost","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint16","name":"maxMemberCapacity","type":"uint16"},{"internalType":"uint16","name":"maxBankCapacity","type":"uint16"},{"internalType":"uint24","name":"maxImageId","type":"uint24"},{"internalType":"uint40","name":"minimumAge","type":"uint40"},{"internalType":"uint80","name":"price","type":"uint80"}],"indexed":false,"internalType":"struct Clans.Tier[]","name":"tiers","type":"tuple[]"}],"name":"EditTiers","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"InviteAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fromPlayerId","type":"uint256"}],"name":"InviteSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"invitedPlayerIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"deletedInvitesPlayerId","type":"uint256"}],"name":"InvitesDeletedByClan","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"clanIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"InvitesDeletedByPlayer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"acceptedByPlayerId","type":"uint256"}],"name":"JoinRequestAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"JoinRequestRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"JoinRequestSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"MemberLeft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"memberId","type":"uint256"},{"indexed":false,"internalType":"enum Clans.ClanRank","name":"rank","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"PlayerRankUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"clanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerId","type":"uint256"},{"indexed":false,"internalType":"enum Clans.ClanRank","name":"clan","type":"uint8"}],"name":"SetClanRank","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"acceptInvite","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_member","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"acceptJoinRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint16","name":"maxMemberCapacity","type":"uint16"},{"internalType":"uint16","name":"maxBankCapacity","type":"uint16"},{"internalType":"uint24","name":"maxImageId","type":"uint24"},{"internalType":"uint40","name":"minimumAge","type":"uint40"},{"internalType":"uint80","name":"price","type":"uint80"}],"internalType":"struct Clans.Tier[]","name":"_tiers","type":"tuple[]"}],"name":"addTiers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bankFactory","outputs":[{"internalType":"contract IBankFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"canWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_memberId","type":"uint256"},{"internalType":"enum Clans.ClanRank","name":"_rank","type":"uint8"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"changeRank","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"clanId","type":"uint256"}],"name":"clans","outputs":[{"internalType":"uint80","name":"owner","type":"uint80"},{"internalType":"uint16","name":"imageId","type":"uint16"},{"internalType":"uint16","name":"memberCount","type":"uint16"},{"internalType":"uint40","name":"createdTimestamp","type":"uint40"},{"internalType":"uint8","name":"tierId","type":"uint8"},{"internalType":"string","name":"name","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_playerId","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_discord","type":"string"},{"internalType":"string","name":"_telegram","type":"string"},{"internalType":"uint16","name":"_imageId","type":"uint16"},{"internalType":"uint8","name":"_tierId","type":"uint8"}],"name":"createClan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256[]","name":"_invitedPlayerIds","type":"uint256[]"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"deleteInvitesAsClan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_clanIds","type":"uint256[]"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"deleteInvitesAsPlayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_discord","type":"string"},{"internalType":"string","name":"_telegram","type":"string"},{"internalType":"uint256","name":"_imageId","type":"uint256"}],"name":"editClan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"editNameCost","outputs":[{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint16","name":"maxMemberCapacity","type":"uint16"},{"internalType":"uint16","name":"maxBankCapacity","type":"uint16"},{"internalType":"uint24","name":"maxImageId","type":"uint24"},{"internalType":"uint40","name":"minimumAge","type":"uint40"},{"internalType":"uint80","name":"price","type":"uint80"}],"internalType":"struct Clans.Tier[]","name":"_tiers","type":"tuple[]"}],"name":"editTiers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"getClanNameOfPlayer","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"getClanTierMembership","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"hasInviteRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBrushToken","name":"_brush","type":"address"},{"internalType":"contract IERC1155","name":"_playerNFT","type":"address"},{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address","name":"_dev","type":"address"},{"internalType":"uint80","name":"_editNameCost","type":"uint80"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_member","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"inviteMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"isClanMember","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"isMemberOfAnyClan","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"lowercaseNames","outputs":[{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"}],"name":"maxBankCapacity","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"}],"name":"maxMemberCapacity","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextClanId","outputs":[{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"clanId","type":"uint256"}],"name":"ownerlessClanTimestamps","outputs":[{"internalType":"uint40","name":"timestampLeft","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"playerId","type":"uint256"}],"name":"playerInfo","outputs":[{"internalType":"uint32","name":"clanId","type":"uint32"},{"internalType":"enum Clans.ClanRank","name":"rank","type":"uint8"},{"internalType":"uint32","name":"requestedClanId","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"removeJoinRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_newOwner","type":"uint256"},{"internalType":"enum Clans.ClanRank","name":"_newRank","type":"uint8"}],"name":"renounceOwnershipTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"}],"name":"requestToJoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBankFactory","name":"_bankFactory","type":"address"}],"name":"setBankFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint72","name":"_editNameCost","type":"uint72"}],"name":"setEditNameCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPlayers","name":"_players","type":"address"}],"name":"setPlayers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tiers","outputs":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint16","name":"maxMemberCapacity","type":"uint16"},{"internalType":"uint16","name":"maxBankCapacity","type":"uint16"},{"internalType":"uint24","name":"maxImageId","type":"uint24"},{"internalType":"uint40","name":"minimumAge","type":"uint40"},{"internalType":"uint80","name":"price","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_clanId","type":"uint256"},{"internalType":"uint256","name":"_playerId","type":"uint256"},{"internalType":"uint8","name":"_newTierId","type":"uint8"}],"name":"upgradeClan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60a080604052346200009e57306080526000549060ff8260081c166200008f575060ff8082161062000053575b6040516150d39081620000a48239608051818181611d82015281816120ee015261272b0152f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a1386200002c565b63ce446e0f60e01b8152600490fd5b600080fdfe608080604052600436101561001357600080fd5b60003560e01c908163039af9eb146132cc57508063049ca36f1461328157806315007980146131b8578063188f3fbe146131495780631cfc4fb814612f9a57806321d856db1461298457806326e3cc251461291f5780633659cfe6146126da578063421f9a6e146126855780634b586fa01461244b5780634c47322e146123e75780634da27ac6146123bb5780634f1ef286146120725780634f90b4a214611ff05780635143c91114611dfc57806352d1902d14611d3c57806355a07c2114611b3c57806355f4d5ca14611ab657806366469a3a14611a0d5780637103ffdf146117c4578063715018a614611726578063757b81ef146116db57806378f46b8b1461164a578063843125f81461137d57806386992019146113045780638d779fe6146112b25780638d94b36b146111cc5780638da5cb5b1461117a578063900ba78a1461106b5780639c2c3fe014610e1b578063acaace5914610dc1578063acc255e514610d3b578063ad3e6e1414610c52578063b67531e214610a23578063bfecf6ce1461080b578063c9fe814b146106a3578063cd6d56be14610652578063d940ef7014610617578063ed5937b5146102dc578063f2fde38b1461024c5763ff2c5814146101e257600080fd5b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043560005260cf60205260ff60406000205460981c1660005260d1602052602061ffff60406000205460081c16604051908152f35b600080fd5b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610247576102836133ab565b61028b614ef5565b73ffffffffffffffffffffffffffffffffffffffff8116156102b2576102b090614f40565b005b60046040517f7448fbae000000000000000000000000000000000000000000000000000000008152fd5b34610247576102ea3661356c565b60ca546040517fe743862900000000000000000000000000000000000000000000000000000000815233600482015260248101839052602094929185908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b576000916105de575b50156105b457600081815260d08552604090205463ffffffff919082811684146103a35760046040517f4bafc272000000000000000000000000000000000000000000000000000000008152fd5b851c60ff1660058110156105855760021161055b578260005260cf85526040600020918460005260d086526040600020908481835460281c16036105315783549060ff8260981c1660005260d1885261ffff91828060406000205460081c169160601c161015610507576104bb61050295640100000000937fd14dd2cf75183e81cb02e488e65e13b85a687b87437ec44fa803b06fb671c3a19a8a60005260028301905260406000207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008154169055600181835460601c1601167fffffffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffff6dffff00000000000000000000000083549260601b169116179055565b85167fffffffffffffffffffffffffffffffffffffffffffffff00000000000000000083541617179055604051938493846040919493926060820195825260208201520152565b0390a1005b60046040517f56453ed6000000000000000000000000000000000000000000000000000000008152fd5b60046040517fc6fbedfe000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd52ab5d1000000000000000000000000000000000000000000000000000000008152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60046040517f538fc3f8000000000000000000000000000000000000000000000000000000008152fd5b6105fe9150853d8711610604575b6105f6818361344f565b810190613722565b85610355565b503d6105ec565b6040513d6000823e3d90fd5b3461024757610625366133ce565b9060005260cf602052600260406000200190600052602052602060ff604060002054166040519015158152f35b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043560005260d3602052602064ffffffffff60406000205416604051908152f35b34610247576106b1366133ce565b60cc546040517efdd58e0000000000000000000000000000000000000000000000000000000081523360048201526024810183905260209182908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b576000916107de575b50156107b4578160005260d081528263ffffffff604060002054160361078a5760cf90836000525269ffffffffffffffffffff60406000205416610760576102b0916144fd565b60046040517faebe7948000000000000000000000000000000000000000000000000000000008152fd5b60046040517f4bafc272000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0f1dd826000000000000000000000000000000000000000000000000000000008152fd5b90508181813d8311610804575b6107f5818361344f565b81010312610247575184610719565b503d6107eb565b346102475760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043567ffffffffffffffff81116102475761085a903690600401613402565b60cc546040517efdd58e00000000000000000000000000000000000000000000000000000000815233600482015260248035908201819052602094939290919085908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b576000916109f6575b50156107b45781156109cc5760005b8281106109245750927f284330b7aeacaa076942744a635969b490cf5cafa294d5b6c311f387078afa289361091b60405194859460408652604086019161386c565b918301520390a1005b61092f81848661382d565b35908160005260cf8087526002908160406000200185600052885260ff60406000205416156109a25761099d93600052875260406000200183600052865260406000207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541690556137d1565b6108d9565b60046040517fc57fa2ea000000000000000000000000000000000000000000000000000000008152fd5b60046040517f2a627d80000000000000000000000000000000000000000000000000000000008152fd5b90508481813d8311610a1c575b610a0d818361344f565b810103126102475751856108ca565b503d610a03565b346102475760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475767ffffffffffffffff60043560243582811161024757610a7690369060040161336e565b919060443584811161024757610a9090369060040161336e565b91909460643590811161024757610aab90369060040161336e565b929094608435938560005260209660cf885269ffffffffffffffffffff93610b4589866040600020541673ffffffffffffffffffffffffffffffffffffffff60cc541660405180809581947efdd58e00000000000000000000000000000000000000000000000000000000835233600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03915afa90811561060b57600091610c25575b50156107b4577fff9c4aa2c485437fd53cb8c1462dd050bd76f4e240718699dd1bb1bb248c6be499610bc3610bd995610c05988b60005260cf8d5260ff60406000205460981c1660005260d18d52610bbd62ffffff60406000205460281c168c6138a9565b8b61394d565b610c10575b610bd485858585613e84565b6140be565b908460005260cf865260406000205416604051958695865285015260806040850152608084019061373a565b9060608301520390a1005b610c208760cd5460a01c166145d9565b610bc8565b90508981813d8311610c4b575b610c3c818361344f565b8101031261024757518b610b58565b503d610c32565b346102475760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760243560443560ff811681036102475760cc546040517efdd58e00000000000000000000000000000000000000000000000000000000815233600482015260248101849052906020908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b57600091610d0a575b50156107b4576102b0916004356148c7565b90506020813d8211610d33575b81610d246020938361344f565b81010312610247575183610cf8565b3d9150610d17565b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043573ffffffffffffffffffffffffffffffffffffffff811680910361024757610d93614ef5565b7fffffffffffffffffffffffff000000000000000000000000000000000000000060ca54161760ca55600080f35b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610247576020610e1160043560005260d060205263ffffffff60406000205416151590565b6040519015158152f35b346102475760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760443560243560043560058310156102475760cc546040517efdd58e0000000000000000000000000000000000000000000000000000000081523360048201526064356024820181905294916020919082908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b5760009161103e575b50156107b4578360005260d081528263ffffffff604060002054160361078a578360005260d0815260ff80604060002054831c169186600052604060002054901c166005811015610585578281111561101457848603610fdb576005821015610585578111610fb1575b600581101561058557818114610f875781811115610f7a5781610f5d5750506102b0925061428f565b9160046102b095949293036141fc57610f7581614152565b6141fc565b5090916102b093926141fc565b60046040517fbebb6212000000000000000000000000000000000000000000000000000000008152fd5b60046040517fbea1b713000000000000000000000000000000000000000000000000000000008152fd5b6005821015610585578110610f345760046040517f1b1613f7000000000000000000000000000000000000000000000000000000008152fd5b60046040517f26d24e80000000000000000000000000000000000000000000000000000000008152fd5b90508181813d8311611064575b611055818361344f565b81010312610247575186610eca565b503d61104b565b3461024757611079366133ce565b60cc546040517efdd58e000000000000000000000000000000000000000000000000000000008152336004820152602481018390529192602092909183908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b5760009161114d575b50156107b457826040927f86ef48d3478dfc87f7a61b90ffdd3193d9862a68632a4c233e71d330b3bb5ce59460005260d08152836000207fffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffff81541690558351928352820152a1005b90508281813d8311611173575b611164818361344f565b810103126102475751846110e5565b503d61115a565b346102475760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024757602073ffffffffffffffffffffffffffffffffffffffff60975416604051908152f35b34610247576111da36613501565b906111e3614ef5565b60005b82811061121e576040517feda6ff97e5243629083aff63c9a0f9a5ad50c6d235c74b51e9ec92dc6ad5f6db9080610502868683614a65565b60ff8061123461122f848787614a47565b614a57565b1660005260d16020528060406000205416159081159161129a575b50611270578061126a6112656001938686614a47565b614b5b565b016111e6565b60046040517f4a41c37a000000000000000000000000000000000000000000000000000000008152fd5b90506112aa61122f838686614a47565b16158461124f565b346102475760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024757602073ffffffffffffffffffffffffffffffffffffffff60cb5416604051908152f35b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043560005260d060205263ffffffff6040600020541660005260cf60205261137961136560016040600020016135f7565b6040519182916020835260208301906136df565b0390f35b346102475760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043573ffffffffffffffffffffffffffffffffffffffff9081811680910361024757602435908282168092036102475760443583811680910361024757606435938416809403610247576084359169ffffffffffffffffffff831691828403610247576000549560ff8760081c16159687809861163d575b8015611626575b156115fc578760017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008316176000556115cd575b5060ff60005460081c16156115a3577dffffffffffffffffffff0000000000000000000000000000000000000000602095740100000000000000000000000000000000000000007f7934a8db3f8f75ea0c15b07050e7abbb51f58cfa3914f76450dc170f3d40d811986114d233614f40565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000968760c954161760c95560cc549460cd549760ce54161760ce557fffff000000000000000000000000000000000000000000000000000000000000809516171760cc5560a01b169216171760cd55604051908152a161154e57005b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b60046040517fd7e6bcf8000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011760005587611460565b60046040517f0dc149f0000000000000000000000000000000000000000000000000000000008152fd5b50303b15801561142c5750600160ff82161461142c565b50600160ff821610611425565b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043567ffffffffffffffff811161024757366023820112156102475760ff6116c560206116b2819436906024816004013591016134ca565b81604051938285809451938492016136bc565b810160d281520301902054166040519015158152f35b346102475760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024757602069ffffffffffffffffffff60cc5460a01c16604051908152f35b346102475760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475761175d614ef5565b600073ffffffffffffffffffffffffffffffffffffffff6097547fffffffffffffffffffffffff00000000000000000000000000000000000000008116609755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610247576117d2366133ce565b60ca546040517fe743862900000000000000000000000000000000000000000000000000000000815233600482015260248101839052602093929184908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b576000916119f0575b50156105b4578160005260cf835264ffffffffff60406000205460701c16156119c6578060005260d0835260406000209261188b8260005260d060205263ffffffff60406000205416151590565b61199c5783549363ffffffff8560281c168061190a575b7f5b4036fee23699edc6c33868b48eea7f82a415ae2715865db9ec6b74cc4701456040868686868b7fffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffff68ffffffff00000000008660281b1691161790558351928352820152a1005b93929190838514611972577f5b4036fee23699edc6c33868b48eea7f82a415ae2715865db9ec6b74cc470145957f86ef48d3478dfc87f7a61b90ffdd3193d9862a68632a4c233e71d330b3bb5ce56040809781519081528686820152a19550909192936118a2565b60046040517f177366d1000000000000000000000000000000000000000000000000000000008152fd5b60046040517f76cfa8c1000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd699f7e9000000000000000000000000000000000000000000000000000000008152fd5b611a079150843d8611610604576105f6818361344f565b8461183d565b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043560005260cf60205260ff6040600020611379611a5f6001835493016135f7565b604051938369ffffffffffffffffffff869516855261ffff808260501c1660208701528160601c16604086015264ffffffffff8160701c16606086015260981c16608084015260c060a084015260c08301906136df565b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043573ffffffffffffffffffffffffffffffffffffffff811680910361024757611b0e614ef5565b7fffffffffffffffffffffffff000000000000000000000000000000000000000060cb54161760cb55600080f35b3461024757611b4a366133ce565b60ca546040517fe7438629000000000000000000000000000000000000000000000000000000008152336004820152602481018390529192602092909183908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b57600091611d1f575b50156105b4578060005260cf82526040600020928060005260d08352604060002092600285019384825260ff60406000205416156109a25785549460ff8660981c1660005260d1835261ffff95868060406000205460081c169160601c161015610507577f4029968a3f2d34f7c8df00f90946159de86b935a5c57f786888ce5d1d7845d9c96604096611cbd92866000528552876000207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008154169055600181835460601c1601167fffffffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffff6dffff00000000000000000000000083549260601b169116179055565b7fffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffff64010000000063ffffffff86167fffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000084541617171690558351928352820152a1005b611d369150833d8511610604576105f6818361344f565b84611bb7565b346102475760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003611dd25760206040517f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8152f35b60046040517f7251afea000000000000000000000000000000000000000000000000000000008152fd5b3461024757611e0a3661356c565b60cc546040517efdd58e0000000000000000000000000000000000000000000000000000000081523360048201526024810183905291939160209182908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b57600091611fc3575b50156107b457600084815260d08252604090205463ffffffff81168314611ec05760046040517f4bafc272000000000000000000000000000000000000000000000000000000008152fd5b811c60ff1660058110156105855760021161055b578160005260cf81526040600020805460ff8160981c1660005260d1835261ffff8060406000205460081c169160601c16101561050757600201938360005284825260ff60406000205416611f99577f4369ab5e12e56ff9170c7037f6ff6af3a74a80f2eae2946ba5cd73dc0efd167094610502928560005252604060002060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055604051938493846040919493926060820195825260208201520152565b60046040517fcbc57df5000000000000000000000000000000000000000000000000000000008152fd5b90508181813d8311611fe9575b611fda818361344f565b81010312610247575185611e75565b503d611fd0565b3461024757611ffe36613501565b612006614ef5565b60005b81811061204257507fab0ba102ddeb1d896e289b4c68719d8a1f4a198be3ab6883484a1fe929718a4f9161050260405192839283614a65565b8061205e60ff61205861122f6001958789614a47565b1661378f565b61206c611265828587614a47565b01612009565b60407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610247576120a46133ab565b60243567ffffffffffffffff81116102475736602382011215610247576120d59036906024816004013591016134ca565b9073ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001690813014612391577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc91818354160361236757612149614ef5565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561217f5750506102b09150614fad565b82919216604051927f52d1902d0000000000000000000000000000000000000000000000000000000084526020938481600481865afa60009181612338575b506121ed5760046040517f81007d10000000000000000000000000000000000000000000000000000000008152fd5b0361230e576121fb82614fad565b604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2835115801590612306575b61223557005b813b156122de57506000838192846102b096519201905af43d156122d6573d9061225e82613490565b9161226c604051938461344f565b82523d60008484013e5b7f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c604051936122a485613433565b602785528401527f206661696c656400000000000000000000000000000000000000000000000000604084015261503f565b606090612276565b807f1fdb1d6d0000000000000000000000000000000000000000000000000000000060049252fd5b50600161222f565b60046040517f8ae7e94c000000000000000000000000000000000000000000000000000000008152fd5b9091508581813d8311612360575b612350818361344f565b81010312610247575190876121be565b503d612346565b60046040517f36a15c6e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0ce7e818000000000000000000000000000000000000000000000000000000008152fd5b346102475760206123cb366133ce565b60005260d0825263ffffffff6040600020541614604051908152f35b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043560005260d060205263ffffffff6040600020541660005260cf602052602060ff60406000205460981c16604051908152f35b346102475760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043560243567ffffffffffffffff81116102475761249d903690600401613402565b9160443573ffffffffffffffffffffffffffffffffffffffff60cc54169260405180947efdd58e0000000000000000000000000000000000000000000000000000000082526020958691818061251a8833600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03915afa90811561060b57600091612658575b50156107b457600082815260d08552604090205463ffffffff811684146125785760046040517f4bafc272000000000000000000000000000000000000000000000000000000008152fd5b841c60ff1660058110156105855760021161055b578260005260cf8452604060002085156109cc5760020160005b8681106125f75750506125ec907f473f1c3e2a696b3007a52e476d439236942f08e0cff330fc24aeefab41d0d98e9560606040519687968752860152606085019161386c565b9060408301520390a1005b61260281888561382d565b35908160005282875260ff60406000205416156109a2576126539160005282875260406000207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541690556137d1565b6125a6565b90508481813d831161267e575b61266f818361344f565b8101031261024757518661252d565b503d612665565b3461024757612693366133ce565b60005260d06020526040600020549063ffffffff82161490816126be575b6020826040519015158152f35b60ff915060201c166005811015610585576003111560206126b1565b34610247576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610247576127126133ab565b9073ffffffffffffffffffffffffffffffffffffffff807f000000000000000000000000000000000000000000000000000000000000000016803014612391577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90828254160361236757612785614ef5565b604051908382019282841067ffffffffffffffff8511176128f057836040526000835260ff7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914354166000146127e25750505050506102b090614fad565b8516906040517f52d1902d0000000000000000000000000000000000000000000000000000000081528581600481865afa600091816128c1575b5061284b5760046040517f81007d10000000000000000000000000000000000000000000000000000000008152fd5b0361230e5761285985614fad565b604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28151158015906128b9575b61289357005b843b156122de57506102b093600092839251915af43d156122d6573d9061225e82613490565b50600061288d565b9091508681813d83116128e9575b6128d9818361344f565b810103126102475751908861281c565b503d6128cf565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043560005260cf60205260ff60406000205460981c1660005260d1602052602061ffff60406000205460181c16604051908152f35b346102475760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475767ffffffffffffffff602435818111610247576129d490369060040161336e565b604435838111610247576129ec90369060040161336e565b909360643590811161024757612a0690369060040161336e565b94909261ffff60843516608435036102475760ff60a4351660a435036102475760ca546040517fe743862900000000000000000000000000000000000000000000000000000000815233600480830191909152356024820152906020908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b57600091612f7b575b50156105b457600435600090815260d060205260409020805490959063ffffffff1661199c5760ff60a4351660005260d1602052612af062ffffff6040600020612adf60ff60a4351661378f565b5460281c1661ffff608435166138a9565b60cc54957dffffffffffffffffffff0000000000000000000000000000000000000000600169ffffffffffffffffffff8960a01c160160a01b167fffff00000000000000000000ffffffffffffffffffffffffffffffffffffffff88161760cc5569ffffffffffffffffffff8760a01c1660005260cf602052604060002073010000000000000000000000000000000000000069ffffffffffffffffffff600435167fffffffffffffffffffffffff00ffffffffffffffffff0000000000000000000083541617177fffffffffffffffffffffffffff0000000000ffffffffffffffffffffffffffff6c0100000000000000000000000072ffffffffff00000000000000000000000000004260701b16927fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff6bffff0000000000000000000060843560501b16911617171617905563ffffffff90640400000000828960a01c167fffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000835416171780915560281c16612e13575b612da29669ffffffffffffffffffff9587957f1b3735104e097b87cb15840370ada9d3aa1b878cfc81c59513bca1d5a8dbc70b95612cce612d0196612cdb968b60209d60a01c1661394d565b50610bd485858585613e84565b604051918291868660a01c1683526004358884015260a0604084015260a083019061373a565b61ffff60843516606083015260ff60a4351660808301520390a1600160ff60a4351603612dfa575b73ffffffffffffffffffffffffffffffffffffffff60cb54169060006040518096819582947f8471af7700000000000000000000000000000000000000000000000000000000845260a01c1633600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561060b57612db257005b6020813d602011612df2575b81612dcb6020938361344f565b81010312610247575173ffffffffffffffffffffffffffffffffffffffff81160361024757005b3d9150612dbe565b612e0e60a435600435848460a01c166148c7565b612d29565b60cc546040517efdd58e0000000000000000000000000000000000000000000000000000000081523360048083019190915235602482015295969495919291906020908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b57600091612f49575b50156107b457612da29660209669ffffffffffffffffffff967f1b3735104e097b87cb15840370ada9d3aa1b878cfc81c59513bca1d5a8dbc70b95612cce612cdb95612d019760043560005260d08d5260406000207fffffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffff81541690557f86ef48d3478dfc87f7a61b90ffdd3193d9862a68632a4c233e71d330b3bb5ce560408c8e82519160a01c1681526004356020820152a19650965050955095975095509650612c82565b90506020813d602011612f73575b81612f646020938361344f565b81010312610247575188612e84565b3d9150612f57565b612f94915060203d602011610604576105f6818361344f565b87612a91565b346102475760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024757604435602435600435600583101561024757600081815260cf60209081526040918290205460cc5492517efdd58e00000000000000000000000000000000000000000000000000000000815233600482015269ffffffffffffffffffff9182166024820152909282908290604490829073ffffffffffffffffffffffffffffffffffffffff165afa90811561060b5760009161311c575b50156107b4578360005260d081528263ffffffff604060002054160361078a5760cf90836000525260406000205416928383146130f25780156130e45760048110156130ba57836130b5916102b095846141fc565b6144fd565b60046040517fcbcd7cd3000000000000000000000000000000000000000000000000000000008152fd5b506130b56102b0938261428f565b60046040517f6927acfe000000000000000000000000000000000000000000000000000000008152fd5b90508181813d8311613142575b613133818361344f565b81010312610247575186613060565b503d613129565b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043560005260d060205260606040600020546040519063ffffffff9081811683526131ad6020840160ff8360201c16613361565b60281c166040820152f35b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760043568ffffffffffffffffff811690818103610247577f7934a8db3f8f75ea0c15b07050e7abbb51f58cfa3914f76450dc170f3d40d8119160209161322b614ef5565b7fffff00000000000000000000ffffffffffffffffffffffffffffffffffffffff7cffffffffffffffffff000000000000000000000000000000000000000060cd549260a01b1691161760cd55604051908152a1005b346102475760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024757602069ffffffffffffffffffff60cd5460a01c16604051908152f35b346102475760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102475760c09060043560005260d160205269ffffffffffffffffffff60406000205460ff8116835261ffff808260081c1660208501528160181c16604084015262ffffff8160281c16606084015264ffffffffff8160401c16608084015260681c1660a0820152f35b9060058210156105855752565b9181601f840112156102475782359167ffffffffffffffff8311610247576020838186019501011161024757565b359061ffff8216820361024757565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361024757565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040910112610247576004359060243590565b9181601f840112156102475782359167ffffffffffffffff8311610247576020808501948460051b01011161024757565b6060810190811067ffffffffffffffff8211176128f057604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176128f057604052565b67ffffffffffffffff81116128f057601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b9291926134d682613490565b916134e4604051938461344f565b829481845281830111610247578281602093846000960137010152565b9060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8301126102475760043567ffffffffffffffff92838211610247578060238301121561024757816004013593841161024757602460c0850283010111610247576024019190565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc606091011261024757600435906024359060443590565b90600182811c921680156135ed575b60208310146135be57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f16916135b3565b906040519182600082549261360b846135a4565b90818452600194858116908160001461367a5750600114613637575b50506136359250038361344f565b565b9093915060005260209081600020936000915b81831061366257505061363593508201013880613627565b8554888401850152948501948794509183019161364a565b90506136359550602093507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880613627565b60005b8381106136cf5750506000910152565b81810151838201526020016136bf565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60209361371b815180928187528780880191016136bc565b0116010190565b90816020910312610247575180151581036102475790565b90815180825260208092019182818360051b85019501936000915b8483106137655750505050505090565b909192939495848061377f83856001950387528a516136df565b9801930193019194939290613755565b60005260d160205260ff60406000205416156137a757565b60046040517f5f633df8000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146137fe5760010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b919081101561383d5760051b0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90918281527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83116102475760209260051b809284830137010190565b9081159182156138e6575b50506138bc57565b60046040517f0ac2b816000000000000000000000000000000000000000000000000000000008152fd5b11905038806138b4565b90601f836040947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093602086528160208701528686013760008582860101520116010190565b818110613941575050565b60008155600101613936565b916139a49391739bcb040b6ffc0adcedda870f0a8e18e4278c72de906040948551937fb2dad15500000000000000000000000000000000000000000000000000000000855284806000998a936004968784016138f0565b0381865af4938415613e7a578794613df8575b5083966003855110613dd0576014855111613da857865180947f91ae2cdb000000000000000000000000000000000000000000000000000000008252602095869182878301528180613a0c602482018c6136df565b03915af4908115613d9e578291613d81575b5015613d5957613a2d85614ddc565b9682825260cf8552600192613a4d613a4885848620016135f7565b614ddc565b8099835188810190613a788a82818751970196613a6b81878a6136bc565b810103808452018261344f565b51902091845192898401835194613a998c8281880198613a6b81878c6136bc565b51902014159b8c613ab2575b5050505050505050505050565b60ff86518b818651613ac581838b6136bc565b810160d28152030190205416613d315792613afc928a92838a989796519182613cea575b50505085519384928392519283916136bc565b810160d2815203019020837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055835260cf86528220019480519367ffffffffffffffff8511613cbe5750613b5586546135a4565b601f8111613c85575b508491601f8511600114613be75784955090849394929193613bbc575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff91921b9260031b1c19161790555b3880808080808080808080613aa5565b015191507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff38613b7b565b868152858120939585917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08316915b88838310613c6b5750505010613c34575b505050811b019055613bac565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c19169055388080613c27565b858701518855909601959485019487935090810190613c16565b613cae90878452868420601f870160051c810191888810613cb4575b601f0160051c0190613936565b38613b5e565b9091508190613ca1565b8260416024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b82613cf98a51948580946136bc565b810160d28152030190207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008154169055388381613ae9565b8886517fd202940c000000000000000000000000000000000000000000000000000000008152fd5b8287517f9954195a000000000000000000000000000000000000000000000000000000008152fd5b613d989150853d8711610604576105f6818361344f565b38613a1e565b88513d84823e3d90fd5b8287517f680b6caf000000000000000000000000000000000000000000000000000000008152fd5b8287517fcb58bcce000000000000000000000000000000000000000000000000000000008152fd5b9093503d8088833e613e0a818361344f565b810190602081830312613e765780519067ffffffffffffffff8211613e72570181601f82011215613e76578051613e4081613490565b92613e4d8951948561344f565b81845260208284010111613e7257613e6b91602080850191016136bc565b92386139b7565b8880fd5b8780fd5b86513d89823e3d90fd5b92909160198311614067578215158061405d575b61403357739bcb040b6ffc0adcedda870f0a8e18e4278c72de906040948551907f1c39ceeb0000000000000000000000000000000000000000000000000000000082528180613eee6020988994600484016138f0565b0381865af49081156140285760009161400b575b5015613fe25760198311613fb957918391613f4b9386518095819482937ff816bc3b000000000000000000000000000000000000000000000000000000008452600484016138f0565b03915af4918215613fae57600092613f91575b505015613f685750565b600490517f1efe3600000000000000000000000000000000000000000000000000000000008152fd5b613fa79250803d10610604576105f6818361344f565b3880613f5e565b83513d6000823e3d90fd5b600485517f2090d718000000000000000000000000000000000000000000000000000000008152fd5b600485517f22331a14000000000000000000000000000000000000000000000000000000008152fd5b6140229150853d8711610604576105f6818361344f565b38613f02565b86513d6000823e3d90fd5b60046040517f8c72c2a1000000000000000000000000000000000000000000000000000000008152fd5b5060048310613e98565b60046040517f36856494000000000000000000000000000000000000000000000000000000008152fd5b80511561383d5760200190565b80516001101561383d5760400190565b80516002101561383d5760600190565b9490939192604051926080840184811067ffffffffffffffff8211176128f0576040526003845260005b6060808210156141025790602091828288010152016140e8565b505061412d614140939661414f96869961411b88614091565b5261412587614091565b5036916134ca565b6141368561409e565b526141258461409e565b614149826140ae565b526140ae565b50565b60407f81ec2aca54fed63234990c222e20c265fbd80545574659c8e359fe9dc3cda162918060005260cf60205269ffffffffffffffffffff826000208054907fffffffffffffffffffffffffffffffffffffffffffff000000000000000000008216905560d36020528360002064ffffffffff42167fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000008254161790558351928352166020820152a1565b9091928260005260d060205260406000206005851015610585577f57ff30d4395dd2630a292b8a50feba238650ef9136dd5961908b899bb1ba9916946080948261428793547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff64ff000000008560201b16911617905560405194855260208501526040840190613361565b6060820152a1565b9060009082825260209060cf82526040938484208269ffffffffffffffffffff825416146144ef575b61ffff9081815460601c1680156144c25781547fffffffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9190910160601b6dffff00000000000000000000000016178155869082905460601c1661448a575081855260cf84528585205460601c1661446157907fe5cdc676962c829e36cbb7b0c60a322b60e2d01db199590aab156803c5a97ae6838360d09594875260cf825261439e8261438c613a4860018c8c20016135f7565b818b51938285809451938492016136bc565b810160d28152030190207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00815416905580875260cf8252866001898220828155016143e981546135a4565b80614425575b5050508751908152a15b835252207fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000008154169055565b82601f821160011461443d575050555b8638806143ef565b909180825261445a601f878420940160051c840160018501613936565b5555614435565b600485517fe0283d92000000000000000000000000000000000000000000000000000000008152fd5b7f6d009105c92c4eb0f5b1d18f384208f5f674832b61c8eb69d8eb7067ced5cd7c915060d094939281519081528385820152a16143f9565b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6144f882614152565b6142b8565b6040907fb36e6603e4ebbca03e98d06ae8a134eb0c59baf95557ee9403a9fe073b6ac074928160005260cf6020528260002069ffffffffffffffffffff82167fffffffffffffffffffffffffffffffffffffffffffff0000000000000000000082541617905560d3602052826000207fffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000081541690558060005260d0602052826000206404000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff82541617905582519182526020820152a1565b73ffffffffffffffffffffffffffffffffffffffff908160c95416916040918251917f23b872dd000000000000000000000000000000000000000000000000000000008352600492338482015230602482015282604482015260209081816064816000809b5af18015613e7a576148aa575b508260021c928260c954168360cd54167f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe8360011c168681046002148715171561487e5783039283116148525786926146f89285928b8b518096819582947fa9059cbb000000000000000000000000000000000000000000000000000000009a8b855284016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561484857614753928492879261482b575b508560c95416908a8760ce5416918b519687958694859384528d84016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af18015613e7a5761480d575b505060c9541690813b156148095784929160248492865197889384927f42966c68000000000000000000000000000000000000000000000000000000008452878401525af180156147ff576147b8575b50505050565b67ffffffffffffffff84116147d357505052388080806147b2565b9060416024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b83513d84823e3d90fd5b8480fd5b8161482392903d10610604576105f6818361344f565b503880614762565b61484190843d8611610604576105f6818361344f565b503861470f565b87513d8a823e3d90fd5b6024896011897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60248a60118a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6148c090823d8411610604576105f6818361344f565b503861464b565b9160009183835260cf60205260409160ff8385205460981c16845260d1602052828420549360ff8516948515614a1e5760ff8316958611156149f55761490c8661378f565b85825260d16020528482205469ffffffffffffffffffff80809360681c169160681c16038181116149c85794606096949261496c8295937ff926d4ef55149e1fe1f7e953b8bddc590c485497a4f01d73ea589b8150bfed839a98166145d9565b86815260cf60205220907fffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffff73ff0000000000000000000000000000000000000083549260981b16911617905581519384526020840152820152a1565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b600485517fc59efceb000000000000000000000000000000000000000000000000000000008152fd5b600485517fd699f7e9000000000000000000000000000000000000000000000000000000008152fd5b919081101561383d5760c0020190565b3560ff811681036102475790565b602080825280820184905260409182019360009290915b828410614a8b57505050505090565b9091929394853560ff811680910361024757815261ffff80614aae84890161339c565b1683830152614abe84880161339c565b16838201526060808701359062ffffff8216809203610247578201526080808701359064ffffffffff82168092036102475782015260a0908187013569ffffffffffffffffffff81168091036102475760019282015260c080910196019401929190614a7c565b3569ffffffffffffffffffff811681036102475790565b3561ffff811681036102475790565b3562ffffff811681036102475790565b60ff614b6682614a57565b1660018111614c4d575b60005260d160205260406000209060ff614b8982614a57565b1682549162ffff00614b9d60208301614b3c565b60081b1664ffff000000614bb360408401614b3c565b60181b1667ffffff0000000000614bcc60608501614b4b565b60281b169160808401359464ffffffffff86168603610247577fffffffffffffffffff000000000000000000000000000000000000000000000076ffffffffffffffffffff00000000000000000000000000614c3860a06cffffffffff00000000000000009801614b25565b60681b169716171717179160401b1617179055565b614c5960a08301614b25565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82018281116137fe57600081815260d160205269ffffffffffffffffffff92604093808584205460681c16911610614da257614cb860208601614b3c565b82825260d160205261ffff9081808685205460081c16911610614d7957614ce0848701614b3c565b83835260d16020528483205460181c8216911610614d50578290614d0660608701614b4b565b92815260d1602052205460281c62ffffff908116911610614d275750614b70565b600490517f3f07a645000000000000000000000000000000000000000000000000000000008152fd5b600483517f83202d3d000000000000000000000000000000000000000000000000000000008152fd5b600484517f7dc1f31b000000000000000000000000000000000000000000000000000000008152fd5b600483517fdbbbe822000000000000000000000000000000000000000000000000000000008152fd5b90815181101561383d570160200190565b60405190614e088151918383614dfb60209586948580860191016136bc565b810103808552018361344f565b8151805b614e1557505090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180614e428185614dcb565b51604160f891821c101580614ede575b614e5d575b50614e0c565b90614e69849186614dcb565b51821c019060ff8211614eb05782917fff00000000000000000000000000000000000000000000000000000000000000911b1660001a614ea98286614dcb565b5338614e57565b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b50605a614eeb8387614dcb565b51821c1115614e52565b73ffffffffffffffffffffffffffffffffffffffff609754163303614f1657565b60046040517f6db2465f000000000000000000000000000000000000000000000000000000008152fd5b6097549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617609755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b803b156150155773ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc91167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b60046040517f71ab98ae000000000000000000000000000000000000000000000000000000008152fd5b9091901561504b575090565b81511561505b5750805190602001fd5b615099906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906136df565b0390fdfea2646970667358221220d2108304ea4a266c77d652cc890db0a03cd4d5c1ee9027e1dd38aa57b00f24c564736f6c63430008140033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Validator ID :
0 FTM
Amount Staked
0
Amount Delegated
0
Staking Total
0
Staking Start Epoch
0
Staking Start Time
0
Proof of Importance
0
Origination Score
0
Validation Score
0
Active
0
Online
0
Downtime
0 s
Address | Amount | claimed Rewards | Created On Epoch | Created On |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.