feat: initial commit for wtf-contract v2
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
|
||||
|
||||
pragma solidity >=0.6.2;
|
||||
|
||||
import {IERC20} from "./IERC20.sol";
|
||||
import {IERC165} from "./IERC165.sol";
|
||||
|
||||
/**
|
||||
* @title IERC1363
|
||||
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
|
||||
*
|
||||
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
|
||||
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
|
||||
*/
|
||||
interface IERC1363 is IERC20, IERC165 {
|
||||
/*
|
||||
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
|
||||
* 0xb0202a11 ===
|
||||
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
|
||||
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
|
||||
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
|
||||
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
|
||||
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
|
||||
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
|
||||
*/
|
||||
|
||||
/**
|
||||
* @dev Moves a `value` amount of tokens from the caller's account to `to`
|
||||
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
|
||||
* @param to The address which you want to transfer to.
|
||||
* @param value The amount of tokens to be transferred.
|
||||
* @return A boolean value indicating whether the operation succeeded unless throwing.
|
||||
*/
|
||||
function transferAndCall(address to, uint256 value) external returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Moves a `value` amount of tokens from the caller's account to `to`
|
||||
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
|
||||
* @param to The address which you want to transfer to.
|
||||
* @param value The amount of tokens to be transferred.
|
||||
* @param data Additional data with no specified format, sent in call to `to`.
|
||||
* @return A boolean value indicating whether the operation succeeded unless throwing.
|
||||
*/
|
||||
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
|
||||
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
|
||||
* @param from The address which you want to send tokens from.
|
||||
* @param to The address which you want to transfer to.
|
||||
* @param value The amount of tokens to be transferred.
|
||||
* @return A boolean value indicating whether the operation succeeded unless throwing.
|
||||
*/
|
||||
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
|
||||
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
|
||||
* @param from The address which you want to send tokens from.
|
||||
* @param to The address which you want to transfer to.
|
||||
* @param value The amount of tokens to be transferred.
|
||||
* @param data Additional data with no specified format, sent in call to `to`.
|
||||
* @return A boolean value indicating whether the operation succeeded unless throwing.
|
||||
*/
|
||||
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
|
||||
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
|
||||
* @param spender The address which will spend the funds.
|
||||
* @param value The amount of tokens to be spent.
|
||||
* @return A boolean value indicating whether the operation succeeded unless throwing.
|
||||
*/
|
||||
function approveAndCall(address spender, uint256 value) external returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
|
||||
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
|
||||
* @param spender The address which will spend the funds.
|
||||
* @param value The amount of tokens to be spent.
|
||||
* @param data Additional data with no specified format, sent in call to `spender`.
|
||||
* @return A boolean value indicating whether the operation succeeded unless throwing.
|
||||
*/
|
||||
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
|
||||
|
||||
pragma solidity >=0.4.16;
|
||||
|
||||
import {IERC165} from "../utils/introspection/IERC165.sol";
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
|
||||
|
||||
pragma solidity >=0.4.16;
|
||||
|
||||
import {IERC20} from "../token/ERC20/IERC20.sol";
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20Metadata.sol)
|
||||
|
||||
pragma solidity >=0.6.2;
|
||||
|
||||
import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5313.sol)
|
||||
|
||||
pragma solidity >=0.4.16;
|
||||
|
||||
/**
|
||||
* @dev Interface for the Light Contract Ownership Standard.
|
||||
*
|
||||
* A standardized minimal interface required to identify an account that controls a contract
|
||||
*/
|
||||
interface IERC5313 {
|
||||
/**
|
||||
* @dev Gets the address of the owner.
|
||||
*/
|
||||
function owner() external view returns (address);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v5.5.0) (interfaces/IERC6909.sol)
|
||||
|
||||
pragma solidity >=0.6.2;
|
||||
|
||||
import {IERC165} from "../utils/introspection/IERC165.sol";
|
||||
|
||||
/**
|
||||
* @dev Required interface of an ERC-6909 compliant contract, as defined in the
|
||||
* https://eips.ethereum.org/EIPS/eip-6909[ERC].
|
||||
*/
|
||||
interface IERC6909 is IERC165 {
|
||||
/**
|
||||
* @dev Emitted when the allowance of a `spender` for an `owner` is set for a token of type `id`.
|
||||
* The new allowance is `amount`.
|
||||
*/
|
||||
event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount);
|
||||
|
||||
/**
|
||||
* @dev Emitted when `owner` grants or revokes operator status for a `spender`.
|
||||
*/
|
||||
event OperatorSet(address indexed owner, address indexed spender, bool approved);
|
||||
|
||||
/**
|
||||
* @dev Emitted when `amount` tokens of type `id` are moved from `sender` to `receiver` initiated by `caller`.
|
||||
*/
|
||||
event Transfer(
|
||||
address caller,
|
||||
address indexed sender,
|
||||
address indexed receiver,
|
||||
uint256 indexed id,
|
||||
uint256 amount
|
||||
);
|
||||
|
||||
/**
|
||||
* @dev Returns the amount of tokens of type `id` owned by `owner`.
|
||||
*/
|
||||
function balanceOf(address owner, uint256 id) external view returns (uint256);
|
||||
|
||||
/**
|
||||
* @dev Returns the amount of tokens of type `id` that `spender` is allowed to spend on behalf of `owner`.
|
||||
*
|
||||
* NOTE: Does not include operator allowances.
|
||||
*/
|
||||
function allowance(address owner, address spender, uint256 id) external view returns (uint256);
|
||||
|
||||
/**
|
||||
* @dev Returns true if `spender` is set as an operator for `owner`.
|
||||
*/
|
||||
function isOperator(address owner, address spender) external view returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Sets an approval to `spender` for `amount` of tokens of type `id` from the caller's tokens. An `amount` of
|
||||
* `type(uint256).max` signifies an unlimited approval.
|
||||
*
|
||||
* Must return true.
|
||||
*/
|
||||
function approve(address spender, uint256 id, uint256 amount) external returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Grants or revokes unlimited transfer permission of any token id to `spender` for the caller's tokens.
|
||||
*
|
||||
* Must return true.
|
||||
*/
|
||||
function setOperator(address spender, bool approved) external returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Transfers `amount` of token type `id` from the caller's account to `receiver`.
|
||||
*
|
||||
* Must return true.
|
||||
*/
|
||||
function transfer(address receiver, uint256 id, uint256 amount) external returns (bool);
|
||||
|
||||
/**
|
||||
* @dev Transfers `amount` of token type `id` from `sender` to `receiver`.
|
||||
*
|
||||
* Must return true.
|
||||
*/
|
||||
function transferFrom(address sender, address receiver, uint256 id, uint256 amount) external returns (bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Optional extension of {IERC6909} that adds metadata functions.
|
||||
*/
|
||||
interface IERC6909Metadata is IERC6909 {
|
||||
/**
|
||||
* @dev Returns the name of the token of type `id`.
|
||||
*/
|
||||
function name(uint256 id) external view returns (string memory);
|
||||
|
||||
/**
|
||||
* @dev Returns the ticker symbol of the token of type `id`.
|
||||
*/
|
||||
function symbol(uint256 id) external view returns (string memory);
|
||||
|
||||
/**
|
||||
* @dev Returns the number of decimals for the token of type `id`.
|
||||
*/
|
||||
function decimals(uint256 id) external view returns (uint8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Optional extension of {IERC6909} that adds content URI functions.
|
||||
*/
|
||||
interface IERC6909ContentURI is IERC6909 {
|
||||
/**
|
||||
* @dev Returns URI for the contract.
|
||||
*/
|
||||
function contractURI() external view returns (string memory);
|
||||
|
||||
/**
|
||||
* @dev Returns the URI for the token of type `id`.
|
||||
*/
|
||||
function tokenURI(uint256 id) external view returns (string memory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Optional extension of {IERC6909} that adds a token supply function.
|
||||
*/
|
||||
interface IERC6909TokenSupply is IERC6909 {
|
||||
/**
|
||||
* @dev Returns the total supply of the token of type `id`.
|
||||
*/
|
||||
function totalSupply(uint256 id) external view returns (uint256);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user