Address Details
contract

0xcd8148C6f63C1559a1f95962569a915AA7907Eb7

Contract Name
CarbonCreditBundleToken
Creator
0x957e72–18f089 at 0x1066ee–940e9a
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
10589409
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
CarbonCreditBundleToken




Optimization enabled
true
Compiler version
v0.8.9+commit.e5eed63a




Optimization runs
200
EVM Version
london




Verified at
2022-05-06T22:17:08.367534Z

project:/contracts/CarbonCreditBundleToken.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.9;

import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

import "./abstracts/AbstractToken.sol";

import './CarbonCreditToken.sol';

/// @author FlowCarbon LLC
/// @title A Carbon Credit Bundle Token Reference Implementation
contract CarbonCreditBundleToken is AbstractToken {

    using SafeERC20Upgradeable for CarbonCreditToken;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    /// @notice Emitted when someone deposits tokens into the bundle
    /// @param account - the depositing account
    /// @param amount - the amount deposited
    /// @param tokenAddress - the address of the vanilla underlying
    event Deposit(address account, uint256 amount, address tokenAddress);

    /// @notice Emitted when someone withdraws tokens from the bundle
    /// @param account - the withdrawing account
    /// @param amount - the amount deposited
    /// @param tokenAddress - the address of the vanilla underlying
    event Withdraw(address account, uint256 amount, address tokenAddress);

    /// @notice Emitted when a new token is added to the bundle
    /// @param tokenAddress - the new token that is added
    event TokenAdded(address tokenAddress);

    /// @notice Emitted when a new token is removed from the bundle
    /// @param tokenAddress - the token that has ben removed
    event TokenRemoved(address tokenAddress);

    /// @notice Emitted when the minimum vintage requirements change
    /// @param vintage - the new vintage after the update
    event VintageIncremented(uint16 vintage);

    /// @notice the fee divisor taken upon withdrawal
    /// @dev 1/feeDivisor is the fee in %
    uint256 public feeDivisor;

    /// @notice the minimal vintage
    uint16 public vintage;

    /// @notice the CarbonCreditTokens that form this bundle
    EnumerableSetUpgradeable.AddressSet private _tokenAddresses;

    struct TokenChecksums {
        address _tokenAddress;
        uint256 _amount;
    }

    /// @notice keeps track of checksums, amounts and underlying tokens
    mapping (bytes32 => TokenChecksums) private _retiredChecksums;

    function initialize(
        string memory name_, string memory symbol_, uint16 vintage_, CarbonCreditToken[] memory tokens_,
        address owner_, uint256 feeDivisor_
    ) external initializer {
        require(vintage_ > 2000, 'Vintage out of bounds');
        require(vintage_ < 2100, 'Vintage out of bounds');

        __AbstractToken_init(name_, symbol_, owner_);
        vintage = vintage_;

        feeDivisor = feeDivisor_;
        for (uint256 i = 0; i < tokens_.length; i++) {
            _addToken(tokens_[i]);
        }
    }

    /// @notice increasing the vintage
    /// @dev existing tokens can no longer be deposited, new tokens require the new vintage
    /// @param years_ number of years to increment the vintage, needs to be smaller than 10
    function incrementVintage(uint16 years_) external onlyOwner returns (uint16) {
        require(years_ <= 10, "vintage increment out of bounds");
        vintage += years_;

        emit VintageIncremented(vintage);
        return vintage;
    }

    /// @notice Checks if a token exists
    /// @param token_ - a carbon credit token
    function hasToken(CarbonCreditToken token_) public view returns (bool) {
        return _tokenAddresses.contains(address(token_));
    }

    /// @notice Number of tokens in this bundle
    function tokenCount() external view returns (uint256) {
        return _tokenAddresses.length();
    }

    /// @notice A token from the bundle
    /// @param index_ the index position taken from tokenCount()
    function tokenAtIndex(uint256 index_) external view returns (address) {
        return _tokenAddresses.at(index_);
    }

    /// @notice Adds a new token to the bundle. The token has to match the TokenDetails signature of the bundle
    /// @param token_ - a carbon credit token that is added to the bundle.
    function addToken(CarbonCreditToken token_) external onlyOwner returns (bool) {
        _addToken(token_);
        return true;
    }

    /// @dev private function to execute addToken so it can be used in the initalizer
    function _addToken(CarbonCreditToken token_) private returns (bool) {
        require(!hasToken(token_), "token already exists");
        require(token_.vintage() >= vintage, "vintage mismatch");
        require(address(token_) != address(this), "cannot add to self");

        _tokenAddresses.add(address(token_));
        emit TokenAdded(address(token_));
        return true;
    }



    /// @notice removes a token from the bundle
    /// @param token_ the carbon credit token to remove
    function removeToken(CarbonCreditToken token_) external onlyOwner returns (bool) {
        address tokenAddress = address(token_);
        require(_tokenAddresses.contains(tokenAddress), "token does not exists");
        require(token_.balanceOf(address(this)) == 0, "token has remaining balance");
        _tokenAddresses.remove(tokenAddress);
        emit TokenRemoved(tokenAddress);
        return true;
    }

    /// @notice deposits an underlying into the bundle, deposits need to be approved beforehand
    /// @param token_ the carbon credit token to deposit
    /// @param amount_ - the amount one wants to deposit
    function deposit(CarbonCreditToken token_, uint256 amount_) external returns (bool) {
        address tokenAddress = address(token_);
        require(_tokenAddresses.contains(tokenAddress), "token does not exists");
        require(token_.vintage() >= vintage, "token outdated");

        _mint(_msgSender(), amount_);
        token_.safeTransferFrom(_msgSender(), address(this), amount_);

        emit Deposit(_msgSender(), amount_, tokenAddress);
        return true;
    }

    /// @notice withdraws an underlying from the bundle, note that a fee may apply
    /// @param token_ the carbon credit token to withdraw
    /// @param amount_ - the amount one wants to withdraw (including fee)
    function withdraw(CarbonCreditToken token_, uint256 amount_) external returns (bool) {
        address tokenAddress = address(token_);
        require(_tokenAddresses.contains(tokenAddress), "token does not exists");
        require(token_.balanceOf(address(this)) >= amount_, "amount exceeds the token balance");

        _burn(_msgSender(), amount_);

        uint256 withdrawTokensAmount = amount_;
        if (feeDivisor > 0) {
            uint256 feeAmount = amount_ / feeDivisor;
            withdrawTokensAmount = amount_ - feeAmount;
            token_.safeTransfer(owner(), feeAmount);
        }

        token_.safeTransfer(_msgSender(), withdrawTokensAmount);

        emit Withdraw(_msgSender(), withdrawTokensAmount, tokenAddress);
        return true;
    }

    /// @notice the contract owner can finalize the retirement once the underlying has been retired
    /// @param token_ the carbon credit token to finalize the retirement for
    /// @param amount_ the number of token to finalize retirement for
    /// @param checksum_ the checksum associated with the underlying retirement event
    function finalizeRetirement(CarbonCreditToken token_, uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) {
        address tokenAddress = address(token_);

        require(_tokenAddresses.contains(tokenAddress), "token does not exists");
        require(_retiredChecksums[checksum_]._amount == 0, "checksum was already used");
        require(amount_ <= awaitingRetirement, 'retire exceeds pending balance');
        require(token_.balanceOf(address(this)) >= amount_, "amount exceeds the token balance");

        awaitingRetirement -= amount_;
        _retiredChecksums[checksum_] = TokenChecksums(tokenAddress, amount_);
        retired += amount_;

        token_.burn(amount_);
        emit FinalizeRetirement(amount_, checksum_);
        return true;
    }

    /// @dev via ICarbonCreditTokenInterface
    function amountRetiredWithChecksum(bytes32 checksum_) external view returns (uint256) {
        return _retiredChecksums[checksum_]._amount;
    }

    /// @param checksum_ the checksum of the associated retirement event of the underlying
    /// @return the address of the CarbonCreditToken that has been retired with this checksum
    function tokenAddressRetiredWithChecksum(bytes32 checksum_) external view returns (address) {
        return _retiredChecksums[checksum_]._tokenAddress;
    }
}
        

