-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTreasury.sol
41 lines (32 loc) · 1011 Bytes
/
Treasury.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/utils/Address.sol";
contract Treasury {
using Address for address payable;
address public deployer;
address public governance;
event PaymentSent(address indexed receiver, uint256 amount);
modifier onlyGovernance() {
require(msg.sender == governance, "Only governance");
_;
}
modifier onlyDeployer() {
require(msg.sender == deployer, "Only deployer");
_;
}
constructor() {
deployer = msg.sender;
}
function setGovernance(address _governanceAddress) external onlyDeployer {
require(governance == address(0), "Governance already set");
governance = _governanceAddress;
}
function sendPayment(
address _receiver,
uint _amount
) external onlyGovernance {
payable(_receiver).sendValue(_amount);
emit PaymentSent(_receiver, _amount);
}
receive() external payable {}
}