Contract 0x239592dbe50e428ac9955a68589e011701ce18df

 

Contract Overview

Balance:
0 MATIC

MATIC Value:
$0.00

Token:
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xdfc43c1c15174243bb606e8a58e48409d5f27dbdb2107478accbd330ef46a84bAssign Random Po...213694752021-11-14 18:55:2963 days 16 hrs ago0x22de936854e40350d01f47724fd047d4de0f26a1 IN  0x239592dbe50e428ac9955a68589e011701ce18df0 MATIC0.2228821230
0x3bc11697534224f5cc38a36f303f371e07b7dd72eefc2c3808b68c79c0a74ea1Assign Random Po...213694632021-11-14 18:55:0163 days 16 hrs ago0x22de936854e40350d01f47724fd047d4de0f26a1 IN  0x239592dbe50e428ac9955a68589e011701ce18df0 MATIC0.2567796930
0x5018c92aa6cb0b597bb9eb3c0b255a435e1fe0b7ad12210d3cd31c1b2256764cAssign Random Po...213694592021-11-14 18:54:5363 days 16 hrs ago0x22de936854e40350d01f47724fd047d4de0f26a1 IN  0x239592dbe50e428ac9955a68589e011701ce18df0 MATIC0.2592969330
0xc41f3bb6bed56edee9a4e1ca096336f2a702b6a10f1e2f1fc16cd054d3627c66Assign Random Po...213694502021-11-14 18:54:3563 days 16 hrs ago0x22de936854e40350d01f47724fd047d4de0f26a1 IN  0x239592dbe50e428ac9955a68589e011701ce18df0 MATIC0.2473072830
0x9531f25b96b4f7c6c9ffab551b1d0d303e3789fca0e506d7f928daf600d7fd6b0x60806040213693002021-11-14 18:48:0163 days 16 hrs ago0x35026e47d89eaa2d08b97db30b996d1854674dec IN  Create: Randomizer0 MATIC0.0091362550
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Randomizer

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 1337 runs

Other Settings:
default evmVersion, MIT license
/**
 *Submitted for verification at polygonscan.com on 2021-11-14
*/

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0 <0.9.0;

