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

Fix permissions for functions to use proxyOwner #41

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
21 changes: 15 additions & 6 deletions contracts/land/LANDRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ contract LANDRegistry is Storage,
super.initialize(data);
}

function authorizeDeploy(address beneficiary) public onlyOwner {
modifier onlyProxyOwner() {
require(msg.sender == proxyOwner);
_;
}

//
// LAND Create and destroy
//

function authorizeDeploy(address beneficiary) public onlyProxyOwner {
authorizedDeploy[beneficiary] = true;
}
function forbidDeploy(address beneficiary) public onlyOwner {
function forbidDeploy(address beneficiary) public onlyProxyOwner {
authorizedDeploy[beneficiary] = false;
}

Expand All @@ -41,7 +50,7 @@ contract LANDRegistry is Storage,
}
}

function destroy(uint256 assetId) onlyOwner public {
function destroy(uint256 assetId) onlyProxyOwner public {
_destroy(assetId);
}

Expand All @@ -53,7 +62,7 @@ contract LANDRegistry is Storage,
latestPing[msg.sender] = now;
}

function setLatestToNow(address user) onlyOwner public {
function setLatestToNow(address user) onlyProxyOwner public {
latestPing[user] = now;
}

Expand Down Expand Up @@ -130,7 +139,7 @@ contract LANDRegistry is Storage,
}

//
// Transfer LAND
// LAND Transfer
//

function transferLand(int x, int y, address to) public {
Expand All @@ -145,7 +154,7 @@ contract LANDRegistry is Storage,
}

//
// Update LAND
// LAND Update
//

function updateLandData(int x, int y, string data) public onlyOperatorOrHolder(encodeTokenId(x, y)) {
Expand Down
12 changes: 12 additions & 0 deletions contracts/upgradable/Proxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ contract Proxy is Storage, DelegateProxy {
proxyOwner = msg.sender;
}

//
// Ownership
//

modifier onlyProxyOwner() {
require(msg.sender == proxyOwner);
_;
Expand All @@ -31,13 +35,21 @@ contract Proxy is Storage, DelegateProxy {
newProxyOwner = _newOwner;
}

//
// Upgrade
//

function upgrade(IApplication newContract, bytes data) public onlyProxyOwner {
currentContract = newContract;
IApplication(this).initialize(data);

Upgrade(newContract, data);
}

//
// Dispatch fallback
//

function () payable public {
require(currentContract != 0); // if app code hasn't been set yet, don't call
delegatedFwd(currentContract, msg.data);
Expand Down
Loading