Address Contract Verified
Address
0x6D8445F0d9de1C6bdB565d3B45A6E77f4333DF9F
Balance
0 ETH
Nonce
1
Code Size
1921 bytes
Creator
0x6Ab50509...1417 at tx 0xff4a4f77...84fd0f
Indexed Transactions
0
Contract Bytecode
1921 bytes
0x608060405234801561000f575f5ffd5b506004361061007b575f3560e01c80638da5cb5b116100595780638da5cb5b146100d3578063baab394e146100f1578063e6c7c4561461010f578063fc0c546a1461012d5761007b565b8063095ea7b31461007f5780631f73ee601461009b57806323b872dd146100b7575b5f5ffd5b6100996004803603810190610094919061045b565b61014b565b005b6100b560048036038101906100b09190610499565b6101eb565b005b6100d160048036038101906100cc91906104c4565b6101f5565b005b6100db6102dd565b6040516100e89190610523565b60405180910390f35b6100f9610302565b604051610106919061054b565b60405180910390f35b610117610308565b604051610124919061054b565b60405180910390f35b6101356103a6565b60405161014291906105bf565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b383836040518363ffffffff1660e01b81526004016101a69291906105d8565b6020604051808303815f875af11580156101c2573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101e69190610634565b505050565b8060028190555050565b60025481111561023a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610231906106b9565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b8152600401610297939291906106d7565b6020604051808303815f875af11580156102b3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102d79190610634565b50505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016103629190610523565b602060405180830381865afa15801561037d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a19190610720565b905090565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103f7826103ce565b9050919050565b610407816103ed565b8114610411575f5ffd5b50565b5f81359050610422816103fe565b92915050565b5f819050919050565b61043a81610428565b8114610444575f5ffd5b50565b5f8135905061045581610431565b92915050565b5f5f60408385031215610471576104706103ca565b5b5f61047e85828601610414565b925050602061048f85828601610447565b9150509250929050565b5f602082840312156104ae576104ad6103ca565b5b5f6104bb84828501610447565b91505092915050565b5f5f5f606084860312156104db576104da6103ca565b5b5f6104e886828701610414565b93505060206104f986828701610414565b925050604061050a86828701610447565b9150509250925092565b61051d816103ed565b82525050565b5f6020820190506105365f830184610514565b92915050565b61054581610428565b82525050565b5f60208201905061055e5f83018461053c565b92915050565b5f819050919050565b5f61058761058261057d846103ce565b610564565b6103ce565b9050919050565b5f6105988261056d565b9050919050565b5f6105a98261058e565b9050919050565b6105b98161059f565b82525050565b5f6020820190506105d25f8301846105b0565b92915050565b5f6040820190506105eb5f830185610514565b6105f8602083018461053c565b9392505050565b5f8115159050919050565b610613816105ff565b811461061d575f5ffd5b50565b5f8151905061062e8161060a565b92915050565b5f60208284031215610649576106486103ca565b5b5f61065684828501610620565b91505092915050565b5f82825260208201905092915050565b7f416d6f756e742065786365656473207370656e64696e672063617000000000005f82015250565b5f6106a3601b8361065f565b91506106ae8261066f565b602082019050919050565b5f6020820190508181035f8301526106d081610697565b9050919050565b5f6060820190506106ea5f830186610514565b6106f76020830185610514565b610704604083018461053c565b949350505050565b5f8151905061071a81610431565b92915050565b5f60208284031215610735576107346103ca565b5b5f6107428482850161070c565b9150509291505056fea26469706673582212204bfc3927f06f863a0474c7ae80838b5f286426f65e2ddf7c52ba5e43d4839dd264736f6c634300081f0033
Verified Source Code Full Match
Compiler: v0.8.31+commit.fd3a2265
EVM: osaka
Optimization: No
cv.sol 36 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract TokenApproval {
IERC20 public token;
address public owner;
uint256 public spendingCap;
constructor(address _tokenAddress) {
token = IERC20(_tokenAddress);
owner = msg.sender;
}
// Function to set the spending cap
function setSpendingCap(uint256 _spendingCap) public {
spendingCap = _spendingCap;
}
// Function to approve the contract to spend tokens on behalf of the caller
function approve(address spender, uint256 amount) public {
token.approve(spender, amount);
}
// Function to transfer tokens from the caller to the contract
function transferFrom(address from, address to, uint256 amount) public {
require(amount <= spendingCap, "Amount exceeds spending cap");
token.transferFrom(from, to, amount);
}
// Function to check the balance of the contract
function balanceOfContract() public view returns (uint256) {
return token.balanceOf(address(this));
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
Read Contract
balanceOfContract 0xe6c7c456 → uint256
owner 0x8da5cb5b → address
spendingCap 0xbaab394e → uint256
token 0xfc0c546a → address
Write Contract 3 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
setSpendingCap 0x1f73ee60
uint256 _spendingCap
transferFrom 0x23b872dd
address from
address to
uint256 amount
Recent Transactions
No transactions found for this address