/_openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal initializer {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
    uint256[49] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal initializer {
        __Context_init_unchained();
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
    uint256[45] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
          

/_openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
          

/_openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal initializer {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol

// SPDX-License-Identifier: MIT

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.
 */
library EnumerableSetUpgradeable {
    // 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) {
        return _values(set._inner);
    }

    // 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;

        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 on 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;

        assembly {
            result := store
        }

        return result;
    }
}
          

/project_/contracts/CarbonCreditToken.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.9;

import "./abstracts/AbstractToken.sol";

/// @author FlowCarbon LLC
/// @title A Carbon Credit Token Reference Implementation

contract CarbonCreditToken is AbstractToken {

    struct TokenDetails {
        string methodology;
        string creditType;
        uint16 vintage;
    }

    TokenDetails private _details;

    /// @notice Emitted when the contract owner mints new tokens
    /// @dev the account is already in the Transfer Event and thus omitted here
    /// @param amount - the amount of token that finalize retirement
    /// @param checksum - a checksum associated with the underlying purchase event
    event Mint(uint256 amount, bytes32 checksum);

    /// @notice checksums associated with the underlying mapped to the number of minted tokens
    mapping (bytes32 => uint256) private _checksums;

    /// @notice checksums associated with the underlying retirement event mapped to the number of finally retired tokens
    mapping (bytes32 => uint256) private _retiredChecksums;

    /// @notice number of tokens removed from chain
    uint256 public movedOffChain;

    function initialize(string memory name_, string memory symbol_, TokenDetails memory details_, address owner_) external initializer {
        require(details_.vintage > 2000, 'Vintage out of bounds');
        require(details_.vintage < 2100, 'Vintage out of bounds');

        __AbstractToken_init(name_, symbol_, owner_);
        _details = details_;
    }

    /// @notice mints new tokens, a checksum representing purchase of the underlying with the minting event
    /// @param account_ - the account that will receive the new tokens
    /// @param amount_ - the amount of new tokens to be minted
    /// @param checksum_ - a checksum associated with the underlying purchase event
    function mint(address account_, uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) {
        require(_checksums[checksum_] == 0, "checksum was already used");

        _mint(account_, amount_);
        _checksums[checksum_] = amount_;
        emit Mint(amount_, checksum_);
        return true;
    }

    /// @param checksum_ - the checksum associated with a minting event
    /// @return the amount minted with the associated checksum
    function amountMintedWithChecksum(bytes32 checksum_) external view returns (uint256) {
        return _checksums[checksum_];
    }

    /// @notice the contract owner can finalize the retirement once the underlying has been retired
    /// @param amount_ the number of token to finalize retirement for
    /// @param checksum_ the checksum associated with the underlying retirement event
    function finalizeRetirement(uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) {
        require(_retiredChecksums[checksum_] == 0, "checksum was already used");
        require(amount_ <= awaitingRetirement, "retire exceeds pending balance");

        _retiredChecksums[checksum_] = amount_;
        awaitingRetirement -= amount_;
        retired += amount_;

        emit FinalizeRetirement(amount_, checksum_);
        return true;
    }

     /// @dev Destroys `amount` tokens from the caller.
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
        if (owner() == _msgSender()) {
            movedOffChain += amount;
        }
    }

    /// @dev via ICarbonCreditTokenInterface
    function amountRetiredWithChecksum(bytes32 checksum_) external view returns (uint256) {
        return _retiredChecksums[checksum_];
    }

     /// @notice The methodology of this token (e.g. verra or goldstandard)
    function methodology() external view returns (string memory) {
        return _details.methodology;
    }

    /// @notice The creditType of this token (e.g. enum like "WETLAND_RESTORATION", or "REFORESTATION")
    function creditType() external view returns(string memory) {
        return _details.creditType;
    }

    /// @notice The guaranteed vintage of this year - newer is possible because new is always better :-)
    function vintage() external view returns(uint16) {
        return _details.vintage;
    }
}
          

/project_/contracts/abstracts/AbstractToken.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import '@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol';

import "../interfaces/ICarbonCreditTokenInterface.sol";

