ETH Price: $1,974.93 (+1.40%)

Contract

0x1DF62622F2FA840eD0708a52B67b89f48bAD806b

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Stake Ballot1215647672023-08-15 7:49:40911 days ago1692085780IN
0x1DF62622...48bAD806b
0 ETH0.000050530.1
Stake Ballot1030422532023-06-20 9:27:44967 days ago1687253264IN
0x1DF62622...48bAD806b
0 ETH0.000048980.1
Stake Ballot958433612023-05-30 1:32:56989 days ago1685410376IN
0x1DF62622...48bAD806b
0 ETH0.000067830.1
Stake Ballot956657882023-05-29 13:00:34989 days ago1685365234IN
0x1DF62622...48bAD806b
0 ETH0.000088390.1
Stake Ballot944056542023-05-25 20:43:50993 days ago1685047430IN
0x1DF62622...48bAD806b
0 ETH0.000087150.1
Stake Ballot937569492023-05-23 23:24:49995 days ago1684884289IN
0x1DF62622...48bAD806b
0 ETH0.00010180.1
Stake Ballot910062262023-05-15 16:51:071003 days ago1684169467IN
0x1DF62622...48bAD806b
0 ETH0.000194410.1
Stake Ballot887081252023-05-08 21:59:071010 days ago1683583147IN
0x1DF62622...48bAD806b
0 ETH0.000198350.1
Stake Ballot870332152023-05-04 0:14:471015 days ago1683159287IN
0x1DF62622...48bAD806b
0 ETH0.000142220.1
Stake Ballot811865772023-04-16 21:56:071032 days ago1681682167IN
0x1DF62622...48bAD806b
0 ETH0.000088010.1
Stake Ballot806785812023-04-15 10:34:351033 days ago1681554875IN
0x1DF62622...48bAD806b
0 ETH0.000061040.1
Stake Ballot794339262023-04-11 18:59:331037 days ago1681239573IN
0x1DF62622...48bAD806b
0 ETH0.000107250.1
Stake Ballot794077592023-04-11 17:09:431037 days ago1681232983IN
0x1DF62622...48bAD806b
0 ETH0.000081080.1
Stake Ballot789412972023-04-10 8:36:021038 days ago1681115762IN
0x1DF62622...48bAD806b
0 ETH0.000061990.1
Stake Ballot762184982023-04-02 8:56:271046 days ago1680425787IN
0x1DF62622...48bAD806b
0 ETH0.00005520.1
Stake Ballot760570052023-04-01 21:14:371047 days ago1680383677IN
0x1DF62622...48bAD806b
0 ETH0.000058850.1
Stake Ballot755029102023-03-31 6:13:521049 days ago1680243232IN
0x1DF62622...48bAD806b
0 ETH0.000057370.1
Stake Ballot755026182023-03-31 6:12:391049 days ago1680243159IN
0x1DF62622...48bAD806b
0 ETH0.00005840.1
Stake Ballot755018242023-03-31 6:09:201049 days ago1680242960IN
0x1DF62622...48bAD806b
0 ETH0.000057370.1
Stake Ballot751429712023-03-30 5:11:211050 days ago1680153081IN
0x1DF62622...48bAD806b
0 ETH0.000078750.1
Stake Ballot746043402023-03-28 15:24:441051 days ago1680017084IN
0x1DF62622...48bAD806b
0 ETH0.000080150.1
Stake Ballot746042202023-03-28 15:24:141051 days ago1680017054IN
0x1DF62622...48bAD806b
0 ETH0.000082890.1
Stake Ballot743386842023-03-27 20:51:451052 days ago1679950305IN
0x1DF62622...48bAD806b
0 ETH0.000144750.1
Stake Ballot741777952023-03-27 9:45:221052 days ago1679910322IN
0x1DF62622...48bAD806b
0 ETH0.000059750.1
Stake Ballot740548742023-03-27 1:17:531053 days ago1679879873IN
0x1DF62622...48bAD806b
0 ETH0.000046760.1
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GeneralsAmuletStaker

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../ManagerModifier.sol";

