Source Code
Overview
SOPH Balance
More Info
ContractCreator
Multichain Info
N/A
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Create Counter | 739791 | 23 days ago | IN | 0 SOPH | 0.24392637 |
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:
CounterFactory
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: UNLICENSED pragma solidity ^0.8.13; import "./Counter.sol"; contract CounterFactory { event CounterCreated(address counterAddress, bytes32 salt, uint256 initialNumber); // Maps salt to deployed counter address mapping(bytes32 => address) public counters; // Create a new Counter with the provided salt and initial number function createCounter(bytes32 salt, uint256 initialNumber) external returns (address) { Counter counter = new Counter{salt: salt}(initialNumber); address counterAddress = address(counter); counters[salt] = counterAddress; emit CounterCreated(counterAddress, salt, initialNumber); return counterAddress; } // Get the address of a counter for a given salt function getCounterAddress(bytes32 salt) public view returns (address) { return counters[salt]; } // Predict the address of a counter for a given salt function predictCounterAddress(bytes32 salt) public view returns (address) { bytes memory bytecode = abi.encodePacked( type(Counter).creationCode, abi.encode(uint256(0)) // Default initialNumber for prediction ); return address(uint160(uint(keccak256(abi.encodePacked( bytes1(0xff), address(this), salt, keccak256(bytecode) ))))); } // Predict the address of a counter for a given salt and initial number function predictCounterAddressWithInitialNumber(bytes32 salt, uint256 initialNumber) public view returns (address) { bytes memory bytecode = abi.encodePacked( type(Counter).creationCode, abi.encode(initialNumber) ); return address(uint160(uint(keccak256(abi.encodePacked( bytes1(0xff), address(this), salt, keccak256(bytecode) ))))); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; contract Counter { uint256 public number; constructor(uint256 initialNumber) { number = initialNumber; } function setNumber(uint256 newNumber) public { number = newNumber; } function increment() public { number++; } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "mode": "3" }, "outputSelection": { "*": { "*": [ "abi" ] } }, "detectMissingLibraries": false, "forceEVMLA": false, "enableEraVMExtensions": false, "libraries": {} }
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"counterAddress","type":"address"},{"indexed":false,"internalType":"bytes32","name":"salt","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"initialNumber","type":"uint256"}],"name":"CounterCreated","type":"event"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"counters","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256","name":"initialNumber","type":"uint256"}],"name":"createCounter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"salt","type":"bytes32"}],"name":"getCounterAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"salt","type":"bytes32"}],"name":"predictCounterAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256","name":"initialNumber","type":"uint256"}],"name":"predictCounterAddressWithInitialNumber","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
9c4d535b00000000000000000000000000000000000000000000000000000000000000000100007de9eb81ab23f34ed6f08d599ee9e5d8a0f57cbd5b3c26fcdf45e7aa1700000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x0002000000000002000300000000000200010000000103550000006003100270000000610030019d0000008004000039000000400040043f0000000100200190000000170000c13d0000006102300197000000040020008c000000f90000413d000000000301043b000000e003300270000000630030009c0000001f0000a13d000000640030009c000000340000613d000000650030009c0000006a0000613d000000660030009c000000230000613d000000f90000013d0000000001000416000000000001004b000000f90000c13d00000020010000390000010000100443000001200000044300000062010000410000017e0001042e000000670030009c000000c20000613d000000680030009c000000f90000c13d000000240020008c000000f90000413d0000000002000416000000000002004b000000f90000c13d0000000401100370000000000101043b000000000010043f000000200000043f00000040020000390000000001000019017d015e0000040f000000000101041a0000006c01100197000000800010043f00000072010000410000017e0001042e000000240020008c000000f90000413d0000000001000416000000000001004b000000f90000c13d0000014001000039000000400010043f0000008402000039000000800020043f0000006002000041000000c40020043f000001600000043f0000002002000039000001400020043f017d01280000040f000000400200043d000300000002001d00000080010000390000002002200039000200000002001d017d01450000040f00000000020100190000014001000039017d01450000040f00000003030000290000000002310049000000200120008a00000000001304350000000001030019017d01330000040f000000030100002900000000020104330000000201000029017d015e0000040f00000004020000390000000102200367000000000302043b0000000004010019000000400100043d000300000001001d00000000020004100000002001100039000200000001001d017d01530000040f00000003030000290000000002310049000000200120008a00000000001304350000000001030019017d01330000040f000000030100002900000000020104330000000201000029000000f00000013d000000440020008c000000f90000413d0000000002000416000000000002004b000000f90000c13d0000000402100370000000000302043b0000002401100370000000000201043b0000006001000041000000a40010043f000200000002001d000001040020043f00000000010004140000006902000041000000800020043f000300000003001d000000840030043f0000006002000039000000c40020043f0000002002000039000000e40020043f000000610010009c0000006101008041000000c0011002100000006a011001c70000800602000039017d01730000040f0000000100200190000000fb0000613d000000030400002900000000020000310000000103200367000000000101043b000000000001004b0000000002000019000000fe0000613d000100000001001d000000000040043f000000200000043f0000000001000414000000610010009c0000006101008041000000c0011002100000006b011001c70000801002000039017d01780000040f0000000100200190000000f90000613d00000001020000290000006c04200197000000000101043b000000000201041a0000006d02200197000000000242019f000000000021041b000000400100043d000000400210003900000002030000290000000000320435000000200210003900000003030000290000000000320435000300000004001d0000000000410435000000610010009c000000610100804100000040011002100000000002000414000000610020009c0000006102008041000000c002200210000000000112019f0000006e011001c70000800d0200003900000001030000390000006f04000041017d01730000040f0000000100200190000000f90000613d000000400100043d00000003020000290000000000210435000000610010009c0000006101008041000000400110021000000070011001c70000017e0001042e0000000001000416000000000001004b000000f90000c13d0000000001020019017d011c0000040f0000008403000039000000800030043f0000006003000041000000c40030043f000200000001001d000001600020043f0000002001000039000001400010043f0000018001000039000000400010043f0000008001000039000001a002000039017d01450000040f00000000020100190000014001000039017d01450000040f000001a00210008a000001800020043f000001800210008a0000018001000039017d01330000040f000001800200043d000001a001000039017d015e0000040f0000000004010019000000400100043d000300000001001d00000000020004100000002001100039000100000001001d0000000203000029017d01530000040f00000003030000290000000002310049000000200120008a00000000001304350000000001030019017d01330000040f000000030100002900000000020104330000000101000029017d015e0000040f0000006c01100197000000400200043d0000000000120435000000610020009c0000006102008041000000400120021000000070011001c70000017e0001042e00000000010000190000017f0001043000000060021002700000006102200197000000000301034f0000001f0520018f0000007106200198000000400100043d0000000004610019000001090000613d000000000703034f0000000008010019000000007907043c0000000008980436000000000048004b000001050000c13d000000000005004b000001160000613d000000000363034f0000000305500210000000000604043300000000065601cf000000000656022f000000000303043b0000010005500089000000000353022f00000000035301cf000000000363019f00000000003404350000006002200210000000610010009c00000061010080410000004001100210000000000121019f0000017f00010430000000730010009c000001260000213d000000430010008c000001260000a13d00000001020003670000000401200370000000000101043b0000002402200370000000000202043b000000000001042d00000000010000190000017f00010430000000740010009c0000012d0000813d0000004001100039000000400010043f000000000001042d0000007501000041000000000010043f0000004101000039000000040010043f00000076010000410000017f000104300000001f0220003900000078022001970000000001120019000000000021004b00000000020000390000000102004039000000770010009c0000013f0000213d00000001002001900000013f0000c13d000000400010043f000000000001042d0000007501000041000000000010043f0000004101000039000000040010043f00000076010000410000017f000104300000000031010434000000000001004b000001500000613d000000000400001900000000052400190000000006430019000000000606043300000000006504350000002004400039000000000014004b000001490000413d00000000012100190000000000010435000000000001042d0000007905000041000000000051043500000060022002100000000105100039000000000025043500000035021000390000000000420435000000150210003900000000003204350000005501100039000000000001042d000000610010009c00000061010080410000004001100210000000610020009c00000061020080410000006002200210000000000112019f0000000002000414000000610020009c0000006102008041000000c002200210000000000112019f0000007a011001c70000801002000039017d01780000040f0000000100200190000001710000613d000000000101043b000000000001042d00000000010000190000017f0001043000000176002104210000000102000039000000000001042d0000000002000019000000000001042d0000017b002104230000000102000039000000000001042d0000000002000019000000000001042d0000017d000004320000017e0001042e0000017f00010430010000237f8b7ac3a695a5670d53fbeaf6f4050b22ad7a5b1d0e47d83b97f0a500000000000000000000000000000000000000000000000000000000ffffffff000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000000000000000000000000000785a735200000000000000000000000000000000000000000000000000000000785a7353000000000000000000000000000000000000000000000000000000008cf332db00000000000000000000000000000000000000000000000000000000a3893deb000000000000000000000000000000000000000000000000000000003764e42b000000000000000000000000000000000000000000000000000000003c882a6b3cda33511d41a8a5431b1770c5bc0ddd62e1cd30555d16659b89c0d60f4f9f5702000000000000000000000000000000000000a40000008000000000000000000200000000000000000000000000000000000040000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000020000000000000000000000000000000000006000000000000000000000000092ed34504153276c08466a1095454750bcb3f75dc7969669eb3dbcf04d0e5320000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffe000000000000000000000000000000000000000200000008000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000ffffffffffffffc04e487b71000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ff0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000636adc9c32138866d09e0016d9055e6a77e9ed702da6867a5b7cfebef0a1ffe2
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.