Source Code
EVM
Overview
ETH Balance
0 ETH
ETH Value
$0.00Latest 25 from a total of 394 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Request Random | 36573229 | 27 mins ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36573088 | 28 mins ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36565520 | 1 hr ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36565386 | 1 hr ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36558175 | 2 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36558046 | 2 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36550242 | 3 hrs ago | IN | 0 ETH | 0.00000751 | ||||
| Request Random | 36550129 | 3 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36542942 | 4 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36542835 | 4 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36535418 | 5 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36535303 | 5 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36528458 | 6 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36528329 | 6 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36520740 | 7 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36520588 | 7 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36513872 | 8 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36513737 | 8 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36507084 | 9 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36506969 | 9 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36500265 | 10 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36500163 | 10 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36493401 | 11 hrs ago | IN | 0 ETH | 0.00000752 | ||||
| Request Random | 36493286 | 11 hrs ago | IN | 0 ETH | 0.00000788 | ||||
| Request Random | 36486573 | 12 hrs ago | IN | 0 ETH | 0.00000752 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 29473171 | 48 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
RandomContract
Compiler Version
v0.8.20+commit.a1b79de6
Contract Source Code (Solidity)
/**
*Submitted for verification at abscan.org on 2025-12-08
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IVRFSystem {
function requestRandomNumberWithTraceId(
uint256 traceId
) external returns (uint256 requestId);
}
interface IVRFSystemCallback {
/**
* Callback for when a Random Number is delivered
*
* @param requestId Id of the request
* @param randomNumber Random number that was generated by the Verified Random Number Generator Tool
*/
function randomNumberCallback(
uint256 requestId,
uint256 randomNumber
) external;
}
contract RandomContract is IVRFSystemCallback {
IVRFSystem public vrfSystem;
mapping(uint256 => address) public requestToUser;
mapping(uint256 => uint256) public requestMin;
mapping(uint256 => uint256) public requestMax;
mapping(address => uint256) public userRandomNumber;
event RandomNumberRequested(
uint256 indexed requestId,
address indexed callbackAddress,
uint256 indexed traceId
);
event RandomNumberDelivered(
uint256 indexed requestId,
address indexed callbackAddress,
uint256 indexed traceId,
uint256 roundNumber,
uint256 randomNumber
);
/**
* @dev Constructor to set the VRF system address
* @param _vrfSystemAddress Address of the Proof of Play VRF system contract
*/
constructor(address _vrfSystemAddress) {
vrfSystem = IVRFSystem(_vrfSystemAddress);
}
/**
* @dev Request a random number within a specified range
* @param min Minimum value (inclusive)
* @param max Maximum value (inclusive)
* @return requestId The ID of the random number request
*
* NOTE: The random number will be delivered via randomNumberCallback()
* after 1-3 seconds by the VRF system
*/
function requestRandom(
uint256 min,
uint256 max
) external returns (uint256) {
require(min <= max, "Min must be <= max");
uint256 requestId = vrfSystem.requestRandomNumberWithTraceId(0);
requestToUser[requestId] = msg.sender;
requestMin[requestId] = min;
requestMax[requestId] = max;
emit RandomNumberRequested(requestId, address(this), 0);
return requestId;
}
/**
* @dev Callback function called by VRF system when random number is ready
* @param requestId The ID of the original request
* @param randomNumber The raw random number (uint256, very large number)
*
* NOTE: This function can only be called by the VRF system.
* The raw randomNumber is converted to the requested range using modulo.
*/
function randomNumberCallback(
uint256 requestId,
uint256 randomNumber
) external override {
require(msg.sender == address(vrfSystem), "Only VRF system");
require(requestToUser[requestId] != address(0), "Invalid request");
address user = requestToUser[requestId];
uint256 min = requestMin[requestId];
uint256 max = requestMax[requestId];
uint256 range = max - min + 1;
uint256 randomInRange = min + (randomNumber % range);
userRandomNumber[user] = randomInRange;
emit RandomNumberDelivered(
requestId,
address(this),
0,
0,
randomInRange
);
delete requestToUser[requestId];
delete requestMin[requestId];
delete requestMax[requestId];
}
/**
* @dev Derive multiple random numbers from a single base random number
* @param baseRandom The base random number from VRF
* @param count Number of random numbers to derive
* @return numbers Array of derived random numbers
*
* NOTE: Useful when you need multiple random values but only want to
* make one VRF request. Each derived number is cryptographically
* independent using keccak256 hashing.
*
* Example: For a card game needing 5 cards, call deriveNumbers(baseRandom, 5)
*/
function deriveNumbers(
uint256 baseRandom,
uint256 count
) internal pure returns (uint256[] memory) {
uint256[] memory numbers = new uint256[](count);
for (uint256 i = 0; i < count; i++) {
numbers[i] = uint256(keccak256(abi.encodePacked(baseRandom, i)));
}
return numbers;
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_vrfSystemAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"address","name":"callbackAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"traceId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"roundNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"randomNumber","type":"uint256"}],"name":"RandomNumberDelivered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"address","name":"callbackAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"traceId","type":"uint256"}],"name":"RandomNumberRequested","type":"event"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256","name":"randomNumber","type":"uint256"}],"name":"randomNumberCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestMin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"min","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"requestRandom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestToUser","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRandomNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vrfSystem","outputs":[{"internalType":"contract IVRFSystem","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b506040516105dc3803806105dc83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b610549806100936000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80639cf3a4221161005b5780639cf3a422146100fe578063b54a3c321461011e578063e862d7fd1461013e578063f436aa661461015e57600080fd5b80633e2f7eb5146100825780638d9d93e4146100c85780638f561acc146100e9575b600080fd5b6100ab610090366004610431565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100db6100d636600461044a565b610171565b6040519081526020016100bf565b6100fc6100f736600461044a565b61029a565b005b6100db61010c366004610431565b60026020526000908152604090205481565b6100db61012c36600461046c565b60046020526000908152604090205481565b6100db61014c366004610431565b60036020526000908152604090205481565b6000546100ab906001600160a01b031681565b6000818311156101bd5760405162461bcd60e51b815260206004820152601260248201527109ad2dc40daeae6e840c4ca40787a40dac2f60731b60448201526064015b60405180910390fd5b600080546040516371c8a23960e11b8152600481018390526001600160a01b039091169063e3914472906024016020604051808303816000875af1158015610209573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022d919061049c565b600081815260016020908152604080832080546001600160a01b031916331790556002825280832088905560039091528082208690555191925090309083907f0412f12636343f005eb6a020fa429ce7c86c3cfa2b4ebd9f6a00a059790350b6908490a490505b92915050565b6000546001600160a01b031633146102e65760405162461bcd60e51b815260206004820152600f60248201526e4f6e6c79205652462073797374656d60881b60448201526064016101b4565b6000828152600160205260409020546001600160a01b031661033c5760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081c995c5d595cdd608a1b60448201526064016101b4565b60008281526001602090815260408083205460028352818420546003909352908320546001600160a01b039091169261037583836104cb565b6103809060016104de565b9050600061038e82876104f1565b61039890856104de565b6001600160a01b03861660009081526004602090815260408083208490558051838152918201849052929350909130918a917ff8604b0cd25e2913a59ecb707311c974ed91bca81be78e0df4b9afaa5b3a6a48910160405180910390a45050506000938452505060016020908152604080842080546001600160a01b031916905560028252808420849055600390915282209190915550565b60006020828403121561044357600080fd5b5035919050565b6000806040838503121561045d57600080fd5b50508035926020909101359150565b60006020828403121561047e57600080fd5b81356001600160a01b038116811461049557600080fd5b9392505050565b6000602082840312156104ae57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610294576102946104b5565b80820180821115610294576102946104b5565b60008261050e57634e487b7160e01b600052601260045260246000fd5b50069056fea2646970667358221220541edb951ee01ebddd75cbca113679be906177a4017174014bdb6b45a0213e8164736f6c63430008140033000000000000000000000000bdc8b6eb1840215a22fc1134046f595b7d42c2de
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80639cf3a4221161005b5780639cf3a422146100fe578063b54a3c321461011e578063e862d7fd1461013e578063f436aa661461015e57600080fd5b80633e2f7eb5146100825780638d9d93e4146100c85780638f561acc146100e9575b600080fd5b6100ab610090366004610431565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100db6100d636600461044a565b610171565b6040519081526020016100bf565b6100fc6100f736600461044a565b61029a565b005b6100db61010c366004610431565b60026020526000908152604090205481565b6100db61012c36600461046c565b60046020526000908152604090205481565b6100db61014c366004610431565b60036020526000908152604090205481565b6000546100ab906001600160a01b031681565b6000818311156101bd5760405162461bcd60e51b815260206004820152601260248201527109ad2dc40daeae6e840c4ca40787a40dac2f60731b60448201526064015b60405180910390fd5b600080546040516371c8a23960e11b8152600481018390526001600160a01b039091169063e3914472906024016020604051808303816000875af1158015610209573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022d919061049c565b600081815260016020908152604080832080546001600160a01b031916331790556002825280832088905560039091528082208690555191925090309083907f0412f12636343f005eb6a020fa429ce7c86c3cfa2b4ebd9f6a00a059790350b6908490a490505b92915050565b6000546001600160a01b031633146102e65760405162461bcd60e51b815260206004820152600f60248201526e4f6e6c79205652462073797374656d60881b60448201526064016101b4565b6000828152600160205260409020546001600160a01b031661033c5760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081c995c5d595cdd608a1b60448201526064016101b4565b60008281526001602090815260408083205460028352818420546003909352908320546001600160a01b039091169261037583836104cb565b6103809060016104de565b9050600061038e82876104f1565b61039890856104de565b6001600160a01b03861660009081526004602090815260408083208490558051838152918201849052929350909130918a917ff8604b0cd25e2913a59ecb707311c974ed91bca81be78e0df4b9afaa5b3a6a48910160405180910390a45050506000938452505060016020908152604080842080546001600160a01b031916905560028252808420849055600390915282209190915550565b60006020828403121561044357600080fd5b5035919050565b6000806040838503121561045d57600080fd5b50508035926020909101359150565b60006020828403121561047e57600080fd5b81356001600160a01b038116811461049557600080fd5b9392505050565b6000602082840312156104ae57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610294576102946104b5565b80820180821115610294576102946104b5565b60008261050e57634e487b7160e01b600052601260045260246000fd5b50069056fea2646970667358221220541edb951ee01ebddd75cbca113679be906177a4017174014bdb6b45a0213e8164736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bdc8b6eb1840215a22fc1134046f595b7d42c2de
-----Decoded View---------------
Arg [0] : _vrfSystemAddress (address): 0xBDC8B6eb1840215A22fC1134046f595b7D42C2DE
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000bdc8b6eb1840215a22fc1134046f595b7d42c2de
Deployed Bytecode Sourcemap
590:3929:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;679:48;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;679:48:0;;;;;;-1:-1:-1;;;;;363:32:1;;;345:51;;333:2;318:18;679:48:0;;;;;;;;1894:456;;;;;;:::i;:::-;;:::i;:::-;;;806:25:1;;;794:2;779:18;1894:456:0;660:177:1;2746:854:0;;;;;;:::i;:::-;;:::i;:::-;;734:45;;;;;;:::i;:::-;;;;;;;;;;;;;;838:51;;;;;;:::i;:::-;;;;;;;;;;;;;;786:45;;;;;;:::i;:::-;;;;;;;;;;;;;;643:27;;;;;-1:-1:-1;;;;;643:27:0;;;1894:456;1986:7;2021:3;2014;:10;;2006:41;;;;-1:-1:-1;;;2006:41:0;;1559:2:1;2006:41:0;;;1541:21:1;1598:2;1578:18;;;1571:30;-1:-1:-1;;;1617:18:1;;;1610:48;1675:18;;2006:41:0;;;;;;;;;2060:17;2080:9;;:43;;-1:-1:-1;;;2080:43:0;;;;;806:25:1;;;-1:-1:-1;;;;;2080:9:0;;;;:40;;779:18:1;;2080:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2136:24;;;;:13;:24;;;;;;;;:37;;-1:-1:-1;;;;;;2136:37:0;2163:10;2136:37;;;2184:10;:21;;;;;:27;;;2222:10;:21;;;;;;:27;;;2265:50;2060:63;;-1:-1:-1;2136:24:0;2306:4;;2060:63;;2265:50;;2136:24;;2265:50;2333:9;-1:-1:-1;1894:456:0;;;;;:::o;2746:854::-;2901:9;;-1:-1:-1;;;;;2901:9:0;2879:10;:32;2871:60;;;;-1:-1:-1;;;2871:60:0;;2285:2:1;2871:60:0;;;2267:21:1;2324:2;2304:18;;;2297:30;-1:-1:-1;;;2343:18:1;;;2336:45;2398:18;;2871:60:0;2083:339:1;2871:60:0;2986:1;2950:24;;;:13;:24;;;;;;-1:-1:-1;;;;;2950:24:0;2942:66;;;;-1:-1:-1;;;2942:66:0;;2629:2:1;2942:66:0;;;2611:21:1;2668:2;2648:18;;;2641:30;-1:-1:-1;;;2687:18:1;;;2680:45;2742:18;;2942:66:0;2427:339:1;2942:66:0;3021:12;3036:24;;;:13;:24;;;;;;;;;3085:10;:21;;;;;;3131:10;:21;;;;;;;-1:-1:-1;;;;;3036:24:0;;;;3181:9;3085:21;3131;3181:9;:::i;:::-;:13;;3193:1;3181:13;:::i;:::-;3165:29;-1:-1:-1;3205:21:0;3236:20;3165:29;3236:12;:20;:::i;:::-;3229:28;;:3;:28;:::i;:::-;-1:-1:-1;;;;;3270:22:0;;;;;;:16;:22;;;;;;;;:38;;;3326:144;;3562:25:1;;;3603:18;;;3596:34;;;3270:38:0;;-1:-1:-1;3270:22:0;;3394:4;;3362:9;;3326:144;;3535:18:1;3326:144:0;;;;;;;-1:-1:-1;;;3490:24:0;;;;-1:-1:-1;;3490:13:0;:24;;;;;;;;3483:31;;-1:-1:-1;;;;;;3483:31:0;;;3532:10;:21;;;;;3525:28;;;3571:10;:21;;;;;3564:28;;;;-1:-1:-1;2746:854: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;407:248::-;475:6;483;536:2;524:9;515:7;511:23;507:32;504:52;;;552:1;549;542:12;504:52;-1:-1:-1;;575:23:1;;;645:2;630:18;;;617:32;;-1:-1:-1;407:248:1:o;842:286::-;901:6;954:2;942:9;933:7;929:23;925:32;922:52;;;970:1;967;960:12;922:52;996:23;;-1:-1:-1;;;;;1048:31:1;;1038:42;;1028:70;;1094:1;1091;1084:12;1028:70;1117:5;842:286;-1:-1:-1;;;842:286:1:o;1894:184::-;1964:6;2017:2;2005:9;1996:7;1992:23;1988:32;1985:52;;;2033:1;2030;2023:12;1985:52;-1:-1:-1;2056:16:1;;1894:184;-1:-1:-1;1894:184:1:o;2771:127::-;2832:10;2827:3;2823:20;2820:1;2813:31;2863:4;2860:1;2853:15;2887:4;2884:1;2877:15;2903:128;2970:9;;;2991:11;;;2988:37;;;3005:18;;:::i;3036:125::-;3101:9;;;3122:10;;;3119:36;;;3135:18;;:::i;3166:209::-;3198:1;3224;3214:132;;3268:10;3263:3;3259:20;3256:1;3249:31;3303:4;3300:1;3293:15;3331:4;3328:1;3321:15;3214:132;-1:-1:-1;3360:9:1;;3166:209::o
Swarm Source
ipfs://541edb951ee01ebddd75cbca113679be906177a4017174014bdb6b45a0213e81
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.