Description:
Smart contract deployed on Ethereum with Factory features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"src/Dependencies/Whitelist.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0
// Docgen-SOLC: 0.8.25
pragma solidity ^0.8.24;
import {Owned} from "./Owned.sol";
import {IWhitelist} from "../Interfaces/IWhitelist.sol";
contract Whitelist is IWhitelist, Owned {
// calling contract -> funcSig -> whitelisted
mapping(address => mapping(bytes4 => bool)) public whitelistedFunc;
// calling contract -> funcSig -> user -> whitelisted
mapping(address => mapping(bytes4 => mapping(address => bool))) whitelist;
event WhitelistedFuncAdded(address callingContract, bytes4 funcSig);
event WhitelistFuncRemoved(
address callingContract,
bytes4 funcSig
);
event Whitelisted(address callingContract, bytes4 funcSig, address user);
event WhitelistRemoved(
address callingContract,
bytes4 funcSig,
address user
);
error FuncNotWhitelisted();
constructor(address owner) Owned(owner) {}
function addWhitelistedFunc(
address callingContract,
bytes4 funcSig
) external override onlyOwner {
whitelistedFunc[callingContract][funcSig] = true;
emit WhitelistedFuncAdded(callingContract, funcSig);
}
function removeWhitelistedFunc(
address callingContract,
bytes4 funcSig
) external override onlyOwner {
whitelistedFunc[callingContract][funcSig] = false;
emit WhitelistFuncRemoved(callingContract, funcSig);
}
function addToWhitelist(
address callingContract,
bytes4 funcSig,
address user
) external override onlyOwner {
if (!whitelistedFunc[callingContract][funcSig]) {
revert FuncNotWhitelisted();
}
whitelist[callingContract][funcSig][user] = true;
emit Whitelisted(callingContract, funcSig, user);
}
function removeFromWhitelist(
address callingContract,
bytes4 funcSig,
address user
) external override onlyOwner {
whitelist[callingContract][funcSig][user] = false;
emit WhitelistRemoved(callingContract, funcSig, user);
}
function isWhitelisted(
address callingContract,
bytes4 funcSig,
address user
) external view override returns (bool) {
if (!whitelistedFunc[callingContract][funcSig]) {
return true;
}
return whitelist[callingContract][funcSig][user];
}
function isWhitelistedFunc(
address callingContract,
bytes4 funcSig
) external view returns (bool) {
return whitelistedFunc[callingContract][funcSig];
}
}
"
},
"src/Dependencies/Owned.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0
// Docgen-SOLC: 0.8.25
pragma solidity 0.8.24;
import "../Interfaces/IOwned.sol";
// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned is IOwned {
address public override owner;
address public override nominatedOwner;
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
constructor(address _owner) {
require(_owner != address(0), "Owned/owner-zero");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external virtual override onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external virtual override {
require(msg.sender == nominatedOwner, "Owned/not-nominated");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner() {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Owned/not-owner");
}
}
"
},
"src/Interfaces/IWhitelist.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IWhitelist {
function addWhitelistedFunc(address callingContract, bytes4 funcSig) external;
function removeWhitelistedFunc(address callingContract, bytes4 funcSig) external;
function addToWhitelist(address callingContract, bytes4 funcSig, address user) external;
function removeFromWhitelist(address callingContract, bytes4 funcSig, address user) external;
function isWhitelisted(address callingContract, bytes4 funcSig, address user) external view returns (bool);
function isWhitelistedFunc(address callingContract, bytes4 funcSig) external view returns (bool);
}
"
},
"src/Interfaces/IOwned.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IOwned {
function owner() external view returns (address);
function nominatedOwner() external view returns (address);
function nominateNewOwner(address owner) external;
function acceptOwnership() external;
}
"
}
},
"settings": {
"remappings": [
"openzeppelin/=lib/V2-gov/lib/openzeppelin-contracts/",
"@chimera/=lib/V2-gov/lib/chimera/src/",
"@openzeppelin/contracts/=lib/V2-gov/lib/openzeppelin-contracts/contracts/",
"Solady/=lib/Solady/src/",
"V2-gov/=lib/V2-gov/",
"chimera/=lib/V2-gov/lib/chimera/src/",
"ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"v4-core/=lib/V2-gov/lib/v4-core/"
],
"optimizer": {
"enabled": true,
"runs": 1
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false
}
}}
Submitted on: 2025-10-13 12:13:00
Comments
Log in to comment.
No comments yet.