Contract 0xd967678Ece2eC0AfA74A3e2e3129dD2da912cA55

Contract Overview

Balance:
0 BTT
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xd39f477ccba34afdd9db3e77084b326636723b8e3be80cd6ff01bc8995f1d6400x60a06040148422122022-11-22 8:05:5576 days 10 hrs ago0x31003c2d5685c7d28d7174c3255307eb9a0f3015 IN  Create: Periphery20 BTT644.4423
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Periphery2

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 2 of 7 : IERC721.sol
// 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);
}

File 3 of 7 : IERC165.sol
// 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);
}

File 4 of 7 : IERC3525.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/**
 * @title ERC-3525 Semi-Fungible Token Standard
 * @dev See https://eips.ethereum.org/EIPS/eip-3525
 * Note: the ERC-165 identifier for this interface is 0xc97ae3d5.
 */
interface IERC3525 is IERC165, IERC721 {
    /**
     * @dev MUST emit when value of a token is transferred to another token with the same slot,
     *  including zero value transfers (_value == 0) as well as transfers when tokens are created
     *  (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).
     * @param _fromTokenId The token id to transfer value from
     * @param _toTokenId The token id to transfer value to
     * @param _value The transferred value
     */
    event TransferValue(
        uint256 indexed _fromTokenId,
        uint256 indexed _toTokenId,
        uint256 _value
    );

    /**
     * @dev MUST emits when the approval value of a token is set or changed.
     * @param _tokenId The token to approve
     * @param _operator The operator to approve for
     * @param _value The maximum value that `_operator` is allowed to manage
     */
    event ApprovalValue(
        uint256 indexed _tokenId,
        address indexed _operator,
        uint256 _value
    );

    /**
     * @dev MUST emit when the slot of a token is set or changed.
     * @param _tokenId The token of which slot is set or changed
     * @param _oldSlot The previous slot of the token
     * @param _newSlot The updated slot of the token
     */
    event SlotChanged(
        uint256 indexed _tokenId,
        uint256 indexed _oldSlot,
        uint256 indexed _newSlot
    );

    /**
     * @notice Get the number of decimals the token uses for value - e.g. 6, means the user
     *  representation of the value of a token can be calculated by dividing it by 1,000,000.
     *  Considering the compatibility with third-party wallets, this function is defined as
     *  `valueDecimals()` instead of `decimals()` to avoid conflict with ERC20 tokens.
     * @return The number of decimals for value
     */
    function valueDecimals() external view returns (uint8);

    /**
     * @notice Get the value of a token.
     * @param _tokenId The token for which to query the balance
     * @return The value of `_tokenId`
     */
    function balanceOf(uint256 _tokenId) external view returns (uint256);

    /**
     * @notice Get the slot of a token.
     * @param _tokenId The identifier for a token
     * @return The slot of the token
     */
    function slotOf(uint256 _tokenId) external view returns (uint256);

    /**
     * @notice Allow an operator to manage the value of a token, up to the `_value` amount.
     * @dev MUST revert unless caller is the current owner, an authorized operator, or the approved
     *  address for `_tokenId`.
     *  MUST emit ApprovalValue event.
     * @param _tokenId The token to approve
     * @param _operator The operator to be approved
     * @param _value The maximum value of `_toTokenId` that `_operator` is allowed to manage
     */
    function approve(
        uint256 _tokenId,
        address _operator,
        uint256 _value
    ) external;

    /**
     * @notice Get the maximum value of a token that an operator is allowed to manage.
     * @param _tokenId The token for which to query the allowance
     * @param _operator The address of an operator
     * @return The current approval value of `_tokenId` that `_operator` is allowed to manage
     */
    function allowance(
        uint256 _tokenId,
        address _operator
    ) external view returns (uint256);

    /**
     * @notice Transfer value from a specified token to another specified token with the same slot.
     * @dev Caller MUST be the current owner, an authorized operator or an operator who has been
     *  approved the whole `_fromTokenId` or part of it.
     *  MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.
     *  MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.
     *  MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the
     *  operator.
     *  MUST emit `TransferValue` event.
     * @param _fromTokenId The token to transfer value from
     * @param _toTokenId The token to transfer value to
     * @param _value The transferred value
     */
    function transferFrom(
        uint256 _fromTokenId,
        uint256 _toTokenId,
        uint256 _value
    ) external;

