From 7fefe05d7dbe84df659317e0482b2ebcbeeb7a37 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 25 Jul 2023 08:20:39 +0800 Subject: [PATCH] add metadata to event emit for Multisig TXs & Application Proposals --- contracts/multisigs/CharityApplications.sol | 4 ++-- contracts/multisigs/CharityApplicationsStorage.sol | 2 +- contracts/multisigs/MultiSigGeneric.sol | 2 +- .../multisigs/interfaces/ICharityApplications.sol | 5 +++-- contracts/multisigs/interfaces/IMultiSigGeneric.sol | 7 ++++++- .../endowment-multisig/EndowmentMultiSig.sol | 3 ++- .../endowment-multisig/EndowmentMultiSigEmitter.sol | 12 +++++++++--- .../interfaces/IEndowmentMultiSigEmitter.sol | 3 ++- 8 files changed, 26 insertions(+), 12 deletions(-) diff --git a/contracts/multisigs/CharityApplications.sol b/contracts/multisigs/CharityApplications.sol index 0ca8f4304..087736ba2 100644 --- a/contracts/multisigs/CharityApplications.sol +++ b/contracts/multisigs/CharityApplications.sol @@ -111,7 +111,7 @@ contract CharityApplications is MultiSigGeneric, StorageApplications, ICharityAp */ function proposeApplication( AccountMessages.CreateEndowmentRequest memory _application, - string memory _meta + bytes memory _meta ) public override { require(proposals[proposalCount].proposer == address(0), "Proposal already exists"); require( @@ -140,7 +140,7 @@ contract CharityApplications is MultiSigGeneric, StorageApplications, ICharityAp executed: false }); - emit ApplicationProposed(proposalCount, msg.sender, _application.name, expiry); + emit ApplicationProposed(proposalCount, msg.sender, _application.name, expiry, _meta); if (isOwner[msg.sender]) { confirmProposal(proposalCount); diff --git a/contracts/multisigs/CharityApplicationsStorage.sol b/contracts/multisigs/CharityApplicationsStorage.sol index 66c20c13b..122ee365b 100644 --- a/contracts/multisigs/CharityApplicationsStorage.sol +++ b/contracts/multisigs/CharityApplicationsStorage.sol @@ -8,7 +8,7 @@ library ApplicationsStorage { struct ApplicationProposal { address proposer; AccountMessages.CreateEndowmentRequest application; - string meta; + bytes meta; uint256 expiry; bool executed; } diff --git a/contracts/multisigs/MultiSigGeneric.sol b/contracts/multisigs/MultiSigGeneric.sol index 58ad31f81..476788b16 100644 --- a/contracts/multisigs/MultiSigGeneric.sol +++ b/contracts/multisigs/MultiSigGeneric.sol @@ -348,6 +348,6 @@ contract MultiSigGeneric is metadata: metadata }); transactionCount += 1; - emit TransactionSubmitted(address(this), msg.sender, transactionId); + emit TransactionSubmitted(address(this), msg.sender, transactionId, metadata); } } diff --git a/contracts/multisigs/interfaces/ICharityApplications.sol b/contracts/multisigs/interfaces/ICharityApplications.sol index 1c7aa2d91..0b17027d5 100644 --- a/contracts/multisigs/interfaces/ICharityApplications.sol +++ b/contracts/multisigs/interfaces/ICharityApplications.sol @@ -12,7 +12,8 @@ abstract contract ICharityApplications { uint256 proposalId, address proposer, string charityName, - uint256 expiry + uint256 expiry, + bytes metadata ); event ApplicationExecuted(uint256 proposalId); event ApplicationConfirmed(uint256 proposalId, address owner); @@ -51,7 +52,7 @@ abstract contract ICharityApplications { function proposeApplication( AccountMessages.CreateEndowmentRequest memory application, - string memory meta + bytes memory meta ) public virtual; function confirmProposal(uint256 proposalId) public virtual; diff --git a/contracts/multisigs/interfaces/IMultiSigGeneric.sol b/contracts/multisigs/interfaces/IMultiSigGeneric.sol index 9743cdb9f..6784c25f0 100644 --- a/contracts/multisigs/interfaces/IMultiSigGeneric.sol +++ b/contracts/multisigs/interfaces/IMultiSigGeneric.sol @@ -20,7 +20,12 @@ abstract contract IMultiSigGeneric is IERC165 { event ApprovalsRequiredChanged(address msAddress, uint256 approvalsRequired); event RequireExecutionChanged(address msAddress, bool requireExecution); event ExpiryChanged(address msAddress, uint256 transactionExpiry); - event TransactionSubmitted(address msAddress, address sender, uint256 transactionId); + event TransactionSubmitted( + address msAddress, + address sender, + uint256 transactionId, + bytes metadata + ); event TransactionConfirmed(address msAddress, address sender, uint256 transactionId); event TransactionConfirmationRevoked(address msAddress, address sender, uint256 transactionId); event TransactionExecuted(address msAddress, uint256 transactionId); diff --git a/contracts/normalized_endowment/endowment-multisig/EndowmentMultiSig.sol b/contracts/normalized_endowment/endowment-multisig/EndowmentMultiSig.sol index e57cf94ac..f1254e479 100644 --- a/contracts/normalized_endowment/endowment-multisig/EndowmentMultiSig.sol +++ b/contracts/normalized_endowment/endowment-multisig/EndowmentMultiSig.sol @@ -125,7 +125,8 @@ contract EndowmentMultiSig is MultiSigGeneric { IEndowmentMultiSigEmitter(EMITTER_ADDRESS).transactionSubmittedEndowment( ENDOWMENT_ID, msg.sender, - transactionId + transactionId, + metadata ); } diff --git a/contracts/normalized_endowment/endowment-multisig/EndowmentMultiSigEmitter.sol b/contracts/normalized_endowment/endowment-multisig/EndowmentMultiSigEmitter.sol index 7c89aefe1..4a443442f 100644 --- a/contracts/normalized_endowment/endowment-multisig/EndowmentMultiSigEmitter.sol +++ b/contracts/normalized_endowment/endowment-multisig/EndowmentMultiSigEmitter.sol @@ -21,7 +21,12 @@ contract EndowmentMultiSigEmitter is IEndowmentMultiSigEmitter, Initializable { bool requireExecution, uint256 transactionExpiry ); - event TransactionSubmitted(uint256 endowmentId, address owner, uint256 transactionId); + event TransactionSubmitted( + uint256 endowmentId, + address owner, + uint256 transactionId, + bytes metadata + ); event TransactionConfirmed(uint256 endowmentId, address owner, uint256 transactionId); event TransactionConfirmationRevoked(uint256 endowmentId, address owner, uint256 transactionId); event TransactionConfirmationOfFormerOwnerRevoked( @@ -93,9 +98,10 @@ contract EndowmentMultiSigEmitter is IEndowmentMultiSigEmitter, Initializable { function transactionSubmittedEndowment( uint256 endowmentId, address owner, - uint256 transactionId + uint256 transactionId, + bytes memory metadata ) public isEmitter { - emit TransactionSubmitted(endowmentId, owner, transactionId); + emit TransactionSubmitted(endowmentId, owner, transactionId, metadata); } /** diff --git a/contracts/normalized_endowment/endowment-multisig/interfaces/IEndowmentMultiSigEmitter.sol b/contracts/normalized_endowment/endowment-multisig/interfaces/IEndowmentMultiSigEmitter.sol index 769328da2..ea599c7fb 100644 --- a/contracts/normalized_endowment/endowment-multisig/interfaces/IEndowmentMultiSigEmitter.sol +++ b/contracts/normalized_endowment/endowment-multisig/interfaces/IEndowmentMultiSigEmitter.sol @@ -23,7 +23,8 @@ interface IEndowmentMultiSigEmitter { function transactionSubmittedEndowment( uint256 endowmentId, address owner, - uint256 transactionId + uint256 transactionId, + bytes memory metadata ) external; function transactionExecutedEndowment(uint256 endowmentId, uint256 transactionId) external;