contract GeneralsAmuletStaker is ManagerModifier {
    using EnumerableSet for EnumerableSet.UintSet;
    IERC721 public ballotContract;
    IERC721 public generalContract;

    mapping(uint256 => string) public amulets;
    mapping(uint256 => uint256) public generalAmulet;

    // Mapping to hold the staked tokens for a user
    mapping(address => EnumerableSet.UintSet) internal userBallotsStaked;

    // Boolean flag to allow unstaking of the ballot token
    bool public allowUnstake = false;

    event AmuletChanged(uint256 amuletId, string amuleName);
    event AmuletAdded(uint256 amuletId, string amuleName);
    event AmuletRemoved(uint256 amuletId);

    constructor(
        address _manager,
        address _ballotContract,
        address _generalContract
    ) ManagerModifier(_manager) {
        ballotContract = IERC721(_ballotContract);
        generalContract = IERC721(_generalContract);
    }

    // Function to allow the manager to allow unstaking of the ballot token
    function setAllowUnstake(bool _allowUnstake) external onlyManager {
        allowUnstake = _allowUnstake;
    }

    function stakeBallot(
        uint256 _ballotId,
        uint256 _generalTokenId,
        uint256 _amuletId
    ) external {
        require(
            keccak256(abi.encodePacked(amulets[_amuletId])) !=
                keccak256(abi.encodePacked("")),
            "Invalid amulet ID"
        );

        // Require that the user owns the general token
        require(
            generalContract.ownerOf(_generalTokenId) == msg.sender,
            "User does not own general token"
        );

        ballotContract.transferFrom(msg.sender, address(this), _ballotId);

        generalAmulet[_generalTokenId] = _amuletId;
        userBallotsStaked[msg.sender].add(_ballotId);
    }

    // Function to unstake, checks that the unstaking is allowed
    function unstakeBallot(uint256 _ballotId) external {
        require(allowUnstake, "Unstaking not allowed");
        require(
            userBallotsStaked[msg.sender].contains(_ballotId),
            "Ballot not staked"
        );

        ballotContract.transferFrom(address(this), msg.sender, _ballotId);
        userBallotsStaked[msg.sender].remove(_ballotId);
    }

    // Allowed amulets modifiers
    function addAmulet(
        uint256 _amuletId,
        string memory _property
    ) external onlyManager {
        amulets[_amuletId] = _property;
        emit AmuletAdded(_amuletId, _property);
    }

    function removeAmulet(uint256 _amuletId) external onlyManager {
        delete amulets[_amuletId];
        emit AmuletRemoved(_amuletId);
    }

    function changeAmulet(
        uint256 _amuletId,
        string memory _property
    ) external onlyManager {
        amulets[_amuletId] = _property;
        emit AmuletChanged(_amuletId, _property);
    }

    function getGeneralAmulet(uint256 _generalTokenId)
        external
        view
        returns (string memory)
    {
        return amulets[generalAmulet[_generalTokenId]];
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

pragma solidity ^0.8.17;

interface IManager {
  function isAdmin(address _addr) external view returns (bool);

  function isManager(address _addr, uint256 _type) external view returns (bool);

  function addManager(address _addr, uint256 _type) external;

  function removeManager(address _addr, uint256 _type) external;

  function addAdmin(address _addr) external;

  function removeAdmin(address _addr) external;
}

File 6 of 6 : ManagerModifier.sol
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.17;

import "./interfaces/ITokenManager.sol";

abstract contract ManagerModifier {
  //=======================================
  // Immutables
  //=======================================
  IManager public immutable MANAGER;

  //=======================================
  // Constructor
  //=======================================
  constructor(address _manager) {
    MANAGER = IManager(_manager);
  }

  //=======================================
  // Modifiers
  //=======================================
  modifier onlyAdmin() {
    require(MANAGER.isAdmin(msg.sender), "Manager: Not an Admin");
    _;
  }

  modifier onlyManager() {
    require(MANAGER.isManager(msg.sender, 0), "Manager: Not manager");
    _;
  }

  modifier onlyMinter() {
    require(MANAGER.isManager(msg.sender, 1), "Manager: Not minter");
    _;
  }

  modifier onlyTokenMinter() {
    require(MANAGER.isManager(msg.sender, 2), "Manager: Not token minter");
    _;
  }

  modifier onlyBinder() {
    require(MANAGER.isManager(msg.sender, 3), "Manager: Not binder");
    _;
  }

  modifier onlyOracle() {
    require(MANAGER.isManager(msg.sender, 4), "Manager: Not oracle");
    _;
  }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_manager","type":"address"},{"internalType":"address","name":"_ballotContract","type":"address"},{"internalType":"address","name":"_generalContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amuletId","type":"uint256"},{"indexed":false,"internalType":"string","name":"amuleName","type":"string"}],"name":"AmuletAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amuletId","type":"uint256"},{"indexed":false,"internalType":"string","name":"amuleName","type":"string"}],"name":"AmuletChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amuletId","type":"uint256"}],"name":"AmuletRemoved","type":"event"},{"inputs":[],"name":"MANAGER","outputs":[{"internalType":"contract IManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amuletId","type":"uint256"},{"internalType":"string","name":"_property","type":"string"}],"name":"addAmulet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allowUnstake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"amulets","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ballotContract","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amuletId","type":"uint256"},{"internalType":"string","name":"_property","type":"string"}],"name":"changeAmulet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"generalAmulet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"generalContract","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_generalTokenId","type":"uint256"}],"name":"getGeneralAmulet","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amuletId","type":"uint256"}],"name":"removeAmulet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_allowUnstake","type":"bool"}],"name":"setAllowUnstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ballotId","type":"uint256"},{"internalType":"uint256","name":"_generalTokenId","type":"uint256"},{"internalType":"uint256","name":"_amuletId","type":"uint256"}],"name":"stakeBallot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ballotId","type":"uint256"}],"name":"unstakeBallot","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040526005805460ff1916905534801561001a57600080fd5b506040516111863803806111868339810160408190526100399161008b565b6001600160a01b03928316608052600080549284166001600160a01b0319938416179055600180549190931691161790556100ce565b80516001600160a01b038116811461008657600080fd5b919050565b6000806000606084860312156100a057600080fd5b6100a98461006f565b92506100b76020850161006f565b91506100c56040850161006f565b90509250925092565b60805161108161010560003960008181610102015281816102ea015281816105ce0152818161086b015261096301526110816000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806379abfd771161008c578063a9e6068011610066578063a9e60680146101de578063af2da0ec146101f1578063ca4ea5de14610204578063de190da41461021757600080fd5b806379abfd77146101a557806388e1b7db146101b857806391645ec8146101cb57600080fd5b80630db2e7e7146100d45780631b2df850146100fd57806330d17c671461013c5780636e3828ba1461014f5780637831819d1461017d57806379080d9214610190575b600080fd5b6100e76100e2366004610c09565b610234565b6040516100f49190610c68565b60405180910390f35b6101247f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100f4565b600154610124906001600160a01b031681565b61016f61015d366004610c09565b60036020526000908152604090205481565b6040519081526020016100f4565b600054610124906001600160a01b031681565b6101a361019e366004610c91565b6102ce565b005b6100e76101b3366004610c09565b6103d8565b6101a36101c6366004610c09565b610487565b6101a36101d9366004610d5a565b6105b2565b6101a36101ec366004610d7e565b610670565b6101a36101ff366004610c09565b61084f565b6101a3610212366004610c91565b610947565b6005546102249060ff1681565b60405190151581526020016100f4565b6002602052600090815260409020805461024d90610daa565b80601f016020809104026020016040519081016040528092919081815260200182805461027990610daa565b80156102c65780601f1061029b576101008083540402835291602001916102c6565b820191906000526020600020905b8154815290600101906020018083116102a957829003601f168201915b505050505081565b6040516365e6a4df60e11b8152336004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cbcd49be90604401602060405180830381865afa158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d9190610de4565b6103825760405162461bcd60e51b815260040161037990610e01565b60405180910390fd5b600082815260026020526040902061039a8282610e7e565b507fa69fe1d4bc19ba1d2e7aff899c0d0123f07c38e4104784a8fbd28782d5c76e4482826040516103cc929190610f3e565b60405180910390a15050565b60008181526003602090815260408083205483526002909152902080546060919061040290610daa565b80601f016020809104026020016040519081016040528092919081815260200182805461042e90610daa565b801561047b5780601f106104505761010080835404028352916020019161047b565b820191906000526020600020905b81548152906001019060200180831161045e57829003601f168201915b50505050509050919050565b60055460ff166104d15760405162461bcd60e51b8152602060048201526015602482015274155b9cdd185ada5b99c81b9bdd08185b1b1bddd959605a1b6044820152606401610379565b3360009081526004602052604090206104ea9082610a3c565b61052a5760405162461bcd60e51b815260206004820152601160248201527010985b1b1bdd081b9bdd081cdd185ad959607a1b6044820152606401610379565b6000546040516323b872dd60e01b8152306004820152336024820152604481018390526001600160a01b03909116906323b872dd90606401600060405180830381600087803b15801561057c57600080fd5b505af1158015610590573d6000803e3d6000fd5b50503360009081526004602052604090206105ae9250905082610a59565b5050565b6040516365e6a4df60e11b8152336004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cbcd49be90604401602060405180830381865afa15801561061d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106419190610de4565b61065d5760405162461bcd60e51b815260040161037990610e01565b6005805460ff1916911515919091179055565b604080516000808252602080830180855283519020858352600290915290839020909261069d9201610f5f565b60405160208183030381529060405280519060200120036106f45760405162461bcd60e51b8152602060048201526011602482015270125b9d985b1a5908185b5d5b195d081251607a1b6044820152606401610379565b6001546040516331a9108f60e11b81526004810184905233916001600160a01b031690636352211e90602401602060405180830381865afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610fd5565b6001600160a01b0316146107b75760405162461bcd60e51b815260206004820152601f60248201527f5573657220646f6573206e6f74206f776e2067656e6572616c20746f6b656e006044820152606401610379565b6000546040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b03909116906323b872dd90606401600060405180830381600087803b15801561080957600080fd5b505af115801561081d573d6000803e3d6000fd5b505050600083815260036020908152604080832085905533835260049091529020610849915084610a65565b50505050565b6040516365e6a4df60e11b8152336004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cbcd49be90604401602060405180830381865afa1580156108ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108de9190610de4565b6108fa5760405162461bcd60e51b815260040161037990610e01565b600081815260026020526040812061091191610bb3565b6040518181527f75342c673737bc5fcf2373ca47b0fb161ee9124dec25f85d813e8cb8cdf6c1669060200160405180910390a150565b6040516365e6a4df60e11b8152336004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cbcd49be90604401602060405180830381865afa1580156109b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d69190610de4565b6109f25760405162461bcd60e51b815260040161037990610e01565b6000828152600260205260409020610a0a8282610e7e565b507f55a6d32f929cac96a5f69b65c69e1ae01b738885e17c9c831338fcb9c76525f982826040516103cc929190610f3e565b600081815260018301602052604081205415155b90505b92915050565b6000610a508383610a71565b6000610a508383610b64565b60008181526001830160205260408120548015610b5a576000610a95600183610ffe565b8554909150600090610aa990600190610ffe565b9050818114610b0e576000866000018281548110610ac957610ac961101f565b9060005260206000200154905080876000018481548110610aec57610aec61101f565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610b1f57610b1f611035565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a53565b6000915050610a53565b6000818152600183016020526040812054610bab57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a53565b506000610a53565b508054610bbf90610daa565b6000825580601f10610bcf575050565b601f016020900490600052602060002090810190610bed9190610bf0565b50565b5b80821115610c055760008155600101610bf1565b5090565b600060208284031215610c1b57600080fd5b5035919050565b6000815180845260005b81811015610c4857602081850181015186830182015201610c2c565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610a506020830184610c22565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610ca457600080fd5b82359150602083013567ffffffffffffffff80821115610cc357600080fd5b818501915085601f830112610cd757600080fd5b813581811115610ce957610ce9610c7b565b604051601f8201601f19908116603f01168101908382118183101715610d1157610d11610c7b565b81604052828152886020848701011115610d2a57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b8015158114610bed57600080fd5b600060208284031215610d6c57600080fd5b8135610d7781610d4c565b9392505050565b600080600060608486031215610d9357600080fd5b505081359360208301359350604090920135919050565b600181811c90821680610dbe57607f821691505b602082108103610dde57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215610df657600080fd5b8151610d7781610d4c565b60208082526014908201527326b0b730b3b2b91d102737ba1036b0b730b3b2b960611b604082015260600190565b601f821115610e7957600081815260208120601f850160051c81016020861015610e565750805b601f850160051c820191505b81811015610e7557828155600101610e62565b5050505b505050565b815167ffffffffffffffff811115610e9857610e98610c7b565b610eac81610ea68454610daa565b84610e2f565b602080601f831160018114610ee15760008415610ec95750858301515b600019600386901b1c1916600185901b178555610e75565b600085815260208120601f198616915b82811015610f1057888601518255948401946001909101908401610ef1565b5085821015610f2e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b828152604060208201526000610f576040830184610c22565b949350505050565b6000808354610f6d81610daa565b60018281168015610f855760018114610f9a57610fc9565b60ff1984168752821515830287019450610fc9565b8760005260208060002060005b85811015610fc05781548a820152908401908201610fa7565b50505082870194505b50929695505050505050565b600060208284031215610fe757600080fd5b81516001600160a01b0381168114610d7757600080fd5b81810381811115610a5357634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fdfea264697066735822122061c5a021a2c8f951607cfa41546abb306d3dd3f380963b6b23aa764ef4f2d55b64736f6c634300081100330000000000000000000000008937ff68da18e97b58109b598a6f0ebbf82da3e20000000000000000000000009fe6688e7d4bfbc69fe2727f578b1f1b8c75b9300000000000000000000000001aaec0fa487a979a3f6b46dccf0ac2648167a61e

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806379abfd771161008c578063a9e6068011610066578063a9e60680146101de578063af2da0ec146101f1578063ca4ea5de14610204578063de190da41461021757600080fd5b806379abfd77146101a557806388e1b7db146101b857806391645ec8146101cb57600080fd5b80630db2e7e7146100d45780631b2df850146100fd57806330d17c671461013c5780636e3828ba1461014f5780637831819d1461017d57806379080d9214610190575b600080fd5b6100e76100e2366004610c09565b610234565b6040516100f49190610c68565b60405180910390f35b6101247f0000000000000000000000008937ff68da18e97b58109b598a6f0ebbf82da3e281565b6040516001600160a01b0390911681526020016100f4565b600154610124906001600160a01b031681565b61016f61015d366004610c09565b60036020526000908152604090205481565b6040519081526020016100f4565b600054610124906001600160a01b031681565b6101a361019e366004610c91565b6102ce565b005b6100e76101b3366004610c09565b6103d8565b6101a36101c6366004610c09565b610487565b6101a36101d9366004610d5a565b6105b2565b6101a36101ec366004610d7e565b610670565b6101a36101ff366004610c09565b61084f565b6101a3610212366004610c91565b610947565b6005546102249060ff1681565b60405190151581526020016100f4565b6002602052600090815260409020805461024d90610daa565b80601f016020809104026020016040519081016040528092919081815260200182805461027990610daa565b80156102c65780601f1061029b576101008083540402835291602001916102c6565b820191906000526020600020905b8154815290600101906020018083116102a957829003601f168201915b505050505081565b6040516365e6a4df60e11b8152336004820152600060248201527f0000000000000000000000008937ff68da18e97b58109b598a6f0ebbf82da3e26001600160a01b03169063cbcd49be90604401602060405180830381865afa158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d9190610de4565b6103825760405162461bcd60e51b815260040161037990610e01565b60405180910390fd5b600082815260026020526040902061039a8282610e7e565b507fa69fe1d4bc19ba1d2e7aff899c0d0123f07c38e4104784a8fbd28782d5c76e4482826040516103cc929190610f3e565b60405180910390a15050565b60008181526003602090815260408083205483526002909152902080546060919061040290610daa565b80601f016020809104026020016040519081016040528092919081815260200182805461042e90610daa565b801561047b5780601f106104505761010080835404028352916020019161047b565b820191906000526020600020905b81548152906001019060200180831161045e57829003601f168201915b50505050509050919050565b60055460ff166104d15760405162461bcd60e51b8152602060048201526015602482015274155b9cdd185ada5b99c81b9bdd08185b1b1bddd959605a1b6044820152606401610379565b3360009081526004602052604090206104ea9082610a3c565b61052a5760405162461bcd60e51b815260206004820152601160248201527010985b1b1bdd081b9bdd081cdd185ad959607a1b6044820152606401610379565b6000546040516323b872dd60e01b8152306004820152336024820152604481018390526001600160a01b03909116906323b872dd90606401600060405180830381600087803b15801561057c57600080fd5b505af1158015610590573d6000803e3d6000fd5b50503360009081526004602052604090206105ae9250905082610a59565b5050565b6040516365e6a4df60e11b8152336004820152600060248201527f0000000000000000000000008937ff68da18e97b58109b598a6f0ebbf82da3e26001600160a01b03169063cbcd49be90604401602060405180830381865afa15801561061d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106419190610de4565b61065d5760405162461bcd60e51b815260040161037990610e01565b6005805460ff1916911515919091179055565b604080516000808252602080830180855283519020858352600290915290839020909261069d9201610f5f565b60405160208183030381529060405280519060200120036106f45760405162461bcd60e51b8152602060048201526011602482015270125b9d985b1a5908185b5d5b195d081251607a1b6044820152606401610379565b6001546040516331a9108f60e11b81526004810184905233916001600160a01b031690636352211e90602401602060405180830381865afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610fd5565b6001600160a01b0316146107b75760405162461bcd60e51b815260206004820152601f60248201527f5573657220646f6573206e6f74206f776e2067656e6572616c20746f6b656e006044820152606401610379565b6000546040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b03909116906323b872dd90606401600060405180830381600087803b15801561080957600080fd5b505af115801561081d573d6000803e3d6000fd5b505050600083815260036020908152604080832085905533835260049091529020610849915084610a65565b50505050565b6040516365e6a4df60e11b8152336004820152600060248201527f0000000000000000000000008937ff68da18e97b58109b598a6f0ebbf82da3e26001600160a01b03169063cbcd49be90604401602060405180830381865afa1580156108ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108de9190610de4565b6108fa5760405162461bcd60e51b815260040161037990610e01565b600081815260026020526040812061091191610bb3565b6040518181527f75342c673737bc5fcf2373ca47b0fb161ee9124dec25f85d813e8cb8cdf6c1669060200160405180910390a150565b6040516365e6a4df60e11b8152336004820152600060248201527f0000000000000000000000008937ff68da18e97b58109b598a6f0ebbf82da3e26001600160a01b03169063cbcd49be90604401602060405180830381865afa1580156109b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d69190610de4565b6109f25760405162461bcd60e51b815260040161037990610e01565b6000828152600260205260409020610a0a8282610e7e565b507f55a6d32f929cac96a5f69b65c69e1ae01b738885e17c9c831338fcb9c76525f982826040516103cc929190610f3e565b600081815260018301602052604081205415155b90505b92915050565b6000610a508383610a71565b6000610a508383610b64565b60008181526001830160205260408120548015610b5a576000610a95600183610ffe565b8554909150600090610aa990600190610ffe565b9050818114610b0e576000866000018281548110610ac957610ac961101f565b9060005260206000200154905080876000018481548110610aec57610aec61101f565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610b1f57610b1f611035565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a53565b6000915050610a53565b6000818152600183016020526040812054610bab57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a53565b506000610a53565b508054610bbf90610daa565b6000825580601f10610bcf575050565b601f016020900490600052602060002090810190610bed9190610bf0565b50565b5b80821115610c055760008155600101610bf1565b5090565b600060208284031215610c1b57600080fd5b5035919050565b6000815180845260005b81811015610c4857602081850181015186830182015201610c2c565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610a506020830184610c22565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215610ca457600080fd5b82359150602083013567ffffffffffffffff80821115610cc357600080fd5b818501915085601f830112610cd757600080fd5b813581811115610ce957610ce9610c7b565b604051601f8201601f19908116603f01168101908382118183101715610d1157610d11610c7b565b81604052828152886020848701011115610d2a57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b8015158114610bed57600080fd5b600060208284031215610d6c57600080fd5b8135610d7781610d4c565b9392505050565b600080600060608486031215610d9357600080fd5b505081359360208301359350604090920135919050565b600181811c90821680610dbe57607f821691505b602082108103610dde57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215610df657600080fd5b8151610d7781610d4c565b60208082526014908201527326b0b730b3b2b91d102737ba1036b0b730b3b2b960611b604082015260600190565b601f821115610e7957600081815260208120601f850160051c81016020861015610e565750805b601f850160051c820191505b81811015610e7557828155600101610e62565b5050505b505050565b815167ffffffffffffffff811115610e9857610e98610c7b565b610eac81610ea68454610daa565b84610e2f565b602080601f831160018114610ee15760008415610ec95750858301515b600019600386901b1c1916600185901b178555610e75565b600085815260208120601f198616915b82811015610f1057888601518255948401946001909101908401610ef1565b5085821015610f2e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b828152604060208201526000610f576040830184610c22565b949350505050565b6000808354610f6d81610daa565b60018281168015610f855760018114610f9a57610fc9565b60ff1984168752821515830287019450610fc9565b8760005260208060002060005b85811015610fc05781548a820152908401908201610fa7565b50505082870194505b50929695505050505050565b600060208284031215610fe757600080fd5b81516001600160a01b0381168114610d7757600080fd5b81810381811115610a5357634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fdfea264697066735822122061c5a021a2c8f951607cfa41546abb306d3dd3f380963b6b23aa764ef4f2d55b64736f6c63430008110033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000008937ff68da18e97b58109b598a6f0ebbf82da3e20000000000000000000000009fe6688e7d4bfbc69fe2727f578b1f1b8c75b9300000000000000000000000001aaec0fa487a979a3f6b46dccf0ac2648167a61e

-----Decoded View---------------
Arg [0] : _manager (address): 0x8937fF68da18e97B58109b598a6f0EbbF82DA3E2
Arg [1] : _ballotContract (address): 0x9FE6688e7d4BFbC69fE2727f578B1f1b8c75B930
Arg [2] : _generalContract (address): 0x1aaEC0Fa487A979A3F6B46DCCf0aC2648167a61E

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000008937ff68da18e97b58109b598a6f0ebbf82da3e2
Arg [1] : 0000000000000000000000009fe6688e7d4bfbc69fe2727f578b1f1b8c75b930
Arg [2] : 0000000000000000000000001aaec0fa487a979a3f6b46dccf0ac2648167a61e


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
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.