Skip to content

Commit 0f01758

Browse files
committed
updated code
1 parent 30308c9 commit 0f01758

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/ProposalManager.sol

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: UNLICENSED
22
pragma solidity ^0.8.28;
33

4+
import "./treasury.sol";
5+
46

57
error Not_Admin();
68
error INVALID_PROPOSAL_STATUS();
@@ -9,10 +11,13 @@ error PROPOSAL_DOES_NOT_EXIST();
911

1012
contract ProposalManager {
1113

14+
Treasury public treasury;
15+
1216
address public admin;
1317

14-
constructor(){
18+
constructor(address _treasury){
1519
admin = msg.sender;
20+
treasury = Treasury(payable(_treasury))
1621
}
1722

1823
enum ProposalStatus {
@@ -47,7 +52,7 @@ constructor(){
4752

4853
event proposalCreated(address indexed proposer, address recipient, uint amount);
4954
event proposalApproved(uint indexed proposer_id);
50-
event proposalexecuted(uint indexed proposer);
55+
event proposalexecuted(uint indexed proposer_id);
5156

5257
function createProposal(address _recipient, uint256 _amount) external {
5358
proposalCount++;
@@ -76,6 +81,8 @@ constructor(){
7681
if(proposal.status != ProposalStatus.APPROVED) revert INVALID_PROPOSAL_STATUS();
7782
proposals[_id].status = ProposalStatus.EXECUTED;
7883

84+
treasury.sendFunds(proposal.recipient, proposal.amount);
85+
7986
emit proposalexecuted(_id);
8087
}
8188

0 commit comments

Comments
 (0)