Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x5C073CeCaFC56EE9f4335230A09933965C8ed472
Balance 0 ETH
Nonce 1
Code Size 5592 bytes
Indexed Transactions 0
External Etherscan ยท Sourcify

Contract Bytecode

5592 bytes
0x608060405234801561001057600080fd5b50600436106101985760003560e01c80637762df25116100e3578063b94ec9d01161008c578063dc38bdb511610066578063dc38bdb5146103a7578063fa461974146103d1578063ff0a4eb0146103da57600080fd5b8063b94ec9d014610369578063ba42590d14610371578063c0b6f5611461039457600080fd5b80638da5cb5b116100bd5780638da5cb5b146103085780638df9288b146103285780639ea76f341461033b57600080fd5b80637762df25146102b557806384483c86146102d55780638923e2f7146102f557600080fd5b806336db9fb2116101455780635b6ac0111161011f5780635b6ac0111461028e5780635c975abb146102965780637200b829146102ad57600080fd5b806336db9fb21461021a5780633b66f49d146102665780633e5675391461028657600080fd5b80632bb5a9e6116101765780632bb5a9e6146101cd5780632f52ebb7146101ff57806331cec7a31461021257600080fd5b80631040faf91461019d578063141fd8c8146101b957806323452b9c146101c3575b600080fd5b6101a660045481565b6040519081526020015b60405180910390f35b6101a66203f48081565b6101cb6103e3565b005b6003546101f29074010000000000000000000000000000000000000000900460ff1681565b6040516101b091906112b0565b6101cb61020d36600461133d565b6104ea565b6101cb6106e0565b6102417f000000000000000000000000f4d2888d29d722226fafa5d9b24f9164c092421e81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101b0565b6101a66102743660046113b2565b60076020526000908152604090205481565b6101cb6106fe565b6101cb6107f5565b60005460ff165b60405190151581526020016101b0565b6101cb6108cf565b6003546102419073ffffffffffffffffffffffffffffffffffffffff1681565b6101a66102e33660046113d4565b60086020526000908152604090205481565b6101cb6103033660046113d4565b610a0d565b6002546102419073ffffffffffffffffffffffffffffffffffffffff1681565b6101cb6103363660046113ed565b610ac8565b61029d61034936600461140f565b600a60209081526000928352604080842090915290825290205460ff1681565b6101cb610bab565b61029d61037f3660046113d4565b60096020526000908152604090205460ff1681565b6101cb6103a23660046113b2565b610bc3565b6103ba6103b536600461143b565b610cc5565b6040805192151583526020830191909152016101b0565b6101a660055481565b6101a660065481565b6103eb610ce2565b60035474010000000000000000000000000000000000000000900460ff16600081600281111561041d5761041d611281565b03610454576040517fccf69db700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181600281111561046857610468611281565b0361049657600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556040517f8eca980489e87f7dba4f26917aa4bfc906eb3f2b4f7b4b9fd0ff2b8bb3e21ae390600090a150565b6104f2610d33565b60015460020361052e576040517f1bbee72600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026001556004546000908152600a6020908152604080832033845290915290205460ff161561058a576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061059933868686610d70565b91509150816105d4576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600654851115610610576040517fc3ebbdaf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6004546000908152600a60209081526040808320338452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560079091528120805483929061066c9084906114c4565b9091555061069d90507f000000000000000000000000f4d2888d29d722226fafa5d9b24f9164c092421e3383610ee4565b60045460405182815233907fe8dbd8c18906df11a70832fe7c874d1fddf6952cee2320658d669256183879999060200160405180910390a3505060018055505050565b6106e8610ce2565b6106f0610d33565b426005556106fc6110be565b565b610706610ce2565b600260035474010000000000000000000000000000000000000000900460ff16600281111561073757610737611281565b1461076e576040517f045c512200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055604051600081527f3edd90e7770f06fafde38004653b33870066c33bfc923ff6102acd601f85dfbc906020015b60405180910390a1565b6107fd610ce2565b600060035474010000000000000000000000000000000000000000900460ff16600281111561082e5761082e611281565b14610865576040517f74ed79ae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740200000000000000000000000000000000000000001790556040517f3ff05a45e46337fa1cbf20996d2eeb927280bce099f37252bcca1040609604ec90600090a1565b600160035474010000000000000000000000000000000000000000900460ff16600281111561090057610900611281565b14610937576040517f5e4f282600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60035473ffffffffffffffffffffffffffffffffffffffff163314610988576040517fafdcfb9200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001633908117909155600380547fffffffffffffffffffffff0000000000000000000000000000000000000000001690556040519081527f3edd90e7770f06fafde38004653b33870066c33bfc923ff6102acd601f85dfbc906020016107eb565b610a15610ce2565b610a1d611121565b6203f480600554610a2e91906114c4565b4211610a66576040517ff91f552f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a917f000000000000000000000000f4d2888d29d722226fafa5d9b24f9164c092421e3383610ee4565b6040518181527fb4cd5c4a08bbed33abfe773ece179d156730e39629e065b7dcd8263027387c1d906020015b60405180910390a150565b610ad0610ce2565b60008281526009602052604090205460ff1615610b19576040517fa40497f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60048054906000610b29836114d7565b9091555050600480546000908152600860209081526040808320869055858352600990915280822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556006849055915491517fa8278b88a5ae3c7c9deea1719589c25bfabd75774aa0feb5288f7d567f34eb499190a25050565b610bb3610ce2565b610bbb611121565b6106fc61115d565b610bcb610ce2565b600060035474010000000000000000000000000000000000000000900460ff166002811115610bfc57610bfc611281565b14610c33576040517f74ed79ae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffff000000000000000000000000000000000000000000909116811774010000000000000000000000000000000000000000179091556040805133815260208101929092527fb86c75c9bffca616b2d314cc914f7c3f1d174255b16b941c3f3ededee276d5ef9101610abd565b600080610cd486868686610d70565b915091505b94509492505050565b60025473ffffffffffffffffffffffffffffffffffffffff1633146106fc576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005460ff16156106fc576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606086901b1660208201526034810184905260009081908190605401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506000610e52868680806020026020016040519081016040528093929190818152602001838360200280828437600092018290525060045481526008602052604090205492508691506111bd9050565b9050801580610e9357506004546000908152600a6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8c16845290915290205460ff165b15610ea657600080935093505050610cd9565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260076020526040902054600190610ed9908961150f565b935093505050610cd9565b8273ffffffffffffffffffffffffffffffffffffffff163b600003610f35576040517f09ee12d500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff8381166024830152604482018390526000918291861690606401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905251610fe89190611522565b6000604051808303816000865af19150503d8060008114611025576040519150601f19603f3d011682016040523d82523d6000602084013e61102a565b606091505b509150915081611066576040517ff1568f9500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051156110b757808060200190518101906110819190611551565b6110b7576040517ff1568f9500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050565b6110c6610d33565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258906020016107eb565b60005460ff166106fc576040517f6cd6020100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611165611121565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020016107eb565b6000826111ca85846111d3565b14949350505050565b600081815b84518110156112775760008582815181106111f5576111f5611573565b60200260200101519050808311611237576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250611264565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061126f816114d7565b9150506111d8565b5090505b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600383106112eb577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b60008083601f84011261130357600080fd5b50813567ffffffffffffffff81111561131b57600080fd5b6020830191508360208260051b850101111561133657600080fd5b9250929050565b60008060006040848603121561135257600080fd5b83359250602084013567ffffffffffffffff81111561137057600080fd5b61137c868287016112f1565b9497909650939450505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146113ad57600080fd5b919050565b6000602082840312156113c457600080fd5b6113cd82611389565b9392505050565b6000602082840312156113e657600080fd5b5035919050565b6000806040838503121561140057600080fd5b50508035926020909101359150565b6000806040838503121561142257600080fd5b8235915061143260208401611389565b90509250929050565b6000806000806060858703121561145157600080fd5b61145a85611389565b935060208501359250604085013567ffffffffffffffff81111561147d57600080fd5b611489878288016112f1565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561127b5761127b611495565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361150857611508611495565b5060010190565b8181038181111561127b5761127b611495565b6000825160005b818110156115435760208186018101518583015201611529565b506000920191825250919050565b60006020828403121561156357600080fd5b815180151581146113cd57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea264697066735822122040947bc83fa2b9285e0d81b92a4154fcf7742c691fc7199f10ce061c4990705764736f6c63430008140033

