Address Details
contract
0x18F7fD11Ee989B8B708cdDfeDBD1B75887d83523
- Contract Name
- CarbonCreditBundleToken
- Creator
- 0x382e12–15731b at 0xa59777–17751e
- 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
- Fetching transactions...
- Transfers
- Fetching transfers...
- Gas Used
- Fetching gas used...
- Last Balance Update
- 16626068
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- CarbonCreditBundleToken
- Optimization enabled
- true
- Compiler version
- v0.8.13+commit.abaa5c0e
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2022-05-19T08:42:54.100249Z
project:/contracts/CarbonCreditBundleToken.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.13; 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; struct TokenChecksums { address _tokenAddress; uint256 _amount; } /// @notice Emitted when someone bundles tokens into the bundle token /// @param account - the token sender /// @param amount - the amount of tokens to bundle /// @param tokenAddress - the address of the vanilla underlying event Bundle(address account, uint256 amount, address tokenAddress); /// @notice Emitted when someone unbundles tokens from the bundle /// @param account - the token recipient /// @param amount - the amount of tokens to bundle /// @param tokenAddress - the address of the vanilla underlying event Unbundle(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 been 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 unbundling /// @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; /// @notice Keeps track of checksums, amounts and underlying tokens mapping (bytes32 => TokenChecksums) private _offsetChecksums; 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 bundled, 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 Bundles an underlying into the bundle, bundle need to be approved beforehand /// @param token_ - the carbon credit token to bundle /// @param amount_ - the amount one wants to bundle function bundle(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 Bundle(_msgSender(), amount_, tokenAddress); return true; } /// @notice Unbundles an underlying from the bundle, note that a fee may apply /// @param token_ - the carbon credit token to undbundle /// @param amount_ - the amount one wants to unbundle (including fee) /// @return the amount of tokens after fees function unbundle(CarbonCreditToken token_, uint256 amount_) external returns (uint256) { 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 amountToUnbundle = amount_; if (feeDivisor > 0) { uint256 feeAmount = amount_ / feeDivisor; amountToUnbundle = amount_ - feeAmount; token_.safeTransfer(owner(), feeAmount); } token_.safeTransfer(_msgSender(), amountToUnbundle); emit Unbundle(_msgSender(), amountToUnbundle, tokenAddress); return amountToUnbundle; } /// @notice The contract owner can finalize the offsetting process once the underlying tokens have been offset /// @param token_ - the carbon credit token to finalize the offsetting process for /// @param amount_ - the number of token to finalize offsetting process for /// @param checksum_ - the checksum associated with the underlying offset event function finalizeOffset(CarbonCreditToken token_, uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) { address tokenAddress = address(token_); require(_tokenAddresses.contains(tokenAddress), "token does not exists"); require(_offsetChecksums[checksum_]._amount == 0, "checksum was already used"); require(amount_ <= pendingBalance, 'offset exceeds pending balance'); require(token_.balanceOf(address(this)) >= amount_, "amount exceeds the token balance"); pendingBalance -= amount_; _offsetChecksums[checksum_] = TokenChecksums(tokenAddress, amount_); offsetBalance += amount_; token_.burn(amount_); emit FinalizeOffset(amount_, checksum_); return true; } /// @dev See ICarbonCreditTokenInterface function amountOffsettedWithChecksum(bytes32 checksum_) external view returns (uint256) { return _offsetChecksums[checksum_]._amount; } /// @param checksum_ - the checksum of the associated offset event of the underlying /// @return the address of the CarbonCreditToken that has been offset with this checksum function tokenAddressOffsettedWithChecksum(bytes32 checksum_) external view returns (address) { return _offsetChecksums[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.13; import "./abstracts/AbstractToken.sol"; import "./interfaces/ICarbonCreditPermissionList.sol"; /// @author FlowCarbon LLC /// @title A Carbon Credit Token Reference Implementation contract CarbonCreditToken is AbstractToken { struct TokenDetails { string methodology; string creditType; uint16 vintage; } /// @notice Token metadata TokenDetails private _details; /// @notice The permissionlist associated with this token ICarbonCreditPermissionList public permissionList; /// @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 tokens that were minted /// @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 offset event mapped to the number of finally offsetted tokens mapping (bytes32 => uint256) private _offsetChecksums; /// @notice Number of tokens removed from chain uint256 public movedOffChain; function initialize( string memory name_, string memory symbol_, TokenDetails memory details_, ICarbonCreditPermissionList permissionList_, 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_; permissionList = permissionList_; } /// @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 offsetting process once the underlying tokens have been offset /// @param amount_ - the number of token to finalize offsetting /// @param checksum_ - the checksum associated with the underlying offset event function finalizeOffset(uint256 amount_, bytes32 checksum_) external onlyOwner returns (bool) { require(_offsetChecksums[checksum_] == 0, "checksum was already used"); require(amount_ <= pendingBalance, "offset exceeds pending balance"); _offsetChecksums[checksum_] = amount_; pendingBalance -= amount_; offsetBalance += amount_; emit FinalizeOffset(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 See ICarbonCreditTokenInterface function amountOffsettedWithChecksum(bytes32 checksum_) external view returns (uint256) { return _offsetChecksums[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; } /// @notice Renounce the permission list, rendering this token non-permissioned /// NOTE: This operation is irreversible, it will leave the token permanently non-permissioned! function renouncePermissionList() onlyOwner external { permissionList = ICarbonCreditPermissionList(address(0)); } function setPermissionList(ICarbonCreditPermissionList permissionList_) onlyOwner external { require(address(permissionList) != address(0), "this operation is not allowed for non-permissioned tokens"); require(address(permissionList_) != address(0), "invalid attempt at renouncing the permission list - use renouncePermissionList() instead"); permissionList = permissionList_; } /// @notice Override ERC20.transfer to respect permission lists function _transfer(address from_, address to_, uint256 amount_) internal virtual override { if (address(permissionList) != address(0)) { require(permissionList.hasPermission(from_), "the sender is not permitted to transfer this token"); require(permissionList.hasPermission(to_), "the recipient is not permitted to receive this token"); } return super._transfer(from_, to_, amount_); } }
/project_/contracts/abstracts/AbstractToken.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.13; 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 { struct OffsetEntry { uint time; uint amount; } /// @notice Emitted when the underlying token is offset /// @param amount - the amount of tokens offset /// @param checksum - the checksum associated with the offset event event FinalizeOffset(uint256 amount, bytes32 checksum); /// @notice User mapping to the amount of offset tokens mapping (address => uint256) internal _offsetBalances; /// @notice Number of tokens offset by the protocol that have not been finalized yet uint256 public pendingBalance; /// @notice Number of tokens fully offset uint256 public offsetBalance; /// @dev Mapping of user to offsets to make them discoverable mapping(address => OffsetEntry[]) private _offsets; function __AbstractToken_init(string memory name_, string memory symbol_, address owner_) internal initializer { __ERC20_init(name_, symbol_); __Ownable_init(); transferOwnership(owner_); } /// @dev See ICarbonCreditTokenInterface function offsetCountOf(address address_) external view returns(uint256) { return _offsets[address_].length; } /// @dev See ICarbonCreditTokenInterface function offsetAmountAtIndex(address address_, uint256 index_) external view returns(uint256) { return _offsets[address_][index_].amount; } /// @dev See ICarbonCreditTokenInterface function offsetTimeAtIndex(address address_, uint256 index_) external view returns(uint256) { return _offsets[address_][index_].time; } //// @dev See ICarbonCreditTokenInterface function offsetBalanceOf(address account_) external view returns (uint256) { return _offsetBalances[account_]; } /// @dev Common functionality of the two offset functions function _offset(address account_, uint256 amount_) internal { _burn(_msgSender(), amount_); _offsetBalances[account_] += amount_; pendingBalance += amount_; _offsets[account_].push(OffsetEntry(block.timestamp, amount_)); emit Offset(account_, amount_); } /// @dev See ICarbonCreditTokenInterface function offsetOnBehalfOf(address account_, uint256 amount_) public { _offset(account_, amount_); } /// @dev See ICarbonCreditTokenInterface function offset(uint256 amount_) external { _offset(_msgSender(), amount_); } }
/project_/contracts/interfaces/ICarbonCreditPermissionList.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.13; /// @author FlowCarbon LLC /// @title The common interface of carbon credit permission lists interface ICarbonCreditPermissionList { /// @notice Emitted when the list state changes /// @param account - the account for which permissions have changed /// @param hasPermission - flag indicating wether permissions were granted or revoked event PermissionChanged(address account, bool hasPermission); // @notice Return the name of the list function name() external view returns (string memory); // @notice Grant or revoke permissions of an account // @param account_ - the address to which to grant or revoke permissions // @param hasPermission_ - flag indicating wether to grant or revoke permissions function setPermission(address account_, bool hasPermission_) external; // @notice Return the current permissions of an account // @param account_ - the address to check // @return flag indicating wether this account has permission or not function hasPermission(address account_) external view returns (bool); // @notice Return the address at the given list index // @param index_ - the index into the list // @return address at the given index function at(uint256 index_) external view returns (address); // @notice Get the number of accounts that have been granted permission // @return number of accounts that have been granted permission function length() external view returns (uint256); }
/project_/contracts/interfaces/ICarbonCreditTokenInterface.sol
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.13; /// @author FlowCarbon LLC /// @title The common interface of carbon credit tokens interface ICarbonCreditTokenInterface { /// @notice Emitted when someone offsets carbon tokens /// @param account - the account credited with offsetting /// @param amount - the amount of carbon that was offset event Offset(address account, uint256 amount); /// @notice Offset on behalf of the user /// @dev This will only offset tokens send by msg.sender, increases tokens awaiting finalization /// @param amount_ - the number of tokens to be offset function offset(uint256 amount_) external; /// @notice Offsets on behalf of the given address /// @dev This will offset tokens on behalf of account, increases tokens awaiting finalization /// @param account_ - the address off the account to offset on behalf of /// @param amount_ - the number of tokens to be offset function offsetOnBehalfOf(address account_, uint256 amount_) external; /// @notice Return the balance of tokens offsetted by the given address /// @param account_ - the account for which to check the number of tokens that were offset /// @return the number of tokens offsetted by the given account function offsetBalanceOf(address account_) external view returns (uint256); /// @notice Return the balance of tokens offsetted by an address that match the given checksum /// @param checksum_ - the checksum of the associated offset event of the underlying token /// @return the number of tokens that have been offsetted with this checksum function amountOffsettedWithChecksum(bytes32 checksum_) external view returns (uint256); /// @notice Returns the number of offsets for the given address /// @dev This is a pattern to discover all offsets and their occurrences for a user /// @param address_ - address of the user that offsetted the tokens function offsetCountOf(address address_) external view returns(uint256); /// @notice Returns amount of offsetted tokens for the given address and index /// @param address_ - address of the user who did the offsets /// @param index_ - index into the list function offsetAmountAtIndex(address address_, uint256 index_) external view returns(uint256); /// @notice Returns the timestamp of an offset for the given address and index /// @param address_ - address of the user who did the offsets /// @param index_ - index into the list function offsetTimeAtIndex(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":"Bundle","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":"FinalizeOffset","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes32","name":"checksum","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"Offset","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","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":"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":"Unbundle","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":"VintageIncremented","inputs":[{"type":"uint16","name":"vintage","internalType":"uint16","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":"amountOffsettedWithChecksum","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":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"bundle","inputs":[{"type":"address","name":"token_","internalType":"contract CarbonCreditToken"},{"type":"uint256","name":"amount_","internalType":"uint256"}]},{"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":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeDivisor","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"finalizeOffset","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":"nonpayable","outputs":[],"name":"offset","inputs":[{"type":"uint256","name":"amount_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"offsetAmountAtIndex","inputs":[{"type":"address","name":"address_","internalType":"address"},{"type":"uint256","name":"index_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"offsetBalance","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"offsetBalanceOf","inputs":[{"type":"address","name":"account_","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"offsetCountOf","inputs":[{"type":"address","name":"address_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"offsetOnBehalfOf","inputs":[{"type":"address","name":"account_","internalType":"address"},{"type":"uint256","name":"amount_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"offsetTimeAtIndex","inputs":[{"type":"address","name":"address_","internalType":"address"},{"type":"uint256","name":"index_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingBalance","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":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenAddressOffsettedWithChecksum","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":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"unbundle","inputs":[{"type":"address","name":"token_","internalType":"contract CarbonCreditToken"},{"type":"uint256","name":"amount_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16","name":"","internalType":"uint16"}],"name":"vintage","inputs":[]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50612928806100206000396000f3fe608060405234801561001057600080fd5b506004361061021c5760003560e01c806392003cec11610125578063b4dc3dc7116100ad578063d48bfca71161007c578063d48bfca7146104bd578063dd62ed3e146104d0578063e383d6bb14610509578063eba3cdfe14610532578063f2fde38b1461054557600080fd5b8063b4dc3dc714610465578063b4f7438014610478578063bc1905cb1461048b578063cdcf35b8146104b457600080fd5b80639bd2ef98116100f45780639bd2ef98146103fb5780639f181b5e14610424578063a457c2d71461042c578063a9059cbb1461043f578063aa0480f71461045257600080fd5b806392003cec146103c457806395d89b41146103d75780639a36f932146103df5780639bb0f599146103e857600080fd5b80635726dd86116101a857806363bcdaaa1161017757806363bcdaaa1461034e57806370a0823114610361578063715018a61461038a5780638da5cb5b146103925780638da61ee0146103a357600080fd5b80635726dd86146102fc57806357b4d18e1461031f5780635fa7b584146103285780636202b6421461033b57600080fd5b80631b1de240116101ef5780631b1de2401461028957806323b872dd1461029c578063313ce567146102af57806339509351146102be57806341f1afc7146102d157600080fd5b806306fdde0314610221578063095ea7b31461023f578063169da0451461026257806318160ddd14610277575b600080fd5b610229610558565b6040516102369190612353565b60405180910390f35b61025261024d3660046123a6565b6105ea565b6040519015158152602001610236565b6102756102703660046123a6565b610601565b005b6067545b604051908152602001610236565b6102526102973660046123d2565b61060f565b6102526102aa366004612407565b6108ee565b60405160128152602001610236565b6102526102cc3660046123a6565b610998565b6102e46102df366004612448565b6109d4565b6040516001600160a01b039091168152602001610236565b61027b61030a366004612448565b6000908152609f602052604090206001015490565b61027b60985481565b610252610336366004612461565b6109e1565b61027b6103493660046123a6565b610b3e565b61027561035c366004612545565b610b82565b61027b61036f366004612461565b6001600160a01b031660009081526065602052604090205490565b610275610cf1565b6033546001600160a01b03166102e4565b609c546103b19061ffff1681565b60405161ffff9091168152602001610236565b6102756103d2366004612448565b610d27565b610229610d34565b61027b609b5481565b6102526103f6366004612461565b610d43565b61027b610409366004612461565b6001600160a01b03166000908152609a602052604090205490565b61027b610d50565b61025261043a3660046123a6565b610d61565b61025261044d3660046123a6565b610dfa565b6103b161046036600461266a565b610e07565b61027b6104733660046123a6565b610f01565b61027b6104863660046123a6565b6110a1565b61027b610499366004612461565b6001600160a01b031660009081526097602052604090205490565b61027b60995481565b6102526104cb366004612461565b6110e5565b61027b6104de366004612687565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205490565b6102e4610517366004612448565b6000908152609f60205260409020546001600160a01b031690565b6102526105403660046123a6565b61111b565b610275610553366004612461565b611270565b606060688054610567906126c0565b80601f0160208091040260200160405190810160405280929190818152602001828054610593906126c0565b80156105e05780601f106105b5576101008083540402835291602001916105e0565b820191906000526020600020905b8154815290600101906020018083116105c357829003601f168201915b5050505050905090565b60006105f7338484611308565b5060015b92915050565b61060b828261142d565b5050565b6033546000906001600160a01b031633146106455760405162461bcd60e51b815260040161063c906126fa565b60405180910390fd5b83610651609d82611505565b61066d5760405162461bcd60e51b815260040161063c9061272f565b6000838152609f6020526040902060010154156106cc5760405162461bcd60e51b815260206004820152601960248201527f636865636b73756d2077617320616c7265616479207573656400000000000000604482015260640161063c565b60985484111561071e5760405162461bcd60e51b815260206004820152601e60248201527f6f666673657420657863656564732070656e64696e672062616c616e63650000604482015260640161063c565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a0823190602401602060405180830381865afa158015610764573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610788919061275e565b10156107d65760405162461bcd60e51b815260206004820181905260248201527f616d6f756e7420657863656564732074686520746f6b656e2062616c616e6365604482015260640161063c565b83609860008282546107e8919061278d565b90915550506040805180820182526001600160a01b03838116825260208083018881526000888152609f909252938120925183546001600160a01b03191692169190911782559151600190910155609980548692906108489084906127a4565b9091555050604051630852cd8d60e31b8152600481018590526001600160a01b038616906342966c6890602401600060405180830381600087803b15801561088f57600080fd5b505af11580156108a3573d6000803e3d6000fd5b505060408051878152602081018790527f532709d2ea1c0a15357d1ecde99a26077d0d42cc72899a902bc9bc019b57224e935001905060405180910390a160019150505b9392505050565b60006108fb848484611527565b6001600160a01b0384166000908152606660209081526040808320338452909152902054828110156109805760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b606482015260840161063c565b61098d8533858403611308565b506001949350505050565b3360008181526066602090815260408083206001600160a01b038716845290915281205490916105f79185906109cf9086906127a4565b611308565b60006105fb609d836116f7565b6033546000906001600160a01b03163314610a0e5760405162461bcd60e51b815260040161063c906126fa565b81610a1a609d82611505565b610a365760405162461bcd60e51b815260040161063c9061272f565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610a7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9e919061275e565b15610aeb5760405162461bcd60e51b815260206004820152601b60248201527f746f6b656e206861732072656d61696e696e672062616c616e63650000000000604482015260640161063c565b610af6609d82611703565b506040516001600160a01b03821681527f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd39060200160405180910390a160019150505b919050565b6001600160a01b0382166000908152609a60205260408120805483908110610b6857610b686127bc565b906000526020600020906002020160000154905092915050565b600054610100900460ff1680610b9b575060005460ff16155b610bb75760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015610bd9576000805461ffff19166101011790555b6107d08561ffff1611610c265760405162461bcd60e51b815260206004820152601560248201527476696e74616765206f7574206f6620626f756e647360581b604482015260640161063c565b6108348561ffff1610610c735760405162461bcd60e51b815260206004820152601560248201527476696e74616765206f7574206f6620626f756e647360581b604482015260640161063c565b610c7e878785611718565b609c805461ffff191661ffff8716179055609b82905560005b8451811015610cd557610cc2858281518110610cb557610cb56127bc565b60200260200101516117a1565b5080610ccd81612820565b915050610c97565b508015610ce8576000805461ff00191690555b50505050505050565b6033546001600160a01b03163314610d1b5760405162461bcd60e51b815260040161063c906126fa565b610d256000611949565b565b610d31338261142d565b50565b606060698054610567906126c0565b60006105fb609d83611505565b6000610d5c609d61199b565b905090565b3360009081526066602090815260408083206001600160a01b038616845290915281205482811015610de35760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161063c565b610df03385858403611308565b5060019392505050565b60006105f7338484611527565b6033546000906001600160a01b03163314610e345760405162461bcd60e51b815260040161063c906126fa565b600a8261ffff161115610e895760405162461bcd60e51b815260206004820152601f60248201527f76696e7461676520696e6372656d656e74206f7574206f6620626f756e647300604482015260640161063c565b609c8054839190600090610ea290849061ffff16612839565b82546101009290920a61ffff818102199093169183160217909155609c54604051911681527f092ea5dd2ad1afe704131ac8713bf04b9b840be8f31b75d0eb10aca01b53763a915060200160405180910390a15050609c5461ffff1690565b600082610f0f609d82611505565b610f2b5760405162461bcd60e51b815260040161063c9061272f565b6040516370a0823160e01b815230600482015283906001600160a01b038616906370a0823190602401602060405180830381865afa158015610f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f95919061275e565b1015610fe35760405162461bcd60e51b815260206004820181905260248201527f616d6f756e7420657863656564732074686520746f6b656e2062616c616e6365604482015260640161063c565b610fed33846119a5565b609b5483901561103d576000609b5485611007919061285f565b9050611013818661278d565b915061103b61102a6033546001600160a01b031690565b6001600160a01b0388169083611af0565b505b6110516001600160a01b0386163383611af0565b60408051338152602081018390526001600160a01b0384168183015290517fce49cb319f475bc1c5c9e2fee7591b0d5a5b0ad474292ceccd43c4a5c35f8ff29181900360600190a1949350505050565b6001600160a01b0382166000908152609a602052604081208054839081106110cb576110cb6127bc565b906000526020600020906002020160010154905092915050565b6033546000906001600160a01b031633146111125760405162461bcd60e51b815260040161063c906126fa565b6105f7826117a1565b600082611129609d82611505565b6111455760405162461bcd60e51b815260040161063c9061272f565b609c60009054906101000a900461ffff1661ffff16846001600160a01b0316638da61ee06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc9190612881565b61ffff1610156111ff5760405162461bcd60e51b815260206004820152600e60248201526d1d1bdad95b881bdd5d19185d195960921b604482015260640161063c565b6112093384611b53565b61121e6001600160a01b038516333086611c32565b60408051338152602081018590526001600160a01b0383168183015290517f25b5c811ccf2ce762052d609df7e49902dffd07dbb29fbf039cfcdb6cf0376089181900360600190a15060019392505050565b6033546001600160a01b0316331461129a5760405162461bcd60e51b815260040161063c906126fa565b6001600160a01b0381166112ff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161063c565b610d3181611949565b6001600160a01b03831661136a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063c565b6001600160a01b0382166113cb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063c565b6001600160a01b0383811660008181526066602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b61143733826119a5565b6001600160a01b0382166000908152609760205260408120805483929061145f9084906127a4565b92505081905550806098600082825461147891906127a4565b90915550506001600160a01b0382166000818152609a6020908152604080832081518083018352428152808401878152825460018082018555938752958590209151600290960290910194855551930192909255815192835282018390527f34ea76956884cf5a870184e95247be7a9ce55b0fd84ac7a88665a0bdad0085f1910160405180910390a15050565b6001600160a01b038116600090815260018301602052604081205415156108e7565b6001600160a01b03831661158b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161063c565b6001600160a01b0382166115ed5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161063c565b6001600160a01b038316600090815260656020526040902054818110156116655760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161063c565b6001600160a01b0380851660009081526065602052604080822085850390559185168152908120805484929061169c9084906127a4565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116e891815260200190565b60405180910390a35b50505050565b60006108e78383611c6a565b60006108e7836001600160a01b038416611c94565b600054610100900460ff1680611731575060005460ff16155b61174d5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff1615801561176f576000805461ffff19166101011790555b6117798484611d87565b611781611e06565b61178a82611270565b80156116f1576000805461ff001916905550505050565b60006117ac82610d43565b156117f05760405162461bcd60e51b8152602060048201526014602482015273746f6b656e20616c72656164792065786973747360601b604482015260640161063c565b609c60009054906101000a900461ffff1661ffff16826001600160a01b0316638da61ee06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611843573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118679190612881565b61ffff1610156118ac5760405162461bcd60e51b815260206004820152601060248201526f0ecd2dce8c2ceca40dad2e6dac2e8c6d60831b604482015260640161063c565b306001600160a01b038316036118f95760405162461bcd60e51b815260206004820152601260248201527131b0b73737ba1030b232103a379039b2b63360711b604482015260640161063c565b611904609d83611e81565b506040516001600160a01b03831681527f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49060200160405180910390a1506001919050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006105fb825490565b6001600160a01b038216611a055760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161063c565b6001600160a01b03821660009081526065602052604090205481811015611a795760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161063c565b6001600160a01b0383166000908152606560205260408120838303905560678054849290611aa890849061278d565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611420565b505050565b6040516001600160a01b038316602482015260448101829052611aeb90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611e96565b6001600160a01b038216611ba95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161063c565b8060676000828254611bbb91906127a4565b90915550506001600160a01b03821660009081526065602052604081208054839290611be89084906127a4565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526116f19085906323b872dd60e01b90608401611b1c565b6000826000018281548110611c8157611c816127bc565b9060005260206000200154905092915050565b60008181526001830160205260408120548015611d7d576000611cb860018361278d565b8554909150600090611ccc9060019061278d565b9050818114611d31576000866000018281548110611cec57611cec6127bc565b9060005260206000200154905080876000018481548110611d0f57611d0f6127bc565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611d4257611d4261289e565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105fb565b60009150506105fb565b600054610100900460ff1680611da0575060005460ff16155b611dbc5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015611dde576000805461ffff19166101011790555b611de6611f68565b611df08383611fd2565b8015611aeb576000805461ff0019169055505050565b600054610100900460ff1680611e1f575060005460ff16155b611e3b5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015611e5d576000805461ffff19166101011790555b611e65611f68565b611e6d612067565b8015610d31576000805461ff001916905550565b60006108e7836001600160a01b0384166120c7565b6000611eeb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121169092919063ffffffff16565b805190915015611aeb5780806020019051810190611f0991906128b4565b611aeb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161063c565b600054610100900460ff1680611f81575060005460ff16155b611f9d5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015611e6d576000805461ffff19166101011790558015610d31576000805461ff001916905550565b600054610100900460ff1680611feb575060005460ff16155b6120075760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015612029576000805461ffff19166101011790555b825161203c90606890602086019061228e565b50815161205090606990602085019061228e565b508015611aeb576000805461ff0019169055505050565b600054610100900460ff1680612080575060005460ff16155b61209c5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff161580156120be576000805461ffff19166101011790555b611e6d33611949565b600081815260018301602052604081205461210e575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105fb565b5060006105fb565b6060612125848460008561212d565b949350505050565b60608247101561218e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161063c565b843b6121dc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161063c565b600080866001600160a01b031685876040516121f891906128d6565b60006040518083038185875af1925050503d8060008114612235576040519150601f19603f3d011682016040523d82523d6000602084013e61223a565b606091505b509150915061224a828286612255565b979650505050505050565b606083156122645750816108e7565b8251156122745782518084602001fd5b8160405162461bcd60e51b815260040161063c9190612353565b82805461229a906126c0565b90600052602060002090601f0160209004810192826122bc5760008555612302565b82601f106122d557805160ff1916838001178555612302565b82800160010185558215612302579182015b828111156123025782518255916020019190600101906122e7565b5061230e929150612312565b5090565b5b8082111561230e5760008155600101612313565b60005b8381101561234257818101518382015260200161232a565b838111156116f15750506000910152565b6020815260008251806020840152612372816040850160208701612327565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610d3157600080fd5b8035610b3981612386565b600080604083850312156123b957600080fd5b82356123c481612386565b946020939093013593505050565b6000806000606084860312156123e757600080fd5b83356123f281612386565b95602085013595506040909401359392505050565b60008060006060848603121561241c57600080fd5b833561242781612386565b9250602084013561243781612386565b929592945050506040919091013590565b60006020828403121561245a57600080fd5b5035919050565b60006020828403121561247357600080fd5b81356108e781612386565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156124bd576124bd61247e565b604052919050565b600082601f8301126124d657600080fd5b813567ffffffffffffffff8111156124f0576124f061247e565b612503601f8201601f1916602001612494565b81815284602083860101111561251857600080fd5b816020850160208301376000918101602001919091529392505050565b61ffff81168114610d3157600080fd5b60008060008060008060c0878903121561255e57600080fd5b863567ffffffffffffffff8082111561257657600080fd5b6125828a838b016124c5565b975060209150818901358181111561259957600080fd5b6125a58b828c016124c5565b97505060408901356125b681612535565b95506060890135818111156125ca57600080fd5b8901601f81018b136125db57600080fd5b8035828111156125ed576125ed61247e565b8060051b92506125fe848401612494565b818152928201840192848101908d85111561261857600080fd5b928501925b84841015612642578335925061263283612386565b828252928501929085019061261d565b8098505050505050506126576080880161239b565b915060a087013590509295509295509295565b60006020828403121561267c57600080fd5b81356108e781612535565b6000806040838503121561269a57600080fd5b82356126a581612386565b915060208301356126b581612386565b809150509250929050565b600181811c908216806126d457607f821691505b6020821081036126f457634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b602080825260159082015274746f6b656e20646f6573206e6f742065786973747360581b604082015260600190565b60006020828403121561277057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561279f5761279f612777565b500390565b600082198211156127b7576127b7612777565b500190565b634e487b7160e01b600052603260045260246000fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60006001820161283257612832612777565b5060010190565b600061ffff80831681851680830382111561285657612856612777565b01949350505050565b60008261287c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561289357600080fd5b81516108e781612535565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156128c657600080fd5b815180151581146108e757600080fd5b600082516128e8818460208701612327565b919091019291505056fea264697066735822122056e0ad1bb4cb99e9970a32b42effc7bc4f8c198951daa71e60b1211947c66b7964736f6c634300080d0033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061021c5760003560e01c806392003cec11610125578063b4dc3dc7116100ad578063d48bfca71161007c578063d48bfca7146104bd578063dd62ed3e146104d0578063e383d6bb14610509578063eba3cdfe14610532578063f2fde38b1461054557600080fd5b8063b4dc3dc714610465578063b4f7438014610478578063bc1905cb1461048b578063cdcf35b8146104b457600080fd5b80639bd2ef98116100f45780639bd2ef98146103fb5780639f181b5e14610424578063a457c2d71461042c578063a9059cbb1461043f578063aa0480f71461045257600080fd5b806392003cec146103c457806395d89b41146103d75780639a36f932146103df5780639bb0f599146103e857600080fd5b80635726dd86116101a857806363bcdaaa1161017757806363bcdaaa1461034e57806370a0823114610361578063715018a61461038a5780638da5cb5b146103925780638da61ee0146103a357600080fd5b80635726dd86146102fc57806357b4d18e1461031f5780635fa7b584146103285780636202b6421461033b57600080fd5b80631b1de240116101ef5780631b1de2401461028957806323b872dd1461029c578063313ce567146102af57806339509351146102be57806341f1afc7146102d157600080fd5b806306fdde0314610221578063095ea7b31461023f578063169da0451461026257806318160ddd14610277575b600080fd5b610229610558565b6040516102369190612353565b60405180910390f35b61025261024d3660046123a6565b6105ea565b6040519015158152602001610236565b6102756102703660046123a6565b610601565b005b6067545b604051908152602001610236565b6102526102973660046123d2565b61060f565b6102526102aa366004612407565b6108ee565b60405160128152602001610236565b6102526102cc3660046123a6565b610998565b6102e46102df366004612448565b6109d4565b6040516001600160a01b039091168152602001610236565b61027b61030a366004612448565b6000908152609f602052604090206001015490565b61027b60985481565b610252610336366004612461565b6109e1565b61027b6103493660046123a6565b610b3e565b61027561035c366004612545565b610b82565b61027b61036f366004612461565b6001600160a01b031660009081526065602052604090205490565b610275610cf1565b6033546001600160a01b03166102e4565b609c546103b19061ffff1681565b60405161ffff9091168152602001610236565b6102756103d2366004612448565b610d27565b610229610d34565b61027b609b5481565b6102526103f6366004612461565b610d43565b61027b610409366004612461565b6001600160a01b03166000908152609a602052604090205490565b61027b610d50565b61025261043a3660046123a6565b610d61565b61025261044d3660046123a6565b610dfa565b6103b161046036600461266a565b610e07565b61027b6104733660046123a6565b610f01565b61027b6104863660046123a6565b6110a1565b61027b610499366004612461565b6001600160a01b031660009081526097602052604090205490565b61027b60995481565b6102526104cb366004612461565b6110e5565b61027b6104de366004612687565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205490565b6102e4610517366004612448565b6000908152609f60205260409020546001600160a01b031690565b6102526105403660046123a6565b61111b565b610275610553366004612461565b611270565b606060688054610567906126c0565b80601f0160208091040260200160405190810160405280929190818152602001828054610593906126c0565b80156105e05780601f106105b5576101008083540402835291602001916105e0565b820191906000526020600020905b8154815290600101906020018083116105c357829003601f168201915b5050505050905090565b60006105f7338484611308565b5060015b92915050565b61060b828261142d565b5050565b6033546000906001600160a01b031633146106455760405162461bcd60e51b815260040161063c906126fa565b60405180910390fd5b83610651609d82611505565b61066d5760405162461bcd60e51b815260040161063c9061272f565b6000838152609f6020526040902060010154156106cc5760405162461bcd60e51b815260206004820152601960248201527f636865636b73756d2077617320616c7265616479207573656400000000000000604482015260640161063c565b60985484111561071e5760405162461bcd60e51b815260206004820152601e60248201527f6f666673657420657863656564732070656e64696e672062616c616e63650000604482015260640161063c565b6040516370a0823160e01b815230600482015284906001600160a01b038716906370a0823190602401602060405180830381865afa158015610764573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610788919061275e565b10156107d65760405162461bcd60e51b815260206004820181905260248201527f616d6f756e7420657863656564732074686520746f6b656e2062616c616e6365604482015260640161063c565b83609860008282546107e8919061278d565b90915550506040805180820182526001600160a01b03838116825260208083018881526000888152609f909252938120925183546001600160a01b03191692169190911782559151600190910155609980548692906108489084906127a4565b9091555050604051630852cd8d60e31b8152600481018590526001600160a01b038616906342966c6890602401600060405180830381600087803b15801561088f57600080fd5b505af11580156108a3573d6000803e3d6000fd5b505060408051878152602081018790527f532709d2ea1c0a15357d1ecde99a26077d0d42cc72899a902bc9bc019b57224e935001905060405180910390a160019150505b9392505050565b60006108fb848484611527565b6001600160a01b0384166000908152606660209081526040808320338452909152902054828110156109805760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b606482015260840161063c565b61098d8533858403611308565b506001949350505050565b3360008181526066602090815260408083206001600160a01b038716845290915281205490916105f79185906109cf9086906127a4565b611308565b60006105fb609d836116f7565b6033546000906001600160a01b03163314610a0e5760405162461bcd60e51b815260040161063c906126fa565b81610a1a609d82611505565b610a365760405162461bcd60e51b815260040161063c9061272f565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610a7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9e919061275e565b15610aeb5760405162461bcd60e51b815260206004820152601b60248201527f746f6b656e206861732072656d61696e696e672062616c616e63650000000000604482015260640161063c565b610af6609d82611703565b506040516001600160a01b03821681527f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd39060200160405180910390a160019150505b919050565b6001600160a01b0382166000908152609a60205260408120805483908110610b6857610b686127bc565b906000526020600020906002020160000154905092915050565b600054610100900460ff1680610b9b575060005460ff16155b610bb75760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015610bd9576000805461ffff19166101011790555b6107d08561ffff1611610c265760405162461bcd60e51b815260206004820152601560248201527476696e74616765206f7574206f6620626f756e647360581b604482015260640161063c565b6108348561ffff1610610c735760405162461bcd60e51b815260206004820152601560248201527476696e74616765206f7574206f6620626f756e647360581b604482015260640161063c565b610c7e878785611718565b609c805461ffff191661ffff8716179055609b82905560005b8451811015610cd557610cc2858281518110610cb557610cb56127bc565b60200260200101516117a1565b5080610ccd81612820565b915050610c97565b508015610ce8576000805461ff00191690555b50505050505050565b6033546001600160a01b03163314610d1b5760405162461bcd60e51b815260040161063c906126fa565b610d256000611949565b565b610d31338261142d565b50565b606060698054610567906126c0565b60006105fb609d83611505565b6000610d5c609d61199b565b905090565b3360009081526066602090815260408083206001600160a01b038616845290915281205482811015610de35760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161063c565b610df03385858403611308565b5060019392505050565b60006105f7338484611527565b6033546000906001600160a01b03163314610e345760405162461bcd60e51b815260040161063c906126fa565b600a8261ffff161115610e895760405162461bcd60e51b815260206004820152601f60248201527f76696e7461676520696e6372656d656e74206f7574206f6620626f756e647300604482015260640161063c565b609c8054839190600090610ea290849061ffff16612839565b82546101009290920a61ffff818102199093169183160217909155609c54604051911681527f092ea5dd2ad1afe704131ac8713bf04b9b840be8f31b75d0eb10aca01b53763a915060200160405180910390a15050609c5461ffff1690565b600082610f0f609d82611505565b610f2b5760405162461bcd60e51b815260040161063c9061272f565b6040516370a0823160e01b815230600482015283906001600160a01b038616906370a0823190602401602060405180830381865afa158015610f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f95919061275e565b1015610fe35760405162461bcd60e51b815260206004820181905260248201527f616d6f756e7420657863656564732074686520746f6b656e2062616c616e6365604482015260640161063c565b610fed33846119a5565b609b5483901561103d576000609b5485611007919061285f565b9050611013818661278d565b915061103b61102a6033546001600160a01b031690565b6001600160a01b0388169083611af0565b505b6110516001600160a01b0386163383611af0565b60408051338152602081018390526001600160a01b0384168183015290517fce49cb319f475bc1c5c9e2fee7591b0d5a5b0ad474292ceccd43c4a5c35f8ff29181900360600190a1949350505050565b6001600160a01b0382166000908152609a602052604081208054839081106110cb576110cb6127bc565b906000526020600020906002020160010154905092915050565b6033546000906001600160a01b031633146111125760405162461bcd60e51b815260040161063c906126fa565b6105f7826117a1565b600082611129609d82611505565b6111455760405162461bcd60e51b815260040161063c9061272f565b609c60009054906101000a900461ffff1661ffff16846001600160a01b0316638da61ee06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc9190612881565b61ffff1610156111ff5760405162461bcd60e51b815260206004820152600e60248201526d1d1bdad95b881bdd5d19185d195960921b604482015260640161063c565b6112093384611b53565b61121e6001600160a01b038516333086611c32565b60408051338152602081018590526001600160a01b0383168183015290517f25b5c811ccf2ce762052d609df7e49902dffd07dbb29fbf039cfcdb6cf0376089181900360600190a15060019392505050565b6033546001600160a01b0316331461129a5760405162461bcd60e51b815260040161063c906126fa565b6001600160a01b0381166112ff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161063c565b610d3181611949565b6001600160a01b03831661136a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063c565b6001600160a01b0382166113cb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063c565b6001600160a01b0383811660008181526066602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b61143733826119a5565b6001600160a01b0382166000908152609760205260408120805483929061145f9084906127a4565b92505081905550806098600082825461147891906127a4565b90915550506001600160a01b0382166000818152609a6020908152604080832081518083018352428152808401878152825460018082018555938752958590209151600290960290910194855551930192909255815192835282018390527f34ea76956884cf5a870184e95247be7a9ce55b0fd84ac7a88665a0bdad0085f1910160405180910390a15050565b6001600160a01b038116600090815260018301602052604081205415156108e7565b6001600160a01b03831661158b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161063c565b6001600160a01b0382166115ed5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161063c565b6001600160a01b038316600090815260656020526040902054818110156116655760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161063c565b6001600160a01b0380851660009081526065602052604080822085850390559185168152908120805484929061169c9084906127a4565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116e891815260200190565b60405180910390a35b50505050565b60006108e78383611c6a565b60006108e7836001600160a01b038416611c94565b600054610100900460ff1680611731575060005460ff16155b61174d5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff1615801561176f576000805461ffff19166101011790555b6117798484611d87565b611781611e06565b61178a82611270565b80156116f1576000805461ff001916905550505050565b60006117ac82610d43565b156117f05760405162461bcd60e51b8152602060048201526014602482015273746f6b656e20616c72656164792065786973747360601b604482015260640161063c565b609c60009054906101000a900461ffff1661ffff16826001600160a01b0316638da61ee06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611843573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118679190612881565b61ffff1610156118ac5760405162461bcd60e51b815260206004820152601060248201526f0ecd2dce8c2ceca40dad2e6dac2e8c6d60831b604482015260640161063c565b306001600160a01b038316036118f95760405162461bcd60e51b815260206004820152601260248201527131b0b73737ba1030b232103a379039b2b63360711b604482015260640161063c565b611904609d83611e81565b506040516001600160a01b03831681527f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49060200160405180910390a1506001919050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006105fb825490565b6001600160a01b038216611a055760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161063c565b6001600160a01b03821660009081526065602052604090205481811015611a795760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161063c565b6001600160a01b0383166000908152606560205260408120838303905560678054849290611aa890849061278d565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611420565b505050565b6040516001600160a01b038316602482015260448101829052611aeb90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611e96565b6001600160a01b038216611ba95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161063c565b8060676000828254611bbb91906127a4565b90915550506001600160a01b03821660009081526065602052604081208054839290611be89084906127a4565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526116f19085906323b872dd60e01b90608401611b1c565b6000826000018281548110611c8157611c816127bc565b9060005260206000200154905092915050565b60008181526001830160205260408120548015611d7d576000611cb860018361278d565b8554909150600090611ccc9060019061278d565b9050818114611d31576000866000018281548110611cec57611cec6127bc565b9060005260206000200154905080876000018481548110611d0f57611d0f6127bc565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611d4257611d4261289e565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105fb565b60009150506105fb565b600054610100900460ff1680611da0575060005460ff16155b611dbc5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015611dde576000805461ffff19166101011790555b611de6611f68565b611df08383611fd2565b8015611aeb576000805461ff0019169055505050565b600054610100900460ff1680611e1f575060005460ff16155b611e3b5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015611e5d576000805461ffff19166101011790555b611e65611f68565b611e6d612067565b8015610d31576000805461ff001916905550565b60006108e7836001600160a01b0384166120c7565b6000611eeb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121169092919063ffffffff16565b805190915015611aeb5780806020019051810190611f0991906128b4565b611aeb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161063c565b600054610100900460ff1680611f81575060005460ff16155b611f9d5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015611e6d576000805461ffff19166101011790558015610d31576000805461ff001916905550565b600054610100900460ff1680611feb575060005460ff16155b6120075760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff16158015612029576000805461ffff19166101011790555b825161203c90606890602086019061228e565b50815161205090606990602085019061228e565b508015611aeb576000805461ff0019169055505050565b600054610100900460ff1680612080575060005460ff16155b61209c5760405162461bcd60e51b815260040161063c906127d2565b600054610100900460ff161580156120be576000805461ffff19166101011790555b611e6d33611949565b600081815260018301602052604081205461210e575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105fb565b5060006105fb565b6060612125848460008561212d565b949350505050565b60608247101561218e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161063c565b843b6121dc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161063c565b600080866001600160a01b031685876040516121f891906128d6565b60006040518083038185875af1925050503d8060008114612235576040519150601f19603f3d011682016040523d82523d6000602084013e61223a565b606091505b509150915061224a828286612255565b979650505050505050565b606083156122645750816108e7565b8251156122745782518084602001fd5b8160405162461bcd60e51b815260040161063c9190612353565b82805461229a906126c0565b90600052602060002090601f0160209004810192826122bc5760008555612302565b82601f106122d557805160ff1916838001178555612302565b82800160010185558215612302579182015b828111156123025782518255916020019190600101906122e7565b5061230e929150612312565b5090565b5b8082111561230e5760008155600101612313565b60005b8381101561234257818101518382015260200161232a565b838111156116f15750506000910152565b6020815260008251806020840152612372816040850160208701612327565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610d3157600080fd5b8035610b3981612386565b600080604083850312156123b957600080fd5b82356123c481612386565b946020939093013593505050565b6000806000606084860312156123e757600080fd5b83356123f281612386565b95602085013595506040909401359392505050565b60008060006060848603121561241c57600080fd5b833561242781612386565b9250602084013561243781612386565b929592945050506040919091013590565b60006020828403121561245a57600080fd5b5035919050565b60006020828403121561247357600080fd5b81356108e781612386565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156124bd576124bd61247e565b604052919050565b600082601f8301126124d657600080fd5b813567ffffffffffffffff8111156124f0576124f061247e565b612503601f8201601f1916602001612494565b81815284602083860101111561251857600080fd5b816020850160208301376000918101602001919091529392505050565b61ffff81168114610d3157600080fd5b60008060008060008060c0878903121561255e57600080fd5b863567ffffffffffffffff8082111561257657600080fd5b6125828a838b016124c5565b975060209150818901358181111561259957600080fd5b6125a58b828c016124c5565b97505060408901356125b681612535565b95506060890135818111156125ca57600080fd5b8901601f81018b136125db57600080fd5b8035828111156125ed576125ed61247e565b8060051b92506125fe848401612494565b818152928201840192848101908d85111561261857600080fd5b928501925b84841015612642578335925061263283612386565b828252928501929085019061261d565b8098505050505050506126576080880161239b565b915060a087013590509295509295509295565b60006020828403121561267c57600080fd5b81356108e781612535565b6000806040838503121561269a57600080fd5b82356126a581612386565b915060208301356126b581612386565b809150509250929050565b600181811c908216806126d457607f821691505b6020821081036126f457634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b602080825260159082015274746f6b656e20646f6573206e6f742065786973747360581b604082015260600190565b60006020828403121561277057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561279f5761279f612777565b500390565b600082198211156127b7576127b7612777565b500190565b634e487b7160e01b600052603260045260246000fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60006001820161283257612832612777565b5060010190565b600061ffff80831681851680830382111561285657612856612777565b01949350505050565b60008261287c57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561289357600080fd5b81516108e781612535565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156128c657600080fd5b815180151581146108e757600080fd5b600082516128e8818460208701612327565b919091019291505056fea264697066735822122056e0ad1bb4cb99e9970a32b42effc7bc4f8c198951daa71e60b1211947c66b7964736f6c634300080d0033