ETH Price: $2,283.60 (+2.29%)

Contract

0xdE22f3a62b3cFF575F20614F33c0C65AdCB94702
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x6103d261147673612022-05-13 12:24:39848 days ago1652444679IN
 Create: IPFSConvert
0 ETH0.0101907538.5

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
IPFSConvert

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, BSL 1.1 license
/**
 *Submitted for verification at Etherscan.io on 2022-05-13
*/

// contracts/IPFSConvert.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.4;

/// @title Hightable IPFSConvert Library
/// @author Teahouse Finance
library IPFSConvert {

    bytes constant private CODE_STRING = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
    bytes constant private CIDV0HEAD = "\x00\x04\x28\x0b\x12\x17\x09\x28\x31\x00\x12\x04\x28\x20\x25\x25\x22\x31\x1b\x1d\x39\x29\x09\x26\x1b\x29\x0b\x02\x0a\x18\x25\x22\x24\x1b\x39\x2c\x1d\x39\x07\x06\x29\x25\x13\x15\x2c\x17";

    /**
     * @dev This function converts an 256 bits hash value into IPFS CIDv0 hash string.
     * @param _cidv0 256 bits hash value (not including the 0x12 0x20 signature)
     * @return IPFS CIDv0 hash string (Qm...)
     */
    function cidv0FromBytes32(bytes32 _cidv0) public pure returns (string memory) {
        unchecked {
            // convert to base58
            bytes memory result = new bytes(46);        // 46 is the longest possible base58 result from CIDv0
            uint256 resultLen = 45;
            uint256 number = uint256(_cidv0);
            while(number > 0) {
                uint256 rem = number % 58;
                result[resultLen] = bytes1(uint8(rem));
                resultLen--;
                number = number / 58;
            }

            // add 0x1220 in front of _cidv0
            uint256 i;
            for (i = 0; i < 46; i++) {
                uint8 r = uint8(result[45 - i]) + uint8(CIDV0HEAD[i]);
                if (r >= 58) {
                    result[45 - i] = bytes1(r - 58);
                    result[45 - i - 1] = bytes1(uint8(result[45 - i - 1]) + 1);
                }
                else {
                    result[45 - i] = bytes1(r);
                }
            }

            // convert to characters
            for (i = 0; i < 46; i++) {
                result[i] = CODE_STRING[uint8(result[i])];
            }

            return string(result);
        }
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"bytes32","name":"_cidv0","type":"bytes32"}],"name":"cidv0FromBytes32","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]

6103d261003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c80638614c2c31461003a575b600080fd5b61004d6100483660046102b0565b610063565b60405161005a91906102c9565b60405180910390f35b60408051602e808252606082810190935260009190602082018180368337019050509050602d835b80156100d8576000603a820690508060f81b8484815181106100af576100af61031e565b60200101906001600160f81b031916908160001a905350506000199190910190603a900461008b565b60005b602e8110156102165760006040518060600160405280602e8152602001610335602e913982815181106101105761011061031e565b602001015160f81c60f81b60f81c8583602d03815181106101335761013361031e565b016020015160f81c019050603a60ff8216106101dc57603a810360f81b8583602d03815181106101655761016561031e565b60200101906001600160f81b031916908160001a90535084600183602d0303815181106101945761019461031e565b602001015160f81c60f81b60f81c60010160f81b85600184602d0303815181106101c0576101c061031e565b60200101906001600160f81b031916908160001a90535061020d565b8060f81b8583602d03815181106101f5576101f561031e565b60200101906001600160f81b031916908160001a9053505b506001016100db565b5060005b602e8110156102a6576040518060600160405280603a8152602001610363603a913984828151811061024e5761024e61031e565b0160200151815160f89190911c90811061026a5761026a61031e565b602001015160f81c60f81b8482815181106102875761028761031e565b60200101906001600160f81b031916908160001a90535060010161021a565b5091949350505050565b6000602082840312156102c257600080fd5b5035919050565b600060208083528351808285015260005b818110156102f6578581018301518582016040015282016102da565b81811115610308576000604083870101525b50601f01601f1916929092016040019392505050565b634e487b7160e01b600052603260045260246000fdfe0004280b12170928310012042820252522311b1d392909261b290b020a182522241b392c1d390706292513152c1731323334353637383941424344454647484a4b4c4d4e505152535455565758595a6162636465666768696a6b6d6e6f707172737475767778797aa264697066735822122044c00a41b0be338aa17311e2cd5dc0b66ab483830f0cf49cc77e44e44194509764736f6c634300080d0033

Deployed Bytecode

