ETH Price: $2,635.99 (+0.34%)

Contract

0xED4d05496C71e71cC2A8726af1242C22108d1761
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x61047e6193336562020-01-22 20:47:431731 days ago1579726063IN
 Create: IdToAddressBiMap
0 ETH0.0075336225

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
IdToAddressBiMap

Compiler Version
v0.5.6+commit.b259423e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license
/**
 *Submitted for verification at Etherscan.io on 2020-01-22
*/

pragma solidity ^0.5.0;


library IdToAddressBiMap {
    struct Data {
        mapping(uint16 => address) idToAddress;
        mapping(address => uint16) addressToId;
    }

    function hasId(Data storage self, uint16 id) public view returns (bool) {
        return self.idToAddress[id + 1] != address(0);
    }

    function hasAddress(Data storage self, address addr) public view returns (bool) {
        return self.addressToId[addr] != 0;
    }

    function getAddressAt(Data storage self, uint16 id) public view returns (address) {
        require(hasId(self, id), "Must have ID to get Address");
        return self.idToAddress[id + 1];
    }

    function getId(Data storage self, address addr) public view returns (uint16) {
        require(hasAddress(self, addr), "Must have Address to get ID");
        return self.addressToId[addr] - 1;
    }

    function insert(Data storage self, uint16 id, address addr) public returns (bool) {
        require(addr != address(0), "Cannot insert zero address");
        require(id != uint16(-1), "Cannot insert max uint16");
        // Ensure bijectivity of the mappings
        if (self.addressToId[addr] != 0 || self.idToAddress[id + 1] != address(0)) {
            return false;
        }
        self.idToAddress[id + 1] = addr;
        self.addressToId[addr] = id + 1;
        return true;
    }

}

Contract Security Audit

Contract ABI

[]

61047e610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100615760003560e01c80639f3cb65514610066578063ab8978b7146100bd578063b3129e1f146100e4578063bffacb5c14610127578063dd1261461461016a575b600080fd5b81801561007257600080fd5b506100a96004803603606081101561008957600080fd5b50803590602081013561ffff1690604001356001600160a01b0316610196565b604080519115158252519081900360200190f35b6100a9600480360360408110156100d357600080fd5b508035906020013561ffff166102fc565b610110600480360360408110156100fa57600080fd5b50803590602001356001600160a01b0316610321565b6040805161ffff9092168252519081900360200190f35b61014e6004803603604081101561013d57600080fd5b508035906020013561ffff166103a9565b604080516001600160a01b039092168252519081900360200190f35b6100a96004803603604081101561018057600080fd5b50803590602001356001600160a01b031661042d565b60006001600160a01b0382166101f65760408051600160e51b62461bcd02815260206004820152601a60248201527f43616e6e6f7420696e73657274207a65726f2061646472657373000000000000604482015290519081900360640190fd5b61ffff83811614156102525760408051600160e51b62461bcd02815260206004820152601860248201527f43616e6e6f7420696e73657274206d61782075696e7431360000000000000000604482015290519081900360640190fd5b6001600160a01b038216600090815260018501602052604090205461ffff1615158061029c575061ffff60018401166000908152602085905260409020546001600160a01b031615155b156102a9575060006102f5565b50600182810161ffff1660008181526020868152604080832080546001600160a01b0319166001600160a01b03881690811790915583528785019091529020805461ffff191690911790555b9392505050565b60010161ffff16600090815260209190915260409020546001600160a01b0316151590565b600061032d838361042d565b6103815760408051600160e51b62461bcd02815260206004820152601b60248201527f4d7573742068617665204164647265737320746f206765742049440000000000604482015290519081900360640190fd5b506001600160a01b03166000908152600191909101602052604090205461ffff166000190190565b60006103b583836102fc565b6104095760408051600160e51b62461bcd02815260206004820152601b60248201527f4d757374206861766520494420746f2067657420416464726573730000000000604482015290519081900360640190fd5b5060010161ffff16600090815260209190915260409020546001600160a01b031690565b6001600160a01b03166000908152600191909101602052604090205461ffff1615159056fea165627a7a72305820aebf624c79b17fd0232761c3f186dedc347cbdb7d0c6cff33b05eba89a3ea4a20029

Deployed Bytecode