Verified Source Code Full Match

Compiler: v0.8.20+commit.a1b79de6 EVM: london Optimization: Yes (888888 runs)
SeasonRewardsDistributor.sol 176 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {LowLevelERC20Transfer} from "@looksrare/contracts-libs/contracts/lowLevelCallers/LowLevelERC20Transfer.sol";
import {OwnableTwoSteps} from "@looksrare/contracts-libs/contracts/OwnableTwoSteps.sol";
import {Pausable} from "@looksrare/contracts-libs/contracts/Pausable.sol";
import {ReentrancyGuard} from "@looksrare/contracts-libs/contracts/ReentrancyGuard.sol";

import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

/**
 * @title SeasonRewardsDistributor
 * @notice It distributes LOOKS tokens with rolling Merkle airdrops.
 */
contract SeasonRewardsDistributor is Pausable, ReentrancyGuard, OwnableTwoSteps, LowLevelERC20Transfer {
    uint256 public constant BUFFER_ADMIN_WITHDRAW = 3 days;

    address public immutable looksRareToken;

    // Current reward round (users can only claim pending rewards for the current round)
    uint256 public currentRewardRound;

    // Last paused timestamp
    uint256 public lastPausedTimestamp;

    // Max amount per user in current tree
    uint256 public maximumAmountPerUserInCurrentTree;

    // Total amount claimed by user (in LOOKS)
    mapping(address => uint256) public amountClaimedByUser;

    // Merkle root for a reward round
    mapping(uint256 => bytes32) public merkleRootOfRewardRound;

    // Checks whether a merkle root was used
    mapping(bytes32 => bool) public merkleRootUsed;

    // Keeps track on whether user has claimed at a given reward round
    mapping(uint256 => mapping(address => bool)) public hasUserClaimedForRewardRound;

    event RewardsClaim(address indexed user, uint256 indexed rewardRound, uint256 amount);
    event UpdateSeasonRewards(uint256 indexed rewardRound);
    event TokenWithdrawnOwner(uint256 amount);

    error AlreadyClaimed();
    error AmountHigherThanMax();
    error InvalidProof();
    error MerkleRootAlreadyUsed();
    error TooEarlyToWithdraw();

    /**
     * @notice Constructor
     * @param _looksRareToken address of the LooksRare token
     * @param _owner address of the owner
     */
    constructor(address _looksRareToken, address _owner) OwnableTwoSteps(_owner) {
        looksRareToken = _looksRareToken;
        merkleRootUsed[bytes32(0)] = true;
    }

    /**
     * @notice Claim pending rewards
     * @param amount amount to claim
     * @param merkleProof array containing the merkle proof
     */
    function claim(uint256 amount, bytes32[] calldata merkleProof) external whenNotPaused nonReentrant {
        // Verify the reward round is not claimed already
        if (hasUserClaimedForRewardRound[currentRewardRound][msg.sender]) {
            revert AlreadyClaimed();
        }

        (bool claimStatus, uint256 adjustedAmount) = _canClaim(msg.sender, amount, merkleProof);

        if (!claimStatus) {
            revert InvalidProof();
        }
        if (amount > maximumAmountPerUserInCurrentTree) {
            revert AmountHigherThanMax();
        }

        // Set mapping for user and round as true
        hasUserClaimedForRewardRound[currentRewardRound][msg.sender] = true;

        // Adjust amount claimed
        amountClaimedByUser[msg.sender] += adjustedAmount;

        // Transfer adjusted amount
        _executeERC20DirectTransfer(looksRareToken, msg.sender, adjustedAmount);

        emit RewardsClaim(msg.sender, currentRewardRound, adjustedAmount);
    }

    /**
     * @notice Update season rewards with a new merkle root
     * @dev It automatically increments the currentRewardRound
     * @param merkleRoot root of the computed merkle tree
     */
    function updateSeasonRewards(bytes32 merkleRoot, uint256 newMaximumAmountPerUser) external onlyOwner {
        if (merkleRootUsed[merkleRoot]) {
            revert MerkleRootAlreadyUsed();
        }

        currentRewardRound++;
        merkleRootOfRewardRound[currentRewardRound] = merkleRoot;
        merkleRootUsed[merkleRoot] = true;
        maximumAmountPerUserInCurrentTree = newMaximumAmountPerUser;

        emit UpdateSeasonRewards(currentRewardRound);
    }

    /**
     * @notice Pause distribution
     */
    function pauseDistribution() external onlyOwner whenNotPaused {
        lastPausedTimestamp = block.timestamp;
        _pause();
    }

    /**
     * @notice Unpause distribution
     */
    function unpauseDistribution() external onlyOwner whenPaused {
        _unpause();
    }

    /**
     * @notice Transfer LOOKS tokens back to owner
     * @dev It is for emergency purposes
     * @param amount amount to withdraw
     */
    function withdrawTokenRewards(uint256 amount) external onlyOwner whenPaused {
        if (block.timestamp <= (lastPausedTimestamp + BUFFER_ADMIN_WITHDRAW)) {
            revert TooEarlyToWithdraw();
        }
        _executeERC20DirectTransfer(looksRareToken, msg.sender, amount);

        emit TokenWithdrawnOwner(amount);
    }

    /**
     * @notice Check whether it is possible to claim and how much based on previous distribution
     * @param user address of the user
     * @param amount amount to claim
     * @param merkleProof array with the merkle proof
     */
    function canClaim(
        address user,
        uint256 amount,
        bytes32[] calldata merkleProof
    ) external view returns (bool, uint256) {
        return _canClaim(user, amount, merkleProof);
    }

    /**
     * @notice Check whether it is possible to claim and how much based on previous distribution
     * @param user address of the user
     * @param amount amount to claim
     * @param merkleProof array with the merkle proof
     */
    function _canClaim(
        address user,
        uint256 amount,
        bytes32[] calldata merkleProof
    ) internal view returns (bool, uint256) {
        // Compute the node and verify the merkle proof
        bytes32 node = keccak256(bytes.concat(keccak256(abi.encodePacked(user, amount))));

        bool canUserClaim = MerkleProof.verify(merkleProof, merkleRootOfRewardRound[currentRewardRound], node);

        if ((!canUserClaim) || (hasUserClaimedForRewardRound[currentRewardRound][user])) {
            return (false, 0);
        } else {
            return (true, amount - amountClaimedByUser[user]);
        }
    }
}
Pausable.sol 98 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/**
 * @title Pausable
 * @notice This contract makes it possible to pause the contract.
 *         It is adjusted from OpenZeppelin.
 * @author LooksRare protocol team (๐Ÿ‘€,๐Ÿ’Ž)
 */