/// @author FlowCarbon LLC
/// @title An Abstract Carbon Credit Token
abstract contract AbstractToken is ICarbonCreditTokenInterface, Initializable, OwnableUpgradeable, ERC20Upgradeable {

    /// @notice Emitted when the underlying is retired.
    /// @param amount - the amount retired
    /// @param checksum - the checksum associated with the retirement event
    event FinalizeRetirement(uint256 amount, bytes32 checksum);

    /// @notice user mapping to the amount of retired tokens
    mapping (address => uint256) internal _retiredBalances;

    /// @notice number of tokens retired by the user but not yet retired underlyings
    uint256 public awaitingRetirement;

    /// @notice number of tokens fully retired
    uint256 public retired;

    struct Retirements {
        uint time;
        uint amount;
    }

    /// @dev a mapping of user to retirements to make them discoverable
    mapping(address => Retirements[]) private _retirements;

    /// @dev via ICarbonCreditTokenInterface
    function retirementCountOf(address address_) external view returns(uint256) {
        return _retirements[address_].length;
    }

    /// @dev via ICarbonCreditTokenInterface
    function retirementAmountAtIndex(address address_, uint256 index_) external view returns(uint256) {
        return _retirements[address_][index_].amount;
    }

    /// @dev via ICarbonCreditTokenInterface
    function retirementTimeAtIndex(address address_, uint256 index_) external view returns(uint256) {
        return _retirements[address_][index_].time;
    }

    function __AbstractToken_init(
        string memory name_, string memory symbol_, address owner_
    ) internal initializer {
        __ERC20_init(name_, symbol_);
        __Ownable_init();

        transferOwnership(owner_);
    }

    //// @dev via ICarbonCreditTokenInterface
    function retiredBalanceOf(address account_) external view returns (uint256) {
        return _retiredBalances[account_];
    }

    /// @dev via ICarbonCreditTokenInterface
    function retire(uint256 amount_) external {
        address account = _msgSender();

        _burn(account, amount_);
        _retiredBalances[account] += amount_;
        awaitingRetirement += amount_;
        _retirements[account].push(Retirements(block.timestamp, amount_));

        emit Retire(account, amount_);
    }

}
          

/project_/contracts/interfaces/ICarbonCreditTokenInterface.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.9;

/// @author FlowCarbon LLC
/// @title The common interface of carbon credit tokens
interface ICarbonCreditTokenInterface {

    /// @notice Emitted when someone retires a token
    /// @param account - the retiring account
    /// @param amount - the amount retired
    event Retire(address account, uint256 amount);

    /// @notice retires on behalf of the the user
    /// @dev this will only retire tokens send by msg.sender, increases tokens awaiting finalization
    /// @param amount_ - the number of tokens to be retires
    function retire(uint256 amount_) external;

    /// @param account_ - the account that wants to check the number of retired tokens
    /// @return the number of retired tokens for the given account
    function retiredBalanceOf(address account_) external view returns (uint256);

    /// @param checksum_ the checksum of the associated retirement event of the underlying
    /// @return the number of tokens that have been retired with this checksum
    function amountRetiredWithChecksum(bytes32 checksum_) external view returns (uint256);

    /// @notice returns the number of retirements for the given address
    /// @dev this is a pattern to discover all retirements and their occurrences for a user
    /// @param address_ address of the user who did the retirements
    function retirementCountOf(address address_) external view returns(uint256);

    /// @notice returns amount of retired tokens for the given address and key
    /// @param address_ address of the user who did the retirements
    /// @param index_ index from userRetirementCount()
    function retirementAmountAtIndex(address address_, uint256 index_) external view returns(uint256);

    /// @notice returns the timestamp of a retirement for the given address and key
    /// @param address_ address of the user who did the retirements
    /// @param index_ index from userRetirementCount()
    function retirementTimeAtIndex(address address_, uint256 index_) external view returns(uint256);

}
          

Contract ABI

