ETH Price: $2,292.85 (-5.38%)

Contract

0x0D4B210864dE12B3f561EdBe858A1725D73Ac3aC
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim174920272023-06-16 11:13:35457 days ago1686914015IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0010560416.42442947
Claim174707362023-06-13 11:20:23460 days ago1686655223IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0004626714.7928834
Claim174707342023-06-13 11:19:59460 days ago1686655199IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0016222414.35805899
Claim174582332023-06-11 17:04:47462 days ago1686503087IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0031304716.85944527
Claim173316362023-05-24 21:12:11480 days ago1684962731IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0033620734.91501637
Claim173197032023-05-23 4:54:35482 days ago1684817675IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0022297734.67923178
Claim173097512023-05-21 19:17:11483 days ago1684696631IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0016434566.18837853
Claim172742822023-05-16 19:19:23488 days ago1684264763IN
0x0D4B2108...5D73Ac3aC
0 ETH0.006798262.3705901
Claim172474122023-05-13 0:07:59492 days ago1683936479IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0050665240.17960425
Claim172468682023-05-12 22:17:35492 days ago1683929855IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0061810449.89022652
Claim172456622023-05-12 17:54:35492 days ago1683914075IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0074284258.91602309
Claim172296662023-05-10 11:19:47494 days ago1683717587IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0088567470.24422324
Claim172280092023-05-10 5:44:11495 days ago1683697451IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0064759859.41437688
Claim172219312023-05-09 9:13:35495 days ago1683623615IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0018260558.38332729
Claim172219272023-05-09 9:12:47495 days ago1683623567IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0043140367.1079244
Claim172193642023-05-09 0:34:35496 days ago1683592475IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0073693567.61058045
Claim172181152023-05-08 20:22:23496 days ago1683577343IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0107285798.44084497
Claim172152812023-05-08 10:48:11496 days ago1683542891IN
0x0D4B2108...5D73Ac3aC
0 ETH0.0072013188.48452813
Set Role172097252023-05-07 16:03:11497 days ago1683475391IN
0x0D4B2108...5D73Ac3aC
0 ETH0.00603917124.15056129
0x60806040171939482023-05-05 10:51:11499 days ago1683283871IN
 Create: MutariuumGiveaways
0 ETH0.036049878.83461601

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MutariuumGiveaways

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 5 : MutariuumGiveaways.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "../interfaces/IERC721.sol";
import "../libraries/ECDSA.sol";
import "./Roles.sol";

contract MutariuumGiveaways is Roles {
    error ClaimTimeout();

    constructor() {
        _setRole(msg.sender, 0, true);
    }

    function claim(
        address nft,
        address sender,
        uint256[] calldata tokenIds,
        uint256 blockNumber,
        bytes calldata signature
    ) external {
        _verifySignature(nft, sender, tokenIds, blockNumber, signature);
        IERC721 collection = IERC721(nft);
        uint256 tokensLength = tokenIds.length;
        for (uint256 i = 0; i < tokensLength;) {
            collection.safeTransferFrom(sender, msg.sender, tokenIds[i]);
            unchecked { ++i; }
        }
    }

    function _verifySignature(
        address nft,
        address sender,
        uint256[] calldata tokenIds,
        uint256 blockNumber,
        bytes calldata signature
    ) internal view {
        unchecked {
            if (block.number > blockNumber + 10) {
                revert ClaimTimeout();
            }
        }
        address signer = _getSigner(
            keccak256(
                abi.encode(
                    msg.sender, nft, sender, tokenIds, blockNumber
                )
            ), signature
        );
        if (!_hasRole(signer, 1)) {
            revert ECDSA.InvalidSignature();
        }
    }

    function _getSigner(bytes32 message, bytes calldata signature) internal pure returns(address) {
        bytes32 hash = keccak256(
            abi.encodePacked(
                "\x19Ethereum Signed Message:\n32",
                message
            )
        );
        return ECDSA.recover(hash, signature);
    }
}

File 2 of 5 : Roles.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;

import "../libraries/Bits.sol";

contract Roles {
    using Bits for bytes32;

    error MissingRole(address user, uint256 role);

    event RoleUpdated(address indexed user, uint256 indexed role, bool indexed status);

    /**
     * @dev There is a maximum of 256 roles: each bit says if the role is on or off
     */
    mapping(address => bytes32) private _addressRoles;

    function _hasRole(address user, uint8 role) internal view returns(bool) {
        bytes32 roles = _addressRoles[user];
        return roles.getBool(role);
    }

    function _checkRole(address user, uint8 role) internal virtual view {
        if (user == address(this)) return;
        bytes32 roles = _addressRoles[user];
        bool allowed = roles.getBool(role);
        if (!allowed) {
            revert MissingRole(user, role);
        }
    }

    function _setRole(address user, uint8 role, bool status) internal virtual {
        _addressRoles[user] = _addressRoles[user].setBit(role, status);
        emit RoleUpdated(user, role, status);
    }

    function setRole(address user, uint8 role, bool status) external virtual {
        _checkRole(msg.sender, 0);
        _setRole(user, role, status);
    }

    function getRoles(address user) external view returns(bytes32) {
        return _addressRoles[user];
    }
}

