Address Contract Partially Verified
Address
0x706f89b32217ab25d2c4E4e75af0FF16d05dD0bb
Balance
0 ETH
Nonce
1
Code Size
7362 bytes
Creator
0x3FF441B3...e26a at tx 0xa437afed...677532
Indexed Transactions
0
Contract Bytecode
7362 bytes
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c8063715018a61161010f578063a9059cbb116100a2578063e4234dd811610071578063e4234dd814610410578063efbe389a1461042b578063f2fde38b1461043e578063fd193d441461045157600080fd5b8063a9059cbb146103a8578063d89135cd146103bb578063dc233879146103c4578063dd62ed3e146103d757600080fd5b806395d89b41116100de57806395d89b41146103675780639e281a981461036f5780639fe9307a14610382578063a457c2d71461039557600080fd5b8063715018a6146103145780637c0228111461031c578063816670f31461032f5780638da5cb5b1461034257600080fd5b8063313ce5671161018757806342966c681161015657806342966c68146102c7578063474e4ebe146102da5780636c9c2faf146102e357806370a08231146102eb57600080fd5b8063313ce5671461028857806332424aa31461029d57806339509351146102aa5780633ccfd60b146102bd57600080fd5b806317d7de7c116101c357806317d7de7c1461023357806318160ddd1461023b5780631e7be2101461025257806323b872dd1461027557600080fd5b806306fdde03146101ea578063095ea7b314610208578063150704011461022b575b600080fd5b6101f2610474565b6040516101ff919061191c565b60405180910390f35b61021b61021636600461196b565b610502565b60405190151581526020016101ff565b6101f2610519565b6101f26105ab565b61024460055481565b6040519081526020016101ff565b61021b610260366004611995565b60086020526000908152604090205460ff1681565b61021b6102833660046119b0565b6105ba565b60125b60405160ff90911681526020016101ff565b60045461028b9060ff1681565b61021b6102b836600461196b565b6108a4565b6102c56108db565b005b6102c56102d53660046119ec565b610935565b6102446101f481565b600554610244565b6102446102f9366004611995565b6001600160a01b031660009081526006602052604090205490565b6102c5610a50565b6102c561032a366004611995565b610a62565b6102c561033d366004611995565b610adb565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016101ff565b6101f2610b5d565b6102c561037d36600461196b565b610b6a565b6102c5610390366004611a13565b610cf7565b61021b6103a336600461196b565b610d4d565b61021b6103b636600461196b565b610de8565b610244600c5481565b6102c56103d2366004611995565b611008565b6102446103e5366004611a4a565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b61034f73eed9823c13d3dd4af4c583ee7ddde56b4de77f6281565b600e5461034f906001600160a01b031681565b6102c561044c366004611995565b61107a565b61021b61045f366004611995565b600b6020526000908152604090205460ff1681565b6002805461048190611a7d565b80601f01602080910402602001604051908101604052809291908181526020018280546104ad90611a7d565b80156104fa5780601f106104cf576101008083540402835291602001916104fa565b820191906000526020600020905b8154815290600101906020018083116104dd57829003601f168201915b505050505081565b600061050f3384846111b2565b5060015b92915050565b60606003805461052890611a7d565b80601f016020809104026020016040519081016040528092919081815260200182805461055490611a7d565b80156105a15780601f10610576576101008083540402835291602001916105a1565b820191906000526020600020905b81548152906001019060200180831161058457829003601f168201915b5050505050905090565b60606002805461052890611a7d565b3360009081526008602052604081205460ff1661062957336000908152600d602052604090205442906105ef90605a90611acd565b11156106165760405162461bcd60e51b815260040161060d90611ae0565b60405180910390fd5b336000908152600d602052604090204290555b82826001600160a01b038216301480159061065257506000546001600160a01b03838116911614155b801561067757506001600160a01b03821660009081526008602052604090205460ff16155b156106cc576001600160a01b0382166000908152600660205260409020546b50c783eb9b5c85f2a8000000906106ae908390611acd565b11156106cc5760405162461bcd60e51b815260040161060d90611b2a565b6001600160a01b0386166000908152600760209081526040808320338452909152902054848110156107515760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b606482015260840161060d565b6001600160a01b0387166000908152600660205260409020548511156107ca5760405162461bcd60e51b815260206004820152602860248201527f45524332303a20696e73756666696369656e742062616c616e636520666f72206044820152673a3930b739b332b960c11b606482015260840161060d565b6001600160a01b0386166000908152600b602052604081205460ff16801561080f57506001600160a01b03881673eed9823c13d3dd4af4c583ee7ddde56b4de77f6214155b15610865576127106108236101f488611b88565b61082d9190611b9f565b90508015801561083d5750600086115b15610846575060015b6108658873eed9823c13d3dd4af4c583ee7ddde56b4de77f62836112d7565b6108798888610874848a611bc1565b6112d7565b60001982146108965761089688336108918986611bc1565b6111b2565b506001979650505050505050565b3360008181526007602090815260408083206001600160a01b0387168452909152812054909161050f918590610891908690611acd565b6108e361157f565b476108ff6108f96000546001600160a01b031690565b826115d9565b6040518181527f430648de173157e069201c943adb2d4e340e7cf5b27b1b09c9cb852f03d63b569060200160405180910390a150565b61093d61157f565b3360009081526006602052604090205481111561099c5760405162461bcd60e51b815260206004820152601960248201527f4e6f7420656e6f75676820746f6b656e7320746f206275726e00000000000000604482015260640161060d565b33600090815260066020526040812080548392906109bb908490611bc1565b9250508190555080600560008282546109d49190611bc1565b9250508190555080600c60008282546109ed9190611acd565b90915550506040518181526000903390600080516020611c6d8339815191529060200160405180910390a360405181815233907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59060200160405180910390a250565b610a5861157f565b610a60611670565b565b610a6a61157f565b6001600160a01b038116610ab75760405162461bcd60e51b8152602060048201526014602482015273496e76616c69642070616972206164647265737360601b604482015260640161060d565b6001600160a01b03166000908152600b60205260409020805460ff19166001179055565b610ae361157f565b6001600160a01b0381166000908152600b602052604090205460ff16610b3c5760405162461bcd60e51b815260206004820152600e60248201526d14185a5c881b9bdd08195e1a5cdd60921b604482015260640161060d565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b6003805461048190611a7d565b610b7261157f565b6040516370a0823160e01b8152306004820152829082906001600160a01b038316906370a0823190602401602060405180830381865afa158015610bba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bde9190611bd4565b1015610c685760405162461bcd60e51b815260206004820152604d60248201527f4e6f7420656e6f75676820746f6b656e7320696e2074686520636f6e7472616360448201527f74206f72206f776e65722063616e6e6f7420776974686472617720746f6b656e60648201526c1cc81a5b8818dbdb9d1c9858dd609a1b608482015260a40161060d565b306001600160a01b03841603610cd65760405162461bcd60e51b815260206004820152602d60248201527f4f776e65722063616e6e6f74207769746864726177205353445820746f6b656e60448201526c1cc81a5b8818dbdb9d1c9858dd609a1b606482015260840161060d565b610cf281610cec6000546001600160a01b031690565b84611682565b505050565b610cff61157f565b6001600160a01b038216600081815260086020526040808220805460ff1916851515179055517faab7954e9d246b167ef88aeddad35209ca2489d95a8aeb59e288d9b19fae5a549190a25050565b3360009081526007602090815260408083206001600160a01b038616845290915281205480831115610dcf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161060d565b610dde33856108918685611bc1565b5060019392505050565b3360009081526008602052604081205460ff16610e4e57336000908152600d60205260409020544290610e1d90605a90611acd565b1115610e3b5760405162461bcd60e51b815260040161060d90611ae0565b336000908152600d602052604090204290555b82826001600160a01b0382163014801590610e7757506000546001600160a01b03838116911614155b8015610e9c57506001600160a01b03821660009081526008602052604090205460ff16155b15610ef1576001600160a01b0382166000908152600660205260409020546b50c783eb9b5c85f2a800000090610ed3908390611acd565b1115610ef15760405162461bcd60e51b815260040161060d90611b2a565b33600090815260066020526040902054841115610f505760405162461bcd60e51b815260206004820152601b60248201527f45524332303a20696e73756666696369656e742062616c616e63650000000000604482015260640161060d565b6001600160a01b0385166000908152600b602052604090205460ff168015610f8c57503373eed9823c13d3dd4af4c583ee7ddde56b4de77f6214155b15610ff2576000612710610fa26101f487611b88565b610fac9190611b9f565b905080158015610fbc5750600085115b15610fc5575060015b610fe43373eed9823c13d3dd4af4c583ee7ddde56b4de77f62836112d7565b610fee8186611bc1565b9450505b610ffd3386866112d7565b506001949350505050565b61101061157f565b6001600160a01b0381166110585760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161060d565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b61108261157f565b6001600160a01b0381166110a85760405162461bcd60e51b815260040161060d90611bed565b6000600660006110c06000546001600160a01b031690565b6001600160a01b03166001600160a01b031681526020019081526020016000205490506000600660006110fb6000546001600160a01b031690565b6001600160a01b03166001600160a01b03168152602001908152602001600020819055508060066000846001600160a01b03166001600160a01b0316815260200190815260200160002060008282546111549190611acd565b90915550506001600160a01b0382166111756000546001600160a01b031690565b6001600160a01b0316600080516020611c6d8339815191528360405161119d91815260200190565b60405180910390a36111ae826116d4565b5050565b6001600160a01b0383166112145760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060d565b6001600160a01b0382166112755760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060d565b6001600160a01b0383811660008181526007602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661133b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060d565b600081116113a45760405162461bcd60e51b815260206004820152603060248201527f45524332303a207472616e7366657220616d6f756e74206d757374206265206760448201526f726561746572207468616e207a65726f60801b606482015260840161060d565b6001600160a01b03831660009081526006602052604090205481111561140c5760405162461bcd60e51b815260206004820152601b60248201527f45524332303a20696e73756666696369656e742062616c616e63650000000000604482015260640161060d565b6001600160a01b0382166114f0576001600160a01b03831660009081526006602052604081208054839290611442908490611bc1565b92505081905550806005600082825461145b9190611bc1565b9250508190555080600c60008282546114749190611acd565b90915550506040518181526000906001600160a01b03851690600080516020611c6d8339815191529060200160405180910390a3826001600160a01b03167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040516114e391815260200190565b60405180910390a2505050565b6001600160a01b03831660009081526006602052604081208054839290611518908490611bc1565b90915550506001600160a01b03821660009081526006602052604081208054839290611545908490611acd565b92505081905550816001600160a01b0316836001600160a01b0316600080516020611c6d833981519152836040516112ca91815260200190565b6000546001600160a01b03163314610a605760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060d565b804710156115fc5760405163cd78605960e01b815230600482015260240161060d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611649576040519150601f19603f3d011682016040523d82523d6000602084013e61164e565b606091505b5050905080610cf257604051630a12f52160e11b815260040160405180910390fd5b61167861157f565b610a60600061170e565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610cf290849061175e565b6116dc61157f565b6001600160a01b0381166117025760405162461bcd60e51b815260040161060d90611bed565b61170b8161170e565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006117736001600160a01b038416836117c1565b905080516000141580156117985750808060200190518101906117969190611c33565b155b15610cf257604051635274afe760e01b81526001600160a01b038416600482015260240161060d565b60606117cf838360006117d6565b9392505050565b6060814710156117fb5760405163cd78605960e01b815230600482015260240161060d565b600080856001600160a01b031684866040516118179190611c50565b60006040518083038185875af1925050503d8060008114611854576040519150601f19603f3d011682016040523d82523d6000602084013e611859565b606091505b5091509150611869868383611873565b9695505050505050565b60608261188857611883826118cf565b6117cf565b815115801561189f57506001600160a01b0384163b155b156118c857604051639996b31560e01b81526001600160a01b038516600482015260240161060d565b50806117cf565b8051156118df5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60005b838110156119135781810151838201526020016118fb565b50506000910152565b602081526000825180602084015261193b8160408501602087016118f8565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461196657600080fd5b919050565b6000806040838503121561197e57600080fd5b6119878361194f565b946020939093013593505050565b6000602082840312156119a757600080fd5b6117cf8261194f565b6000806000606084860312156119c557600080fd5b6119ce8461194f565b92506119dc6020850161194f565b9150604084013590509250925092565b6000602082840312156119fe57600080fd5b5035919050565b801515811461170b57600080fd5b60008060408385031215611a2657600080fd5b611a2f8361194f565b91506020830135611a3f81611a05565b809150509250929050565b60008060408385031215611a5d57600080fd5b611a668361194f565b9150611a746020840161194f565b90509250929050565b600181811c90821680611a9157607f821691505b602082108103611ab157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561051357610513611ab7565b6020808252602a908201527f5472616e73616374696f6e20636f6f6c646f776e20706572696f6420686173206040820152691b9bdd081c185cdcd95960b21b606082015260800190565b602080825260409082018190527f526563697069656e74277320746f6b656e20686f6c64696e6720657863656564908201527f7320746865206d6178696d756d20616c6c6f7765642070657263656e74616765606082015260800190565b808202811582820484141761051357610513611ab7565b600082611bbc57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561051357610513611ab7565b600060208284031215611be657600080fd5b5051919050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b600060208284031215611c4557600080fd5b81516117cf81611a05565b60008251611c628184602087016118f8565b919091019291505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122049b2f428daa030a4c6d08add6976d438af34a1e9ead8abcee5ad906d0f4583ba64736f6c63430008120033
Verified Source Code Partial Match
Compiler: v0.8.18+commit.87f61d96
EVM: paris
Optimization: Yes (200 runs)
SpunkySDX.sol 762 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) 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 FailedInnerCall();
}
}
}
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @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);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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(token).code.length > 0;
}
}
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);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
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;
}
}
contract SpunkySDX is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
// Token details
string public name;
string public symbol;
uint8 public _decimals;
uint256 public totalSupply;
// Token balances
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) public whitelists;
address private _vestingContract;
address private _stakingContract;
// Mapping to keep track of valid trading pairs
mapping(address => bool) public validPairs;
// Token burn details
uint256 public totalBurned;
uint256 public constant SELL_TAX_PERCENTAGE = 500;
// Antibot features
uint256 private constant MAX_HOLDING_PERCENTAGE = (500 * (10 ** 9) * (10 ** 18) * 5) / 100;
uint256 private constant TRANSACTION_DELAY = 1.5 minutes;
mapping(address => uint256) private _lastTransactionTime;
address public pancakeswapPair; //To be replaced with Pancakeswap Pair Address `
//Sell Tax Address
address public constant SELL_TAX_ADDRESS = 0xEeD9823C13d3Dd4aF4C583EE7dDde56b4DE77F62;
//Events
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Burn(address indexed account, uint256 amount);
event Withdrawn(uint256 amount);
event Whitelisted(address indexed);
constructor(address _pancakeswapPair) {
name = "SpunkySDX";
symbol = "SSDX";
_decimals = 18;
totalSupply = 500e9 * 10 ** uint256(_decimals);
_balances[address(this)] = totalSupply;
//Transfer Team and IEO allocation to the contract owner
_transfer(address(this), owner(), totalSupply);
require(_pancakeswapPair != address(0), "Zero address provided for _pancakeswapPair");
pancakeswapPair = _pancakeswapPair;
emit Transfer(address(0), address(this), totalSupply);
}
function getSymbol() public view returns (string memory) {
return symbol;
}
function getName() public view returns (string memory) {
return name;
}
function getSupply() public view returns (uint256) {
return totalSupply;
}
function decimals() public pure returns (uint8) {
return 18;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(
address recipient,
uint256 amount
)
public
checkTransactionDelay
checkMaxHolding(recipient, amount)
returns (bool)
{
require(_balances[msg.sender] >= amount, "ERC20: insufficient balance");
if (isSellTransaction(recipient) && msg.sender != SELL_TAX_ADDRESS) {
uint256 taxAmount = (amount * SELL_TAX_PERCENTAGE) / 10000;
// Check for truncation to zero and adjust
if (taxAmount == 0 && amount > 0) {
taxAmount = 1; // Minimum tax of 1e-18 tokens
}
_transfer(msg.sender, SELL_TAX_ADDRESS, taxAmount);
amount -= taxAmount;
}
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(
address owner,
address spender
) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(
address spender,
uint256 amount) public returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public checkTransactionDelay checkMaxHolding(to, amount) returns (bool) {
uint256 currentAllowance = _allowances[from][msg.sender];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
// Check if the sender has enough balance for the transfer amount
require(_balances[from] >= amount, "ERC20: insufficient balance for transfer");
uint256 taxAmount = 0;
if (isSellTransaction(to) && from != SELL_TAX_ADDRESS) {
taxAmount = (amount * SELL_TAX_PERCENTAGE) / 10000;
if (taxAmount == 0 && amount > 0) {
taxAmount = 1; // Minimum tax of 1e-18 tokens
}
_transfer(from, SELL_TAX_ADDRESS, taxAmount);
}
// Transfer the specified amount to the recipient
_transfer(from, to, amount - taxAmount);
// Reduce the allowance by the initial transfer amount
if (currentAllowance != type(uint256).max) {
_approve(from, msg.sender, currentAllowance - amount);
}
return true;
}
function increaseAllowance(
address spender,
uint256 addedValue
) public returns (bool) {
_approve(
msg.sender,
spender,
_allowances[msg.sender][spender] + addedValue
);
return true;
}
function decreaseAllowance(
address spender,
uint256 subtractedValue
) public returns (bool) {
uint256 currentAllowance = _allowances[msg.sender][spender];
require(
subtractedValue <= currentAllowance,
"ERC20: decreased allowance below zero"
);
_approve(msg.sender, spender, currentAllowance - subtractedValue);
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(amount > 0, "ERC20: transfer amount must be greater than zero");
require(_balances[sender] >= amount, "ERC20: insufficient balance");
if (recipient == address(0)){
_balances[sender] -= amount;
totalSupply -= amount;
totalBurned += amount;
emit Transfer(sender, address(0), amount);
emit Burn(sender, amount);
}else{
_balances[sender] -= amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
}
// Function to add a trading pair
function addTradingPair(address _pair) public onlyOwner {
require(_pair != address(0), "Invalid pair address");
validPairs[_pair] = true;
}
// Function to remove a trading pair
function removeTradingPair(address _pair) public onlyOwner {
require(validPairs[_pair], "Pair not exist");
validPairs[_pair] = false;
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function isSellTransaction(address recipient) internal view returns (bool) {
return validPairs[recipient];
}
// Function to update the pancakeswapPair address
function updatePancakeswapPair(address _newPancakeswapPair) public onlyOwner {
require(_newPancakeswapPair != address(0), "Invalid address");
pancakeswapPair = _newPancakeswapPair;
}
function burn(uint256 amount) public onlyOwner {
require(amount <= _balances[msg.sender], "Not enough tokens to burn");
_balances[msg.sender] -= amount;
totalSupply -= amount;
totalBurned += amount;
emit Transfer(msg.sender, address(0), amount);
emit Burn(msg.sender, amount);
}
function withdrawToken(
address tokenAddress,
uint256 tokenAmount
) external onlyOwner {
IERC20 token = IERC20(tokenAddress);
require(
token.balanceOf(address(this)) >= tokenAmount,
"Not enough tokens in the contract or owner cannot withdraw tokens in contract"
);
require(
tokenAddress != address(this),
"Owner cannot withdraw SSDX tokens in contract"
);
SafeERC20.safeTransfer(token, owner(), tokenAmount);
}
function withdraw() external onlyOwner {
uint256 amount = address(this).balance;
Address.sendValue(payable(owner()), amount);
emit Withdrawn(amount);
}
function renounceOwnership() public override onlyOwner {
super.renounceOwnership();
}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
// Transfer the balance of the current owner to the new owner
uint256 balanceOfCurrentOwner = _balances[owner()];
_balances[owner()] = 0;
_balances[newOwner] += balanceOfCurrentOwner;
emit Transfer(owner(), newOwner, balanceOfCurrentOwner);
// Transfer the ownership
super.transferOwnership(newOwner);
}
function whietlist(address _address, bool _isWhitelisting) external onlyOwner {
whitelists[_address] = _isWhitelisting;
emit Whitelisted(_address);
}
modifier checkTransactionDelay() {
if (!whitelists[msg.sender]) {
require(
_lastTransactionTime[msg.sender] + TRANSACTION_DELAY <=block.timestamp,"Transaction cooldown period has not passed"
);
_lastTransactionTime[msg.sender] = block.timestamp;
}
_;
}
modifier checkMaxHolding(address recipient, uint256 amount) {
if (recipient != address(this) && recipient != owner() && !whitelists[recipient]) {
require((_balances[recipient] + amount) <= MAX_HOLDING_PERCENTAGE,
"Recipient's token holding exceeds the maximum allowed percentage"
);
}
_;
}
}
Read Contract
SELL_TAX_ADDRESS 0xe4234dd8 → address
SELL_TAX_PERCENTAGE 0x474e4ebe → uint256
_decimals 0x32424aa3 → uint8
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
getName 0x17d7de7c → string
getSupply 0x6c9c2faf → uint256
getSymbol 0x15070401 → string
name 0x06fdde03 → string
owner 0x8da5cb5b → address
pancakeswapPair 0xefbe389a → address
symbol 0x95d89b41 → string
totalBurned 0xd89135cd → uint256
totalSupply 0x18160ddd → uint256
validPairs 0xfd193d44 → bool
whitelists 0x1e7be210 → bool
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
addTradingPair 0x7c022811
address _pair
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
removeTradingPair 0x816670f3
address _pair
renounceOwnership 0x715018a6
No parameters
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
updatePancakeswapPair 0xdc233879
address _newPancakeswapPair
whietlist 0x9fe9307a
address _address
bool _isWhitelisting
withdraw 0x3ccfd60b
No parameters
withdrawToken 0x9e281a98
address tokenAddress
uint256 tokenAmount
Recent Transactions
No transactions found for this address