/**
    @author The Calystral Team
    @title A contract for Randomization
*/
contract Randomizer {
    /*==============================
    =            EVENTS            =
    ==============================*/
    /**
        @dev MUST emit when any random position is assigned.
        The `userAddress` argument MUST be the user's address.
        The `position` argument MUST be the random position.
    */
    event OnRandomPositionAssigned(
        address indexed userAddress,
        uint256 position
    );

    /*==============================
    =          CONSTANTS           =
    ==============================*/

    /*==============================
    =            STORAGE           =
    ==============================*/
    /// @dev A counter which is used to prevent identical outcomes for multiple rolls within the same block.
    uint256 private _randomnessNonce;

    /*==============================
    =          MODIFIERS           =
    ==============================*/

    /*==============================
    =          CONSTRUCTOR         =
    ==============================*/
    /** 
        @notice Creates and initializes the contract.
        @dev Creates and initializes the contract.
    */
    constructor() {}

    /*==============================
    =      PUBLIC & EXTERNAL       =
    ==============================*/
    /**
        @notice Assigns a user a random positon.
        @dev Assigns a user a random positon.
        Uint256 as the position space where each position is unique due to chance.
        _randomnessNonce is increased after the whole loop sine we use gasLeft() as well.
        Emits the `OnRandomPositionAssigned` event.
        @param userAddresses  The receiver
    */
    function assignRandomPosition(address[] calldata userAddresses) public {
        for (uint256 i = 0; i < userAddresses.length; i++) {
            emit OnRandomPositionAssigned(
                userAddresses[i],
                _getRandomUnit256()
            );
        }
        _randomnessNonce++;
    }

    /*==============================
    =          RESTRICTED          =
    ==============================*/

    /*==============================
    =          VIEW & PURE         =
    ==============================*/
    /**
        @notice Mints a single card as an NFT.
        @dev    Creates a random number between 0 and uin256.
                Uses a nonce + gasLeft to prevent same outcomes in one block.
        @return A random uint256
    */
    function _getRandomUnit256() private view returns (uint256) {
        return
            uint256(
                keccak256(
                    abi.encodePacked(
                        block.timestamp,
                        gasleft(),
                        _randomnessNonce
                    )
                )
            );
    }

    /*==============================
    =      INTERNAL & PRIVATE      =
    ==============================*/
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"position","type":"uint256"}],"name":"OnRandomPositionAssigned","type":"event"},{"inputs":[{"internalType":"address[]","name":"userAddresses","type":"address[]"}],"name":"assignRandomPosition","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50610258806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80631d63c91e14610030575b600080fd5b61004361003e366004610131565b610045565b005b60005b818110156100d957828282818110610062576100626101a6565b905060200201602081019061007791906101bc565b73ffffffffffffffffffffffffffffffffffffffff167f4679767fbecd25dce4b4528e9b34df2835b711bc49fb4707fc039aaabe51f6176100b66100f2565b60405190815260200160405180910390a2806100d1816101f9565b915050610048565b506000805490806100e9836101f9565b91905055505050565b6000425a60005460408051602081019490945283019190915260608201526080016040516020818303038152906040528051906020012060001c905090565b6000806020838503121561014457600080fd5b823567ffffffffffffffff8082111561015c57600080fd5b818501915085601f83011261017057600080fd5b81358181111561017f57600080fd5b8660208260051b850101111561019457600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156101ce57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146101f257600080fd5b9392505050565b600060001982141561021b57634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220e6e8de7f1f8e3d1944ec29587a50598a1e3088735d26997f6768434855b3388464736f6c634300080a0033

Deployed ByteCode Sourcemap

152:2979:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1869:313;;;;;;:::i;:::-;;:::i;:::-;;;1956:9;1951:195;1971:24;;;1951:195;;;2065:13;;2079:1;2065:16;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;2022:112;;;2100:19;:17;:19::i;:::-;2022:112;;1283:25:1;;;1271:2;1256:18;2022:112:0;;;;;;;1997:3;;;;:::i;:::-;;;;1951:195;;;-1:-1:-1;2156:16:0;:18;;;:16;:18;;;:::i;:::-;;;;;;1869:313;;:::o;2661:351::-;2712:7;2853:15;2895:9;2931:16;;2810:160;;;;;;1798:19:1;;;;1833:12;;1826:28;;;;1870:12;;;1863:28;1907:12;;2810:160:0;;;;;;;;;;;;2778:211;;;;;;2752:252;;2732:272;;2661:351;:::o;14:615:1:-;100:6;108;161:2;149:9;140:7;136:23;132:32;129:52;;;177:1;174;167:12;129:52;217:9;204:23;246:18;287:2;279:6;276:14;273:34;;;303:1;300;293:12;273:34;341:6;330:9;326:22;316:32;;386:7;379:4;375:2;371:13;367:27;357:55;;408:1;405;398:12;357:55;448:2;435:16;474:2;466:6;463:14;460:34;;;490:1;487;480:12;460:34;543:7;538:2;528:6;525:1;521:14;517:2;513:23;509:32;506:45;503:65;;;564:1;561;554:12;503:65;595:2;587:11;;;;;617:6;;-1:-1:-1;14:615:1;;-1:-1:-1;;;;14:615:1:o;634:184::-;-1:-1:-1;;;683:1:1;676:88;783:4;780:1;773:15;807:4;804:1;797:15;823:309;882:6;935:2;923:9;914:7;910:23;906:32;903:52;;;951:1;948;941:12;903:52;990:9;977:23;1040:42;1033:5;1029:54;1022:5;1019:65;1009:93;;1098:1;1095;1088:12;1009:93;1121:5;823:309;-1:-1:-1;;;823:309:1:o;1319:289::-;1358:3;-1:-1:-1;;1379:17:1;;1376:197;;;-1:-1:-1;;;1426:1:1;1419:88;1530:4;1527:1;1520:15;1558:4;1555:1;1548:15;1376:197;-1:-1:-1;1600:1:1;1589:13;;1319:289::o

Swarm Source

ipfs://e6e8de7f1f8e3d1944ec29587a50598a1e3088735d26997f6768434855b33884
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.