File 3 of 5 : IERC721.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IERC721 {
  function safeTransferFrom(address from, address to, uint256 tokenId) external;
}

File 4 of 5 : Bits.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

library Bits {
    /**
     * @dev unpack bit [offset] (bool)
     */
    function getBool(bytes32 p, uint8 offset) internal pure returns (bool r) {
        assembly {
            r := and(shr(offset, p), 1)
        }
    }

    /**
     * @dev set bit [{offset}] to {value}
     */
    function setBit(
        bytes32 p,
        uint8 offset,
        bool value
    ) internal pure returns (bytes32 np) {
        assembly {
            np := or(
                and(
                    p,
                    xor(
                        0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
                        shl(offset, 1)
                    )
                ),
                shl(offset, value)
            )
        }
    }
}

File 5 of 5 : ECDSA.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;

library ECDSA {
  error InvalidSignature();

  function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
    if (signature.length != 65) {
      revert InvalidSignature();
    }
    bytes32 r;
    bytes32 s;
    uint8 v;
    assembly {
      r := mload(add(signature, 0x20))
      s := mload(add(signature, 0x40))
      v := byte(0, mload(add(signature, 0x60)))
    }
    return tryRecover(hash, v, r, s);
  }

  function tryRecover(
    bytes32 hash,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) internal pure returns (address) {
    if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
      revert InvalidSignature();
    }
    return ecrecover(hash, v, r, s);
  }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ClaimTimeout","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"role","type":"uint256"}],"name":"MissingRole","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"role","type":"uint256"},{"indexed":true,"internalType":"bool","name":"status","type":"bool"}],"name":"RoleUpdated","type":"event"},{"inputs":[{"internalType":"address","name":"nft","type":"address"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getRoles","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint8","name":"role","type":"uint8"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setRole","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061001e3360006001610023565b610082565b6001600160a01b03831660008181526020819052604080822080546000196001881b181685871b179055518315159260ff86169290917f3e4657b0da61ffd251af36cb52bd766075e299a246b4cb5f3a200bdbdea2c0939190a4505050565b6106d7806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063161b622d14610046578063ce6ccfaf1461005b578063f6bb6b3714610096575b600080fd5b6100596100543660046104e9565b6100a9565b005b6100846100693660046105b4565b6001600160a01b031660009081526020819052604090205490565b60405190815260200160405180910390f35b6100596100a43660046105d6565b61016e565b6100b887878787878787610189565b868460005b8181101561016257826001600160a01b03166342842e0e8a338b8b868181106100e8576100e861062a565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b15801561013f57600080fd5b505af1158015610153573d6000803e3d6000fd5b505050508060010190506100bd565b50505050505050505050565b610179336000610233565b6101848383836102a2565b505050565b82600a014311156101ad576040516340c7517560e11b815260040160405180910390fd5b60006101ea3389898989896040516020016101cd96959493929190610640565b604051602081830303815290604052805190602001208484610301565b6001600160a01b038116600090815260208190526040902054909150600190811c1661022957604051638baa579f60e01b815260040160405180910390fd5b5050505050505050565b306001600160a01b03831603610247575050565b6001600160a01b03821660009081526020819052604090205480821c6001168061029c5760405163607b74c960e11b81526001600160a01b038516600482015260ff8416602482015260440160405180910390fd5b50505050565b6001600160a01b03831660008181526020819052604080822080546000196001881b181685871b179055518315159260ff86169290917f3e4657b0da61ffd251af36cb52bd766075e299a246b4cb5f3a200bdbdea2c0939190a4505050565b6040517b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b6020820152603c81018490526000908190605c016040516020818303038152906040528051906020012090506103908185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061039992505050565b95945050505050565b600081516041146103bd57604051638baa579f60e01b815260040160405180910390fd5b60208201516040830151606084015160001a6103db868285856103e5565b9695505050505050565b60006fa2a8918ca85bafe22016d0b997e4df60600160ff1b0382111561041e57604051638baa579f60e01b815260040160405180910390fd5b60408051600081526020810180835287905260ff861691810191909152606081018490526080810183905260019060a0016020604051602081039080840390855afa158015610471573d6000803e3d6000fd5b5050604051601f1901519695505050505050565b80356001600160a01b038116811461049c57600080fd5b919050565b60008083601f8401126104b357600080fd5b5081356001600160401b038111156104ca57600080fd5b6020830191508360208285010111156104e257600080fd5b9250929050565b600080600080600080600060a0888a03121561050457600080fd5b61050d88610485565b965061051b60208901610485565b955060408801356001600160401b038082111561053757600080fd5b818a0191508a601f83011261054b57600080fd5b81358181111561055a57600080fd5b8b60208260051b850101111561056f57600080fd5b6020830197508096505060608a0135945060808a013591508082111561059457600080fd5b506105a18a828b016104a1565b989b979a50959850939692959293505050565b6000602082840312156105c657600080fd5b6105cf82610485565b9392505050565b6000806000606084860312156105eb57600080fd5b6105f484610485565b9250602084013560ff8116811461060a57600080fd5b91506040840135801515811461061f57600080fd5b809150509250925092565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03878116825286811660208301528516604082015260a060608201819052810183905260006001600160fb1b0384111561068057600080fd5b8360051b808660c08501376080830193909352500160c0019594505050505056fea26469706673582212201d547e1aed0d793a406d88ed155fbd681497857f62f0313e739f5ad773fa61ec64736f6c63430008130033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063161b622d14610046578063ce6ccfaf1461005b578063f6bb6b3714610096575b600080fd5b6100596100543660046104e9565b6100a9565b005b6100846100693660046105b4565b6001600160a01b031660009081526020819052604090205490565b60405190815260200160405180910390f35b6100596100a43660046105d6565b61016e565b6100b887878787878787610189565b868460005b8181101561016257826001600160a01b03166342842e0e8a338b8b868181106100e8576100e861062a565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b15801561013f57600080fd5b505af1158015610153573d6000803e3d6000fd5b505050508060010190506100bd565b50505050505050505050565b610179336000610233565b6101848383836102a2565b505050565b82600a014311156101ad576040516340c7517560e11b815260040160405180910390fd5b60006101ea3389898989896040516020016101cd96959493929190610640565b604051602081830303815290604052805190602001208484610301565b6001600160a01b038116600090815260208190526040902054909150600190811c1661022957604051638baa579f60e01b815260040160405180910390fd5b5050505050505050565b306001600160a01b03831603610247575050565b6001600160a01b03821660009081526020819052604090205480821c6001168061029c5760405163607b74c960e11b81526001600160a01b038516600482015260ff8416602482015260440160405180910390fd5b50505050565b6001600160a01b03831660008181526020819052604080822080546000196001881b181685871b179055518315159260ff86169290917f3e4657b0da61ffd251af36cb52bd766075e299a246b4cb5f3a200bdbdea2c0939190a4505050565b6040517b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b6020820152603c81018490526000908190605c016040516020818303038152906040528051906020012090506103908185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061039992505050565b95945050505050565b600081516041146103bd57604051638baa579f60e01b815260040160405180910390fd5b60208201516040830151606084015160001a6103db868285856103e5565b9695505050505050565b60006fa2a8918ca85bafe22016d0b997e4df60600160ff1b0382111561041e57604051638baa579f60e01b815260040160405180910390fd5b60408051600081526020810180835287905260ff861691810191909152606081018490526080810183905260019060a0016020604051602081039080840390855afa158015610471573d6000803e3d6000fd5b5050604051601f1901519695505050505050565b80356001600160a01b038116811461049c57600080fd5b919050565b60008083601f8401126104b357600080fd5b5081356001600160401b038111156104ca57600080fd5b6020830191508360208285010111156104e257600080fd5b9250929050565b600080600080600080600060a0888a03121561050457600080fd5b61050d88610485565b965061051b60208901610485565b955060408801356001600160401b038082111561053757600080fd5b818a0191508a601f83011261054b57600080fd5b81358181111561055a57600080fd5b8b60208260051b850101111561056f57600080fd5b6020830197508096505060608a0135945060808a013591508082111561059457600080fd5b506105a18a828b016104a1565b989b979a50959850939692959293505050565b6000602082840312156105c657600080fd5b6105cf82610485565b9392505050565b6000806000606084860312156105eb57600080fd5b6105f484610485565b9250602084013560ff8116811461060a57600080fd5b91506040840135801515811461061f57600080fd5b809150509250925092565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03878116825286811660208301528516604082015260a060608201819052810183905260006001600160fb1b0384111561068057600080fd5b8360051b808660c08501376080830193909352500160c0019594505050505056fea26469706673582212201d547e1aed0d793a406d88ed155fbd681497857f62f0313e739f5ad773fa61ec64736f6c63430008130033

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.