Overview
APE Balance
0 APE
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x61071061 | 4603178 | 10 hrs ago | IN | 0 APE | 0.011282 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PackingUtils
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 800 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * @dev External library used to pack and unpack values */ library PackingUtils { /** * @dev Packs values array into a single uint256 * @param _values values to pack * @param _bitLengths corresponding bit lengths for each value */ function pack(uint256[] memory _values, uint256[] memory _bitLengths) external pure returns (uint256 packed) { require(_values.length == _bitLengths.length, "Mismatch in the lengths of values and bitLengths arrays"); uint256 currentShift; for (uint256 i; i < _values.length; ++i) { require(currentShift + _bitLengths[i] <= 256, "Packed value exceeds 256 bits"); uint256 maxValue = (1 << _bitLengths[i]) - 1; require(_values[i] <= maxValue, "Value too large for specified bit length"); uint256 maskedValue = _values[i] & maxValue; packed |= maskedValue << currentShift; currentShift += _bitLengths[i]; } } /** * @dev Unpacks a single uint256 into an array of values * @param _packed packed value * @param _bitLengths corresponding bit lengths for each value */ function unpack(uint256 _packed, uint256[] memory _bitLengths) external pure returns (uint256[] memory values) { values = new uint256[](_bitLengths.length); uint256 currentShift; for (uint256 i; i < _bitLengths.length; ++i) { require(currentShift + _bitLengths[i] <= 256, "Unpacked value exceeds 256 bits"); uint256 maxValue = (1 << _bitLengths[i]) - 1; uint256 mask = maxValue << currentShift; values[i] = (_packed & mask) >> currentShift; currentShift += _bitLengths[i]; } } /** * @dev Unpacks a single uint256 into 4 uint64 values * @param _packed packed value * @return a returned value 1 * @return b returned value 2 * @return c returned value 3 * @return d returned value 4 */ function unpack256To64(uint256 _packed) external pure returns (uint64 a, uint64 b, uint64 c, uint64 d) { a = uint64(_packed); b = uint64(_packed >> 64); c = uint64(_packed >> 128); d = uint64(_packed >> 192); } /** * @dev Unpacks trigger order calldata into 3 values * @param _packed packed value * @return orderType order type * @return trader trader address * @return index trade index */ function unpackTriggerOrder(uint256 _packed) external pure returns (uint8 orderType, address trader, uint32 index) { orderType = uint8(_packed & 0xFF); // 8 bits trader = address(uint160(_packed >> 8)); // 160 bits index = uint32((_packed >> 168)); // 32 bits } }
{ "optimizer": { "enabled": true, "runs": 800 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"uint256[]","name":"_bitLengths","type":"uint256[]"}],"name":"pack","outputs":[{"internalType":"uint256","name":"packed","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_packed","type":"uint256"},{"internalType":"uint256[]","name":"_bitLengths","type":"uint256[]"}],"name":"unpack","outputs":[{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_packed","type":"uint256"}],"name":"unpack256To64","outputs":[{"internalType":"uint64","name":"a","type":"uint64"},{"internalType":"uint64","name":"b","type":"uint64"},{"internalType":"uint64","name":"c","type":"uint64"},{"internalType":"uint64","name":"d","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_packed","type":"uint256"}],"name":"unpackTriggerOrder","outputs":[{"internalType":"uint8","name":"orderType","type":"uint8"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"uint32","name":"index","type":"uint32"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
61071061003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80635e1f97581461005b5780639043477b14610084578063acc482d2146100dd578063c6bc0c3a146100fe575b600080fd5b61006e610069366004610584565b610155565b60405161007b91906105cb565b60405180910390f35b6100a361009236600461060f565b60ff811691600882901c9160a81c90565b6040805160ff909416845273ffffffffffffffffffffffffffffffffffffffff909216602084015263ffffffff169082015260600161007b565b6100f06100eb366004610628565b6102bb565b60405190815260200161007b565b61012161010c36600461060f565b90604082901c90608083901c9060c084901c90565b6040805167ffffffffffffffff9586168152938516602085015291841691830191909152909116606082015260800161007b565b6060815167ffffffffffffffff811115610171576101716104d0565b60405190808252806020026020018201604052801561019a578160200160208202803683370190505b5090506000805b83518110156102b3576101008482815181106101bf576101bf610682565b6020026020010151836101d291906106ae565b11156102255760405162461bcd60e51b815260206004820152601f60248201527f556e7061636b65642076616c756520657863656564732032353620626974730060448201526064015b60405180910390fd5b6000600185838151811061023b5761023b610682565b60200260200101516001901b61025191906106c7565b905060008382901b905083818816901c85848151811061027357610273610682565b60200260200101818152505085838151811061029157610291610682565b6020026020010151846102a491906106ae565b935050508060010190506101a1565b505092915050565b600081518351146103345760405162461bcd60e51b815260206004820152603760248201527f4d69736d6174636820696e20746865206c656e67746873206f662076616c756560448201527f7320616e64206269744c656e6774687320617272617973000000000000000000606482015260840161021c565b6000805b84518110156102b35761010084828151811061035657610356610682565b60200260200101518361036991906106ae565b11156103b75760405162461bcd60e51b815260206004820152601d60248201527f5061636b65642076616c75652065786365656473203235362062697473000000604482015260640161021c565b600060018583815181106103cd576103cd610682565b60200260200101516001901b6103e391906106c7565b9050808683815181106103f8576103f8610682565b602002602001015111156104745760405162461bcd60e51b815260206004820152602860248201527f56616c756520746f6f206c6172676520666f722073706563696669656420626960448201527f74206c656e677468000000000000000000000000000000000000000000000000606482015260840161021c565b60008187848151811061048957610489610682565b60200260200101511690508381901b851794508583815181106104ae576104ae610682565b6020026020010151846104c191906106ae565b93505050806001019050610338565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126104f757600080fd5b8135602067ffffffffffffffff80831115610514576105146104d0565b8260051b604051601f19603f83011681018181108482111715610539576105396104d0565b604052938452602081870181019490810192508785111561055957600080fd5b6020870191505b8482101561057957813583529183019190830190610560565b979650505050505050565b6000806040838503121561059757600080fd5b82359150602083013567ffffffffffffffff8111156105b557600080fd5b6105c1858286016104e6565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015610603578351835292840192918401916001016105e7565b50909695505050505050565b60006020828403121561062157600080fd5b5035919050565b6000806040838503121561063b57600080fd5b823567ffffffffffffffff8082111561065357600080fd5b61065f868387016104e6565b9350602085013591508082111561067557600080fd5b506105c1858286016104e6565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156106c1576106c1610698565b92915050565b818103818111156106c1576106c161069856fea2646970667358221220d165bcf65cff8437f738f5c134857bf662b279c787eba54b58a97c8136ab6d3564736f6c63430008170033
Deployed Bytecode
0x735b0793dc3acf1bcc09954262c479d2bb90e394f830146080604052600436106100565760003560e01c80635e1f97581461005b5780639043477b14610084578063acc482d2146100dd578063c6bc0c3a146100fe575b600080fd5b61006e610069366004610584565b610155565b60405161007b91906105cb565b60405180910390f35b6100a361009236600461060f565b60ff811691600882901c9160a81c90565b6040805160ff909416845273ffffffffffffffffffffffffffffffffffffffff909216602084015263ffffffff169082015260600161007b565b6100f06100eb366004610628565b6102bb565b60405190815260200161007b565b61012161010c36600461060f565b90604082901c90608083901c9060c084901c90565b6040805167ffffffffffffffff9586168152938516602085015291841691830191909152909116606082015260800161007b565b6060815167ffffffffffffffff811115610171576101716104d0565b60405190808252806020026020018201604052801561019a578160200160208202803683370190505b5090506000805b83518110156102b3576101008482815181106101bf576101bf610682565b6020026020010151836101d291906106ae565b11156102255760405162461bcd60e51b815260206004820152601f60248201527f556e7061636b65642076616c756520657863656564732032353620626974730060448201526064015b60405180910390fd5b6000600185838151811061023b5761023b610682565b60200260200101516001901b61025191906106c7565b905060008382901b905083818816901c85848151811061027357610273610682565b60200260200101818152505085838151811061029157610291610682565b6020026020010151846102a491906106ae565b935050508060010190506101a1565b505092915050565b600081518351146103345760405162461bcd60e51b815260206004820152603760248201527f4d69736d6174636820696e20746865206c656e67746873206f662076616c756560448201527f7320616e64206269744c656e6774687320617272617973000000000000000000606482015260840161021c565b6000805b84518110156102b35761010084828151811061035657610356610682565b60200260200101518361036991906106ae565b11156103b75760405162461bcd60e51b815260206004820152601d60248201527f5061636b65642076616c75652065786365656473203235362062697473000000604482015260640161021c565b600060018583815181106103cd576103cd610682565b60200260200101516001901b6103e391906106c7565b9050808683815181106103f8576103f8610682565b602002602001015111156104745760405162461bcd60e51b815260206004820152602860248201527f56616c756520746f6f206c6172676520666f722073706563696669656420626960448201527f74206c656e677468000000000000000000000000000000000000000000000000606482015260840161021c565b60008187848151811061048957610489610682565b60200260200101511690508381901b851794508583815181106104ae576104ae610682565b6020026020010151846104c191906106ae565b93505050806001019050610338565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126104f757600080fd5b8135602067ffffffffffffffff80831115610514576105146104d0565b8260051b604051601f19603f83011681018181108482111715610539576105396104d0565b604052938452602081870181019490810192508785111561055957600080fd5b6020870191505b8482101561057957813583529183019190830190610560565b979650505050505050565b6000806040838503121561059757600080fd5b82359150602083013567ffffffffffffffff8111156105b557600080fd5b6105c1858286016104e6565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015610603578351835292840192918401916001016105e7565b50909695505050505050565b60006020828403121561062157600080fd5b5035919050565b6000806040838503121561063b57600080fd5b823567ffffffffffffffff8082111561065357600080fd5b61065f868387016104e6565b9350602085013591508082111561067557600080fd5b506105c1858286016104e6565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156106c1576106c1610698565b92915050565b818103818111156106c1576106c161069856fea2646970667358221220d165bcf65cff8437f738f5c134857bf662b279c787eba54b58a97c8136ab6d3564736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.