abstract contract Pausable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    error IsPaused();
    error NotPaused();

    bool private _paused;

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert IsPaused();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert NotPaused();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(msg.sender);
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(msg.sender);
    }
}
OwnableTwoSteps.sol 136 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

// Interfaces
import {IOwnableTwoSteps} from "./interfaces/IOwnableTwoSteps.sol";

/**
 * @title OwnableTwoSteps
 * @notice This contract offers transfer of ownership in two steps with potential owner
 *         having to confirm the transaction to become the owner.
 *         Renouncement of the ownership is also a two-step process since the next potential owner is the address(0).
 * @author LooksRare protocol team (๐Ÿ‘€,๐Ÿ’Ž)
 */
abstract contract OwnableTwoSteps is IOwnableTwoSteps {
    /**
     * @notice Address of the current owner.
     */
    address public owner;

    /**
     * @notice Address of the potential owner.
     */
    address public potentialOwner;

    /**
     * @notice Ownership status.
     */
    Status public ownershipStatus;

    /**
     * @notice Modifier to wrap functions for contracts that inherit this contract.
     */
    modifier onlyOwner() {
        _onlyOwner();
        _;
    }

    /**
     * @notice Constructor
     * @param _owner The contract's owner
     */
    constructor(address _owner) {
        owner = _owner;
        emit NewOwner(_owner);
    }

    /**
     * @notice This function is used to cancel the ownership transfer.
     * @dev This function can be used for both cancelling a transfer to a new owner and
     *      cancelling the renouncement of the ownership.
     */
    function cancelOwnershipTransfer() external onlyOwner {
        Status _ownershipStatus = ownershipStatus;
        if (_ownershipStatus == Status.NoOngoingTransfer) {
            revert NoOngoingTransferInProgress();
        }

        if (_ownershipStatus == Status.TransferInProgress) {
            delete potentialOwner;
        }

        delete ownershipStatus;

        emit CancelOwnershipTransfer();
    }

    /**
     * @notice This function is used to confirm the ownership renouncement.
     */
    function confirmOwnershipRenouncement() external onlyOwner {
        if (ownershipStatus != Status.RenouncementInProgress) {
            revert RenouncementNotInProgress();
        }

        delete owner;
        delete ownershipStatus;

        emit NewOwner(address(0));
    }

    /**
     * @notice This function is used to confirm the ownership transfer.
     * @dev This function can only be called by the current potential owner.
     */
    function confirmOwnershipTransfer() external {
        if (ownershipStatus != Status.TransferInProgress) {
            revert TransferNotInProgress();
        }

        if (msg.sender != potentialOwner) {
            revert WrongPotentialOwner();
        }

        owner = msg.sender;
        delete ownershipStatus;
        delete potentialOwner;

        emit NewOwner(msg.sender);
    }

    /**
     * @notice This function is used to initiate the transfer of ownership to a new owner.
     * @param newPotentialOwner New potential owner address
     */
    function initiateOwnershipTransfer(address newPotentialOwner) external onlyOwner {
        if (ownershipStatus != Status.NoOngoingTransfer) {
            revert TransferAlreadyInProgress();
        }

        ownershipStatus = Status.TransferInProgress;
        potentialOwner = newPotentialOwner;

        /**
         * @dev This function can only be called by the owner, so msg.sender is the owner.
         *      We don't have to SLOAD the owner again.
         */
        emit InitiateOwnershipTransfer(msg.sender, newPotentialOwner);
    }

    /**
     * @notice This function is used to initiate the ownership renouncement.
     */
    function initiateOwnershipRenouncement() external onlyOwner {
        if (ownershipStatus != Status.NoOngoingTransfer) {
            revert TransferAlreadyInProgress();
        }

        ownershipStatus = Status.RenouncementInProgress;

        emit InitiateOwnershipRenouncement();
    }

    function _onlyOwner() private view {
        if (msg.sender != owner) revert NotOwner();
    }
}
ReentrancyGuard.sol 32 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

