Verified contractPartialGPL-3.0
GovernanceMulticall
Address0x44a9a54c3cd53161fd6c8d5bf3d1aa627f5a0b93
- Balance
0 ETH
- Transactions
5
- Compiler
solc 0.8.23
- Same code
Only this contract
Details
- Compiler
- solc 0.8.23+commit.f704f362
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- shanghai
- License
- GPL-3.0
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,576,296
- Creation transaction
- 0x1bfa400835…6f1722dbf3
2 files
src/periphery/GovernanceMulticall.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.23;
import {Governance} from "@periphery/utils/Governance.sol";
/// @notice Access-controlled multicall for batching governed configuration.
contract GovernanceMulticall is Governance {
struct Call {
address target;
uint256 value;
bytes data;
}
constructor(address _governance) Governance(_governance) {
require(_governance != address(0), "!governance");
}
receive() external payable {}
function multicall(
Call[] calldata calls
) external payable onlyGovernance returns (bytes[] memory results) {
results = new bytes[](calls.length);
for (uint256 i; i < calls.length; ) {
Call calldata call = calls[i];
require(call.target != address(0), "!target");
(bool success, bytes memory result) = call.target.call{
value: call.value
}(call.data);
if (!success) {
_revert(result);
}
results[i] = result;
unchecked {
++i;
}
}
}
function _revert(bytes memory reason) internal pure {
if (reason.length == 0) {
revert("CALL_FAILED");
}
assembly {
revert(add(reason, 32), mload(reason))
}
}
}
lib/tokenized-strategy-periphery/src/utils/Governance.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.8.18;
contract Governance {
/// @notice Emitted when the governance address is updated.
event GovernanceTransferred(address indexed previousGovernance, address indexed newGovernance);
modifier onlyGovernance() {
_checkGovernance();
_;
}
/// @notice Checks if the msg sender is the governance.
function _checkGovernance() internal view virtual {
require(governance == msg.sender, "!governance");
}
/// @notice Address that can set the default base fee and provider
address public governance;
constructor(address _governance) {
governance = _governance;
emit GovernanceTransferred(address(0), _governance);
}
/**
* @notice Sets a new address as the governance of the contract.
* @dev Throws if the caller is not current governance.
* @param _newGovernance The new governance address.
*/
function transferGovernance(address _newGovernance) external virtual onlyGovernance {
require(_newGovernance != address(0), "ZERO ADDRESS");
address oldGovernance = governance;
governance = _newGovernance;
emit GovernanceTransferred(oldGovernance, _newGovernance);
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "shanghai",
"remappings": [
"@openzeppelin/=lib/openzeppelin-contracts/",
"forge-std/=lib/forge-std/src/",
"@tokenized-strategy/=lib/tokenized-strategy/src/",
"@periphery/=lib/tokenized-strategy-periphery/src/",
"pawn-broker/=lib/pawn-broker/src/",
"@yearn-vaults/=lib/tokenized-strategy-periphery/lib/yearn-vaults-v3/contracts/",
"ds-test/=lib/tokenized-strategy/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/tokenized-strategy/lib/erc4626-tests/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin/=lib/openzeppelin-contracts/contracts/",
"tokenized-strategy-periphery/=lib/tokenized-strategy-periphery/",
"tokenized-strategy/=lib/tokenized-strategy/",
"yearn-vaults-v3/=lib/tokenized-strategy-periphery/lib/yearn-vaults-v3/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.