    /**
     * @notice Transfer value from a specified token to an address. The caller should confirm that
     *  `_to` is capable of receiving ERC3525 tokens.
     * @dev This function MUST create a new ERC3525 token with the same slot for `_to` to receive
     *  the transferred value.
     *  MUST revert if `_fromTokenId` is zero token id or does not exist.
     *  MUST revert if `_to` is zero address.
     *  MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the
     *  operator.
     *  MUST emit `Transfer` and `TransferValue` events.
     * @param _fromTokenId The token to transfer value from
     * @param _to The address to transfer value to
     * @param _value The transferred value
     * @return ID of the new token created for `_to` which receives the transferred value
     */
    function transferFrom(
        uint256 _fromTokenId,
        address _to,
        uint256 _value
    ) external returns (uint256);
}

File 5 of 7 : IManagement.sol
// SPDX-License-Identifier: None
pragma solidity ^0.8.0;

/**
   @title IManagement contract
   @dev Provide interfaces that allow interaction to Management contract
*/
interface IManagement {
    function treasury() external view returns (address);

    function hasRole(
        bytes32 role,
        address account
    ) external view returns (bool);

    function paymentTokens(address _token) external view returns (bool);

    function paused() external view returns (bool);
}

File 6 of 7 : IMembership.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "./IERC3525.sol";

interface IMembership is IERC721Enumerable, IERC3525 {

    function addMembership(
        address _account,
        uint256 _memberId,
        uint256 _type,
        uint256 _value
    ) external;

    function updatePoint(
        uint256 _memberId,
        uint256 _value,
        bool _isAdded
    ) external;

    function cancelMembership(uint256 _memberId) external;
}

File 7 of 7 : Periphery2.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./interfaces/IManagement.sol";
import "./interfaces/IMembership.sol";
import "./interfaces/IERC3525.sol";

