Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- VotingPowerPrism
- Optimization enabled
- true
- Compiler version
- v0.7.4+commit.3f05b770
- Optimization runs
- 999999
- EVM Version
- istanbul
- Verified at
- 2026-04-22T01:58:52.445531Z
Constructor Arguments
0000000000000000000000004f8f512dab59f227ea70b1d8a0044afa95cc80c3
Arg [0] (address) : 0x4f8f512dab59f227ea70b1d8a0044afa95cc80c3
contracts/VotingPowerPrism.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./lib/PrismProxy.sol";
/**
* @title VotingPowerPrism
* @dev Storage for voting power is at this address, while execution is delegated to the prism proxy implementation contract
* All contracts that use voting power should reference this contract.
*/
contract VotingPowerPrism is PrismProxy {
/**
* @notice Construct a new Voting Power Prism Proxy
* @dev Sets initial proxy admin to `_admin`
* @param _admin Initial proxy admin
*/
constructor(address _admin) {
// Initialize storage
ProxyStorage storage s = proxyStorage();
// Set initial proxy admin
s.admin = _admin;
}
/**
* @notice Forwards call to implementation contract
*/
receive() external payable {
_forwardToImplementation();
}
/**
* @notice Forwards call to implementation contract
*/
fallback() external payable {
_forwardToImplementation();
}
}
/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
contract PrismProxy {
/// @notice Proxy admin and implementation storage variables
struct ProxyStorage {
// Administrator for this contract
address admin;
// Pending administrator for this contract
address pendingAdmin;
// Active implementation of this contract
address implementation;
// Pending implementation of this contract
address pendingImplementation;
// Implementation version of this contract
uint8 version;
}
/// @dev Position in contract storage where prism ProxyStorage struct will be stored
bytes32 constant PRISM_PROXY_STORAGE_POSITION = keccak256("prism.proxy.storage");
/// @notice Emitted when pendingImplementation is changed
event NewPendingImplementation(address indexed oldPendingImplementation, address indexed newPendingImplementation);
/// @notice Emitted when pendingImplementation is accepted, which means implementation is updated
event NewImplementation(address indexed oldImplementation, address indexed newImplementation);
/// @notice Emitted when pendingAdmin is changed
event NewPendingAdmin(address indexed oldPendingAdmin, address indexed newPendingAdmin);
/// @notice Emitted when pendingAdmin is accepted, which means admin is updated
event NewAdmin(address indexed oldAdmin, address indexed newAdmin);
/**
* @notice Load proxy storage struct from specified PRISM_PROXY_STORAGE_POSITION
* @return ps ProxyStorage struct
*/
function proxyStorage() internal pure returns (ProxyStorage storage ps) {
bytes32 position = PRISM_PROXY_STORAGE_POSITION;
assembly {
ps.slot := position
}
}
/*** Admin Functions ***/
/**
* @notice Create new pending implementation for prism. msg.sender must be admin
* @dev Admin function for proposing new implementation contract
* @return boolean indicating success of operation
*/
function setPendingProxyImplementation(address newPendingImplementation) public returns (bool) {
ProxyStorage storage s = proxyStorage();
require(msg.sender == s.admin, "Prism::setPendingProxyImp: caller must be admin");
address oldPendingImplementation = s.pendingImplementation;
s.pendingImplementation = newPendingImplementation;
emit NewPendingImplementation(oldPendingImplementation, s.pendingImplementation);
return true;
}
/**
* @notice Accepts new implementation for prism. msg.sender must be pendingImplementation
* @dev Admin function for new implementation to accept it's role as implementation
* @return boolean indicating success of operation
*/
function acceptProxyImplementation() public returns (bool) {
ProxyStorage storage s = proxyStorage();
// Check caller is pendingImplementation and pendingImplementation ≠ address(0)
require(msg.sender == s.pendingImplementation && s.pendingImplementation != address(0), "Prism::acceptProxyImp: caller must be pending implementation");
// Save current values for inclusion in log
address oldImplementation = s.implementation;
address oldPendingImplementation = s.pendingImplementation;
s.implementation = s.pendingImplementation;
s.pendingImplementation = address(0);
s.version++;
emit NewImplementation(oldImplementation, s.implementation);
emit NewPendingImplementation(oldPendingImplementation, s.pendingImplementation);
return true;
}
/**
* @notice Begins transfer of admin rights. The newPendingAdmin must call `acceptAdmin` to finalize the transfer.
* @dev Admin function to begin change of admin. The newPendingAdmin must call `acceptAdmin` to finalize the transfer.
* @param newPendingAdmin New pending admin.
* @return boolean indicating success of operation
*/
function setPendingProxyAdmin(address newPendingAdmin) public returns (bool) {
ProxyStorage storage s = proxyStorage();
// Check caller = admin
require(msg.sender == s.admin, "Prism::setPendingProxyAdmin: caller must be admin");
// Save current value, if any, for inclusion in log
address oldPendingAdmin = s.pendingAdmin;
// Store pendingAdmin with value newPendingAdmin
s.pendingAdmin = newPendingAdmin;
// Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
return true;
}
/**
* @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
* @dev Admin function for pending admin to accept role and update admin
* @return boolean indicating success of operation
*/
function acceptProxyAdmin() public returns (bool) {
ProxyStorage storage s = proxyStorage();
// Check caller is pendingAdmin and pendingAdmin ≠ address(0)
require(msg.sender == s.pendingAdmin && msg.sender != address(0), "Prism::acceptProxyAdmin: caller must be pending admin");
// Save current values for inclusion in log
address oldAdmin = s.admin;
address oldPendingAdmin = s.pendingAdmin;
// Store admin with value pendingAdmin
s.admin = s.pendingAdmin;
// Clear the pending value
s.pendingAdmin = address(0);
emit NewAdmin(oldAdmin, s.admin);
emit NewPendingAdmin(oldPendingAdmin, s.pendingAdmin);
return true;
}
/**
* @notice Get current admin for prism proxy
* @return admin address
*/
function proxyAdmin() public view returns (address) {
ProxyStorage storage s = proxyStorage();
return s.admin;
}
/**
* @notice Get pending admin for prism proxy
* @return admin address
*/
function pendingProxyAdmin() public view returns (address) {
ProxyStorage storage s = proxyStorage();
return s.pendingAdmin;
}
/**
* @notice Address of implementation contract
* @return implementation address
*/
function proxyImplementation() public view returns (address) {
ProxyStorage storage s = proxyStorage();
return s.implementation;
}
/**
* @notice Address of pending implementation contract
* @return pending implementation address
*/
function pendingProxyImplementation() public view returns (address) {
ProxyStorage storage s = proxyStorage();
return s.pendingImplementation;
}
/**
* @notice Current implementation version for proxy
* @return version number
*/
function proxyImplementationVersion() public view returns (uint8) {
ProxyStorage storage s = proxyStorage();
return s.version;
}
/**
* @notice Delegates execution to an implementation contract.
* @dev Returns to the external caller whatever the implementation returns or forwards reverts
*/
function _forwardToImplementation() internal {
ProxyStorage storage s = proxyStorage();
// delegate all other functions to current implementation
(bool success, ) = s.implementation.delegatecall(msg.data);
assembly {
let free_mem_ptr := mload(0x40)
returndatacopy(free_mem_ptr, 0, returndatasize())
switch success
case 0 { revert(free_mem_ptr, returndatasize()) }
default { return(free_mem_ptr, returndatasize()) }
}
}
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":999999,"enabled":true},"metadata":{"useLiteralContent":true,"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"contracts/VotingPowerPrism.sol":"VotingPowerPrism"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_admin","internalType":"address"}]},{"type":"event","name":"NewAdmin","inputs":[{"type":"address","name":"oldAdmin","internalType":"address","indexed":true},{"type":"address","name":"newAdmin","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"NewImplementation","inputs":[{"type":"address","name":"oldImplementation","internalType":"address","indexed":true},{"type":"address","name":"newImplementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"NewPendingAdmin","inputs":[{"type":"address","name":"oldPendingAdmin","internalType":"address","indexed":true},{"type":"address","name":"newPendingAdmin","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"NewPendingImplementation","inputs":[{"type":"address","name":"oldPendingImplementation","internalType":"address","indexed":true},{"type":"address","name":"newPendingImplementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"fallback","stateMutability":"payable"},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"acceptProxyAdmin","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"acceptProxyImplementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingProxyAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingProxyImplementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"proxyAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"proxyImplementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"proxyImplementationVersion","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setPendingProxyAdmin","inputs":[{"type":"address","name":"newPendingAdmin","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setPendingProxyImplementation","inputs":[{"type":"address","name":"newPendingImplementation","internalType":"address"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x608060405234801561001057600080fd5b50604051610aea380380610aea83398101604081905261002f91610082565b600061003961005e565b80546001600160a01b0319166001600160a01b039390931692909217909155506100b0565b7f0e44922e752e5aec2c0503d75bafd73ddc558f76127cf1484a1819fd3dfb6b9090565b600060208284031215610093578081fd5b81516001600160a01b03811681146100a9578182fd5b9392505050565b610a2b806100bf6000396000f3fe60806040526004361061009a5760003560e01c80633e47158c1161006957806394d8fbd01161004e57806394d8fbd01461016a5780639c2562db1461017f578063ec10bbd514610194576100a9565b80633e47158c146101405780636405901614610155576100a9565b80630758e714146100b15780630c870f91146100e757806315596a201461010957806325f86cbb1461012b576100a9565b366100a9576100a76101b4565b005b6100a76101b4565b3480156100bd57600080fd5b506100d16100cc3660046107fc565b61024d565b6040516100de9190610868565b60405180910390f35b3480156100f357600080fd5b506100fc610335565b6040516100de9190610847565b34801561011557600080fd5b5061011e610360565b6040516100de91906109e7565b34801561013757600080fd5b506100fc610390565b34801561014c57600080fd5b506100fc6103bb565b34801561016157600080fd5b506100d16103e3565b34801561017657600080fd5b506100d1610523565b34801561018b57600080fd5b506100fc6106d0565b3480156101a057600080fd5b506100d16101af3660046107fc565b6106fb565b60006101be6107d8565b600281015460405191925060009173ffffffffffffffffffffffffffffffffffffffff909116906101f29083903690610837565b600060405180830381855af49150503d806000811461022d576040519150601f19603f3d011682016040523d82523d6000602084013e610232565b606091505b505090506040513d6000823e818015610249573d82f35b3d82fd5b6000806102586107d8565b805490915073ffffffffffffffffffffffffffffffffffffffff1633146102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab9061092d565b60405180910390fd5b60038101805473ffffffffffffffffffffffffffffffffffffffff8581167fffffffffffffffffffffffff00000000000000000000000000000000000000008316179283905560405191811692169082907fe945ccee5d701fc83f9b8aa8ca94ea4219ec1fcbd4f4cab4f0ea57c5c3e1d81590600090a35060019392505050565b6000806103406107d8565b6002015473ffffffffffffffffffffffffffffffffffffffff1691505090565b60008061036b6107d8565b6003015474010000000000000000000000000000000000000000900460ff1692915050565b60008061039b6107d8565b6001015473ffffffffffffffffffffffffffffffffffffffff1691505090565b6000806103c66107d8565b5473ffffffffffffffffffffffffffffffffffffffff1691505090565b6000806103ee6107d8565b600181015490915073ffffffffffffffffffffffffffffffffffffffff163314801561041957503315155b61044f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab90610873565b805460018201805473ffffffffffffffffffffffffffffffffffffffff8082167fffffffffffffffffffffffff0000000000000000000000000000000000000000808616821780885593169093556040519381169391169083907ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc90600090a3600183015460405173ffffffffffffffffffffffffffffffffffffffff918216918316907fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a990600090a36001935050505090565b60008061052e6107d8565b600381015490915073ffffffffffffffffffffffffffffffffffffffff16331480156105735750600381015473ffffffffffffffffffffffffffffffffffffffff1615155b6105a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab906108d0565b60028101805460038301805473ffffffffffffffffffffffffffffffffffffffff8082167fffffffffffffffffffffffff00000000000000000000000000000000000000008086168217968790557fffffffffffffffffffffff0000000000000000000000000000000000000000008416740100000000000000000000000000000000000000009190941681900460ff90811660010116029290921790925560405192821693909291169083907fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a90600090a3600383015460405173ffffffffffffffffffffffffffffffffffffffff918216918316907fe945ccee5d701fc83f9b8aa8ca94ea4219ec1fcbd4f4cab4f0ea57c5c3e1d81590600090a36001935050505090565b6000806106db6107d8565b6003015473ffffffffffffffffffffffffffffffffffffffff1691505090565b6000806107066107d8565b805490915073ffffffffffffffffffffffffffffffffffffffff163314610759576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab9061098a565b60018101805473ffffffffffffffffffffffffffffffffffffffff8581167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a990600090a35060019392505050565b7f0e44922e752e5aec2c0503d75bafd73ddc558f76127cf1484a1819fd3dfb6b9090565b60006020828403121561080d578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610830578182fd5b9392505050565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b901515815260200190565b60208082526035908201527f507269736d3a3a61636365707450726f787941646d696e3a2063616c6c65722060408201527f6d7573742062652070656e64696e672061646d696e0000000000000000000000606082015260800190565b6020808252603c908201527f507269736d3a3a61636365707450726f7879496d703a2063616c6c6572206d7560408201527f73742062652070656e64696e6720696d706c656d656e746174696f6e00000000606082015260800190565b6020808252602f908201527f507269736d3a3a73657450656e64696e6750726f7879496d703a2063616c6c6560408201527f72206d7573742062652061646d696e0000000000000000000000000000000000606082015260800190565b60208082526031908201527f507269736d3a3a73657450656e64696e6750726f787941646d696e3a2063616c60408201527f6c6572206d7573742062652061646d696e000000000000000000000000000000606082015260800190565b60ff9190911681526020019056fea2646970667358221220f247f6d44d2db3474f825566ed8cf1bc29cb4f7642e1590814d656657daa77fe64736f6c634300070400330000000000000000000000004f8f512dab59f227ea70b1d8a0044afa95cc80c3
Deployed ByteCode
0x60806040526004361061009a5760003560e01c80633e47158c1161006957806394d8fbd01161004e57806394d8fbd01461016a5780639c2562db1461017f578063ec10bbd514610194576100a9565b80633e47158c146101405780636405901614610155576100a9565b80630758e714146100b15780630c870f91146100e757806315596a201461010957806325f86cbb1461012b576100a9565b366100a9576100a76101b4565b005b6100a76101b4565b3480156100bd57600080fd5b506100d16100cc3660046107fc565b61024d565b6040516100de9190610868565b60405180910390f35b3480156100f357600080fd5b506100fc610335565b6040516100de9190610847565b34801561011557600080fd5b5061011e610360565b6040516100de91906109e7565b34801561013757600080fd5b506100fc610390565b34801561014c57600080fd5b506100fc6103bb565b34801561016157600080fd5b506100d16103e3565b34801561017657600080fd5b506100d1610523565b34801561018b57600080fd5b506100fc6106d0565b3480156101a057600080fd5b506100d16101af3660046107fc565b6106fb565b60006101be6107d8565b600281015460405191925060009173ffffffffffffffffffffffffffffffffffffffff909116906101f29083903690610837565b600060405180830381855af49150503d806000811461022d576040519150601f19603f3d011682016040523d82523d6000602084013e610232565b606091505b505090506040513d6000823e818015610249573d82f35b3d82fd5b6000806102586107d8565b805490915073ffffffffffffffffffffffffffffffffffffffff1633146102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab9061092d565b60405180910390fd5b60038101805473ffffffffffffffffffffffffffffffffffffffff8581167fffffffffffffffffffffffff00000000000000000000000000000000000000008316179283905560405191811692169082907fe945ccee5d701fc83f9b8aa8ca94ea4219ec1fcbd4f4cab4f0ea57c5c3e1d81590600090a35060019392505050565b6000806103406107d8565b6002015473ffffffffffffffffffffffffffffffffffffffff1691505090565b60008061036b6107d8565b6003015474010000000000000000000000000000000000000000900460ff1692915050565b60008061039b6107d8565b6001015473ffffffffffffffffffffffffffffffffffffffff1691505090565b6000806103c66107d8565b5473ffffffffffffffffffffffffffffffffffffffff1691505090565b6000806103ee6107d8565b600181015490915073ffffffffffffffffffffffffffffffffffffffff163314801561041957503315155b61044f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab90610873565b805460018201805473ffffffffffffffffffffffffffffffffffffffff8082167fffffffffffffffffffffffff0000000000000000000000000000000000000000808616821780885593169093556040519381169391169083907ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc90600090a3600183015460405173ffffffffffffffffffffffffffffffffffffffff918216918316907fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a990600090a36001935050505090565b60008061052e6107d8565b600381015490915073ffffffffffffffffffffffffffffffffffffffff16331480156105735750600381015473ffffffffffffffffffffffffffffffffffffffff1615155b6105a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab906108d0565b60028101805460038301805473ffffffffffffffffffffffffffffffffffffffff8082167fffffffffffffffffffffffff00000000000000000000000000000000000000008086168217968790557fffffffffffffffffffffff0000000000000000000000000000000000000000008416740100000000000000000000000000000000000000009190941681900460ff90811660010116029290921790925560405192821693909291169083907fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a90600090a3600383015460405173ffffffffffffffffffffffffffffffffffffffff918216918316907fe945ccee5d701fc83f9b8aa8ca94ea4219ec1fcbd4f4cab4f0ea57c5c3e1d81590600090a36001935050505090565b6000806106db6107d8565b6003015473ffffffffffffffffffffffffffffffffffffffff1691505090565b6000806107066107d8565b805490915073ffffffffffffffffffffffffffffffffffffffff163314610759576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab9061098a565b60018101805473ffffffffffffffffffffffffffffffffffffffff8581167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a990600090a35060019392505050565b7f0e44922e752e5aec2c0503d75bafd73ddc558f76127cf1484a1819fd3dfb6b9090565b60006020828403121561080d578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610830578182fd5b9392505050565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b901515815260200190565b60208082526035908201527f507269736d3a3a61636365707450726f787941646d696e3a2063616c6c65722060408201527f6d7573742062652070656e64696e672061646d696e0000000000000000000000606082015260800190565b6020808252603c908201527f507269736d3a3a61636365707450726f7879496d703a2063616c6c6572206d7560408201527f73742062652070656e64696e6720696d706c656d656e746174696f6e00000000606082015260800190565b6020808252602f908201527f507269736d3a3a73657450656e64696e6750726f7879496d703a2063616c6c6560408201527f72206d7573742062652061646d696e0000000000000000000000000000000000606082015260800190565b60208082526031908201527f507269736d3a3a73657450656e64696e6750726f787941646d696e3a2063616c60408201527f6c6572206d7573742062652061646d696e000000000000000000000000000000606082015260800190565b60ff9190911681526020019056fea2646970667358221220f247f6d44d2db3474f825566ed8cf1bc29cb4f7642e1590814d656657daa77fe64736f6c63430007040033