SimpleP1
0xeeaf68fb48145dda824805ccc7654db3e3f127af
Verification
Verified
v0.8.24+commit.e11b9ed9
Type
Contract
1,991 bytes
ABI entries
9
2 read · 2 write
License
none
Contract information
- Address
- 0xeeaf68fb48145dda824805ccc7654db3e3f127af
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.24+commit.e11b9ed9
- Optimization
- Disabled
- Creator
- 0x1898489466…290372363D
- Creation tx
- 0xd2184818f2…780a4e8659
Token
- Name
- Pi network
- Symbol
- PI
- Decimals
- 18
- Holders
- 135
- Market
- View token page →
Read contract (2)
implementation() → address
owner() → address
Events (2)
ImplementationSetOwnershipRenounced
ABI
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "ImplementationSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "OwnershipRenounced",
"type": "event"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [],
"name": "implementation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_implementation",
"type": "address"
}
],
"name": "setImplementation",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract SimpleP1 {
bytes32 private constant _OWNER_SLOT =
0xa7b53796fd2d99cb1f5ae019b54f9e024446c3d12b483f733ccc62ed04eb126a;
bytes32 private constant _IMPL_SLOT =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
event ImplementationSet(address indexed implementation);
event OwnershipRenounced();
modifier onlyOwner() {
require(_getOwner() == msg.sender, "Not owner");
_;
}
constructor() {
_setOwner(msg.sender);
}
function owner() public view returns (address) {
return _getOwner();
}
function implementation() public view returns (address) {
return _getImpl();
}
function setImplementation(address _implementation) external onlyOwner {
require(_implementation != address(0), "Zero address");
require(_getImpl() == address(0), "Already set");
_setImpl(_implementation);
emit ImplementationSet(_implementation);
}
function renounceOwnership() external onlyOwner {
_setOwner(address(0));
emit OwnershipRenounced();
}
function _getOwner() internal view returns (address o) {
bytes32 slot = _OWNER_SLOT;
assembly { o := sload(slot) }
}
function _setOwner(address o) internal {
bytes32 slot = _OWNER_SLOT;
assembly { sstore(slot, o) }
}
function _getImpl() internal view returns (address o) {
bytes32 slot = _IMPL_SLOT;
assembly { o := sload(slot) }
}
function _setImpl(address o) internal {
bytes32 slot = _IMPL_SLOT;
assembly { sstore(slot, o) }
}
fallback() external payable {
address impl = _getImpl();
require(impl != address(0), "Implementation not set");
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
receive() external payable {
address impl = _getImpl();
require(impl != address(0), "Implementation not set");
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
}Chain explorer6646msChain node78ms