0x73ed4d05496c71e71cc2a8726af1242c22108d176130146080604052600436106100615760003560e01c80639f3cb65514610066578063ab8978b7146100bd578063b3129e1f146100e4578063bffacb5c14610127578063dd1261461461016a575b600080fd5b81801561007257600080fd5b506100a96004803603606081101561008957600080fd5b50803590602081013561ffff1690604001356001600160a01b0316610196565b604080519115158252519081900360200190f35b6100a9600480360360408110156100d357600080fd5b508035906020013561ffff166102fc565b610110600480360360408110156100fa57600080fd5b50803590602001356001600160a01b0316610321565b6040805161ffff9092168252519081900360200190f35b61014e6004803603604081101561013d57600080fd5b508035906020013561ffff166103a9565b604080516001600160a01b039092168252519081900360200190f35b6100a96004803603604081101561018057600080fd5b50803590602001356001600160a01b031661042d565b60006001600160a01b0382166101f65760408051600160e51b62461bcd02815260206004820152601a60248201527f43616e6e6f7420696e73657274207a65726f2061646472657373000000000000604482015290519081900360640190fd5b61ffff83811614156102525760408051600160e51b62461bcd02815260206004820152601860248201527f43616e6e6f7420696e73657274206d61782075696e7431360000000000000000604482015290519081900360640190fd5b6001600160a01b038216600090815260018501602052604090205461ffff1615158061029c575061ffff60018401166000908152602085905260409020546001600160a01b031615155b156102a9575060006102f5565b50600182810161ffff1660008181526020868152604080832080546001600160a01b0319166001600160a01b03881690811790915583528785019091529020805461ffff191690911790555b9392505050565b60010161ffff16600090815260209190915260409020546001600160a01b0316151590565b600061032d838361042d565b6103815760408051600160e51b62461bcd02815260206004820152601b60248201527f4d7573742068617665204164647265737320746f206765742049440000000000604482015290519081900360640190fd5b506001600160a01b03166000908152600191909101602052604090205461ffff166000190190565b60006103b583836102fc565b6104095760408051600160e51b62461bcd02815260206004820152601b60248201527f4d757374206861766520494420746f2067657420416464726573730000000000604482015290519081900360640190fd5b5060010161ffff16600090815260209190915260409020546001600160a01b031690565b6001600160a01b03166000908152600191909101602052604090205461ffff1615159056fea165627a7a72305820aebf624c79b17fd0232761c3f186dedc347cbdb7d0c6cff33b05eba89a3ea4a20029

Deployed Bytecode Sourcemap

29:1363:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888:499;;8:9:-1;5:2;;;30:1;27;20:12;5:2;888:499:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;888:499:0;;;;;;;;;;;;;-1:-1:-1;;;;;888:499:0;;:::i;:::-;;;;;;;;;;;;;;;;;;187:136;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;187:136:0;;;;;;;;;:::i;678:202::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;678:202:0;;;;;;-1:-1:-1;;;;;678:202:0;;:::i;:::-;;;;;;;;;;;;;;;;;;;472:198;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;472:198:0;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;472:198:0;;;;;;;;;;;;;;331:133;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;331:133:0;;;;;;-1:-1:-1;;;;;331:133:0;;:::i;888:499::-;964:4;-1:-1:-1;;;;;989:18:0;;981:57;;;;;-1:-1:-1;;;;;981:57:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;1057:16;;;;;;1049:53;;;;;-1:-1:-1;;;;;1049:53:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1164:22:0;;;;;;:16;;;:22;;;;;;;;:27;;;:69;;-1:-1:-1;1195:24:0;1217:1;1212:6;;1195:24;1231:1;1195:24;;;;;;;;;;;-1:-1:-1;;;;;1195:24:0;:38;;1164:69;1160:114;;;-1:-1:-1;1257:5:0;1250:12;;1160:114;-1:-1:-1;1306:1:0;1301:6;;;1284:24;;:16;:24;;;;;;;;;;;:31;;-1:-1:-1;;;;;;1284:31:0;-1:-1:-1;;;;;1284:31:0;;;;;;;;1326:22;;:16;;;:22;;;;;:31;;-1:-1:-1;;1326:31:0;;;;;;888:499;;;;;;:::o;187:136::-;299:1;294:6;277:24;;253:4;277:24;;;;;;;;;;;;-1:-1:-1;;;;;277:24:0;:38;;;187:136::o;678:202::-;747:6;774:22;785:4;791;774:10;:22::i;:::-;766:62;;;;;-1:-1:-1;;;;;766:62:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;846:22:0;;;;;871:1;846:16;;;;:22;;;;;;;;-1:-1:-1;;846:26:0;;678:202::o;472:198::-;545:7;573:15;579:4;585:2;573:5;:15::i;:::-;565:55;;;;;-1:-1:-1;;;;;565:55:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;660:1:0;655:6;638:24;;:16;:24;;;;;;;;;;;;-1:-1:-1;;;;;638:24:0;;472:198::o;331:133::-;-1:-1:-1;;;;;429:22:0;405:4;429:22;;;:16;;;;;:22;;;;;;;;:27;;;331:133::o

Swarm Source

bzzr://aebf624c79b17fd0232761c3f186dedc347cbdb7d0c6cff33b05eba89a3ea4a2

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.