pragma solidity ^0.4.18;
// File: contracts/land/LANDStorage.sol
contract LANDStorage {
mapping (address => uint) latestPing;
uint256 constant clearLow = 0xffffffffffffffffffffffffffffffff00000000000000000000000000000000;
uint256 constant clearHigh = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;
uint256 constant factor = 0x100000000000000000000000000000000;
mapping (address => bool) authorizedDeploy;
}
// File: contracts/upgradable/OwnableStorage.sol
contract OwnableStorage {
address public owner;
function OwnableStorage() internal {
owner = msg.sender;
}
}
// File: contracts/upgradable/ProxyStorage.sol
contract ProxyStorage {
/**
* Current contract to which we are proxing
*/
address public currentContract;
address public proxyOwner;
}
// File: erc821/contracts/AssetRegistryStorage.sol
contract AssetRegistryStorage {
string internal _name;
string internal _symbol;
string internal _description;
/**
* Stores the total count of assets managed by this registry
*/
uint256 internal _count;
/**
* Stores an array of assets owned by a given account
*/
mapping(address => uint256[]) internal _assetsOf;
/**
* Stores the current holder of an asset
*/
mapping(uint256 => address) internal _holderOf;
/**
* Stores the index of an asset in the `_assetsOf` array of its holder
*/
mapping(uint256 => uint256) internal _indexOfAsset;
/**
* Stores the data associated with an asset
*/
mapping(uint256 => string) internal _assetData;
/**
* For a given account, for a given opperator, store whether that operator is
* allowed to transfer and modify assets on behalf of them.
*/
mapping(address => mapping(address => bool)) internal _operators;
/**
* Simple reentrancy lock
*/
bool internal _reentrancy;
}
// File: contracts/Storage.sol
contract Storage is ProxyStorage, OwnableStorage, AssetRegistryStorage, LANDStorage {
}
// File: contracts/upgradable/DelegateProxy.sol
contract DelegateProxy {
/**
* @dev Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!)
* @param _dst Destination address to perform the delegatecall
* @param _calldata Calldata for the delegatecall
*/
function delegatedFwd(address _dst, bytes _calldata) internal {
require(isContract(_dst));
assembly {
let result := delegatecall(sub(gas, 10000), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
// revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.
// if the call returned error data, forward it
switch result case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
function isContract(address _target) constant internal returns (bool) {
uint256 size;
assembly { size := extcodesize(_target) }
return size > 0;
}
}
// File: contracts/upgradable/IApplication.sol
contract IApplication {
function initialize(bytes data) public;
}
// File: contracts/upgradable/Ownable.sol
contract Ownable is Storage {
event OwnerUpdate(address _prevOwner, address _newOwner);
function bytesToAddress (bytes b) pure public returns (address) {
uint result = 0;
for (uint i = b.length-1; i+1 > 0; i--) {
uint c = uint(b[i]);
uint to_inc = c * ( 16 ** ((b.length - i-1) * 2));
result += to_inc;
}
return address(result);
}
modifier onlyOwner {
assert(msg.sender == owner);
_;
}
function initialize(bytes data) public {
owner = bytesToAddress(data);
}
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != owner);
owner = _newOwner;
}
}
// File: contracts/upgradable/Proxy.sol
contract Proxy is Storage, DelegateProxy {
event Upgrade(address indexed newContract, bytes initializedWith);
event OwnerUpdate(address _prevOwner, address _newOwner);
function Proxy() public {
proxyOwner = msg.sender;
}
modifier onlyProxyOwner() {
require(msg.sender == proxyOwner);
_;
}
function transferOwnership(address _newOwner) public onlyProxyOwner {
require(_newOwner != proxyOwner);
OwnerUpdate(proxyOwner, _newOwner);
proxyOwner = _newOwner;
}
function upgrade(IApplication newContract, bytes data) public onlyProxyOwner {
currentContract = newContract;
IApplication(this).initialize(data);
Upgrade(newContract, data);
}
function () payable public {
require(currentContract != 0); // if app code hasn't been set yet, don't call
delegatedFwd(currentContract, msg.data);
}
}
// File: contracts/upgradable/LANDProxy.sol
contract LANDProxy is Storage, Proxy {
}
{
"compilationTarget": {
"LANDProxy.sol": "LANDProxy"
},
"libraries": {},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"constant":true,"inputs":[],"name":"proxyOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newContract","type":"address"},{"name":"data","type":"bytes"}],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"newContract","type":"address"},{"indexed":false,"name":"initializedWith","type":"bytes"}],"name":"Upgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_prevOwner","type":"address"},{"indexed":false,"name":"_newOwner","type":"address"}],"name":"OwnerUpdate","type":"event"}]