From 15a08fdaec33fd7ed5d84d98412fd3e699bfc286 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 28 Sep 2021 15:10:05 +0200 Subject: [PATCH] We need to use tx.origin to get the actual sender of the transaction (not an intermediary contract that talks to the other contract) --- contracts/Contribution.sol | 4 ++-- contracts/Contributor.sol | 2 +- contracts/Reimbursement.sol | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/Contribution.sol b/contracts/Contribution.sol index c7a1f44..0ac60fc 100644 --- a/contracts/Contribution.sol +++ b/contracts/Contribution.sol @@ -49,7 +49,7 @@ contract Contribution is Initializable { event ContributionVetoed(uint32 id, address vetoedByAccount); modifier onlyCore { - require(contributorContract.addressIsCore(msg.sender), "Core only"); + require(contributorContract.addressIsCore(tx.origin), "Core only"); _; } @@ -150,7 +150,7 @@ contract Contribution is Initializable { ); } - function add(uint32 amount, uint32 contributorId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public{ + function add(uint32 amount, uint32 contributorId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public { //require(canPerform(msg.sender, ADD_CONTRIBUTION_ROLE, new uint32[](0)), 'nope'); require(balanceOf(msg.sender) > 0, "Must have Kredits"); uint32 contributionId = contributionsCount + 1; diff --git a/contracts/Contributor.sol b/contracts/Contributor.sol index edeb8e9..d90236b 100644 --- a/contracts/Contributor.sol +++ b/contracts/Contributor.sol @@ -32,7 +32,7 @@ contract Contributor is Initializable { event ContributorAdded(uint32 id, address account); modifier onlyCore { - require(addressIsCore(msg.sender), "Core only"); + require(addressIsCore(tx.origin), "Core only"); _; } diff --git a/contracts/Reimbursement.sol b/contracts/Reimbursement.sol index 0737e2f..5bfaa92 100644 --- a/contracts/Reimbursement.sol +++ b/contracts/Reimbursement.sol @@ -38,7 +38,7 @@ contract Reimbursement is Initializable { } modifier onlyCore { - require(contributorContract.addressIsCore(msg.sender), "Core only"); + require(contributorContract.addressIsCore(tx.origin), "Core only"); _; }