// Interfaces
import {IReentrancyGuard} from "./interfaces/IReentrancyGuard.sol";

/**
 * @title ReentrancyGuard
 * @notice This contract protects against reentrancy attacks.
 *         It is adjusted from OpenZeppelin.
 * @author LooksRare protocol team (๐Ÿ‘€,๐Ÿ’Ž)
 */
abstract contract ReentrancyGuard is IReentrancyGuard {
    uint256 private _status;

    /**
     * @notice Modifier to wrap functions to prevent reentrancy calls.
     */
    modifier nonReentrant() {
        if (_status == 2) {
            revert ReentrancyFail();
        }

        _status = 2;
        _;
        _status = 1;
    }

    constructor() {
        _status = 1;
    }
}
MerkleProof.sol 52 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }
        return computedHash;
    }
}
GenericErrors.sol 7 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/**
 * @notice It is emitted if the call recipient is not a contract.
 */
error NotAContract();
LowLevelErrors.sol 37 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/**
 * @notice It is emitted if the ETH transfer fails.
 */
error ETHTransferFail();

/**
 * @notice It is emitted if the ERC20 approval fails.
 */
error ERC20ApprovalFail();

/**
 * @notice It is emitted if the ERC20 transfer fails.
 */
error ERC20TransferFail();

/**
 * @notice It is emitted if the ERC20 transferFrom fails.
 */