[{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"address","name":"tokenAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"FinalizeRetirement","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes32","name":"checksum","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Retire","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TokenAdded","inputs":[{"type":"address","name":"tokenAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"TokenRemoved","inputs":[{"type":"address","name":"tokenAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"VintageIncremented","inputs":[{"type":"uint16","name":"vintage","internalType":"uint16","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"address","name":"tokenAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addToken","inputs":[{"type":"address","name":"token_","internalType":"contract CarbonCreditToken"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"amountRetiredWithChecksum","inputs":[{"type":"bytes32","name":"checksum_","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"awaitingRetirement","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"decreaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"subtractedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"deposit","inputs":[{"type":"address","name":"token_","internalType":"contract CarbonCreditToken"},{"type":"uint256","name":"amount_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeDivisor","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"finalizeRetirement","inputs":[{"type":"address","name":"token_","internalType":"contract CarbonCreditToken"},{"type":"uint256","name":"amount_","internalType":"uint256"},{"type":"bytes32","name":"checksum_","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasToken","inputs":[{"type":"address","name":"token_","internalType":"contract CarbonCreditToken"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"increaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"addedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint16","name":"","internalType":"uint16"}],"name":"incrementVintage","inputs":[{"type":"uint16","name":"years_","internalType":"uint16"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"string","name":"name_","internalType":"string"},{"type":"string","name":"symbol_","internalType":"string"},{"type":"uint16","name":"vintage_","internalType":"uint16"},{"type":"address[]","name":"tokens_","internalType":"contract CarbonCreditToken[]"},{"type":"address","name":"owner_","internalType":"address"},{"type":"uint256","name":"feeDivisor_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeToken","inputs":[{"type":"address","name":"token_","internalType":"contract CarbonCreditToken"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"retire","inputs":[{"type":"uint256","name":"amount_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"retired","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"retiredBalanceOf","inputs":[{"type":"address","name":"account_","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"retirementAmountAtIndex","inputs":[{"type":"address","name":"address_","internalType":"address"},{"type":"uint256","name":"index_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"retirementCountOf","inputs":[{"type":"address","name":"address_","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"retirementTimeAtIndex","inputs":[{"type":"address","name":"address_","internalType":"address"},{"type":"uint256","name":"index_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenAddressRetiredWithChecksum","inputs":[{"type":"bytes32","name":"checksum_","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenAtIndex","inputs":[{"type":"uint256","name":"index_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16","name":"","internalType":"uint16"}],"name":"vintage","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"withdraw","inputs":[{"type":"address","name":"token_","internalType":"contract CarbonCreditToken"},{"type":"uint256","name":"amount_","internalType":"uint256"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50612949806100206000396000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c806370a0823111610125578063a457c2d7116100ad578063d48bfca71161007c578063d48bfca7146104a3578063dd62ed3e146104b6578063ea3a1fc7146104ef578063f2fde38b14610518578063f3fef3a31461052b57600080fd5b8063a457c2d714610457578063a9059cbb1461046a578063aa0480f71461047d578063b4d5f9961461049057600080fd5b806395d89b41116100f457806395d89b411461040257806399aa05a71461040a5780639a36f932146104335780639bb0f5991461043c5780639f181b5e1461044f57600080fd5b806370a082311461039f578063715018a6146103c85780638da5cb5b146103d05780638da61ee0146103e157600080fd5b8063306c754f116101a85780633950935111610177578063395093511461032857806341f1afc71461033b57806347e7ef24146103665780635fa7b5841461037957806363bcdaaa1461038c57600080fd5b8063306c754f146102ce578063313ce567146102e1578063343f735a146102f05780633790cf571461031357600080fd5b806318160ddd116101e457806318160ddd146102a157806323b872dd146102a95780632a42a1e4146102bc5780632eb38ae0146102c557600080fd5b806306fdde0314610216578063095ea7b3146102345780631165691f1461025757806316a9c0c21461026a575b600080fd5b61021e61053e565b60405161022b9190612371565b60405180910390f35b6102476102423660046123c4565b6105d0565b604051901515815260200161022b565b6102476102653660046123f0565b6105e7565b610293610278366004612425565b6001600160a01b03166000908152609a602052604090205490565b60405190815260200161022b565b606754610293565b6102476102b7366004612442565b6108d5565b61029360985481565b61029360995481565b6102936102dc3660046123c4565b61097f565b6040516012815260200161022b565b6102936102fe366004612483565b6000908152609f602052604090206001015490565b610326610321366004612483565b6109c3565b005b6102476103363660046123c4565b610a9c565b61034e610349366004612483565b610ad8565b6040516001600160a01b03909116815260200161022b565b6102476103743660046123c4565b610ae5565b610247610387366004612425565b610c49565b61032661039a366004612563565b610db5565b6102936103ad366004612425565b6001600160a01b031660009081526065602052604090205490565b610326610f24565b6033546001600160a01b031661034e565b609c546103ef9061ffff1681565b60405161ffff909116815260200161022b565b61021e610f5a565b610293610418366004612425565b6001600160a01b031660009081526097602052604090205490565b610293609b5481565b61024761044a366004612425565b610f69565b610293610f76565b6102476104653660046123c4565b610f87565b6102476104783660046123c4565b611020565b6103ef61048b366004612688565b61102d565b61029361049e3660046123c4565b611127565b6102476104b1366004612425565b61116b565b6102936104c43660046126a5565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205490565b61034e6104fd366004612483565b6000908152609f60205260409020546001600160a01b031690565b610326610526366004612425565b6111a1565b6102476105393660046123c4565b61123c565b60606068805461054d906126de565b80601f0160208091040260200160405190810160405280929190818152602001828054610579906126de565b80156105c65780601f1061059b576101008083540402835291602001916105c6565b820191906000526020600020905b8154815290600101906020018083116105a957829003601f168201915b5050505050905090565b60006105dd3384846113ee565b5060015b92915050565b6033546000906001600160a01b0316331461061d5760405162461bcd60e51b815260040161061490612719565b60405180910390fd5b83610629609d82611513565b6106455760405162461bcd60e51b81526004016106149061274e565b6000838152609f6020526040902060010154156106a45760405162461bcd60e51b815260206004820152601960248201527f636865636b73756d2077617320616c72656164792075736564000000000000006044820152606401610614565b6098548411156106f65760405162461bcd60e51b815260206004820152601e60248201527f72657469726520657863656564732070656e64696e672062616c616e636500006044820152606401610614565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b15801561073757600080fd5b505afa15801561074b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076f919061277d565b10156107bd5760405162461bcd60e51b815260206004820181905260248201527f616d6f756e7420657863656564732074686520746f6b656e2062616c616e63656044820152606401610614565b83609860008282546107cf91906127ac565b90915550506040805180820182526001600160a01b03838116825260208083018881526000888152609f909252938120925183546001600160a01b031916921691909117825591516001909101556099805486929061082f9084906127c3565b9091555050604051630852cd8d60e31b8152600481018590526001600160a01b038616906342966c6890602401600060405180830381600087803b15801561087657600080fd5b505af115801561088a573d6000803e3d6000fd5b505060408051878152602081018790527fc1e99be6fbcfc5fc4c3e1889546e1667c2bd44839320b74aebe257ca6ef846b3935001905060405180910390a160019150505b9392505050565b60006108e2848484611535565b6001600160a01b0384166000908152606660209081526040808320338452909152902054828110156109675760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610614565b61097485338584036113ee565b506001949350505050565b6001600160a01b0382166000908152609a602052604081208054839081106109a9576109a96127db565b906000526020600020906002020160000154905092915050565b336109ce8183611705565b6001600160a01b038116600090815260976020526040812080548492906109f69084906127c3565b925050819055508160986000828254610a0f91906127c3565b90915550506001600160a01b0381166000818152609a6020908152604080832081518083018352428152808401888152825460018082018555938752958590209151600290960290910194855551930192909255815192835282018490527f82b89ed824b293574a2cca050e6e27837b60436d911352f8dca203a9cd35241c910160405180910390a15050565b3360008181526066602090815260408083206001600160a01b038716845290915281205490916105dd918590610ad39086906127c3565b6113ee565b60006105e1609d83611850565b600082610af3609d82611513565b610b0f5760405162461bcd60e51b81526004016106149061274e565b609c60009054906101000a900461ffff1661ffff16846001600160a01b0316638da61ee06040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5d57600080fd5b505afa158015610b71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9591906127f1565b61ffff161015610bd85760405162461bcd60e51b815260206004820152600e60248201526d1d1bdad95b881bdd5d19185d195960921b6044820152606401610614565b610be2338461185c565b610bf76001600160a01b03851633308661193b565b60408051338152602081018590526001600160a01b0383168183015290517fe31c7b8d08ee7db0afa68782e1028ef92305caeea8626633ad44d413e30f6b2f9181900360600190a15060019392505050565b6033546000906001600160a01b03163314610c765760405162461bcd60e51b815260040161061490612719565b81610c82609d82611513565b610c9e5760405162461bcd60e51b81526004016106149061274e565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a082319060240160206040518083038186803b158015610cdd57600080fd5b505afa158015610cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d15919061277d565b15610d625760405162461bcd60e51b815260206004820152601b60248201527f746f6b656e206861732072656d61696e696e672062616c616e636500000000006044820152606401610614565b610d6d609d826119a6565b506040516001600160a01b03821681527f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd39060200160405180910390a160019150505b919050565b600054610100900460ff1680610dce575060005460ff16155b610dea5760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015610e0c576000805461ffff19166101011790555b6107d08561ffff1611610e595760405162461bcd60e51b815260206004820152601560248201527456696e74616765206f7574206f6620626f756e647360581b6044820152606401610614565b6108348561ffff1610610ea65760405162461bcd60e51b815260206004820152601560248201527456696e74616765206f7574206f6620626f756e647360581b6044820152606401610614565b610eb18787856119bb565b609c805461ffff191661ffff8716179055609b82905560005b8451811015610f0857610ef5858281518110610ee857610ee86127db565b6020026020010151611a44565b5080610f008161285c565b915050610eca565b508015610f1b576000805461ff00191690555b50505050505050565b6033546001600160a01b03163314610f4e5760405162461bcd60e51b815260040161061490612719565b610f586000611bfc565b565b60606069805461054d906126de565b60006105e1609d83611513565b6000610f82609d611c4e565b905090565b3360009081526066602090815260408083206001600160a01b0386168452909152812054828110156110095760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610614565b61101633858584036113ee565b5060019392505050565b60006105dd338484611535565b6033546000906001600160a01b0316331461105a5760405162461bcd60e51b815260040161061490612719565b600a8261ffff1611156110af5760405162461bcd60e51b815260206004820152601f60248201527f76696e7461676520696e6372656d656e74206f7574206f6620626f756e6473006044820152606401610614565b609c80548391906000906110c890849061ffff16612877565b82546101009290920a61ffff818102199093169183160217909155609c54604051911681527f092ea5dd2ad1afe704131ac8713bf04b9b840be8f31b75d0eb10aca01b53763a915060200160405180910390a15050609c5461ffff1690565b6001600160a01b0382166000908152609a60205260408120805483908110611151576111516127db565b906000526020600020906002020160010154905092915050565b6033546000906001600160a01b031633146111985760405162461bcd60e51b815260040161061490612719565b6105dd82611a44565b6033546001600160a01b031633146111cb5760405162461bcd60e51b815260040161061490612719565b6001600160a01b0381166112305760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610614565b61123981611bfc565b50565b60008261124a609d82611513565b6112665760405162461bcd60e51b81526004016106149061274e565b6040516370a0823160e01b815230600482015283906001600160a01b038616906370a082319060240160206040518083038186803b1580156112a757600080fd5b505afa1580156112bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112df919061277d565b101561132d5760405162461bcd60e51b815260206004820181905260248201527f616d6f756e7420657863656564732074686520746f6b656e2062616c616e63656044820152606401610614565b6113373384611705565b609b54839015611387576000609b5485611351919061289d565b905061135d81866127ac565b91506113856113746033546001600160a01b031690565b6001600160a01b0388169083611c58565b505b61139b6001600160a01b0386163383611c58565b60408051338152602081018390526001600160a01b0384168183015290517f56c54ba9bd38d8fd62012e42c7ee564519b09763c426d331b3661b537ead19b29181900360600190a1506001949350505050565b6001600160a01b0383166114505760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610614565b6001600160a01b0382166114b15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610614565b6001600160a01b0383811660008181526066602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038116600090815260018301602052604081205415156108ce565b6001600160a01b0383166115995760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610614565b6001600160a01b0382166115fb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610614565b6001600160a01b038316600090815260656020526040902054818110156116735760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610614565b6001600160a01b038085166000908152606560205260408082208585039055918516815290812080548492906116aa9084906127c3565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116f691815260200190565b60405180910390a35b50505050565b6001600160a01b0382166117655760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610614565b6001600160a01b038216600090815260656020526040902054818110156117d95760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610614565b6001600160a01b03831660009081526065602052604081208383039055606780548492906118089084906127ac565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611506565b505050565b60006108ce8383611c88565b6001600160a01b0382166118b25760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610614565b80606760008282546118c491906127c3565b90915550506001600160a01b038216600090815260656020526040812080548392906118f19084906127c3565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526116ff9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611cb2565b60006108ce836001600160a01b038416611d84565b600054610100900460ff16806119d4575060005460ff16155b6119f05760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015611a12576000805461ffff19166101011790555b611a1c8484611e77565b611a24611ef6565b611a2d826111a1565b80156116ff576000805461ff001916905550505050565b6000611a4f82610f69565b15611a935760405162461bcd60e51b8152602060048201526014602482015273746f6b656e20616c72656164792065786973747360601b6044820152606401610614565b609c60009054906101000a900461ffff1661ffff16826001600160a01b0316638da61ee06040518163ffffffff1660e01b815260040160206040518083038186803b158015611ae157600080fd5b505afa158015611af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1991906127f1565b61ffff161015611b5e5760405162461bcd60e51b815260206004820152601060248201526f0ecd2dce8c2ceca40dad2e6dac2e8c6d60831b6044820152606401610614565b6001600160a01b038216301415611bac5760405162461bcd60e51b815260206004820152601260248201527131b0b73737ba1030b232103a379039b2b63360711b6044820152606401610614565b611bb7609d83611f71565b506040516001600160a01b03831681527f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49060200160405180910390a1506001919050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006105e1825490565b6040516001600160a01b03831660248201526044810182905261184b90849063a9059cbb60e01b9060640161196f565b6000826000018281548110611c9f57611c9f6127db565b9060005260206000200154905092915050565b6000611d07826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f869092919063ffffffff16565b80519091501561184b5780806020019051810190611d2591906128bf565b61184b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610614565b60008181526001830160205260408120548015611e6d576000611da86001836127ac565b8554909150600090611dbc906001906127ac565b9050818114611e21576000866000018281548110611ddc57611ddc6127db565b9060005260206000200154905080876000018481548110611dff57611dff6127db565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e3257611e326128e1565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105e1565b60009150506105e1565b600054610100900460ff1680611e90575060005460ff16155b611eac5760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015611ece576000805461ffff19166101011790555b611ed6611f9d565b611ee08383612007565b801561184b576000805461ff0019169055505050565b600054610100900460ff1680611f0f575060005460ff16155b611f2b5760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015611f4d576000805461ffff19166101011790555b611f55611f9d565b611f5d61209c565b8015611239576000805461ff001916905550565b60006108ce836001600160a01b0384166120fc565b6060611f95848460008561214b565b949350505050565b600054610100900460ff1680611fb6575060005460ff16155b611fd25760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015611f5d576000805461ffff19166101011790558015611239576000805461ff001916905550565b600054610100900460ff1680612020575060005460ff16155b61203c5760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff1615801561205e576000805461ffff19166101011790555b82516120719060689060208601906122ac565b5081516120859060699060208501906122ac565b50801561184b576000805461ff0019169055505050565b600054610100900460ff16806120b5575060005460ff16155b6120d15760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff161580156120f3576000805461ffff19166101011790555b611f5d33611bfc565b6000818152600183016020526040812054612143575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105e1565b5060006105e1565b6060824710156121ac5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610614565b843b6121fa5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610614565b600080866001600160a01b0316858760405161221691906128f7565b60006040518083038185875af1925050503d8060008114612253576040519150601f19603f3d011682016040523d82523d6000602084013e612258565b606091505b5091509150612268828286612273565b979650505050505050565b606083156122825750816108ce565b8251156122925782518084602001fd5b8160405162461bcd60e51b81526004016106149190612371565b8280546122b8906126de565b90600052602060002090601f0160209004810192826122da5760008555612320565b82601f106122f357805160ff1916838001178555612320565b82800160010185558215612320579182015b82811115612320578251825591602001919060010190612305565b5061232c929150612330565b5090565b5b8082111561232c5760008155600101612331565b60005b83811015612360578181015183820152602001612348565b838111156116ff5750506000910152565b6020815260008251806020840152612390816040850160208701612345565b601f01601f19169190910160400192915050565b6001600160a01b038116811461123957600080fd5b8035610db0816123a4565b600080604083850312156123d757600080fd5b82356123e2816123a4565b946020939093013593505050565b60008060006060848603121561240557600080fd5b8335612410816123a4565b95602085013595506040909401359392505050565b60006020828403121561243757600080fd5b81356108ce816123a4565b60008060006060848603121561245757600080fd5b8335612462816123a4565b92506020840135612472816123a4565b929592945050506040919091013590565b60006020828403121561249557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156124db576124db61249c565b604052919050565b600082601f8301126124f457600080fd5b813567ffffffffffffffff81111561250e5761250e61249c565b612521601f8201601f19166020016124b2565b81815284602083860101111561253657600080fd5b816020850160208301376000918101602001919091529392505050565b61ffff8116811461123957600080fd5b60008060008060008060c0878903121561257c57600080fd5b863567ffffffffffffffff8082111561259457600080fd5b6125a08a838b016124e3565b97506020915081890135818111156125b757600080fd5b6125c38b828c016124e3565b97505060408901356125d481612553565b95506060890135818111156125e857600080fd5b8901601f81018b136125f957600080fd5b80358281111561260b5761260b61249c565b8060051b925061261c8484016124b2565b818152928201840192848101908d85111561263657600080fd5b928501925b848410156126605783359250612650836123a4565b828252928501929085019061263b565b809850505050505050612675608088016123b9565b915060a087013590509295509295509295565b60006020828403121561269a57600080fd5b81356108ce81612553565b600080604083850312156126b857600080fd5b82356126c3816123a4565b915060208301356126d3816123a4565b809150509250929050565b600181811c908216806126f257607f821691505b6020821081141561271357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b602080825260159082015274746f6b656e20646f6573206e6f742065786973747360581b604082015260600190565b60006020828403121561278f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156127be576127be612796565b500390565b600082198211156127d6576127d6612796565b500190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561280357600080fd5b81516108ce81612553565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600060001982141561287057612870612796565b5060010190565b600061ffff80831681851680830382111561289457612894612796565b01949350505050565b6000826128ba57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156128d157600080fd5b815180151581146108ce57600080fd5b634e487b7160e01b600052603160045260246000fd5b60008251612909818460208701612345565b919091019291505056fea26469706673582212207ced23517adf631eaa9bc579adb41fcec53397666ede28edc06e69c60306106e64736f6c63430008090033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102115760003560e01c806370a0823111610125578063a457c2d7116100ad578063d48bfca71161007c578063d48bfca7146104a3578063dd62ed3e146104b6578063ea3a1fc7146104ef578063f2fde38b14610518578063f3fef3a31461052b57600080fd5b8063a457c2d714610457578063a9059cbb1461046a578063aa0480f71461047d578063b4d5f9961461049057600080fd5b806395d89b41116100f457806395d89b411461040257806399aa05a71461040a5780639a36f932146104335780639bb0f5991461043c5780639f181b5e1461044f57600080fd5b806370a082311461039f578063715018a6146103c85780638da5cb5b146103d05780638da61ee0146103e157600080fd5b8063306c754f116101a85780633950935111610177578063395093511461032857806341f1afc71461033b57806347e7ef24146103665780635fa7b5841461037957806363bcdaaa1461038c57600080fd5b8063306c754f146102ce578063313ce567146102e1578063343f735a146102f05780633790cf571461031357600080fd5b806318160ddd116101e457806318160ddd146102a157806323b872dd146102a95780632a42a1e4146102bc5780632eb38ae0146102c557600080fd5b806306fdde0314610216578063095ea7b3146102345780631165691f1461025757806316a9c0c21461026a575b600080fd5b61021e61053e565b60405161022b9190612371565b60405180910390f35b6102476102423660046123c4565b6105d0565b604051901515815260200161022b565b6102476102653660046123f0565b6105e7565b610293610278366004612425565b6001600160a01b03166000908152609a602052604090205490565b60405190815260200161022b565b606754610293565b6102476102b7366004612442565b6108d5565b61029360985481565b61029360995481565b6102936102dc3660046123c4565b61097f565b6040516012815260200161022b565b6102936102fe366004612483565b6000908152609f602052604090206001015490565b610326610321366004612483565b6109c3565b005b6102476103363660046123c4565b610a9c565b61034e610349366004612483565b610ad8565b6040516001600160a01b03909116815260200161022b565b6102476103743660046123c4565b610ae5565b610247610387366004612425565b610c49565b61032661039a366004612563565b610db5565b6102936103ad366004612425565b6001600160a01b031660009081526065602052604090205490565b610326610f24565b6033546001600160a01b031661034e565b609c546103ef9061ffff1681565b60405161ffff909116815260200161022b565b61021e610f5a565b610293610418366004612425565b6001600160a01b031660009081526097602052604090205490565b610293609b5481565b61024761044a366004612425565b610f69565b610293610f76565b6102476104653660046123c4565b610f87565b6102476104783660046123c4565b611020565b6103ef61048b366004612688565b61102d565b61029361049e3660046123c4565b611127565b6102476104b1366004612425565b61116b565b6102936104c43660046126a5565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205490565b61034e6104fd366004612483565b6000908152609f60205260409020546001600160a01b031690565b610326610526366004612425565b6111a1565b6102476105393660046123c4565b61123c565b60606068805461054d906126de565b80601f0160208091040260200160405190810160405280929190818152602001828054610579906126de565b80156105c65780601f1061059b576101008083540402835291602001916105c6565b820191906000526020600020905b8154815290600101906020018083116105a957829003601f168201915b5050505050905090565b60006105dd3384846113ee565b5060015b92915050565b6033546000906001600160a01b0316331461061d5760405162461bcd60e51b815260040161061490612719565b60405180910390fd5b83610629609d82611513565b6106455760405162461bcd60e51b81526004016106149061274e565b6000838152609f6020526040902060010154156106a45760405162461bcd60e51b815260206004820152601960248201527f636865636b73756d2077617320616c72656164792075736564000000000000006044820152606401610614565b6098548411156106f65760405162461bcd60e51b815260206004820152601e60248201527f72657469726520657863656564732070656e64696e672062616c616e636500006044820152606401610614565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a082319060240160206040518083038186803b15801561073757600080fd5b505afa15801561074b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076f919061277d565b10156107bd5760405162461bcd60e51b815260206004820181905260248201527f616d6f756e7420657863656564732074686520746f6b656e2062616c616e63656044820152606401610614565b83609860008282546107cf91906127ac565b90915550506040805180820182526001600160a01b03838116825260208083018881526000888152609f909252938120925183546001600160a01b031916921691909117825591516001909101556099805486929061082f9084906127c3565b9091555050604051630852cd8d60e31b8152600481018590526001600160a01b038616906342966c6890602401600060405180830381600087803b15801561087657600080fd5b505af115801561088a573d6000803e3d6000fd5b505060408051878152602081018790527fc1e99be6fbcfc5fc4c3e1889546e1667c2bd44839320b74aebe257ca6ef846b3935001905060405180910390a160019150505b9392505050565b60006108e2848484611535565b6001600160a01b0384166000908152606660209081526040808320338452909152902054828110156109675760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610614565b61097485338584036113ee565b506001949350505050565b6001600160a01b0382166000908152609a602052604081208054839081106109a9576109a96127db565b906000526020600020906002020160000154905092915050565b336109ce8183611705565b6001600160a01b038116600090815260976020526040812080548492906109f69084906127c3565b925050819055508160986000828254610a0f91906127c3565b90915550506001600160a01b0381166000818152609a6020908152604080832081518083018352428152808401888152825460018082018555938752958590209151600290960290910194855551930192909255815192835282018490527f82b89ed824b293574a2cca050e6e27837b60436d911352f8dca203a9cd35241c910160405180910390a15050565b3360008181526066602090815260408083206001600160a01b038716845290915281205490916105dd918590610ad39086906127c3565b6113ee565b60006105e1609d83611850565b600082610af3609d82611513565b610b0f5760405162461bcd60e51b81526004016106149061274e565b609c60009054906101000a900461ffff1661ffff16846001600160a01b0316638da61ee06040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5d57600080fd5b505afa158015610b71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9591906127f1565b61ffff161015610bd85760405162461bcd60e51b815260206004820152600e60248201526d1d1bdad95b881bdd5d19185d195960921b6044820152606401610614565b610be2338461185c565b610bf76001600160a01b03851633308661193b565b60408051338152602081018590526001600160a01b0383168183015290517fe31c7b8d08ee7db0afa68782e1028ef92305caeea8626633ad44d413e30f6b2f9181900360600190a15060019392505050565b6033546000906001600160a01b03163314610c765760405162461bcd60e51b815260040161061490612719565b81610c82609d82611513565b610c9e5760405162461bcd60e51b81526004016106149061274e565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a082319060240160206040518083038186803b158015610cdd57600080fd5b505afa158015610cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d15919061277d565b15610d625760405162461bcd60e51b815260206004820152601b60248201527f746f6b656e206861732072656d61696e696e672062616c616e636500000000006044820152606401610614565b610d6d609d826119a6565b506040516001600160a01b03821681527f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd39060200160405180910390a160019150505b919050565b600054610100900460ff1680610dce575060005460ff16155b610dea5760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015610e0c576000805461ffff19166101011790555b6107d08561ffff1611610e595760405162461bcd60e51b815260206004820152601560248201527456696e74616765206f7574206f6620626f756e647360581b6044820152606401610614565b6108348561ffff1610610ea65760405162461bcd60e51b815260206004820152601560248201527456696e74616765206f7574206f6620626f756e647360581b6044820152606401610614565b610eb18787856119bb565b609c805461ffff191661ffff8716179055609b82905560005b8451811015610f0857610ef5858281518110610ee857610ee86127db565b6020026020010151611a44565b5080610f008161285c565b915050610eca565b508015610f1b576000805461ff00191690555b50505050505050565b6033546001600160a01b03163314610f4e5760405162461bcd60e51b815260040161061490612719565b610f586000611bfc565b565b60606069805461054d906126de565b60006105e1609d83611513565b6000610f82609d611c4e565b905090565b3360009081526066602090815260408083206001600160a01b0386168452909152812054828110156110095760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610614565b61101633858584036113ee565b5060019392505050565b60006105dd338484611535565b6033546000906001600160a01b0316331461105a5760405162461bcd60e51b815260040161061490612719565b600a8261ffff1611156110af5760405162461bcd60e51b815260206004820152601f60248201527f76696e7461676520696e6372656d656e74206f7574206f6620626f756e6473006044820152606401610614565b609c80548391906000906110c890849061ffff16612877565b82546101009290920a61ffff818102199093169183160217909155609c54604051911681527f092ea5dd2ad1afe704131ac8713bf04b9b840be8f31b75d0eb10aca01b53763a915060200160405180910390a15050609c5461ffff1690565b6001600160a01b0382166000908152609a60205260408120805483908110611151576111516127db565b906000526020600020906002020160010154905092915050565b6033546000906001600160a01b031633146111985760405162461bcd60e51b815260040161061490612719565b6105dd82611a44565b6033546001600160a01b031633146111cb5760405162461bcd60e51b815260040161061490612719565b6001600160a01b0381166112305760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610614565b61123981611bfc565b50565b60008261124a609d82611513565b6112665760405162461bcd60e51b81526004016106149061274e565b6040516370a0823160e01b815230600482015283906001600160a01b038616906370a082319060240160206040518083038186803b1580156112a757600080fd5b505afa1580156112bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112df919061277d565b101561132d5760405162461bcd60e51b815260206004820181905260248201527f616d6f756e7420657863656564732074686520746f6b656e2062616c616e63656044820152606401610614565b6113373384611705565b609b54839015611387576000609b5485611351919061289d565b905061135d81866127ac565b91506113856113746033546001600160a01b031690565b6001600160a01b0388169083611c58565b505b61139b6001600160a01b0386163383611c58565b60408051338152602081018390526001600160a01b0384168183015290517f56c54ba9bd38d8fd62012e42c7ee564519b09763c426d331b3661b537ead19b29181900360600190a1506001949350505050565b6001600160a01b0383166114505760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610614565b6001600160a01b0382166114b15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610614565b6001600160a01b0383811660008181526066602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038116600090815260018301602052604081205415156108ce565b6001600160a01b0383166115995760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610614565b6001600160a01b0382166115fb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610614565b6001600160a01b038316600090815260656020526040902054818110156116735760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610614565b6001600160a01b038085166000908152606560205260408082208585039055918516815290812080548492906116aa9084906127c3565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116f691815260200190565b60405180910390a35b50505050565b6001600160a01b0382166117655760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610614565b6001600160a01b038216600090815260656020526040902054818110156117d95760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610614565b6001600160a01b03831660009081526065602052604081208383039055606780548492906118089084906127ac565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611506565b505050565b60006108ce8383611c88565b6001600160a01b0382166118b25760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610614565b80606760008282546118c491906127c3565b90915550506001600160a01b038216600090815260656020526040812080548392906118f19084906127c3565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526116ff9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611cb2565b60006108ce836001600160a01b038416611d84565b600054610100900460ff16806119d4575060005460ff16155b6119f05760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015611a12576000805461ffff19166101011790555b611a1c8484611e77565b611a24611ef6565b611a2d826111a1565b80156116ff576000805461ff001916905550505050565b6000611a4f82610f69565b15611a935760405162461bcd60e51b8152602060048201526014602482015273746f6b656e20616c72656164792065786973747360601b6044820152606401610614565b609c60009054906101000a900461ffff1661ffff16826001600160a01b0316638da61ee06040518163ffffffff1660e01b815260040160206040518083038186803b158015611ae157600080fd5b505afa158015611af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1991906127f1565b61ffff161015611b5e5760405162461bcd60e51b815260206004820152601060248201526f0ecd2dce8c2ceca40dad2e6dac2e8c6d60831b6044820152606401610614565b6001600160a01b038216301415611bac5760405162461bcd60e51b815260206004820152601260248201527131b0b73737ba1030b232103a379039b2b63360711b6044820152606401610614565b611bb7609d83611f71565b506040516001600160a01b03831681527f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49060200160405180910390a1506001919050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006105e1825490565b6040516001600160a01b03831660248201526044810182905261184b90849063a9059cbb60e01b9060640161196f565b6000826000018281548110611c9f57611c9f6127db565b9060005260206000200154905092915050565b6000611d07826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f869092919063ffffffff16565b80519091501561184b5780806020019051810190611d2591906128bf565b61184b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610614565b60008181526001830160205260408120548015611e6d576000611da86001836127ac565b8554909150600090611dbc906001906127ac565b9050818114611e21576000866000018281548110611ddc57611ddc6127db565b9060005260206000200154905080876000018481548110611dff57611dff6127db565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e3257611e326128e1565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105e1565b60009150506105e1565b600054610100900460ff1680611e90575060005460ff16155b611eac5760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015611ece576000805461ffff19166101011790555b611ed6611f9d565b611ee08383612007565b801561184b576000805461ff0019169055505050565b600054610100900460ff1680611f0f575060005460ff16155b611f2b5760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015611f4d576000805461ffff19166101011790555b611f55611f9d565b611f5d61209c565b8015611239576000805461ff001916905550565b60006108ce836001600160a01b0384166120fc565b6060611f95848460008561214b565b949350505050565b600054610100900460ff1680611fb6575060005460ff16155b611fd25760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff16158015611f5d576000805461ffff19166101011790558015611239576000805461ff001916905550565b600054610100900460ff1680612020575060005460ff16155b61203c5760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff1615801561205e576000805461ffff19166101011790555b82516120719060689060208601906122ac565b5081516120859060699060208501906122ac565b50801561184b576000805461ff0019169055505050565b600054610100900460ff16806120b5575060005460ff16155b6120d15760405162461bcd60e51b81526004016106149061280e565b600054610100900460ff161580156120f3576000805461ffff19166101011790555b611f5d33611bfc565b6000818152600183016020526040812054612143575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105e1565b5060006105e1565b6060824710156121ac5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610614565b843b6121fa5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610614565b600080866001600160a01b0316858760405161221691906128f7565b60006040518083038185875af1925050503d8060008114612253576040519150601f19603f3d011682016040523d82523d6000602084013e612258565b606091505b5091509150612268828286612273565b979650505050505050565b606083156122825750816108ce565b8251156122925782518084602001fd5b8160405162461bcd60e51b81526004016106149190612371565b8280546122b8906126de565b90600052602060002090601f0160209004810192826122da5760008555612320565b82601f106122f357805160ff1916838001178555612320565b82800160010185558215612320579182015b82811115612320578251825591602001919060010190612305565b5061232c929150612330565b5090565b5b8082111561232c5760008155600101612331565b60005b83811015612360578181015183820152602001612348565b838111156116ff5750506000910152565b6020815260008251806020840152612390816040850160208701612345565b601f01601f19169190910160400192915050565b6001600160a01b038116811461123957600080fd5b8035610db0816123a4565b600080604083850312156123d757600080fd5b82356123e2816123a4565b946020939093013593505050565b60008060006060848603121561240557600080fd5b8335612410816123a4565b95602085013595506040909401359392505050565b60006020828403121561243757600080fd5b81356108ce816123a4565b60008060006060848603121561245757600080fd5b8335612462816123a4565b92506020840135612472816123a4565b929592945050506040919091013590565b60006020828403121561249557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156124db576124db61249c565b604052919050565b600082601f8301126124f457600080fd5b813567ffffffffffffffff81111561250e5761250e61249c565b612521601f8201601f19166020016124b2565b81815284602083860101111561253657600080fd5b816020850160208301376000918101602001919091529392505050565b61ffff8116811461123957600080fd5b60008060008060008060c0878903121561257c57600080fd5b863567ffffffffffffffff8082111561259457600080fd5b6125a08a838b016124e3565b97506020915081890135818111156125b757600080fd5b6125c38b828c016124e3565b97505060408901356125d481612553565b95506060890135818111156125e857600080fd5b8901601f81018b136125f957600080fd5b80358281111561260b5761260b61249c565b8060051b925061261c8484016124b2565b818152928201840192848101908d85111561263657600080fd5b928501925b848410156126605783359250612650836123a4565b828252928501929085019061263b565b809850505050505050612675608088016123b9565b915060a087013590509295509295509295565b60006020828403121561269a57600080fd5b81356108ce81612553565b600080604083850312156126b857600080fd5b82356126c3816123a4565b915060208301356126d3816123a4565b809150509250929050565b600181811c908216806126f257607f821691505b6020821081141561271357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b602080825260159082015274746f6b656e20646f6573206e6f742065786973747360581b604082015260600190565b60006020828403121561278f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156127be576127be612796565b500390565b600082198211156127d6576127d6612796565b500190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561280357600080fd5b81516108ce81612553565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600060001982141561287057612870612796565b5060010190565b600061ffff80831681851680830382111561289457612894612796565b01949350505050565b6000826128ba57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156128d157600080fd5b815180151581146108ce57600080fd5b634e487b7160e01b600052603160045260246000fd5b60008251612909818460208701612345565b919091019291505056fea26469706673582212207ced23517adf631eaa9bc579adb41fcec53397666ede28edc06e69c60306106e64736f6c63430008090033