Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- WrappedTDOT
- Optimization enabled
- true
- Compiler version
- v0.8.17+commit.8df45f5f
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2023-09-12T14:10:49.089374Z
Constructor Arguments
0x0000000000000000000000000000000000000000000300000000000000000000
Arg [0] (address) : 0x0000000000000000000300000000000000000000
Contract source code
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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);
/**
* @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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
/**
* @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 SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 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(IERC20 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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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(IERC20 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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
/*//////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public immutable decimals;
/*//////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/*//////////////////////////////////////////////////////////////
EIP-2612 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
}
/*//////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
return true;
}
/*//////////////////////////////////////////////////////////////
EIP-2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
// Unchecked because the only math done is incrementing
// the owner's nonce which cannot realistically overflow.
unchecked {
address recoveredAddress = ecrecover(
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
),
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
),
v,
r,
s
);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
}
function computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256("1"),
block.chainid,
address(this)
)
);
}
/*//////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// Cannot underflow because a user's balance
// will never be larger than the total supply.
unchecked {
totalSupply -= amount;
}
emit Transfer(from, address(0), amount);
}
}
/// @title IWTDOT Interface
/// @author Acala Developers
/// @notice You can use this integrate with WrappedTDOT.
interface IWTDOT {
/// @notice Deposit TDOT to mint WTDOT.
/// @param who The sender of the transaction.
/// @param tdotAmount The TDOT amount to deposit.
/// @param wtdotAmount The WTDOT amount received.
event Deposit(address indexed who, uint256 tdotAmount, uint256 wtdotAmount);
/// @notice Withdraw TDOT by burn WTDOT.
/// @param who The sender of the transaction.
/// @param wtdotAmount The WTDOT amount to burn.
/// @param tdotAmount The TDOT amount received.
event Withdraw(address indexed who, uint256 wtdotAmount, uint256 tdotAmount);
/// @notice Get the deposit rate(the exchange rate for TDOT to WTDOT).
/// @return Returns (exchangeRate). Deposit rate, 1e18 is 100%
function depositRate() external view returns (uint256);
/// @notice Get the withdraw rate(the exchange rate for WTDOT to TDOT).
/// @return Returns (exchangeRate). Withdraw rate, 1e18 is 100%
function withdrawRate() external view returns (uint256);
/// @notice Deposit `tdotAmount` TDOT to mint WTDOT.
/// @param tdotAmount The TDOT amount to deposit.
/// @return Returns (wtdotAmount). The WTDOT amount received.
function deposit(uint256 tdotAmount) external returns (uint256);
/// @notice Withdraw TDOT by burn `wtdotAmount` WTDOT.
/// @param wtdotAmount The WTDOT amount to burn.
/// @return Returns (tdotAmount). The TDOT amount received.
function withdraw(uint256 wtdotAmount) external returns (uint256);
}
/// @title WrappedTDOT Contract
/// @author Acala Developers
/// @notice To wrap TDOT, TDOT is the LP token of Taiga's StableAsset(DOT-LDOT) pool on Acala. The TDOT holders
/// can receive TDOT as the LP fee by claim. So WTDOT and DOT do not maintain a 1:1 ratio.
contract WrappedTDOT is IWTDOT, ERC20, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
/// @notice The token address of TDOT.
address public immutable tdot;
/// @notice Deploys WTDOT token.
/// @param tdotAddr The token address of TDOT.
constructor(address tdotAddr) ERC20("Wrapped TDOT", "WTDOT", 10) {
tdot = tdotAddr;
}
/// @inheritdoc IWTDOT
function depositRate() public view returns (uint256) {
uint256 tdotAmount = IERC20(tdot).balanceOf(address(this));
uint256 wtdotAmount = totalSupply;
if (wtdotAmount == 0 || tdotAmount == 0) {
return 1e18;
} else {
return wtdotAmount.mul(1e18).div(tdotAmount);
}
}
/// @inheritdoc IWTDOT
function withdrawRate() public view returns (uint256) {
uint256 tdotAmount = IERC20(tdot).balanceOf(address(this));
uint256 wtdotAmount = totalSupply;
if (wtdotAmount == 0) {
return 0;
} else {
return tdotAmount.mul(1e18).div(wtdotAmount);
}
}
/// @inheritdoc IWTDOT
function deposit(uint256 tdotAmount) public returns (uint256) {
uint256 wtdotAmount = tdotAmount.mul(depositRate()).div(1e18);
require(wtdotAmount != 0, "WTDOT: invalid WTDOT amount");
IERC20(tdot).safeTransferFrom(msg.sender, address(this), tdotAmount);
_mint(msg.sender, wtdotAmount);
emit Deposit(msg.sender, tdotAmount, wtdotAmount);
return wtdotAmount;
}
/// @inheritdoc IWTDOT
function withdraw(uint256 wtdotAmount) public returns (uint256) {
require(balanceOf[msg.sender] >= wtdotAmount, "WTDOT: WTDOT not enough");
uint256 tdotAmount = wtdotAmount.mul(withdrawRate()).div(1e18);
require(tdotAmount != 0, "WTDOT: invalid TDOT amount");
_burn(msg.sender, wtdotAmount);
IERC20(tdot).safeTransfer(msg.sender, tdotAmount);
emit Withdraw(msg.sender, wtdotAmount, tdotAmount);
return tdotAmount;
}
}
Contract ABI
[{"type":"constructor","inputs":[{"type":"address","name":"tdotAddr","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DOMAIN_SEPARATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"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":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"deposit","inputs":[{"type":"uint256","name":"tdotAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"depositRate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nonces","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"permit","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tdot","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":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdraw","inputs":[{"type":"uint256","name":"wtdotAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawRate","inputs":[]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","indexed":true},{"type":"address","name":"spender","indexed":true},{"type":"uint256","name":"amount","indexed":false}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"who","indexed":true},{"type":"uint256","name":"tdotAmount","indexed":false},{"type":"uint256","name":"wtdotAmount","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","indexed":true},{"type":"address","name":"to","indexed":true},{"type":"uint256","name":"amount","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"who","indexed":true},{"type":"uint256","name":"wtdotAmount","indexed":false},{"type":"uint256","name":"tdotAmount","indexed":false}],"anonymous":false}]
Contract Creation Code
0x6101006040523480156200001257600080fd5b506040516200179138038062001791833981016040819052620000359162000169565b6040518060400160405280600c81526020016b15dc985c1c195908151113d560a21b8152506040518060400160405280600581526020016415d51113d560da1b815250600a82600090816200008b919062000240565b5060016200009a838262000240565b5060ff81166080524660a052620000b0620000cd565b60c05250506001600655506001600160a01b031660e0526200038a565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516200010191906200030c565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6000602082840312156200017c57600080fd5b81516001600160a01b03811681146200019457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620001c657607f821691505b602082108103620001e757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200023b57600081815260208120601f850160051c81016020861015620002165750805b601f850160051c820191505b81811015620002375782815560010162000222565b5050505b505050565b81516001600160401b038111156200025c576200025c6200019b565b62000274816200026d8454620001b1565b84620001ed565b602080601f831160018114620002ac5760008415620002935750858301515b600019600386901b1c1916600185901b17855562000237565b600085815260208120601f198616915b82811015620002dd57888601518255948401946001909101908401620002bc565b5085821015620002fc5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008083546200031c81620001b1565b600182811680156200033757600181146200034d576200037e565b60ff19841687528215158302870194506200037e565b8760005260208060002060005b85811015620003755781548a8201529084019082016200035a565b50505082870194505b50929695505050505050565b60805160a05160c05160e0516113b1620003e060003960008181610188015281816103e90152818161065c0152818161074201526108d5015260006106fe015260006106c9015260006101da01526113b16000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80633644e515116100a257806395d89b411161007157806395d89b411461025e578063a9059cbb14610266578063b6b55f2514610279578063d505accf1461028c578063dd62ed3e146102a157600080fd5b80633644e5151461020e57806370a08231146102165780637e74a1ed146102365780637ecebe001461023e57600080fd5b806323b872dd116100de57806323b872dd146101705780632b72906f146101835780632e1a7d4d146101c2578063313ce567146101d557600080fd5b806306fdde0314610110578063095ea7b31461012e5780630dcf14171461015157806318160ddd14610167575b600080fd5b6101186102cc565b6040516101259190611027565b60405180910390f35b61014161013c366004611076565b61035a565b6040519015158152602001610125565b6101596103c7565b604051908152602001610125565b61015960025481565b61014161017e3660046110a0565b61048f565b6101aa7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610125565b6101596101d03660046110dc565b61056f565b6101fc7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610125565b6101596106c5565b6101596102243660046110f5565b60036020526000908152604090205481565b610159610720565b61015961024c3660046110f5565b60056020526000908152604090205481565b6101186107e9565b610141610274366004611076565b6107f6565b6101596102873660046110dc565b61085c565b61029f61029a366004611110565b61093f565b005b6101596102af366004611183565b600460209081526000928352604080842090915290825290205481565b600080546102d9906111b6565b80601f0160208091040260200160405190810160405280929190818152602001828054610305906111b6565b80156103525780601f1061032757610100808354040283529160200191610352565b820191906000526020600020905b81548152906001019060200180831161033557829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103b59086815260200190565b60405180910390a35060015b92915050565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610430573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045491906111f0565b600254909150600081900361046c5760009250505090565b6104888161048284670de0b6b3a7640000610b83565b90610b96565b9250505090565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146104eb576104c6838261121f565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b0385166000908152600360205260408120805485929061051390849061121f565b90915550506001600160a01b038085166000818152600360205260409081902080548701905551909187169060008051602061135c8339815191529061055c9087815260200190565b60405180910390a3506001949350505050565b336000908152600360205260408120548211156105d35760405162461bcd60e51b815260206004820152601760248201527f5754444f543a205754444f54206e6f7420656e6f75676800000000000000000060448201526064015b60405180910390fd5b60006105f3670de0b6b3a76400006104826105ec6103c7565b8690610b83565b9050806000036106455760405162461bcd60e51b815260206004820152601a60248201527f5754444f543a20696e76616c69642054444f5420616d6f756e7400000000000060448201526064016105ca565b61064f3384610ba2565b6106836001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383610c0c565b604080518481526020810183905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56891015b60405180910390a292915050565b60007f000000000000000000000000000000000000000000000000000000000000000046146106fb576106f6610c74565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610789573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ad91906111f0565b6002549091508015806107be575081155b156107d357670de0b6b3a76400009250505090565b6104888261048283670de0b6b3a7640000610b83565b600180546102d9906111b6565b3360009081526003602052604081208054839190839061081790849061121f565b90915550506001600160a01b0383166000818152600360205260409081902080548501905551339060008051602061135c833981519152906103b59086815260200190565b600080610876670de0b6b3a76400006104826105ec610720565b9050806000036108c85760405162461bcd60e51b815260206004820152601b60248201527f5754444f543a20696e76616c6964205754444f5420616d6f756e74000000000060448201526064016105ca565b6108fd6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333086610d0e565b6109073382610d4c565b604080518481526020810183905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1591016106b7565b4284101561098f5760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064016105ca565b6000600161099b6106c5565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610aa7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610add5750876001600160a01b0316816001600160a01b0316145b610b1a5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016105ca565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6000610b8f8284611232565b9392505050565b6000610b8f8284611249565b6001600160a01b03821660009081526003602052604081208054839290610bca90849061121f565b90915550506002805482900390556040518181526000906001600160a01b0384169060008051602061135c833981519152906020015b60405180910390a35050565b6040516001600160a01b038316602482015260448101829052610c6f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d9e565b505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051610ca6919061126b565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6040516001600160a01b0380851660248301528316604482015260648101829052610d469085906323b872dd60e01b90608401610c38565b50505050565b8060026000828254610d5e919061130a565b90915550506001600160a01b03821660008181526003602090815260408083208054860190555184815260008051602061135c8339815191529101610c00565b6000610df3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e739092919063ffffffff16565b9050805160001480610e14575080806020019051810190610e14919061131d565b610c6f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105ca565b6060610e828484600085610e8a565b949350505050565b606082471015610eeb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105ca565b600080866001600160a01b03168587604051610f07919061133f565b60006040518083038185875af1925050503d8060008114610f44576040519150601f19603f3d011682016040523d82523d6000602084013e610f49565b606091505b5091509150610f5a87838387610f65565b979650505050505050565b60608315610fd4578251600003610fcd576001600160a01b0385163b610fcd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ca565b5081610e82565b610e828383815115610fe95781518083602001fd5b8060405162461bcd60e51b81526004016105ca9190611027565b60005b8381101561101e578181015183820152602001611006565b50506000910152565b6020815260008251806020840152611046816040850160208701611003565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461107157600080fd5b919050565b6000806040838503121561108957600080fd5b6110928361105a565b946020939093013593505050565b6000806000606084860312156110b557600080fd5b6110be8461105a565b92506110cc6020850161105a565b9150604084013590509250925092565b6000602082840312156110ee57600080fd5b5035919050565b60006020828403121561110757600080fd5b610b8f8261105a565b600080600080600080600060e0888a03121561112b57600080fd5b6111348861105a565b96506111426020890161105a565b95506040880135945060608801359350608088013560ff8116811461116657600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561119657600080fd5b61119f8361105a565b91506111ad6020840161105a565b90509250929050565b600181811c908216806111ca57607f821691505b6020821081036111ea57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561120257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156103c1576103c1611209565b80820281158282048414176103c1576103c1611209565b60008261126657634e487b7160e01b600052601260045260246000fd5b500490565b600080835481600182811c91508083168061128757607f831692505b602080841082036112a657634e487b7160e01b86526022600452602486fd5b8180156112ba57600181146112cf576112fc565b60ff19861689528415158502890196506112fc565b60008a81526020902060005b868110156112f45781548b8201529085019083016112db565b505084890196505b509498975050505050505050565b808201808211156103c1576103c1611209565b60006020828403121561132f57600080fd5b81518015158114610b8f57600080fd5b60008251611351818460208701611003565b919091019291505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205361f792b94ddeee837671c5a21e0bb866642cef1b751773a464584436f2e39864736f6c634300081100330000000000000000000000000000000000000000000300000000000000000000
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80633644e515116100a257806395d89b411161007157806395d89b411461025e578063a9059cbb14610266578063b6b55f2514610279578063d505accf1461028c578063dd62ed3e146102a157600080fd5b80633644e5151461020e57806370a08231146102165780637e74a1ed146102365780637ecebe001461023e57600080fd5b806323b872dd116100de57806323b872dd146101705780632b72906f146101835780632e1a7d4d146101c2578063313ce567146101d557600080fd5b806306fdde0314610110578063095ea7b31461012e5780630dcf14171461015157806318160ddd14610167575b600080fd5b6101186102cc565b6040516101259190611027565b60405180910390f35b61014161013c366004611076565b61035a565b6040519015158152602001610125565b6101596103c7565b604051908152602001610125565b61015960025481565b61014161017e3660046110a0565b61048f565b6101aa7f000000000000000000000000000000000000000000030000000000000000000081565b6040516001600160a01b039091168152602001610125565b6101596101d03660046110dc565b61056f565b6101fc7f000000000000000000000000000000000000000000000000000000000000000a81565b60405160ff9091168152602001610125565b6101596106c5565b6101596102243660046110f5565b60036020526000908152604090205481565b610159610720565b61015961024c3660046110f5565b60056020526000908152604090205481565b6101186107e9565b610141610274366004611076565b6107f6565b6101596102873660046110dc565b61085c565b61029f61029a366004611110565b61093f565b005b6101596102af366004611183565b600460209081526000928352604080842090915290825290205481565b600080546102d9906111b6565b80601f0160208091040260200160405190810160405280929190818152602001828054610305906111b6565b80156103525780601f1061032757610100808354040283529160200191610352565b820191906000526020600020905b81548152906001019060200180831161033557829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103b59086815260200190565b60405180910390a35060015b92915050565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000030000000000000000000016906370a0823190602401602060405180830381865afa158015610430573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045491906111f0565b600254909150600081900361046c5760009250505090565b6104888161048284670de0b6b3a7640000610b83565b90610b96565b9250505090565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146104eb576104c6838261121f565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b0385166000908152600360205260408120805485929061051390849061121f565b90915550506001600160a01b038085166000818152600360205260409081902080548701905551909187169060008051602061135c8339815191529061055c9087815260200190565b60405180910390a3506001949350505050565b336000908152600360205260408120548211156105d35760405162461bcd60e51b815260206004820152601760248201527f5754444f543a205754444f54206e6f7420656e6f75676800000000000000000060448201526064015b60405180910390fd5b60006105f3670de0b6b3a76400006104826105ec6103c7565b8690610b83565b9050806000036106455760405162461bcd60e51b815260206004820152601a60248201527f5754444f543a20696e76616c69642054444f5420616d6f756e7400000000000060448201526064016105ca565b61064f3384610ba2565b6106836001600160a01b037f0000000000000000000000000000000000000000000300000000000000000000163383610c0c565b604080518481526020810183905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56891015b60405180910390a292915050565b60007f000000000000000000000000000000000000000000000000000000000000031346146106fb576106f6610c74565b905090565b507f58826f0a99592a65a646180fbec599920ee086db120eeb9e9ea262a07b74501790565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000030000000000000000000016906370a0823190602401602060405180830381865afa158015610789573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ad91906111f0565b6002549091508015806107be575081155b156107d357670de0b6b3a76400009250505090565b6104888261048283670de0b6b3a7640000610b83565b600180546102d9906111b6565b3360009081526003602052604081208054839190839061081790849061121f565b90915550506001600160a01b0383166000818152600360205260409081902080548501905551339060008051602061135c833981519152906103b59086815260200190565b600080610876670de0b6b3a76400006104826105ec610720565b9050806000036108c85760405162461bcd60e51b815260206004820152601b60248201527f5754444f543a20696e76616c6964205754444f5420616d6f756e74000000000060448201526064016105ca565b6108fd6001600160a01b037f000000000000000000000000000000000000000000030000000000000000000016333086610d0e565b6109073382610d4c565b604080518481526020810183905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1591016106b7565b4284101561098f5760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064016105ca565b6000600161099b6106c5565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610aa7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610add5750876001600160a01b0316816001600160a01b0316145b610b1a5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016105ca565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6000610b8f8284611232565b9392505050565b6000610b8f8284611249565b6001600160a01b03821660009081526003602052604081208054839290610bca90849061121f565b90915550506002805482900390556040518181526000906001600160a01b0384169060008051602061135c833981519152906020015b60405180910390a35050565b6040516001600160a01b038316602482015260448101829052610c6f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d9e565b505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051610ca6919061126b565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6040516001600160a01b0380851660248301528316604482015260648101829052610d469085906323b872dd60e01b90608401610c38565b50505050565b8060026000828254610d5e919061130a565b90915550506001600160a01b03821660008181526003602090815260408083208054860190555184815260008051602061135c8339815191529101610c00565b6000610df3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e739092919063ffffffff16565b9050805160001480610e14575080806020019051810190610e14919061131d565b610c6f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105ca565b6060610e828484600085610e8a565b949350505050565b606082471015610eeb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105ca565b600080866001600160a01b03168587604051610f07919061133f565b60006040518083038185875af1925050503d8060008114610f44576040519150601f19603f3d011682016040523d82523d6000602084013e610f49565b606091505b5091509150610f5a87838387610f65565b979650505050505050565b60608315610fd4578251600003610fcd576001600160a01b0385163b610fcd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ca565b5081610e82565b610e828383815115610fe95781518083602001fd5b8060405162461bcd60e51b81526004016105ca9190611027565b60005b8381101561101e578181015183820152602001611006565b50506000910152565b6020815260008251806020840152611046816040850160208701611003565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461107157600080fd5b919050565b6000806040838503121561108957600080fd5b6110928361105a565b946020939093013593505050565b6000806000606084860312156110b557600080fd5b6110be8461105a565b92506110cc6020850161105a565b9150604084013590509250925092565b6000602082840312156110ee57600080fd5b5035919050565b60006020828403121561110757600080fd5b610b8f8261105a565b600080600080600080600060e0888a03121561112b57600080fd5b6111348861105a565b96506111426020890161105a565b95506040880135945060608801359350608088013560ff8116811461116657600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561119657600080fd5b61119f8361105a565b91506111ad6020840161105a565b90509250929050565b600181811c908216806111ca57607f821691505b6020821081036111ea57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561120257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156103c1576103c1611209565b80820281158282048414176103c1576103c1611209565b60008261126657634e487b7160e01b600052601260045260246000fd5b500490565b600080835481600182811c91508083168061128757607f831692505b602080841082036112a657634e487b7160e01b86526022600452602486fd5b8180156112ba57600181146112cf576112fc565b60ff19861689528415158502890196506112fc565b60008a81526020902060005b868110156112f45781548b8201529085019083016112db565b505084890196505b509498975050505050505050565b808201808211156103c1576103c1611209565b60006020828403121561132f57600080fd5b81518015158114610b8f57600080fd5b60008251611351818460208701611003565b919091019291505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212205361f792b94ddeee837671c5a21e0bb866642cef1b751773a464584436f2e39864736f6c63430008110033