error ERC20TransferFromFail();

/**
 * @notice It is emitted if the ERC721 transferFrom fails.
 */
error ERC721TransferFromFail();

/**
 * @notice It is emitted if the ERC1155 safeTransferFrom fails.
 */
error ERC1155SafeTransferFromFail();

/**
 * @notice It is emitted if the ERC1155 safeBatchTransferFrom fails.
 */
error ERC1155SafeBatchTransferFromFail();
IERC20.sol 20 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(address indexed owner, address indexed spender, uint256 value);

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    function transfer(address to, uint256 amount) external returns (bool);

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
IOwnableTwoSteps.sol 76 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/**
 * @title IOwnableTwoSteps
 * @author LooksRare protocol team (๐Ÿ‘€,๐Ÿ’Ž)
 */
interface IOwnableTwoSteps {
    /**
     * @notice This enum keeps track of the ownership status.
     * @param NoOngoingTransfer The default status when the owner is set
     * @param TransferInProgress The status when a transfer to a new owner is initialized
     * @param RenouncementInProgress The status when a transfer to address(0) is initialized
     */
    enum Status {
        NoOngoingTransfer,
        TransferInProgress,
        RenouncementInProgress
    }

    /**
     * @notice This is returned when there is no transfer of ownership in progress.
     */
    error NoOngoingTransferInProgress();

