List contracts
GET {{baseUrl}}/contracts?blockchain=MATIC&contractAddress=&contractInputType=IMPORT&deployerAddress=&from=2023-01-01T12:04:05Z&name=&pageAfter=&pageBefore=&pageSize=10&status=FAILED&to=2023-01-01T12:04:05Z
Get all contracts
https://developers.circle.com/w3s/reference/listcontracts
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
blockchain | string | Blockchain is the blockchain filter for contracts. | |
contractAddress | null | ContractAddress is the address filter for a single contract. | |
contractInputType | string | ContractInputType is the input type filter for contracts. | |
deployerAddress | null | DeployerAddress is the deployer wallet address filter for contracts. | |
from | string | From is the start time of the query, inclusive | |
name | null | Name is the name filter for contracts. | |
pageAfter | null | PageAfter is used to return items after the given item exclusively. SHOULD NOT be used in conjunction with pageBefore | |
pageBefore | null | PageBefore is used to return items before the given item exclusively. SHOULD NOT be used in conjunction with pageAfter | |
pageSize | number | PageSize is the number of items to return | |
status | string | Status is the status filter for contracts. | |
to | string | To is the end time of the query, inclusive, default to current time |
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Accept | string |
RESPONSES
status: OK
{"data":{"contracts":[{"id":"018d478d-3072-75cc-9d9d-d3951a9b3b63","name":"First Contract","description":"My first hello world contract","contractInputType":"IMPORT","createDate":"2024-01-26T20:54:11Z","updateDate":"2024-01-26T20:54:11Z","archived":false,"contractAddress":"0x1e124d7384cd34448ea5907bd0052a79355ab5eb","blockchain":"ETH-GOERLI","status":"COMPLETE","functions":[],"events":[],"verificationStatus":"UNVERIFIED","sourceCode":[]},{"id":"018a294e-8293-76ca-8980-c1a20c311145","name":"PWToken","description":"Sample Smart Contract","contractInputType":"IMPORT","createDate":"2023-08-24T20:48:45Z","updateDate":"2023-08-24T20:48:45Z","archived":false,"contractAddress":"0x9254efcc96f13953fd6dc6436d81d51bdb5ad68a","blockchain":"ETH-GOERLI","status":"COMPLETE","abiJson":"[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_to\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_value\",\"type\":\"uint256[]\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]","functions":[{"name":"allowance","type":"function","inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"stateMutability":"view","outputs":[{"name":"","type":"uint256"}]},{"name":"approve","type":"function","inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"stateMutability":"nonpayable","outputs":[{"name":"","type":"bool"}]},{"name":"balanceOf","type":"function","inputs":[{"name":"_owner","type":"address"}],"stateMutability":"view","outputs":[{"name":"","type":"uint256"}]},{"name":"decimals","type":"function","stateMutability":"view","outputs":[{"name":"","type":"uint8"}]},{"name":"getTotalSupply","type":"function","stateMutability":"view","outputs":[{"name":"","type":"uint256"}]},{"name":"mint","type":"function","inputs":[{"name":"_to","type":"address[]"},{"name":"_value","type":"uint256[]"}],"stateMutability":"nonpayable"},{"name":"name","type":"function","stateMutability":"view","outputs":[{"name":"","type":"string"}]},{"name":"owner","type":"function","stateMutability":"view","outputs":[{"name":"","type":"address"}]},{"name":"symbol","type":"function","stateMutability":"view","outputs":[{"name":"","type":"string"}]},{"name":"totalSupply","type":"function","stateMutability":"view","outputs":[{"name":"","type":"uint256"}]},{"name":"transfer","type":"function","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"stateMutability":"nonpayable","outputs":[{"name":"","type":"bool"}]},{"name":"transferFrom","type":"function","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"stateMutability":"nonpayable","outputs":[{"name":"","type":"bool"}]}],"events":[{"name":"Approval","type":"event","inputs":[{"name":"owner","type":"address","indexed":true},{"name":"spender","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false}],"anonymous":false},{"name":"Transfer","type":"event","inputs":[{"name":"from","type":"address","indexed":true},{"name":"to","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false}],"anonymous":false}],"verificationStatus":"VERIFIED","sourceCode":[{"fileName":"PWToken.sol","fileContent":"// File: @openzeppelin/contracts/utils/Address.sol\r\n\r\n\r\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\r\n\r\npragma solidity ^0.8.1;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n * ====\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\r\n *\r\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\r\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\r\n * constructor.\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize/address.code.length, which returns 0\r\n // for contracts in construction, since the code is only stored at the end\r\n // of the constructor execution.\r\n\r\n return account.code.length \u003e 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance \u003e= amount, \"Address: insufficient balance\");\r\n\r\n (bool success, ) = recipient.call{value: amount}(\"\");\r\n require(success, \"Address: unable to send value, recipient may have reverted\");\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(address(this).balance \u003e= value, \"Address: insufficient balance for call\");\r\n (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\r\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\r\n *\r\n * _Available since v4.8._\r\n */\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), \"Address: call to non-contract\");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\r\n * revert reason or using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length \u003e 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}\r\n\r\n// File: @openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\r\n\r\n\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\r\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\r\n *\r\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\r\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\r\n * need to send a transaction, and thus is not required to hold Ether at all.\r\n */\r\ninterface IERC20Permit {\r\n /**\r\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\r\n * given ``owner``'s signed approval.\r\n *\r\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\r\n * ordering also apply here.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `deadline` must be a timestamp in the future.\r\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\r\n * over the EIP712-formatted function arguments.\r\n * - the signature must use ``owner``'s current nonce (see {nonces}).\r\n *\r\n * For more information on the signature format, see the\r\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\r\n * section].\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n /**\r\n * @dev Returns the current nonce for `owner`. This value must be\r\n * included whenever a signature is generated for {permit}.\r\n *\r\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\r\n * prevents a signature from being used multiple times.\r\n */\r\n function nonces(address owner) external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\r\n */\r\n // solhint-disable-next-line func-name-mixedcase\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n}\r\n\r\n// File: @openzeppelin/contracts/token/ERC20/IERC20.sol\r\n\r\n\r\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller's account to `to`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender's allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `from` to `to` using the\r\n * allowance mechanism. `amount` is then deducted from the caller's\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) external returns (bool);\r\n}\r\n\r\n// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\r\n\r\n\r\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n\r\n\r\n\r\n/**\r\n * @title SafeERC20\r\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\r\n * contract returns false). Tokens that return no value (and instead revert or\r\n * throw on failure) are also supported, non-reverting calls are assumed to be\r\n * successful.\r\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\r\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\r\n */\r\nlibrary SafeERC20 {\r\n using Address for address;\r\n\r\n function safeTransfer(\r\n IERC20 token,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\r\n }\r\n\r\n function safeTransferFrom(\r\n IERC20 token,\r\n address from,\r\n address to,\r\n uint256 value\r\n ) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\r\n }\r\n\r\n /**\r\n * @dev Deprecated. This function has issues similar to the ones found in\r\n * {IERC20-approve}, and its usage is discouraged.\r\n *\r\n * Whenever possible, use {safeIncreaseAllowance} and\r\n * {safeDecreaseAllowance} instead.\r\n */\r\n function safeApprove(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n // safeApprove should only be called when setting an initial allowance,\r\n // or when resetting it to zero. To increase and decrease it, use\r\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\r\n require(\r\n (value == 0) || (token.allowance(address(this), spender) == 0),\r\n \"SafeERC20: approve from non-zero to non-zero allowance\"\r\n );\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\r\n }\r\n\r\n function safeIncreaseAllowance(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n uint256 newAllowance = token.allowance(address(this), spender) + value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n\r\n function safeDecreaseAllowance(\r\n IERC20 token,\r\n address spender,\r\n uint256 value\r\n ) internal {\r\n unchecked {\r\n uint256 oldAllowance = token.allowance(address(this), spender);\r\n require(oldAllowance \u003e= value, \"SafeERC20: decreased allowance below zero\");\r\n uint256 newAllowance = oldAllowance - value;\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\r\n }\r\n }\r\n\r\n function safePermit(\r\n IERC20Permit token,\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) internal {\r\n uint256 nonceBefore = token.nonces(owner);\r\n token.permit(owner, spender, value, deadline, v, r, s);\r\n uint256 nonceAfter = token.nonces(owner);\r\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param token The token targeted by the call.\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n */\r\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\r\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\r\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\r\n // the target address contains contract code and also asserts for success in the low-level call.\r\n\r\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\r\n if (returndata.length \u003e 0) {\r\n // Return data is optional\r\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\r\n }\r\n }\r\n}\r\n\r\n// File: @openzeppelin/contracts/utils/math/SafeMath.sol\r\n\r\n\r\n// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n// CAUTION\r\n// This version of SafeMath should only be used with Solidity 0.8 or later,\r\n// because it relies on the compiler's built in overflow checks.\r\n\r\n/**\r\n * @dev Wrappers over Solidity's arithmetic operations.\r\n *\r\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\r\n * now has built in overflow checking.\r\n */\r\nlibrary SafeMath {\r\n /**\r\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n uint256 c = a + b;\r\n if (c \u003c a) return (false, 0);\r\n return (true, c);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b \u003e a) return (false, 0);\r\n return (true, a - b);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\r\n // benefit is lost if 'b' is also tested.\r\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\r\n if (a == 0) return (true, 0);\r\n uint256 c = a * b;\r\n if (c / a != b) return (false, 0);\r\n return (true, c);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b == 0) return (false, 0);\r\n return (true, a / b);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b == 0) return (false, 0);\r\n return (true, a % b);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the addition of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity's `+` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Addition cannot overflow.\r\n */\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a + b;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity's `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a - b;\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity's `*` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Multiplication cannot overflow.\r\n */\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a * b;\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers, reverting on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity's `/` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a / b;\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * reverting when dividing by zero.\r\n *\r\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a % b;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\r\n * overflow (when the result is negative).\r\n *\r\n * CAUTION: This function is deprecated because it requires allocating memory for the error\r\n * message unnecessarily. For custom revert reasons use {trySub}.\r\n *\r\n * Counterpart to Solidity's `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n unchecked {\r\n require(b \u003c= a, errorMessage);\r\n return a - b;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity's `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n unchecked {\r\n require(b \u003e 0, errorMessage);\r\n return a / b;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * reverting with custom message when dividing by zero.\r\n *\r\n * CAUTION: This function is deprecated because it requires allocating memory for the error\r\n * message unnecessarily. For custom revert reasons use {tryMod}.\r\n *\r\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n unchecked {\r\n require(b \u003e 0, errorMessage);\r\n return a % b;\r\n }\r\n }\r\n}\r\n\r\n// File: pw.sol\r\n\r\n//SPDX-License-Identifier: Unlicensed\r\npragma solidity ^0.8.3; \r\n\r\n\r\n\r\n\r\ncontract PWToken is IERC20 {\r\n\tusing SafeMath for uint256;\r\n\r\n // define address that will own the contract\r\n address public owner;\r\n // define totalSupply variable\r\n uint256 public override totalSupply;\r\n // mapping address balances \r\n mapping(address =\u003e uint256) private balances;\r\n // mapping address allowance \r\n mapping (address =\u003e mapping (address =\u003e uint256)) private allowed;\r\n // define token name\r\n string public constant name = \"pw test\";\r\n // define token symbol\r\n string public constant symbol = \"PW\";\r\n // define decimals \r\n uint8 public constant decimals = 0;\r\n\r\n // The contract constructor, initiates state varibales for the contract\r\n constructor() public {\r\n owner = msg.sender;\r\n totalSupply = 0;\r\n }\r\n\r\n\r\n //mint function, confirms msg.sender is the owner\r\n //confirms request amount is greater than zero\r\n //sends the contract addresses the specified amount of tokens\r\n function mint(address[] calldata _to, uint256[] calldata _value) public {\r\n //require(msg.sender == owner, \"Error: Unauthorized operation\");\r\n require(_to.length == _value.length, \"Error: Invalid pair entries\");\r\n for (uint256 i = 0; i \u003c _to.length; i++) {\r\n require(_value[i] \u003e 0, \"Error: Invalid value\");\r\n totalSupply = totalSupply.add(_value[i]);\r\n balances[_to[i]] = balances[_to[i]].add(_value[i]);\r\n emit Transfer(address(0), _to[i], _value[i]);\r\n }\r\n }\r\n\r\n //total supply function\r\n function getTotalSupply() public view returns (uint256) {\r\n return totalSupply;\r\n }\r\n\r\n //balances of function\r\n function balanceOf(address _owner) public override view returns (uint256) {\r\n return balances[_owner];\r\n }\r\n\r\n //transfer function\r\n function transfer(address _to, uint256 _value) public override returns (bool) {\r\n require(balances[msg.sender] \u003e= _value, \"Error: Insufficient balances\");\r\n require(_to != address(0), \"Error: Invalid address\");\r\n require(_value \u003e 0, \"Error: Invalid value\");\r\n \r\n balances[msg.sender] = balances[msg.sender].sub(_value);\r\n balances[_to] = balances[_to].add(_value);\r\n emit Transfer(msg.sender, _to, _value);\r\n return true;\r\n }\r\n\r\n //approve function\r\n function approve(address _spender, uint256 _value) public override returns (bool) {\r\n require(_spender != address(0), \"Error: Invalid address\");\r\n require(_value \u003e 0, \"Error: Invalid value\");\r\n require(balances[msg.sender] \u003e= _value, \"Error: Insufficient Balance\");\r\n\r\n allowed[msg.sender][_spender] = _value;\r\n emit Approval(msg.sender, _spender, _value);\r\n return true;\r\n }\r\n \r\n //allownace function\r\n function allowance(address _owner, address _spender) public override view returns (uint256) {\r\n return allowed[_owner][_spender];\r\n }\r\n\r\n //transfer from function\r\n function transferFrom(address _from, address _to, uint256 _value) public override returns (bool) {\r\n require(balances[_from] \u003e= _value, \"Error: insufficient balance\");\r\n require(allowed[_from][msg.sender] \u003e= _value, \"Error: insufficient allowance\");\r\n require(_to != address(0), \"Error: invalid address\");\r\n require(_value \u003e 0, \"Error: invalid value\");\r\n\r\n balances[_from] = balances[_from].sub(_value);\r\n balances[_to] = balances[_to].add(_value);\r\n allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);\r\n emit Transfer(_from, _to, _value);\r\n return true;\r\n }\r\n}"}]}]}}