Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x6106be61 | 15890760 | 734 days ago | IN | 0 ETH | 0.01244668 |
Loading...
Loading
Contract Name:
JBIpfsDecoder
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; /** @notice Utilities to decode an IPFS hash. @dev This is fairly gas intensive, due to multiple nested loops, onchain IPFS hash decoding is therefore not advised (storing them as a string, in that use-case, *might* be more efficient). */ library JBIpfsDecoder { //*********************************************************************// // ------------------- internal constant properties ------------------ // //*********************************************************************// /** @notice Just a kind reminder to our readers @dev Used in base58ToString */ bytes internal constant _ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; function decode(string memory _baseUri, bytes32 _hexString) external pure returns (string memory) { // Concatenate the hex string with the fixed IPFS hash part (0x12 and 0x20) bytes memory completeHexString = abi.encodePacked(bytes2(0x1220), _hexString); // Convert the hex string to a hash string memory ipfsHash = _toBase58(completeHexString); // Concatenate with the base URI return string(abi.encodePacked(_baseUri, ipfsHash)); } /** @notice Convert a hex string to base58 @notice Written by Martin Ludfall - Licence: MIT */ function _toBase58(bytes memory _source) private pure returns (string memory) { if (_source.length == 0) return new string(0); uint8[] memory digits = new uint8[](46); // hash size with the prefix digits[0] = 0; uint8 digitlength = 1; uint256 _sourceLength = _source.length; for (uint256 i; i < _sourceLength; ) { uint256 carry = uint8(_source[i]); for (uint256 j; j < digitlength; ) { carry += uint256(digits[j]) << 8; // mul 256 digits[j] = uint8(carry % 58); carry = carry / 58; unchecked { ++j; } } while (carry > 0) { digits[digitlength] = uint8(carry % 58); unchecked { ++digitlength; } carry = carry / 58; } unchecked { ++i; } } return string(_toAlphabet(_reverse(_truncate(digits, digitlength)))); } function _truncate(uint8[] memory _array, uint8 _length) private pure returns (uint8[] memory) { uint8[] memory output = new uint8[](_length); for (uint256 i; i < _length; ) { output[i] = _array[i]; unchecked { ++i; } } return output; } function _reverse(uint8[] memory _input) private pure returns (uint8[] memory) { uint256 _inputLength = _input.length; uint8[] memory output = new uint8[](_inputLength); for (uint256 i; i < _inputLength; ) { unchecked { output[i] = _input[_input.length - 1 - i]; ++i; } } return output; } function _toAlphabet(uint8[] memory _indices) private pure returns (bytes memory) { uint256 _indicesLength = _indices.length; bytes memory output = new bytes(_indicesLength); for (uint256 i; i < _indicesLength; ) { output[i] = _ALPHABET[_indices[i]]; unchecked { ++i; } } return output; } }
{ "remappings": [ "@jbx-protocol/=node_modules/@jbx-protocol/", "@openzeppelin/=node_modules/@openzeppelin/", "@paulrberg/=node_modules/@paulrberg/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "prb-math/=node_modules/prb-math/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_baseUri","type":"string"},{"internalType":"bytes32","name":"_hexString","type":"bytes32"}],"name":"decode","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
6106be61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c8063030cecc71461003a575b600080fd5b61004d61004836600461049e565b610063565b60405161005a9190610577565b60405180910390f35b604051609160f51b6020820152602281018290526060906000906042016040516020818303038152906040529050600061009c826100cb565b905084816040516020016100b19291906105aa565b604051602081830303815290604052925050505b92915050565b606081516000036100ea57505060408051600081526020810190915290565b60408051602e8082526105e08201909252600091602082016105c080368337019050509050600081600081518110610124576101246105d9565b60ff90921660209283029190910190910152825160019060005b8181101561023f57600086828151811061015a5761015a6105d9565b016020015160f81c905060005b8460ff168110156101e4576008868281518110610186576101866105d9565b602002602001015160ff16901b8261019e91906105ef565b91506101ab603a83610626565b8682815181106101bd576101bd6105d9565b60ff909216602092830291909101909101526101da603a8361063a565b9150600101610167565b505b8015610236576101f7603a82610626565b858560ff168151811061020c5761020c6105d9565b60ff9092166020928302919091019091015260019093019261022f603a8261063a565b90506101e6565b5060010161013e565b5061025a6102556102508585610263565b61030b565b6103ae565b95945050505050565b606060008260ff1667ffffffffffffffff81111561028357610283610488565b6040519080825280602002602001820160405280156102ac578160200160208202803683370190505b50905060005b8360ff16811015610303578481815181106102cf576102cf6105d9565b60200260200101518282815181106102e9576102e96105d9565b60ff909216602092830291909101909101526001016102b2565b509392505050565b805160609060008167ffffffffffffffff81111561032b5761032b610488565b604051908082528060200260200182016040528015610354578160200160208202803683370190505b50905060005b828110156103035784816001875103038151811061037a5761037a6105d9565b6020026020010151828281518110610394576103946105d9565b60ff9092166020928302919091019091015260010161035a565b805160609060008167ffffffffffffffff8111156103ce576103ce610488565b6040519080825280601f01601f1916602001820160405280156103f8576020820181803683370190505b50905060005b82811015610303576040518060600160405280603a815260200161064f603a9139858281518110610431576104316105d9565b602002602001015160ff168151811061044c5761044c6105d9565b602001015160f81c60f81b828281518110610469576104696105d9565b60200101906001600160f81b031916908160001a9053506001016103fe565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156104b157600080fd5b823567ffffffffffffffff808211156104c957600080fd5b818501915085601f8301126104dd57600080fd5b8135818111156104ef576104ef610488565b604051601f8201601f19908116603f0116810190838211818310171561051757610517610488565b8160405282815288602084870101111561053057600080fd5b826020860160208301376000602093820184015298969091013596505050505050565b60005b8381101561056e578181015183820152602001610556565b50506000910152565b6020815260008251806020840152610596816040850160208701610553565b601f01601f19169190910160400192915050565b600083516105bc818460208801610553565b8351908301906105d0818360208801610553565b01949350505050565b634e487b7160e01b600052603260045260246000fd5b808201808211156100c557634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60008261063557610635610610565b500690565b60008261064957610649610610565b50049056fe31323334353637383941424344454647484a4b4c4d4e505152535455565758595a6162636465666768696a6b6d6e6f707172737475767778797aa2646970667358221220cd11c0e434fb65a7219f240903d8e7707ca4e0da76779db56aede144a1d6e8ff64736f6c63430008100033
Deployed Bytecode
0x7387e9dae24682d79b6451932146dec60b5ec88c1b30146080604052600436106100355760003560e01c8063030cecc71461003a575b600080fd5b61004d61004836600461049e565b610063565b60405161005a9190610577565b60405180910390f35b604051609160f51b6020820152602281018290526060906000906042016040516020818303038152906040529050600061009c826100cb565b905084816040516020016100b19291906105aa565b604051602081830303815290604052925050505b92915050565b606081516000036100ea57505060408051600081526020810190915290565b60408051602e8082526105e08201909252600091602082016105c080368337019050509050600081600081518110610124576101246105d9565b60ff90921660209283029190910190910152825160019060005b8181101561023f57600086828151811061015a5761015a6105d9565b016020015160f81c905060005b8460ff168110156101e4576008868281518110610186576101866105d9565b602002602001015160ff16901b8261019e91906105ef565b91506101ab603a83610626565b8682815181106101bd576101bd6105d9565b60ff909216602092830291909101909101526101da603a8361063a565b9150600101610167565b505b8015610236576101f7603a82610626565b858560ff168151811061020c5761020c6105d9565b60ff9092166020928302919091019091015260019093019261022f603a8261063a565b90506101e6565b5060010161013e565b5061025a6102556102508585610263565b61030b565b6103ae565b95945050505050565b606060008260ff1667ffffffffffffffff81111561028357610283610488565b6040519080825280602002602001820160405280156102ac578160200160208202803683370190505b50905060005b8360ff16811015610303578481815181106102cf576102cf6105d9565b60200260200101518282815181106102e9576102e96105d9565b60ff909216602092830291909101909101526001016102b2565b509392505050565b805160609060008167ffffffffffffffff81111561032b5761032b610488565b604051908082528060200260200182016040528015610354578160200160208202803683370190505b50905060005b828110156103035784816001875103038151811061037a5761037a6105d9565b6020026020010151828281518110610394576103946105d9565b60ff9092166020928302919091019091015260010161035a565b805160609060008167ffffffffffffffff8111156103ce576103ce610488565b6040519080825280601f01601f1916602001820160405280156103f8576020820181803683370190505b50905060005b82811015610303576040518060600160405280603a815260200161064f603a9139858281518110610431576104316105d9565b602002602001015160ff168151811061044c5761044c6105d9565b602001015160f81c60f81b828281518110610469576104696105d9565b60200101906001600160f81b031916908160001a9053506001016103fe565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156104b157600080fd5b823567ffffffffffffffff808211156104c957600080fd5b818501915085601f8301126104dd57600080fd5b8135818111156104ef576104ef610488565b604051601f8201601f19908116603f0116810190838211818310171561051757610517610488565b8160405282815288602084870101111561053057600080fd5b826020860160208301376000602093820184015298969091013596505050505050565b60005b8381101561056e578181015183820152602001610556565b50506000910152565b6020815260008251806020840152610596816040850160208701610553565b601f01601f19169190910160400192915050565b600083516105bc818460208801610553565b8351908301906105d0818360208801610553565b01949350505050565b634e487b7160e01b600052603260045260246000fd5b808201808211156100c557634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60008261063557610635610610565b500690565b60008261064957610649610610565b50049056fe31323334353637383941424344454647484a4b4c4d4e505152535455565758595a6162636465666768696a6b6d6e6f707172737475767778797aa2646970667358221220cd11c0e434fb65a7219f240903d8e7707ca4e0da76779db56aede144a1d6e8ff64736f6c63430008100033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.