    /**
     * @notice This is returned when the caller is not the owner.
     */
    error NotOwner();

    /**
     * @notice This is returned when there is no renouncement in progress but
     *         the owner tries to validate the ownership renouncement.
     */
    error RenouncementNotInProgress();

    /**
     * @notice This is returned when the transfer is already in progress but the owner tries
     *         initiate a new ownership transfer.
     */
    error TransferAlreadyInProgress();

    /**
     * @notice This is returned when there is no ownership transfer in progress but the
     *         ownership change tries to be approved.
     */
    error TransferNotInProgress();

    /**
     * @notice This is returned when the ownership transfer is attempted to be validated by the
     *         a caller that is not the potential owner.
     */
    error WrongPotentialOwner();

    /**
     * @notice This is emitted if the ownership transfer is cancelled.
     */
    event CancelOwnershipTransfer();

    /**
     * @notice This is emitted if the ownership renouncement is initiated.
     */
    event InitiateOwnershipRenouncement();

    /**
     * @notice This is emitted if the ownership transfer is initiated.
     * @param previousOwner Previous/current owner
     * @param potentialOwner Potential/future owner
     */
    event InitiateOwnershipTransfer(address previousOwner, address potentialOwner);

    /**
     * @notice This is emitted when there is a new owner.
     */
    event NewOwner(address newOwner);
}
IReentrancyGuard.sol 13 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/**
 * @title IReentrancyGuard
 * @author LooksRare protocol team (๐Ÿ‘€,๐Ÿ’Ž)
 */