0x73de22f3a62b3cff575f20614f33c0c65adcb9470230146080604052600436106100355760003560e01c80638614c2c31461003a575b600080fd5b61004d6100483660046102b0565b610063565b60405161005a91906102c9565b60405180910390f35b60408051602e808252606082810190935260009190602082018180368337019050509050602d835b80156100d8576000603a820690508060f81b8484815181106100af576100af61031e565b60200101906001600160f81b031916908160001a905350506000199190910190603a900461008b565b60005b602e8110156102165760006040518060600160405280602e8152602001610335602e913982815181106101105761011061031e565b602001015160f81c60f81b60f81c8583602d03815181106101335761013361031e565b016020015160f81c019050603a60ff8216106101dc57603a810360f81b8583602d03815181106101655761016561031e565b60200101906001600160f81b031916908160001a90535084600183602d0303815181106101945761019461031e565b602001015160f81c60f81b60f81c60010160f81b85600184602d0303815181106101c0576101c061031e565b60200101906001600160f81b031916908160001a90535061020d565b8060f81b8583602d03815181106101f5576101f561031e565b60200101906001600160f81b031916908160001a9053505b506001016100db565b5060005b602e8110156102a6576040518060600160405280603a8152602001610363603a913984828151811061024e5761024e61031e565b0160200151815160f89190911c90811061026a5761026a61031e565b602001015160f81c60f81b8482815181106102875761028761031e565b60200101906001600160f81b031916908160001a90535060010161021a565b5091949350505050565b6000602082840312156102c257600080fd5b5035919050565b600060208083528351808285015260005b818110156102f6578581018301518582016040015282016102da565b81811115610308576000604083870101525b50601f01601f1916929092016040019392505050565b634e487b7160e01b600052603260045260246000fdfe0004280b12170928310012042820252522311b1d392909261b290b020a182522241b392c1d390706292513152c1731323334353637383941424344454647484a4b4c4d4e505152535455565758595a6162636465666768696a6b6d6e6f707172737475767778797aa264697066735822122044c00a41b0be338aa17311e2cd5dc0b66ab483830f0cf49cc77e44e44194509764736f6c634300080d0033

Deployed Bytecode Sourcemap

169:1837:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;767:1236;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;937:13;;;947:2;937:13;;;830;937;;;;;;915:19;;937:13;;;;;;;;;;;-1:-1:-1;;915:35:0;-1:-1:-1;1047:2:0;1089:6;1111:204;1117:10;;1111:204;;1148:11;1171:2;1162:6;:11;1148:25;;1225:3;1212:18;;1192:6;1199:9;1192:17;;;;;;;;:::i;:::-;;;;:38;-1:-1:-1;;;;;1192:38:0;;;;;;;;-1:-1:-1;;;;1249:11:0;;;;;1297:2;1288:11;;1111:204;;;1377:9;1401:391;1417:2;1413:1;:6;1401:391;;;1445:7;1485:9;;;;;;;;;;;;;;;;;1495:1;1485:12;;;;;;;;:::i;:::-;;;;;;;;;1479:19;;1461:6;1473:1;1468:2;:6;1461:14;;;;;;;;:::i;:::-;;;;;;;1455:43;;-1:-1:-1;1526:2:0;1455:21;1521:7;;;1517:260;;1581:2;1577:1;:6;1570:14;;1553:6;1565:1;1560:2;:6;1553:14;;;;;;;;:::i;:::-;;;;:31;-1:-1:-1;;;;;1553:31:0;;;;;;;;;1641:6;1657:1;1653;1648:2;:6;:10;1641:18;;;;;;;;:::i;:::-;;;;;;;;;1635:25;;1663:1;1635:29;1628:37;;1607:6;1623:1;1619;1614:2;:6;:10;1607:18;;;;;;;;:::i;:::-;;;;:58;-1:-1:-1;;;;;1607:58:0;;;;;;;;;1517:260;;;1755:1;1748:9;;1731:6;1743:1;1738:2;:6;1731:14;;;;;;;;:::i;:::-;;;;:26;-1:-1:-1;;;;;1731:26:0;;;;;;;;;1517:260;-1:-1:-1;1421:3:0;;1401:391;;;-1:-1:-1;1855:1:0;1846:101;1862:2;1858:1;:6;1846:101;;;1902:11;;;;;;;;;;;;;;;;;1920:6;1927:1;1920:9;;;;;;;;:::i;:::-;;;;;1902:29;;1920:9;;;;;;1902:29;;;;;;:::i;:::-;;;;;;;;;1890:6;1897:1;1890:9;;;;;;;;:::i;:::-;;;;:41;-1:-1:-1;;;;;1890:41:0;;;;;;;;-1:-1:-1;1866:3:0;;1846:101;;;-1:-1:-1;1977:6:0;;767:1236;-1:-1:-1;;;;767:1236:0:o;14:180:1:-;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;-1:-1:-1;165:23:1;;14:180;-1:-1:-1;14:180:1:o;199:605::-;319:4;348:2;377;366:9;359:21;409:6;403:13;452:6;447:2;436:9;432:18;425:34;477:1;487:140;501:6;498:1;495:13;487:140;;;596:14;;;592:23;;586:30;562:17;;;581:2;558:26;551:66;516:10;;487:140;;;645:6;642:1;639:13;636:91;;;715:1;710:2;701:6;690:9;686:22;682:31;675:42;636:91;-1:-1:-1;788:2:1;767:15;-1:-1:-1;;763:29:1;748:45;;;;795:2;744:54;;199:605;-1:-1:-1;;;199:605:1:o;1073:127::-;1134:10;1129:3;1125:20;1122:1;1115:31;1165:4;1162:1;1155:15;1189:4;1186:1;1179:15

Swarm Source

ipfs://44c00a41b0be338aa17311e2cd5dc0b66ab483830f0cf49cc77e44e441945097

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.