Created
February 16, 2018 14:54
-
-
Save sherlock-shi-x/df3058c1a3a90fea3c3ed6c173ea27e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
library SafeMath { | |
/** | |
* @dev Multiplies two numbers, throws on overflow. | |
*/ | |
function mul(uint256 a, uint256 b) internal pure returns (uint256) { | |
if (a == 0) { | |
return 0; | |
} | |
uint256 c = a * b; | |
assert(c / a == b); | |
return c; | |
} | |
/** | |
* @dev Integer division of two numbers, truncating the quotient. | |
*/ | |
function div(uint256 a, uint256 b) internal pure returns (uint256) { | |
// assert(b > 0); // Solidity automatically throws when dividing by 0 | |
uint256 c = a / b; | |
// assert(a == b * c + a % b); // There is no case in which this doesn't hold | |
return c; | |
} | |
/** | |
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). | |
*/ | |
function sub(uint256 a, uint256 b) internal pure returns (uint256) { | |
assert(b <= a); | |
return a - b; | |
} | |
/** | |
* @dev Adds two numbers, throws on overflow. | |
*/ | |
function add(uint256 a, uint256 b) internal pure returns (uint256) { | |
uint256 c = a + b; | |
assert(c >= a); | |
return c; | |
} | |
} | |
contract CryptoWaterMargin { | |
using SafeMath for uint256; | |
event Bought (uint256 indexed _itemId, address indexed _owner, uint256 _price); | |
event Sold (uint256 indexed _itemId, address indexed _owner, uint256 _price); | |
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId); | |
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId); | |
address private owner; | |
mapping (address => bool) private admins; | |
IItemRegistry private itemRegistry; | |
bool private erc721Enabled = false; | |
uint256 private increaseLimit1 = 0.02 ether; | |
uint256 private increaseLimit2 = 0.5 ether; | |
uint256 private increaseLimit3 = 2.0 ether; | |
uint256 private increaseLimit4 = 5.0 ether; | |
uint256[] private listedItems; | |
mapping (uint256 => address) private ownerOfItem; | |
mapping (uint256 => uint256) private startingPriceOfItem; | |
mapping (uint256 => uint256) private priceOfItem; | |
mapping (uint256 => address) private approvedOfItem; | |
function CryptoWaterMargin () public { | |
owner = msg.sender; | |
admins[owner] = true; | |
printInitialCard(); | |
} | |
/* Modifiers */ | |
modifier onlyOwner() { | |
require(owner == msg.sender); | |
_; | |
} | |
modifier onlyAdmins() { | |
require(admins[msg.sender]); | |
_; | |
} | |
modifier onlyERC721() { | |
require(erc721Enabled); | |
_; | |
} | |
/* Owner */ | |
function setOwner (address _owner) onlyOwner() public { | |
owner = _owner; | |
} | |
function setItemRegistry (address _itemRegistry) onlyOwner() public { | |
itemRegistry = IItemRegistry(_itemRegistry); | |
} | |
function addAdmin (address _admin) onlyOwner() public { | |
admins[_admin] = true; | |
} | |
function removeAdmin (address _admin) onlyOwner() public { | |
delete admins[_admin]; | |
} | |
// Unlocks ERC721 behaviour, allowing for trading on third party platforms. | |
function enableERC721 () onlyOwner() public { | |
erc721Enabled = true; | |
} | |
/* Withdraw */ | |
/* | |
NOTICE: These functions withdraw the developer's cut which is left | |
in the contract by `buy`. User funds are immediately sent to the old | |
owner in `buy`, no user funds are left in the contract. | |
*/ | |
function withdrawAll () onlyAdmins() public { | |
owner.transfer(this.balance); | |
} | |
function withdrawAmount (uint256 _amount) onlyAdmins() public { | |
owner.transfer(_amount); | |
} | |
/* Listing */ | |
function populateFromItemRegistry (uint256[] _itemIds) onlyOwner() public { | |
for (uint256 i = 0; i < _itemIds.length; i++) { | |
if (priceOfItem[_itemIds[i]] > 0 || itemRegistry.priceOf(_itemIds[i]) == 0) { | |
continue; | |
} | |
listItemFromRegistry(_itemIds[i]); | |
} | |
} | |
function listItemFromRegistry (uint256 _itemId) onlyOwner() public { | |
require(itemRegistry != address(0)); | |
require(itemRegistry.ownerOf(_itemId) != address(0)); | |
require(itemRegistry.priceOf(_itemId) > 0); | |
uint256 price = itemRegistry.priceOf(_itemId); | |
address itemOwner = itemRegistry.ownerOf(_itemId); | |
listItem(_itemId, price, itemOwner); | |
} | |
function listMultipleItems (uint256[] _itemIds, uint256 _price, address _owner) onlyAdmins() external { | |
for (uint256 i = 0; i < _itemIds.length; i++) { | |
listItem(_itemIds[i], _price, _owner); | |
} | |
} | |
function listItem (uint256 _itemId, uint256 _price, address _owner) onlyAdmins() public { | |
require(_price > 0); | |
require(priceOfItem[_itemId] == 0); | |
require(ownerOfItem[_itemId] == address(0)); | |
ownerOfItem[_itemId] = _owner; | |
priceOfItem[_itemId] = _price; | |
startingPriceOfItem[_itemId] = _price; | |
listedItems.push(_itemId); | |
} | |
/* Buying */ | |
function calculateNextPrice (uint256 _price) public view returns (uint256 _nextPrice) { | |
if (_price < increaseLimit1) { | |
return _price.mul(200).div(95); | |
} else if (_price < increaseLimit2) { | |
return _price.mul(135).div(96); | |
} else if (_price < increaseLimit3) { | |
return _price.mul(125).div(97); | |
} else if (_price < increaseLimit4) { | |
return _price.mul(117).div(97); | |
} else { | |
return _price.mul(115).div(98); | |
} | |
} | |
function calculateDevCut (uint256 _price) public view returns (uint256 _devCut) { | |
if (_price < increaseLimit1) { | |
return _price.mul(5).div(100); // 5% | |
} else if (_price < increaseLimit2) { | |
return _price.mul(4).div(100); // 4% | |
} else if (_price < increaseLimit3) { | |
return _price.mul(3).div(100); // 3% | |
} else if (_price < increaseLimit4) { | |
return _price.mul(3).div(100); // 3% | |
} else { | |
return _price.mul(2).div(100); // 2% | |
} | |
} | |
/* | |
Buy a country directly from the contract for the calculated price | |
which ensures that the owner gets a profit. All countries that | |
have been listed can be bought by this method. User funds are sent | |
directly to the previous owner and are never stored in the contract. | |
*/ | |
function buy (uint256 _itemId) payable public { | |
require(priceOf(_itemId) > 0); | |
require(ownerOf(_itemId) != address(0)); | |
require(msg.value >= priceOf(_itemId)); | |
require(ownerOf(_itemId) != msg.sender); | |
require(!isContract(msg.sender)); | |
require(msg.sender != address(0)); | |
address oldOwner = ownerOf(_itemId); | |
address newOwner = msg.sender; | |
uint256 price = priceOf(_itemId); | |
uint256 excess = msg.value.sub(price); | |
_transfer(oldOwner, newOwner, _itemId); | |
priceOfItem[_itemId] = nextPriceOf(_itemId); | |
Bought(_itemId, newOwner, price); | |
Sold(_itemId, oldOwner, price); | |
// Devevloper's cut which is left in contract and accesed by | |
// `withdrawAll` and `withdrawAmountTo` methods. | |
uint256 devCut = calculateDevCut(price); | |
// Transfer payment to old owner minus the developer's cut. | |
oldOwner.transfer(price.sub(devCut)); | |
if (excess > 0) { | |
newOwner.transfer(excess); | |
} | |
} | |
/* ERC721 */ | |
function implementsERC721() public view returns (bool _implements) { | |
return erc721Enabled; | |
} | |
function name() public pure returns (string _name) { | |
return "CryptoCountries.io Countries"; | |
} | |
function symbol() public pure returns (string _symbol) { | |
return "CCC"; | |
} | |
function totalSupply() public view returns (uint256 _totalSupply) { | |
return listedItems.length; | |
} | |
function balanceOf (address _owner) public view returns (uint256 _balance) { | |
uint256 counter = 0; | |
for (uint256 i = 0; i < listedItems.length; i++) { | |
if (ownerOf(listedItems[i]) == _owner) { | |
counter++; | |
} | |
} | |
return counter; | |
} | |
function ownerOf (uint256 _itemId) public view returns (address _owner) { | |
return ownerOfItem[_itemId]; | |
} | |
function tokensOf (address _owner) public view returns (uint256[] _tokenIds) { | |
uint256[] memory items = new uint256[](balanceOf(_owner)); | |
uint256 itemCounter = 0; | |
for (uint256 i = 0; i < listedItems.length; i++) { | |
if (ownerOf(listedItems[i]) == _owner) { | |
items[itemCounter] = listedItems[i]; | |
itemCounter += 1; | |
} | |
} | |
return items; | |
} | |
function tokenExists (uint256 _itemId) public view returns (bool _exists) { | |
return priceOf(_itemId) > 0; | |
} | |
function approvedFor(uint256 _itemId) public view returns (address _approved) { | |
return approvedOfItem[_itemId]; | |
} | |
function approve(address _to, uint256 _itemId) onlyERC721() public { | |
require(msg.sender != _to); | |
require(tokenExists(_itemId)); | |
require(ownerOf(_itemId) == msg.sender); | |
if (_to == 0) { | |
if (approvedOfItem[_itemId] != 0) { | |
delete approvedOfItem[_itemId]; | |
Approval(msg.sender, 0, _itemId); | |
} | |
} else { | |
approvedOfItem[_itemId] = _to; | |
Approval(msg.sender, _to, _itemId); | |
} | |
} | |
/* Transferring a country to another owner will entitle the new owner the profits from `buy` */ | |
function transfer(address _to, uint256 _itemId) onlyERC721() public { | |
require(msg.sender == ownerOf(_itemId)); | |
_transfer(msg.sender, _to, _itemId); | |
} | |
function transferFrom(address _from, address _to, uint256 _itemId) onlyERC721() public { | |
require(approvedFor(_itemId) == msg.sender); | |
_transfer(_from, _to, _itemId); | |
} | |
function _transfer(address _from, address _to, uint256 _itemId) internal { | |
require(tokenExists(_itemId)); | |
require(ownerOf(_itemId) == _from); | |
require(_to != address(0)); | |
require(_to != address(this)); | |
ownerOfItem[_itemId] = _to; | |
approvedOfItem[_itemId] = 0; | |
Transfer(_from, _to, _itemId); | |
} | |
/* Read */ | |
function isAdmin (address _admin) public view returns (bool _isAdmin) { | |
return admins[_admin]; | |
} | |
function startingPriceOf (uint256 _itemId) public view returns (uint256 _startingPrice) { | |
return startingPriceOfItem[_itemId]; | |
} | |
function priceOf (uint256 _itemId) public view returns (uint256 _price) { | |
return priceOfItem[_itemId]; | |
} | |
function nextPriceOf (uint256 _itemId) public view returns (uint256 _nextPrice) { | |
return calculateNextPrice(priceOf(_itemId)); | |
} | |
function allOf (uint256 _itemId) external view returns (address _owner, uint256 _startingPrice, uint256 _price, uint256 _nextPrice) { | |
return (ownerOf(_itemId), startingPriceOf(_itemId), priceOf(_itemId), nextPriceOf(_itemId)); | |
} | |
function itemsForSaleLimit (uint256 _from, uint256 _take) public view returns (uint256[] _items) { | |
uint256[] memory items = new uint256[](_take); | |
for (uint256 i = 0; i < _take; i++) { | |
items[i] = listedItems[_from + i]; | |
} | |
return items; | |
} | |
/* Util */ | |
function isContract(address addr) internal view returns (bool) { | |
uint size; | |
assembly { size := extcodesize(addr) } // solium-disable-line | |
return size > 0; | |
} | |
function changePrice(uint256 _itemId, uint256 _price) public onlyAdmins() { | |
require(_price > 0); | |
require(ownerOfItem[_itemId] == owner); | |
priceOfItem[_itemId] = _price; | |
} | |
function printInitialCard() internal { | |
ownerOfItem[1] = owner; | |
priceOfItem[1] = 1 ether; | |
startingPriceOfItem[1] = 1 ether; | |
listedItems.push(1); | |
ownerOfItem[2] = owner; | |
priceOfItem[2] = 1 ether; | |
startingPriceOfItem[2] = 1 ether; | |
listedItems.push(2); | |
ownerOfItem[3] = owner; | |
priceOfItem[3] = 1 ether; | |
startingPriceOfItem[3] = 1 ether; | |
listedItems.push(3); | |
ownerOfItem[4] = owner; | |
priceOfItem[4] = 1 ether; | |
startingPriceOfItem[4] = 1 ether; | |
listedItems.push(4); | |
ownerOfItem[5] = owner; | |
priceOfItem[5] = 1 ether; | |
startingPriceOfItem[5] = 1 ether; | |
listedItems.push(5); | |
ownerOfItem[6] = owner; | |
priceOfItem[6] = 1 ether; | |
startingPriceOfItem[6] = 1 ether; | |
listedItems.push(6); | |
ownerOfItem[7] = owner; | |
priceOfItem[7] = 1 ether; | |
startingPriceOfItem[7] = 1 ether; | |
listedItems.push(7); | |
ownerOfItem[8] = owner; | |
priceOfItem[8] = 1 ether; | |
startingPriceOfItem[8] = 1 ether; | |
listedItems.push(8); | |
ownerOfItem[9] = owner; | |
priceOfItem[9] = 1 ether; | |
startingPriceOfItem[9] = 1 ether; | |
listedItems.push(9); | |
ownerOfItem[10] = owner; | |
priceOfItem[10] = 1 ether; | |
startingPriceOfItem[10] = 1 ether; | |
listedItems.push(10); | |
ownerOfItem[11] = owner; | |
priceOfItem[11] = 1 ether; | |
startingPriceOfItem[11] = 1 ether; | |
listedItems.push(11); | |
ownerOfItem[12] = owner; | |
priceOfItem[12] = 1 ether; | |
startingPriceOfItem[12] = 1 ether; | |
listedItems.push(12); | |
ownerOfItem[13] = owner; | |
priceOfItem[13] = 1 ether; | |
startingPriceOfItem[13] = 1 ether; | |
listedItems.push(13); | |
ownerOfItem[14] = owner; | |
priceOfItem[14] = 1 ether; | |
startingPriceOfItem[14] = 1 ether; | |
listedItems.push(14); | |
ownerOfItem[15] = owner; | |
priceOfItem[15] = 1 ether; | |
startingPriceOfItem[15] = 1 ether; | |
listedItems.push(15); | |
ownerOfItem[16] = owner; | |
priceOfItem[16] = 1 ether; | |
startingPriceOfItem[16] = 1 ether; | |
listedItems.push(16); | |
ownerOfItem[17] = owner; | |
priceOfItem[17] = 1 ether; | |
startingPriceOfItem[17] = 1 ether; | |
listedItems.push(17); | |
ownerOfItem[18] = owner; | |
priceOfItem[18] = 1 ether; | |
startingPriceOfItem[18] = 1 ether; | |
listedItems.push(18); | |
ownerOfItem[19] = owner; | |
priceOfItem[19] = 1 ether; | |
startingPriceOfItem[19] = 1 ether; | |
listedItems.push(19); | |
ownerOfItem[20] = owner; | |
priceOfItem[20] = 1 ether; | |
startingPriceOfItem[20] = 1 ether; | |
listedItems.push(20); | |
ownerOfItem[21] = owner; | |
priceOfItem[21] = 1 ether; | |
startingPriceOfItem[21] = 1 ether; | |
listedItems.push(21); | |
ownerOfItem[22] = owner; | |
priceOfItem[22] = 1 ether; | |
startingPriceOfItem[22] = 1 ether; | |
listedItems.push(22); | |
ownerOfItem[23] = owner; | |
priceOfItem[23] = 1 ether; | |
startingPriceOfItem[23] = 1 ether; | |
listedItems.push(23); | |
ownerOfItem[24] = owner; | |
priceOfItem[24] = 1 ether; | |
startingPriceOfItem[24] = 1 ether; | |
listedItems.push(24); | |
ownerOfItem[25] = owner; | |
priceOfItem[25] = 1 ether; | |
startingPriceOfItem[25] = 1 ether; | |
listedItems.push(25); | |
ownerOfItem[26] = owner; | |
priceOfItem[26] = 1 ether; | |
startingPriceOfItem[26] = 1 ether; | |
listedItems.push(26); | |
ownerOfItem[27] = owner; | |
priceOfItem[27] = 1 ether; | |
startingPriceOfItem[27] = 1 ether; | |
listedItems.push(27); | |
ownerOfItem[28] = owner; | |
priceOfItem[28] = 1 ether; | |
startingPriceOfItem[28] = 1 ether; | |
listedItems.push(28); | |
ownerOfItem[29] = owner; | |
priceOfItem[29] = 1 ether; | |
startingPriceOfItem[29] = 1 ether; | |
listedItems.push(29); | |
ownerOfItem[30] = owner; | |
priceOfItem[30] = 1 ether; | |
startingPriceOfItem[30] = 1 ether; | |
listedItems.push(30); | |
ownerOfItem[31] = owner; | |
priceOfItem[31] = 1 ether; | |
startingPriceOfItem[31] = 1 ether; | |
listedItems.push(31); | |
ownerOfItem[32] = owner; | |
priceOfItem[32] = 1 ether; | |
startingPriceOfItem[32] = 1 ether; | |
listedItems.push(32); | |
ownerOfItem[33] = owner; | |
priceOfItem[33] = 1 ether; | |
startingPriceOfItem[33] = 1 ether; | |
listedItems.push(33); | |
ownerOfItem[34] = owner; | |
priceOfItem[34] = 1 ether; | |
startingPriceOfItem[34] = 1 ether; | |
listedItems.push(34); | |
ownerOfItem[35] = owner; | |
priceOfItem[35] = 1 ether; | |
startingPriceOfItem[35] = 1 ether; | |
listedItems.push(35); | |
ownerOfItem[36] = owner; | |
priceOfItem[36] = 1 ether; | |
startingPriceOfItem[36] = 1 ether; | |
listedItems.push(36); | |
ownerOfItem[37] = owner; | |
priceOfItem[37] = 1 ether; | |
startingPriceOfItem[37] = 1 ether; | |
listedItems.push(37); | |
ownerOfItem[38] = owner; | |
priceOfItem[38] = 1 ether; | |
startingPriceOfItem[38] = 1 ether; | |
listedItems.push(38); | |
ownerOfItem[39] = owner; | |
priceOfItem[39] = 1 ether; | |
startingPriceOfItem[39] = 1 ether; | |
listedItems.push(39); | |
ownerOfItem[40] = owner; | |
priceOfItem[40] = 1 ether; | |
startingPriceOfItem[40] = 1 ether; | |
listedItems.push(40); | |
ownerOfItem[41] = owner; | |
priceOfItem[41] = 1 ether; | |
startingPriceOfItem[41] = 1 ether; | |
listedItems.push(41); | |
ownerOfItem[42] = owner; | |
priceOfItem[42] = 1 ether; | |
startingPriceOfItem[42] = 1 ether; | |
listedItems.push(42); | |
ownerOfItem[43] = owner; | |
priceOfItem[43] = 1 ether; | |
startingPriceOfItem[43] = 1 ether; | |
listedItems.push(43); | |
ownerOfItem[44] = owner; | |
priceOfItem[44] = 1 ether; | |
startingPriceOfItem[44] = 1 ether; | |
listedItems.push(44); | |
ownerOfItem[45] = owner; | |
priceOfItem[45] = 1 ether; | |
startingPriceOfItem[45] = 1 ether; | |
listedItems.push(45); | |
ownerOfItem[46] = owner; | |
priceOfItem[46] = 1 ether; | |
startingPriceOfItem[46] = 1 ether; | |
listedItems.push(46); | |
ownerOfItem[47] = owner; | |
priceOfItem[47] = 1 ether; | |
startingPriceOfItem[47] = 1 ether; | |
listedItems.push(47); | |
ownerOfItem[48] = owner; | |
priceOfItem[48] = 1 ether; | |
startingPriceOfItem[48] = 1 ether; | |
listedItems.push(48); | |
ownerOfItem[49] = owner; | |
priceOfItem[49] = 1 ether; | |
startingPriceOfItem[49] = 1 ether; | |
listedItems.push(49); | |
ownerOfItem[50] = owner; | |
priceOfItem[50] = 1 ether; | |
startingPriceOfItem[50] = 1 ether; | |
listedItems.push(50); | |
ownerOfItem[51] = owner; | |
priceOfItem[51] = 1 ether; | |
startingPriceOfItem[51] = 1 ether; | |
listedItems.push(51); | |
ownerOfItem[52] = owner; | |
priceOfItem[52] = 1 ether; | |
startingPriceOfItem[52] = 1 ether; | |
listedItems.push(52); | |
ownerOfItem[53] = owner; | |
priceOfItem[53] = 1 ether; | |
startingPriceOfItem[53] = 1 ether; | |
listedItems.push(53); | |
ownerOfItem[54] = owner; | |
priceOfItem[54] = 1 ether; | |
startingPriceOfItem[54] = 1 ether; | |
listedItems.push(54); | |
ownerOfItem[55] = owner; | |
priceOfItem[55] = 1 ether; | |
startingPriceOfItem[55] = 1 ether; | |
listedItems.push(55); | |
ownerOfItem[56] = owner; | |
priceOfItem[56] = 1 ether; | |
startingPriceOfItem[56] = 1 ether; | |
listedItems.push(56); | |
ownerOfItem[57] = owner; | |
priceOfItem[57] = 1 ether; | |
startingPriceOfItem[57] = 1 ether; | |
listedItems.push(57); | |
ownerOfItem[58] = owner; | |
priceOfItem[58] = 1 ether; | |
startingPriceOfItem[58] = 1 ether; | |
listedItems.push(58); | |
ownerOfItem[59] = owner; | |
priceOfItem[59] = 1 ether; | |
startingPriceOfItem[59] = 1 ether; | |
listedItems.push(59); | |
ownerOfItem[60] = owner; | |
priceOfItem[60] = 1 ether; | |
startingPriceOfItem[60] = 1 ether; | |
listedItems.push(60); | |
ownerOfItem[61] = owner; | |
priceOfItem[61] = 1 ether; | |
startingPriceOfItem[61] = 1 ether; | |
listedItems.push(61); | |
ownerOfItem[62] = owner; | |
priceOfItem[62] = 1 ether; | |
startingPriceOfItem[62] = 1 ether; | |
listedItems.push(62); | |
ownerOfItem[63] = owner; | |
priceOfItem[63] = 1 ether; | |
startingPriceOfItem[63] = 1 ether; | |
listedItems.push(63); | |
ownerOfItem[64] = owner; | |
priceOfItem[64] = 1 ether; | |
startingPriceOfItem[64] = 1 ether; | |
listedItems.push(64); | |
ownerOfItem[65] = owner; | |
priceOfItem[65] = 1 ether; | |
startingPriceOfItem[65] = 1 ether; | |
listedItems.push(65); | |
ownerOfItem[66] = owner; | |
priceOfItem[66] = 1 ether; | |
startingPriceOfItem[66] = 1 ether; | |
listedItems.push(66); | |
ownerOfItem[67] = owner; | |
priceOfItem[67] = 1 ether; | |
startingPriceOfItem[67] = 1 ether; | |
listedItems.push(67); | |
ownerOfItem[68] = owner; | |
priceOfItem[68] = 1 ether; | |
startingPriceOfItem[68] = 1 ether; | |
listedItems.push(68); | |
ownerOfItem[69] = owner; | |
priceOfItem[69] = 1 ether; | |
startingPriceOfItem[69] = 1 ether; | |
listedItems.push(69); | |
ownerOfItem[70] = owner; | |
priceOfItem[70] = 1 ether; | |
startingPriceOfItem[70] = 1 ether; | |
listedItems.push(70); | |
ownerOfItem[71] = owner; | |
priceOfItem[71] = 1 ether; | |
startingPriceOfItem[71] = 1 ether; | |
listedItems.push(71); | |
ownerOfItem[72] = owner; | |
priceOfItem[72] = 1 ether; | |
startingPriceOfItem[72] = 1 ether; | |
listedItems.push(72); | |
ownerOfItem[73] = owner; | |
priceOfItem[73] = 1 ether; | |
startingPriceOfItem[73] = 1 ether; | |
listedItems.push(73); | |
ownerOfItem[74] = owner; | |
priceOfItem[74] = 1 ether; | |
startingPriceOfItem[74] = 1 ether; | |
listedItems.push(74); | |
ownerOfItem[75] = owner; | |
priceOfItem[75] = 1 ether; | |
startingPriceOfItem[75] = 1 ether; | |
listedItems.push(75); | |
ownerOfItem[76] = owner; | |
priceOfItem[76] = 1 ether; | |
startingPriceOfItem[76] = 1 ether; | |
listedItems.push(76); | |
ownerOfItem[77] = owner; | |
priceOfItem[77] = 1 ether; | |
startingPriceOfItem[77] = 1 ether; | |
listedItems.push(77); | |
ownerOfItem[78] = owner; | |
priceOfItem[78] = 1 ether; | |
startingPriceOfItem[78] = 1 ether; | |
listedItems.push(78); | |
ownerOfItem[79] = owner; | |
priceOfItem[79] = 1 ether; | |
startingPriceOfItem[79] = 1 ether; | |
listedItems.push(79); | |
ownerOfItem[80] = owner; | |
priceOfItem[80] = 1 ether; | |
startingPriceOfItem[80] = 1 ether; | |
listedItems.push(80); | |
ownerOfItem[81] = owner; | |
priceOfItem[81] = 1 ether; | |
startingPriceOfItem[81] = 1 ether; | |
listedItems.push(81); | |
ownerOfItem[82] = owner; | |
priceOfItem[82] = 1 ether; | |
startingPriceOfItem[82] = 1 ether; | |
listedItems.push(82); | |
ownerOfItem[83] = owner; | |
priceOfItem[83] = 1 ether; | |
startingPriceOfItem[83] = 1 ether; | |
listedItems.push(83); | |
ownerOfItem[84] = owner; | |
priceOfItem[84] = 1 ether; | |
startingPriceOfItem[84] = 1 ether; | |
listedItems.push(84); | |
ownerOfItem[85] = owner; | |
priceOfItem[85] = 1 ether; | |
startingPriceOfItem[85] = 1 ether; | |
listedItems.push(85); | |
ownerOfItem[86] = owner; | |
priceOfItem[86] = 1 ether; | |
startingPriceOfItem[86] = 1 ether; | |
listedItems.push(86); | |
ownerOfItem[87] = owner; | |
priceOfItem[87] = 1 ether; | |
startingPriceOfItem[87] = 1 ether; | |
listedItems.push(87); | |
ownerOfItem[88] = owner; | |
priceOfItem[88] = 1 ether; | |
startingPriceOfItem[88] = 1 ether; | |
listedItems.push(88); | |
ownerOfItem[89] = owner; | |
priceOfItem[89] = 1 ether; | |
startingPriceOfItem[89] = 1 ether; | |
listedItems.push(89); | |
ownerOfItem[90] = owner; | |
priceOfItem[90] = 1 ether; | |
startingPriceOfItem[90] = 1 ether; | |
listedItems.push(90); | |
ownerOfItem[91] = owner; | |
priceOfItem[91] = 1 ether; | |
startingPriceOfItem[91] = 1 ether; | |
listedItems.push(91); | |
ownerOfItem[92] = owner; | |
priceOfItem[92] = 1 ether; | |
startingPriceOfItem[92] = 1 ether; | |
listedItems.push(92); | |
ownerOfItem[93] = owner; | |
priceOfItem[93] = 1 ether; | |
startingPriceOfItem[93] = 1 ether; | |
listedItems.push(93); | |
ownerOfItem[94] = owner; | |
priceOfItem[94] = 1 ether; | |
startingPriceOfItem[94] = 1 ether; | |
listedItems.push(94); | |
ownerOfItem[95] = owner; | |
priceOfItem[95] = 1 ether; | |
startingPriceOfItem[95] = 1 ether; | |
listedItems.push(95); | |
ownerOfItem[96] = owner; | |
priceOfItem[96] = 1 ether; | |
startingPriceOfItem[96] = 1 ether; | |
listedItems.push(96); | |
ownerOfItem[97] = owner; | |
priceOfItem[97] = 1 ether; | |
startingPriceOfItem[97] = 1 ether; | |
listedItems.push(97); | |
ownerOfItem[98] = owner; | |
priceOfItem[98] = 1 ether; | |
startingPriceOfItem[98] = 1 ether; | |
listedItems.push(98); | |
ownerOfItem[99] = owner; | |
priceOfItem[99] = 1 ether; | |
startingPriceOfItem[99] = 1 ether; | |
listedItems.push(99); | |
ownerOfItem[100] = owner; | |
priceOfItem[100] = 1 ether; | |
startingPriceOfItem[100] = 1 ether; | |
listedItems.push(100); | |
ownerOfItem[101] = owner; | |
priceOfItem[101] = 1 ether; | |
startingPriceOfItem[101] = 1 ether; | |
listedItems.push(101); | |
ownerOfItem[102] = owner; | |
priceOfItem[102] = 1 ether; | |
startingPriceOfItem[102] = 1 ether; | |
listedItems.push(102); | |
ownerOfItem[103] = owner; | |
priceOfItem[103] = 1 ether; | |
startingPriceOfItem[103] = 1 ether; | |
listedItems.push(103); | |
ownerOfItem[104] = owner; | |
priceOfItem[104] = 1 ether; | |
startingPriceOfItem[104] = 1 ether; | |
listedItems.push(104); | |
ownerOfItem[105] = owner; | |
priceOfItem[105] = 1 ether; | |
startingPriceOfItem[105] = 1 ether; | |
listedItems.push(105); | |
ownerOfItem[106] = owner; | |
priceOfItem[106] = 1 ether; | |
startingPriceOfItem[106] = 1 ether; | |
listedItems.push(106); | |
ownerOfItem[107] = owner; | |
priceOfItem[107] = 1 ether; | |
startingPriceOfItem[107] = 1 ether; | |
listedItems.push(107); | |
ownerOfItem[108] = owner; | |
priceOfItem[108] = 1 ether; | |
startingPriceOfItem[108] = 1 ether; | |
listedItems.push(108); | |
ownerOfItem[109] = owner; | |
priceOfItem[109] = 1 ether; | |
startingPriceOfItem[109] = 1 ether; | |
listedItems.push(109); | |
ownerOfItem[110] = owner; | |
priceOfItem[110] = 1 ether; | |
startingPriceOfItem[110] = 1 ether; | |
listedItems.push(110); | |
ownerOfItem[111] = owner; | |
priceOfItem[111] = 1 ether; | |
startingPriceOfItem[111] = 1 ether; | |
listedItems.push(111); | |
ownerOfItem[112] = owner; | |
priceOfItem[112] = 1 ether; | |
startingPriceOfItem[112] = 1 ether; | |
listedItems.push(112); | |
ownerOfItem[113] = owner; | |
priceOfItem[113] = 1 ether; | |
startingPriceOfItem[113] = 1 ether; | |
listedItems.push(113); | |
ownerOfItem[114] = owner; | |
priceOfItem[114] = 1 ether; | |
startingPriceOfItem[114] = 1 ether; | |
listedItems.push(114); | |
} | |
} | |
interface IItemRegistry { | |
function itemsForSaleLimit (uint256 _from, uint256 _take) public view returns (uint256[] _items); | |
function ownerOf (uint256 _itemId) public view returns (address _owner); | |
function priceOf (uint256 _itemId) public view returns (uint256 _price); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment