Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed usage of code as identifier. #1100

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions contracts/common/DomainRoles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ contract DomainRoles is DSRoles {
return bytes32(0) != roles & shifted;
}

function canCall(address caller, uint256 where, address code, bytes4 sig) public view returns (bool) {
function canCall(address caller, uint256 where, address codeAddress, bytes4 sig) public view returns (bool) {
bytes32 hasRoles = getUserRoles(caller, where);
bytes32 needsOneOf = getCapabilityRoles(code, sig);
bytes32 needsOneOf = getCapabilityRoles(codeAddress, sig);
return bytes32(0) != hasRoles & needsOneOf;
}

function canCallOnlyBecause(address caller, uint256 where, uint8 role, address code, bytes4 sig) public view returns (bool) {
function canCallOnlyBecause(address caller, uint256 where, uint8 role, address codeAddress, bytes4 sig) public view returns (bool) {
bytes32 hasRoles = getUserRoles(caller, where);
bytes32 needsOneOf = getCapabilityRoles(code, sig);
bytes32 needsOneOf = getCapabilityRoles(codeAddress, sig);
bytes32 shifted = bytes32(uint256(uint256(2) ** uint256(role)));
// See if the permission comes from a *specific* role
return bytes32(0) == (needsOneOf & hasRoles) ^ shifted;
Expand All @@ -69,8 +69,8 @@ contract DomainRoles is DSRoles {
return hasUserRole(who, 1, role);
}

function canCall(address caller, address code, bytes4 sig) public view override returns (bool) {
return canCall(caller, 1, code, sig);
function canCall(address caller, address codeAddress, bytes4 sig) public view override returns (bool) {
return canCall(caller, 1, codeAddress, sig);
}

}