interface IReentrancyGuard {
    /**
     * @notice This is returned when there is a reentrant call.
     */
    error ReentrancyFail();
}
LowLevelERC20Transfer.sol 65 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

// Interfaces
import {IERC20} from "../interfaces/generic/IERC20.sol";

// Errors
import {ERC20TransferFail, ERC20TransferFromFail} from "../errors/LowLevelErrors.sol";
import {NotAContract} from "../errors/GenericErrors.sol";

/**
 * @title LowLevelERC20Transfer
 * @notice This contract contains low-level calls to transfer ERC20 tokens.
 * @author LooksRare protocol team (๐Ÿ‘€,๐Ÿ’Ž)
 */
contract LowLevelERC20Transfer {
    /**
     * @notice Execute ERC20 transferFrom
     * @param currency Currency address
     * @param from Sender address
     * @param to Recipient address
     * @param amount Amount to transfer
     */
    function _executeERC20TransferFrom(address currency, address from, address to, uint256 amount) internal {
        if (currency.code.length == 0) {
            revert NotAContract();
        }

        (bool status, bytes memory data) = currency.call(abi.encodeCall(IERC20.transferFrom, (from, to, amount)));

        if (!status) {
            revert ERC20TransferFromFail();
        }

        if (data.length > 0) {
            if (!abi.decode(data, (bool))) {
                revert ERC20TransferFromFail();
            }
        }
    }

    /**
     * @notice Execute ERC20 (direct) transfer
     * @param currency Currency address
     * @param to Recipient address
     * @param amount Amount to transfer
     */
    function _executeERC20DirectTransfer(address currency, address to, uint256 amount) internal {
        if (currency.code.length == 0) {
            revert NotAContract();
        }

        (bool status, bytes memory data) = currency.call(abi.encodeCall(IERC20.transfer, (to, amount)));

        if (!status) {
            revert ERC20TransferFail();
        }

        if (data.length > 0) {
            if (!abi.decode(data, (bool))) {
                revert ERC20TransferFail();
            }
        }
    }
}

Read Contract

BUFFER_ADMIN_WITHDRAW 0x141fd8c8 → uint256
amountClaimedByUser 0x3b66f49d → uint256
canClaim 0xdc38bdb5 → bool, uint256
currentRewardRound 0x1040faf9 → uint256
hasUserClaimedForRewardRound 0x9ea76f34 → bool
lastPausedTimestamp 0xfa461974 → uint256
looksRareToken 0x36db9fb2 → address
maximumAmountPerUserInCurrentTree 0xff0a4eb0 → uint256
merkleRootOfRewardRound 0x84483c86 → bytes32
merkleRootUsed 0xba42590d → bool
owner 0x8da5cb5b → address
ownershipStatus 0x2bb5a9e6 → uint8
paused 0x5c975abb → bool
potentialOwner 0x7762df25 → address

Write Contract 10 functions

These functions modify contract state and require a wallet transaction to execute.

cancelOwnershipTransfer 0x23452b9c
No parameters
claim 0x2f52ebb7
uint256 amount
bytes32[] merkleProof
confirmOwnershipRenouncement 0x3e567539
No parameters
confirmOwnershipTransfer 0x7200b829
No parameters
initiateOwnershipRenouncement 0x5b6ac011
No parameters
initiateOwnershipTransfer 0xc0b6f561
address newPotentialOwner
pauseDistribution 0x31cec7a3
No parameters
unpauseDistribution 0xb94ec9d0
No parameters
updateSeasonRewards 0x8df9288b
bytes32 merkleRoot
uint256 newMaximumAmountPerUser
withdrawTokenRewards 0x8923e2f7
uint256 amount

Recent Transactions

No transactions found for this address