We need to use tx.origin to get the actual sender of the transaction (not an intermediary contract that talks to the other contract)

This commit is contained in:
bumi 2021-09-28 15:10:05 +02:00
parent 0756569dc7
commit 15a08fdaec
3 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ contract Contribution is Initializable {
event ContributionVetoed(uint32 id, address vetoedByAccount); event ContributionVetoed(uint32 id, address vetoedByAccount);
modifier onlyCore { 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(canPerform(msg.sender, ADD_CONTRIBUTION_ROLE, new uint32[](0)), 'nope');
require(balanceOf(msg.sender) > 0, "Must have Kredits"); require(balanceOf(msg.sender) > 0, "Must have Kredits");
uint32 contributionId = contributionsCount + 1; uint32 contributionId = contributionsCount + 1;

View File

@ -32,7 +32,7 @@ contract Contributor is Initializable {
event ContributorAdded(uint32 id, address account); event ContributorAdded(uint32 id, address account);
modifier onlyCore { modifier onlyCore {
require(addressIsCore(msg.sender), "Core only"); require(addressIsCore(tx.origin), "Core only");
_; _;
} }

View File

@ -38,7 +38,7 @@ contract Reimbursement is Initializable {
} }
modifier onlyCore { modifier onlyCore {
require(contributorContract.addressIsCore(msg.sender), "Core only"); require(contributorContract.addressIsCore(tx.origin), "Core only");
_; _;
} }