contract Periphery2 {

    struct XRate {
        uint256 bValue;             //  base value
        uint256 qValue;             //  quote value
    }

    struct Schedule {
        uint256 start;
        uint256 end;
    }

    bytes32 private constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

    address private immutable MEMBERSHIP;
    IManagement public management;

    //  Regular exchange rate for a pair of two loyalty types (type => type => exchange_rate)
    mapping(uint256 => mapping(uint256 => XRate)) private _globalRates;

    //  Exclusive exchange rate for a pair of two loyalty types during one special event
    mapping(uint256 => mapping(uint256 => mapping(uint256 => XRate))) private _specialRates;

    mapping(uint256 => Schedule) private _schedules;

    modifier onlyManager() {
        require(management.hasRole(MANAGER_ROLE, msg.sender), "Only Manager");
        _;
    }

    event Swap(
        uint256 eventId,
        address indexed caller,
        uint256 indexed bTokenId,
        uint256 indexed qTokenId,
        uint256 bType,
        uint256 qType,
        uint256 bAmount,
        uint256 qAmount
    );

    constructor(
        IManagement _management,
        address _membership
    ) {
        MEMBERSHIP = _membership;
        management = _management;
    }

    function setManagement(address _management) external onlyManager {
        require(_management != address(0), "Set zero address");

        management = IManagement(_management);
    }

    function adjust(uint256 _eventId, uint256 _end) external onlyManager {
        uint256 _currentTime = block.timestamp;
        Schedule memory schedule_ = _schedules[_eventId];
        require(schedule_.start != 0 && _currentTime < schedule_.end, "Invalid request");

        _schedules[_eventId].end = _end;
    }

    function setSchedule(uint256 _eventId, uint256 _start, uint256 _end) external onlyManager {
        uint256 _currentTime = block.timestamp;
        require(_schedules[_eventId].start == 0, "EventId exists");
        require(_start >= _currentTime && _start < _end, "Invalid schedule");

        _schedules[_eventId].start = _start;
        _schedules[_eventId].end = _end;
    }

    function setXRate(
        uint256 _eventId,
        uint256[] calldata _baseTypes,
        uint256[] calldata _quoteTypes,
        uint256[] calldata _baseValues,
        uint256[] calldata _quoteValues
    ) external onlyManager {
        uint256 _len = _baseTypes.length;
        require(
            _baseValues.length == _len &&
            _quoteTypes.length == _len &&
            _quoteValues.length == _len,
            "Invalid length"
        );
        _eventId == 0 ? _setGlobalRate(_len, _baseTypes, _quoteTypes, _baseValues, _quoteValues) : _setSpecialRate(_len, _eventId, _baseTypes, _quoteTypes, _baseValues, _quoteValues);
    }

    function specialSwap(uint256 _eventId, uint256 _bTokenId, uint256 _qTokenId, uint256 _quoteType, uint256 _bAmount) external {
        uint256 _currentTime = block.timestamp;
        require(
            _schedules[_eventId].start <= _currentTime && _currentTime <= _schedules[_eventId].end,
            "Event not yet started or already ended"
        );
        _swap(_eventId, _bTokenId, _qTokenId, _quoteType, _bAmount);
    }

    function regularSwap(uint256 _bTokenId, uint256 _qTokenId, uint256 _quoteType, uint256 _bAmount) external {
        _swap(0, _bTokenId, _qTokenId, _quoteType, _bAmount);
    }

    function _swap(uint256 _eventId, uint256 _bTokenId, uint256 _qTokenId, uint256 _quoteType, uint256 _bAmount) private {
        address _caller = msg.sender;
        IMembership _membership = IMembership(membership());
        require(
            _membership.ownerOf(_bTokenId) == _caller, "Base Token Id not owned"
        );

        uint256 _baseType = _membership.slotOf(_bTokenId);
        XRate memory _xrate;
        if (_eventId != 0)
            _xrate = specialRate(_eventId, _baseType, _quoteType);
        else
            _xrate = globalRate(_baseType, _quoteType); 
        require(
            _xrate.bValue != 0 && _xrate.qValue != 0, "Unsupport swapping this pair of tokens"
        );
        uint256 _qAmount = _bAmount * _quoteType / _baseType;
        _membership.updatePoint(_bTokenId, _bAmount, false);
        
        if (_qTokenId != 0) {
            require(
                _membership.ownerOf(_qTokenId) == _caller &&  _membership.slotOf(_qTokenId) == _quoteType,
                "Invalid Quote Token Id"
            );
            _membership.updatePoint(_qTokenId, _qAmount, true);
        }
        else {
            _qTokenId = _membership.totalSupply() + 1;
            _membership.addMembership(
                _caller, _qTokenId, _quoteType, _qAmount
            );
        }
        emit Swap(_eventId, _caller, _bTokenId, _qTokenId, _baseType, _quoteType, _bAmount, _qAmount); 
    }

    function globalRate(uint256 _baseType, uint256 _quoteType) public view returns (XRate memory) {
        return _globalRates[_baseType][_quoteType];
    }

    function specialRate(uint256 _eventId, uint256 _baseType, uint256 _quoteType) public view returns (XRate memory) {
        require(_schedules[_eventId].start != 0, "EventId not exists");
        return _specialRates[_eventId][_baseType][_quoteType];
    }

    function schedule(uint256 _eventId) external view returns (Schedule memory) {
        return _schedules[_eventId];
    }

    function membership() public view returns (address) {
        return MEMBERSHIP;
    }

    function _setGlobalRate(
        uint256 _len,
        uint256[] calldata _baseTypes,
        uint256[] calldata _quoteTypes,
        uint256[] calldata _baseValues,
        uint256[] calldata _quoteValues
    ) private {
        for (uint256 i; i < 2 * _len; i++) {
            if (i < _len) {
                _globalRates[_baseTypes[i]][_quoteTypes[i]].bValue = _baseValues[i];
                _globalRates[_baseTypes[i]][_quoteTypes[i]].qValue = _quoteValues[i];
            }
            else {
                _globalRates[_quoteTypes[i]][_baseTypes[i]].bValue = _quoteValues[i - _len];
                _globalRates[_quoteTypes[i]][_baseTypes[i]].qValue = _baseValues[i - _len];
            }
        }
    }

    function _setSpecialRate(
        uint256 _len,
        uint256 _eventId,
        uint256[] calldata _baseTypes,
        uint256[] calldata _quoteTypes,
        uint256[] calldata _baseValues,
        uint256[] calldata _quoteValues
    ) private {
        uint256 _currentTime = block.timestamp;
        Schedule memory schedule_ = _schedules[_eventId];
        require(
            schedule_.start != 0 && schedule_.start <= _currentTime && _currentTime <= schedule_.end,
            "Invalid request"
        );
        for (uint256 i; i < 2 * _len; i++) {
            if (i < _len) {
                _specialRates[_eventId][_baseTypes[i]][_quoteTypes[i]].bValue = _baseValues[i];
                _specialRates[_eventId][_baseTypes[i]][_quoteTypes[i]].qValue = _quoteValues[i];
            }
            else {
                _specialRates[_eventId][_quoteTypes[i]][_baseTypes[i]].bValue = _quoteValues[i - _len];
                _specialRates[_eventId][_quoteTypes[i]][_baseTypes[i]].qValue = _baseValues[i - _len];
            }
        }
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"contract IManagement","name":"_management","type":"address"},{"internalType":"address","name":"_membership","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"eventId","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint256","name":"bTokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"qTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"qType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"qAmount","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"uint256","name":"_eventId","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"adjust","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseType","type":"uint256"},{"internalType":"uint256","name":"_quoteType","type":"uint256"}],"name":"globalRate","outputs":[{"components":[{"internalType":"uint256","name":"bValue","type":"uint256"},{"internalType":"uint256","name":"qValue","type":"uint256"}],"internalType":"struct Periphery2.XRate","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"management","outputs":[{"internalType":"contract IManagement","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"membership","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bTokenId","type":"uint256"},{"internalType":"uint256","name":"_qTokenId","type":"uint256"},{"internalType":"uint256","name":"_quoteType","type":"uint256"},{"internalType":"uint256","name":"_bAmount","type":"uint256"}],"name":"regularSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_eventId","type":"uint256"}],"name":"schedule","outputs":[{"components":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"internalType":"struct Periphery2.Schedule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_management","type":"address"}],"name":"setManagement","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_eventId","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"setSchedule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_eventId","type":"uint256"},{"internalType":"uint256[]","name":"_baseTypes","type":"uint256[]"},{"internalType":"uint256[]","name":"_quoteTypes","type":"uint256[]"},{"internalType":"uint256[]","name":"_baseValues","type":"uint256[]"},{"internalType":"uint256[]","name":"_quoteValues","type":"uint256[]"}],"name":"setXRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_eventId","type":"uint256"},{"internalType":"uint256","name":"_baseType","type":"uint256"},{"internalType":"uint256","name":"_quoteType","type":"uint256"}],"name":"specialRate","outputs":[{"components":[{"internalType":"uint256","name":"bValue","type":"uint256"},{"internalType":"uint256","name":"qValue","type":"uint256"}],"internalType":"struct Periphery2.XRate","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_eventId","type":"uint256"},{"internalType":"uint256","name":"_bTokenId","type":"uint256"},{"internalType":"uint256","name":"_qTokenId","type":"uint256"},{"internalType":"uint256","name":"_quoteType","type":"uint256"},{"internalType":"uint256","name":"_bAmount","type":"uint256"}],"name":"specialSwap","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b506040516200274e3803806200274e833981810160405281019062000037919062000162565b8073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1681525050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050620001a9565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000e582620000b8565b9050919050565b6000620000f982620000d8565b9050919050565b6200010b81620000ec565b81146200011757600080fd5b50565b6000815190506200012b8162000100565b92915050565b6200013c81620000d8565b81146200014857600080fd5b50565b6000815190506200015c8162000131565b92915050565b600080604083850312156200017c576200017b620000b3565b5b60006200018c858286016200011a565b92505060206200019f858286016200014b565b9150509250929050565b608051612589620001c560003960006108fc01526125896000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80636fbfd409116100715780636fbfd4091461016257806388a8d60214610192578063a2bf68b9146101b0578063d4a22bde146101ce578063de930fad146101ea578063f3996ea814610206576100a9565b806317d2bea4146100ae578063418ce7d6146100ca57806341d289b9146100e657806344affa2c146101025780635443d3b514610132575b600080fd5b6100c860048036038101906100c3919061175f565b610222565b005b6100e460048036038101906100df919061179f565b6103df565b005b61010060048036038101906100fb9190611857565b6105d1565b005b61011c6004803603810190610117919061175f565b610781565b6040516101299190611991565b60405180910390f35b61014c6004803603810190610147919061179f565b6107d4565b6040516101599190611991565b60405180910390f35b61017c600480360381019061017791906119ac565b610893565b6040516101899190611a08565b60405180910390f35b61019a6108d4565b6040516101a79190611aa2565b60405180910390f35b6101b86108f8565b6040516101c59190611ade565b60405180910390f35b6101e860048036038101906101e39190611b25565b610920565b005b61020460048036038101906101ff9190611b52565b610add565b005b610220600480360381019061021b9190611bb9565b610af1565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166391d148547f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08336040518363ffffffff1660e01b815260040161029d929190611c4d565b60206040518083038186803b1580156102b557600080fd5b505afa1580156102c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ed9190611cae565b61032c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032390611d38565b60405180910390fd5b6000429050600060036000858152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600081600001511415801561037f5750806020015182105b6103be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103b590611da4565b60405180910390fd5b82600360008681526020019081526020016000206001018190555050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166391d148547f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08336040518363ffffffff1660e01b815260040161045a929190611c4d565b60206040518083038186803b15801561047257600080fd5b505afa158015610486573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104aa9190611cae565b6104e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e090611d38565b60405180910390fd5b60004290506000600360008681526020019081526020016000206000015414610547576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053e90611e10565b60405180910390fd5b80831015801561055657508183105b610595576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058c90611e7c565b60405180910390fd5b82600360008681526020019081526020016000206000018190555081600360008681526020019081526020016000206001018190555050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166391d148547f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08336040518363ffffffff1660e01b815260040161064c929190611c4d565b60206040518083038186803b15801561066457600080fd5b505afa158015610678573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069c9190611cae565b6106db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d290611d38565b60405180910390fd5b600088889050905080858590501480156106f757508087879050145b801561070557508083839050145b610744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073b90611ee8565b60405180910390fd5b60008a146107635761075e818b8b8b8b8b8b8b8b8b610b86565b610775565b610774818a8a8a8a8a8a8a8a610ea6565b5b50505050505050505050565b6107896116eb565b60016000848152602001908152602001600020600083815260200190815260200160002060405180604001604052908160008201548152602001600182015481525050905092915050565b6107dc6116eb565b600060036000868152602001908152602001600020600001541415610836576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082d90611f54565b60405180910390fd5b60026000858152602001908152602001600020600084815260200190815260200160002060008381526020019081526020016000206040518060400160405290816000820154815260200160018201548152505090509392505050565b61089b611705565b60036000838152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f0000000000000000000000000000000000000000000000000000000000000000905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166391d148547f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08336040518363ffffffff1660e01b815260040161099b929190611c4d565b60206040518083038186803b1580156109b357600080fd5b505afa1580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190611cae565b610a2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2190611d38565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9190611fc0565b60405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610aeb6000858585856110dc565b50505050565b600042905080600360008881526020019081526020016000206000015411158015610b32575060036000878152602001908152602001600020600101548111155b610b71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6890612052565b60405180910390fd5b610b7e86868686866110dc565b505050505050565b60004290506000600360008c81526020019081526020016000206040518060400160405290816000820154815260200160018201548152505090506000816000015114158015610bda575081816000015111155b8015610bea575080602001518211155b610c29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2090611da4565b60405180910390fd5b60005b8c6002610c3991906120a1565b811015610e97578c811015610d5d57868682818110610c5b57610c5a6120fb565b5b90506020020135600260008e815260200190815260200160002060008d8d85818110610c8a57610c896120fb565b5b90506020020135815260200190815260200160002060008b8b85818110610cb457610cb36120fb565b5b90506020020135815260200190815260200160002060000181905550848482818110610ce357610ce26120fb565b5b90506020020135600260008e815260200190815260200160002060008d8d85818110610d1257610d116120fb565b5b90506020020135815260200190815260200160002060008b8b85818110610d3c57610d3b6120fb565b5b90506020020135815260200190815260200160002060010181905550610e84565b84848e83610d6b919061212a565b818110610d7b57610d7a6120fb565b5b90506020020135600260008e815260200190815260200160002060008b8b85818110610daa57610da96120fb565b5b90506020020135815260200190815260200160002060008d8d85818110610dd457610dd36120fb565b5b9050602002013581526020019081526020016000206000018190555086868e83610dfe919061212a565b818110610e0e57610e0d6120fb565b5b90506020020135600260008e815260200190815260200160002060008b8b85818110610e3d57610e3c6120fb565b5b90506020020135815260200190815260200160002060008d8d85818110610e6757610e666120fb565b5b905060200201358152602001908152602001600020600101819055505b8080610e8f9061215e565b915050610c2c565b50505050505050505050505050565b60005b896002610eb691906120a1565b8110156110d05789811015610fb857848482818110610ed857610ed76120fb565b5b90506020020135600160008b8b85818110610ef657610ef56120fb565b5b9050602002013581526020019081526020016000206000898985818110610f2057610f1f6120fb565b5b90506020020135815260200190815260200160002060000181905550828282818110610f4f57610f4e6120fb565b5b90506020020135600160008b8b85818110610f6d57610f6c6120fb565b5b9050602002013581526020019081526020016000206000898985818110610f9757610f966120fb565b5b905060200201358152602001908152602001600020600101819055506110bd565b82828b83610fc6919061212a565b818110610fd657610fd56120fb565b5b9050602002013560016000898985818110610ff457610ff36120fb565b5b90506020020135815260200190815260200160002060008b8b8581811061101e5761101d6120fb565b5b9050602002013581526020019081526020016000206000018190555084848b83611048919061212a565b818110611058576110576120fb565b5b9050602002013560016000898985818110611076576110756120fb565b5b90506020020135815260200190815260200160002060008b8b858181106110a05761109f6120fb565b5b905060200201358152602001908152602001600020600101819055505b80806110c89061215e565b915050610ea9565b50505050505050505050565b600033905060006110eb6108f8565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16636352211e886040518263ffffffff1660e01b815260040161113d91906121b6565b60206040518083038186803b15801561115557600080fd5b505afa158015611169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118d91906121e6565b73ffffffffffffffffffffffffffffffffffffffff16146111e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111da9061225f565b60405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff1663263f3e7e886040518263ffffffff1660e01b815260040161121e91906121b6565b60206040518083038186803b15801561123657600080fd5b505afa15801561124a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126e9190612294565b90506112786116eb565b600089146112925761128b8983886107d4565b905061129f565b61129c8287610781565b90505b60008160000151141580156112b957506000816020015114155b6112f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ef90612333565b60405180910390fd5b600082878761130791906120a1565b6113119190612382565b90508373ffffffffffffffffffffffffffffffffffffffff1663d0a9e1f38a8860006040518463ffffffff1660e01b8152600401611351939291906123c2565b600060405180830381600087803b15801561136b57600080fd5b505af115801561137f573d6000803e3d6000fd5b5050505060008814611589578473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16636352211e8a6040518263ffffffff1660e01b81526004016113db91906121b6565b60206040518083038186803b1580156113f357600080fd5b505afa158015611407573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142b91906121e6565b73ffffffffffffffffffffffffffffffffffffffff161480156114d55750868473ffffffffffffffffffffffffffffffffffffffff1663263f3e7e8a6040518263ffffffff1660e01b815260040161148391906121b6565b60206040518083038186803b15801561149b57600080fd5b505afa1580156114af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d39190612294565b145b611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b90612445565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1663d0a9e1f3898360016040518463ffffffff1660e01b8152600401611552939291906123c2565b600060405180830381600087803b15801561156c57600080fd5b505af1158015611580573d6000803e3d6000fd5b50505050611687565b60018473ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115d157600080fd5b505afa1580156115e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116099190612294565b6116139190612465565b97508373ffffffffffffffffffffffffffffffffffffffff1663d955299b868a8a856040518563ffffffff1660e01b815260040161165494939291906124bb565b600060405180830381600087803b15801561166e57600080fd5b505af1158015611682573d6000803e3d6000fd5b505050505b87898673ffffffffffffffffffffffffffffffffffffffff167f784992527503186165f910e7ece14dce45e23be2f216c0860f97e2f7a112e9138d878c8c886040516116d7959493929190612500565b60405180910390a450505050505050505050565b604051806040016040528060008152602001600081525090565b604051806040016040528060008152602001600081525090565b600080fd5b600080fd5b6000819050919050565b61173c81611729565b811461174757600080fd5b50565b60008135905061175981611733565b92915050565b600080604083850312156117765761177561171f565b5b60006117848582860161174a565b92505060206117958582860161174a565b9150509250929050565b6000806000606084860312156117b8576117b761171f565b5b60006117c68682870161174a565b93505060206117d78682870161174a565b92505060406117e88682870161174a565b9150509250925092565b600080fd5b600080fd5b600080fd5b60008083601f840112611817576118166117f2565b5b8235905067ffffffffffffffff811115611834576118336117f7565b5b6020830191508360208202830111156118505761184f6117fc565b5b9250929050565b600080600080600080600080600060a08a8c0312156118795761187861171f565b5b60006118878c828d0161174a565b99505060208a013567ffffffffffffffff8111156118a8576118a7611724565b5b6118b48c828d01611801565b985098505060408a013567ffffffffffffffff8111156118d7576118d6611724565b5b6118e38c828d01611801565b965096505060608a013567ffffffffffffffff81111561190657611905611724565b5b6119128c828d01611801565b945094505060808a013567ffffffffffffffff81111561193557611934611724565b5b6119418c828d01611801565b92509250509295985092959850929598565b61195c81611729565b82525050565b6040820160008201516119786000850182611953565b50602082015161198b6020850182611953565b50505050565b60006040820190506119a66000830184611962565b92915050565b6000602082840312156119c2576119c161171f565b5b60006119d08482850161174a565b91505092915050565b6040820160008201516119ef6000850182611953565b506020820151611a026020850182611953565b50505050565b6000604082019050611a1d60008301846119d9565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611a68611a63611a5e84611a23565b611a43565b611a23565b9050919050565b6000611a7a82611a4d565b9050919050565b6000611a8c82611a6f565b9050919050565b611a9c81611a81565b82525050565b6000602082019050611ab76000830184611a93565b92915050565b6000611ac882611a23565b9050919050565b611ad881611abd565b82525050565b6000602082019050611af36000830184611acf565b92915050565b611b0281611abd565b8114611b0d57600080fd5b50565b600081359050611b1f81611af9565b92915050565b600060208284031215611b3b57611b3a61171f565b5b6000611b4984828501611b10565b91505092915050565b60008060008060808587031215611b6c57611b6b61171f565b5b6000611b7a8782880161174a565b9450506020611b8b8782880161174a565b9350506040611b9c8782880161174a565b9250506060611bad8782880161174a565b91505092959194509250565b600080600080600060a08688031215611bd557611bd461171f565b5b6000611be38882890161174a565b9550506020611bf48882890161174a565b9450506040611c058882890161174a565b9350506060611c168882890161174a565b9250506080611c278882890161174a565b9150509295509295909350565b6000819050919050565b611c4781611c34565b82525050565b6000604082019050611c626000830185611c3e565b611c6f6020830184611acf565b9392505050565b60008115159050919050565b611c8b81611c76565b8114611c9657600080fd5b50565b600081519050611ca881611c82565b92915050565b600060208284031215611cc457611cc361171f565b5b6000611cd284828501611c99565b91505092915050565b600082825260208201905092915050565b7f4f6e6c79204d616e616765720000000000000000000000000000000000000000600082015250565b6000611d22600c83611cdb565b9150611d2d82611cec565b602082019050919050565b60006020820190508181036000830152611d5181611d15565b9050919050565b7f496e76616c696420726571756573740000000000000000000000000000000000600082015250565b6000611d8e600f83611cdb565b9150611d9982611d58565b602082019050919050565b60006020820190508181036000830152611dbd81611d81565b9050919050565b7f4576656e74496420657869737473000000000000000000000000000000000000600082015250565b6000611dfa600e83611cdb565b9150611e0582611dc4565b602082019050919050565b60006020820190508181036000830152611e2981611ded565b9050919050565b7f496e76616c6964207363686564756c6500000000000000000000000000000000600082015250565b6000611e66601083611cdb565b9150611e7182611e30565b602082019050919050565b60006020820190508181036000830152611e9581611e59565b9050919050565b7f496e76616c6964206c656e677468000000000000000000000000000000000000600082015250565b6000611ed2600e83611cdb565b9150611edd82611e9c565b602082019050919050565b60006020820190508181036000830152611f0181611ec5565b9050919050565b7f4576656e744964206e6f74206578697374730000000000000000000000000000600082015250565b6000611f3e601283611cdb565b9150611f4982611f08565b602082019050919050565b60006020820190508181036000830152611f6d81611f31565b9050919050565b7f536574207a65726f206164647265737300000000000000000000000000000000600082015250565b6000611faa601083611cdb565b9150611fb582611f74565b602082019050919050565b60006020820190508181036000830152611fd981611f9d565b9050919050565b7f4576656e74206e6f74207965742073746172746564206f7220616c726561647960008201527f20656e6465640000000000000000000000000000000000000000000000000000602082015250565b600061203c602683611cdb565b915061204782611fe0565b604082019050919050565b6000602082019050818103600083015261206b8161202f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120ac82611729565b91506120b783611729565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156120f0576120ef612072565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061213582611729565b915061214083611729565b92508282101561215357612152612072565b5b828203905092915050565b600061216982611729565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561219c5761219b612072565b5b600182019050919050565b6121b081611729565b82525050565b60006020820190506121cb60008301846121a7565b92915050565b6000815190506121e081611af9565b92915050565b6000602082840312156121fc576121fb61171f565b5b600061220a848285016121d1565b91505092915050565b7f4261736520546f6b656e204964206e6f74206f776e6564000000000000000000600082015250565b6000612249601783611cdb565b915061225482612213565b602082019050919050565b600060208201905081810360008301526122788161223c565b9050919050565b60008151905061228e81611733565b92915050565b6000602082840312156122aa576122a961171f565b5b60006122b88482850161227f565b91505092915050565b7f556e737570706f7274207377617070696e6720746869732070616972206f662060008201527f746f6b656e730000000000000000000000000000000000000000000000000000602082015250565b600061231d602683611cdb565b9150612328826122c1565b604082019050919050565b6000602082019050818103600083015261234c81612310565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061238d82611729565b915061239883611729565b9250826123a8576123a7612353565b5b828204905092915050565b6123bc81611c76565b82525050565b60006060820190506123d760008301866121a7565b6123e460208301856121a7565b6123f160408301846123b3565b949350505050565b7f496e76616c69642051756f746520546f6b656e20496400000000000000000000600082015250565b600061242f601683611cdb565b915061243a826123f9565b602082019050919050565b6000602082019050818103600083015261245e81612422565b9050919050565b600061247082611729565b915061247b83611729565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156124b0576124af612072565b5b828201905092915050565b60006080820190506124d06000830187611acf565b6124dd60208301866121a7565b6124ea60408301856121a7565b6124f760608301846121a7565b95945050505050565b600060a08201905061251560008301886121a7565b61252260208301876121a7565b61252f60408301866121a7565b61253c60608301856121a7565b61254960808301846121a7565b969550505050505056fea264697066735822122044c1fa12f3db33f34c91186af36faeb8e0acfe1e8e89c287c2422505204f64e064736f6c634300080900330000000000000000000000002f295e191147d406bc7c1b732243ff5d437ce716000000000000000000000000c3d01e6f6b1edf8383ca3ba6940f212baed28ea6

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

0000000000000000000000002f295e191147d406bc7c1b732243ff5d437ce716000000000000000000000000c3d01e6f6b1edf8383ca3ba6940f212baed28ea6

-----Decoded View---------------
Arg [0] : _management (address): 0x2f295e191147d406bc7c1b732243ff5d437ce716
Arg [1] : _membership (address): 0xc3d01e6f6b1edf8383ca3ba6940f212baed28ea6

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000002f295e191147d406bc7c1b732243ff5d437ce716
Arg [1] : 000000000000000000000000c3d01e6f6b1edf8383ca3ba6940f212baed28ea6


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading