Overview
SOPH Balance
SOPH Value
-More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
7641647 | 8 days ago | Contract Creation | 0 SOPH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
TokenMaker
Compiler Version
v0.8.24+commit.e11b9ed9
ZkSolc Version
v1.5.11
Optimization Enabled:
Yes with Mode 3
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import {OwnableRoles} from "lib/solady/src/auth/OwnableRoles.sol"; import {SafeTransferLib} from "lib/solady/src/utils/SafeTransferLib.sol"; import {IERC20} from "contracts/interfaces/IERC20.sol"; import {INonfungiblePositionManager} from "contracts/interfaces/INonfungiblePositionManager.sol"; import {ICLFactory} from "contracts/interfaces/ICLFactory.sol"; import {IMakeERC20} from "contracts/interfaces/IMakeERC20.sol"; import {ILPEscrow} from "contracts/interfaces/ILPEscrow.sol"; import {ITokenMaker} from "contracts/interfaces/ITokenMaker.sol"; import {MakeERC20} from "contracts/MakeERC20.sol"; import {LPEscrow} from "contracts/LPEscrow.sol"; import {ISyncSwapCustomPoolManager} from "contracts/interfaces/ISyncSwapCustomPoolManager.sol"; // /$$$$$$$$ /$$ /$$ /$$ /$$ // |__ $$__/ | $$ | $$$ /$$$ | $$ // | $$ /$$$$$$ | $$ /$$ /$$$$$$ /$$$$$$$ | $$$$ /$$$$ /$$$$$$ | $$ /$$ /$$$$$$ /$$$$$$ // | $$ /$$__ $$| $$ /$$/ /$$__ $$| $$__ $$| $$ $$/$$ $$ |____ $$| $$ /$$/ /$$__ $$ /$$__ $$ // | $$| $$ \ $$| $$$$$$/ | $$$$$$$$| $$ \ $$| $$ $$$| $$ /$$$$$$$| $$$$$$/ | $$$$$$$$| $$ \__/ // | $$| $$ | $$| $$_ $$ | $$_____/| $$ | $$| $$\ $ | $$ /$$__ $$| $$_ $$ | $$_____/| $$ // | $$| $$$$$$/| $$ \ $$| $$$$$$$| $$ | $$| $$ \/ | $$| $$$$$$$| $$ \ $$| $$$$$$$| $$ // |__/ \______/ |__/ \__/ \_______/|__/ |__/|__/ |__/ \_______/|__/ \__/ \_______/|__/ contract TokenMaker is OwnableRoles, ITokenMaker { // ======================= Constant ======================= int24 public constant MIN_TICK_2000 = -886000; int24 public constant MAX_TICK_2000 = 886000; uint256 internal constant BPS_DENOM = 10_000; uint24 internal constant ONE_PERCENTAGE_FEE = 10_000; // fee is in 1e6 decimals (3000 is 0.3%) uint256 internal constant PAUSER_ROLE = 1; // ======================= Storage ======================= address public counterAsset; address public positionManager; address public CLFactory; address public feeManager; uint256 public protocolFeeBPS; address public protocolFeeRecipient; uint256 public minTotalSupply; uint256 public maxTotalSupply; int24 public minTick; int24 public maxTick; bool public paused; /** * @dev Constructor to initialize TokenMaker with provided parameters. * @param _params Struct containing initial parameters for setting up the contract. */ constructor(InitParams memory _params) { CLFactory = _params.CLFactory; counterAsset = _params.counterAsset; positionManager = _params.positionManager; feeManager = _params.feeManager; paused = false; minTotalSupply = 10_000e18; maxTotalSupply = 100_000_000_000e18; minTick = -150000; maxTick = 150000; _setProtocolFee(_params.protocolFeeBPS, _params.protocolFeeRecipient); _initializeOwner(_params.owner); _setPausers(_params.pausers); } // ======================= External Function ======================= /** * @dev Creates a new token and sets up an escrow for it. * @param _name Name of the new token. * @param _symbol Symbol of the new token. * @param _params Struct containing parameters for creating the token. * @return token_ Address of the created token. * @return LP_ Address of the liquidity pool for the token. * @return tokenId_ Token ID of the liquidity position. * @return escrow_ Address of the associated escrow contract. */ function makeToken(string memory _name, string memory _symbol, MakeParams memory _params) external returns (address token_, address LP_, uint256 tokenId_, address escrow_) { if (paused) revert TokenMaker__Paused(); if ( _params.totalSupply < minTotalSupply || _params.totalSupply > maxTotalSupply || _params.startingTick < minTick || _params.startingTick > maxTick || _params.feeRecipients.length > 16 ) revert TokenMaker__InvalidTokenParams(); token_ = address(new MakeERC20{salt: _params.salt}()); escrow_ = address(new LPEscrow()); // deploy escrow before so we know address. IMakeERC20(token_).initialize(_name, _symbol, _params.totalSupply); (tokenId_, LP_) = _makeLPdeposit(token_, escrow_, _params); // Initialize escrow `makeLPdeposit()` so we know all the _params. ILPEscrow(escrow_).initialize( ILPEscrow.InitParams({ LP: LP_, tokenId: tokenId_, counterAsset: counterAsset, newToken: token_, positionManager: positionManager, tokenMaker: address(this), feeRecipients: _params.feeRecipients, feeBPS: _params.feeBPS }) ); uint256 excessToken = IERC20(token_).balanceOf(address(this)); if (excessToken != 0) SafeTransferLib.safeTransfer(token_, address(0), excessToken); emit TokenCreated(token_, LP_, tokenId_, escrow_); } // ======================= Internal Function ======================= /** * @dev Internal function to create a liquidity position and deposit tokens. * @param _token Address of the token to deposit. * @param _escrow Address of the escrow contract. * @param _params Parameters for the liquidity position. * @return tokenId_ ID of the created token. * @return LP_ Address of the liquidity pool. */ function _makeLPdeposit(address _token, address _escrow, MakeParams memory _params) internal returns (uint256 tokenId_, address LP_) { address token0_; address token1_; uint256 token0Supply_; uint256 token1Supply_; uint256 minToken0_; uint256 minToken1_; int24 minTick_; int24 maxTick_; IERC20(_token).approve(positionManager, _params.totalSupply); if (counterAsset < _token) { token0_ = counterAsset; token1_ = _token; token0Supply_ = 0; token1Supply_ = _params.totalSupply; minToken0_ = 0; minToken1_ = _params.totalSupply - 1e8; minTick_ = MIN_TICK_2000; // temp maxTick_ = _params.startingTick; } else { token0_ = _token; token1_ = counterAsset; token0Supply_ = _params.totalSupply; token1Supply_ = 0; minToken0_ = _params.totalSupply - 1e8; minToken1_ = 0; minTick_ = _params.startingTick; maxTick_ = MAX_TICK_2000; } INonfungiblePositionManager.MintParams memory mintParams = INonfungiblePositionManager .MintParams({ token0: token0_, token1: token1_, tickSpacing: int24(2000), // tick spacing corresponds with 1% of fee tickLower: minTick_, tickUpper: maxTick_, amount0Desired: token0Supply_, amount1Desired: token1Supply_, amount0Min: minToken0_, amount1Min: minToken1_, recipient: _escrow, deadline: block.timestamp, sqrtPriceX96: getSqrtRatioAtTick(_params.startingTick) }); (tokenId_,,,) = INonfungiblePositionManager(positionManager).mint(mintParams); LP_ = ICLFactory(CLFactory).getPool(token0_, token1_, 2000); ISyncSwapCustomPoolManager(feeManager).setCustomPoolSwapFee( LP_, token0_, ONE_PERCENTAGE_FEE ); // set swap fee for token0 to 1% ISyncSwapCustomPoolManager(feeManager).setCustomPoolSwapFee( LP_, token1_, ONE_PERCENTAGE_FEE ); // set swap fee for token1 to 1% ISyncSwapCustomPoolManager(feeManager).updatePoolProtocolFee(LP_); // reduce syncswap fees from 30% to 10% } function _setPausers(address[] memory _pausers) internal { for (uint256 i = 0; i < _pausers.length; i++) { _grantRoles(_pausers[i], PAUSER_ROLE); } } function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(887272), "T"); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } // ======================= Admin Function ======================= function setPositionManager(address _positionManager) public onlyOwner { if (_positionManager == address(0)) revert TokenMaker__InvalidSet(); positionManager = _positionManager; } function setCLFactory(address _CLFactory) public onlyOwner { if (_CLFactory == address(0)) revert TokenMaker__InvalidSet(); CLFactory = _CLFactory; } function setFeeManager(address _feeManager) public onlyOwner { if (_feeManager == address(0)) revert TokenMaker__InvalidSet(); feeManager = _feeManager; } function pause() public onlyOwnerOrRoles(1) { paused = true; } function unpause() public onlyOwner { paused = false; } function setSupplyLimits(uint256 _minTotalSupply, uint256 _maxTotalSupply) external onlyOwner { if (_minTotalSupply > _maxTotalSupply || _minTotalSupply < 1e6 || _maxTotalSupply > 1e36) { revert TokenMaker__InvalidSet(); } minTotalSupply = _minTotalSupply; maxTotalSupply = _maxTotalSupply; } function setTickLimits(int24 _minTick, int24 _maxTick) external onlyOwner { if (_minTick > _maxTick || _minTick < -886000 || _maxTick > 886000) { revert TokenMaker__InvalidSet(); } minTick = _minTick; maxTick = _maxTick; } function setProtocolFee(uint256 _protocolFeeBPS, address _protocolFeeRecipient) external onlyOwner { _setProtocolFee(_protocolFeeBPS, _protocolFeeRecipient); } function _setProtocolFee(uint256 _protocolFeeBPS, address _protocolFeeRecipient) internal { if (_protocolFeeBPS > BPS_DENOM || _protocolFeeRecipient == address(0)) { revert TokenMaker__InvalidSet(); } protocolFeeBPS = _protocolFeeBPS; protocolFeeRecipient = _protocolFeeRecipient; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {Ownable} from "./Ownable.sol"; /// @notice Simple single owner and multiroles authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/OwnableRoles.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract OwnableRoles is Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The `user`'s roles is updated to `roles`. /// Each bit of `roles` represents whether the role is set. event RolesUpdated(address indexed user, uint256 indexed roles); /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`. uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE = 0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The role slot of `user` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED)) /// let roleSlot := keccak256(0x00, 0x20) /// ``` /// This automatically ignores the upper bits of the `user` in case /// they are not clean, as well as keep the `keccak256` under 32-bytes. /// /// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`. uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Overwrite the roles directly without authorization guard. function _setRoles(address user, uint256 roles) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) // Store the new value. sstore(keccak256(0x0c, 0x20), roles) // Emit the {RolesUpdated} event. log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles) } } /// @dev Updates the roles directly without authorization guard. /// If `on` is true, each set bit of `roles` will be turned on, /// otherwise, each set bit of `roles` will be turned off. function _updateRoles(address user, uint256 roles, bool on) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) let roleSlot := keccak256(0x0c, 0x20) // Load the current value. let current := sload(roleSlot) // Compute the updated roles if `on` is true. let updated := or(current, roles) // Compute the updated roles if `on` is false. // Use `and` to compute the intersection of `current` and `roles`, // `xor` it with `current` to flip the bits in the intersection. if iszero(on) { updated := xor(current, and(current, roles)) } // Then, store the new value. sstore(roleSlot, updated) // Emit the {RolesUpdated} event. log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated) } } /// @dev Grants the roles directly without authorization guard. /// Each bit of `roles` represents the role to turn on. function _grantRoles(address user, uint256 roles) internal virtual { _updateRoles(user, roles, true); } /// @dev Removes the roles directly without authorization guard. /// Each bit of `roles` represents the role to turn off. function _removeRoles(address user, uint256 roles) internal virtual { _updateRoles(user, roles, false); } /// @dev Throws if the sender does not have any of the `roles`. function _checkRoles(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Throws if the sender is not the owner, /// and does not have any of the `roles`. /// Checks for ownership first, then lazily checks for roles. function _checkOwnerOrRoles(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner. // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } } /// @dev Throws if the sender does not have any of the `roles`, /// and is not the owner. /// Checks for roles first, then lazily checks for ownership. function _checkRolesOrOwner(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { // If the caller is not the stored owner. // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } } /// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`. /// This is meant for frontends like Etherscan, and is therefore not fully optimized. /// Not recommended to be called on-chain. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) { /// @solidity memory-safe-assembly assembly { for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } { // We don't need to mask the values of `ordinals`, as Solidity // cleans dirty upper bits when storing variables into memory. roles := or(shl(mload(add(ordinals, i)), 1), roles) } } } /// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap. /// This is meant for frontends like Etherscan, and is therefore not fully optimized. /// Not recommended to be called on-chain. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) { /// @solidity memory-safe-assembly assembly { // Grab the pointer to the free memory. ordinals := mload(0x40) let ptr := add(ordinals, 0x20) let o := 0 // The absence of lookup tables, De Bruijn, etc., here is intentional for // smaller bytecode, as this function is not meant to be called on-chain. for { let t := roles } 1 {} { mstore(ptr, o) // `shr` 5 is equivalent to multiplying by 0x20. // Push back into the ordinals array if the bit is set. ptr := add(ptr, shl(5, and(t, 1))) o := add(o, 1) t := shr(o, roles) if iszero(t) { break } } // Store the length of `ordinals`. mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20)))) // Allocate the memory. mstore(0x40, ptr) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to grant `user` `roles`. /// If the `user` already has a role, then it will be an no-op for the role. function grantRoles(address user, uint256 roles) public payable virtual onlyOwner { _grantRoles(user, roles); } /// @dev Allows the owner to remove `user` `roles`. /// If the `user` does not have a role, then it will be an no-op for the role. function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner { _removeRoles(user, roles); } /// @dev Allow the caller to remove their own roles. /// If the caller does not have a role, then it will be an no-op for the role. function renounceRoles(uint256 roles) public payable virtual { _removeRoles(msg.sender, roles); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the roles of `user`. function rolesOf(address user) public view virtual returns (uint256 roles) { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) // Load the stored value. roles := sload(keccak256(0x0c, 0x20)) } } /// @dev Returns whether `user` has any of `roles`. function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) { return rolesOf(user) & roles != 0; } /// @dev Returns whether `user` has all of `roles`. function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) { return rolesOf(user) & roles == roles; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by an account with `roles`. modifier onlyRoles(uint256 roles) virtual { _checkRoles(roles); _; } /// @dev Marks a function as only callable by the owner or by an account /// with `roles`. Checks for ownership first, then lazily checks for roles. modifier onlyOwnerOrRoles(uint256 roles) virtual { _checkOwnerOrRoles(roles); _; } /// @dev Marks a function as only callable by an account with `roles` /// or the owner. Checks for roles first, then lazily checks for ownership. modifier onlyRolesOrOwner(uint256 roles) virtual { _checkRolesOrOwner(roles); _; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ROLE CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // IYKYK uint256 internal constant _ROLE_0 = 1 << 0; uint256 internal constant _ROLE_1 = 1 << 1; uint256 internal constant _ROLE_2 = 1 << 2; uint256 internal constant _ROLE_3 = 1 << 3; uint256 internal constant _ROLE_4 = 1 << 4; uint256 internal constant _ROLE_5 = 1 << 5; uint256 internal constant _ROLE_6 = 1 << 6; uint256 internal constant _ROLE_7 = 1 << 7; uint256 internal constant _ROLE_8 = 1 << 8; uint256 internal constant _ROLE_9 = 1 << 9; uint256 internal constant _ROLE_10 = 1 << 10; uint256 internal constant _ROLE_11 = 1 << 11; uint256 internal constant _ROLE_12 = 1 << 12; uint256 internal constant _ROLE_13 = 1 << 13; uint256 internal constant _ROLE_14 = 1 << 14; uint256 internal constant _ROLE_15 = 1 << 15; uint256 internal constant _ROLE_16 = 1 << 16; uint256 internal constant _ROLE_17 = 1 << 17; uint256 internal constant _ROLE_18 = 1 << 18; uint256 internal constant _ROLE_19 = 1 << 19; uint256 internal constant _ROLE_20 = 1 << 20; uint256 internal constant _ROLE_21 = 1 << 21; uint256 internal constant _ROLE_22 = 1 << 22; uint256 internal constant _ROLE_23 = 1 << 23; uint256 internal constant _ROLE_24 = 1 << 24; uint256 internal constant _ROLE_25 = 1 << 25; uint256 internal constant _ROLE_26 = 1 << 26; uint256 internal constant _ROLE_27 = 1 << 27; uint256 internal constant _ROLE_28 = 1 << 28; uint256 internal constant _ROLE_29 = 1 << 29; uint256 internal constant _ROLE_30 = 1 << 30; uint256 internal constant _ROLE_31 = 1 << 31; uint256 internal constant _ROLE_32 = 1 << 32; uint256 internal constant _ROLE_33 = 1 << 33; uint256 internal constant _ROLE_34 = 1 << 34; uint256 internal constant _ROLE_35 = 1 << 35; uint256 internal constant _ROLE_36 = 1 << 36; uint256 internal constant _ROLE_37 = 1 << 37; uint256 internal constant _ROLE_38 = 1 << 38; uint256 internal constant _ROLE_39 = 1 << 39; uint256 internal constant _ROLE_40 = 1 << 40; uint256 internal constant _ROLE_41 = 1 << 41; uint256 internal constant _ROLE_42 = 1 << 42; uint256 internal constant _ROLE_43 = 1 << 43; uint256 internal constant _ROLE_44 = 1 << 44; uint256 internal constant _ROLE_45 = 1 << 45; uint256 internal constant _ROLE_46 = 1 << 46; uint256 internal constant _ROLE_47 = 1 << 47; uint256 internal constant _ROLE_48 = 1 << 48; uint256 internal constant _ROLE_49 = 1 << 49; uint256 internal constant _ROLE_50 = 1 << 50; uint256 internal constant _ROLE_51 = 1 << 51; uint256 internal constant _ROLE_52 = 1 << 52; uint256 internal constant _ROLE_53 = 1 << 53; uint256 internal constant _ROLE_54 = 1 << 54; uint256 internal constant _ROLE_55 = 1 << 55; uint256 internal constant _ROLE_56 = 1 << 56; uint256 internal constant _ROLE_57 = 1 << 57; uint256 internal constant _ROLE_58 = 1 << 58; uint256 internal constant _ROLE_59 = 1 << 59; uint256 internal constant _ROLE_60 = 1 << 60; uint256 internal constant _ROLE_61 = 1 << 61; uint256 internal constant _ROLE_62 = 1 << 62; uint256 internal constant _ROLE_63 = 1 << 63; uint256 internal constant _ROLE_64 = 1 << 64; uint256 internal constant _ROLE_65 = 1 << 65; uint256 internal constant _ROLE_66 = 1 << 66; uint256 internal constant _ROLE_67 = 1 << 67; uint256 internal constant _ROLE_68 = 1 << 68; uint256 internal constant _ROLE_69 = 1 << 69; uint256 internal constant _ROLE_70 = 1 << 70; uint256 internal constant _ROLE_71 = 1 << 71; uint256 internal constant _ROLE_72 = 1 << 72; uint256 internal constant _ROLE_73 = 1 << 73; uint256 internal constant _ROLE_74 = 1 << 74; uint256 internal constant _ROLE_75 = 1 << 75; uint256 internal constant _ROLE_76 = 1 << 76; uint256 internal constant _ROLE_77 = 1 << 77; uint256 internal constant _ROLE_78 = 1 << 78; uint256 internal constant _ROLE_79 = 1 << 79; uint256 internal constant _ROLE_80 = 1 << 80; uint256 internal constant _ROLE_81 = 1 << 81; uint256 internal constant _ROLE_82 = 1 << 82; uint256 internal constant _ROLE_83 = 1 << 83; uint256 internal constant _ROLE_84 = 1 << 84; uint256 internal constant _ROLE_85 = 1 << 85; uint256 internal constant _ROLE_86 = 1 << 86; uint256 internal constant _ROLE_87 = 1 << 87; uint256 internal constant _ROLE_88 = 1 << 88; uint256 internal constant _ROLE_89 = 1 << 89; uint256 internal constant _ROLE_90 = 1 << 90; uint256 internal constant _ROLE_91 = 1 << 91; uint256 internal constant _ROLE_92 = 1 << 92; uint256 internal constant _ROLE_93 = 1 << 93; uint256 internal constant _ROLE_94 = 1 << 94; uint256 internal constant _ROLE_95 = 1 << 95; uint256 internal constant _ROLE_96 = 1 << 96; uint256 internal constant _ROLE_97 = 1 << 97; uint256 internal constant _ROLE_98 = 1 << 98; uint256 internal constant _ROLE_99 = 1 << 99; uint256 internal constant _ROLE_100 = 1 << 100; uint256 internal constant _ROLE_101 = 1 << 101; uint256 internal constant _ROLE_102 = 1 << 102; uint256 internal constant _ROLE_103 = 1 << 103; uint256 internal constant _ROLE_104 = 1 << 104; uint256 internal constant _ROLE_105 = 1 << 105; uint256 internal constant _ROLE_106 = 1 << 106; uint256 internal constant _ROLE_107 = 1 << 107; uint256 internal constant _ROLE_108 = 1 << 108; uint256 internal constant _ROLE_109 = 1 << 109; uint256 internal constant _ROLE_110 = 1 << 110; uint256 internal constant _ROLE_111 = 1 << 111; uint256 internal constant _ROLE_112 = 1 << 112; uint256 internal constant _ROLE_113 = 1 << 113; uint256 internal constant _ROLE_114 = 1 << 114; uint256 internal constant _ROLE_115 = 1 << 115; uint256 internal constant _ROLE_116 = 1 << 116; uint256 internal constant _ROLE_117 = 1 << 117; uint256 internal constant _ROLE_118 = 1 << 118; uint256 internal constant _ROLE_119 = 1 << 119; uint256 internal constant _ROLE_120 = 1 << 120; uint256 internal constant _ROLE_121 = 1 << 121; uint256 internal constant _ROLE_122 = 1 << 122; uint256 internal constant _ROLE_123 = 1 << 123; uint256 internal constant _ROLE_124 = 1 << 124; uint256 internal constant _ROLE_125 = 1 << 125; uint256 internal constant _ROLE_126 = 1 << 126; uint256 internal constant _ROLE_127 = 1 << 127; uint256 internal constant _ROLE_128 = 1 << 128; uint256 internal constant _ROLE_129 = 1 << 129; uint256 internal constant _ROLE_130 = 1 << 130; uint256 internal constant _ROLE_131 = 1 << 131; uint256 internal constant _ROLE_132 = 1 << 132; uint256 internal constant _ROLE_133 = 1 << 133; uint256 internal constant _ROLE_134 = 1 << 134; uint256 internal constant _ROLE_135 = 1 << 135; uint256 internal constant _ROLE_136 = 1 << 136; uint256 internal constant _ROLE_137 = 1 << 137; uint256 internal constant _ROLE_138 = 1 << 138; uint256 internal constant _ROLE_139 = 1 << 139; uint256 internal constant _ROLE_140 = 1 << 140; uint256 internal constant _ROLE_141 = 1 << 141; uint256 internal constant _ROLE_142 = 1 << 142; uint256 internal constant _ROLE_143 = 1 << 143; uint256 internal constant _ROLE_144 = 1 << 144; uint256 internal constant _ROLE_145 = 1 << 145; uint256 internal constant _ROLE_146 = 1 << 146; uint256 internal constant _ROLE_147 = 1 << 147; uint256 internal constant _ROLE_148 = 1 << 148; uint256 internal constant _ROLE_149 = 1 << 149; uint256 internal constant _ROLE_150 = 1 << 150; uint256 internal constant _ROLE_151 = 1 << 151; uint256 internal constant _ROLE_152 = 1 << 152; uint256 internal constant _ROLE_153 = 1 << 153; uint256 internal constant _ROLE_154 = 1 << 154; uint256 internal constant _ROLE_155 = 1 << 155; uint256 internal constant _ROLE_156 = 1 << 156; uint256 internal constant _ROLE_157 = 1 << 157; uint256 internal constant _ROLE_158 = 1 << 158; uint256 internal constant _ROLE_159 = 1 << 159; uint256 internal constant _ROLE_160 = 1 << 160; uint256 internal constant _ROLE_161 = 1 << 161; uint256 internal constant _ROLE_162 = 1 << 162; uint256 internal constant _ROLE_163 = 1 << 163; uint256 internal constant _ROLE_164 = 1 << 164; uint256 internal constant _ROLE_165 = 1 << 165; uint256 internal constant _ROLE_166 = 1 << 166; uint256 internal constant _ROLE_167 = 1 << 167; uint256 internal constant _ROLE_168 = 1 << 168; uint256 internal constant _ROLE_169 = 1 << 169; uint256 internal constant _ROLE_170 = 1 << 170; uint256 internal constant _ROLE_171 = 1 << 171; uint256 internal constant _ROLE_172 = 1 << 172; uint256 internal constant _ROLE_173 = 1 << 173; uint256 internal constant _ROLE_174 = 1 << 174; uint256 internal constant _ROLE_175 = 1 << 175; uint256 internal constant _ROLE_176 = 1 << 176; uint256 internal constant _ROLE_177 = 1 << 177; uint256 internal constant _ROLE_178 = 1 << 178; uint256 internal constant _ROLE_179 = 1 << 179; uint256 internal constant _ROLE_180 = 1 << 180; uint256 internal constant _ROLE_181 = 1 << 181; uint256 internal constant _ROLE_182 = 1 << 182; uint256 internal constant _ROLE_183 = 1 << 183; uint256 internal constant _ROLE_184 = 1 << 184; uint256 internal constant _ROLE_185 = 1 << 185; uint256 internal constant _ROLE_186 = 1 << 186; uint256 internal constant _ROLE_187 = 1 << 187; uint256 internal constant _ROLE_188 = 1 << 188; uint256 internal constant _ROLE_189 = 1 << 189; uint256 internal constant _ROLE_190 = 1 << 190; uint256 internal constant _ROLE_191 = 1 << 191; uint256 internal constant _ROLE_192 = 1 << 192; uint256 internal constant _ROLE_193 = 1 << 193; uint256 internal constant _ROLE_194 = 1 << 194; uint256 internal constant _ROLE_195 = 1 << 195; uint256 internal constant _ROLE_196 = 1 << 196; uint256 internal constant _ROLE_197 = 1 << 197; uint256 internal constant _ROLE_198 = 1 << 198; uint256 internal constant _ROLE_199 = 1 << 199; uint256 internal constant _ROLE_200 = 1 << 200; uint256 internal constant _ROLE_201 = 1 << 201; uint256 internal constant _ROLE_202 = 1 << 202; uint256 internal constant _ROLE_203 = 1 << 203; uint256 internal constant _ROLE_204 = 1 << 204; uint256 internal constant _ROLE_205 = 1 << 205; uint256 internal constant _ROLE_206 = 1 << 206; uint256 internal constant _ROLE_207 = 1 << 207; uint256 internal constant _ROLE_208 = 1 << 208; uint256 internal constant _ROLE_209 = 1 << 209; uint256 internal constant _ROLE_210 = 1 << 210; uint256 internal constant _ROLE_211 = 1 << 211; uint256 internal constant _ROLE_212 = 1 << 212; uint256 internal constant _ROLE_213 = 1 << 213; uint256 internal constant _ROLE_214 = 1 << 214; uint256 internal constant _ROLE_215 = 1 << 215; uint256 internal constant _ROLE_216 = 1 << 216; uint256 internal constant _ROLE_217 = 1 << 217; uint256 internal constant _ROLE_218 = 1 << 218; uint256 internal constant _ROLE_219 = 1 << 219; uint256 internal constant _ROLE_220 = 1 << 220; uint256 internal constant _ROLE_221 = 1 << 221; uint256 internal constant _ROLE_222 = 1 << 222; uint256 internal constant _ROLE_223 = 1 << 223; uint256 internal constant _ROLE_224 = 1 << 224; uint256 internal constant _ROLE_225 = 1 << 225; uint256 internal constant _ROLE_226 = 1 << 226; uint256 internal constant _ROLE_227 = 1 << 227; uint256 internal constant _ROLE_228 = 1 << 228; uint256 internal constant _ROLE_229 = 1 << 229; uint256 internal constant _ROLE_230 = 1 << 230; uint256 internal constant _ROLE_231 = 1 << 231; uint256 internal constant _ROLE_232 = 1 << 232; uint256 internal constant _ROLE_233 = 1 << 233; uint256 internal constant _ROLE_234 = 1 << 234; uint256 internal constant _ROLE_235 = 1 << 235; uint256 internal constant _ROLE_236 = 1 << 236; uint256 internal constant _ROLE_237 = 1 << 237; uint256 internal constant _ROLE_238 = 1 << 238; uint256 internal constant _ROLE_239 = 1 << 239; uint256 internal constant _ROLE_240 = 1 << 240; uint256 internal constant _ROLE_241 = 1 << 241; uint256 internal constant _ROLE_242 = 1 << 242; uint256 internal constant _ROLE_243 = 1 << 243; uint256 internal constant _ROLE_244 = 1 << 244; uint256 internal constant _ROLE_245 = 1 << 245; uint256 internal constant _ROLE_246 = 1 << 246; uint256 internal constant _ROLE_247 = 1 << 247; uint256 internal constant _ROLE_248 = 1 << 248; uint256 internal constant _ROLE_249 = 1 << 249; uint256 internal constant _ROLE_250 = 1 << 250; uint256 internal constant _ROLE_251 = 1 << 251; uint256 internal constant _ROLE_252 = 1 << 252; uint256 internal constant _ROLE_253 = 1 << 253; uint256 internal constant _ROLE_254 = 1 << 254; uint256 internal constant _ROLE_255 = 1 << 255; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /// @dev The Permit2 operation has failed. error Permit2Failed(); /// @dev The Permit2 amount must be less than `2**160 - 1`. error Permit2AmountOverflow(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /// @dev The unique EIP-712 domain domain separator for the DAI token contract. bytes32 internal constant DAI_DOMAIN_SEPARATOR = 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; /// @dev The address for the WETH9 contract on Ethereum mainnet. address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @dev The canonical Permit2 address. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function trySafeTransferFrom(address token, address from, address to, uint256 amount) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { success := lt(or(iszero(extcodesize(token)), returndatasize()), success) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { // Check the `extcodesize` again just in case the token selfdestructs lol. if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( // The arguments of `mul` are evaluated from right to left. mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// If the initial attempt fails, try to use Permit2 to transfer the token. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { if (!trySafeTransferFrom(token, from, to, amount)) { permit2TransferFrom(token, from, to, amount); } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. /// Reverts upon failure. function permit2TransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(add(m, 0x74), shr(96, shl(96, token))) mstore(add(m, 0x54), amount) mstore(add(m, 0x34), to) mstore(add(m, 0x20), shl(96, from)) // `transferFrom(address,address,uint160,address)`. mstore(m, 0x36c78516000000000000000000000000) let p := PERMIT2 let exists := eq(chainid(), 1) if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } if iszero( and( call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), lt(iszero(extcodesize(token)), exists) // Token has code and Permit2 exists. ) ) { mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) } } } /// @dev Permit a user to spend a given amount of /// another user's tokens via native EIP-2612 permit if possible, falling /// back to Permit2 if native permit fails or is not implemented on the token. function permit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { bool success; /// @solidity memory-safe-assembly assembly { for {} shl(96, xor(token, WETH9)) {} { mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. if iszero( and( // The arguments of `and` are evaluated from right to left. lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. // Gas stipend to limit gas burn for tokens that don't refund gas when // an non-existing function is called. 5K should be enough for a SLOAD. staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) ) ) { break } // After here, we can be sure that token is a contract. let m := mload(0x40) mstore(add(m, 0x34), spender) mstore(add(m, 0x20), shl(96, owner)) mstore(add(m, 0x74), deadline) if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { mstore(0x14, owner) mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. // `nonces` is already at `add(m, 0x54)`. // `1` is already stored at `add(m, 0x94)`. mstore(add(m, 0xb4), and(0xff, v)) mstore(add(m, 0xd4), r) mstore(add(m, 0xf4), s) success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) break } mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. mstore(add(m, 0x54), amount) mstore(add(m, 0x94), and(0xff, v)) mstore(add(m, 0xb4), r) mstore(add(m, 0xd4), s) success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) break } } if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); } /// @dev Simple permit on the Permit2 contract. function simplePermit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(m, 0x927da105) // `allowance(address,address,address)`. { let addressMask := shr(96, not(0)) mstore(add(m, 0x20), and(addressMask, owner)) mstore(add(m, 0x40), and(addressMask, token)) mstore(add(m, 0x60), and(addressMask, spender)) mstore(add(m, 0xc0), and(addressMask, spender)) } let p := mul(PERMIT2, iszero(shr(160, amount))) if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) ) ) { mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(p))), 0x04) } mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). // `owner` is already `add(m, 0x20)`. // `token` is already at `add(m, 0x40)`. mstore(add(m, 0x60), amount) mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. // `nonce` is already at `add(m, 0xa0)`. // `spender` is already at `add(m, 0xc0)`. mstore(add(m, 0xe0), deadline) mstore(add(m, 0x100), 0x100) // `signature` offset. mstore(add(m, 0x120), 0x41) // `signature` length. mstore(add(m, 0x140), r) mstore(add(m, 0x160), s) mstore(add(m, 0x180), shl(248, v)) if iszero( // Revert if token does not have code, or if the call fails. mul(extcodesize(token), call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00))) { mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ 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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title Stripped down interface of Aero NFP Manager interface INonfungiblePositionManager { /// @notice Returns the position information associated with a given token ID. /// @dev Throws if the token ID is not valid. /// @param tokenId The ID of the token that represents the position /// @return nonce The nonce for permits /// @return operator The address that is approved for spending /// @return token0 The address of the token0 for a specific pool /// @return token1 The address of the token1 for a specific pool /// @return tickSpacing The tick spacing associated with the pool /// @return tickLower The lower end of the tick range for the position /// @return tickUpper The higher end of the tick range for the position /// @return liquidity The liquidity of the position /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation function positions(uint256 tokenId) external view returns ( uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns the address of the Token Descriptor, that handles generating token URIs for Positions function tokenDescriptor() external view returns (address); /// @notice Returns the address of the Owner, that is allowed to set a new TokenDescriptor function owner() external view returns (address); struct MintParams { address token0; address token1; int24 tickSpacing; int24 tickLower; int24 tickUpper; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; uint160 sqrtPriceX96; } /// @notice Creates a new position wrapped in a NFT /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized /// a method does not exist, i.e. the pool is assumed to be initialized. /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata /// @return tokenId The ID of the token that represents the minted position /// @return liquidity The amount of liquidity for this position /// @return amount0 The amount of token0 /// @return amount1 The amount of token1 function mint(MintParams calldata params) external payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1); struct IncreaseLiquidityParams { uint256 tokenId; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender` /// @param params tokenId The ID of the token for which liquidity is being increased, /// amount0Desired The desired amount of token0 to be spent, /// amount1Desired The desired amount of token1 to be spent, /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check, /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check, /// deadline The time by which the transaction must be included to effect the change /// @return liquidity The new liquidity amount as a result of the increase /// @return amount0 The amount of token0 to acheive resulting liquidity /// @return amount1 The amount of token1 to acheive resulting liquidity function increaseLiquidity(IncreaseLiquidityParams calldata params) external payable returns (uint128 liquidity, uint256 amount0, uint256 amount1); struct DecreaseLiquidityParams { uint256 tokenId; uint128 liquidity; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } /// @notice Decreases the amount of liquidity in a position and accounts it to the position /// @param params tokenId The ID of the token for which liquidity is being decreased, /// amount The amount by which liquidity will be decreased, /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity, /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity, /// deadline The time by which the transaction must be included to effect the change /// @return amount0 The amount of token0 accounted to the position's tokens owed /// @return amount1 The amount of token1 accounted to the position's tokens owed /// @dev The use of this function can cause a loss to users of the NonfungiblePositionManager /// @dev for tokens that have very high decimals. /// @dev The amount of tokens necessary for the loss is: 3.4028237e+38. /// @dev This is equivalent to 1e20 value with 18 decimals. function decreaseLiquidity(DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1); struct CollectParams { uint256 tokenId; address recipient; uint128 amount0Max; uint128 amount1Max; } /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient /// @notice Used to update staked positions before deposit and withdraw /// @param params tokenId The ID of the NFT for which tokens are being collected, /// recipient The account that should receive the tokens, /// amount0Max The maximum amount of token0 to collect, /// amount1Max The maximum amount of token1 to collect /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Minimal interface for the CL Factory interface ICLFactory { /// @notice Returns the pool address for a given pair of tokens and a tick spacing, or address 0 if it does not exist /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @param tickSpacing The tick spacing of the pool /// @return pool The pool address function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool); /// @notice Returns the address of the Owner, that is allowed to set a new poolCreator function owner() external view returns (address); function setPoolCreator(address poolCreator) external; function feeManager() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; interface IMakeERC20 { function initialize(string memory _name, string memory _symbol, uint256 _totalSupply) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; interface ILPEscrow { // ======================= Struct ======================= /** * @dev Struct that holds the initialization parameters for the escrow contract. * @param LP Address of the liquidity pool (LP) associated with this escrow. * @param tokenId The token ID representing the LP position. * @param counterAsset The address of the counterAsset token contract, which should be cdxUSD or MF. * @param newToken The address of the new token paired with counterAsset in the LP. * @param positionManager The address of the position manager contract managing LP positions. * @param tokenMaker The address of the TokenMaker contract used for protocol fees and token creation. * @param feeRecipients Array of addresses that will receive fees. * @param feeBPS Array of fee amounts in basis points (BPS) for each fee recipient. */ struct InitParams { address LP; uint256 tokenId; address counterAsset; address newToken; address positionManager; address tokenMaker; address[] feeRecipients; uint256[] feeBPS; } // ======================= Error ======================= error LPEscrow__InvalidFeeAmounts(); error LPEscrow__feeArrayLengthMismatch(); // ======================= Event ======================= /** * @dev Event that is emitted when fees are distributed to the fee recipients. * @param token Address of the token that was distributed. * @param feeRecipients Array of addresses that received the fees. * @param feeBPS Array of BPS values that represent the share of fees for each recipient. * @param totalAmount The total amount of token distributed as fees. */ event DistributeFees( address indexed token, address[] feeRecipients, uint256[] feeBPS, uint256 totalAmount ); function initialize(InitParams memory params) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; interface ITokenMaker { // ======================= Struct ======================= /** * @dev Parameters for creating a new token in the TokenMaker contract. * @param salt Unique identifier used to generate the token address deterministically. * @param totalSupply Total supply of the token being created. * @param startingTick Initial tick corresponding to initial price of the liquidity pool. * @param feeRecipients Array of addresses that will receive fees from token transactions. * @param feeBPS Array of fee basis points (BPS) corresponding to each fee recipient. */ struct MakeParams { bytes32 salt; uint256 totalSupply; int24 startingTick; address[] feeRecipients; uint256[] feeBPS; } /** * @dev Initialization parameters for deploying the TokenMaker contract. * @param escrowImpl Address of the escrow implementation contract. * @param tokenImpl Address of the token implementation contract. * @param CLFactory Address of the factory contract for creating liquidity pools. * @param counterAsset Address of the counterAsset token. * @param positionManager Address of the position manager contract. * @param protocolFeeBPS Protocol fee rate in basis points (BPS). * @param protocolFeeRecipient Address that receives the protocol fees. * @param owner Address that has admin access to the TokenMaker contract. * @param pausers Array of addresses that can pause the TokenMaker contract. */ struct InitParams { address CLFactory; address counterAsset; address positionManager; uint256 protocolFeeBPS; address protocolFeeRecipient; address owner; address[] pausers; address feeManager; } // ======================= Error ======================= error TokenMaker__InvalidTokenParams(); error TokenMaker__InvalidSet(); error TokenMaker__Paused(); // ======================= Event ======================= /** * @dev Emitted when a new token is created. * @param token Address of the newly created token. * @param LP Address of the liquidity pool. * @param tokenId Token ID associated with the liquidity position. * @param escrow Address of the escrow contract. */ event TokenCreated(address indexed token, address indexed LP, uint256 tokenId, address escrow); // ======================= Function ======================= function makeToken(string memory name, string memory symbol, MakeParams memory params) external returns (address token, address LP, uint256 tokenId, address escrow); function protocolFeeBPS() external view returns (uint256); function protocolFeeRecipient() external view returns (address); function counterAsset() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import {ERC20} from "lib/solady/src/tokens/ERC20.sol"; import {Initializable} from "zksync-oz/contracts/proxy/utils/Initializable.sol"; // /$$ /$$ /$$ /$$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ // | $$$ /$$$ | $$ | $$_____/| $$__ $$ /$$__ $$ /$$__ $$ /$$$_ $$ // | $$$$ /$$$$ /$$$$$$ | $$ /$$ /$$$$$$ | $$ | $$ \ $$| $$ \__/|__/ \ $$| $$$$\ $$ // | $$ $$/$$ $$ |____ $$| $$ /$$/ /$$__ $$| $$$$$ | $$$$$$$/| $$ /$$$$$$/| $$ $$ $$ // | $$ $$$| $$ /$$$$$$$| $$$$$$/ | $$$$$$$$| $$__/ | $$__ $$| $$ /$$____/ | $$\ $$$$ // | $$\ $ | $$ /$$__ $$| $$_ $$ | $$_____/| $$ | $$ \ $$| $$ $$| $$ | $$ \ $$$ // | $$ \/ | $$| $$$$$$$| $$ \ $$| $$$$$$$| $$$$$$$$| $$ | $$| $$$$$$/| $$$$$$$$| $$$$$$/ // |__/ |__/ \_______/|__/ \__/ \_______/|________/|__/ |__/ \______/ |________/ \______/ contract MakeERC20 is ERC20, Initializable { string internal tokenName; string internal tokenSymbol; /** * @dev Constructor that disables initializers for this contract. */ constructor() { //_disableInitializers(); // @issue: commented out till we decide to use proxy or not } function initialize(string memory _name, string memory _symbol, uint256 _totalSupply) external initializer { tokenName = _name; tokenSymbol = _symbol; _mint(msg.sender, _totalSupply); } function name() public view override returns (string memory) { return tokenName; } function symbol() public view override returns (string memory) { return tokenSymbol; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; import {Initializable} from "zksync-oz/contracts/proxy/utils/Initializable.sol"; import {SafeTransferLib} from "lib/solady/src/utils/SafeTransferLib.sol"; import {INonfungiblePositionManager} from "contracts/interfaces/INonfungiblePositionManager.sol"; import {ILPEscrow} from "contracts/interfaces/ILPEscrow.sol"; import {ITokenMaker} from "contracts/interfaces/ITokenMaker.sol"; // /$$ /$$$$$$$ /$$$$$$$$ // | $$ | $$__ $$| $$_____/ // | $$ | $$ \ $$| $$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ /$$ // | $$ | $$$$$$$/| $$$$$ /$$_____/ /$$_____/ /$$__ $$ /$$__ $$| $$ | $$ | $$ // | $$ | $$____/ | $$__/ | $$$$$$ | $$ | $$ \__/| $$ \ $$| $$ | $$ | $$ // | $$ | $$ | $$ \____ $$| $$ | $$ | $$ | $$| $$ | $$ | $$ // | $$$$$$$$| $$ | $$$$$$$$ /$$$$$$$/| $$$$$$$| $$ | $$$$$$/| $$$$$/$$$$/ // |________/|__/ |________/|_______/ \_______/|__/ \______/ \_____/\___/ contract LPEscrow is ILPEscrow, Initializable { using SafeTransferLib for address; // ======================= Constant ======================= uint256 public constant BPS_DENOM = 10_000; // ======================= Storage ======================= address public tokenMaker; address public LP; address public counterAsset; address public newToken; address public positionManager; uint256 public tokenId; address[] public feeRecipients; uint256[] public feeBPS; /** * @dev Constructor that disables initializers for this contract. */ constructor() { //_disableInitializers(); // @issue: commented out till we decide to use proxy or not } /** * * @dev Initializes the escrow contract with the provided parameters. * @param params_ Initialization parameters, including LP, tokens, and fee settings. */ function initialize(InitParams memory params_) external initializer { LP = params_.LP; tokenId = params_.tokenId; counterAsset = params_.counterAsset; newToken = params_.newToken; positionManager = params_.positionManager; tokenMaker = params_.tokenMaker; _setFees(params_.feeRecipients, params_.feeBPS); } // ======================= External Function ======================= /** * @dev Collects fees from the LP position and distributes them to recipients and protocol. */ function collectAndDistributeFees() external { (uint256 counterAssetAmount_, uint256 newTokenAmount_) = _collectFromLP(); uint256 protocolFeeBPS_ = ITokenMaker(tokenMaker).protocolFeeBPS(); address protocolFeeRecipient_ = ITokenMaker(tokenMaker).protocolFeeRecipient(); uint256 protocolFeeUSD_ = counterAssetAmount_ * protocolFeeBPS_ / BPS_DENOM; uint256 protocolFeeToken_ = newTokenAmount_ * protocolFeeBPS_ / BPS_DENOM; counterAsset.safeTransfer(protocolFeeRecipient_, protocolFeeUSD_); newToken.safeTransfer(protocolFeeRecipient_, protocolFeeToken_); _distributeFees(counterAssetAmount_ - protocolFeeUSD_, counterAsset); _distributeFees(newTokenAmount_ - protocolFeeToken_, newToken); } // ======================= Internal Function ======================= /** * @dev Collects tokens from the LP position. * @return counterAssetAmount_ Amount of counterAsset collected from the LP position. * @return newTokenAmount_ Amount of newToken collected from the LP position. */ function _collectFromLP() internal returns (uint256 counterAssetAmount_, uint256 newTokenAmount_) { INonfungiblePositionManager.CollectParams memory params_; params_.tokenId = tokenId; params_.recipient = address(this); params_.amount0Max = type(uint128).max; params_.amount1Max = type(uint128).max; if (counterAsset < newToken) { (counterAssetAmount_, newTokenAmount_) = INonfungiblePositionManager(positionManager).collect(params_); } else { (newTokenAmount_, counterAssetAmount_) = INonfungiblePositionManager(positionManager).collect(params_); } } /** * @dev Distributes collected fees to each fee recipient based on their BPS allocation. * @param _totalAmount Total amount of tokens to distribute as fees. * @param _token Address of the token to be distributed. */ function _distributeFees(uint256 _totalAmount, address _token) internal { uint256 remaining_ = _totalAmount; for (uint256 i = 0; i < feeRecipients.length - 1; i++) { uint256 feeAmount = _totalAmount * feeBPS[i] / BPS_DENOM; _token.safeTransfer(feeRecipients[i], feeAmount); remaining_ -= feeAmount; } _token.safeTransfer(feeRecipients[feeRecipients.length - 1], remaining_); emit DistributeFees(_token, feeRecipients, feeBPS, _totalAmount); } /** * @dev Sets the fee recipients and their respective BPS allocations. * @param _feeRecipients Array of addresses to receive fees. * @param _feeBPS Array of fee basis points for each recipient. * Reverts if lengths do not match or if total BPS is not equal to `BPS_DENOM`. */ function _setFees(address[] memory _feeRecipients, uint256[] memory _feeBPS) internal { if (_feeRecipients.length != _feeBPS.length) revert LPEscrow__feeArrayLengthMismatch(); uint256 totalFeeBPS_ = 0; for (uint256 i = 0; i < _feeBPS.length; i++) { totalFeeBPS_ += _feeBPS[i]; } if (totalFeeBPS_ != BPS_DENOM) revert LPEscrow__InvalidFeeAmounts(); feeRecipients = _feeRecipients; feeBPS = _feeBPS; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.23; interface ISyncSwapCustomPoolManager { // Set swap fee for a specific pool created by the pool creator, fee is in 1e6 decimals (3000 is 0.3%) // Directional fee is supported by tokenIn - set twice for both directions. function setCustomPoolSwapFee(address pool, address tokenIn, uint24 fee) external; // Update pool's LP fee share to 90% function updatePoolProtocolFee(address pool) external; function setIsFeeSetter(address _target, bool _isFeeSetter) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC20 + EIP-2612 implementation. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC20.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol) /// /// @dev Note: /// - The ERC20 standard allows minting and transferring to and from the zero address, /// minting and transferring zero tokens, as well as self-approvals. /// For performance, this implementation WILL NOT revert for such actions. /// Please add any checks with overrides if desired. /// - The `permit` function uses the ecrecover precompile (0x1). /// /// If you are overriding: /// - NEVER violate the ERC20 invariant: /// the total sum of all balances must be equal to `totalSupply()`. /// - Check that the overridden function is actually used in the function you want to /// change the behavior of. Much of the code has been manually inlined for performance. abstract contract ERC20 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The total supply has overflowed. error TotalSupplyOverflow(); /// @dev The allowance has overflowed. error AllowanceOverflow(); /// @dev The allowance has underflowed. error AllowanceUnderflow(); /// @dev Insufficient balance. error InsufficientBalance(); /// @dev Insufficient allowance. error InsufficientAllowance(); /// @dev The permit is invalid. error InvalidPermit(); /// @dev The permit has expired. error PermitExpired(); /// @dev The allowance of Permit2 is fixed at infinity. error Permit2AllowanceIsFixedAtInfinity(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Emitted when `amount` tokens is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 amount); /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`. event Approval(address indexed owner, address indexed spender, uint256 amount); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The storage slot for the total supply. uint256 private constant _TOTAL_SUPPLY_SLOT = 0x05345cdf77eb68f44c; /// @dev The balance slot of `owner` is given by: /// ``` /// mstore(0x0c, _BALANCE_SLOT_SEED) /// mstore(0x00, owner) /// let balanceSlot := keccak256(0x0c, 0x20) /// ``` uint256 private constant _BALANCE_SLOT_SEED = 0x87a211a2; /// @dev The allowance slot of (`owner`, `spender`) is given by: /// ``` /// mstore(0x20, spender) /// mstore(0x0c, _ALLOWANCE_SLOT_SEED) /// mstore(0x00, owner) /// let allowanceSlot := keccak256(0x0c, 0x34) /// ``` uint256 private constant _ALLOWANCE_SLOT_SEED = 0x7f5e9f20; /// @dev The nonce slot of `owner` is given by: /// ``` /// mstore(0x0c, _NONCES_SLOT_SEED) /// mstore(0x00, owner) /// let nonceSlot := keccak256(0x0c, 0x20) /// ``` uint256 private constant _NONCES_SLOT_SEED = 0x38377508; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev `(_NONCES_SLOT_SEED << 16) | 0x1901`. uint256 private constant _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX = 0x383775081901; /// @dev `keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")`. bytes32 private constant _DOMAIN_TYPEHASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; /// @dev `keccak256("1")`. /// If you need to use a different version, override `_versionHash`. bytes32 private constant _DEFAULT_VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6; /// @dev `keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")`. bytes32 private constant _PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; /// @dev The canonical Permit2 address. /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. /// To enable, override `_givePermit2InfiniteAllowance()`. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 METADATA */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the name of the token. function name() public view virtual returns (string memory); /// @dev Returns the symbol of the token. function symbol() public view virtual returns (string memory); /// @dev Returns the decimals places of the token. function decimals() public view virtual returns (uint8) { return 18; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the amount of tokens in existence. function totalSupply() public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := sload(_TOTAL_SUPPLY_SLOT) } } /// @dev Returns the amount of tokens owned by `owner`. function balanceOf(address owner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _BALANCE_SLOT_SEED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x20)) } } /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`. function allowance(address owner, address spender) public view virtual returns (uint256 result) { if (_givePermit2InfiniteAllowance()) { if (spender == _PERMIT2) return type(uint256).max; } /// @solidity memory-safe-assembly assembly { mstore(0x20, spender) mstore(0x0c, _ALLOWANCE_SLOT_SEED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x34)) } } /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. /// /// Emits a {Approval} event. function approve(address spender, uint256 amount) public virtual returns (bool) { if (_givePermit2InfiniteAllowance()) { /// @solidity memory-safe-assembly assembly { // If `spender == _PERMIT2 && amount != type(uint256).max`. if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(amount)))) { mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. revert(0x1c, 0x04) } } } /// @solidity memory-safe-assembly assembly { // Compute the allowance slot and store the amount. mstore(0x20, spender) mstore(0x0c, _ALLOWANCE_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x34), amount) // Emit the {Approval} event. mstore(0x00, amount) log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c))) } return true; } /// @dev Transfer `amount` tokens from the caller to `to`. /// /// Requirements: /// - `from` must at least have `amount`. /// /// Emits a {Transfer} event. function transfer(address to, uint256 amount) public virtual returns (bool) { _beforeTokenTransfer(msg.sender, to, amount); /// @solidity memory-safe-assembly assembly { // Compute the balance slot and load its value. mstore(0x0c, _BALANCE_SLOT_SEED) mstore(0x00, caller()) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Compute the balance slot of `to`. mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance of `to`. // Will not overflow because the sum of all user balances // cannot exceed the maximum uint256 value. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c))) } _afterTokenTransfer(msg.sender, to, amount); return true; } /// @dev Transfers `amount` tokens from `from` to `to`. /// /// Note: Does not update the allowance if it is the maximum uint256 value. /// /// Requirements: /// - `from` must at least have `amount`. /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) { _beforeTokenTransfer(from, to, amount); // Code duplication is for zero-cost abstraction if possible. if (_givePermit2InfiniteAllowance()) { /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) if iszero(eq(caller(), _PERMIT2)) { // Compute the allowance slot and load its value. mstore(0x20, caller()) mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED)) let allowanceSlot := keccak256(0x0c, 0x34) let allowance_ := sload(allowanceSlot) // If the allowance is not the maximum uint256 value. if not(allowance_) { // Revert if the amount to be transferred exceeds the allowance. if gt(amount, allowance_) { mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. revert(0x1c, 0x04) } // Subtract and store the updated allowance. sstore(allowanceSlot, sub(allowance_, amount)) } } // Compute the balance slot and load its value. mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Compute the balance slot of `to`. mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance of `to`. // Will not overflow because the sum of all user balances // cannot exceed the maximum uint256 value. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) } } else { /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) // Compute the allowance slot and load its value. mstore(0x20, caller()) mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED)) let allowanceSlot := keccak256(0x0c, 0x34) let allowance_ := sload(allowanceSlot) // If the allowance is not the maximum uint256 value. if not(allowance_) { // Revert if the amount to be transferred exceeds the allowance. if gt(amount, allowance_) { mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. revert(0x1c, 0x04) } // Subtract and store the updated allowance. sstore(allowanceSlot, sub(allowance_, amount)) } // Compute the balance slot and load its value. mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Compute the balance slot of `to`. mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance of `to`. // Will not overflow because the sum of all user balances // cannot exceed the maximum uint256 value. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) } } _afterTokenTransfer(from, to, amount); return true; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EIP-2612 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev For more performance, override to return the constant value /// of `keccak256(bytes(name()))` if `name()` will never change. function _constantNameHash() internal view virtual returns (bytes32 result) {} /// @dev If you need a different value, override this function. function _versionHash() internal view virtual returns (bytes32 result) { result = _DEFAULT_VERSION_HASH; } /// @dev For inheriting contracts to increment the nonce. function _incrementNonce(address owner) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _NONCES_SLOT_SEED) mstore(0x00, owner) let nonceSlot := keccak256(0x0c, 0x20) sstore(nonceSlot, add(1, sload(nonceSlot))) } } /// @dev Returns the current nonce for `owner`. /// This value is used to compute the signature for EIP-2612 permit. function nonces(address owner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the nonce slot and load its value. mstore(0x0c, _NONCES_SLOT_SEED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x20)) } } /// @dev Sets `value` as the allowance of `spender` over the tokens of `owner`, /// authorized by a signed approval by `owner`. /// /// Emits a {Approval} event. function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { if (_givePermit2InfiniteAllowance()) { /// @solidity memory-safe-assembly assembly { // If `spender == _PERMIT2 && value != type(uint256).max`. if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(value)))) { mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. revert(0x1c, 0x04) } } } bytes32 nameHash = _constantNameHash(); // We simply calculate it on-the-fly to allow for cases where the `name` may change. if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); bytes32 versionHash = _versionHash(); /// @solidity memory-safe-assembly assembly { // Revert if the block timestamp is greater than `deadline`. if gt(timestamp(), deadline) { mstore(0x00, 0x1a15a3cc) // `PermitExpired()`. revert(0x1c, 0x04) } let m := mload(0x40) // Grab the free memory pointer. // Clean the upper 96 bits. owner := shr(96, shl(96, owner)) spender := shr(96, shl(96, spender)) // Compute the nonce slot and load its value. mstore(0x0e, _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX) mstore(0x00, owner) let nonceSlot := keccak256(0x0c, 0x20) let nonceValue := sload(nonceSlot) // Prepare the domain separator. mstore(m, _DOMAIN_TYPEHASH) mstore(add(m, 0x20), nameHash) mstore(add(m, 0x40), versionHash) mstore(add(m, 0x60), chainid()) mstore(add(m, 0x80), address()) mstore(0x2e, keccak256(m, 0xa0)) // Prepare the struct hash. mstore(m, _PERMIT_TYPEHASH) mstore(add(m, 0x20), owner) mstore(add(m, 0x40), spender) mstore(add(m, 0x60), value) mstore(add(m, 0x80), nonceValue) mstore(add(m, 0xa0), deadline) mstore(0x4e, keccak256(m, 0xc0)) // Prepare the ecrecover calldata. mstore(0x00, keccak256(0x2c, 0x42)) mstore(0x20, and(0xff, v)) mstore(0x40, r) mstore(0x60, s) let t := staticcall(gas(), 1, 0x00, 0x80, 0x20, 0x20) // If the ecrecover fails, the returndatasize will be 0x00, // `owner` will be checked if it equals the hash at 0x00, // which evaluates to false (i.e. 0), and we will revert. // If the ecrecover succeeds, the returndatasize will be 0x20, // `owner` will be compared against the returned address at 0x20. if iszero(eq(mload(returndatasize()), owner)) { mstore(0x00, 0xddafbaef) // `InvalidPermit()`. revert(0x1c, 0x04) } // Increment and store the updated nonce. sstore(nonceSlot, add(nonceValue, t)) // `t` is 1 if ecrecover succeeds. // Compute the allowance slot and store the value. // The `owner` is already at slot 0x20. mstore(0x40, or(shl(160, _ALLOWANCE_SLOT_SEED), spender)) sstore(keccak256(0x2c, 0x34), value) // Emit the {Approval} event. log3(add(m, 0x60), 0x20, _APPROVAL_EVENT_SIGNATURE, owner, spender) mstore(0x40, m) // Restore the free memory pointer. mstore(0x60, 0) // Restore the zero pointer. } } /// @dev Returns the EIP-712 domain separator for the EIP-2612 permit. function DOMAIN_SEPARATOR() public view virtual returns (bytes32 result) { bytes32 nameHash = _constantNameHash(); // We simply calculate it on-the-fly to allow for cases where the `name` may change. if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); bytes32 versionHash = _versionHash(); /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Grab the free memory pointer. mstore(m, _DOMAIN_TYPEHASH) mstore(add(m, 0x20), nameHash) mstore(add(m, 0x40), versionHash) mstore(add(m, 0x60), chainid()) mstore(add(m, 0x80), address()) result := keccak256(m, 0xa0) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL MINT FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Mints `amount` tokens to `to`, increasing the total supply. /// /// Emits a {Transfer} event. function _mint(address to, uint256 amount) internal virtual { _beforeTokenTransfer(address(0), to, amount); /// @solidity memory-safe-assembly assembly { let totalSupplyBefore := sload(_TOTAL_SUPPLY_SLOT) let totalSupplyAfter := add(totalSupplyBefore, amount) // Revert if the total supply overflows. if lt(totalSupplyAfter, totalSupplyBefore) { mstore(0x00, 0xe5cfe957) // `TotalSupplyOverflow()`. revert(0x1c, 0x04) } // Store the updated total supply. sstore(_TOTAL_SUPPLY_SLOT, totalSupplyAfter) // Compute the balance slot and load its value. mstore(0x0c, _BALANCE_SLOT_SEED) mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, mload(0x0c))) } _afterTokenTransfer(address(0), to, amount); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL BURN FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Burns `amount` tokens from `from`, reducing the total supply. /// /// Emits a {Transfer} event. function _burn(address from, uint256 amount) internal virtual { _beforeTokenTransfer(from, address(0), amount); /// @solidity memory-safe-assembly assembly { // Compute the balance slot and load its value. mstore(0x0c, _BALANCE_SLOT_SEED) mstore(0x00, from) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Subtract and store the updated total supply. sstore(_TOTAL_SUPPLY_SLOT, sub(sload(_TOTAL_SUPPLY_SLOT), amount)) // Emit the {Transfer} event. mstore(0x00, amount) log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0) } _afterTokenTransfer(from, address(0), amount); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL TRANSFER FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Moves `amount` of tokens from `from` to `to`. function _transfer(address from, address to, uint256 amount) internal virtual { _beforeTokenTransfer(from, to, amount); /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) // Compute the balance slot and load its value. mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) let fromBalanceSlot := keccak256(0x0c, 0x20) let fromBalance := sload(fromBalanceSlot) // Revert if insufficient balance. if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } // Subtract and store the updated balance. sstore(fromBalanceSlot, sub(fromBalance, amount)) // Compute the balance slot of `to`. mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x20) // Add and store the updated balance of `to`. // Will not overflow because the sum of all user balances // cannot exceed the maximum uint256 value. sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) // Emit the {Transfer} event. mstore(0x20, amount) log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) } _afterTokenTransfer(from, to, amount); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL ALLOWANCE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Updates the allowance of `owner` for `spender` based on spent `amount`. function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { if (_givePermit2InfiniteAllowance()) { if (spender == _PERMIT2) return; // Do nothing, as allowance is infinite. } /// @solidity memory-safe-assembly assembly { // Compute the allowance slot and load its value. mstore(0x20, spender) mstore(0x0c, _ALLOWANCE_SLOT_SEED) mstore(0x00, owner) let allowanceSlot := keccak256(0x0c, 0x34) let allowance_ := sload(allowanceSlot) // If the allowance is not the maximum uint256 value. if not(allowance_) { // Revert if the amount to be transferred exceeds the allowance. if gt(amount, allowance_) { mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. revert(0x1c, 0x04) } // Subtract and store the updated allowance. sstore(allowanceSlot, sub(allowance_, amount)) } } } /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`. /// /// Emits a {Approval} event. function _approve(address owner, address spender, uint256 amount) internal virtual { if (_givePermit2InfiniteAllowance()) { /// @solidity memory-safe-assembly assembly { // If `spender == _PERMIT2 && amount != type(uint256).max`. if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(amount)))) { mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. revert(0x1c, 0x04) } } } /// @solidity memory-safe-assembly assembly { let owner_ := shl(96, owner) // Compute the allowance slot and store the amount. mstore(0x20, spender) mstore(0x0c, or(owner_, _ALLOWANCE_SLOT_SEED)) sstore(keccak256(0x0c, 0x34), amount) // Emit the {Approval} event. mstore(0x00, amount) log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, owner_), shr(96, mload(0x2c))) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HOOKS TO OVERRIDE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Hook that is called before any transfer of tokens. /// This includes minting and burning. function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /// @dev Hook that is called after any transfer of tokens. /// This includes minting and burning. function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PERMIT2 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns whether to fix the Permit2 contract's allowance at infinity. /// /// This value should be kept constant after contract initialization, /// or else the actual allowance values may not match with the {Approval} events. /// For best performance, return a compile-time constant for zero-cost abstraction. function _givePermit2InfiniteAllowance() internal view virtual returns (bool) { return false; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.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 { /** * @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. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = _setInitializedVersion(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. * * `initializer` is equivalent to `reinitializer(1)`, so 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. * * 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. */ modifier reinitializer(uint8 version) { bool isTopLevelCall = _setInitializedVersion(version); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(version); } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { _setInitializedVersion(type(uint8).max); } function _setInitializedVersion(uint8 version) private returns (bool) { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level // of initializers, because in other contexts the contract may have been reentered. if (_initializing) { require( version == 1 && !Address.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else { require(_initialized < version, "Initializable: contract is already initialized"); _initialized = version; return true; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [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 { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "viaIR": false, "codegen": "yul", "remappings": [ "forge-std/=lib/forge-std/src/", "zksync-oz/=lib/zksync-era/contracts/l1-contracts/lib/murky/lib/openzeppelin-contracts/", "@matterlabs/=lib/zksync-era/contracts/", "ds-test/=lib/zksync-era/contracts/l1-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/zksync-era/contracts/lib/openzeppelin-contracts-upgradeable-v4/lib/erc4626-tests/", "forge-zksync-std/=lib/forge-zksync-std/src/", "murky/=lib/zksync-era/contracts/lib/murky/", "openzeppelin-contracts-upgradeable-v4/=lib/zksync-era/contracts/lib/openzeppelin-contracts-upgradeable-v4/", "openzeppelin-contracts-v4/=lib/zksync-era/contracts/lib/openzeppelin-contracts-v4/", "openzeppelin-contracts/=lib/zksync-era/contracts/lib/murky/lib/openzeppelin-contracts/", "solady/=lib/solady/src/", "zksync-era/=lib/zksync-era/" ], "evmVersion": "paris", "outputSelection": { "*": { "*": [ "abi" ] } }, "optimizer": { "enabled": true, "mode": "3", "fallback_to_optimizing_for_size": false, "disable_system_request_memoization": true }, "metadata": {}, "libraries": {}, "enableEraVMExtensions": false, "forceEVMLA": false }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"components":[{"internalType":"address","name":"CLFactory","type":"address"},{"internalType":"address","name":"counterAsset","type":"address"},{"internalType":"address","name":"positionManager","type":"address"},{"internalType":"uint256","name":"protocolFeeBPS","type":"uint256"},{"internalType":"address","name":"protocolFeeRecipient","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address[]","name":"pausers","type":"address[]"},{"internalType":"address","name":"feeManager","type":"address"}],"internalType":"struct ITokenMaker.InitParams","name":"_params","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"TokenMaker__InvalidSet","type":"error"},{"inputs":[],"name":"TokenMaker__InvalidTokenParams","type":"error"},{"inputs":[],"name":"TokenMaker__Paused","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"roles","type":"uint256"}],"name":"RolesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"LP","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"escrow","type":"address"}],"name":"TokenCreated","type":"event"},{"inputs":[],"name":"CLFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TICK_2000","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_TICK_2000","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"counterAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"grantRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAllRoles","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAnyRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"components":[{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"int24","name":"startingTick","type":"int24"},{"internalType":"address[]","name":"feeRecipients","type":"address[]"},{"internalType":"uint256[]","name":"feeBPS","type":"uint256[]"}],"internalType":"struct ITokenMaker.MakeParams","name":"_params","type":"tuple"}],"name":"makeToken","outputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"address","name":"LP_","type":"address"},{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"address","name":"escrow_","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxTick","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTick","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeBPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"renounceRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"revokeRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"rolesOf","outputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_CLFactory","type":"address"}],"name":"setCLFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeManager","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_positionManager","type":"address"}],"name":"setPositionManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_protocolFeeBPS","type":"uint256"},{"internalType":"address","name":"_protocolFeeRecipient","type":"address"}],"name":"setProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minTotalSupply","type":"uint256"},{"internalType":"uint256","name":"_maxTotalSupply","type":"uint256"}],"name":"setSupplyLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"_minTick","type":"int24"},{"internalType":"int24","name":"_maxTick","type":"int24"}],"name":"setTickLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
9c4d535b00000000000000000000000000000000000000000000000000000000000000000100036dda7c94471ad2fb46a484ceeb0428aa35426fdbd9da7759abec44bac7000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000f6e27007e257e74c86522387bd071d561ba3c970000000000000000000000007d2fde5a4311ec68c4064ca34d4b24367b3fdd6400000000000000000000000055a853462862d54ef6fce380ce83dfd60494cf7a000000000000000000000000000000000000000000000000000000000000138800000000000000000000000099e463e5583a3b025ea62afb4c89649a77237f4900000000000000000000000099e463e5583a3b025ea62afb4c89649a77237f490000000000000000000000000000000000000000000000000000000000000100000000000000000000000000cc058f7d30912acd4cf04821a85a921e4c2562710000000000000000000000000000000000000000000000000000000000000004000000000000000000000000beb15caee71001d82f430e4deda80e16ddf438db000000000000000000000000f29da3595351dbfd0d647857c46f8d63fc2e68c5000000000000000000000000ccb4f4b05739b6c62d9663a5fa7f1e26930480190000000000000000000000008a1771672765fb340ba4fef7e6fc6c5e29ac6e3e
Deployed Bytecode
0x0002000000000002001300000000000200010000000103550000006003100270000002c80030019d0000008004000039000000400040043f000002c8033001970000000100200190000000220000c13d000000040030008c000000440000413d001300000000003d000000000201043b000000e002200270000002de0020009c000000460000a13d000002df0020009c0000009a0000213d000002ec0020009c000000f00000a13d000002ed0020009c000004670000a13d000002ee0020009c000005ca0000613d000002ef0020009c0000052e0000613d000002f00020009c000000440000c13d0000000001000416000000000001004b000000440000c13d0000000201000039000005320000013d0000000002000416000000000002004b000000440000c13d0000001f02300039000002c9022001970000008002200039000000400020043f0000001f0530018f000002ca063001980000008002600039000000320000613d000000000701034f000000007807043c0000000004840436000000000024004b0000002e0000c13d000000000005004b0000003f0000613d000000000161034f0000000304500210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f0000000000120435000000200030008c000000440000413d000000800100043d000002cb0010009c000000af0000a13d000000000100001900000b1600010430000002f80020009c000000bf0000a13d000002f90020009c000001160000a13d000002fa0020009c000004a30000a13d000002fb0020009c000005ec0000613d000002fc0020009c0000055e0000613d000002fd0020009c000000440000c13d000000440030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000402100370000000000202043b0000031d002001980000031e0300004100000000030060190000031f04200197000000000343019f000000000032004b000000440000c13d0000002401100370000000000101043b0000031d001001980000031e0300004100000000030060190000031f04100197000000000343019f000000000031004b000000440000c13d000002d503000041000000000303041a0000000004000411000000000034004b000006100000c13d0000032e0010009c00000000030000390000000103002039000003200010009c00000000040000390000000104004039000000000334016f0000000100300190000005fc0000c13d000003300020009c0000000004000019000003200400404100000320032001970000032005300167000003200030009c00000000060000190000032006002041000003200050009c000000000604c019000000000006004b000005fc0000c13d000000000012004b000000000400001900000320040020410000032005100197000000000653013f000000000053004b00000000030000190000032003004041000003200060009c000000000304c019000000000003004b000005fc0000c13d000003630220019700000018011002100000036401100197000000000121019f0000000802000039000000000302041a0000036503300197000000000131019f000000000012041b000000000100001900000b150001042e000002e00020009c0000010b0000a13d000002e10020009c000004700000a13d000002e20020009c000005d90000613d000002e30020009c000005370000613d000002e40020009c000000440000c13d000000240030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000401100370000000000101043b000002ce0010009c000000440000213d0000031002000041000005c10000013d000000800830003900000080091000390000000002980049000002cc0020009c000000440000213d000001000020008c000000440000413d000000400500043d000002cd0050009c0000012e0000a13d0000036101000041000000000010043f0000004101000039000000040010043f000003540100004100000b1600010430000003050020009c000001230000213d0000030b0020009c000004bf0000213d0000030e0020009c000005690000613d0000030f0020009c000000440000c13d000000440030008c000000440000413d0000000401100370000000000101043b000002ce0010009c000000440000213d000002d502000041000000000202041a0000000003000411000000000023004b000006100000c13d000002d8020000410000000c0020043f000000000010043f0000000001000414000002c80010009c000002c801008041000000c001100210000002d9011001c700008010020000390b140b0f0000040f0000000100200190000000440000613d00000024020000390000000102200367000000000202043b000000000101043b000000000301041a000000000623019f000000000061041b0000000c0100043d00000000020004140000006005100270000002c80020009c000002c802008041000000c001200210000002d6011001c70000800d020000390000000303000039000002da04000041000005980000013d000002f30020009c000001f40000213d000002f60020009c000004d70000613d000002f70020009c000000440000c13d000002d501000041000000000501041a0000000001000411000000000051004b000006100000c13d0000000001000414000002c80010009c000002c801008041000000c001100210000002d6011001c70000800d020000390000000303000039000002d70400004100000000060000190b140b0a0000040f0000000100200190000000440000613d000002d501000041000000000001041b000000000100001900000b150001042e000002e70020009c000004380000213d000002ea0020009c000004dc0000613d000002eb0020009c000000440000c13d0000000001000416000000000001004b000000440000c13d0000000301000039000005320000013d000003000020009c000004540000213d000003030020009c000005080000613d000003040020009c000000440000c13d0000000001000416000000000001004b000000440000c13d0000033001000041000000800010043f000003110100004100000b150001042e000003060020009c000004cc0000213d000003090020009c000005710000613d0000030a0020009c000000440000c13d0000000001000416000000000001004b000000440000c13d0000000701000039000005c60000013d0000010002500039000000400020043f0000000002090433000002ce0020009c000000440000213d0000000006250436000000a0021000390000000002020433000002ce0020009c000000440000213d0000000000260435000000c0021000390000000002020433000002ce0020009c000000440000213d000000400750003900000000002704350000006002500039000000e0031000390000000003030433000000000032043500000100031000390000000003030433000002ce0030009c000000440000213d000000800450003900000000003404350000012003100039000000000a030433000002ce00a0009c000000440000213d000000a0035000390000000000a30435000001400a100039000000000a0a0433000002cb00a0009c000000440000213d00000000099a00190000001f0a90003900000000008a004b000000440000813d000000009b090434000002cb00b0009c000000b90000213d000000050cb002100000003f0ac00039000002cf0da00197000000400a00043d000000000dda00190000000000ad004b000000000e000039000000010e004039000002cb00d0009c000000b90000213d0000000100e00190000000b90000c13d0000004000d0043f0000000000ba0435000000000c9c001900000000008c004b000000440000213d00000000000b004b000001750000613d00000000080a0019000000009b090434000002ce00b0009c000000440000213d00000020088000390000000000b804350000000000c9004b0000016e0000413d000000c008500039001200000008001d0000000000a8043500000160011000390000000001010433000002ce0010009c000000440000213d000000e00850003900000000001804350000000005050433000002ce055001970000000208000039000000000908041a000002d009900197000000000559019f000000000058041b0000000005060433000002ce05500197000000000600041a000002d006600197000000000556019f000000000050041b0000000005070433000002ce055001970000000106000039000000000706041a000002d007700197000000000557019f000000000056041b0000000305000039000000000605041a000002d006600197000000000116019f000000000015041b000002d10100004100000006050000390000000806000039000000000706041a000000000015041b000002d2010000410000000705000039000000000015041b000002d301700197000002d4011001c7000000000016041b0000000001020433000027100010008c000006400000213d0000000002040433000002ce02200198000006400000613d0000000404000039000000000014041b0000000501000039000000000401041a000002d004400197000000000224019f000000000021041b0000000001030433000002ce06100197000002d501000041000000000061041b0000000001000414000002c80010009c000002c801008041000000c001100210000002d6011001c70000800d020000390000000303000039000002d70400004100000000050000190b140b0a0000040f0000000100200190000000440000613d00000012010000290000000001010433001000000001001d0000000021010434001100000002001d000000000001004b000001ef0000613d0000000002000019001200000002001d000000050120021000000011011000290000000001010433000002d8020000410000000c0020043f000002ce01100197000000000010043f0000000001000414000002c80010009c000002c801008041000000c001100210000002d9011001c700008010020000390b140b0f0000040f0000000100200190000000440000613d000000000101043b000000000201041a00000001062001bf000000000061041b0000000c0100043d00000000020004140000006005100270000002c80020009c000002c802008041000000c001200210000002d6011001c70000800d020000390000000303000039000002da040000410b140b0a0000040f0000000100200190000000440000613d0000001202000029000000010220003900000010010000290000000001010433000000000012004b000001c70000413d000000200100003900000100001004430000012000000443000002db0100004100000b150001042e000002f40020009c000004e10000613d000002f50020009c000000440000c13d000000640030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000402100370000000000402043b000002cb0040009c000000440000213d0000002302400039000000000032004b000000440000813d0000000405400039000000000251034f000000000202043b000002cb0020009c000000b90000213d0000001f062000390000036b066001970000003f066000390000036b066001970000031b0060009c000000b90000213d0000008006600039000000400060043f000000800020043f00000000042400190000002404400039000000000034004b000000440000213d0000002004500039000000000541034f0000036b062001980000001f0720018f000000a004600039000002220000613d000000a008000039000000000905034f000000009a09043c0000000008a80436000000000048004b0000021e0000c13d000000000007004b0000022f0000613d000000000565034f0000000306700210000000000704043300000000076701cf000000000767022f000000000505043b0000010006600089000000000565022f00000000056501cf000000000575019f0000000000540435000000a00220003900000000000204350000002402100370000000000402043b000002cb0040009c000000440000213d0000002302400039000000000032004b000000440000813d0000000405400039000000000251034f000000000202043b000002cb0020009c000000b90000213d0000001f062000390000036b066001970000003f066000390000036b06600197000000400700043d0000000006670019001200000007001d000000000076004b00000000070000390000000107004039000002cb0060009c000000b90000213d0000000100700190000000b90000c13d000000400060043f00000012060000290000000006260436001100000006001d00000000042400190000002404400039000000000034004b000000440000213d0000002004500039000000000541034f0000036b062001980000001f0720018f00000011046000290000025f0000613d000000000805034f0000001109000029000000008a08043c0000000009a90436000000000049004b0000025b0000c13d000000000007004b0000026c0000613d000000000565034f0000000306700210000000000704043300000000076701cf000000000767022f000000000505043b0000010006600089000000000565022f00000000056501cf000000000575019f0000000000540435000000110220002900000000000204350000004402100370000000000402043b000002cb0040009c000000440000213d0000000002430049000002cc0020009c000000440000213d000000a40020008c000000440000413d000000400200043d0000031c0020009c000000b90000213d000000a005200039000000400050043f0000000405400039000000000551034f000000000505043b00000000065204360000002405400039000000000551034f000000000505043b001000000006001d00000000005604350000004405400039000000000651034f000000000606043b0000031d006001980000031e0700004100000000070060190000031f08600197000000000787019f000000000076004b000000440000c13d0000004007200039000f00000007001d00000000006704350000002005500039000000000651034f000000000606043b000002cb0060009c000000440000213d00000000074600190000002306700039000000000036004b000000440000813d0000000406700039000000000661034f000000000806043b000002cb0080009c000000b90000213d00000005098002100000003f06900039000002cf0a600197000000400600043d000000000aa6001900000000006a004b000000000b000039000000010b004039000002cb00a0009c000000b90000213d0000000100b00190000000b90000c13d0000004000a0043f000000000086043500000024077000390000000009790019000000000039004b000000440000213d000000000008004b000002be0000613d0000000008060019000000000a71034f000000000a0a043b000002ce00a0009c000000440000213d00000020088000390000000000a804350000002007700039000000000097004b000002b50000413d0000006007200039000e00000007001d00000000006704350000002005500039000000000551034f000000000505043b000002cb0050009c000000440000213d00000000054500190000002304500039000000000034004b000000000600001900000320060080410000032004400197000000000004004b00000000070000190000032007004041000003200040009c000000000706c019000000000007004b000000440000c13d0000000404500039000000000441034f000000000604043b000002cb0060009c000000b90000213d00000005076002100000003f04700039000002cf08400197000000400400043d0000000008840019000000000048004b00000000090000390000000109004039000002cb0080009c000000b90000213d0000000100900190000000b90000c13d000000400080043f000000000064043500000024055000390000000006570019000000000036004b000000440000213d000000000065004b000002f40000813d0000000003040019000000000751034f000000000707043b000000200330003900000000007304350000002005500039000000000065004b000002ed0000413d0000008001200039000d00000001001d00000000004104350000000801000039000000000101041a0000032100100198000006480000c13d000000100300002900000000030304330000000604000039000000000404041a000000000043004b0000064b0000413d0000000704000039000000000404041a000000000043004b0000064b0000213d0000000f0300002900000000030304330000031f043001970000031d003001980000031e030000410000000003006019000000000343019f0000031f041001970000031d001001980000031e050000410000000005006019000000000545019f00000320065001970000032004300197000000000764013f000000000064004b00000000060000190000032006002041000000000053004b00000000050000190000032005004041000003200070009c000000000605c019000000000006004b0000064b0000c13d00000018051002700000031f0550019700000323001001980000031e010000410000000001006019000000000151019f000000000013004b000000000300001900000320030020410000032001100197000000000514013f000000000014004b00000000010000190000032001004041000003200050009c000000000103c019000000000001004b0000064b0000c13d0000000e0100002900000000010104330000000001010433000000110010008c0000064b0000813d000000400100043d000003240010009c000000b90000213d00000000020204330000002403100039000002c60400004100000000004304350000004403100039000000000400041400000060050000390000000000530435000003250300004100000000003104350000000403100039000000000023043500000064021000390000000000020435000002c80010009c000002c8010080410000004001100210000002c80040009c000002c804008041000000c002400210000000000121019f00000326011001c700008006020000390b140b0a0000040f00000001002001900000064e0000613d00000000020000310000000103200367000000000101043b000c00000001001d000000000001004b0000000002000019000006510000613d000000400100043d000003240010009c000000b90000213d0000002402100039000002c70300004100000000003204350000004402100039000000000300041400000060040000390000000000420435000003270200004100000000002104350000006402100039000000000002043500000004021000390000000000020435000002c80010009c000002c8010080410000004001100210000002c80030009c000002c803008041000000c002300210000000000121019f00000326011001c700008006020000390b140b0a0000040f00000001002001900000066f0000613d00000000020000310000000103200367000000000101043b000b00000001001d000000000001004b0000000002000019000006720000613d00000010010000290000000001010433000a00000001001d000003280100004100000000001004430000000c01000029000002ce01100197000c00000001001d00000004001004430000000001000414000002c80010009c000002c801008041000000c00110021000000329011001c700008002020000390b140b0f0000040f000000010020019000000ac00000613d000000000101043b000000000001004b000000440000613d000000400300043d0000032a01000041000000000013043500000004023000390000006001000039000800000002001d00000000001204350000006401300039000000800200043d0000000000210435000900000003001d0000008401300039000000000002004b000003a70000613d00000000030000190000000004130019000000a005300039000000000505043300000000005404350000002003300039000000000023004b000003a00000413d000000000312001900000000000304350000001f022000390000036b02200197000000090300002900000024043000390000008003200039000700000004001d00000000003404350000000001120019000000120200002900000000020204330000000001210436000000000002004b000003be0000613d000000000300001900000000041300190000001105300029000000000505043300000000005404350000002003300039000000000023004b000003b70000413d00000000031200190000000000030435000000090400002900000044034000390000000a0500002900000000005304350000001f022000390000036b0220019700000000014100490000000001210019000002c80010009c000002c80100804100000060011002100000000002000414000002c80020009c000002c802008041000000c002200210000000000112019f000002c80040009c000002c8020000410000000002044019001200400020021800000012011001af0000000c020000290b140b0a0000040f00000001002001900000067e0000613d0000000901000029000002cb0010009c000000b90000213d0000000904000029000000400040043f000000100100002900000000010104330000000102000039000000000202041a0000032b030000410000000000340435000002ce0220019700000008030000290000000000230435000000070200002900000000001204350000000001000414000002c80010009c000002c801008041000000c00110021000000012011001af0000032c011001c70000000c020000290b140b0a0000040f0000006003100270000002c803300197000000200030008c000000200400003900000000040340190000001f0640018f00000020074001900000000905700029000004000000613d000000000801034f0000000909000029000000008a08043c0000000009a90436000000000059004b000003fc0000c13d000000000006004b0000040d0000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f000000000065043500000001002001900000068b0000613d0000001f01400039000000600110018f0000000901100029001200000001001d000002cb0010009c000000b90000213d0000001201000029000000400010043f000000200030008c000000440000413d00000009010000290000000001010433000000000001004b0000000002000039000000010200c039000000000021004b000000440000c13d00000010010000290000000001010433000000000200041a000002ce03200197001100000003001d0000000c0030006c000006970000813d0000032f0510009c000006ac0000413d000003300300004100000331020000410000000f0400002900000000060404330000031f046001970000031d006001980000031e060000410000000006006019000000000846019f000000000600001900000000070100190000000001000019000a000c0000002d0000000009080019000006a70000013d000002e80020009c000004ee0000613d000002e90020009c000000440000c13d000000440030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000402100370000000000202043b0000002401100370000000000101043b000002ce0010009c000000440000213d000002d503000041000000000303041a0000000004000411000000000034004b000006100000c13d000027100020008c000005fc0000213d000002ce01100198000005fc0000613d0000000403000039000000000023041b0000000502000039000006250000013d000003010020009c000005120000613d000003020020009c000000440000c13d000000440030008c000000440000413d0000000401100370000000000101043b001200000001001d000002ce0010009c000000440000213d0b140ac60000040f00000024010000390000000101100367000000000201043b00000012010000290b140ad00000040f000000000100001900000b150001042e000002f10020009c000005240000613d000002f20020009c000000440000c13d0000000001000416000000000001004b000000440000c13d0000000601000039000005c60000013d000002e50020009c000005290000613d000002e60020009c000000440000c13d000000240030008c000000440000413d0000000401100370000000000101043b001200000001001d000002ce0010009c000000440000213d000002d501000041000000000101041a0000000002000411000000000012004b000006100000c13d00000310010000410000000c0010043f0000001201000029000000000010043f0000000001000414000002c80010009c000002c801008041000000c001100210000002d9011001c700008010020000390b140b0f0000040f0000000100200190000000440000613d000000000101043b001000000001001d000000000101041a001100000001001d000003140100004100000000001004430000000001000414000002c80010009c000002c801008041000000c00110021000000315011001c70000800b020000390b140b0f0000040f000000010020019000000ac00000613d000000000101043b000000110010006c0000062b0000a13d0000031601000041000000000010043f000003130100004100000b1600010430000002fe0020009c000005490000613d000002ff0020009c000000440000c13d00000310010000410000000c0010043f0000000001000411000000000010043f0000000001000414000002c80010009c000002c801008041000000c001100210000002d9011001c700008010020000390b140b0f0000040f0000000100200190000000440000613d000000000101043b000000000001041b0000000001000414000002c80010009c000002c801008041000000c001100210000002d6011001c70000800d0200003900000002030000390000036604000041000005970000013d0000030c0020009c0000059d0000613d0000030d0020009c000000440000c13d0000000001000416000000000001004b000000440000c13d0000000801000039000000000101041a00000018021002700000031f022001970000032300100198000004e80000013d000003070020009c000005b70000613d000003080020009c000000440000c13d0000000001000416000000000001004b000000440000c13d0000032e01000041000000800010043f000003110100004100000b150001042e0000000001000416000000000001004b000000440000c13d0000000501000039000005320000013d0000000001000416000000000001004b000000440000c13d0000000401000039000005c60000013d0000000001000416000000000001004b000000440000c13d0000000801000039000000000101041a0000031f021001970000031d001001980000031e010000410000000001006019000000000121019f000000800010043f000003110100004100000b150001042e000000440030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000002402100370000000000202043b0000000401100370000000000101043b000002d503000041000000000303041a0000000004000411000000000034004b000006100000c13d000003170020009c000005fc0000213d000003180010009c000005fc0000413d000000000021004b000005fc0000213d0000000603000039000000000013041b0000000701000039000000000021041b000000000100001900000b150001042e0000000001000416000000000001004b000000440000c13d0b140ac60000040f0000000801000039000000000201041a0000031902200197000000000021041b000000000100001900000b150001042e000000240030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000401100370000000000101043b000002ce0010009c000000440000213d000002d502000041000000000202041a0000000003000411000000000023004b000006100000c13d000000000001004b000005fc0000613d0000000302000039000006250000013d0000000001000416000000000001004b000000440000c13d0000000101000039000005320000013d0000000001000416000000000001004b000000440000c13d000000000100041a000005330000013d0000000001000416000000000001004b000000440000c13d000002d501000041000000000101041a000002ce01100197000000800010043f000003110100004100000b150001042e000000240030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000401100370000000000101043b000002ce0010009c000000440000213d000002d502000041000000000202041a0000000003000411000000000023004b000006100000c13d000000000001004b000005fc0000613d0000000202000039000006250000013d000000440030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000402100370000000000202043b000002ce0020009c000000440000213d000002d8030000410000000c0030043f000000000020043f0000002401100370000000000101043b001200000001001d0000000c0100003900000020020000390b140af50000040f000000000101041a0000001200100180000005640000013d0000000001000416000000000001004b000000440000c13d0000000801000039000000000101041a00000321001001980000000001000039000000010100c039000000800010043f000003110100004100000b150001042e000000240030008c000000440000413d0000000401100370000000000201043b00000000010004110b140ad00000040f000000000100001900000b150001042e00000310010000410000000c0010043f0000000001000411000000000010043f000003140100004100000000001004430000000001000414000002c80010009c000002c801008041000000c00110021000000315011001c70000800b020000390b140b0f0000040f000000010020019000000ac00000613d000000000101043b001200000001001d0000000001000414000002c80010009c000002c801008041000000c001100210000002d9011001c700008010020000390b140b0f0000040f0000000100200190000000440000613d000000000101043b0000001202000029000003680220009a000000000021041b0000000001000414000002c80010009c000002c801008041000000c001100210000002d6011001c70000800d020000390000000203000039000003690400004100000000050004110b140b0a0000040f0000000100200190000000440000613d000000000100001900000b150001042e000000440030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000402100370000000000202043b000002ce0020009c000000440000213d0000002401100370000000000101043b001200000001001d000002d8010000410000000c0010043f000000000020043f0000000c0100003900000020020000390b140af50000040f000000000101041a000000120110017f000000120010006c00000000010000390000000101006039000000800010043f000003110100004100000b150001042e000000240030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000401100370000000000101043b000002ce0010009c000000440000213d000002d8020000410000000c0020043f000000000010043f0000000c0100003900000020020000390b140af50000040f000000000101041a000000800010043f000003110100004100000b150001042e0000000001000416000000000001004b000000440000c13d000002d501000041000000000201041a0000000001000411000000000021004b000006000000c13d0000000801000039000000000201041a00000319022001970000031a022001c7000000000021041b000000000100001900000b150001042e000000240030008c000000440000413d0000000401100370000000000101043b001200000001001d000002ce0010009c000000440000213d000002d501000041000000000501041a0000000001000411000000000051004b000006100000c13d0000001206000029000000000006004b000006140000c13d0000031201000041000000000010043f000003130100004100000b1600010430000000240030008c000000440000413d0000000002000416000000000002004b000000440000c13d0000000401100370000000000101043b000002ce0010009c000000440000213d000002d502000041000000000202041a0000000003000411000000000023004b000006100000c13d000000000001004b000006240000c13d000002dc01000041000000800010043f000003670100004100000b1600010430000002d8020000410000000c0020043f000000000010043f0000000001000414000002c80010009c000002c801008041000000c001100210000002d9011001c700008010020000390b140b0f0000040f0000000100200190000000440000613d000000000101043b000000000101041a0000000100100190000005d20000c13d0000036a01000041000000000010043f000003130100004100000b16000104300000000001000414000002c80010009c000002c801008041000000c001100210000002d6011001c70000800d020000390000000303000039000002d7040000410b140b0a0000040f0000000100200190000000440000613d000002d5010000410000001202000029000000000021041b000000000100001900000b150001042e0000000102000039000000000302041a000002d003300197000000000113019f000000000012041b000000000100001900000b150001042e0000001001000029000000000001041b000002d501000041000000000501041a0000000001000414000002c80010009c000002c801008041000000c001100210000002d6011001c70000800d020000390000000303000039000002d70400004100000012060000290b140b0a0000040f0000000100200190000000440000613d0000001201000029000002d502000041000000000012041b000000000100001900000b150001042e000000400100043d000002dc020000410000000000210435000002c80010009c000002c8010080410000004001100210000002dd011001c700000b1600010430000000400100043d0000032202000041000006420000013d000000400100043d0000036202000041000006420000013d0000006002100270000002c802200197000000000301034f0000001f0520018f000002ca06200198000000400100043d00000000046100190000065c0000613d000000000703034f0000000008010019000000007907043c0000000008980436000000000048004b000006580000c13d000000000005004b000006690000613d000000000363034f0000000305500210000000000604043300000000065601cf000000000656022f000000000303043b0000010005500089000000000353022f00000000035301cf000000000363019f00000000003404350000006002200210000002c80010009c000002c8010080410000004001100210000000000121019f00000b16000104300000006002100270000002c802200197000000000301034f0000001f0520018f000002ca06200198000000400100043d00000000046100190000065c0000613d000000000703034f0000000008010019000000007907043c0000000008980436000000000048004b000006790000c13d0000065c0000013d00000060061002700000001f0460018f000002ca05600198000000400200043d0000000003520019000009fe0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000038004b000006860000c13d000009fe0000013d0000001f0530018f000002ca06300198000000400200043d0000000004620019000008560000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b000006920000c13d000008560000013d0000032f0610009c000006ac0000413d0000032e040000410000000f0200002900000000030204330000031f023001970000031d003001980000031e030000410000000003006019000000000823019f000000000500001900000000070000190000000003080019000a00110000002d0011000c0000002d0000032e09000041000002cc0080009c000000000a080019000006b30000a13d000003200080009c000006b20000c13d0000036101000041000000000010043f0000001101000039000000040010043f000003540100004100000b1600010430000000000a8000890000033200a0009c000006c60000a13d000000120300002900000044013000390000035f02000041000000000021043500000024013000390000000102000039000000000021043500000360010000410000000000130435000000040130003900000020020000390000000000210435000002c80030009c000002c803008041000000400130021000000351011001c700000b16000104300000000100a00190000003340c000041000003330c006041000003350bc000d1000000800bb002700000000200a00190000000000c0bc019000003360bc000d1000000800bb002700000000400a00190000000000c0bc019000003370bc000d1000000800bb002700000000800a00190000000000c0bc019000003380bc000d1000000800bb002700000001000a00190000000000c0bc019000003390bc000d1000000800bb002700000002000a00190000000000c0bc0190000033a0bc000d1000000800bb002700000004000a00190000000000c0bc0190000033b0bc000d1000000800bb002700000008000a00190000000000c0bc0190000033c0bc000d1000000800bb002700000010000a00190000000000c0bc0190000033d0bc000d1000000800bb002700000020000a00190000000000c0bc0190000033e0bc000d1000000800bb002700000040000a00190000000000c0bc0190000033f0bc000d1000000800bb002700000080000a00190000000000c0bc019000003400bc000d1000000800bb002700000100000a00190000000000c0bc019000003410bc000d1000000800bb002700000200000a00190000000000c0bc019000003420bc000d1000000800bb002700000400000a00190000000000c0bc019000003430bc000d1000000800bb002700000800000a00190000000000c0bc019000003440bc000d1000000800bb002700000034500a00198000000000c0bc019000003460bc000d1000000800bb002700000034700a00198000000000c0bc019000003480bc000d1000000800bb002700000034900a00198000000000c0bc0190000034a00a001980000034b0ac000d1000000800ca0c27000100000000c001d000002cc0080009c0000071b0000213d000000000008004b0000071b0000613d000000010800008a00100010008001020000001008000029000002c8008001980000000008000039000000010800c039000400000008001d00000012080000290000034c0080009c000000b90000213d000000120a0000290000018008a00039000000400080043f0000031d009001980000031e080000410000000008006019000000000448019f0000010008a00039000900000008001d0000000000580435000000e005a00039000800000005001d0000000000650435000000c005a00039000700000005001d0000000000750435000000a005a00039000600000005001d00000000001504350000004005a00039000007d001000039000300000005001d00000000001504350000002005a000390000000a01000029000100000005001d0000000000150435000000110100002900000000001a04350000008001a00039000500000001001d00000000004104350000031d003001980000031e010000410000000001006019000000000121019f0000006002a00039000200000002001d00000000001204350000000b01000029000002ce011001970000012002a00039000f00000001001d000b00000002001d0000000000120435000003140100004100000000001004430000000001000414000002c80010009c000002c801008041000000c00110021000000315011001c70000800b020000390b140b0f0000040f000000010020019000000ac00000613d00000010020000290000002003200270000000000101043b0000001205000029000001400250003900000000001204350000000401300029000002ce01100197000001600350003900000000001304350000000101000039000000000101041a000000400600043d000400000006001d0000034d040000410000000004460436001000000004001d0000000004050433000002ce044001970000000405600039000000000045043500000001040000290000000004040433000002ce0440019700000024056000390000000000450435000000030400002900000000040404330000031f054001970000031d004001980000031e040000410000000004006019000000000454019f00000044056000390000000000450435000000020400002900000000040404330000031f054001970000031d004001980000031e040000410000000004006019000000000454019f00000064056000390000000000450435000000050400002900000000040404330000031f054001970000031d004001980000031e040000410000000004006019000000000454019f0000008405600039000000000045043500000006040000290000000004040433000000a405600039000000000045043500000007040000290000000004040433000000c405600039000000000045043500000008040000290000000004040433000000e405600039000000000045043500000009040000290000000004040433000001040560003900000000004504350000000b040000290000000004040433000002ce04400197000001240560003900000000004504350000000002020433000001440460003900000000002404350000000002030433000002ce0220019700000164036000390000000000230435000002c80060009c000002c802000041000000000206401900000040022002100000000003000414000002c80030009c000002c803008041000000c003300210000000000323019f000002ce021001970000034e013001c70b140b0a0000040f0000006003100270000002c803300197000000800030008c000000800400003900000000040340190000001f0640018f000000e007400190000000040b0000290000000405700029000007c80000613d000000000801034f00000000090b0019000000008a08043c0000000009a90436000000000059004b000007c40000c13d000000000006004b000007d50000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f00000000006504350000000100200190000008330000613d0000001f01400039000001e00110018f0000000002b10019000000000012004b00000000010000390000000101004039001200000002001d000002cb0020009c000000b90000213d0000000100100190000000b90000c13d0000001201000029000000400010043f000000800030008c000008310000413d000000100100002900000000010104330000034f0010009c000008310000213d00000000010b0433000b00000001001d0000000201000039000000000201041a00000012040000290000004401400039000007d003000039000000000031043500000024014000390000000a03000029000000000031043500000350010000410000000000140435000000040140003900000011030000290000000000310435000002c80040009c000002c801000041000000000104401900000040011002100000000003000414000002c80030009c000002c803008041000000c003300210000000000113019f00000351011001c7000002ce022001970b140b0f0000040f0000006003100270000002c803300197000000200030008c000000200400003900000000040340190000001f0640018f00000020074001900000001205700029000008150000613d000000000801034f0000001209000029000000008a08043c0000000009a90436000000000059004b000008110000c13d000000000006004b000008220000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f000000000065043500000001002001900000084b0000613d0000001f01400039000000600110018f0000001201100029000002cb0010009c000000b90000213d000000400010043f000000200030008c000008310000413d00000012010000290000000001010433001000000001001d000002ce0010009c000008650000a13d0000001301000029000009c70000013d0000001f0430018f0000000005100370000002ca06300198000000400100043d00000000026100190000083f0000613d000000000705034f0000000008010019000000007907043c0000000008980436000000000028004b0000083b0000c13d000000000004004b00000a2e0000613d000000000565034f0000000304400210000000000602043300000000064601cf000000000646022f000000000505043b0000010004400089000000000545022f00000000044501cf00000a2c0000013d0000001f0530018f000002ca06300198000000400200043d0000000004620019000008560000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b000008520000c13d000000000005004b000008630000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f0000000000140435000000600130021000000a0d0000013d0000000301000039000000000101041a00000328020000410000000000200443000002ce01100197000900000001001d00000004001004430000000001000414000002c80010009c000002c801008041000000c00110021000000329011001c700008002020000390b140b0f0000040f000000010020019000000ac00000613d000000000101043b000000000001004b000000440000613d000000400300043d00000044013000390000271002000039000000000021043500000024013000390000001102000029000000000021043500000352010000410000000000130435000000040130003900000010020000290000000000210435000002c80030009c001200000003001d000002c801000041000000000103401900000040011002100000000002000414000002c80020009c000002c802008041000000c002200210000000000112019f00000351011001c700000009020000290b140b0a0000040f0000000100200190000009cb0000613d0000001201000029000002cb0010009c000000b90000213d0000001201000029000000400010043f0000000301000039000000000101041a00000328020000410000000000200443000002ce01100197001100000001001d00000004001004430000000001000414000002c80010009c000002c801008041000000c00110021000000329011001c700008002020000390b140b0f0000040f000000010020019000000ac00000613d000000000101043b000000000001004b000000440000613d000000400300043d00000044013000390000271002000039000000000021043500000024013000390000000a02000029000000000021043500000352010000410000000000130435000000040130003900000010020000290000000000210435000002c80030009c001200000003001d000002c801000041000000000103401900000040011002100000000002000414000002c80020009c000002c802008041000000c002200210000000000112019f00000351011001c700000011020000290b140b0a0000040f0000000100200190000009d80000613d0000001201000029000002cb0010009c000000b90000213d0000001201000029000000400010043f0000000301000039000000000101041a00000328020000410000000000200443000002ce01100197001100000001001d00000004001004430000000001000414000002c80010009c000002c801008041000000c00110021000000329011001c700008002020000390b140b0f0000040f000000010020019000000ac00000613d000000000101043b000000000001004b000000440000613d000000400300043d00000353010000410000000001130436000a00000001001d000000040130003900000010020000290000000000210435000002c80030009c001200000003001d000002c801000041000000000103401900000040011002100000000002000414000002c80020009c000002c802008041000000c002200210000000000112019f00000354011001c700000011020000290b140b0a0000040f0000000100200190000009e50000613d0000001201000029000002cb0010009c000000b90000213d0000001201000029000000400010043f000002cd0010009c000000b90000213d0000000101000039000000000101041a0000000e0200002900000000020204330000000d03000029000000000303043300000012060000290000010004600039000000000500041a000000400040043f000000e004600039000d00000004001d0000000000340435000000c003600039000900000003001d0000000000230435000002ce011001970000008002600039000800000002001d000000000012043500000060026000390000000c01000029000600000002001d0000000000120435000002ce015001970000004002600039000500000002001d00000000001204350000000b010000290000000a02000029000000000012043500000010010000290000000000160435000000a0026000390000000001000410000700000002001d0000000000120435000003280100004100000000001004430000000f0100002900000004001004430000000001000414000002c80010009c000002c801008041000000c00110021000000329011001c700008002020000390b140b0f0000040f000000010020019000000ac00000613d000000000101043b000000000001004b000000440000613d000000400400043d0000035501000041000000000014043500000004024000390000002001000039000e00000002001d000000000012043500000012010000290000000001010433000002ce01100197000000240240003900000000001204350000000a0100002900000000010104330000004402400039000000000012043500000005010000290000000001010433000002ce011001970000006402400039000000000012043500000006010000290000000001010433000002ce011001970000008402400039000000000012043500000008010000290000000001010433000002ce01100197000000a402400039000000000012043500000007010000290000000001010433000002ce01100197000000c402400039000000000012043500000009010000290000000002010433000000e40140003900000100030000390000000000310435000001240140003900000000030204330000000000310435001100000004001d0000014401400039000000000003004b000009680000613d000000000400001900000020022000390000000005020433000002ce0550019700000000015104360000000104400039000000000034004b000009610000413d00000011040000290000000002410049000000240320008a0000000d0200002900000000020204330000010404400039000000000034043500000000030204330000000001310436000000000003004b0000097a0000613d00000000040000190000002002200039000000000502043300000000015104360000000104400039000000000034004b000009740000413d00000011030000290000000001310049000002c80010009c000002c80100804100000060011002100000000002000414000002c80020009c000002c802008041000000c002200210000000000121019f000002c80030009c000002c8020000410000000002034019001200400020021800000012011001af0000000f020000290b140b0a0000040f0000000100200190000009f20000613d0000001101000029000002cb0010009c000000b90000213d0000001102000029000000400020043f0000035601000041000000000012043500000000010004100000000e0200002900000000001204350000000001000414000002c80010009c000002c801008041000000c00110021000000012011001af00000354011001c70000000c020000290b140b0f0000040f0000006003100270000002c803300197000000200030008c000000200400003900000000040340190000001f0640018f00000020074001900000001105700029000009ae0000613d000000000801034f0000001109000029000000008a08043c0000000009a90436000000000059004b000009aa0000c13d000000000006004b000009bb0000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435001200130000002d000000010020019000000a120000613d0000001f01400039000000600110018f0000001101100029000002cb0010009c000000b90000213d000000400010043f000000200030008c00000a300000813d0000001201000029000002c80010009c000002c8010080410000035e011000d100000b160001043000000060061002700000001f0460018f000002ca05600198000000400200043d0000000003520019000009fe0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000038004b000009d30000c13d000009fe0000013d00000060061002700000001f0460018f000002ca05600198000000400200043d0000000003520019000009fe0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000038004b000009e00000c13d000009fe0000013d00000060061002700000001f0460018f000002ca05600198000000400200043d0000000003520019000009fe0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000038004b000009ed0000c13d000009fe0000013d00000060061002700000001f0460018f000002ca05600198000000400200043d0000000003520019000009fe0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000038004b000009fa0000c13d000002c806600197000000000004004b00000a0c0000613d000000000151034f0000000304400210000000000503043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001304350000006001600210000002c80020009c000002c8020080410000004002200210000000000112019f00000b16000104300000001202300029000000000032004b000000440000213d00000012041003600000001f0530018f000002ca06300198000000400100043d000000000261001900000a210000613d000000000704034f0000000008010019000000007907043c0000000008980436000000000028004b00000a1d0000c13d000000000005004b00000a2e0000613d000000000464034f0000000305500210000000000602043300000000065601cf000000000656022f000000000404043b0000010005500089000000000454022f00000000045401cf000000000464019f000000000042043500000060023002100000066a0000013d00000011020000290000000002020433000000000002004b00000a990000613d0000001203000029000000140030043f000000340020043f000003570100004100000000001304350000000001000414000002c80010009c000002c801008041000000c001100210000000000003004b00000a550000c13d00000359011001c70000000c020000290b140b0a0000040f001100000002001d0000006002100270000002c802200197000000200020008c000e00000002001d00000020020080390000001f0320018f000000200220019000000a510000613d000000000401034f0000000005000019000000004604043c0000000005650436000000000025004b00000a4d0000c13d000000000003004b00000a780000613d000000000121034f00000a6e0000013d00000358011001c7000080090200003900000012030000290000000c0400002900000000050000190b140b0a0000040f001100000002001d0000006002100270000002c802200197000000200020008c000e00000002001d00000020020080390000001f0320018f0000002004200190000000120240002900000a6b0000613d000000000501034f0000001206000029000000005705043c0000000006760436000000000026004b00000a670000c13d000000000003004b00000a780000613d000000000141034f0000000303300210000000000402043300000000043401cf000000000434022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000141019f00000000001204350000001101000029000000010010019000000a7f0000613d00000012010000290000000001010433000000010010008c00000a960000613d000003280100004100000000001004430000000c0100002900000004001004430000000001000414000002c80010009c000002c801008041000000c00110021000000329011001c700008002020000390b140b0f0000040f000000010020019000000ac00000613d000000010200008a000000110220014f000000000101043b000000000001004b000000000100003900000001010060390000000e001001b0000000010220c1bf000000010020019000000ac10000c13d0000001201000029000000340010043f000000400100043d00000020021000390000000f0300002900000000003204350000000b020000290000000000210435000002c80010009c000002c80100804100000040011002100000000002000414000002c80020009c000002c802008041000000c002200210000000000112019f0000035b011001c70000800d0200003900000003030000390000035c040000410000000c0500002900000010060000290b140b0a0000040f0000000100200190000000440000613d000000400100043d00000060021000390000000f03000029000000000032043500000040021000390000000b0300002900000000003204350000002002100039000000100300002900000000003204350000000c020000290000000000210435000002c80010009c000002c80100804100000040011002100000035d011001c700000b150001042e000000000001042f0000035a0100004100000012020000290000000000120435000003130100004100000b1600010430000002d501000041000000000101041a0000000002000411000000000012004b00000acc0000c13d000000000001042d0000036a01000041000000000010043f000003130100004100000b16000104300001000000000002000100000002001d000002d8020000410000000c0020043f000000000010043f0000000001000414000002c80010009c000002c801008041000000c001100210000002d9011001c700008010020000390b140b0f0000040f000000010020019000000af20000613d000000010200008a000000010220014f000000000101043b000000000301041a000000000623016f000000000061041b0000000c0100043d00000000020004140000006005100270000002c80020009c000002c802008041000000c001200210000002d6011001c70000800d020000390000000303000039000002da040000410b140b0a0000040f000000010020019000000af20000613d000000000001042d000000000100001900000b1600010430000000000001042f000002c80010009c000002c8010080410000004001100210000002c80020009c000002c8020080410000006002200210000000000112019f0000000002000414000002c80020009c000002c802008041000000c002200210000000000112019f000002d6011001c700008010020000390b140b0f0000040f000000010020019000000b080000613d000000000101043b000000000001042d000000000100001900000b160001043000000b0d002104210000000102000039000000000001042d0000000002000019000000000001042d00000b12002104230000000102000039000000000001042d0000000002000019000000000001042d00000b140000043200000b150001042e00000b160001043000000000000000000100018fe6f8527f967fe1b54a9ae0dcb5aac13dcebfeced7b67a2b41c303aaf0100017d0dff4e2c44ca54b5fce4e5c6349d3ff9513dfccdb37a616395ed0fd700000000000000000000000000000000000000000000000000000000ffffffff00000000000000000000000000000000000000000000000000000001ffffffe000000000000000000000000000000000000000000000000000000000ffffffe0000000000000000000000000000000000000000000000000ffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000fffffffffffffeff000000000000000000000000ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000021e19e0c9bab24000000000000000000000000000000000000000000001431e0fae6d7217caa0000000ffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000249f0fdb610ffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392702000000000000000000000000000000000000000000000000000000000000008be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0000000000000000000000000000000000000000000000000000000008b78c6d802000000000000000000000000000000000000200000000c0000000000000000715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26000000020000000000000000000000000000004000000100000000000000000007aa6e2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000064df049d0000000000000000000000000000000000000000000000000000000096daa32100000000000000000000000000000000000000000000000000000000eba08b2900000000000000000000000000000000000000000000000000000000f2fde38a00000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000fd5f309600000000000000000000000000000000000000000000000000000000fee81cf400000000000000000000000000000000000000000000000000000000eba08b2a00000000000000000000000000000000000000000000000000000000f04e283e00000000000000000000000000000000000000000000000000000000d1244ee800000000000000000000000000000000000000000000000000000000d1244ee900000000000000000000000000000000000000000000000000000000ea289d000000000000000000000000000000000000000000000000000000000096daa32200000000000000000000000000000000000000000000000000000000d0fb020300000000000000000000000000000000000000000000000000000000791b98bb000000000000000000000000000000000000000000000000000000008456cb58000000000000000000000000000000000000000000000000000000008456cb59000000000000000000000000000000000000000000000000000000008da5cb5b000000000000000000000000000000000000000000000000000000008dc2c1f600000000000000000000000000000000000000000000000000000000791b98bc0000000000000000000000000000000000000000000000000000000079db63460000000000000000000000000000000000000000000000000000000072fcfbf70000000000000000000000000000000000000000000000000000000072fcfbf80000000000000000000000000000000000000000000000000000000073b6f36b0000000000000000000000000000000000000000000000000000000064df049e00000000000000000000000000000000000000000000000000000000715018a6000000000000000000000000000000000000000000000000000000003f4ba83900000000000000000000000000000000000000000000000000000000514e62fb000000000000000000000000000000000000000000000000000000005760f2e2000000000000000000000000000000000000000000000000000000005760f2e3000000000000000000000000000000000000000000000000000000005c975abb000000000000000000000000000000000000000000000000000000005f72364000000000000000000000000000000000000000000000000000000000514e62fc0000000000000000000000000000000000000000000000000000000054d1f13d00000000000000000000000000000000000000000000000000000000472d35b800000000000000000000000000000000000000000000000000000000472d35b9000000000000000000000000000000000000000000000000000000004a4ee7b1000000000000000000000000000000000000000000000000000000003f4ba83a00000000000000000000000000000000000000000000000000000000471d42450000000000000000000000000000000000000000000000000000000025692961000000000000000000000000000000000000000000000000000000002de94806000000000000000000000000000000000000000000000000000000002de94807000000000000000000000000000000000000000000000000000000002e53c5590000000000000000000000000000000000000000000000000000000025692962000000000000000000000000000000000000000000000000000000002ab4d052000000000000000000000000000000000000000000000000000000001cd64df3000000000000000000000000000000000000000000000000000000001cd64df4000000000000000000000000000000000000000000000000000000001db3b6dd00000000000000000000000000000000000000000000000000000000183a4f6e000000000000000000000000000000000000000000000000000000001c10893f00000000000000000000000000000000000000000000000000000000389a75e10000000000000000000000000000000000000020000000800000000000000000000000000000000000000000000000000000000000000000000000007448fbae00000000000000000000000000000000000000040000001c0000000000000000796b89b91644bc98cd93958e4c9038275d622183e25ac5af08cc6b5d955391320200000200000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000006f5e88180000000000000000000000000000000000c097ce7bc90715b34b9f100000000000000000000000000000000000000000000000000000000000000000000f4240ffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffff0000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000ffffffffffffff7f000000000000000000000000000000000000000000000000ffffffffffffff5f0000000000000000000000000000000000000000000000000000000000800000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000000000000000000000000000000000000000000000000000000000007fffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff0000000000003804a72a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000ffffffffffffff7b3cda33511d41a8a5431b1770c5bc0ddd62e1cd30555d16659b89c0d60f4f9f5702000000000000000000000000000000000000840000000000000000000000009c4d535bdea7cd8a978f128b93471df48c7dbab89d703809115bdc118c235bfd1806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b830200000200000000000000000000000000000024000000000000000000000000b119490e00000000000000000000000000000000000000000000000000000000095ea7b30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000000000000000000000005f5e0ff00000000000000000000000000000000000000000000000000000000000d84f00000000000000000000000000000000000000000000000000000000005f5e100fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff27b100000000000000000000000000000000000000000000000000000000000727b1000000000000000000000000000000000000000000000000000000000000d89e8000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000fffcb933bd6fad37aa2d162d1a59400100000000000000000000000000000000fff97272373d413259a46990580e213a00000000000000000000000000000000fff2e50f5f656932ef12357cf3c7fdcc00000000000000000000000000000000ffe5caca7e10e4e61c3624eaa0941cd000000000000000000000000000000000ffcb9843d60f6159c9db58835c92664400000000000000000000000000000000ff973b41fa98c081472e6896dfb254c000000000000000000000000000000000ff2ea16466c96a3843ec78b326b5286100000000000000000000000000000000fe5dee046a99a2a811c461f1969c305300000000000000000000000000000000fcbe86c7900a88aedcffc83b479aa3a400000000000000000000000000000000f987a7253ac413176f2b074cf7815e5400000000000000000000000000000000f3392b0822b70005940c7a398e4b70f300000000000000000000000000000000e7159475a2c29b7443b29c7fa6e889d900000000000000000000000000000000d097f3bdfd2022b8845ad8f792aa582500000000000000000000000000000000a9f746462d870fdf8a65dc1f90e061e50000000000000000000000000000000070d869a156d2a1b890bb3df62baf32f70000000000000000000000000000000031be135f97d08fd981231505542fcfa60000000000000000000000000000000009aa508b5b7a84e1c677de54f3e99bc9000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000005d6af8dedb81196699c329225ee60400000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000002216e584f5fa1ea926041bedfe98000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000048a170391f7dc42444e8fa2000000000000000000000000000000000000000000000000fffffffffffffe7fb5007d1f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018400000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffff28af8d0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000981007250000000000000000000000000000000000000000000000000000000067ee6ed6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000be496e170000000000000000000000000000000000000000000000000000000070a082310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a9059cbb000000000000000000000000020000000000000000000000000000000000004400000010000000000000000000000000000000000000000000000000000000440000001000000000000000000000000000000000000000000000000000000000000000000000000090b8ec180200000000000000000000000000000000000040000000000000000000000000d8bafc41c4f594bfd5eb92ec994539df40807a4822f3335267ce029b13cee68e00000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000010000000000000000540000000000000000000000000000000000000000000000000000000000000008c379a0000000000000000000000000000000000000000000000000000000004e487b71000000000000000000000000000000000000000000000000000000009bfb0bc3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff0000000000000000000000000000000000000000000000000000ffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000fa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c920000000000000000000000000000000000000004000000800000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd5d00dbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d0000000000000000000000000000000000000000000000000000000082b42900ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03fb19b40328b0c0ba3c72c5e1ce512e69adaa875bf0ab0dacb2b3f8fe51ad96f
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000f6e27007e257e74c86522387bd071d561ba3c970000000000000000000000007d2fde5a4311ec68c4064ca34d4b24367b3fdd6400000000000000000000000055a853462862d54ef6fce380ce83dfd60494cf7a000000000000000000000000000000000000000000000000000000000000138800000000000000000000000099e463e5583a3b025ea62afb4c89649a77237f4900000000000000000000000099e463e5583a3b025ea62afb4c89649a77237f490000000000000000000000000000000000000000000000000000000000000100000000000000000000000000cc058f7d30912acd4cf04821a85a921e4c2562710000000000000000000000000000000000000000000000000000000000000004000000000000000000000000beb15caee71001d82f430e4deda80e16ddf438db000000000000000000000000f29da3595351dbfd0d647857c46f8d63fc2e68c5000000000000000000000000ccb4f4b05739b6c62d9663a5fa7f1e26930480190000000000000000000000008a1771672765fb340ba4fef7e6fc6c5e29ac6e3e
-----Decoded View---------------
Arg [0] : _params (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 0000000000000000000000000f6e27007e257e74c86522387bd071d561ba3c97
Arg [2] : 0000000000000000000000007d2fde5a4311ec68c4064ca34d4b24367b3fdd64
Arg [3] : 00000000000000000000000055a853462862d54ef6fce380ce83dfd60494cf7a
Arg [4] : 0000000000000000000000000000000000000000000000000000000000001388
Arg [5] : 00000000000000000000000099e463e5583a3b025ea62afb4c89649a77237f49
Arg [6] : 00000000000000000000000099e463e5583a3b025ea62afb4c89649a77237f49
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [8] : 000000000000000000000000cc058f7d30912acd4cf04821a85a921e4c256271
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [10] : 000000000000000000000000beb15caee71001d82f430e4deda80e16ddf438db
Arg [11] : 000000000000000000000000f29da3595351dbfd0d647857c46f8d63fc2e68c5
Arg [12] : 000000000000000000000000ccb4f4b05739b6c62d9663a5fa7f1e2693048019
Arg [13] : 0000000000000000000000008a1771672765fb340ba4fef7e6fc6c5e29ac6e3e
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.