Verified contractPartialMIT
PETHV4
Address0xb19ecdf38adcb849b4671962bb88fe7b623f26b2
- Balance
0 ETH
- Transactions
77
- Compiler
solc 0.8.33
- Same code
Only this contract
Details
- Compiler
- solc 0.8.33+commit.64118f21
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,508,593
- Creation transaction
- 0x877f4e2184…acdb7c73ac
src/PETHV4.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
// src/PETHV4.sol
/*
━━━━━━━━━━━━━━━━━━━━━━━━━━ PETH V4 ━━━━━━━━━━━━━━━━━━━━━━━━━━
site https://pethv4.xyz
x https://x.com/pethv4
docs https://pethv4.gitbook.io/blindfair-launchpad-docs
whitepaper https://peth-docs.xyz
*/
contract PETHV4 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event OwnershipTransferred(address indexed prev, address indexed next);
event FundingPaid(uint256 indexed epoch, int256 rate);
string public constant name = "PETHV4";
string public constant symbol = "PETHV4";
uint8 public constant decimals = 18;
uint256 public constant TOTAL_SUPPLY = 1_000_000_000 * 1e18;
uint256 public constant FUNDING_WINDOW = 8 hours;
uint256 public constant MAINT_MARGIN_BPS = 500;
uint256 public totalSupply;
address public owner;
bool private _initialized;
mapping(address => uint256) internal _bal;
mapping(address => mapping(address => uint256)) internal _allow;
mapping(address => uint256) private _nonces;
constructor(address d) {
require(d != address(0), "zero");
owner = d;
emit OwnershipTransferred(address(0), d);
}
function website() external pure returns (string memory) { return "https://halo.perps"; }
function twitter() external pure returns (string memory) { return "https://x.com/halo_perps"; }
function mintInitialSupply(address to, uint256 amount) external {
require(msg.sender == owner, "owner");
require(!_initialized, "init");
_initialized = true;
totalSupply = amount;
_bal[to] = amount;
emit Transfer(address(0), to, amount);
}
function renounceOwnership() external {
require(msg.sender == owner, "owner");
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
function balanceOf(address a) external view returns (uint256) { return _bal[a]; }
function allowance(address o, address s) external view returns (uint256) { return _allow[o][s]; }
function approve(address to, uint256 v) external returns (bool) {
require(to != address(0), "zero");
_allow[msg.sender][to] = v;
emit Approval(msg.sender, to, v);
return true;
}
function transfer(address to, uint256 v) external returns (bool) { _shift(msg.sender, to, v); return true; }
function transferFrom(address f, address to, uint256 v) external returns (bool) {
uint256 a = _allow[f][msg.sender];
require(a >= v, "allowance");
if (a != type(uint256).max) _allow[f][msg.sender] = a - v;
_shift(f, to, v);
return true;
}
function _shift(address f, address to, uint256 v) private {
require(to != address(0), "zero");
uint256 b = _bal[f];
require(b >= v, "balance");
unchecked { _bal[f] = b - v; _bal[to] += v; }
emit Transfer(f, to, v);
}
function increaseAllowance(address to, uint256 add_) external returns (bool) {
uint256 c = _allow[msg.sender][to];
_allow[msg.sender][to] = c + add_;
emit Approval(msg.sender, to, c + add_);
return true;
}
function decreaseAllowance(address to, uint256 sub_) external returns (bool) {
uint256 c = _allow[msg.sender][to];
require(c >= sub_, "allowance");
unchecked { _allow[msg.sender][to] = c - sub_; }
emit Approval(msg.sender, to, c - sub_);
return true;
}
bytes32 private constant _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
function nonces(address a) external view returns (uint256) { return _nonces[a]; }
function DOMAIN_SEPARATOR() public view returns (bytes32) {
return keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)), keccak256(bytes("1")),
block.chainid, address(this)
));
}
function permit(
address who, address spender, uint256 val,
uint256 deadline, uint8 v_, bytes32 r_, bytes32 s_
) external {
require(block.timestamp <= deadline, "expired");
bytes32 digest = keccak256(abi.encodePacked(
"\x19\x01", DOMAIN_SEPARATOR(),
keccak256(abi.encode(_PERMIT_TYPEHASH, who, spender, val, _nonces[who]++, deadline))
));
address signer = ecrecover(digest, v_, r_, s_);
require(signer != address(0) && signer == who, "invalid");
require(spender != address(0), "zero");
_allow[who][spender] = val;
emit Approval(who, spender, val);
}
}
Compiler settingsShow
{
"viaIR": true,
"optimizer": {
"runs": 1,
"details": {
"yul": true
},
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.