From bd2ce4f3e6c650e043d9a13f29d66959877d69fc Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 10 Dec 2020 12:56:13 +0800 Subject: [PATCH 01/64] add build and flatten by waffle --- .gitignore | 4 +- contracts-flattener/ApostleBase.sol | 1235 ++++++++++ contracts-flattener/ApostleBaseAuthority.sol | 23 + .../ApostleBaseAuthorityV2.sol | 25 + contracts-flattener/ApostleBaseV2.sol | 1251 ++++++++++ contracts-flattener/ApostleBaseV3.sol | 1352 +++++++++++ contracts-flattener/ApostleClockAuction.sol | 1164 ++++++++++ contracts-flattener/ApostleSettingIds.sol | 97 + contracts-flattener/ClockAuctionAuthority.sol | 21 + contracts-flattener/ERC721BridgeAuthority.sol | 20 + contracts-flattener/Gen0Apostle.sol | 650 ++++++ contracts-flattener/Gen0ApostleV2.sol | 656 ++++++ contracts-flattener/HarbergerPotionShop.sol | 737 ++++++ contracts-flattener/IApostleAuction.sol | 15 + contracts-flattener/IApostleBase.sol | 30 + contracts-flattener/IERC721Bridge.sol | 15 + contracts-flattener/IGeneScience.sol | 26 + contracts-flattener/IHabergPotionShop.sol | 10 + contracts-flattener/IItemBar.sol | 10 + contracts-flattener/ILandBase.sol | 8 + contracts-flattener/ILandResource.sol | 12 + contracts-flattener/Migrations.sol | 2060 +++++++++++++++++ contracts-flattener/PetBase.sol | 842 +++++++ contracts-flattener/PetBaseAuthority.sol | 19 + contracts-flattener/SiringAuctionBase.sol | 737 ++++++ contracts-flattener/SiringClockAuction.sol | 999 ++++++++ contracts-flattener/SiringClockAuctionV2.sol | 1003 ++++++++ contracts/ApostleBaseV3.sol | 29 + contracts/interfaces/IItemBar.sol | 8 + package.json | 6 +- 30 files changed, 13062 insertions(+), 2 deletions(-) create mode 100644 contracts-flattener/ApostleBase.sol create mode 100644 contracts-flattener/ApostleBaseAuthority.sol create mode 100644 contracts-flattener/ApostleBaseAuthorityV2.sol create mode 100644 contracts-flattener/ApostleBaseV2.sol create mode 100644 contracts-flattener/ApostleBaseV3.sol create mode 100644 contracts-flattener/ApostleClockAuction.sol create mode 100644 contracts-flattener/ApostleSettingIds.sol create mode 100644 contracts-flattener/ClockAuctionAuthority.sol create mode 100644 contracts-flattener/ERC721BridgeAuthority.sol create mode 100644 contracts-flattener/Gen0Apostle.sol create mode 100644 contracts-flattener/Gen0ApostleV2.sol create mode 100644 contracts-flattener/HarbergerPotionShop.sol create mode 100644 contracts-flattener/IApostleAuction.sol create mode 100644 contracts-flattener/IApostleBase.sol create mode 100644 contracts-flattener/IERC721Bridge.sol create mode 100644 contracts-flattener/IGeneScience.sol create mode 100644 contracts-flattener/IHabergPotionShop.sol create mode 100644 contracts-flattener/IItemBar.sol create mode 100644 contracts-flattener/ILandBase.sol create mode 100644 contracts-flattener/ILandResource.sol create mode 100644 contracts-flattener/Migrations.sol create mode 100644 contracts-flattener/PetBase.sol create mode 100644 contracts-flattener/PetBaseAuthority.sol create mode 100644 contracts-flattener/SiringAuctionBase.sol create mode 100644 contracts-flattener/SiringClockAuction.sol create mode 100644 contracts-flattener/SiringClockAuctionV2.sol create mode 100644 contracts/ApostleBaseV3.sol create mode 100644 contracts/interfaces/IItemBar.sol diff --git a/.gitignore b/.gitignore index 32859b1..b0b9383 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ .idea node_modules build -contracts-flattener truffle.js truffle-config.js package-lock.json +contracts/GeneScienceV8.sol +waffle.json +cache diff --git a/contracts-flattener/ApostleBase.sol b/contracts-flattener/ApostleBase.sol new file mode 100644 index 0000000..561a93b --- /dev/null +++ b/contracts-flattener/ApostleBase.sol @@ -0,0 +1,1235 @@ +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IObjectOwnership.sol + +// pragma solidity ^0.4.24; + +contract IObjectOwnership { + function mintObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); + + function burnObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol + +// pragma solidity ^0.4.24; + +contract ITokenUse { + uint48 public constant MAX_UINT48_TIME = 281474976710655; + + function isObjectInHireStage(uint256 _tokenId) public view returns (bool); + + function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); + + function getTokenUser(uint256 _tokenId) public view returns (address); + + function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; + + function cancelTokenUseOffer(uint256 _tokenId) public; + + function takeTokenUseOffer(uint256 _tokenId) public; + + function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; + + function removeActivity(uint256 _tokenId, address _user) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IMinerObject.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IMinerObject is ERC165 { + bytes4 internal constant InterfaceId_IMinerObject = 0x64272b75; + + /* + * 0x64272b752 === + * bytes4(keccak256('strengthOf(uint256,address)')) + */ + + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256); + +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IActivityObject.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IActivityObject is ERC165 { + bytes4 internal constant InterfaceId_IActivityObject = 0x2b9eccc6; + /* + * 0x2b9eccc6 === + * bytes4(keccak256('activityAdded(uint256,address,address)')) ^ + * bytes4(keccak256('activityRemoved(uint256,address,address)')) + */ + + function activityAdded(uint256 _tokenId, address _activity, address _user) public; + + function activityRemoved(uint256 _tokenId, address _activity, address _user) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IActivity.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IActivity is ERC165 { + bytes4 internal constant InterfaceId_IActivity = 0x6086e7f8; + /* + * 0x6086e7f8 === + * bytes4(keccak256('activityStopped(uint256)')) + */ + + function activityStopped(uint256 _tokenId) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol + +// pragma solidity ^0.4.23; + +contract ERC223 { + function transfer(address to, uint amount, bytes data) public returns (bool ok); + + function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); + + event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title SupportsInterfaceWithLookup + * @author Matt Condon (@shrugs) + * @dev Implements ERC165 using a lookup table. + */ +contract SupportsInterfaceWithLookup is ERC165 { + + bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; + /** + * 0x01ffc9a7 === + * bytes4(keccak256('supportsInterface(bytes4)')) + */ + + /** + * @dev a mapping of interface id to whether or not it's supported + */ + mapping(bytes4 => bool) internal supportedInterfaces; + + /** + * @dev A contract implementing SupportsInterfaceWithLookup + * implement ERC165 itself + */ + constructor() + public + { + _registerInterface(InterfaceId_ERC165); + } + + /** + * @dev implement supportsInterface(bytes4) using a lookup table + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool) + { + return supportedInterfaces[_interfaceId]; + } + + /** + * @dev private method for registering an interface + */ + function _registerInterface(bytes4 _interfaceId) + internal + { + require(_interfaceId != 0xffffffff); + supportedInterfaces[_interfaceId] = true; + } +} + + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: contracts/interfaces/IGeneScience.sol + +// pragma solidity ^0.4.24; + + +/// @title defined the interface that will be referenced in main Kitty contract +contract IGeneScience { + /// @dev simply a boolean to indicate this is the contract we expect to be + function isGeneScience() public pure returns (bool); + + /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor + /// @param genes1 genes of mom + /// @param genes2 genes of sire + /// @param talents1 talents of mom + /// @param talents2 talents of sire + /// @return the genes and talents that are supposed to be passed down the child + function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); + + function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); + + function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); + + function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); + + function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); +} + + +// Dependency file: contracts/interfaces/IHabergPotionShop.sol + +// pragma solidity ^0.4.24; + +contract IHabergPotionShop { + function tryKillApostle(uint256 _tokenId, address _killer) public; + + function harbergLifeTime(uint256 _tokenId) public view; + +} + +// Dependency file: contracts/interfaces/ILandBase.sol + +// pragma solidity ^0.4.24; + +contract ILandBase { + + function resourceToken2RateAttrId(address _resourceToken) public view returns (uint256); +} + +// Root file: contracts/ApostleBase.sol + +pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +// import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; +// import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; +// import "@evolutionland/common/contracts/interfaces/IActivity.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; +// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "contracts/interfaces/IGeneScience.sol"; +// import "contracts/interfaces/IHabergPotionShop.sol"; +// import "contracts/interfaces/ILandBase.sol"; + +// all Ids in this contracts refer to index which is using 128-bit unsigned integers. +// this is CONTRACT_APOSTLE_BASE +contract ApostleBase is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { + + event Birth( + address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime + ); + event Pregnant( + uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex + ); + + /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() + /// function. This is used to notify the auto-birth daemon that this breeding action + /// included a pre-payment of the gas required to call the giveBirth() function. + event AutoBirth(uint256 matronId, uint256 cooldownEndTime); + + event Unbox(uint256 tokenId, uint256 activeTime); + + struct Apostle { + // An apostles genes never change. + uint256 genes; + + uint256 talents; + + // the ID of the parents of this Apostle. set to 0 for gen0 apostle. + // Note that using 128-bit unsigned integers to represent parents IDs, + // which refer to lastApostleObjectId for those two. + uint256 matronId; + uint256 sireId; + + // Set to the ID of the sire apostle for matrons that are pregnant, + // zero otherwise. A non-zero value here is how we know an apostle + // is pregnant. Used to retrieve the genetic material for the new + // apostle when the birth transpires. + uint256 siringWithId; + // Set to the index in the cooldown array (see below) that represents + // the current cooldown duration for this apostle. + uint16 cooldownIndex; + // The "generation number" of this apostle. + uint16 generation; + + uint48 birthTime; + uint48 activeTime; + uint48 deadTime; + uint48 cooldownEndTime; + } + + uint32[14] public cooldowns = [ + uint32(1 minutes), + uint32(2 minutes), + uint32(5 minutes), + uint32(10 minutes), + uint32(30 minutes), + uint32(1 hours), + uint32(2 hours), + uint32(4 hours), + uint32(8 hours), + uint32(16 hours), + uint32(1 days), + uint32(2 days), + uint32(4 days), + uint32(7 days) + ]; + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + + /*** STORAGE ***/ + bool private singletonLock = false; + + uint128 public lastApostleObjectId; + + ISettingsRegistry public registry; + + mapping(uint256 => Apostle) public tokenId2Apostle; + + mapping(uint256 => address) public sireAllowedToAddress; + + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + + _registerInterface(InterfaceId_IActivity); + _registerInterface(InterfaceId_IActivityObject); + _registerInterface(InterfaceId_IMinerObject); + _updateCoolDown(); + + } + + // called by gen0Apostle + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { + _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); + } + + function _createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { + + require(_generation <= 65535); + uint256 coolDownIndex = _generation / 2; + if (coolDownIndex > 13) { + coolDownIndex = 13; + } + + Apostle memory apostle = Apostle({ + genes : _genes, + talents : _talents, + birthTime : uint48(now), + activeTime : 0, + deadTime : 0, + cooldownEndTime : 0, + matronId : _matronId, + sireId : _sireId, + siringWithId : 0, + cooldownIndex : uint16(coolDownIndex), + generation : uint16(_generation) + }); + + lastApostleObjectId += 1; + require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); + + tokenId2Apostle[tokenId] = apostle; + + emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); + + return tokenId; + } + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ + uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; + return cooldowns[cooldownIndex]; + } + + // @dev Checks to see if a apostle is able to breed. + // @param _apostleId - index of apostles which is within uint128. + function isReadyToBreed(uint256 _apostleId) + public + view + returns (bool) + { + require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); + + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); + + // In addition to checking the cooldownEndTime, we also need to check to see if + // the cat has a pending birth; there can be some period of time between the end + // of the pregnacy timer and the birth event. + return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); + } + + function approveSiring(address _addr, uint256 _sireId) + public + whenNotPaused + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_sireId) == msg.sender); + + sireAllowedToAddress[_sireId] = _addr; + } + + // check apostle's owner or siring permission + function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + address matronOwner = objectOwnership.ownerOf(_matronId); + address sireOwner = objectOwnership.ownerOf(_sireId); + + // Siring is okay if they have same owner, or if the matron's owner was given + // permission to breed with this sire. + return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); + } + + function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { + + Apostle storage aps = tokenId2Apostle[_tokenId]; + // Compute the end of the cooldown time (based on current cooldownIndex) + aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); + + // Increment the breeding count, clamping it at 13, which is the length of the + // cooldowns array. We could check the array size dynamically, but hard-coding + // this as a constant saves gas. Yay, Solidity! + if (aps.cooldownIndex < 13) { + aps.cooldownIndex += 1; + } + + // address(0) meaning use by its owner or whitelisted contract + ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); + + return uint256(aps.cooldownEndTime); + + } + + function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { + return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); + } + + /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT + /// check ownership permissions (that is up to the caller). + /// @param _matron A reference to the apostle struct of the potential matron. + /// @param _matronId The matron's ID. + /// @param _sire A reference to the apostle struct of the potential sire. + /// @param _sireId The sire's ID + function _isValidMatingPair( + Apostle storage _matron, + uint256 _matronId, + Apostle storage _sire, + uint256 _sireId + ) + private + view + returns (bool) + { + // An apostle can't breed with itself! + if (_matronId == _sireId) { + return false; + } + + // Apostles can't breed with their parents. + if (_matron.matronId == _sireId || _matron.sireId == _sireId) { + return false; + } + if (_sire.matronId == _matronId || _sire.sireId == _matronId) { + return false; + } + + // We can short circuit the sibling check (below) if either cat is + // gen zero (has a matron ID of zero). + if (_sire.matronId == 0 || _matron.matronId == 0) { + return true; + } + + // Apostles can't breed with full or half siblings. + if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { + return false; + } + if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { + return false; + } + + // Everything seems cool! Let's get DTF. + return true; + } + + + function canBreedWith(uint256 _matronId, uint256 _sireId) + public + view + returns (bool) + { + require(_matronId > 0); + require(_sireId > 0); + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + return _isValidMatingPair(matron, _matronId, sire, _sireId) && + _isSiringPermitted(_sireId, _matronId) && + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + } + + + // only can be called by SiringClockAuction + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { + + _breedWith(_matronId, _sireId); + + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, matron.cooldownEndTime); + return true; + } + + + function _breedWith(uint256 _matronId, uint256 _sireId) internal { + require(canBreedWith(_matronId, _sireId)); + + require(isReadyToBreed(_matronId)); + require(isReadyToBreed(_sireId)); + + // Grab a reference to the Apostles from storage. + Apostle storage sire = tokenId2Apostle[_sireId]; + + Apostle storage matron = tokenId2Apostle[_matronId]; + + // Mark the matron as pregnant, keeping track of who the sire is. + matron.siringWithId = _sireId; + + // Trigger the cooldown for both parents. + uint sireCoolDownEndTime = _triggerCooldown(_sireId); + uint matronCoolDownEndTime = _triggerCooldown(_matronId); + + // Clear siring permission for both parents. This may not be strictly necessary + // but it's likely to avoid confusion! + delete sireAllowedToAddress[_matronId]; + delete sireAllowedToAddress[_sireId]; + + + // Emit the pregnancy event. + emit Pregnant( + _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); + } + + + function breedWithAuto(uint256 _matronId, uint256 _sireId) + public + whenNotPaused + { + // Check for payment + // caller must approve first. + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), autoBirthFee)); + + // Call through the normal breeding flow + _breedWith(_matronId, _sireId); + + // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call + // giveBirth(). + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); + } + /// @notice Have a pregnant apostle give birth! + /// @param _matronId An apostle ready to give birth. + /// @return The apostle tokenId of the new Apostles. + /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, + /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned + /// to the current owner of the matron. Upon successful completion, both the matron and the + /// new Apostles will be ready to breed again. Note that anyone can call this function (if they + /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level) + public + isHuman + whenNotPaused + { + + Apostle storage matron = tokenId2Apostle[_matronId]; + uint256 sireId = matron.siringWithId; + + if (_resourceToken != address(0)) { + // users must approve enough resourceToken to this contract + // if _resourceToken is registered + // will be checked in mixgenes + ERC20(_resourceToken).transferFrom(msg.sender, address(this), _level * registry.uintOf(UINT_MIX_TALENT)); + } + + + require(_payAndMix(_matronId, sireId, _resourceToken, _level)); + + } + + + function _payAndMix( + uint256 _matronId, + uint256 _sireId, + address _resourceToken, + uint256 _level) + internal returns (bool) { + // Grab a reference to the matron in storage. + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + + // Check that the matron is a valid apostle. + require(matron.birthTime > 0); + require(sire.birthTime > 0); + + // Check that the matron is pregnant, and that its time has come! + require(_isReadyToGiveBirth(matron)); + + // Grab a reference to the sire in storage. + // uint256 sireId = matron.siringWithId; + // prevent stack too deep error + // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; + + // Determine the higher generation number of the two parents + uint16 parentGen = matron.generation; + if (sire.generation > matron.generation) { + parentGen = sire.generation; + } + + // Call the sooper-sekret, sooper-expensive, gene mixing operation. + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + + address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); + // Make the new Apostle! + _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); + + // Clear the reference to sire from the matron (REQUIRED! Having siringWithId + // set is what marks a matron as being pregnant.) + delete matron.siringWithId; + + return true; + } + + function tokenFallback(address _from, uint256 _value, bytes _data) public { + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + + uint matronId; + uint sireId; + uint level; + + if (msg.sender == registry.addressOf(CONTRACT_RING_ERC20_TOKEN)) { + require(_value >= autoBirthFee, 'not enough to breed.'); + ERC223(msg.sender).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), _value, toBytes(_from)); + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + sireId := mload(add(ptr, 164)) + } + + // All checks passed, apostle gets pregnant! + _breedWith(matronId, sireId); + emit AutoBirth(matronId, uint48(tokenId2Apostle[matronId].cooldownEndTime)); + + } else if (isValidResourceToken(msg.sender)){ + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + level := mload(add(ptr, 164)) + } + + require(level > 0 && _value >= level * registry.uintOf(UINT_MIX_TALENT), 'resource for mixing is not enough.'); + + sireId = tokenId2Apostle[matronId].siringWithId; + + // TODO: msg.sender must be valid resource tokens, this is now checked in the implement of IGeneScience. + // better to check add a API in IGeneScience for checking valid msg.sender is one of the resource. + require(_payAndMix(matronId, sireId, msg.sender, level)); + + } + + } + + function isValidResourceToken(address _resourceToken) public view returns (bool) { + uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); + return index > 0; + } + + + /// Anyone can try to kill this Apostle; + function killApostle(uint256 _tokenId) public { + require(tokenId2Apostle[_tokenId].activeTime > 0); + require(defaultLifeTime(_tokenId) < now); + + address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); + IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); + } + + function isDead(uint256 _tokenId) public view returns (bool) { + return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; + } + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { + uint256 start = tokenId2Apostle[_tokenId].birthTime; + + if (tokenId2Apostle[_tokenId].activeTime > 0) { + start = tokenId2Apostle[_tokenId].activeTime; + } + + return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); + } + + /// IMinerObject + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + + /// IActivityObject + function activityAdded(uint256 _tokenId, address _activity, address _user) auth public { + // to active the apostle when it do activity the first time + if (tokenId2Apostle[_tokenId].activeTime == 0) { + tokenId2Apostle[_tokenId].activeTime = uint48(now); + + emit Unbox(_tokenId, now); + } + + } + + function activityRemoved(uint256 _tokenId, address _activity, address _user) auth public { + // do nothing. + } + + /// IActivity + function activityStopped(uint256 _tokenId) auth public { + // do nothing. + } + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + Apostle storage apostle = tokenId2Apostle[_tokenId]; + return ( + apostle.genes, + apostle.talents, + apostle.matronId, + apostle.sireId, + uint256(apostle.cooldownIndex), + uint256(apostle.generation), + uint256(apostle.birthTime), + uint256(apostle.activeTime), + uint256(apostle.deadTime), + uint256(apostle.cooldownEndTime) + ); + } + + function toBytes(address x) public pure returns (bytes b) { + b = new bytes(32); + assembly {mstore(add(b, 32), x)} + } + + + function _updateCoolDown() internal { + cooldowns[0] = uint32(1 minutes); + cooldowns[1] = uint32(2 minutes); + cooldowns[2] = uint32(5 minutes); + cooldowns[3] = uint32(10 minutes); + cooldowns[4] = uint32(30 minutes); + cooldowns[5] = uint32(1 hours); + cooldowns[6] = uint32(2 hours); + cooldowns[7] = uint32(4 hours); + cooldowns[8] = uint32(8 hours); + cooldowns[9] = uint32(16 hours); + cooldowns[10] = uint32(1 days); + cooldowns[11] = uint32(2 days); + cooldowns[12] = uint32(4 days); + cooldowns[13] = uint32(7 days); + } +} + + diff --git a/contracts-flattener/ApostleBaseAuthority.sol b/contracts-flattener/ApostleBaseAuthority.sol new file mode 100644 index 0000000..c198476 --- /dev/null +++ b/contracts-flattener/ApostleBaseAuthority.sol @@ -0,0 +1,23 @@ +// Root file: contracts/ApostleBaseAuthority.sol + +pragma solidity ^0.4.24; + +contract ApostleBaseAuthority { + mapping (address => bool) public whiteList; + + constructor(address[] _whitelists) public { + for (uint i = 0; i < _whitelists.length; i ++) { + whiteList[_whitelists[i]] = true; + } + } + + function canCall( + address _src, address _dst, bytes4 _sig + ) public view returns (bool) { + return ( whiteList[_src] && _sig == bytes4(keccak256("createApostle(uint256,uint256,uint256,uint256,uint256,address)")) ) || + ( whiteList[_src] && _sig == bytes4(keccak256("breedWithInAuction(uint256,uint256)")) ) || + ( whiteList[_src] && _sig == bytes4(keccak256("activityAdded(uint256,address,address)"))) || + ( whiteList[_src] && _sig == bytes4(keccak256("activityRemoved(uint256,address,address)"))) || + ( whiteList[_src] && _sig == bytes4(keccak256("activityStopped(uint256)"))); + } +} \ No newline at end of file diff --git a/contracts-flattener/ApostleBaseAuthorityV2.sol b/contracts-flattener/ApostleBaseAuthorityV2.sol new file mode 100644 index 0000000..1a7a945 --- /dev/null +++ b/contracts-flattener/ApostleBaseAuthorityV2.sol @@ -0,0 +1,25 @@ +// Root file: contracts/ApostleBaseAuthorityV2.sol + +pragma solidity ^0.4.24; + +contract ApostleBaseAuthorityV2 { + mapping (address => bool) public whiteList; + + constructor(address[] _whitelists) public { + for (uint i = 0; i < _whitelists.length; i ++) { + whiteList[_whitelists[i]] = true; + } + } + + function canCall( + address _src, address _dst, bytes4 _sig + ) public view returns (bool) { + return ( whiteList[_src] && _sig == bytes4(keccak256("createApostle(uint256,uint256,uint256,uint256,uint256,address)")) ) || + ( whiteList[_src] && _sig == bytes4(keccak256("breedWithInAuction(uint256,uint256)")) ) || + ( whiteList[_src] && _sig == bytes4(keccak256("activityAdded(uint256,address,address)"))) || + ( whiteList[_src] && _sig == bytes4(keccak256("activityRemoved(uint256,address,address)"))) || + ( whiteList[_src] && _sig == bytes4(keccak256("updateGenesAndTalents(uint256,uint256,uint256)"))) || + ( whiteList[_src] && _sig == bytes4(keccak256("batchUpdate(uint256[],uint256[],uint256[])"))) || + ( whiteList[_src] && _sig == bytes4(keccak256("activityStopped(uint256)"))); + } +} \ No newline at end of file diff --git a/contracts-flattener/ApostleBaseV2.sol b/contracts-flattener/ApostleBaseV2.sol new file mode 100644 index 0000000..c64c4a0 --- /dev/null +++ b/contracts-flattener/ApostleBaseV2.sol @@ -0,0 +1,1251 @@ +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IObjectOwnership.sol + +// pragma solidity ^0.4.24; + +contract IObjectOwnership { + function mintObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); + + function burnObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol + +// pragma solidity ^0.4.24; + +contract ITokenUse { + uint48 public constant MAX_UINT48_TIME = 281474976710655; + + function isObjectInHireStage(uint256 _tokenId) public view returns (bool); + + function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); + + function getTokenUser(uint256 _tokenId) public view returns (address); + + function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; + + function cancelTokenUseOffer(uint256 _tokenId) public; + + function takeTokenUseOffer(uint256 _tokenId) public; + + function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; + + function removeActivity(uint256 _tokenId, address _user) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IMinerObject.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IMinerObject is ERC165 { + bytes4 internal constant InterfaceId_IMinerObject = 0x64272b75; + + /* + * 0x64272b752 === + * bytes4(keccak256('strengthOf(uint256,address)')) + */ + + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256); + +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IActivityObject.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IActivityObject is ERC165 { + bytes4 internal constant InterfaceId_IActivityObject = 0x2b9eccc6; + /* + * 0x2b9eccc6 === + * bytes4(keccak256('activityAdded(uint256,address,address)')) ^ + * bytes4(keccak256('activityRemoved(uint256,address,address)')) + */ + + function activityAdded(uint256 _tokenId, address _activity, address _user) public; + + function activityRemoved(uint256 _tokenId, address _activity, address _user) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IActivity.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IActivity is ERC165 { + bytes4 internal constant InterfaceId_IActivity = 0x6086e7f8; + /* + * 0x6086e7f8 === + * bytes4(keccak256('activityStopped(uint256)')) + */ + + function activityStopped(uint256 _tokenId) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol + +// pragma solidity ^0.4.23; + +contract ERC223 { + function transfer(address to, uint amount, bytes data) public returns (bool ok); + + function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); + + event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title SupportsInterfaceWithLookup + * @author Matt Condon (@shrugs) + * @dev Implements ERC165 using a lookup table. + */ +contract SupportsInterfaceWithLookup is ERC165 { + + bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; + /** + * 0x01ffc9a7 === + * bytes4(keccak256('supportsInterface(bytes4)')) + */ + + /** + * @dev a mapping of interface id to whether or not it's supported + */ + mapping(bytes4 => bool) internal supportedInterfaces; + + /** + * @dev A contract implementing SupportsInterfaceWithLookup + * implement ERC165 itself + */ + constructor() + public + { + _registerInterface(InterfaceId_ERC165); + } + + /** + * @dev implement supportsInterface(bytes4) using a lookup table + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool) + { + return supportedInterfaces[_interfaceId]; + } + + /** + * @dev private method for registering an interface + */ + function _registerInterface(bytes4 _interfaceId) + internal + { + require(_interfaceId != 0xffffffff); + supportedInterfaces[_interfaceId] = true; + } +} + + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: contracts/interfaces/IGeneScience.sol + +// pragma solidity ^0.4.24; + + +/// @title defined the interface that will be referenced in main Kitty contract +contract IGeneScience { + /// @dev simply a boolean to indicate this is the contract we expect to be + function isGeneScience() public pure returns (bool); + + /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor + /// @param genes1 genes of mom + /// @param genes2 genes of sire + /// @param talents1 talents of mom + /// @param talents2 talents of sire + /// @return the genes and talents that are supposed to be passed down the child + function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); + + function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); + + function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); + + function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); + + function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); +} + + +// Dependency file: contracts/interfaces/IHabergPotionShop.sol + +// pragma solidity ^0.4.24; + +contract IHabergPotionShop { + function tryKillApostle(uint256 _tokenId, address _killer) public; + + function harbergLifeTime(uint256 _tokenId) public view; + +} + +// Dependency file: contracts/interfaces/ILandBase.sol + +// pragma solidity ^0.4.24; + +contract ILandBase { + + function resourceToken2RateAttrId(address _resourceToken) public view returns (uint256); +} + +// Root file: contracts/ApostleBaseV2.sol + +pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +// import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; +// import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; +// import "@evolutionland/common/contracts/interfaces/IActivity.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; +// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "contracts/interfaces/IGeneScience.sol"; +// import "contracts/interfaces/IHabergPotionShop.sol"; +// import "contracts/interfaces/ILandBase.sol"; + +// all Ids in this contracts refer to index which is using 128-bit unsigned integers. +// this is CONTRACT_APOSTLE_BASE +contract ApostleBaseV2 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { + + event Birth( + address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime + ); + event Pregnant( + uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex + ); + + /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() + /// function. This is used to notify the auto-birth daemon that this breeding action + /// included a pre-payment of the gas required to call the giveBirth() function. + event AutoBirth(uint256 matronId, uint256 cooldownEndTime); + + event Unbox(uint256 tokenId, uint256 activeTime); + + struct Apostle { + // An apostles genes never change. + uint256 genes; + + uint256 talents; + + // the ID of the parents of this Apostle. set to 0 for gen0 apostle. + // Note that using 128-bit unsigned integers to represent parents IDs, + // which refer to lastApostleObjectId for those two. + uint256 matronId; + uint256 sireId; + + // Set to the ID of the sire apostle for matrons that are pregnant, + // zero otherwise. A non-zero value here is how we know an apostle + // is pregnant. Used to retrieve the genetic material for the new + // apostle when the birth transpires. + uint256 siringWithId; + // Set to the index in the cooldown array (see below) that represents + // the current cooldown duration for this apostle. + uint16 cooldownIndex; + // The "generation number" of this apostle. + uint16 generation; + + uint48 birthTime; + uint48 activeTime; + uint48 deadTime; + uint48 cooldownEndTime; + } + + uint32[14] public cooldowns = [ + uint32(1 minutes), + uint32(2 minutes), + uint32(5 minutes), + uint32(10 minutes), + uint32(30 minutes), + uint32(1 hours), + uint32(2 hours), + uint32(4 hours), + uint32(8 hours), + uint32(16 hours), + uint32(1 days), + uint32(2 days), + uint32(4 days), + uint32(7 days) + ]; + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + + /*** STORAGE ***/ + bool private singletonLock = false; + + uint128 public lastApostleObjectId; + + ISettingsRegistry public registry; + + mapping(uint256 => Apostle) public tokenId2Apostle; + + mapping(uint256 => address) public sireAllowedToAddress; + + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + + _registerInterface(InterfaceId_IActivity); + _registerInterface(InterfaceId_IActivityObject); + _registerInterface(InterfaceId_IMinerObject); + _updateCoolDown(); + + } + + // called by gen0Apostle + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { + _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); + } + + function _createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { + + require(_generation <= 65535); + uint256 coolDownIndex = _generation / 2; + if (coolDownIndex > 13) { + coolDownIndex = 13; + } + + Apostle memory apostle = Apostle({ + genes : _genes, + talents : _talents, + birthTime : uint48(now), + activeTime : 0, + deadTime : 0, + cooldownEndTime : 0, + matronId : _matronId, + sireId : _sireId, + siringWithId : 0, + cooldownIndex : uint16(coolDownIndex), + generation : uint16(_generation) + }); + + lastApostleObjectId += 1; + require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); + + tokenId2Apostle[tokenId] = apostle; + + emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); + + return tokenId; + } + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ + uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; + return cooldowns[cooldownIndex]; + } + + // @dev Checks to see if a apostle is able to breed. + // @param _apostleId - index of apostles which is within uint128. + function isReadyToBreed(uint256 _apostleId) + public + view + returns (bool) + { + require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); + + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); + + // In addition to checking the cooldownEndTime, we also need to check to see if + // the cat has a pending birth; there can be some period of time between the end + // of the pregnacy timer and the birth event. + return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); + } + + function approveSiring(address _addr, uint256 _sireId) + public + whenNotPaused + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_sireId) == msg.sender); + + sireAllowedToAddress[_sireId] = _addr; + } + + // check apostle's owner or siring permission + function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + address matronOwner = objectOwnership.ownerOf(_matronId); + address sireOwner = objectOwnership.ownerOf(_sireId); + + // Siring is okay if they have same owner, or if the matron's owner was given + // permission to breed with this sire. + return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); + } + + function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { + + Apostle storage aps = tokenId2Apostle[_tokenId]; + // Compute the end of the cooldown time (based on current cooldownIndex) + aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); + + // Increment the breeding count, clamping it at 13, which is the length of the + // cooldowns array. We could check the array size dynamically, but hard-coding + // this as a constant saves gas. Yay, Solidity! + if (aps.cooldownIndex < 13) { + aps.cooldownIndex += 1; + } + + // address(0) meaning use by its owner or whitelisted contract + ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); + + return uint256(aps.cooldownEndTime); + + } + + function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { + return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); + } + + /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT + /// check ownership permissions (that is up to the caller). + /// @param _matron A reference to the apostle struct of the potential matron. + /// @param _matronId The matron's ID. + /// @param _sire A reference to the apostle struct of the potential sire. + /// @param _sireId The sire's ID + function _isValidMatingPair( + Apostle storage _matron, + uint256 _matronId, + Apostle storage _sire, + uint256 _sireId + ) + private + view + returns (bool) + { + // An apostle can't breed with itself! + if (_matronId == _sireId) { + return false; + } + + // Apostles can't breed with their parents. + if (_matron.matronId == _sireId || _matron.sireId == _sireId) { + return false; + } + if (_sire.matronId == _matronId || _sire.sireId == _matronId) { + return false; + } + + // We can short circuit the sibling check (below) if either cat is + // gen zero (has a matron ID of zero). + if (_sire.matronId == 0 || _matron.matronId == 0) { + return true; + } + + // Apostles can't breed with full or half siblings. + if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { + return false; + } + if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { + return false; + } + + // Everything seems cool! Let's get DTF. + return true; + } + + + function canBreedWith(uint256 _matronId, uint256 _sireId) + public + view + returns (bool) + { + require(_matronId > 0); + require(_sireId > 0); + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + return _isValidMatingPair(matron, _matronId, sire, _sireId) && + _isSiringPermitted(_sireId, _matronId) && + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + } + + + // only can be called by SiringClockAuction + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { + + _breedWith(_matronId, _sireId); + + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, matron.cooldownEndTime); + return true; + } + + + function _breedWith(uint256 _matronId, uint256 _sireId) internal { + require(canBreedWith(_matronId, _sireId)); + + require(isReadyToBreed(_matronId)); + require(isReadyToBreed(_sireId)); + + // Grab a reference to the Apostles from storage. + Apostle storage sire = tokenId2Apostle[_sireId]; + + Apostle storage matron = tokenId2Apostle[_matronId]; + + // Mark the matron as pregnant, keeping track of who the sire is. + matron.siringWithId = _sireId; + + // Trigger the cooldown for both parents. + uint sireCoolDownEndTime = _triggerCooldown(_sireId); + uint matronCoolDownEndTime = _triggerCooldown(_matronId); + + // Clear siring permission for both parents. This may not be strictly necessary + // but it's likely to avoid confusion! + delete sireAllowedToAddress[_matronId]; + delete sireAllowedToAddress[_sireId]; + + + // Emit the pregnancy event. + emit Pregnant( + _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); + } + + + function breedWithAuto(uint256 _matronId, uint256 _sireId) + public + whenNotPaused + { + // Check for payment + // caller must approve first. + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), autoBirthFee)); + + // Call through the normal breeding flow + _breedWith(_matronId, _sireId); + + // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call + // giveBirth(). + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); + } + /// @notice Have a pregnant apostle give birth! + /// @param _matronId An apostle ready to give birth. + /// @return The apostle tokenId of the new Apostles. + /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, + /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned + /// to the current owner of the matron. Upon successful completion, both the matron and the + /// new Apostles will be ready to breed again. Note that anyone can call this function (if they + /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level) + public + isHuman + whenNotPaused + { + + Apostle storage matron = tokenId2Apostle[_matronId]; + uint256 sireId = matron.siringWithId; + + if (_resourceToken != address(0)) { + // users must approve enough resourceToken to this contract + // if _resourceToken is registered + // will be checked in mixgenes + ERC20(_resourceToken).transferFrom(msg.sender, address(this), _level * registry.uintOf(UINT_MIX_TALENT)); + } + + + require(_payAndMix(_matronId, sireId, _resourceToken, _level)); + + } + + + function _payAndMix( + uint256 _matronId, + uint256 _sireId, + address _resourceToken, + uint256 _level) + internal returns (bool) { + // Grab a reference to the matron in storage. + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + + // Check that the matron is a valid apostle. + require(matron.birthTime > 0); + require(sire.birthTime > 0); + + // Check that the matron is pregnant, and that its time has come! + require(_isReadyToGiveBirth(matron)); + + // Grab a reference to the sire in storage. + // uint256 sireId = matron.siringWithId; + // prevent stack too deep error + // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; + + // Determine the higher generation number of the two parents + uint16 parentGen = matron.generation; + if (sire.generation > matron.generation) { + parentGen = sire.generation; + } + + // Call the sooper-sekret, sooper-expensive, gene mixing operation. + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + + address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); + // Make the new Apostle! + _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); + + // Clear the reference to sire from the matron (REQUIRED! Having siringWithId + // set is what marks a matron as being pregnant.) + delete matron.siringWithId; + + return true; + } + + function tokenFallback(address _from, uint256 _value, bytes _data) public { + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + + uint matronId; + uint sireId; + uint level; + + if (msg.sender == registry.addressOf(CONTRACT_RING_ERC20_TOKEN)) { + require(_value >= autoBirthFee, 'not enough to breed.'); + ERC223(msg.sender).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), _value, toBytes(_from)); + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + sireId := mload(add(ptr, 164)) + } + + // All checks passed, apostle gets pregnant! + _breedWith(matronId, sireId); + emit AutoBirth(matronId, uint48(tokenId2Apostle[matronId].cooldownEndTime)); + + } else if (isValidResourceToken(msg.sender)){ + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + level := mload(add(ptr, 164)) + } + + require(level > 0 && _value >= level * registry.uintOf(UINT_MIX_TALENT), 'resource for mixing is not enough.'); + + sireId = tokenId2Apostle[matronId].siringWithId; + + // TODO: msg.sender must be valid resource tokens, this is now checked in the implement of IGeneScience. + // better to check add a API in IGeneScience for checking valid msg.sender is one of the resource. + require(_payAndMix(matronId, sireId, msg.sender, level)); + + } + + } + + function isValidResourceToken(address _resourceToken) public view returns (bool) { + uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); + return index > 0; + } + + + /// Anyone can try to kill this Apostle; + function killApostle(uint256 _tokenId) public { + require(tokenId2Apostle[_tokenId].activeTime > 0); + require(defaultLifeTime(_tokenId) < now); + + address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); + IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); + } + + function isDead(uint256 _tokenId) public view returns (bool) { + return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; + } + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { + uint256 start = tokenId2Apostle[_tokenId].birthTime; + + if (tokenId2Apostle[_tokenId].activeTime > 0) { + start = tokenId2Apostle[_tokenId].activeTime; + } + + return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); + } + + /// IMinerObject + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + + /// IActivityObject + function activityAdded(uint256 _tokenId, address _activity, address _user) auth public { + // to active the apostle when it do activity the first time + if (tokenId2Apostle[_tokenId].activeTime == 0) { + tokenId2Apostle[_tokenId].activeTime = uint48(now); + + emit Unbox(_tokenId, now); + } + + } + + function activityRemoved(uint256 _tokenId, address _activity, address _user) auth public { + // do nothing. + } + + /// IActivity + function activityStopped(uint256 _tokenId) auth public { + // do nothing. + } + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + Apostle storage apostle = tokenId2Apostle[_tokenId]; + return ( + apostle.genes, + apostle.talents, + apostle.matronId, + apostle.sireId, + uint256(apostle.cooldownIndex), + uint256(apostle.generation), + uint256(apostle.birthTime), + uint256(apostle.activeTime), + uint256(apostle.deadTime), + uint256(apostle.cooldownEndTime) + ); + } + + function toBytes(address x) public pure returns (bytes b) { + b = new bytes(32); + assembly {mstore(add(b, 32), x)} + } + + + function _updateCoolDown() internal { + cooldowns[0] = uint32(1 minutes); + cooldowns[1] = uint32(2 minutes); + cooldowns[2] = uint32(5 minutes); + cooldowns[3] = uint32(10 minutes); + cooldowns[4] = uint32(30 minutes); + cooldowns[5] = uint32(1 hours); + cooldowns[6] = uint32(2 hours); + cooldowns[7] = uint32(4 hours); + cooldowns[8] = uint32(8 hours); + cooldowns[9] = uint32(16 hours); + cooldowns[10] = uint32(1 days); + cooldowns[11] = uint32(2 days); + cooldowns[12] = uint32(4 days); + cooldowns[13] = uint32(7 days); + } + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { + Apostle storage aps = tokenId2Apostle[_tokenId]; + aps.genes = _genes; + aps.talents = _talents; + } + + function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { + require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); + for(uint i = 0; i < _tokenIds.length; i++) { + Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; + aps.genes = _genesList[i]; + aps.talents = _talentsList[i]; + } + + } +} + + diff --git a/contracts-flattener/ApostleBaseV3.sol b/contracts-flattener/ApostleBaseV3.sol new file mode 100644 index 0000000..701e60d --- /dev/null +++ b/contracts-flattener/ApostleBaseV3.sol @@ -0,0 +1,1352 @@ +// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol + +// pragma solidity ^0.4.24; + + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + // Gas optimization: this is cheaper than asserting 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (_a == 0) { + return 0; + } + + 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 _a / _b; + } + + /** + * @dev Subtracts 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 c) { + c = _a + _b; + assert(c >= _a); + return c; + } +} + + +// Dependency file: contracts/interfaces/IItemBar.sol + +// pragma solidity ^0.4.24; + +interface IItemBar { + function enhanceStrengthRateOf( + address _resourceToken, + uint256 _tokenId + ) external view returns (uint256); +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IObjectOwnership.sol + +// pragma solidity ^0.4.24; + +contract IObjectOwnership { + function mintObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); + + function burnObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol + +// pragma solidity ^0.4.24; + +contract ITokenUse { + uint48 public constant MAX_UINT48_TIME = 281474976710655; + + function isObjectInHireStage(uint256 _tokenId) public view returns (bool); + + function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); + + function getTokenUser(uint256 _tokenId) public view returns (address); + + function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; + + function cancelTokenUseOffer(uint256 _tokenId) public; + + function takeTokenUseOffer(uint256 _tokenId) public; + + function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; + + function removeActivity(uint256 _tokenId, address _user) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IMinerObject.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IMinerObject is ERC165 { + bytes4 internal constant InterfaceId_IMinerObject = 0x64272b75; + + /* + * 0x64272b752 === + * bytes4(keccak256('strengthOf(uint256,address)')) + */ + + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256); + +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IActivityObject.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IActivityObject is ERC165 { + bytes4 internal constant InterfaceId_IActivityObject = 0x2b9eccc6; + /* + * 0x2b9eccc6 === + * bytes4(keccak256('activityAdded(uint256,address,address)')) ^ + * bytes4(keccak256('activityRemoved(uint256,address,address)')) + */ + + function activityAdded(uint256 _tokenId, address _activity, address _user) public; + + function activityRemoved(uint256 _tokenId, address _activity, address _user) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IActivity.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + +contract IActivity is ERC165 { + bytes4 internal constant InterfaceId_IActivity = 0x6086e7f8; + /* + * 0x6086e7f8 === + * bytes4(keccak256('activityStopped(uint256)')) + */ + + function activityStopped(uint256 _tokenId) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol + +// pragma solidity ^0.4.23; + +contract ERC223 { + function transfer(address to, uint amount, bytes data) public returns (bool ok); + + function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); + + event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title SupportsInterfaceWithLookup + * @author Matt Condon (@shrugs) + * @dev Implements ERC165 using a lookup table. + */ +contract SupportsInterfaceWithLookup is ERC165 { + + bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; + /** + * 0x01ffc9a7 === + * bytes4(keccak256('supportsInterface(bytes4)')) + */ + + /** + * @dev a mapping of interface id to whether or not it's supported + */ + mapping(bytes4 => bool) internal supportedInterfaces; + + /** + * @dev A contract implementing SupportsInterfaceWithLookup + * implement ERC165 itself + */ + constructor() + public + { + _registerInterface(InterfaceId_ERC165); + } + + /** + * @dev implement supportsInterface(bytes4) using a lookup table + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool) + { + return supportedInterfaces[_interfaceId]; + } + + /** + * @dev private method for registering an interface + */ + function _registerInterface(bytes4 _interfaceId) + internal + { + require(_interfaceId != 0xffffffff); + supportedInterfaces[_interfaceId] = true; + } +} + + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: contracts/interfaces/IGeneScience.sol + +// pragma solidity ^0.4.24; + + +/// @title defined the interface that will be referenced in main Kitty contract +contract IGeneScience { + /// @dev simply a boolean to indicate this is the contract we expect to be + function isGeneScience() public pure returns (bool); + + /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor + /// @param genes1 genes of mom + /// @param genes2 genes of sire + /// @param talents1 talents of mom + /// @param talents2 talents of sire + /// @return the genes and talents that are supposed to be passed down the child + function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); + + function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); + + function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); + + function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); + + function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); +} + + +// Dependency file: contracts/interfaces/IHabergPotionShop.sol + +// pragma solidity ^0.4.24; + +contract IHabergPotionShop { + function tryKillApostle(uint256 _tokenId, address _killer) public; + + function harbergLifeTime(uint256 _tokenId) public view; + +} + +// Dependency file: contracts/interfaces/ILandBase.sol + +// pragma solidity ^0.4.24; + +contract ILandBase { + + function resourceToken2RateAttrId(address _resourceToken) public view returns (uint256); +} + +// Dependency file: contracts/ApostleBaseV2.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +// import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; +// import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; +// import "@evolutionland/common/contracts/interfaces/IActivity.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; +// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "contracts/interfaces/IGeneScience.sol"; +// import "contracts/interfaces/IHabergPotionShop.sol"; +// import "contracts/interfaces/ILandBase.sol"; + +// all Ids in this contracts refer to index which is using 128-bit unsigned integers. +// this is CONTRACT_APOSTLE_BASE +contract ApostleBaseV2 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { + + event Birth( + address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime + ); + event Pregnant( + uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex + ); + + /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() + /// function. This is used to notify the auto-birth daemon that this breeding action + /// included a pre-payment of the gas required to call the giveBirth() function. + event AutoBirth(uint256 matronId, uint256 cooldownEndTime); + + event Unbox(uint256 tokenId, uint256 activeTime); + + struct Apostle { + // An apostles genes never change. + uint256 genes; + + uint256 talents; + + // the ID of the parents of this Apostle. set to 0 for gen0 apostle. + // Note that using 128-bit unsigned integers to represent parents IDs, + // which refer to lastApostleObjectId for those two. + uint256 matronId; + uint256 sireId; + + // Set to the ID of the sire apostle for matrons that are pregnant, + // zero otherwise. A non-zero value here is how we know an apostle + // is pregnant. Used to retrieve the genetic material for the new + // apostle when the birth transpires. + uint256 siringWithId; + // Set to the index in the cooldown array (see below) that represents + // the current cooldown duration for this apostle. + uint16 cooldownIndex; + // The "generation number" of this apostle. + uint16 generation; + + uint48 birthTime; + uint48 activeTime; + uint48 deadTime; + uint48 cooldownEndTime; + } + + uint32[14] public cooldowns = [ + uint32(1 minutes), + uint32(2 minutes), + uint32(5 minutes), + uint32(10 minutes), + uint32(30 minutes), + uint32(1 hours), + uint32(2 hours), + uint32(4 hours), + uint32(8 hours), + uint32(16 hours), + uint32(1 days), + uint32(2 days), + uint32(4 days), + uint32(7 days) + ]; + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + + /*** STORAGE ***/ + bool private singletonLock = false; + + uint128 public lastApostleObjectId; + + ISettingsRegistry public registry; + + mapping(uint256 => Apostle) public tokenId2Apostle; + + mapping(uint256 => address) public sireAllowedToAddress; + + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + + _registerInterface(InterfaceId_IActivity); + _registerInterface(InterfaceId_IActivityObject); + _registerInterface(InterfaceId_IMinerObject); + _updateCoolDown(); + + } + + // called by gen0Apostle + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { + _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); + } + + function _createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { + + require(_generation <= 65535); + uint256 coolDownIndex = _generation / 2; + if (coolDownIndex > 13) { + coolDownIndex = 13; + } + + Apostle memory apostle = Apostle({ + genes : _genes, + talents : _talents, + birthTime : uint48(now), + activeTime : 0, + deadTime : 0, + cooldownEndTime : 0, + matronId : _matronId, + sireId : _sireId, + siringWithId : 0, + cooldownIndex : uint16(coolDownIndex), + generation : uint16(_generation) + }); + + lastApostleObjectId += 1; + require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); + + tokenId2Apostle[tokenId] = apostle; + + emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); + + return tokenId; + } + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ + uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; + return cooldowns[cooldownIndex]; + } + + // @dev Checks to see if a apostle is able to breed. + // @param _apostleId - index of apostles which is within uint128. + function isReadyToBreed(uint256 _apostleId) + public + view + returns (bool) + { + require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); + + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); + + // In addition to checking the cooldownEndTime, we also need to check to see if + // the cat has a pending birth; there can be some period of time between the end + // of the pregnacy timer and the birth event. + return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); + } + + function approveSiring(address _addr, uint256 _sireId) + public + whenNotPaused + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_sireId) == msg.sender); + + sireAllowedToAddress[_sireId] = _addr; + } + + // check apostle's owner or siring permission + function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + address matronOwner = objectOwnership.ownerOf(_matronId); + address sireOwner = objectOwnership.ownerOf(_sireId); + + // Siring is okay if they have same owner, or if the matron's owner was given + // permission to breed with this sire. + return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); + } + + function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { + + Apostle storage aps = tokenId2Apostle[_tokenId]; + // Compute the end of the cooldown time (based on current cooldownIndex) + aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); + + // Increment the breeding count, clamping it at 13, which is the length of the + // cooldowns array. We could check the array size dynamically, but hard-coding + // this as a constant saves gas. Yay, Solidity! + if (aps.cooldownIndex < 13) { + aps.cooldownIndex += 1; + } + + // address(0) meaning use by its owner or whitelisted contract + ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); + + return uint256(aps.cooldownEndTime); + + } + + function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { + return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); + } + + /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT + /// check ownership permissions (that is up to the caller). + /// @param _matron A reference to the apostle struct of the potential matron. + /// @param _matronId The matron's ID. + /// @param _sire A reference to the apostle struct of the potential sire. + /// @param _sireId The sire's ID + function _isValidMatingPair( + Apostle storage _matron, + uint256 _matronId, + Apostle storage _sire, + uint256 _sireId + ) + private + view + returns (bool) + { + // An apostle can't breed with itself! + if (_matronId == _sireId) { + return false; + } + + // Apostles can't breed with their parents. + if (_matron.matronId == _sireId || _matron.sireId == _sireId) { + return false; + } + if (_sire.matronId == _matronId || _sire.sireId == _matronId) { + return false; + } + + // We can short circuit the sibling check (below) if either cat is + // gen zero (has a matron ID of zero). + if (_sire.matronId == 0 || _matron.matronId == 0) { + return true; + } + + // Apostles can't breed with full or half siblings. + if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { + return false; + } + if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { + return false; + } + + // Everything seems cool! Let's get DTF. + return true; + } + + + function canBreedWith(uint256 _matronId, uint256 _sireId) + public + view + returns (bool) + { + require(_matronId > 0); + require(_sireId > 0); + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + return _isValidMatingPair(matron, _matronId, sire, _sireId) && + _isSiringPermitted(_sireId, _matronId) && + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + } + + + // only can be called by SiringClockAuction + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { + + _breedWith(_matronId, _sireId); + + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, matron.cooldownEndTime); + return true; + } + + + function _breedWith(uint256 _matronId, uint256 _sireId) internal { + require(canBreedWith(_matronId, _sireId)); + + require(isReadyToBreed(_matronId)); + require(isReadyToBreed(_sireId)); + + // Grab a reference to the Apostles from storage. + Apostle storage sire = tokenId2Apostle[_sireId]; + + Apostle storage matron = tokenId2Apostle[_matronId]; + + // Mark the matron as pregnant, keeping track of who the sire is. + matron.siringWithId = _sireId; + + // Trigger the cooldown for both parents. + uint sireCoolDownEndTime = _triggerCooldown(_sireId); + uint matronCoolDownEndTime = _triggerCooldown(_matronId); + + // Clear siring permission for both parents. This may not be strictly necessary + // but it's likely to avoid confusion! + delete sireAllowedToAddress[_matronId]; + delete sireAllowedToAddress[_sireId]; + + + // Emit the pregnancy event. + emit Pregnant( + _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); + } + + + function breedWithAuto(uint256 _matronId, uint256 _sireId) + public + whenNotPaused + { + // Check for payment + // caller must approve first. + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), autoBirthFee)); + + // Call through the normal breeding flow + _breedWith(_matronId, _sireId); + + // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call + // giveBirth(). + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); + } + /// @notice Have a pregnant apostle give birth! + /// @param _matronId An apostle ready to give birth. + /// @return The apostle tokenId of the new Apostles. + /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, + /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned + /// to the current owner of the matron. Upon successful completion, both the matron and the + /// new Apostles will be ready to breed again. Note that anyone can call this function (if they + /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level) + public + isHuman + whenNotPaused + { + + Apostle storage matron = tokenId2Apostle[_matronId]; + uint256 sireId = matron.siringWithId; + + if (_resourceToken != address(0)) { + // users must approve enough resourceToken to this contract + // if _resourceToken is registered + // will be checked in mixgenes + ERC20(_resourceToken).transferFrom(msg.sender, address(this), _level * registry.uintOf(UINT_MIX_TALENT)); + } + + + require(_payAndMix(_matronId, sireId, _resourceToken, _level)); + + } + + + function _payAndMix( + uint256 _matronId, + uint256 _sireId, + address _resourceToken, + uint256 _level) + internal returns (bool) { + // Grab a reference to the matron in storage. + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + + // Check that the matron is a valid apostle. + require(matron.birthTime > 0); + require(sire.birthTime > 0); + + // Check that the matron is pregnant, and that its time has come! + require(_isReadyToGiveBirth(matron)); + + // Grab a reference to the sire in storage. + // uint256 sireId = matron.siringWithId; + // prevent stack too deep error + // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; + + // Determine the higher generation number of the two parents + uint16 parentGen = matron.generation; + if (sire.generation > matron.generation) { + parentGen = sire.generation; + } + + // Call the sooper-sekret, sooper-expensive, gene mixing operation. + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + + address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); + // Make the new Apostle! + _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); + + // Clear the reference to sire from the matron (REQUIRED! Having siringWithId + // set is what marks a matron as being pregnant.) + delete matron.siringWithId; + + return true; + } + + function tokenFallback(address _from, uint256 _value, bytes _data) public { + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + + uint matronId; + uint sireId; + uint level; + + if (msg.sender == registry.addressOf(CONTRACT_RING_ERC20_TOKEN)) { + require(_value >= autoBirthFee, 'not enough to breed.'); + ERC223(msg.sender).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), _value, toBytes(_from)); + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + sireId := mload(add(ptr, 164)) + } + + // All checks passed, apostle gets pregnant! + _breedWith(matronId, sireId); + emit AutoBirth(matronId, uint48(tokenId2Apostle[matronId].cooldownEndTime)); + + } else if (isValidResourceToken(msg.sender)){ + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + level := mload(add(ptr, 164)) + } + + require(level > 0 && _value >= level * registry.uintOf(UINT_MIX_TALENT), 'resource for mixing is not enough.'); + + sireId = tokenId2Apostle[matronId].siringWithId; + + // TODO: msg.sender must be valid resource tokens, this is now checked in the implement of IGeneScience. + // better to check add a API in IGeneScience for checking valid msg.sender is one of the resource. + require(_payAndMix(matronId, sireId, msg.sender, level)); + + } + + } + + function isValidResourceToken(address _resourceToken) public view returns (bool) { + uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); + return index > 0; + } + + + /// Anyone can try to kill this Apostle; + function killApostle(uint256 _tokenId) public { + require(tokenId2Apostle[_tokenId].activeTime > 0); + require(defaultLifeTime(_tokenId) < now); + + address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); + IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); + } + + function isDead(uint256 _tokenId) public view returns (bool) { + return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; + } + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { + uint256 start = tokenId2Apostle[_tokenId].birthTime; + + if (tokenId2Apostle[_tokenId].activeTime > 0) { + start = tokenId2Apostle[_tokenId].activeTime; + } + + return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); + } + + /// IMinerObject + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + + /// IActivityObject + function activityAdded(uint256 _tokenId, address _activity, address _user) auth public { + // to active the apostle when it do activity the first time + if (tokenId2Apostle[_tokenId].activeTime == 0) { + tokenId2Apostle[_tokenId].activeTime = uint48(now); + + emit Unbox(_tokenId, now); + } + + } + + function activityRemoved(uint256 _tokenId, address _activity, address _user) auth public { + // do nothing. + } + + /// IActivity + function activityStopped(uint256 _tokenId) auth public { + // do nothing. + } + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + Apostle storage apostle = tokenId2Apostle[_tokenId]; + return ( + apostle.genes, + apostle.talents, + apostle.matronId, + apostle.sireId, + uint256(apostle.cooldownIndex), + uint256(apostle.generation), + uint256(apostle.birthTime), + uint256(apostle.activeTime), + uint256(apostle.deadTime), + uint256(apostle.cooldownEndTime) + ); + } + + function toBytes(address x) public pure returns (bytes b) { + b = new bytes(32); + assembly {mstore(add(b, 32), x)} + } + + + function _updateCoolDown() internal { + cooldowns[0] = uint32(1 minutes); + cooldowns[1] = uint32(2 minutes); + cooldowns[2] = uint32(5 minutes); + cooldowns[3] = uint32(10 minutes); + cooldowns[4] = uint32(30 minutes); + cooldowns[5] = uint32(1 hours); + cooldowns[6] = uint32(2 hours); + cooldowns[7] = uint32(4 hours); + cooldowns[8] = uint32(8 hours); + cooldowns[9] = uint32(16 hours); + cooldowns[10] = uint32(1 days); + cooldowns[11] = uint32(2 days); + cooldowns[12] = uint32(4 days); + cooldowns[13] = uint32(7 days); + } + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { + Apostle storage aps = tokenId2Apostle[_tokenId]; + aps.genes = _genes; + aps.talents = _talents; + } + + function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { + require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); + for(uint i = 0; i < _tokenIds.length; i++) { + Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; + aps.genes = _genesList[i]; + aps.talents = _talentsList[i]; + } + + } +} + + + + +// Root file: contracts/ApostleBaseV3.sol + +pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// import "contracts/interfaces/IItemBar.sol"; +// import "contracts/ApostleBaseV2.sol"; + +contract ApostleBaseV3 is ApostleBaseV2 { + + using SafeMath for uint256; + + // 0x434f4e54524143545f41504f53544c455f4954454d5f42415200000000000000 + bytes32 public constant CONTRACT_LAND_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; + + // rate precision + uint112 public constant RATE_DECIMALS = 10**8; + + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + uint256 strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + + address itemBar = registry.addressOf(CONTRACT_LAND_ITEM_BAR); + uint256 enhanceRate = + IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); + uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_DECIMALS); + uint256 totalStrength = strength.add(enhanceStrength); + return totalStrength; + } +} diff --git a/contracts-flattener/ApostleClockAuction.sol b/contracts-flattener/ApostleClockAuction.sol new file mode 100644 index 0000000..e16ee50 --- /dev/null +++ b/contracts-flattener/ApostleClockAuction.sol @@ -0,0 +1,1164 @@ +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol + +// pragma solidity ^0.4.24; + + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + // Gas optimization: this is cheaper than asserting 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (_a == 0) { + return 0; + } + + 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 _a / _b; + } + + /** + * @dev Subtracts 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 c) { + c = _a + _b; + assert(c >= _a); + return c; + } +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol + +// pragma solidity ^0.4.23; + +contract ERC223 { + function transfer(address to, uint amount, bytes data) public returns (bool ok); + + function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); + + event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: contracts/interfaces/IApostleBase.sol + +// pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol + +// pragma solidity ^0.4.24; + +contract ITokenUse { + uint48 public constant MAX_UINT48_TIME = 281474976710655; + + function isObjectInHireStage(uint256 _tokenId) public view returns (bool); + + function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); + + function getTokenUser(uint256 _tokenId) public view returns (address); + + function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; + + function cancelTokenUseOffer(uint256 _tokenId) public; + + function takeTokenUseOffer(uint256 _tokenId) public; + + function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; + + function removeActivity(uint256 _tokenId, address _user) public; +} + +// Root file: contracts/ApostleClockAuction.sol + +pragma solidity ^0.4.23; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "contracts/interfaces/IApostleBase.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; + +contract ApostleClockAuction is PausableDSAuth, ApostleSettingIds { + using SafeMath for *; + event AuctionCreated( + uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt + ); + + event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); + event AuctionCancelled(uint256 tokenId); + + // claimedToken event + event ClaimedTokens(address indexed token, address indexed owner, uint amount); + + // new bid event + event NewBid( + uint256 indexed tokenId, address lastBidder, address lastReferer, uint256 lastRecord, address tokenAddress, uint256 bidStartAt, uint256 returnToLastBidder + ); + + // Represents an auction on an NFT + struct Auction { + // Current owner of NFT + address seller; + // Time when auction started + // NOTE: 0 if this auction has been concluded + uint48 startedAt; + // Duration (in seconds) of auction + uint48 duration; + // Price (in token) at beginning of auction + uint128 startingPriceInToken; + // Price (in token) at end of auction + uint128 endingPriceInToken; + // bid the auction through which token + address token; + + // it saves gas in this order + // highest offered price (in RING) + uint128 lastRecord; + // bidder who offer the highest price + address lastBidder; + // latestBidder's bidTime in timestamp + uint48 lastBidStartAt; + // lastBidder's referer + address lastReferer; + } + + bool private singletonLock = false; + + ISettingsRegistry public registry; + + // Map from token ID to their corresponding auction. + mapping(uint256 => Auction) public tokenIdToAuction; + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + // Modifiers to check that inputs can be safely stored with a certain + // number of bits. We use constants and multiple modifiers to save gas. + modifier canBeStoredWith48Bits(uint256 _value) { + require(_value <= 281474976710656); + _; + } + + modifier canBeStoredWith128Bits(uint256 _value) { + require(_value < 340282366920938463463374607431768211455); + _; + } + + modifier isOnAuction(uint256 _tokenId) { + require(tokenIdToAuction[_tokenId].startedAt > 0); + _; + } + + /////////////////////// + // Constructor + /////////////////////// + constructor() public { + // initializeContract + } + + /// @dev Constructor creates a reference to the NFT ownership contract + /// and verifies the owner cut is in the valid range. + /// bidWaitingMinutes - biggest waiting time from a bid's starting to ending(in minutes) + function initializeContract( + ISettingsRegistry _registry) public singletonLockCall { + + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + } + + /// @dev DON'T give me your money. + function() external {} + + /////////////////////// + // Auction Create and Cancel + /////////////////////// + + function createAuction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token) // with any token + public auth { + _createAuction(msg.sender, _tokenId, _startingPriceInToken, _endingPriceInToken, _duration, _startAt, msg.sender, _token); + } + + /// @dev Cancels an auction that hasn't been won yet. + /// Returns the NFT to original owner. + /// @notice This is a state-modifying function that can + /// be called while the contract is paused. + /// @param _tokenId - ID of token on auction + function cancelAuction(uint256 _tokenId) public isOnAuction(_tokenId) + { + Auction storage auction = tokenIdToAuction[_tokenId]; + + address seller = auction.seller; + require((msg.sender == seller && !paused) || msg.sender == owner); + + // once someone has bidden for this auction, no one has the right to cancel it. + require(auction.lastBidder == 0x0); + + delete tokenIdToAuction[_tokenId]; + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, seller, _tokenId); + emit AuctionCancelled(_tokenId); + } + + //@dev only NFT contract can invoke this + //@param _from - owner of _tokenId + function receiveApproval( + address _from, + uint256 _tokenId, + bytes //_extraData + ) + public + whenNotPaused + { + if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { + uint256 startingPriceInRING; + uint256 endingPriceInRING; + uint256 duration; + address seller; + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + startingPriceInRING := mload(add(ptr, 132)) + endingPriceInRING := mload(add(ptr, 164)) + duration := mload(add(ptr, 196)) + seller := mload(add(ptr, 228)) + } + + // TODO: add parameter _token + _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); + } + + } + + /////////////////////// + // Bid With Auction + /////////////////////// + + // @dev bid with RING. Computes the price and transfers winnings. + function _bidWithToken(address _from, uint256 _tokenId, uint256 _valueInToken, address _referer) internal returns (uint256){ + // Get a reference to the auction struct + Auction storage auction = tokenIdToAuction[_tokenId]; + + // Check that the incoming bid is higher than the current price + uint priceInToken = getCurrentPriceInToken(_tokenId); + require(_valueInToken >= priceInToken, + "your offer is lower than the current price, try again with a higher one."); + uint refund = _valueInToken - priceInToken; + + if (refund > 0) { + ERC20(auction.token).transfer(_from, refund); + } + + uint bidMoment; + uint returnToLastBidder; + (bidMoment, returnToLastBidder) = _bidProcess(_from, auction, priceInToken, _referer); + + // Tell the world! + emit NewBid(_tokenId, _from, _referer, priceInToken, auction.token, bidMoment, returnToLastBidder); + + return priceInToken; + } + + // here to handle bid for LAND(NFT) using RING + // @dev bidder must use RING.transfer(address(this), _valueInRING, bytes32(_tokenId) + // to invoke this function + // @param _data - need to be generated from (tokenId + referer) + + function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { + uint tokenId; + address referer; + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + tokenId := mload(add(ptr, 132)) + referer := mload(add(ptr, 164)) + } + + // safer for users + require(msg.sender == tokenIdToAuction[tokenId].token); + require(tokenIdToAuction[tokenId].startedAt > 0); + + _bidWithToken(_from, tokenId, _valueInToken, referer); + } + + // TODO: advice: offer some reward for the person who claimed + // @dev claim _tokenId for auction's lastBidder + function claimApostleAsset(uint _tokenId) public isHuman isOnAuction(_tokenId) { + // Get a reference to the auction struct + Auction storage auction = tokenIdToAuction[_tokenId]; + + // at least bidWaitingTime after last bidder's bid moment, + // and no one else has bidden during this bidWaitingTime, + // then any one can claim this token(land) for lastBidder. + require(auction.lastBidder != 0x0 && now >= auction.lastBidStartAt + registry.uintOf(ApostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME), + "this auction has not finished yet, try again later"); + + address lastBidder = auction.lastBidder; + uint lastRecord = auction.lastRecord; + + delete tokenIdToAuction[_tokenId]; + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, lastBidder, _tokenId); + + emit AuctionSuccessful(_tokenId, lastRecord, lastBidder); + } + + function _firstPartBid(uint _auctionCut, uint _refererCut, address _pool, address _buyer, Auction storage _auction, uint _priceInToken, address _referer) internal returns (uint, uint){ + require(now >= uint256(_auction.startedAt)); + // Calculate the auctioneer's cut. + // (NOTE: computeCut() is guaranteed to return a + // value <= price, so this subtraction can't go negative.) + // TODO: token to the seller + uint256 ownerCutAmount = computeCut(_priceInToken, _auctionCut); + + // transfer to the seller + ERC223(_auction.token).transfer(_auction.seller, (_priceInToken - ownerCutAmount), toBytes(_buyer)); + + if (_referer != 0x0) { + uint refererBounty = computeCut(ownerCutAmount, _refererCut); + ERC20(_auction.token).transfer(_referer, refererBounty); + ERC223(_auction.token).transfer(_pool, (ownerCutAmount - refererBounty), toBytes(_buyer)); + } else { + ERC223(_auction.token).transfer(_pool, ownerCutAmount, toBytes(_buyer)); + } + + // modify bid-related member variables + _auction.lastBidder = _buyer; + _auction.lastRecord = uint128(_priceInToken); + _auction.lastBidStartAt = uint48(now); + _auction.lastReferer = _referer; + + return (_auction.lastBidStartAt, 0); + } + + + function _secondPartBid(uint _auctionCut, uint _refererCut, address _pool, address _buyer, Auction storage _auction, uint _priceInToken, address _referer) internal returns (uint, uint){ + // TODO: repair bug of first bid's time limitation + // if this the first bid, there is no time limitation + require(now <= _auction.lastBidStartAt + registry.uintOf(ApostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME), "It's too late."); + + // _priceInToken that is larger than lastRecord + // was assured in _currentPriceInRING(_auction) + // here double check + // 1.1*price + bounty - (price + bounty) = 0.1 * price + uint surplus = _priceInToken.sub(uint256(_auction.lastRecord)); + uint poolCutAmount = computeCut(surplus, _auctionCut); + uint extractFromGap = surplus - poolCutAmount; + uint realReturnForEach = extractFromGap / 2; + + // here use transfer(address,uint256) for safety + ERC223(_auction.token).transfer(_auction.seller, realReturnForEach, toBytes(_buyer)); + ERC20(_auction.token).transfer(_auction.lastBidder, (realReturnForEach + uint256(_auction.lastRecord))); + + if (_referer != 0x0) { + uint refererBounty = computeCut(poolCutAmount, _refererCut); + ERC20(_auction.token).transfer(_referer, refererBounty); + ERC223(_auction.token).transfer(_pool, (poolCutAmount - refererBounty), toBytes(_buyer)); + } else { + ERC223(_auction.token).transfer(_pool, poolCutAmount, toBytes(_buyer)); + } + + // modify bid-related member variables + _auction.lastBidder = _buyer; + _auction.lastRecord = uint128(_priceInToken); + _auction.lastBidStartAt = uint48(now); + _auction.lastReferer = _referer; + + return (_auction.lastBidStartAt, (realReturnForEach + uint256(_auction.lastRecord))); + } + + // TODO: add _token to compatible backwards with ring and eth + function _bidProcess(address _buyer, Auction storage _auction, uint _priceInToken, address _referer) + internal + canBeStoredWith128Bits(_priceInToken) + returns (uint256, uint256){ + + uint auctionCut = registry.uintOf(UINT_AUCTION_CUT); + uint256 refererCut = registry.uintOf(UINT_REFERER_CUT); + address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); + + // uint256 refererBounty; + + // the first bid + if (_auction.lastBidder == 0x0 && _priceInToken > 0) { + + return _firstPartBid(auctionCut, refererCut, revenuePool, _buyer, _auction, _priceInToken, _referer); + } + + // TODO: the math calculation needs further check + // not the first bid + if (_auction.lastRecord > 0 && _auction.lastBidder != 0x0) { + + return _secondPartBid(auctionCut, refererCut, revenuePool, _buyer, _auction, _priceInToken, _referer); + } + + } + + + /// @notice This method can be used by the owner to extract mistakenly + /// sent tokens to this contract. + /// @param _token The address of the token contract that you want to recover + /// set to 0 in case you want to extract ether. + function claimTokens(address _token) public onlyOwner { + if (_token == 0x0) { + owner.transfer(address(this).balance); + return; + } + ERC20 token = ERC20(_token); + uint balance = token.balanceOf(address(this)); + token.transfer(owner, balance); + + emit ClaimedTokens(_token, owner, balance); + } + + /// @dev Computes owner's cut of a sale. + /// @param _price - Sale price of NFT. + function computeCut(uint256 _price, uint256 _cut) public pure returns (uint256) { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our entry functions carefully cap the maximum values for + // currency (at 128-bits), and ownerCut <= 10000 (see the require() + // statement in the ClockAuction constructor). The result of this + // function is always guaranteed to be <= _price. + return _price * _cut / 10000; + } + + /// @dev Returns auction info for an NFT on auction. + /// @param _tokenId - ID of NFT on auction. + function getAuction(uint256 _tokenId) + public + view + returns + ( + address seller, + uint256 startedAt, + uint256 duration, + uint256 startingPrice, + uint256 endingPrice, + address token, + uint128 lastRecord, + address lastBidder, + uint256 lastBidStartAt, + address lastReferer + ) { + Auction storage auction = tokenIdToAuction[_tokenId]; + return ( + auction.seller, + auction.startingPriceInToken, + auction.endingPriceInToken, + auction.duration, + auction.startedAt, + auction.token, + auction.lastRecord, + auction.lastBidder, + auction.lastBidStartAt, + auction.lastReferer + ); + } + + /// @dev Returns the current price of an auction. + /// Returns current price of an NFT on auction. Broken into two + /// functions (this one, that computes the duration from the auction + /// structure, and the other that does the price computation) so we + /// can easily test that the price computation works correctly. + /// @param _tokenId - ID of the token price we are checking. + function getCurrentPriceInToken(uint256 _tokenId) + public + view + returns (uint256) + { + uint256 secondsPassed = 0; + + // A bit of insurance against negative values (or wraparound). + // Probably not necessary (since Ethereum guarnatees that the + // now variable doesn't ever go backwards). + if (now > tokenIdToAuction[_tokenId].startedAt) { + secondsPassed = now - tokenIdToAuction[_tokenId].startedAt; + } + // if no one has bidden for _auction, compute the price as below. + if (tokenIdToAuction[_tokenId].lastRecord == 0) { + return _computeCurrentPriceInToken( + tokenIdToAuction[_tokenId].startingPriceInToken, + tokenIdToAuction[_tokenId].endingPriceInToken, + tokenIdToAuction[_tokenId].duration, + secondsPassed + ); + } else { + // compatible with first bid + // as long as price_offered_by_buyer >= 1.1 * currentPice, + // this buyer will be the lastBidder + // 1.1 * (lastRecord) + return (11 * (uint256(tokenIdToAuction[_tokenId].lastRecord)) / 10); + } + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256 _tokenId, + bytes //_data + ) + public + returns (bytes4) { + // owner can put apostle on market + // after coolDownEndTime + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + } + + // get auction's price of last bidder offered + // @dev return price of _auction (in RING) + function getLastRecord(uint _tokenId) public view returns (uint256) { + return tokenIdToAuction[_tokenId].lastRecord; + } + + function getLastBidder(uint _tokenId) public view returns (address) { + return tokenIdToAuction[_tokenId].lastBidder; + } + + function getLastBidStartAt(uint _tokenId) public view returns (uint256) { + return tokenIdToAuction[_tokenId].lastBidStartAt; + } + + // @dev if someone new wants to bid, the lowest price he/she need to afford + function computeNextBidRecord(uint _tokenId) public view returns (uint256) { + return getCurrentPriceInToken(_tokenId); + } + + /// @dev Creates and begins a new auction. + /// @param _tokenId - ID of token to auction, sender must be owner. + // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason + /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. + /// @param _endingPriceInToken - Price of item (in token) at end of auction. + /// @param _duration - Length of time to move between starting + /// price and ending price (in seconds). + /// @param _seller - Seller, if not the message sender + function _createAuction( + address _from, + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _seller, + address _token + ) + internal + canBeStoredWith128Bits(_startingPriceInToken) + canBeStoredWith128Bits(_endingPriceInToken) + canBeStoredWith48Bits(_duration) + canBeStoredWith48Bits(_startAt) + whenNotPaused + { + // Require that all auctions have a duration of + // at least one minute. (Keeps our math from getting hairy!) + require(_duration >= 1 minutes, "duration must be at least 1 minutes"); + require(_duration <= 1000 days); + require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); + // escrow + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, this, _tokenId); + + tokenIdToAuction[_tokenId] = Auction({ + seller : _seller, + startedAt : uint48(_startAt), + duration : uint48(_duration), + startingPriceInToken : uint128(_startingPriceInToken), + endingPriceInToken : uint128(_endingPriceInToken), + lastRecord : 0, + token : _token, + // which refer to lastRecord, lastBidder, lastBidStartAt,lastReferer + // all set to zero when initialized + lastBidder : address(0), + lastBidStartAt : 0, + lastReferer : address(0) + }); + + emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); + } + + /// @dev Computes the current price of an auction. Factored out + /// from _currentPrice so we can run extensive unit tests. + /// When testing, make this function public and turn on + /// `Current price computation` test suite. + function _computeCurrentPriceInToken( + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _secondsPassed + ) + internal + pure + returns (uint256) + { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our public functions carefully cap the maximum values for + // time (at 64-bits) and currency (at 128-bits). _duration is + // also known to be non-zero (see the require() statement in + // _addAuction()) + if (_secondsPassed >= _duration) { + // We've reached the end of the dynamic pricing portion + // of the auction, just return the end price. + return _endingPriceInToken; + } else { + // Starting price can be higher than ending price (and often is!), so + // this delta can be negative. + int256 totalPriceInTokenChange = int256(_endingPriceInToken) - int256(_startingPriceInToken); + + // This multiplication can't overflow, _secondsPassed will easily fit within + // 64-bits, and totalPriceChange will easily fit within 128-bits, their product + // will always fit within 256-bits. + int256 currentPriceInTokenChange = totalPriceInTokenChange * int256(_secondsPassed) / int256(_duration); + + // currentPriceChange can be negative, but if so, will have a magnitude + // less that _startingPrice. Thus, this result will always end up positive. + int256 currentPriceInToken = int256(_startingPriceInToken) + currentPriceInTokenChange; + + return uint256(currentPriceInToken); + } + } + + + function toBytes(address x) public pure returns (bytes b) { + b = new bytes(32); + assembly {mstore(add(b, 32), x)} + } +} diff --git a/contracts-flattener/ApostleSettingIds.sol b/contracts-flattener/ApostleSettingIds.sol new file mode 100644 index 0000000..c7bdeb9 --- /dev/null +++ b/contracts-flattener/ApostleSettingIds.sol @@ -0,0 +1,97 @@ +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Root file: contracts/ApostleSettingIds.sol + +pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} diff --git a/contracts-flattener/ClockAuctionAuthority.sol b/contracts-flattener/ClockAuctionAuthority.sol new file mode 100644 index 0000000..66505e6 --- /dev/null +++ b/contracts-flattener/ClockAuctionAuthority.sol @@ -0,0 +1,21 @@ +// Root file: contracts/ClockAuctionAuthority.sol + +pragma solidity ^0.4.24; + +contract ClockAuctionAuthority { + + mapping (address => bool) public whiteList; + + constructor(address[] _whitelists) public { + for (uint i = 0; i < _whitelists.length; i ++) { + whiteList[_whitelists[i]] = true; + } + } + + function canCall( + address _src, address _dst, bytes4 _sig + ) public view returns (bool) { + return ( whiteList[_src] && _sig == bytes4(keccak256("createAuction(uint256,uint256,uint256,uint256,uint256,address)")) ); + + } +} \ No newline at end of file diff --git a/contracts-flattener/ERC721BridgeAuthority.sol b/contracts-flattener/ERC721BridgeAuthority.sol new file mode 100644 index 0000000..234f30b --- /dev/null +++ b/contracts-flattener/ERC721BridgeAuthority.sol @@ -0,0 +1,20 @@ +// Root file: contracts/pet/ERC721BridgeAuthority.sol + +pragma solidity ^0.4.24; + +// TODO: move this to common +contract ERC721BridgeAuthority { + mapping (address => bool) public whiteList; + + constructor(address[] _whitelists) public { + for (uint i = 0; i < _whitelists.length; i++) { + whiteList[_whitelists[i]] = true; + } + } + + function canCall( + address _src, address _dst, bytes4 _sig + ) public view returns (bool) { + return ( whiteList[_src] && _sig == bytes4(keccak256("bridgeInAuth(address,uint256,address)")) ); + } +} \ No newline at end of file diff --git a/contracts-flattener/Gen0Apostle.sol b/contracts-flattener/Gen0Apostle.sol new file mode 100644 index 0000000..2d6447e --- /dev/null +++ b/contracts-flattener/Gen0Apostle.sol @@ -0,0 +1,650 @@ +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: contracts/interfaces/IApostleBase.sol + +// pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} + +// Dependency file: contracts/interfaces/IApostleAuction.sol + +// pragma solidity ^0.4.24; + +contract IApostleAuction { + function createAuction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token)public; + + function cancelAuction(uint256 _tokenId) public; +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol + +// pragma solidity ^0.4.23; + +contract ERC223 { + function transfer(address to, uint amount, bytes data) public returns (bool ok); + + function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); + + event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Root file: contracts/Gen0Apostle.sol + +pragma solidity ^0.4.24; +// import "contracts/ApostleSettingIds.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "contracts/interfaces/IApostleBase.sol"; +// import "contracts/interfaces/IApostleAuction.sol"; +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; + +contract Gen0Apostle is PausableDSAuth, ApostleSettingIds { + // claimedToken event + event ClaimedTokens(address indexed token, address indexed owner, uint amount); + event ClaimedERC721Token(address indexed owner, uint256 tokenId); + + bool private singletonLock = false; + + uint256 public gen0CreationLimit; + + ISettingsRegistry public registry; + + address public operator; + + uint256 public gen0Count; + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + function initializeContract(ISettingsRegistry _registry, uint _gen0Limit) public singletonLockCall { + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + gen0CreationLimit = _gen0Limit; + } + + + function createGen0Apostle(uint256 _genes, uint256 _talents, address _owner) public { + require(operator == msg.sender, "you have no rights"); + require(gen0Count + 1 <= gen0CreationLimit, "Exceed Generation Limit"); + IApostleBase apostleBase = IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)); + apostleBase.createApostle(0, 0, 0, _genes, _talents, _owner); + gen0Count++; + } + + function createGen0Auction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token) + public { + require(operator == msg.sender, "you have no rights"); + IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); + + // aprove land to auction contract + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).approve(address(auction), _tokenId); + // create an auciton + // have to set _seller to this + auction.createAuction(_tokenId,_startingPriceInToken, _endingPriceInToken, _duration,_startAt, _token); + + } + + function cancelAuction(uint256 _tokenId) public onlyOwner { + IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); + auction.cancelAuction(_tokenId); + } + + + function setOperator(address _operator) public onlyOwner { + operator = _operator; + } + + function tokenFallback(address _from, uint256 _value, bytes _data) public { + address ring = registry.addressOf(CONTRACT_RING_ERC20_TOKEN); + address kton = registry.addressOf(CONTRACT_KTON_ERC20_TOKEN); + address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); + + if(msg.sender == ring || msg.sender == kton) { + ERC223(msg.sender).transfer(revenuePool, _value, _data); + } + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256, // _tokenId, + bytes //_data + ) + public + returns (bytes4) { + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + } + + /// @notice This method can be used by the owner to extract mistakenly + /// sent tokens to this contract. + /// @param _token The address of the token contract that you want to recover + /// set to 0 in case you want to extract ether. + function claimTokens(address _token) public onlyOwner { + if (_token == 0x0) { + owner.transfer(address(this).balance); + return; + } + ERC20 token = ERC20(_token); + uint balance = token.balanceOf(address(this)); + token.transfer(owner, balance); + + emit ClaimedTokens(_token, owner, balance); + } + + function claimERC721Tokens(uint256 _tokenId) public onlyOwner { + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), owner, _tokenId); + + emit ClaimedERC721Token(owner, _tokenId); + } + +} \ No newline at end of file diff --git a/contracts-flattener/Gen0ApostleV2.sol b/contracts-flattener/Gen0ApostleV2.sol new file mode 100644 index 0000000..3ecb8bf --- /dev/null +++ b/contracts-flattener/Gen0ApostleV2.sol @@ -0,0 +1,656 @@ +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: contracts/interfaces/IApostleBase.sol + +// pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} + +// Dependency file: contracts/interfaces/IApostleAuction.sol + +// pragma solidity ^0.4.24; + +contract IApostleAuction { + function createAuction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token)public; + + function cancelAuction(uint256 _tokenId) public; +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol + +// pragma solidity ^0.4.23; + +contract ERC223 { + function transfer(address to, uint amount, bytes data) public returns (bool ok); + + function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); + + event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Root file: contracts/Gen0ApostleV2.sol + +pragma solidity ^0.4.24; +// import "contracts/ApostleSettingIds.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "contracts/interfaces/IApostleBase.sol"; +// import "contracts/interfaces/IApostleAuction.sol"; +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; + +contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { + // claimedToken event + event ClaimedTokens(address indexed token, address indexed owner, uint amount); + event ClaimedERC721Token(address indexed owner, uint256 tokenId); + event TakeOut(uint256 tokenId); + + bool private singletonLock = false; + + uint256 public gen0CreationLimit; + + ISettingsRegistry public registry; + + address public operator; + + uint256 public gen0Count; + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + function initializeContract(ISettingsRegistry _registry, uint _gen0Limit) public singletonLockCall { + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + gen0CreationLimit = _gen0Limit; + } + + + function createGen0Apostle(uint256 _genes, uint256 _talents, address _owner) public { + require(operator == msg.sender, "you have no rights"); + require(gen0Count + 1 <= gen0CreationLimit, "Exceed Generation Limit"); + IApostleBase apostleBase = IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)); + apostleBase.createApostle(0, 0, 0, _genes, _talents, _owner); + gen0Count++; + } + + function createGen0Auction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token) + public { + require(operator == msg.sender, "you have no rights"); + IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); + + // aprove land to auction contract + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).approve(address(auction), _tokenId); + // create an auciton + // have to set _seller to this + auction.createAuction(_tokenId,_startingPriceInToken, _endingPriceInToken, _duration,_startAt, _token); + + } + + function cancelAuction(uint256 _tokenId) public onlyOwner { + IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); + auction.cancelAuction(_tokenId); + } + + + function setOperator(address _operator) public onlyOwner { + operator = _operator; + } + + function tokenFallback(address _from, uint256 _value, bytes _data) public { + address ring = registry.addressOf(CONTRACT_RING_ERC20_TOKEN); + address kton = registry.addressOf(CONTRACT_KTON_ERC20_TOKEN); + address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); + + if(msg.sender == ring || msg.sender == kton) { + ERC223(msg.sender).transfer(revenuePool, _value, _data); + } + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256, // _tokenId, + bytes //_data + ) + public + returns (bytes4) { + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + } + + /// @notice This method can be used by the owner to extract mistakenly + /// sent tokens to this contract. + /// @param _token The address of the token contract that you want to recover + /// set to 0 in case you want to extract ether. + function claimTokens(address _token) public onlyOwner { + if (_token == 0x0) { + owner.transfer(address(this).balance); + return; + } + ERC20 token = ERC20(_token); + uint balance = token.balanceOf(address(this)); + token.transfer(owner, balance); + + emit ClaimedTokens(_token, owner, balance); + } + + function claimERC721Tokens(uint256 _tokenId) public onlyOwner { + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), owner, _tokenId); + + emit ClaimedERC721Token(owner, _tokenId); + } + + function setApproval(address _operator, bool _isApproved) public onlyOwner { + ERC721 nft = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + nft.setApprovalForAll(_operator, _isApproved); + } + +} \ No newline at end of file diff --git a/contracts-flattener/HarbergerPotionShop.sol b/contracts-flattener/HarbergerPotionShop.sol new file mode 100644 index 0000000..aab6ddb --- /dev/null +++ b/contracts-flattener/HarbergerPotionShop.sol @@ -0,0 +1,737 @@ +// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol + +// pragma solidity ^0.4.24; + + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + // Gas optimization: this is cheaper than asserting 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (_a == 0) { + return 0; + } + + 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 _a / _b; + } + + /** + * @dev Subtracts 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 c) { + c = _a + _b; + assert(c >= _a); + return c; + } +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IBurnableERC20.sol + +// pragma solidity ^0.4.23; + +contract IBurnableERC20 { + function burn(address _from, uint _value) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IMintableERC20.sol + +// pragma solidity ^0.4.23; + +contract IMintableERC20 { + + function mint(address _to, uint256 _value) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: contracts/interfaces/IApostleBase.sol + +// pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} + +// Root file: contracts/HarbergerPotionShop.sol + +pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/interfaces/IBurnableERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/IMintableERC20.sol"; +// import "@evolutionland/common/contracts/DSAuth.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "contracts/interfaces/IApostleBase.sol"; + +contract HarbergerPotionShop is DSAuth, ApostleSettingIds { + using SafeMath for *; + + /* + * Events + */ + event ClaimedTokens(address indexed _token, address indexed _owner, uint _amount); + + /* + * Storages + */ + + bool private singletonLock = false; + + ISettingsRegistry public registry; + + /* + * Structs + */ + struct PotionState { + uint256 estimatePrice; + uint256 availablePotionFund; + uint48 startTime; + uint48 boughtLifeTime; + uint48 lastUpdateTime; + bool isDead; + } + + mapping (uint256 => PotionState) public tokenId2PotionState; + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + + /** + * @dev Bank's constructor which set the token address and unitInterest_ + */ + constructor () public { + // initializeContract(_registry); + } + + /** + * @dev Same with constructor, but is used and called by storage proxy as logic contract. + * @param _registry - address of SettingsRegistry + */ + function initializeContract(address _registry) public singletonLockCall { + // call Ownable's constructor + owner = msg.sender; + + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + } + + function startHabergPotionModel(uint256 _tokenId, uint256 _estimatePrice, uint256 _ringAmount) public { + require( + ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender, "Only apostle owner can start Potion model."); + + + address apostleBase = registry.addressOf(CONTRACT_APOSTLE_BASE); + require(!(IApostleBase(apostleBase).isDead(_tokenId)), "Apostle is dead, can not start Haberg."); + + require(tokenId2PotionState[_tokenId].lastUpdateTime == 0, "Potion model should not started yet."); + require(_estimatePrice > 0, "Apostle estimated price must larger than zero."); + + ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom(msg.sender, address(this), _ringAmount); + + tokenId2PotionState[_tokenId] = PotionState({ + estimatePrice: _estimatePrice, + availablePotionFund: _ringAmount, + startTime: uint48(IApostleBase(apostleBase).defaultLifeTime(_tokenId)), + boughtLifeTime: 0, + lastUpdateTime: uint48(now), + isDead: false + }); + } + + function tryKillApostle(uint256 _tokenId, address _killer) public auth { + if (tokenId2PotionState[_tokenId].lastUpdateTime == 0) { + // didn't start hargberg or already exited. + return; + } else if (tokenId2PotionState[_tokenId].isDead) { + return; + } else { + uint256 currentHarbergLifeTime = harbergLifeTime(_tokenId); + require(currentHarbergLifeTime < now); + + tokenId2PotionState[_tokenId].isDead = true; + tokenId2PotionState[_tokenId].boughtLifeTime += uint48(currentHarbergLifeTime - tokenId2PotionState[_tokenId].startTime); + tokenId2PotionState[_tokenId].availablePotionFund = 0; + tokenId2PotionState[_tokenId].lastUpdateTime = uint48(now); + } + } + + // deposit haberg tax + function buyPotion(uint256 _tokenId, uint256 _ringAmount) public { + require(ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender, "Only apostle owner can buy potion."); + + _buyPotion(msg.sender, _tokenId, _ringAmount); + } + + function _buyPotion(address _payer, uint256 _tokenId, uint256 _ringAmount) internal { + require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); + require(!tokenId2PotionState[_tokenId].isDead, "Apostle must not be dead."); + + ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom(_payer, address(this), _ringAmount); + + tokenId2PotionState[_tokenId].availablePotionFund += _ringAmount; + } + + function changeHabergEstimatePrice(uint256 _tokenId, uint256 _estimatePrice) public { + require(ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender); + require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); + require(!tokenId2PotionState[_tokenId].isDead, "Apostle must not be dead."); + + _updateHabergPotionState(_tokenId); + + tokenId2PotionState[_tokenId].estimatePrice = _estimatePrice; + } + + function _updateHabergPotionState(uint256 _tokenId) internal { + uint256 newBoughtLifeTime = now - tokenId2PotionState[_tokenId].lastUpdateTime; + + uint256 usedPotionFund = tokenId2PotionState[_tokenId].estimatePrice + .mul(registry.uintOf(UINT_HABERG_POTION_TAX_RATE)).div(100000000) + .mul(newBoughtLifeTime).div(1 days); + + tokenId2PotionState[_tokenId].availablePotionFund = tokenId2PotionState[_tokenId].availablePotionFund.sub(usedPotionFund); + + tokenId2PotionState[_tokenId].boughtLifeTime = uint48(tokenId2PotionState[_tokenId].boughtLifeTime + newBoughtLifeTime); + + tokenId2PotionState[_tokenId].lastUpdateTime = uint48(now); + } + + /// stop Haberg will kill the apostle + function stopHabergAndWithdrawFunds(uint256 _tokenId) public { + require(ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender, "Only apostle owner can call this."); + require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); + require(!tokenId2PotionState[_tokenId].isDead, "Apostle must not be dead."); + + _updateHabergPotionState(_tokenId); + + tokenId2PotionState[_tokenId].isDead = true; + tokenId2PotionState[_tokenId].availablePotionFund = 0; + + ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom( + address(this), msg.sender, tokenId2PotionState[_tokenId].availablePotionFund); + } + + function forceBuy(uint256 _tokenId, uint256 _depositPotionFee) public { + require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); + require(!tokenId2PotionState[_tokenId].isDead, "Apostle must not be dead."); + + address tokenOwner = ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId); + + uint256 oldAvailablePotionFund = tokenId2PotionState[_tokenId].availablePotionFund; + + /// new owner must make up the potion fee if the old owner didn't pay enough + _buyPotion(msg.sender, _tokenId, _depositPotionFee); + + _updateHabergPotionState(_tokenId); + + uint256 usedFund = oldAvailablePotionFund + _depositPotionFee - tokenId2PotionState[_tokenId].availablePotionFund; + + if (oldAvailablePotionFund > usedFund) { + ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom( + address(this), tokenOwner, (oldAvailablePotionFund - usedFund) + ); + } + + ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom( + msg.sender, tokenOwner, tokenId2PotionState[_tokenId].estimatePrice); + + // must approve this first, if not, others can kill this apostle in Apostle. + ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).transferFrom(tokenOwner, msg.sender, _tokenId); + } + + function harbergLifeTime(uint256 _tokenId) public view returns (uint256) { + return tokenId2PotionState[_tokenId].startTime + tokenId2PotionState[_tokenId].boughtLifeTime + tokenId2PotionState[_tokenId].availablePotionFund + .mul(1 days).div( + tokenId2PotionState[_tokenId].estimatePrice.mul(registry.uintOf(UINT_HABERG_POTION_TAX_RATE)).div(100000000) + ); + } + + /// @notice This method can be used by the owner to extract mistakenly + /// sent tokens to this contract. + /// @param _token The address of the token contract that you want to recover + /// set to 0 in case you want to extract ether. + function claimTokens(address _token) public onlyOwner { + if (_token == 0x0) { + owner.transfer(address(this).balance); + return; + } + ERC20 token = ERC20(_token); + uint balance = token.balanceOf(address(this)); + token.transfer(owner, balance); + + emit ClaimedTokens(_token, owner, balance); + } + +} diff --git a/contracts-flattener/IApostleAuction.sol b/contracts-flattener/IApostleAuction.sol new file mode 100644 index 0000000..db2f8c6 --- /dev/null +++ b/contracts-flattener/IApostleAuction.sol @@ -0,0 +1,15 @@ +// Root file: contracts/interfaces/IApostleAuction.sol + +pragma solidity ^0.4.24; + +contract IApostleAuction { + function createAuction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token)public; + + function cancelAuction(uint256 _tokenId) public; +} diff --git a/contracts-flattener/IApostleBase.sol b/contracts-flattener/IApostleBase.sol new file mode 100644 index 0000000..35549bf --- /dev/null +++ b/contracts-flattener/IApostleBase.sol @@ -0,0 +1,30 @@ +// Root file: contracts/interfaces/IApostleBase.sol + +pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} \ No newline at end of file diff --git a/contracts-flattener/IERC721Bridge.sol b/contracts-flattener/IERC721Bridge.sol new file mode 100644 index 0000000..a50c5a8 --- /dev/null +++ b/contracts-flattener/IERC721Bridge.sol @@ -0,0 +1,15 @@ +// Root file: contracts/interfaces/IERC721Bridge.sol + +pragma solidity ^0.4.24; + +contract IERC721Bridge { + + + function originNft2Adaptor(address _originContract) public view returns (address); + + function ownerOf(uint256 _mirrorTokenId) public view returns (address); + + function isBridged(uint256 _mirrorTokenId) public view returns (bool); + + function bridgeInAuth(address _originNftAddress, uint256 _originTokenId, address _owner) public returns (uint256); +} diff --git a/contracts-flattener/IGeneScience.sol b/contracts-flattener/IGeneScience.sol new file mode 100644 index 0000000..f055486 --- /dev/null +++ b/contracts-flattener/IGeneScience.sol @@ -0,0 +1,26 @@ +// Root file: contracts/interfaces/IGeneScience.sol + +pragma solidity ^0.4.24; + + +/// @title defined the interface that will be referenced in main Kitty contract +contract IGeneScience { + /// @dev simply a boolean to indicate this is the contract we expect to be + function isGeneScience() public pure returns (bool); + + /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor + /// @param genes1 genes of mom + /// @param genes2 genes of sire + /// @param talents1 talents of mom + /// @param talents2 talents of sire + /// @return the genes and talents that are supposed to be passed down the child + function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); + + function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); + + function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); + + function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); + + function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); +} diff --git a/contracts-flattener/IHabergPotionShop.sol b/contracts-flattener/IHabergPotionShop.sol new file mode 100644 index 0000000..4bf5f20 --- /dev/null +++ b/contracts-flattener/IHabergPotionShop.sol @@ -0,0 +1,10 @@ +// Root file: contracts/interfaces/IHabergPotionShop.sol + +pragma solidity ^0.4.24; + +contract IHabergPotionShop { + function tryKillApostle(uint256 _tokenId, address _killer) public; + + function harbergLifeTime(uint256 _tokenId) public view; + +} \ No newline at end of file diff --git a/contracts-flattener/IItemBar.sol b/contracts-flattener/IItemBar.sol new file mode 100644 index 0000000..179422f --- /dev/null +++ b/contracts-flattener/IItemBar.sol @@ -0,0 +1,10 @@ +// Root file: contracts/interfaces/IItemBar.sol + +pragma solidity ^0.4.24; + +interface IItemBar { + function enhanceStrengthRateOf( + address _resourceToken, + uint256 _tokenId + ) external view returns (uint256); +} diff --git a/contracts-flattener/ILandBase.sol b/contracts-flattener/ILandBase.sol new file mode 100644 index 0000000..66620ea --- /dev/null +++ b/contracts-flattener/ILandBase.sol @@ -0,0 +1,8 @@ +// Root file: contracts/interfaces/ILandBase.sol + +pragma solidity ^0.4.24; + +contract ILandBase { + + function resourceToken2RateAttrId(address _resourceToken) public view returns (uint256); +} \ No newline at end of file diff --git a/contracts-flattener/ILandResource.sol b/contracts-flattener/ILandResource.sol new file mode 100644 index 0000000..2d728df --- /dev/null +++ b/contracts-flattener/ILandResource.sol @@ -0,0 +1,12 @@ +// Root file: contracts/interfaces/ILandResource.sol + +pragma solidity ^0.4.23; + +contract ILandResource { + + function updateMinerStrengthWhenStart(uint256 _apostleTokenId) public; + + function updateMinerStrengthWhenStop(uint256 _apostleTokenId) public; + + function landWorkingOn(uint256 _apostleTokenId) public view returns (uint256); +} diff --git a/contracts-flattener/Migrations.sol b/contracts-flattener/Migrations.sol new file mode 100644 index 0000000..e2c70ab --- /dev/null +++ b/contracts-flattener/Migrations.sol @@ -0,0 +1,2060 @@ +// Dependency file: @evolutionland/common/contracts/ObjectOwnershipAuthority.sol + +// pragma solidity ^0.4.24; + +contract ObjectOwnershipAuthority { + + mapping (address => bool) public whiteList; + + constructor(address[] _whitelists) public { + for (uint i = 0; i < _whitelists.length; i ++) { + whiteList[_whitelists[i]] = true; + } + } + + function canCall( + address _src, address _dst, bytes4 _sig + ) public view returns (bool) { + return ( whiteList[_src] && _sig == bytes4(keccak256("mintObject(address,uint128)")) ) || + ( whiteList[_src] && _sig == bytes4(keccak256("burnObject(address,uint128)")) ); + } +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/SettingsRegistry.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/DSAuth.sol"; + +/** + * @title SettingsRegistry + * @dev This contract holds all the settings for updating and querying. + */ +contract SettingsRegistry is ISettingsRegistry, DSAuth { + + mapping(bytes32 => uint256) public uintProperties; + mapping(bytes32 => string) public stringProperties; + mapping(bytes32 => address) public addressProperties; + mapping(bytes32 => bytes) public bytesProperties; + mapping(bytes32 => bool) public boolProperties; + mapping(bytes32 => int256) public intProperties; + + mapping(bytes32 => SettingsValueTypes) public valueTypes; + + function uintOf(bytes32 _propertyName) public view returns (uint256) { + require(valueTypes[_propertyName] == SettingsValueTypes.UINT, "Property type does not match."); + return uintProperties[_propertyName]; + } + + function stringOf(bytes32 _propertyName) public view returns (string) { + require(valueTypes[_propertyName] == SettingsValueTypes.STRING, "Property type does not match."); + return stringProperties[_propertyName]; + } + + function addressOf(bytes32 _propertyName) public view returns (address) { + require(valueTypes[_propertyName] == SettingsValueTypes.ADDRESS, "Property type does not match."); + return addressProperties[_propertyName]; + } + + function bytesOf(bytes32 _propertyName) public view returns (bytes) { + require(valueTypes[_propertyName] == SettingsValueTypes.BYTES, "Property type does not match."); + return bytesProperties[_propertyName]; + } + + function boolOf(bytes32 _propertyName) public view returns (bool) { + require(valueTypes[_propertyName] == SettingsValueTypes.BOOL, "Property type does not match."); + return boolProperties[_propertyName]; + } + + function intOf(bytes32 _propertyName) public view returns (int) { + require(valueTypes[_propertyName] == SettingsValueTypes.INT, "Property type does not match."); + return intProperties[_propertyName]; + } + + function setUintProperty(bytes32 _propertyName, uint _value) public auth { + require( + valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.UINT, "Property type does not match."); + uintProperties[_propertyName] = _value; + valueTypes[_propertyName] = SettingsValueTypes.UINT; + + emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.UINT)); + } + + function setStringProperty(bytes32 _propertyName, string _value) public auth { + require( + valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.STRING, "Property type does not match."); + stringProperties[_propertyName] = _value; + valueTypes[_propertyName] = SettingsValueTypes.STRING; + + emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.STRING)); + } + + function setAddressProperty(bytes32 _propertyName, address _value) public auth { + require( + valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.ADDRESS, "Property type does not match."); + + addressProperties[_propertyName] = _value; + valueTypes[_propertyName] = SettingsValueTypes.ADDRESS; + + emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.ADDRESS)); + } + + function setBytesProperty(bytes32 _propertyName, bytes _value) public auth { + require( + valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.BYTES, "Property type does not match."); + + bytesProperties[_propertyName] = _value; + valueTypes[_propertyName] = SettingsValueTypes.BYTES; + + emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.BYTES)); + } + + function setBoolProperty(bytes32 _propertyName, bool _value) public auth { + require( + valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.BOOL, "Property type does not match."); + + boolProperties[_propertyName] = _value; + valueTypes[_propertyName] = SettingsValueTypes.BOOL; + + emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.BOOL)); + } + + function setIntProperty(bytes32 _propertyName, int _value) public auth { + require( + valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.INT, "Property type does not match."); + + intProperties[_propertyName] = _value; + valueTypes[_propertyName] = SettingsValueTypes.INT; + + emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.INT)); + } + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint256 /* SettingsValueTypes */ ) { + return uint256(valueTypes[_propertyName]); + } + +} + +// Dependency file: openzeppelin-solidity/contracts/ownership/Ownable.sol + +// pragma solidity ^0.4.24; + + +/** + * @title Ownable + * @dev The Ownable contract has an owner address, and provides basic authorization control + * functions, this simplifies the implementation of "user permissions". + */ +contract Ownable { + address public owner; + + + event OwnershipRenounced(address indexed previousOwner); + event OwnershipTransferred( + address indexed previousOwner, + address indexed newOwner + ); + + + /** + * @dev The Ownable constructor sets the original `owner` of the contract to the sender + * account. + */ + constructor() public { + owner = msg.sender; + } + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + /** + * @dev Allows the current owner to relinquish control of the contract. + * @notice Renouncing to ownership will leave the contract without an owner. + * It will not be possible to call the functions with the `onlyOwner` + * modifier anymore. + */ + function renounceOwnership() public onlyOwner { + emit OwnershipRenounced(owner); + owner = address(0); + } + + /** + * @dev Allows the current owner to transfer control of the contract to a newOwner. + * @param _newOwner The address to transfer ownership to. + */ + function transferOwnership(address _newOwner) public onlyOwner { + _transferOwnership(_newOwner); + } + + /** + * @dev Transfers control of the contract to a newOwner. + * @param _newOwner The address to transfer ownership to. + */ + function _transferOwnership(address _newOwner) internal { + require(_newOwner != address(0)); + emit OwnershipTransferred(owner, _newOwner); + owner = _newOwner; + } +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC721 token receiver interface + * @dev Interface for any contract that wants to support safeTransfers + * from ERC721 asset contracts. + */ +contract ERC721Receiver { + /** + * @dev Magic value to be returned upon successful reception of an NFT + * Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`, + * which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` + */ + bytes4 internal constant ERC721_RECEIVED = 0x150b7a02; + + /** + * @notice Handle the receipt of an NFT + * @dev The ERC721 smart contract calls this function on the recipient + * after a `safetransfer`. This function MAY throw to revert and reject the + * transfer. Return of other than the magic value MUST result in the + * transaction being reverted. + * Note: the contract address is always the message sender. + * @param _operator The address which called `safeTransferFrom` function + * @param _from The address which previously owned the token + * @param _tokenId The NFT identifier which is being transferred + * @param _data Additional data with no specified format + * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + */ + function onERC721Received( + address _operator, + address _from, + uint256 _tokenId, + bytes _data + ) + public + returns(bytes4); +} + + +// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol + +// pragma solidity ^0.4.24; + + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + // Gas optimization: this is cheaper than asserting 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (_a == 0) { + return 0; + } + + 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 _a / _b; + } + + /** + * @dev Subtracts 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 c) { + c = _a + _b; + assert(c >= _a); + return c; + } +} + + +// Dependency file: openzeppelin-solidity/contracts/AddressUtils.sol + +// pragma solidity ^0.4.24; + + +/** + * Utility library of inline functions on addresses + */ +library AddressUtils { + + /** + * Returns whether the target address is a contract + * @dev This function will return false if invoked during the constructor of a contract, + * as the code is not actually created until after the constructor finishes. + * @param _addr address to check + * @return whether the target address is a contract + */ + function isContract(address _addr) internal view returns (bool) { + uint256 size; + // XXX Currently there is no better way to check if there is a contract in an address + // than to check the size of the code at that address. + // See https://ethereum.stackexchange.com/a/14016/36603 + // for more details about how this works. + // TODO Check this again before the Serenity release, because all addresses will be + // contracts then. + // solium-disable-next-line security/no-inline-assembly + assembly { size := extcodesize(_addr) } + return size > 0; + } + +} + + +// Dependency file: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title SupportsInterfaceWithLookup + * @author Matt Condon (@shrugs) + * @dev Implements ERC165 using a lookup table. + */ +contract SupportsInterfaceWithLookup is ERC165 { + + bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; + /** + * 0x01ffc9a7 === + * bytes4(keccak256('supportsInterface(bytes4)')) + */ + + /** + * @dev a mapping of interface id to whether or not it's supported + */ + mapping(bytes4 => bool) internal supportedInterfaces; + + /** + * @dev A contract implementing SupportsInterfaceWithLookup + * implement ERC165 itself + */ + constructor() + public + { + _registerInterface(InterfaceId_ERC165); + } + + /** + * @dev implement supportsInterface(bytes4) using a lookup table + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool) + { + return supportedInterfaces[_interfaceId]; + } + + /** + * @dev private method for registering an interface + */ + function _registerInterface(bytes4 _interfaceId) + internal + { + require(_interfaceId != 0xffffffff); + supportedInterfaces[_interfaceId] = true; + } +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721BasicToken.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol"; +// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// import "openzeppelin-solidity/contracts/AddressUtils.sol"; +// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic implementation + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic { + + using SafeMath for uint256; + using AddressUtils for address; + + // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` + bytes4 private constant ERC721_RECEIVED = 0x150b7a02; + + // Mapping from token ID to owner + mapping (uint256 => address) internal tokenOwner; + + // Mapping from token ID to approved address + mapping (uint256 => address) internal tokenApprovals; + + // Mapping from owner to number of owned token + mapping (address => uint256) internal ownedTokensCount; + + // Mapping from owner to operator approvals + mapping (address => mapping (address => bool)) internal operatorApprovals; + + constructor() + public + { + // register the supported interfaces to conform to ERC721 via ERC165 + _registerInterface(InterfaceId_ERC721); + _registerInterface(InterfaceId_ERC721Exists); + } + + /** + * @dev Gets the balance of the specified address + * @param _owner address to query the balance of + * @return uint256 representing the amount owned by the passed address + */ + function balanceOf(address _owner) public view returns (uint256) { + require(_owner != address(0)); + return ownedTokensCount[_owner]; + } + + /** + * @dev Gets the owner of the specified token ID + * @param _tokenId uint256 ID of the token to query the owner of + * @return owner address currently marked as the owner of the given token ID + */ + function ownerOf(uint256 _tokenId) public view returns (address) { + address owner = tokenOwner[_tokenId]; + require(owner != address(0)); + return owner; + } + + /** + * @dev Returns whether the specified token exists + * @param _tokenId uint256 ID of the token to query the existence of + * @return whether the token exists + */ + function exists(uint256 _tokenId) public view returns (bool) { + address owner = tokenOwner[_tokenId]; + return owner != address(0); + } + + /** + * @dev Approves another address to transfer the given token ID + * The zero address indicates there is no approved address. + * There can only be one approved address per token at a given time. + * Can only be called by the token owner or an approved operator. + * @param _to address to be approved for the given token ID + * @param _tokenId uint256 ID of the token to be approved + */ + function approve(address _to, uint256 _tokenId) public { + address owner = ownerOf(_tokenId); + require(_to != owner); + require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); + + tokenApprovals[_tokenId] = _to; + emit Approval(owner, _to, _tokenId); + } + + /** + * @dev Gets the approved address for a token ID, or zero if no address set + * @param _tokenId uint256 ID of the token to query the approval of + * @return address currently approved for the given token ID + */ + function getApproved(uint256 _tokenId) public view returns (address) { + return tokenApprovals[_tokenId]; + } + + /** + * @dev Sets or unsets the approval of a given operator + * An operator is allowed to transfer all tokens of the sender on their behalf + * @param _to operator address to set the approval + * @param _approved representing the status of the approval to be set + */ + function setApprovalForAll(address _to, bool _approved) public { + require(_to != msg.sender); + operatorApprovals[msg.sender][_to] = _approved; + emit ApprovalForAll(msg.sender, _to, _approved); + } + + /** + * @dev Tells whether an operator is approved by a given owner + * @param _owner owner address which you want to query the approval of + * @param _operator operator address which you want to query the approval of + * @return bool whether the given operator is approved by the given owner + */ + function isApprovedForAll( + address _owner, + address _operator + ) + public + view + returns (bool) + { + return operatorApprovals[_owner][_operator]; + } + + /** + * @dev Transfers the ownership of a given token ID to another address + * Usage of this method is discouraged, use `safeTransferFrom` whenever possible + * Requires the msg sender to be the owner, approved, or operator + * @param _from current owner of the token + * @param _to address to receive the ownership of the given token ID + * @param _tokenId uint256 ID of the token to be transferred + */ + function transferFrom( + address _from, + address _to, + uint256 _tokenId + ) + public + { + require(isApprovedOrOwner(msg.sender, _tokenId)); + require(_from != address(0)); + require(_to != address(0)); + + clearApproval(_from, _tokenId); + removeTokenFrom(_from, _tokenId); + addTokenTo(_to, _tokenId); + + emit Transfer(_from, _to, _tokenId); + } + + /** + * @dev Safely transfers the ownership of a given token ID to another address + * If the target address is a contract, it must implement `onERC721Received`, + * which is called upon a safe transfer, and return the magic value + * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, + * the transfer is reverted. + * + * Requires the msg sender to be the owner, approved, or operator + * @param _from current owner of the token + * @param _to address to receive the ownership of the given token ID + * @param _tokenId uint256 ID of the token to be transferred + */ + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId + ) + public + { + // solium-disable-next-line arg-overflow + safeTransferFrom(_from, _to, _tokenId, ""); + } + + /** + * @dev Safely transfers the ownership of a given token ID to another address + * If the target address is a contract, it must implement `onERC721Received`, + * which is called upon a safe transfer, and return the magic value + * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, + * the transfer is reverted. + * Requires the msg sender to be the owner, approved, or operator + * @param _from current owner of the token + * @param _to address to receive the ownership of the given token ID + * @param _tokenId uint256 ID of the token to be transferred + * @param _data bytes data to send along with a safe transfer check + */ + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public + { + transferFrom(_from, _to, _tokenId); + // solium-disable-next-line arg-overflow + require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data)); + } + + /** + * @dev Returns whether the given spender can transfer a given token ID + * @param _spender address of the spender to query + * @param _tokenId uint256 ID of the token to be transferred + * @return bool whether the msg.sender is approved for the given token ID, + * is an operator of the owner, or is the owner of the token + */ + function isApprovedOrOwner( + address _spender, + uint256 _tokenId + ) + internal + view + returns (bool) + { + address owner = ownerOf(_tokenId); + // Disable solium check because of + // https://github.com/duaraghav8/Solium/issues/175 + // solium-disable-next-line operator-whitespace + return ( + _spender == owner || + getApproved(_tokenId) == _spender || + isApprovedForAll(owner, _spender) + ); + } + + /** + * @dev Internal function to mint a new token + * Reverts if the given token ID already exists + * @param _to The address that will own the minted token + * @param _tokenId uint256 ID of the token to be minted by the msg.sender + */ + function _mint(address _to, uint256 _tokenId) internal { + require(_to != address(0)); + addTokenTo(_to, _tokenId); + emit Transfer(address(0), _to, _tokenId); + } + + /** + * @dev Internal function to burn a specific token + * Reverts if the token does not exist + * @param _tokenId uint256 ID of the token being burned by the msg.sender + */ + function _burn(address _owner, uint256 _tokenId) internal { + clearApproval(_owner, _tokenId); + removeTokenFrom(_owner, _tokenId); + emit Transfer(_owner, address(0), _tokenId); + } + + /** + * @dev Internal function to clear current approval of a given token ID + * Reverts if the given address is not indeed the owner of the token + * @param _owner owner of the token + * @param _tokenId uint256 ID of the token to be transferred + */ + function clearApproval(address _owner, uint256 _tokenId) internal { + require(ownerOf(_tokenId) == _owner); + if (tokenApprovals[_tokenId] != address(0)) { + tokenApprovals[_tokenId] = address(0); + } + } + + /** + * @dev Internal function to add a token ID to the list of a given address + * @param _to address representing the new owner of the given token ID + * @param _tokenId uint256 ID of the token to be added to the tokens list of the given address + */ + function addTokenTo(address _to, uint256 _tokenId) internal { + require(tokenOwner[_tokenId] == address(0)); + tokenOwner[_tokenId] = _to; + ownedTokensCount[_to] = ownedTokensCount[_to].add(1); + } + + /** + * @dev Internal function to remove a token ID from the list of a given address + * @param _from address representing the previous owner of the given token ID + * @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address + */ + function removeTokenFrom(address _from, uint256 _tokenId) internal { + require(ownerOf(_tokenId) == _from); + ownedTokensCount[_from] = ownedTokensCount[_from].sub(1); + tokenOwner[_tokenId] = address(0); + } + + /** + * @dev Internal function to invoke `onERC721Received` on a target address + * The call is not executed if the target address is not a contract + * @param _from address representing the previous owner of the given token ID + * @param _to target address that will receive the tokens + * @param _tokenId uint256 ID of the token to be transferred + * @param _data bytes optional data to send along with the call + * @return whether the call correctly returned the expected magic value + */ + function checkAndCallSafeTransfer( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + internal + returns (bool) + { + if (!_to.isContract()) { + return true; + } + bytes4 retval = ERC721Receiver(_to).onERC721Received( + msg.sender, _from, _tokenId, _data); + return (retval == ERC721_RECEIVED); + } +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721BasicToken.sol"; +// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; + + +/** + * @title Full ERC721 Token + * This implementation includes all the required and some optional functionality of the ERC721 standard + * Moreover, it includes approve all functionality using operator terminology + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 { + + // Token name + string internal name_; + + // Token symbol + string internal symbol_; + + // Mapping from owner to list of owned token IDs + mapping(address => uint256[]) internal ownedTokens; + + // Mapping from token ID to index of the owner tokens list + mapping(uint256 => uint256) internal ownedTokensIndex; + + // Array with all token ids, used for enumeration + uint256[] internal allTokens; + + // Mapping from token id to position in the allTokens array + mapping(uint256 => uint256) internal allTokensIndex; + + // Optional mapping for token URIs + mapping(uint256 => string) internal tokenURIs; + + /** + * @dev Constructor function + */ + constructor(string _name, string _symbol) public { + name_ = _name; + symbol_ = _symbol; + + // register the supported interfaces to conform to ERC721 via ERC165 + _registerInterface(InterfaceId_ERC721Enumerable); + _registerInterface(InterfaceId_ERC721Metadata); + } + + /** + * @dev Gets the token name + * @return string representing the token name + */ + function name() external view returns (string) { + return name_; + } + + /** + * @dev Gets the token symbol + * @return string representing the token symbol + */ + function symbol() external view returns (string) { + return symbol_; + } + + /** + * @dev Returns an URI for a given token ID + * Throws if the token ID does not exist. May return an empty string. + * @param _tokenId uint256 ID of the token to query + */ + function tokenURI(uint256 _tokenId) public view returns (string) { + require(exists(_tokenId)); + return tokenURIs[_tokenId]; + } + + /** + * @dev Gets the token ID at a given index of the tokens list of the requested owner + * @param _owner address owning the tokens list to be accessed + * @param _index uint256 representing the index to be accessed of the requested tokens list + * @return uint256 token ID at the given index of the tokens list owned by the requested address + */ + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256) + { + require(_index < balanceOf(_owner)); + return ownedTokens[_owner][_index]; + } + + /** + * @dev Gets the total amount of tokens stored by the contract + * @return uint256 representing the total amount of tokens + */ + function totalSupply() public view returns (uint256) { + return allTokens.length; + } + + /** + * @dev Gets the token ID at a given index of all the tokens in this contract + * Reverts if the index is greater or equal to the total number of tokens + * @param _index uint256 representing the index to be accessed of the tokens list + * @return uint256 token ID at the given index of the tokens list + */ + function tokenByIndex(uint256 _index) public view returns (uint256) { + require(_index < totalSupply()); + return allTokens[_index]; + } + + /** + * @dev Internal function to set the token URI for a given token + * Reverts if the token ID does not exist + * @param _tokenId uint256 ID of the token to set its URI + * @param _uri string URI to assign + */ + function _setTokenURI(uint256 _tokenId, string _uri) internal { + require(exists(_tokenId)); + tokenURIs[_tokenId] = _uri; + } + + /** + * @dev Internal function to add a token ID to the list of a given address + * @param _to address representing the new owner of the given token ID + * @param _tokenId uint256 ID of the token to be added to the tokens list of the given address + */ + function addTokenTo(address _to, uint256 _tokenId) internal { + super.addTokenTo(_to, _tokenId); + uint256 length = ownedTokens[_to].length; + ownedTokens[_to].push(_tokenId); + ownedTokensIndex[_tokenId] = length; + } + + /** + * @dev Internal function to remove a token ID from the list of a given address + * @param _from address representing the previous owner of the given token ID + * @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address + */ + function removeTokenFrom(address _from, uint256 _tokenId) internal { + super.removeTokenFrom(_from, _tokenId); + + // To prevent a gap in the array, we store the last token in the index of the token to delete, and + // then delete the last slot. + uint256 tokenIndex = ownedTokensIndex[_tokenId]; + uint256 lastTokenIndex = ownedTokens[_from].length.sub(1); + uint256 lastToken = ownedTokens[_from][lastTokenIndex]; + + ownedTokens[_from][tokenIndex] = lastToken; + // This also deletes the contents at the last position of the array + ownedTokens[_from].length--; + + // Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to + // be zero. Then we can make sure that we will remove _tokenId from the ownedTokens list since we are first swapping + // the lastToken to the first position, and then dropping the element placed in the last position of the list + + ownedTokensIndex[_tokenId] = 0; + ownedTokensIndex[lastToken] = tokenIndex; + } + + /** + * @dev Internal function to mint a new token + * Reverts if the given token ID already exists + * @param _to address the beneficiary that will own the minted token + * @param _tokenId uint256 ID of the token to be minted by the msg.sender + */ + function _mint(address _to, uint256 _tokenId) internal { + super._mint(_to, _tokenId); + + allTokensIndex[_tokenId] = allTokens.length; + allTokens.push(_tokenId); + } + + /** + * @dev Internal function to burn a specific token + * Reverts if the token does not exist + * @param _owner owner of the token to burn + * @param _tokenId uint256 ID of the token being burned by the msg.sender + */ + function _burn(address _owner, uint256 _tokenId) internal { + super._burn(_owner, _tokenId); + + // Clear metadata (if any) + if (bytes(tokenURIs[_tokenId]).length != 0) { + delete tokenURIs[_tokenId]; + } + + // Reorg all tokens array + uint256 tokenIndex = allTokensIndex[_tokenId]; + uint256 lastTokenIndex = allTokens.length.sub(1); + uint256 lastToken = allTokens[lastTokenIndex]; + + allTokens[tokenIndex] = lastToken; + allTokens[lastTokenIndex] = 0; + + allTokens.length--; + allTokensIndex[_tokenId] = 0; + allTokensIndex[lastToken] = tokenIndex; + } + +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IInterstellarEncoder.sol + +// pragma solidity ^0.4.24; + +contract IInterstellarEncoder { + uint256 constant CLEAR_HIGH = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; + + uint256 public constant MAGIC_NUMBER = 42; // Interstellar Encoding Magic Number. + uint256 public constant CHAIN_ID = 1; // Ethereum mainet. + uint256 public constant CURRENT_LAND = 1; // 1 is Atlantis, 0 is NaN. + + enum ObjectClass { + NaN, + LAND, + APOSTLE, + OBJECT_CLASS_COUNT + } + + function registerNewObjectClass(address _objectContract, uint8 objectClass) public; + + function registerNewTokenContract(address _tokenAddress) public; + + function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectIndex) public view returns (uint256 _tokenId); + + function encodeTokenIdForObjectContract( + address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId); + + function getContractAddress(uint256 _tokenId) public view returns (address); + + function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId); + + function getObjectClass(uint256 _tokenId) public view returns (uint8); + + function getObjectAddress(uint256 _tokenId) public view returns (address); +} + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: @evolutionland/common/contracts/ObjectOwnership.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol"; +// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoder.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/DSAuth.sol"; +// import "@evolutionland/common/contracts/SettingIds.sol"; + +contract ObjectOwnership is ERC721Token("Evolution Land Objects","EVO"), DSAuth, SettingIds { + ISettingsRegistry public registry; + + bool private singletonLock = false; + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + /** + * @dev Atlantis's constructor + */ + constructor () public { + // initializeContract(); + } + + /** + * @dev Same with constructor, but is used and called by storage proxy as logic contract. + */ + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + // SupportsInterfaceWithLookup constructor + _registerInterface(InterfaceId_ERC165); + + // ERC721BasicToken constructor + _registerInterface(InterfaceId_ERC721); + _registerInterface(InterfaceId_ERC721Exists); + + // ERC721Token constructor + name_ = "Evolution Land Objects"; + symbol_ = "EVO"; // Evolution Land Objects + // register the supported interfaces to conform to ERC721 via ERC165 + _registerInterface(InterfaceId_ERC721Enumerable); + _registerInterface(InterfaceId_ERC721Metadata); + + registry = ISettingsRegistry(_registry); + } + + function mintObject(address _to, uint128 _objectId) public auth returns (uint256 _tokenId) { + address interstellarEncoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); + + _tokenId = IInterstellarEncoder(interstellarEncoder).encodeTokenIdForObjectContract( + address(this), msg.sender, _objectId); + super._mint(_to, _tokenId); + } + + function burnObject(address _to, uint128 _objectId) public auth returns (uint256 _tokenId) { + address interstellarEncoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); + + _tokenId = IInterstellarEncoder(interstellarEncoder).encodeTokenIdForObjectContract( + address(this), msg.sender, _objectId); + super._burn(_to, _tokenId); + } + + function mint(address _to, uint256 _tokenId) public auth { + super._mint(_to, _tokenId); + } + + function burn(address _to, uint256 _tokenId) public auth { + super._burn(_to, _tokenId); + } + + //@dev user invoke approveAndCall to create auction + //@param _to - address of auction contractß + function approveAndCall( + address _to, + uint _tokenId, + bytes _extraData + ) public { + // set _to to the auction contract + approve(_to, _tokenId); + + if(!_to.call( + bytes4(keccak256("receiveApproval(address,uint256,bytes)")), abi.encode(msg.sender, _tokenId, _extraData) + )) { + revert(); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol + +// pragma solidity ^0.4.24; + +contract IInterstellarEncoderV3 { + uint256 constant CLEAR_HIGH = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; + + uint256 public constant MAGIC_NUMBER = 42; // Interstellar Encoding Magic Number. + uint256 public constant CHAIN_ID = 1; // Ethereum mainet. + uint256 public constant CURRENT_LAND = 1; // 1 is Atlantis, 0 is NaN. + + enum ObjectClass { + NaN, + LAND, + APOSTLE, + OBJECT_CLASS_COUNT + } + + function registerNewObjectClass(address _objectContract, uint8 objectClass) public; + + function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectIndex) public view returns (uint256 _tokenId); + + function encodeTokenIdForObjectContract( + address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId); + + function encodeTokenIdForOuterObjectContract( + address _objectContract, address nftAddress, address _originNftAddress, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256); + + function getContractAddress(uint256 _tokenId) public view returns (address); + + function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId); + + function getObjectClass(uint256 _tokenId) public view returns (uint8); + + function getObjectAddress(uint256 _tokenId) public view returns (address); + + function getProducerId(uint256 _tokenId) public view returns (uint16); + + function getOriginAddress(uint256 _tokenId) public view returns (address); + +} + +// Dependency file: @evolutionland/common/contracts/InterstellarEncoderV3.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol"; + +// TODO: upgrade. +contract InterstellarEncoderV3 is IInterstellarEncoderV3, Ownable { + // [magic_number, chain_id, contract_id <2>, origin_chain_id, origin_contract_id<2>, object_class, convert_type, <6>, land, <128>] + mapping(uint8 => address) public ownershipId2Address; + mapping(address => uint8) public ownershipAddress2Id; + + mapping(address => uint8) public classAddress2Id; // class + // extended since V2 + mapping(uint8 => address) public classId2Address; + + function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectId) public view returns (uint256 _tokenId) { + uint16 contractId = ownershipAddress2Id[_tokenAddress]; + require(ownershipAddress2Id[_tokenAddress] > 0, "Contract address does not exist"); + + _tokenId = (MAGIC_NUMBER << 248) + (CHAIN_ID << 240) + (uint256(contractId) << 224) + + (CHAIN_ID << 216) + (uint256(contractId) << 200) + (uint256(_objectClass) << 192) + (CURRENT_LAND << 128) + uint256(_objectId); + } + + function encodeTokenIdForOuter( + address _nftAddress, address _originNftAddress, uint8 _objectClass, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256) { + uint16 contractId = ownershipAddress2Id[_nftAddress]; + uint16 originContractId = ownershipAddress2Id[_originNftAddress]; + require(contractId > 0 && originContractId > 0 && _producerId > 0, "Contract address does not exist"); + + uint256 tokenId = (MAGIC_NUMBER << 248) + (CHAIN_ID << 240) + (uint256(contractId) << 224) + + (CHAIN_ID << 216) + (uint256(originContractId) << 200) + (uint256(_objectClass) << 192) + (uint256(_convertType) << 184)+ (uint256(_producerId) << 128) + uint256(_objectId); + + return tokenId; + } + + // TODO; newly added + // @param _tokenAddress - objectOwnership + // @param _objectContract - xxxBase contract + function encodeTokenIdForOuterObjectContract( + address _objectContract, address _nftAddress, address _originNftAddress, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256) { + require (classAddress2Id[_objectContract] > 0, "Object class for this object contract does not exist."); + + return encodeTokenIdForOuter(_nftAddress, _originNftAddress, classAddress2Id[_objectContract], _objectId, _producerId, _convertType); + + } + // TODO; newly added + function encodeTokenIdForObjectContract( + address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId) { + require (classAddress2Id[_objectContract] > 0, "Object class for this object contract does not exist."); + + _tokenId = encodeTokenId(_tokenAddress, classAddress2Id[_objectContract], _objectId); + } + + function registerNewOwnershipContract(address _nftAddress, uint8 _nftId) public onlyOwner { + ownershipAddress2Id[_nftAddress] = _nftId; + ownershipId2Address[_nftId] = _nftAddress; + } + + function registerNewObjectClass(address _objectContract, uint8 _objectClass) public onlyOwner { + classAddress2Id[_objectContract] = _objectClass; + classId2Address[_objectClass] = _objectContract; + } + + function getProducerId(uint256 _tokenId) public view returns (uint16) { + return uint16((_tokenId >> 128) & 0xff); + } + + function getContractAddress(uint256 _tokenId) public view returns (address) { + return ownershipId2Address[uint8((_tokenId >> 240) & 0xff)]; + } + + function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId) { + return uint128(_tokenId & CLEAR_HIGH); + } + + function getObjectClass(uint256 _tokenId) public view returns (uint8) { + return uint8((_tokenId << 56) >> 248); + } + + function getObjectAddress(uint256 _tokenId) public view returns (address) { + return classId2Address[uint8((_tokenId << 56) >> 248)]; + } + + // TODO; newly added + function getOriginAddress(uint256 _tokenId) public view returns (address) { + uint8 originContractId = uint8((_tokenId >> 200) & 0xff); + return ownershipId2Address[originContractId]; + + } +} + +// Dependency file: @evolutionland/common/contracts/InterstellarEncoderV2.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; +// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoder.sol"; + +// TODO: upgrade. +contract InterstellarEncoderV2 is IInterstellarEncoder, Ownable { + // [magic_number, chain_id, contract_id <2>, origin_chain_id, origin_contract_id<2>, object_class, convert_type, <6>, land, <128>] + mapping(uint16 => address) public contractId2Address; + mapping(address => uint16) public contractAddress2Id; + + mapping(address => uint8) public objectContract2ObjectClass; + + uint16 public lastContractId = 0; + + // extended since V2 + mapping(uint8 => address) public objectClass2ObjectContract; + + function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectId) public view returns (uint256 _tokenId) { + uint16 contractId = contractAddress2Id[_tokenAddress]; + require(contractAddress2Id[_tokenAddress] > 0, "Contract address does not exist"); + + _tokenId = (MAGIC_NUMBER << 248) + (CHAIN_ID << 240) + (uint256(contractId) << 224) + + (CHAIN_ID << 216) + (uint256(contractId) << 200) + (uint256(_objectClass) << 192) + (CURRENT_LAND << 128) + uint256(_objectId); + } + + function encodeTokenIdForObjectContract( + address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId) { + require (objectContract2ObjectClass[_objectContract] > 0, "Object class for this object contract does not exist."); + + _tokenId = encodeTokenId(_tokenAddress, objectContract2ObjectClass[_objectContract], _objectId); + } + + function registerNewTokenContract(address _tokenAddress) public onlyOwner { + require(contractAddress2Id[_tokenAddress] == 0, "Contract address already exist"); + require(lastContractId < 65535, "Contract Id already reach maximum."); + + lastContractId += 1; + + contractAddress2Id[_tokenAddress] = lastContractId; + contractId2Address[lastContractId] = _tokenAddress; + } + + function registerNewObjectClass(address _objectContract, uint8 _objectClass) public onlyOwner { + objectContract2ObjectClass[_objectContract] = _objectClass; + objectClass2ObjectContract[_objectClass] = _objectContract; + } + + function getContractAddress(uint256 _tokenId) public view returns (address) { + return contractId2Address[uint16((_tokenId << 16) >> 240)]; + } + + function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId) { + return uint128(_tokenId & CLEAR_HIGH); + } + + function getObjectClass(uint256 _tokenId) public view returns (uint8) { + return uint8((_tokenId << 56) >> 248); + } + + function getObjectAddress(uint256 _tokenId) public view returns (address) { + return objectClass2ObjectContract[uint8((_tokenId << 56) >> 248)]; + } +} + +// Dependency file: @evolutionland/upgraeability-using-unstructured-storage/contracts/Proxy.sol + +// pragma solidity ^0.4.21; + +/** + * @title Proxy + * @dev Gives the possibility to delegate any call to a foreign implementation. + */ +contract Proxy { + /** + * @dev Tells the address of the implementation where every call will be delegated. + * @return address of the implementation to which it will be delegated + */ + function implementation() public view returns (address); + + /** + * @dev Fallback function allowing to perform a delegatecall to the given implementation. + * This function will return whatever the implementation call returns + */ + function () payable public { + address _impl = implementation(); + require(_impl != address(0)); + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0) + let size := returndatasize + returndatacopy(ptr, 0, size) + + switch result + case 0 { revert(ptr, size) } + default { return(ptr, size) } + } + } +} + + +// Dependency file: @evolutionland/upgraeability-using-unstructured-storage/contracts/UpgradeabilityProxy.sol + +// pragma solidity ^0.4.21; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/upgraeability-using-unstructured-storage/contracts/Proxy.sol'; + +/** + * @title UpgradeabilityProxy + * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded + */ +contract UpgradeabilityProxy is Proxy { + /** + * @dev This event will be emitted every time the implementation gets upgraded + * @param implementation representing the address of the upgraded implementation + */ + event Upgraded(address indexed implementation); + + // Storage position of the address of the current implementation + bytes32 private constant implementationPosition = keccak256("org.zeppelinos.proxy.implementation"); + + /** + * @dev Constructor function + */ + function UpgradeabilityProxy() public {} + + /** + * @dev Tells the address of the current implementation + * @return address of the current implementation + */ + function implementation() public view returns (address impl) { + bytes32 position = implementationPosition; + assembly { + impl := sload(position) + } + } + + /** + * @dev Sets the address of the current implementation + * @param newImplementation address representing the new implementation to be set + */ + function setImplementation(address newImplementation) internal { + bytes32 position = implementationPosition; + assembly { + sstore(position, newImplementation) + } + } + + /** + * @dev Upgrades the implementation address + * @param newImplementation representing the address of the new implementation to be set + */ + function _upgradeTo(address newImplementation) internal { + address currentImplementation = implementation(); + require(currentImplementation != newImplementation); + setImplementation(newImplementation); + emit Upgraded(newImplementation); + } +} + + +// Dependency file: @evolutionland/upgraeability-using-unstructured-storage/contracts/OwnedUpgradeabilityProxy.sol + +// pragma solidity ^0.4.21; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/upgraeability-using-unstructured-storage/contracts/UpgradeabilityProxy.sol'; + +/** + * @title OwnedUpgradeabilityProxy + * @dev This contract combines an upgradeability proxy with basic authorization control functionalities + */ +contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { + /** + * @dev Event to show ownership has been transferred + * @param previousOwner representing the address of the previous owner + * @param newOwner representing the address of the new owner + */ + event ProxyOwnershipTransferred(address previousOwner, address newOwner); + + // Storage position of the owner of the contract + bytes32 private constant proxyOwnerPosition = keccak256("org.zeppelinos.proxy.owner"); + + /** + * @dev the constructor sets the original owner of the contract to the sender account. + */ + function OwnedUpgradeabilityProxy() public { + setUpgradeabilityOwner(msg.sender); + } + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyProxyOwner() { + require(msg.sender == proxyOwner()); + _; + } + + /** + * @dev Tells the address of the owner + * @return the address of the owner + */ + function proxyOwner() public view returns (address owner) { + bytes32 position = proxyOwnerPosition; + assembly { + owner := sload(position) + } + } + + /** + * @dev Sets the address of the owner + */ + function setUpgradeabilityOwner(address newProxyOwner) internal { + bytes32 position = proxyOwnerPosition; + assembly { + sstore(position, newProxyOwner) + } + } + + /** + * @dev Allows the current owner to transfer control of the contract to a newOwner. + * @param newOwner The address to transfer ownership to. + */ + function transferProxyOwnership(address newOwner) public onlyProxyOwner { + require(newOwner != address(0)); + emit ProxyOwnershipTransferred(proxyOwner(), newOwner); + setUpgradeabilityOwner(newOwner); + } + + /** + * @dev Allows the proxy owner to upgrade the current version of the proxy. + * @param implementation representing the address of the new implementation to be set. + */ + function upgradeTo(address implementation) public onlyProxyOwner { + _upgradeTo(implementation); + } + + /** + * @dev Allows the proxy owner to upgrade the current version of the proxy and call the new implementation + * to initialize whatever is needed through a low level call. + * @param implementation representing the address of the new implementation to be set. + * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function + * signature of the implementation to be called with the needed payload + */ + function upgradeToAndCall(address implementation, bytes data) payable public onlyProxyOwner { + upgradeTo(implementation); + require(this.call.value(msg.value)(data)); + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IMintableERC20.sol + +// pragma solidity ^0.4.23; + +contract IMintableERC20 { + + function mint(address _to, uint256 _value) public; +} + +// Dependency file: @evolutionland/common/contracts/interfaces/INFTAdaptor.sol + +// pragma solidity ^0.4.24; + + +contract INFTAdaptor { + function toMirrorTokenId(uint256 _originTokenId) public view returns (uint256); + + function toOriginTokenId(uint256 _mirrorTokenId) public view returns (uint256); + + function approveOriginToken(address _bridge, uint256 _originTokenId) public; + + function ownerInOrigin(uint256 _originTokenId) public view returns (address); + + function cacheMirrorTokenId(uint256 _originTokenId, uint256 _mirrorTokenId) public; +} + + +// Dependency file: @evolutionland/common/contracts/ERC721Bridge.sol + +// pragma solidity ^0.4.23; + +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/SettingIds.sol"; +// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol"; +// import "@evolutionland/common/contracts/interfaces/IMintableERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/INFTAdaptor.sol"; +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; + + +/* + * naming convention: + * originTokenId - token outside evolutionLand + * mirrorTokenId - mirror token + */ +contract ERC721Bridge is SettingIds, PausableDSAuth { + + /* + * Storage + */ + bool private singletonLock = false; + + ISettingsRegistry public registry; + + + // originNFTContract => its adator + // for instance, CryptoKitties => CryptoKittiesAdaptor + // this need to be registered by owner + mapping(address => address) public originNFT2Adaptor; + + // tokenId_inside => tokenId_outside + mapping(uint256 => uint256) public mirrorId2OriginId; + + /* + * Event + */ + event BridgeIn(uint256 originTokenId, uint256 mirrorTokenId, address originContract, address adaptorAddress, address owner); + + event SwapIn(uint256 originTokenId, uint256 mirrorTokenId, address owner); + event SwapOut(uint256 originTokenId, uint256 mirrorTokenId, address owner); + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + function initializeContract(ISettingsRegistry _registry) public singletonLockCall { + owner = msg.sender; + emit LogSetOwner(msg.sender); + registry = _registry; + } + + function registerAdaptor(address _originNftAddress, address _erc721Adaptor) public whenNotPaused onlyOwner { + originNFT2Adaptor[_originNftAddress] = _erc721Adaptor; + } + + // used by PetBase + function bridgeInAuth(address _originNftAddress, uint256 _originTokenId, address _owner) public auth returns (uint256) { + return _bridgeIn(_originNftAddress, _originTokenId, _owner); + } + + + // generate new mirror token without origin token frozen + function bridgeIn(address _originNftAddress, uint256 _originTokenId) public returns (uint256) { + _bridgeIn(_originNftAddress, _originTokenId, msg.sender); + } + + function _bridgeIn(address _originNftAddress, uint256 _originTokenId, address _owner) internal returns (uint256) { + address adaptor = originNFT2Adaptor[_originNftAddress]; + require(adaptor != address(0), "Not registered!"); + + require(INFTAdaptor(adaptor).ownerInOrigin(_originTokenId) == _owner, "Invalid owner!"); + + uint256 mirrorTokenId = INFTAdaptor(adaptor).toMirrorTokenId(_originTokenId); + + // if it is the first time to bridge in + if (!isBridged(mirrorTokenId)) { + // keep new mirror object in this contract + // before the owner has transferred his/her outerObject into this contract + // mirror object can not be transferred + address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); + IMintableERC20(objectOwnership).mint(address(this), mirrorTokenId); + + // link objects_in and objects_out + INFTAdaptor(adaptor).cacheMirrorTokenId(_originTokenId, mirrorTokenId); + mirrorId2OriginId[mirrorTokenId] = _originTokenId; + + emit BridgeIn(_originTokenId, mirrorTokenId, _originNftAddress, adaptor, _owner); + } + + return mirrorTokenId; + } + + // freeze origin token to free mirror token + function swapIn(address _originNftAddress, uint256 _originTokenId) public { + require(ERC721(_originNftAddress).ownerOf(_originTokenId) == msg.sender, "Invalid owner!"); + + address adaptor = originNFT2Adaptor[_originNftAddress]; + require(adaptor != address(0), "Not registered!"); + + // all specific originTokens are kept in bridge + ERC721(_originNftAddress).transferFrom(msg.sender, address(this), _originTokenId); + + uint256 mirrorTokenId = INFTAdaptor(adaptor).toMirrorTokenId(_originTokenId); + address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); + ERC721(objectOwnership).transferFrom(address(this), msg.sender, mirrorTokenId); + + emit SwapIn(_originTokenId, mirrorTokenId, msg.sender); + } + + function bridgeAndSwapIn(address _originNftAddress, uint256 _originTokenId) public { + bridgeIn(_originNftAddress, _originTokenId); + swapIn(_originNftAddress, _originTokenId); + } + + function swapOut(uint256 _mirrorTokenId) public { + IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); + address nftContract = interstellarEncoder.getContractAddress(_mirrorTokenId); + require(nftContract != address(0), "No such NFT contract"); + address adaptor = originNFT2Adaptor[nftContract]; + require(adaptor != address(0), "not registered!"); + require(ownerOfMirror(_mirrorTokenId) == msg.sender, "you have no right to swap it out!"); + + // TODO: if it is needed to check its current status + uint256 originTokenId = mirrorId2OriginId[_mirrorTokenId]; + address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); + ERC721(objectOwnership).transferFrom(msg.sender, address(this), _mirrorTokenId); + ERC721(nftContract).transferFrom(address(this), msg.sender, originTokenId); + + emit SwapOut(originTokenId, _mirrorTokenId, msg.sender); + } + + function approveOriginToken(address _originNFT, address _approved, uint256 _originTokenId) public auth { + ERC721(_originNFT).approve(_approved, _originTokenId); + } + + function ownerOf(uint256 _mirrorTokenId) public view returns (address) { + return ownerOfMirror(_mirrorTokenId); + } + + // return human owner of the token + function mirrorOfOrigin(address _originNFT, uint256 _originTokenId) public view returns (uint256) { + INFTAdaptor adapter = INFTAdaptor(originNFT2Adaptor[_originNFT]); + + return adapter.toMirrorTokenId(_originTokenId); + } + + // return human owner of the token + function ownerOfMirror(uint256 _mirrorTokenId) public view returns (address) { + address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); + address owner = ERC721(objectOwnership).ownerOf(_mirrorTokenId); + if(owner != address(this)) { + return owner; + } else { + uint originTokenId = mirrorId2OriginId[_mirrorTokenId]; + return INFTAdaptor(originNFT2Adaptor[originOwnershipAddress(_mirrorTokenId)]).ownerInOrigin(originTokenId); + } + } + + function originOwnershipAddress(uint256 _mirrorTokenId) public view returns (address) { + IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); + + return interstellarEncoder.getOriginAddress(_mirrorTokenId); + } + + function isBridged(uint256 _mirrorTokenId) public view returns (bool) { + return (mirrorId2OriginId[_mirrorTokenId] != 0); + } +} + + +// Root file: contracts/Migrations.sol + +pragma solidity ^0.4.23; +// import "@evolutionland/common/contracts/ObjectOwnershipAuthority.sol"; +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/SettingsRegistry.sol'; +// import "@evolutionland/common/contracts/ObjectOwnership.sol"; +// import "@evolutionland/common/contracts/InterstellarEncoderV3.sol"; +// import "@evolutionland/common/contracts/InterstellarEncoderV2.sol"; +// import "@evolutionland/upgraeability-using-unstructured-storage/contracts/OwnedUpgradeabilityProxy.sol"; +// import "@evolutionland/common/contracts/ERC721Bridge.sol"; + +contract Migrations { + address public owner; + uint public last_completed_migration; + + constructor() public { + owner = msg.sender; + } + + modifier restricted() { + if (msg.sender == owner) _; + } + + function setCompleted(uint completed) public restricted { + last_completed_migration = completed; + } + + function upgrade(address new_address) public restricted { + Migrations upgraded = Migrations(new_address); + upgraded.setCompleted(last_completed_migration); + } +} diff --git a/contracts-flattener/PetBase.sol b/contracts-flattener/PetBase.sol new file mode 100644 index 0000000..7951eac --- /dev/null +++ b/contracts-flattener/PetBase.sol @@ -0,0 +1,842 @@ +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/INFTAdaptor.sol + +// pragma solidity ^0.4.24; + + +contract INFTAdaptor { + function toMirrorTokenId(uint256 _originTokenId) public view returns (uint256); + + function toOriginTokenId(uint256 _mirrorTokenId) public view returns (uint256); + + function approveOriginToken(address _bridge, uint256 _originTokenId) public; + + function ownerInOrigin(uint256 _originTokenId) public view returns (address); + + function cacheMirrorTokenId(uint256 _originTokenId, uint256 _mirrorTokenId) public; +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol + +// pragma solidity ^0.4.24; + +contract IInterstellarEncoderV3 { + uint256 constant CLEAR_HIGH = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; + + uint256 public constant MAGIC_NUMBER = 42; // Interstellar Encoding Magic Number. + uint256 public constant CHAIN_ID = 1; // Ethereum mainet. + uint256 public constant CURRENT_LAND = 1; // 1 is Atlantis, 0 is NaN. + + enum ObjectClass { + NaN, + LAND, + APOSTLE, + OBJECT_CLASS_COUNT + } + + function registerNewObjectClass(address _objectContract, uint8 objectClass) public; + + function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectIndex) public view returns (uint256 _tokenId); + + function encodeTokenIdForObjectContract( + address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId); + + function encodeTokenIdForOuterObjectContract( + address _objectContract, address nftAddress, address _originNftAddress, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256); + + function getContractAddress(uint256 _tokenId) public view returns (address); + + function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId); + + function getObjectClass(uint256 _tokenId) public view returns (uint8); + + function getObjectAddress(uint256 _tokenId) public view returns (address); + + function getProducerId(uint256 _tokenId) public view returns (uint16); + + function getOriginAddress(uint256 _tokenId) public view returns (address); + +} + +// Dependency file: contracts/interfaces/IApostleBase.sol + +// pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} + +// Dependency file: contracts/interfaces/IERC721Bridge.sol + +// pragma solidity ^0.4.24; + +contract IERC721Bridge { + + + function originNft2Adaptor(address _originContract) public view returns (address); + + function ownerOf(uint256 _mirrorTokenId) public view returns (address); + + function isBridged(uint256 _mirrorTokenId) public view returns (bool); + + function bridgeInAuth(address _originNftAddress, uint256 _originTokenId, address _owner) public returns (uint256); +} + + +// Dependency file: contracts/interfaces/IGeneScience.sol + +// pragma solidity ^0.4.24; + + +/// @title defined the interface that will be referenced in main Kitty contract +contract IGeneScience { + /// @dev simply a boolean to indicate this is the contract we expect to be + function isGeneScience() public pure returns (bool); + + /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor + /// @param genes1 genes of mom + /// @param genes2 genes of sire + /// @param talents1 talents of mom + /// @param talents2 talents of sire + /// @return the genes and talents that are supposed to be passed down the child + function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); + + function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); + + function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); + + function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); + + function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); +} + + +// Dependency file: contracts/interfaces/ILandResource.sol + +// pragma solidity ^0.4.23; + +contract ILandResource { + + function updateMinerStrengthWhenStart(uint256 _apostleTokenId) public; + + function updateMinerStrengthWhenStop(uint256 _apostleTokenId) public; + + function landWorkingOn(uint256 _apostleTokenId) public view returns (uint256); +} + + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol + +// pragma solidity ^0.4.24; + + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + // Gas optimization: this is cheaper than asserting 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (_a == 0) { + return 0; + } + + 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 _a / _b; + } + + /** + * @dev Subtracts 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 c) { + c = _a + _b; + assert(c >= _a); + return c; + } +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IObjectOwnership.sol + +// pragma solidity ^0.4.24; + +contract IObjectOwnership { + function mintObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); + + function burnObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); +} + +// Root file: contracts/pet/PetBase.sol + +pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/interfaces/INFTAdaptor.sol"; +// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol"; +// import "contracts/interfaces/IApostleBase.sol"; +// import "contracts/interfaces/IERC721Bridge.sol"; +// import "contracts/interfaces/IGeneScience.sol"; +// import "contracts/interfaces/ILandResource.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; + +contract PetBase is PausableDSAuth, ApostleSettingIds { + + using SafeMath for *; + + /* + * Storage + */ + bool private singletonLock = false; + + ISettingsRegistry public registry; + + uint128 public lastPetObjectId; + + uint128 public maxTiedNumber; + + struct PetStatus { + uint128 maxTiedNumber; + uint128 tiedCount; + uint256[] tiedList; + } + + struct TiedStatus { + uint256 apostleTokenId; + uint256 index; + } + + mapping(uint256 => PetStatus) public tokenId2PetStatus; + mapping(uint256 => TiedStatus) public pet2TiedStatus; + + event Tied(uint256 apostleTokenId, uint256 mirrorTokenId, uint256 enhancedTalents, bool changed, address originNFT, address owner); + event UnTied(uint256 apostleTokenId, uint256 mirrorTokenId, uint256 enhancedTalents, bool changed, address originNFT, address owner); + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + function initializeContract(ISettingsRegistry _registry, uint128 _number) public singletonLockCall { + owner = msg.sender; + emit LogSetOwner(msg.sender); + registry = _registry; + maxTiedNumber = _number; + } + + + // TODO: it can be more specific afterwards + function createPet(address _owner) public auth returns (uint256) { + + lastPetObjectId += 1; + require(lastPetObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastPetObjectId)); + + return tokenId; + } + + function bridgeInAndTie(address _originNftAddress, uint256 _originTokenId, uint256 _apostleTokenId) public { + address erc721Bridge = registry.addressOf(SettingIds.CONTRACT_ERC721_BRIDGE); + uint256 mirrorTokenId = IERC721Bridge(erc721Bridge).bridgeInAuth(_originNftAddress, _originTokenId, msg.sender); + _tiePetTokenToApostle(mirrorTokenId, _apostleTokenId, msg.sender, _originNftAddress); + } + + // any one can use it + function tiePetTokenToApostle(uint256 _mirrorTokenId, uint256 _apostleTokenId) public { + IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); + address originAddress = interstellarEncoder.getOriginAddress(_mirrorTokenId); + + _tiePetTokenToApostle(_mirrorTokenId, _apostleTokenId, msg.sender, originAddress); + } + + + function _tiePetTokenToApostle(uint256 _petTokenId, uint256 _apostleTokenId, address _owner, address _originAddress) internal { + if (tokenId2PetStatus[_apostleTokenId].maxTiedNumber == 0) { + tokenId2PetStatus[_apostleTokenId].maxTiedNumber = maxTiedNumber; + } + + require(pet2TiedStatus[_petTokenId].apostleTokenId == 0, "it has already been tied."); + tokenId2PetStatus[_apostleTokenId].tiedCount += 1; + require(tokenId2PetStatus[_apostleTokenId].tiedCount <= tokenId2PetStatus[_apostleTokenId].maxTiedNumber); + + uint256 index = tokenId2PetStatus[_apostleTokenId].tiedList.length; + tokenId2PetStatus[_apostleTokenId].tiedList.push(_petTokenId); + + pet2TiedStatus[_petTokenId] = TiedStatus({ + apostleTokenId : _apostleTokenId, + index : index + }); + + + // TODO: update gene, through apostleBase + address apostleBase = registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE); + uint256 talents; + uint256 genes; + (genes, talents, ,,,,,,,) = IApostleBase(apostleBase).getApostleInfo(_apostleTokenId); + uint256 enhancedTalents = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).enhanceWithMirrorToken(talents, _petTokenId); + + bool changed = _updateTalentsAndMinerStrength(_petTokenId, _apostleTokenId, genes, talents, enhancedTalents, _owner); + + emit Tied(_apostleTokenId, _petTokenId, enhancedTalents, changed, _originAddress, _owner); + } + + + function _updateTalentsAndMinerStrength(uint256 _petTokenId, uint256 _apostleTokenId, uint256 _genes, uint256 _talents, uint256 _modifiedTalents, address _owner) internal returns (bool){ + address erc721Bridge = registry.addressOf(SettingIds.CONTRACT_ERC721_BRIDGE); + IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); + + // if the pet is from outside world + // it need to be bridged in + if (interstellarEncoder.getProducerId(_petTokenId) >= 256) { + + require(IERC721Bridge(erc721Bridge).isBridged(_petTokenId), "please bridged in first."); + } + + address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); + + // if this pet is inside evoland + // it will also be considered in erc721Bridge + require(IERC721Bridge(erc721Bridge).ownerOf(_petTokenId) == _owner || ERC721(objectOwnership).ownerOf(_apostleTokenId) == _owner, "you have no right."); + + + // TODO: update mine + // changed - true + bool changed = _talents == _modifiedTalents ? false : true; + if (changed) { + address landResource = registry.addressOf(CONTRACT_LAND_RESOURCE); + if (ILandResource(landResource).landWorkingOn(_apostleTokenId) != 0) { + // true means minus strength + ILandResource(landResource).updateMinerStrengthWhenStop(_apostleTokenId); + } + + IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).updateGenesAndTalents(_apostleTokenId, _genes, _modifiedTalents); + + if (ILandResource(landResource).landWorkingOn(_apostleTokenId) != 0) { + ILandResource(landResource).updateMinerStrengthWhenStart(_apostleTokenId); + } + } + + return changed; + } + + function untiePetToken(uint256 _petTokenId) public { + uint256 apostleTokenId = pet2TiedStatus[_petTokenId].apostleTokenId; + + // if pet is not tied, do nothing + if(apostleTokenId == 0) { + return; + } + + uint256 index = pet2TiedStatus[_petTokenId].index; + // update count + tokenId2PetStatus[apostleTokenId].tiedCount = uint128(uint256(tokenId2PetStatus[apostleTokenId].tiedCount).sub(1)); + + // update petList + uint256 lastPetIndex = uint128(tokenId2PetStatus[apostleTokenId].tiedList.length.sub(1)); + uint256 lastPet = tokenId2PetStatus[apostleTokenId].tiedList[lastPetIndex]; + + tokenId2PetStatus[apostleTokenId].tiedList[index] = lastPet; + tokenId2PetStatus[apostleTokenId].tiedList[lastPetIndex] = 0; + + tokenId2PetStatus[apostleTokenId].tiedList.length -= 1; + + // update lastPet's index + pet2TiedStatus[lastPet].index = index; + + delete pet2TiedStatus[_petTokenId]; + + + address apostleBase = registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE); + uint256 talents; + uint256 genes; + (genes, talents, ,,,,,,,) = IApostleBase(apostleBase).getApostleInfo(apostleTokenId); + uint256 weakenTalents = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).removeMirrorToken(talents, _petTokenId); + + + bool changed = _updateTalentsAndMinerStrength(_petTokenId, apostleTokenId, genes, talents, weakenTalents, msg.sender); + + IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); + address originAddress = interstellarEncoder.getOriginAddress(_petTokenId); + + emit UnTied(apostleTokenId, _petTokenId, weakenTalents, changed, originAddress, msg.sender); + + } + + function getTiedPet(uint256 _apostleTokenId, uint256 _index) public view returns (uint256) { + return tokenId2PetStatus[_apostleTokenId].tiedList[_index]; + } + +} diff --git a/contracts-flattener/PetBaseAuthority.sol b/contracts-flattener/PetBaseAuthority.sol new file mode 100644 index 0000000..ef4ea38 --- /dev/null +++ b/contracts-flattener/PetBaseAuthority.sol @@ -0,0 +1,19 @@ +// Root file: contracts/pet/PetBaseAuthority.sol + +pragma solidity ^0.4.24; + +contract PetBaseAuthority { + mapping (address => bool) public whiteList; + + constructor(address[] _whitelists) public { + for (uint i = 0; i < _whitelists.length; i ++) { + whiteList[_whitelists[i]] = true; + } + } + + function canCall( + address _src, address _dst, bytes4 _sig + ) public view returns (bool) { + return ( whiteList[_src] && _sig == bytes4(keccak256("createPet(address)")) ); + } +} \ No newline at end of file diff --git a/contracts-flattener/SiringAuctionBase.sol b/contracts-flattener/SiringAuctionBase.sol new file mode 100644 index 0000000..6805104 --- /dev/null +++ b/contracts-flattener/SiringAuctionBase.sol @@ -0,0 +1,737 @@ +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol + +// pragma solidity ^0.4.24; + + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + // Gas optimization: this is cheaper than asserting 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (_a == 0) { + return 0; + } + + 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 _a / _b; + } + + /** + * @dev Subtracts 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 c) { + c = _a + _b; + assert(c >= _a); + return c; + } +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol + +// pragma solidity ^0.4.24; + +contract ITokenUse { + uint48 public constant MAX_UINT48_TIME = 281474976710655; + + function isObjectInHireStage(uint256 _tokenId) public view returns (bool); + + function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); + + function getTokenUser(uint256 _tokenId) public view returns (address); + + function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; + + function cancelTokenUseOffer(uint256 _tokenId) public; + + function takeTokenUseOffer(uint256 _tokenId) public; + + function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; + + function removeActivity(uint256 _tokenId, address _user) public; +} + +// Dependency file: contracts/interfaces/IApostleBase.sol + +// pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} + +// Root file: contracts/SiringAuctionBase.sol + +pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +// import "contracts/interfaces/IApostleBase.sol"; + +/// @title Auction Core +/// @dev Contains models, variables, and internal methods for the auction. +contract SiringAuctionBase is ApostleSettingIds, PausableDSAuth { + using SafeMath for *; + + event AuctionCreated( + uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt + ); + event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); + event AuctionCancelled(uint256 tokenId); + + // Represents an auction on an NFT + struct Auction { + // Current owner of NFT + address seller; + // Price (in ring(wei)) at beginning of auction + uint128 startingPriceInToken; + // Price (in ring(wei)) at end of auction + uint128 endingPriceInToken; + // Duration (in seconds) of auction + uint48 duration; + // Time when auction started + // NOTE: 0 if this auction has been concluded + uint48 startedAt; + // bid with which token + address token; + } + + ISettingsRegistry public registry; + + // Map from token ID to their corresponding auction. + mapping (uint256 => Auction) public tokenIdToAuction; + + /// @dev DON'T give me your money. + function() external {} + + // Modifiers to check that inputs can be safely stored with a certain + // number of bits. We use constants and multiple modifiers to save gas. + modifier canBeStoredWith48Bits(uint256 _value) { + require(_value <= 281474976710655); + _; + } + + modifier canBeStoredWith128Bits(uint256 _value) { + require(_value < 340282366920938463463374607431768211455); + _; + } + + + /// @dev Creates and begins a new auction. + /// @param _tokenId - ID of token to auction, sender must be owner. + // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason + /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. + /// @param _endingPriceInToken - Price of item (in token) at end of auction. + /// @param _duration - Length of time to move between starting + /// price and ending price (in seconds). + /// @param _seller - Seller, if not the message sender + function _createAuction( + address _from, + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _seller, + address _token + ) + internal + canBeStoredWith128Bits(_startingPriceInToken) + canBeStoredWith128Bits(_endingPriceInToken) + canBeStoredWith48Bits(_duration) + canBeStoredWith48Bits(_startAt) + whenNotPaused + { + // Require that all auctions have a duration of + // at least one minute. (Keeps our math from getting hairy!) + require(_duration >= 1 minutes, "duration must be at least 1 minutes"); + require(_duration <= 1000 days); + + require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); + // escrow + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, address(this), _tokenId); + + tokenIdToAuction[_tokenId] = Auction({ + seller: _seller, + startedAt: uint48(_startAt), + duration: uint48(_duration), + startingPriceInToken: uint128(_startingPriceInToken), + endingPriceInToken: uint128(_endingPriceInToken), + token: _token + }); + + emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); + } + + /// @dev Cancels an auction unconditionally. + function _cancelAuction(uint256 _tokenId, address _seller) internal { + _removeAuction(_tokenId); + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), _seller, _tokenId); + emit AuctionCancelled(_tokenId); + } + + + /// @dev Removes an auction from the list of open auctions. + /// @param _tokenId - ID of NFT on auction. + function _removeAuction(uint256 _tokenId) internal { + delete tokenIdToAuction[_tokenId]; + } + + /// @dev Returns true if the NFT is on auction. + /// @param _auction - Auction to check. + function _isOnAuction(Auction storage _auction) internal view returns (bool) { + return (_auction.startedAt > 0); + } + + /// @dev Returns current price of an NFT on auction. Broken into two + /// functions (this one, that computes the duration from the auction + /// structure, and the other that does the price computation) so we + /// can easily test that the price computation works correctly. + function _currentPrice(Auction storage _auction) + internal + view + returns (uint256) + { + uint256 secondsPassed = 0; + + // A bit of insurance against negative values (or wraparound). + // Probably not necessary (since Ethereum guarnatees that the + // now variable doesn't ever go backwards). + if (now > _auction.startedAt) { + secondsPassed = now - _auction.startedAt; + } + + return _computeCurrentPrice( + _auction.startingPriceInToken, + _auction.endingPriceInToken, + _auction.duration, + secondsPassed + ); + } + + /// @dev Computes the current price of an auction. Factored out + /// from _currentPrice so we can run extensive unit tests. + /// When testing, make this function public and turn on + /// `Current price computation` test suite. + function _computeCurrentPrice( + uint256 _startingPrice, + uint256 _endingPrice, + uint256 _duration, + uint256 _secondsPassed + ) + internal + pure + returns (uint256) + { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our public functions carefully cap the maximum values for + // time (at 64-bits) and currency (at 128-bits). _duration is + // also known to be non-zero (see the require() statement in + // _addAuction()) + if (_secondsPassed >= _duration) { + // We've reached the end of the dynamic pricing portion + // of the auction, just return the end price. + return _endingPrice; + } else { + // Starting price can be higher than ending price (and often is!), so + // this delta can be negative. + int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice); + + // This multiplication can't overflow, _secondsPassed will easily fit within + // 64-bits, and totalPriceChange will easily fit within 128-bits, their product + // will always fit within 256-bits. + int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration); + + // currentPriceChange can be negative, but if so, will have a magnitude + // less that _startingPrice. Thus, this result will always end up positive. + int256 currentPrice = int256(_startingPrice) + currentPriceChange; + + return uint256(currentPrice); + } + } + + /// @dev Computes owner's cut of a sale. + /// @param _price - Sale price of NFT. + function _computeCut(uint256 _price) internal view returns (uint256) { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our entry functions carefully cap the maximum values for + // currency (at 128-bits), and ownerCut <= 10000 (see the require() + // statement in the ClockAuction constructor). The result of this + // function is always guaranteed to be <= _price. + uint ownerCut = registry.uintOf(UINT_AUCTION_CUT); + return _price * ownerCut / 10000; + } + +} diff --git a/contracts-flattener/SiringClockAuction.sol b/contracts-flattener/SiringClockAuction.sol new file mode 100644 index 0000000..e2dd7e8 --- /dev/null +++ b/contracts-flattener/SiringClockAuction.sol @@ -0,0 +1,999 @@ +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol + +// pragma solidity ^0.4.23; + +contract ERC223 { + function transfer(address to, uint amount, bytes data) public returns (bool ok); + + function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); + + event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol + +// pragma solidity ^0.4.24; + +contract ITokenUse { + uint48 public constant MAX_UINT48_TIME = 281474976710655; + + function isObjectInHireStage(uint256 _tokenId) public view returns (bool); + + function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); + + function getTokenUser(uint256 _tokenId) public view returns (address); + + function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; + + function cancelTokenUseOffer(uint256 _tokenId) public; + + function takeTokenUseOffer(uint256 _tokenId) public; + + function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; + + function removeActivity(uint256 _tokenId, address _user) public; +} + +// Dependency file: contracts/interfaces/IApostleBase.sol + +// pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} + +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol + +// pragma solidity ^0.4.24; + + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + // Gas optimization: this is cheaper than asserting 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (_a == 0) { + return 0; + } + + 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 _a / _b; + } + + /** + * @dev Subtracts 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 c) { + c = _a + _b; + assert(c >= _a); + return c; + } +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: contracts/SiringAuctionBase.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +// import "contracts/interfaces/IApostleBase.sol"; + +/// @title Auction Core +/// @dev Contains models, variables, and internal methods for the auction. +contract SiringAuctionBase is ApostleSettingIds, PausableDSAuth { + using SafeMath for *; + + event AuctionCreated( + uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt + ); + event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); + event AuctionCancelled(uint256 tokenId); + + // Represents an auction on an NFT + struct Auction { + // Current owner of NFT + address seller; + // Price (in ring(wei)) at beginning of auction + uint128 startingPriceInToken; + // Price (in ring(wei)) at end of auction + uint128 endingPriceInToken; + // Duration (in seconds) of auction + uint48 duration; + // Time when auction started + // NOTE: 0 if this auction has been concluded + uint48 startedAt; + // bid with which token + address token; + } + + ISettingsRegistry public registry; + + // Map from token ID to their corresponding auction. + mapping (uint256 => Auction) public tokenIdToAuction; + + /// @dev DON'T give me your money. + function() external {} + + // Modifiers to check that inputs can be safely stored with a certain + // number of bits. We use constants and multiple modifiers to save gas. + modifier canBeStoredWith48Bits(uint256 _value) { + require(_value <= 281474976710655); + _; + } + + modifier canBeStoredWith128Bits(uint256 _value) { + require(_value < 340282366920938463463374607431768211455); + _; + } + + + /// @dev Creates and begins a new auction. + /// @param _tokenId - ID of token to auction, sender must be owner. + // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason + /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. + /// @param _endingPriceInToken - Price of item (in token) at end of auction. + /// @param _duration - Length of time to move between starting + /// price and ending price (in seconds). + /// @param _seller - Seller, if not the message sender + function _createAuction( + address _from, + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _seller, + address _token + ) + internal + canBeStoredWith128Bits(_startingPriceInToken) + canBeStoredWith128Bits(_endingPriceInToken) + canBeStoredWith48Bits(_duration) + canBeStoredWith48Bits(_startAt) + whenNotPaused + { + // Require that all auctions have a duration of + // at least one minute. (Keeps our math from getting hairy!) + require(_duration >= 1 minutes, "duration must be at least 1 minutes"); + require(_duration <= 1000 days); + + require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); + // escrow + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, address(this), _tokenId); + + tokenIdToAuction[_tokenId] = Auction({ + seller: _seller, + startedAt: uint48(_startAt), + duration: uint48(_duration), + startingPriceInToken: uint128(_startingPriceInToken), + endingPriceInToken: uint128(_endingPriceInToken), + token: _token + }); + + emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); + } + + /// @dev Cancels an auction unconditionally. + function _cancelAuction(uint256 _tokenId, address _seller) internal { + _removeAuction(_tokenId); + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), _seller, _tokenId); + emit AuctionCancelled(_tokenId); + } + + + /// @dev Removes an auction from the list of open auctions. + /// @param _tokenId - ID of NFT on auction. + function _removeAuction(uint256 _tokenId) internal { + delete tokenIdToAuction[_tokenId]; + } + + /// @dev Returns true if the NFT is on auction. + /// @param _auction - Auction to check. + function _isOnAuction(Auction storage _auction) internal view returns (bool) { + return (_auction.startedAt > 0); + } + + /// @dev Returns current price of an NFT on auction. Broken into two + /// functions (this one, that computes the duration from the auction + /// structure, and the other that does the price computation) so we + /// can easily test that the price computation works correctly. + function _currentPrice(Auction storage _auction) + internal + view + returns (uint256) + { + uint256 secondsPassed = 0; + + // A bit of insurance against negative values (or wraparound). + // Probably not necessary (since Ethereum guarnatees that the + // now variable doesn't ever go backwards). + if (now > _auction.startedAt) { + secondsPassed = now - _auction.startedAt; + } + + return _computeCurrentPrice( + _auction.startingPriceInToken, + _auction.endingPriceInToken, + _auction.duration, + secondsPassed + ); + } + + /// @dev Computes the current price of an auction. Factored out + /// from _currentPrice so we can run extensive unit tests. + /// When testing, make this function public and turn on + /// `Current price computation` test suite. + function _computeCurrentPrice( + uint256 _startingPrice, + uint256 _endingPrice, + uint256 _duration, + uint256 _secondsPassed + ) + internal + pure + returns (uint256) + { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our public functions carefully cap the maximum values for + // time (at 64-bits) and currency (at 128-bits). _duration is + // also known to be non-zero (see the require() statement in + // _addAuction()) + if (_secondsPassed >= _duration) { + // We've reached the end of the dynamic pricing portion + // of the auction, just return the end price. + return _endingPrice; + } else { + // Starting price can be higher than ending price (and often is!), so + // this delta can be negative. + int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice); + + // This multiplication can't overflow, _secondsPassed will easily fit within + // 64-bits, and totalPriceChange will easily fit within 128-bits, their product + // will always fit within 256-bits. + int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration); + + // currentPriceChange can be negative, but if so, will have a magnitude + // less that _startingPrice. Thus, this result will always end up positive. + int256 currentPrice = int256(_startingPrice) + currentPriceChange; + + return uint256(currentPrice); + } + } + + /// @dev Computes owner's cut of a sale. + /// @param _price - Sale price of NFT. + function _computeCut(uint256 _price) internal view returns (uint256) { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our entry functions carefully cap the maximum values for + // currency (at 128-bits), and ownerCut <= 10000 (see the require() + // statement in the ClockAuction constructor). The result of this + // function is always guaranteed to be <= _price. + uint ownerCut = registry.uintOf(UINT_AUCTION_CUT); + return _price * ownerCut / 10000; + } + +} + + +// Root file: contracts/SiringClockAuction.sol + +pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +// import "contracts/interfaces/IApostleBase.sol"; +// import "contracts/SiringAuctionBase.sol"; + +/// @title Clock auction for non-fungible tokens. +contract SiringClockAuction is SiringAuctionBase { + + + bool private singletonLock = false; + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + function initializeContract(ISettingsRegistry _registry) public singletonLockCall { + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + } + + /// @dev Cancels an auction that hasn't been won yet. + /// Returns the NFT to original owner. + /// @notice This is a state-modifying function that can + /// be called while the contract is paused. + /// @param _tokenId - ID of token on auction + function cancelAuction(uint256 _tokenId) + public + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + address seller = auction.seller; + require(msg.sender == seller); + _cancelAuction(_tokenId, seller); + } + + /// @dev Cancels an auction when the contract is paused. + /// Only the owner may do this, and NFTs are returned to + /// the seller. This should only be used in emergencies. + /// @param _tokenId - ID of the NFT on auction to cancel. + function cancelAuctionWhenPaused(uint256 _tokenId) + whenPaused + onlyOwner + public + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + _cancelAuction(_tokenId, auction.seller); + } + + /// @dev Returns auction info for an NFT on auction. + /// @param _tokenId - ID of NFT on auction. + function getAuction(uint256 _tokenId) + public + view + returns + ( + address seller, + uint256 startingPrice, + uint256 endingPrice, + uint256 duration, + uint256 startedAt, + address token + ) { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + return ( + auction.seller, + uint256(auction.startingPriceInToken), + uint256(auction.endingPriceInToken), + uint256(auction.duration), + uint256(auction.startedAt), + auction.token + ); + } + + /// @dev Returns the current price of an auction. + /// @param _tokenId - ID of the token price we are checking. + function getCurrentPriceInToken(uint256 _tokenId) + public + view + returns (uint256) + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + return _currentPrice(auction); + } + + function receiveApproval( + address _from, + uint256 _tokenId, + bytes //_extraData + ) public whenNotPaused { + if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { + uint256 startingPriceInRING; + uint256 endingPriceInRING; + uint256 duration; + address seller; + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + startingPriceInRING := mload(add(ptr, 132)) + endingPriceInRING := mload(add(ptr, 164)) + duration := mload(add(ptr, 196)) + seller := mload(add(ptr, 228)) + } + + // TODO: add parameter _token + _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); + } + } + + + function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { + uint sireId; + uint matronId; + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + sireId := mload(add(ptr, 164)) + } + // safer for users + require(msg.sender == tokenIdToAuction[sireId].token); + require(tokenIdToAuction[sireId].startedAt > 0); + + uint256 autoBirthFee = registry.uintOf(UINT_AUTOBIRTH_FEE); + + // Check that the incoming bid is higher than the current price + uint priceInToken = getCurrentPriceInToken(sireId); + + require(_valueInToken >= (priceInToken + autoBirthFee), + "your offer is lower than the current price, try again with a higher one."); + Auction storage auction = tokenIdToAuction[sireId]; + require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); + + address seller = auction.seller; + + _removeAuction(sireId); + uint refund = _valueInToken - priceInToken - autoBirthFee; + + if (refund > 0) { + ERC20(msg.sender).transfer(_from, refund); + } + + if (priceInToken > 0) { + _bidWithToken(msg.sender, _from, seller, sireId, matronId, priceInToken, autoBirthFee); + } + } + + + function _bidWithToken( + address _auctionToken, address _from, address _seller, uint256 _sireId, uint256 _matronId, uint256 _priceInToken, uint256 _autoBirthFee) internal { + //uint256 ownerCutAmount = _computeCut(priceInToken); + uint cut = _computeCut(_priceInToken); + ERC223(_auctionToken).transfer(_seller, (_priceInToken - cut), toBytes(_from)); + ERC223(_auctionToken).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), (cut + _autoBirthFee), toBytes(_from)); + + IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).approveSiring(_from, _sireId); + + address apostleBase = registry.addressOf(CONTRACT_APOSTLE_BASE); + + require(IApostleBase(apostleBase).breedWithInAuction(_matronId, _sireId)); + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), _seller, _sireId); + + // Tell the world! + emit AuctionSuccessful(_sireId, _priceInToken, _from); + + } + + function toBytes(address x) public pure returns (bytes b) { + b = new bytes(32); + assembly {mstore(add(b, 32), x)} + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256, // _tokenId, + bytes //_data + ) + public + returns (bytes4) { + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + + } +} diff --git a/contracts-flattener/SiringClockAuctionV2.sol b/contracts-flattener/SiringClockAuctionV2.sol new file mode 100644 index 0000000..9911bed --- /dev/null +++ b/contracts-flattener/SiringClockAuctionV2.sol @@ -0,0 +1,1003 @@ +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC20Basic + * @dev Simpler version of ERC20 interface + * See https://github.com/ethereum/EIPs/issues/179 + */ +contract ERC20Basic { + function totalSupply() public view returns (uint256); + function balanceOf(address _who) public view returns (uint256); + function transfer(address _to, uint256 _value) public returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; + + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +contract ERC20 is ERC20Basic { + function allowance(address _owner, address _spender) + public view returns (uint256); + + function transferFrom(address _from, address _to, uint256 _value) + public returns (bool); + + function approve(address _spender, uint256 _value) public returns (bool); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol + +// pragma solidity ^0.4.24; + +contract ISettingsRegistry { + enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } + + function uintOf(bytes32 _propertyName) public view returns (uint256); + + function stringOf(bytes32 _propertyName) public view returns (string); + + function addressOf(bytes32 _propertyName) public view returns (address); + + function bytesOf(bytes32 _propertyName) public view returns (bytes); + + function boolOf(bytes32 _propertyName) public view returns (bool); + + function intOf(bytes32 _propertyName) public view returns (int); + + function setUintProperty(bytes32 _propertyName, uint _value) public; + + function setStringProperty(bytes32 _propertyName, string _value) public; + + function setAddressProperty(bytes32 _propertyName, address _value) public; + + function setBytesProperty(bytes32 _propertyName, bytes _value) public; + + function setBoolProperty(bytes32 _propertyName, bool _value) public; + + function setIntProperty(bytes32 _propertyName, int _value) public; + + function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); + + event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); +} + +// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol + +// pragma solidity ^0.4.23; + +contract ERC223 { + function transfer(address to, uint amount, bytes data) public returns (bool ok); + + function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); + + event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol + +// pragma solidity ^0.4.24; + +contract ITokenUse { + uint48 public constant MAX_UINT48_TIME = 281474976710655; + + function isObjectInHireStage(uint256 _tokenId) public view returns (bool); + + function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); + + function getTokenUser(uint256 _tokenId) public view returns (address); + + function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; + + function cancelTokenUseOffer(uint256 _tokenId) public; + + function takeTokenUseOffer(uint256 _tokenId) public; + + function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; + + function removeActivity(uint256 _tokenId, address _user) public; +} + +// Dependency file: contracts/interfaces/IApostleBase.sol + +// pragma solidity ^0.4.24; + + +// TODO: upgrade common-contacts version then delete this. +contract IApostleBase { + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; + + function isReadyToBreed(uint256 _apostleId) public view returns (bool); + + function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); + + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); + + function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256); + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256); + + function isDead(uint256 _tokenId) public view returns (bool); + + function approveSiring(address _addr, uint256 _sireId) public; + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; +} + +// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol + +// pragma solidity ^0.4.24; + + +/** + * @title ERC165 + * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md + */ +interface ERC165 { + + /** + * @notice Query if a contract implements an interface + * @param _interfaceId The interface identifier, as specified in ERC-165 + * @dev Interface identification is specified in ERC-165. This function + * uses less than 30,000 gas. + */ + function supportsInterface(bytes4 _interfaceId) + external + view + returns (bool); +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; + + +/** + * @title ERC721 Non-Fungible Token Standard basic interface + * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Basic is ERC165 { + + bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; + /* + * 0x80ac58cd === + * bytes4(keccak256('balanceOf(address)')) ^ + * bytes4(keccak256('ownerOf(uint256)')) ^ + * bytes4(keccak256('approve(address,uint256)')) ^ + * bytes4(keccak256('getApproved(uint256)')) ^ + * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ + * bytes4(keccak256('isApprovedForAll(address,address)')) ^ + * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) + */ + + bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; + /* + * 0x4f558e79 === + * bytes4(keccak256('exists(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; + /** + * 0x780e9d63 === + * bytes4(keccak256('totalSupply()')) ^ + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ + * bytes4(keccak256('tokenByIndex(uint256)')) + */ + + bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; + /** + * 0x5b5e139f === + * bytes4(keccak256('name()')) ^ + * bytes4(keccak256('symbol()')) ^ + * bytes4(keccak256('tokenURI(uint256)')) + */ + + event Transfer( + address indexed _from, + address indexed _to, + uint256 indexed _tokenId + ); + event Approval( + address indexed _owner, + address indexed _approved, + uint256 indexed _tokenId + ); + event ApprovalForAll( + address indexed _owner, + address indexed _operator, + bool _approved + ); + + function balanceOf(address _owner) public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view returns (bool _exists); + + function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) + public view returns (address _operator); + + function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) + public view returns (bool); + + function transferFrom(address _from, address _to, uint256 _tokenId) public; + function safeTransferFrom(address _from, address _to, uint256 _tokenId) + public; + + function safeTransferFrom( + address _from, + address _to, + uint256 _tokenId, + bytes _data + ) + public; +} + + +// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Enumerable is ERC721Basic { + function totalSupply() public view returns (uint256); + function tokenOfOwnerByIndex( + address _owner, + uint256 _index + ) + public + view + returns (uint256 _tokenId); + + function tokenByIndex(uint256 _index) public view returns (uint256); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721Metadata is ERC721Basic { + function name() external view returns (string _name); + function symbol() external view returns (string _symbol); + function tokenURI(uint256 _tokenId) public view returns (string); +} + + +/** + * @title ERC-721 Non-Fungible Token Standard, full implementation interface + * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md + */ +contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { +} + + +// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol + +// pragma solidity ^0.4.24; + + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { + // Gas optimization: this is cheaper than asserting 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (_a == 0) { + return 0; + } + + 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 _a / _b; + } + + /** + * @dev Subtracts 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 c) { + c = _a + _b; + assert(c >= _a); + return c; + } +} + + +// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol + +// pragma solidity ^0.4.24; + +contract IAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} + +// Dependency file: @evolutionland/common/contracts/DSAuth.sol + +// pragma solidity ^0.4.24; + +// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; + +contract DSAuthEvents { + event LogSetAuthority (address indexed authority); + event LogSetOwner (address indexed owner); +} + +/** + * @title DSAuth + * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth + * But in the isAuthorized method, the src from address(this) is remove for safty concern. + */ +contract DSAuth is DSAuthEvents { + IAuthority public authority; + address public owner; + + constructor() public { + owner = msg.sender; + emit LogSetOwner(msg.sender); + } + + function setOwner(address owner_) + public + auth + { + owner = owner_; + emit LogSetOwner(owner); + } + + function setAuthority(IAuthority authority_) + public + auth + { + authority = authority_; + emit LogSetAuthority(authority); + } + + modifier auth { + require(isAuthorized(msg.sender, msg.sig)); + _; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + function isAuthorized(address src, bytes4 sig) internal view returns (bool) { + if (src == owner) { + return true; + } else if (authority == IAuthority(0)) { + return false; + } else { + return authority.canCall(src, this, sig); + } + } +} + + +// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol + +// pragma solidity ^0.4.24; + +// import "@evolutionland/common/contracts/DSAuth.sol"; + + +/** + * @title Pausable + * @dev Base contract which allows children to implement an emergency stop mechanism. + */ +contract PausableDSAuth is DSAuth { + event Pause(); + event Unpause(); + + bool public paused = false; + + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + */ + modifier whenNotPaused() { + require(!paused); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + */ + modifier whenPaused() { + require(paused); + _; + } + + /** + * @dev called by the owner to pause, triggers stopped state + */ + function pause() public onlyOwner whenNotPaused { + paused = true; + emit Pause(); + } + + /** + * @dev called by the owner to unpause, returns to normal state + */ + function unpause() public onlyOwner whenPaused { + paused = false; + emit Unpause(); + } +} + +// Dependency file: @evolutionland/common/contracts/SettingIds.sol + +// pragma solidity ^0.4.24; + +/** + Id definitions for SettingsRegistry.sol + Can be used in conjunction with the settings registry to get properties +*/ +contract SettingIds { + bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; + + bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; + + bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; + + bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; + + bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; + + bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; + + bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; + + bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; + + bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; + + bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; + + bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; + + // Cut owner takes on each auction, measured in basis points (1/100 of a percent). + // this can be considered as transaction fee. + // Values 0-10,000 map to 0%-100% + // set ownerCut to 4% + // ownerCut = 400; + bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 + + bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 + + // Cut referer takes on each auction, measured in basis points (1/100 of a percent). + // which cut from transaction fee. + // Values 0-10,000 map to 0%-100% + // set refererCut to 4% + // refererCut = 400; + bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; + + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + +// Dependency file: contracts/ApostleSettingIds.sol + +// pragma solidity ^0.4.24; +// import "@evolutionland/common/contracts/SettingIds.sol"; + + +contract ApostleSettingIds is SettingIds { + + bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; + + /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards + /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by + /// the COO role as the gas price changes. + bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; + + bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; + + bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; + + bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; + + // when player wants to buy their apostle some talents + // the minimum or unit they need to pay + bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; + + bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; + + /// Denominator is 100000000 + bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; + + // TODO: move this to common-contract + bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; +} + + +// Dependency file: contracts/SiringAuctionBase.sol + +// pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/PausableDSAuth.sol"; +// import "contracts/ApostleSettingIds.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +// import "contracts/interfaces/IApostleBase.sol"; + +/// @title Auction Core +/// @dev Contains models, variables, and internal methods for the auction. +contract SiringAuctionBase is ApostleSettingIds, PausableDSAuth { + using SafeMath for *; + + event AuctionCreated( + uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt + ); + event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); + event AuctionCancelled(uint256 tokenId); + + // Represents an auction on an NFT + struct Auction { + // Current owner of NFT + address seller; + // Price (in ring(wei)) at beginning of auction + uint128 startingPriceInToken; + // Price (in ring(wei)) at end of auction + uint128 endingPriceInToken; + // Duration (in seconds) of auction + uint48 duration; + // Time when auction started + // NOTE: 0 if this auction has been concluded + uint48 startedAt; + // bid with which token + address token; + } + + ISettingsRegistry public registry; + + // Map from token ID to their corresponding auction. + mapping (uint256 => Auction) public tokenIdToAuction; + + /// @dev DON'T give me your money. + function() external {} + + // Modifiers to check that inputs can be safely stored with a certain + // number of bits. We use constants and multiple modifiers to save gas. + modifier canBeStoredWith48Bits(uint256 _value) { + require(_value <= 281474976710655); + _; + } + + modifier canBeStoredWith128Bits(uint256 _value) { + require(_value < 340282366920938463463374607431768211455); + _; + } + + + /// @dev Creates and begins a new auction. + /// @param _tokenId - ID of token to auction, sender must be owner. + // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason + /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. + /// @param _endingPriceInToken - Price of item (in token) at end of auction. + /// @param _duration - Length of time to move between starting + /// price and ending price (in seconds). + /// @param _seller - Seller, if not the message sender + function _createAuction( + address _from, + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _seller, + address _token + ) + internal + canBeStoredWith128Bits(_startingPriceInToken) + canBeStoredWith128Bits(_endingPriceInToken) + canBeStoredWith48Bits(_duration) + canBeStoredWith48Bits(_startAt) + whenNotPaused + { + // Require that all auctions have a duration of + // at least one minute. (Keeps our math from getting hairy!) + require(_duration >= 1 minutes, "duration must be at least 1 minutes"); + require(_duration <= 1000 days); + + require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); + // escrow + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, address(this), _tokenId); + + tokenIdToAuction[_tokenId] = Auction({ + seller: _seller, + startedAt: uint48(_startAt), + duration: uint48(_duration), + startingPriceInToken: uint128(_startingPriceInToken), + endingPriceInToken: uint128(_endingPriceInToken), + token: _token + }); + + emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); + } + + /// @dev Cancels an auction unconditionally. + function _cancelAuction(uint256 _tokenId, address _seller) internal { + _removeAuction(_tokenId); + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), _seller, _tokenId); + emit AuctionCancelled(_tokenId); + } + + + /// @dev Removes an auction from the list of open auctions. + /// @param _tokenId - ID of NFT on auction. + function _removeAuction(uint256 _tokenId) internal { + delete tokenIdToAuction[_tokenId]; + } + + /// @dev Returns true if the NFT is on auction. + /// @param _auction - Auction to check. + function _isOnAuction(Auction storage _auction) internal view returns (bool) { + return (_auction.startedAt > 0); + } + + /// @dev Returns current price of an NFT on auction. Broken into two + /// functions (this one, that computes the duration from the auction + /// structure, and the other that does the price computation) so we + /// can easily test that the price computation works correctly. + function _currentPrice(Auction storage _auction) + internal + view + returns (uint256) + { + uint256 secondsPassed = 0; + + // A bit of insurance against negative values (or wraparound). + // Probably not necessary (since Ethereum guarnatees that the + // now variable doesn't ever go backwards). + if (now > _auction.startedAt) { + secondsPassed = now - _auction.startedAt; + } + + return _computeCurrentPrice( + _auction.startingPriceInToken, + _auction.endingPriceInToken, + _auction.duration, + secondsPassed + ); + } + + /// @dev Computes the current price of an auction. Factored out + /// from _currentPrice so we can run extensive unit tests. + /// When testing, make this function public and turn on + /// `Current price computation` test suite. + function _computeCurrentPrice( + uint256 _startingPrice, + uint256 _endingPrice, + uint256 _duration, + uint256 _secondsPassed + ) + internal + pure + returns (uint256) + { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our public functions carefully cap the maximum values for + // time (at 64-bits) and currency (at 128-bits). _duration is + // also known to be non-zero (see the require() statement in + // _addAuction()) + if (_secondsPassed >= _duration) { + // We've reached the end of the dynamic pricing portion + // of the auction, just return the end price. + return _endingPrice; + } else { + // Starting price can be higher than ending price (and often is!), so + // this delta can be negative. + int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice); + + // This multiplication can't overflow, _secondsPassed will easily fit within + // 64-bits, and totalPriceChange will easily fit within 128-bits, their product + // will always fit within 256-bits. + int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration); + + // currentPriceChange can be negative, but if so, will have a magnitude + // less that _startingPrice. Thus, this result will always end up positive. + int256 currentPrice = int256(_startingPrice) + currentPriceChange; + + return uint256(currentPrice); + } + } + + /// @dev Computes owner's cut of a sale. + /// @param _price - Sale price of NFT. + function _computeCut(uint256 _price) internal view returns (uint256) { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our entry functions carefully cap the maximum values for + // currency (at 128-bits), and ownerCut <= 10000 (see the require() + // statement in the ClockAuction constructor). The result of this + // function is always guaranteed to be <= _price. + uint ownerCut = registry.uintOf(UINT_AUCTION_CUT); + return _price * ownerCut / 10000; + } + +} + + +// Root file: contracts/SiringClockAuctionV2.sol + +pragma solidity ^0.4.24; + +// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; +// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +// import "contracts/interfaces/IApostleBase.sol"; +// import "contracts/SiringAuctionBase.sol"; + +/// @title Clock auction for non-fungible tokens. +contract SiringClockAuctionV2 is SiringAuctionBase { + + + bool private singletonLock = false; + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + function initializeContract(ISettingsRegistry _registry) public singletonLockCall { + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + } + + /// @dev Cancels an auction that hasn't been won yet. + /// Returns the NFT to original owner. + /// @notice This is a state-modifying function that can + /// be called while the contract is paused. + /// @param _tokenId - ID of token on auction + function cancelAuction(uint256 _tokenId) + public + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + address seller = auction.seller; + require(msg.sender == seller); + _cancelAuction(_tokenId, seller); + } + + /// @dev Cancels an auction when the contract is paused. + /// Only the owner may do this, and NFTs are returned to + /// the seller. This should only be used in emergencies. + /// @param _tokenId - ID of the NFT on auction to cancel. + function cancelAuctionWhenPaused(uint256 _tokenId) + whenPaused + onlyOwner + public + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + _cancelAuction(_tokenId, auction.seller); + } + + /// @dev Returns auction info for an NFT on auction. + /// @param _tokenId - ID of NFT on auction. + function getAuction(uint256 _tokenId) + public + view + returns + ( + address seller, + uint256 startingPrice, + uint256 endingPrice, + uint256 duration, + uint256 startedAt, + address token + ) { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + return ( + auction.seller, + uint256(auction.startingPriceInToken), + uint256(auction.endingPriceInToken), + uint256(auction.duration), + uint256(auction.startedAt), + auction.token + ); + } + + /// @dev Returns the current price of an auction. + /// @param _tokenId - ID of the token price we are checking. + function getCurrentPriceInToken(uint256 _tokenId) + public + view + returns (uint256) + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + return _currentPrice(auction); + } + + function receiveApproval( + address _from, + uint256 _tokenId, + bytes //_extraData + ) public whenNotPaused { + if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { + uint256 startingPriceInRING; + uint256 endingPriceInRING; + uint256 duration; + address seller; + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + startingPriceInRING := mload(add(ptr, 132)) + endingPriceInRING := mload(add(ptr, 164)) + duration := mload(add(ptr, 196)) + seller := mload(add(ptr, 228)) + } + + // TODO: add parameter _token + _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); + } + } + + + function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { + uint sireId; + uint matronId; + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + sireId := mload(add(ptr, 164)) + } + // safer for users + require(msg.sender == tokenIdToAuction[sireId].token); + require(tokenIdToAuction[sireId].startedAt > 0); + + uint256 autoBirthFee = registry.uintOf(UINT_AUTOBIRTH_FEE); + + // Check that the incoming bid is higher than the current price + uint priceInToken = getCurrentPriceInToken(sireId); + + require(_valueInToken >= (priceInToken + autoBirthFee), + "your offer is lower than the current price, try again with a higher one."); + Auction storage auction = tokenIdToAuction[sireId]; + require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); + + address seller = auction.seller; + + _removeAuction(sireId); + uint refund = _valueInToken - priceInToken - autoBirthFee; + + if (refund > 0) { + ERC20(msg.sender).transfer(_from, refund); + } + + if (priceInToken > 0) { + _bidWithToken(msg.sender, _from, seller, sireId, matronId, priceInToken, autoBirthFee); + } + } + + + function _bidWithToken( + address _auctionToken, address _from, address _seller, uint256 _sireId, uint256 _matronId, uint256 _priceInToken, uint256 _autoBirthFee) + internal + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_matronId) == _from, "You can only breed your own apostle."); + //uint256 ownerCutAmount = _computeCut(priceInToken); + uint cut = _computeCut(_priceInToken); + ERC223(_auctionToken).transfer(_seller, (_priceInToken - cut), toBytes(_from)); + ERC223(_auctionToken).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), (cut + _autoBirthFee), toBytes(_from)); + + IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).approveSiring(_from, _sireId); + + address apostleBase = registry.addressOf(CONTRACT_APOSTLE_BASE); + + require(IApostleBase(apostleBase).breedWithInAuction(_matronId, _sireId)); + + objectOwnership.transferFrom(address(this), _seller, _sireId); + + // Tell the world! + emit AuctionSuccessful(_sireId, _priceInToken, _from); + + } + + function toBytes(address x) public pure returns (bytes b) { + b = new bytes(32); + assembly {mstore(add(b, 32), x)} + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256, // _tokenId, + bytes //_data + ) + public + returns (bytes4) { + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + + } +} diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol new file mode 100644 index 0000000..2925273 --- /dev/null +++ b/contracts/ApostleBaseV3.sol @@ -0,0 +1,29 @@ +pragma solidity ^0.4.24; + +import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "./interfaces/IItemBar.sol"; +import "./ApostleBaseV2.sol"; + +contract ApostleBaseV3 is ApostleBaseV2 { + + using SafeMath for uint256; + + // 0x434f4e54524143545f41504f53544c455f4954454d5f42415200000000000000 + bytes32 public constant CONTRACT_LAND_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; + + // rate precision + uint112 public constant RATE_DECIMALS = 10**8; + + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + uint256 strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + + address itemBar = registry.addressOf(CONTRACT_LAND_ITEM_BAR); + uint256 enhanceRate = + IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); + uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_DECIMALS); + uint256 totalStrength = strength.add(enhanceStrength); + return totalStrength; + } +} diff --git a/contracts/interfaces/IItemBar.sol b/contracts/interfaces/IItemBar.sol new file mode 100644 index 0000000..530ebc8 --- /dev/null +++ b/contracts/interfaces/IItemBar.sol @@ -0,0 +1,8 @@ +pragma solidity ^0.4.24; + +interface IItemBar { + function enhanceStrengthRateOf( + address _resourceToken, + uint256 _tokenId + ) external view returns (uint256); +} diff --git a/package.json b/package.json index 92599e1..5722097 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "test": "test" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "npx waffle", + "flatten": "npx waffle flatten" }, "repository": { "type": "git", @@ -26,5 +27,8 @@ "@evolutionland/common": "^1.7.9", "@evolutionland/upgraeability-using-unstructured-storage": "^0.1.1", "openzeppelin-solidity": "^1.12.0" + }, + "devDependencies": { + "ethereum-waffle": "^3.2.1" } } From b432808a6b2956e350ffceda4620eac5dd515659 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 10 Dec 2020 19:44:00 +0800 Subject: [PATCH 02/64] fix --- contracts/ApostleBaseV3.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index 2925273..8bafaf6 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -9,7 +9,7 @@ contract ApostleBaseV3 is ApostleBaseV2 { using SafeMath for uint256; // 0x434f4e54524143545f41504f53544c455f4954454d5f42415200000000000000 - bytes32 public constant CONTRACT_LAND_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; + bytes32 public constant CONTRACT_APOSTLE_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; // rate precision uint112 public constant RATE_DECIMALS = 10**8; @@ -18,8 +18,8 @@ contract ApostleBaseV3 is ApostleBaseV2 { uint talents = tokenId2Apostle[_tokenId].talents; uint256 strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) .getStrength(talents, _resourceToken, _landTokenId); - - address itemBar = registry.addressOf(CONTRACT_LAND_ITEM_BAR); + // V3 + address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); uint256 enhanceRate = IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_DECIMALS); From bce063b9767e527336aa87370bb54f1bf70996ee Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 10 Dec 2020 19:45:24 +0800 Subject: [PATCH 03/64] fix --- contracts-flattener/ApostleBaseV3.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts-flattener/ApostleBaseV3.sol b/contracts-flattener/ApostleBaseV3.sol index 701e60d..9b9890e 100644 --- a/contracts-flattener/ApostleBaseV3.sol +++ b/contracts-flattener/ApostleBaseV3.sol @@ -1332,7 +1332,7 @@ contract ApostleBaseV3 is ApostleBaseV2 { using SafeMath for uint256; // 0x434f4e54524143545f41504f53544c455f4954454d5f42415200000000000000 - bytes32 public constant CONTRACT_LAND_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; + bytes32 public constant CONTRACT_APOSTLE_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; // rate precision uint112 public constant RATE_DECIMALS = 10**8; @@ -1341,8 +1341,8 @@ contract ApostleBaseV3 is ApostleBaseV2 { uint talents = tokenId2Apostle[_tokenId].talents; uint256 strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) .getStrength(talents, _resourceToken, _landTokenId); - - address itemBar = registry.addressOf(CONTRACT_LAND_ITEM_BAR); + // V3 + address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); uint256 enhanceRate = IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_DECIMALS); From e67696d250665316ad27a27d7ad826cf26e28e10 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 11 Dec 2020 19:45:22 +0800 Subject: [PATCH 04/64] change rate precision --- contracts-flattener/ApostleBaseV3.sol | 4 ++-- contracts/ApostleBaseV3.sol | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts-flattener/ApostleBaseV3.sol b/contracts-flattener/ApostleBaseV3.sol index 9b9890e..7e04e56 100644 --- a/contracts-flattener/ApostleBaseV3.sol +++ b/contracts-flattener/ApostleBaseV3.sol @@ -1335,7 +1335,7 @@ contract ApostleBaseV3 is ApostleBaseV2 { bytes32 public constant CONTRACT_APOSTLE_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; // rate precision - uint112 public constant RATE_DECIMALS = 10**8; + uint128 public constant RATE_PRECISION = 10**8; function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { uint talents = tokenId2Apostle[_tokenId].talents; @@ -1345,7 +1345,7 @@ contract ApostleBaseV3 is ApostleBaseV2 { address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); uint256 enhanceRate = IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); - uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_DECIMALS); + uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_PRECISION); uint256 totalStrength = strength.add(enhanceStrength); return totalStrength; } diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index 8bafaf6..cf3b89a 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -12,7 +12,7 @@ contract ApostleBaseV3 is ApostleBaseV2 { bytes32 public constant CONTRACT_APOSTLE_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; // rate precision - uint112 public constant RATE_DECIMALS = 10**8; + uint128 public constant RATE_PRECISION = 10**8; function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { uint talents = tokenId2Apostle[_tokenId].talents; @@ -22,7 +22,7 @@ contract ApostleBaseV3 is ApostleBaseV2 { address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); uint256 enhanceRate = IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); - uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_DECIMALS); + uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_PRECISION); uint256 totalStrength = strength.add(enhanceStrength); return totalStrength; } From 36ae12e4b17d3a895000b0d3da2e0cbf2f905fba Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 23 Dec 2020 15:47:15 +0800 Subject: [PATCH 05/64] cache strength for gas saving --- contracts-flattener/ApostleBaseV3.sol | 13 ++++++++++--- contracts/ApostleBaseV3.sol | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/contracts-flattener/ApostleBaseV3.sol b/contracts-flattener/ApostleBaseV3.sol index 7e04e56..12a7acd 100644 --- a/contracts-flattener/ApostleBaseV3.sol +++ b/contracts-flattener/ApostleBaseV3.sol @@ -1337,10 +1337,17 @@ contract ApostleBaseV3 is ApostleBaseV2 { // rate precision uint128 public constant RATE_PRECISION = 10**8; + //cache for gas saving + mapping(uint256 => mapping(uint256 => mapping(address => uint256))) talents2Strength; + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - uint talents = tokenId2Apostle[_tokenId].talents; - uint256 strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); + uint256 talents = tokenId2Apostle[_tokenId].talents; + uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; + if (strength == 0) { + strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + talents2Strength[talents][_landTokenId][_resourceToken] = strength; + } // V3 address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); uint256 enhanceRate = diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index cf3b89a..6eda29b 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -14,10 +14,17 @@ contract ApostleBaseV3 is ApostleBaseV2 { // rate precision uint128 public constant RATE_PRECISION = 10**8; + //cache for gas saving + mapping(uint256 => mapping(uint256 => mapping(address => uint256))) talents2Strength; + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - uint talents = tokenId2Apostle[_tokenId].talents; - uint256 strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); + uint256 talents = tokenId2Apostle[_tokenId].talents; + uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; + if (strength == 0) { + strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + talents2Strength[talents][_landTokenId][_resourceToken] = strength; + } // V3 address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); uint256 enhanceRate = From 8be5cf6b4d995e77448d9a0fbeffb69dc417a3ab Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 30 Dec 2020 14:38:02 +0800 Subject: [PATCH 06/64] cache strength of --- contracts-flattener/ApostleBaseV3.sol | 16 ++++++++++++++++ contracts/ApostleBaseV3.sol | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/contracts-flattener/ApostleBaseV3.sol b/contracts-flattener/ApostleBaseV3.sol index 12a7acd..2083fc0 100644 --- a/contracts-flattener/ApostleBaseV3.sol +++ b/contracts-flattener/ApostleBaseV3.sol @@ -1341,6 +1341,22 @@ contract ApostleBaseV3 is ApostleBaseV2 { mapping(uint256 => mapping(uint256 => mapping(address => uint256))) talents2Strength; function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint256 talents = tokenId2Apostle[_tokenId].talents; + uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; + if (strength == 0) { + strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + // V3 + address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); + uint256 enhanceRate = + IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); + uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_PRECISION); + uint256 totalStrength = strength.add(enhanceStrength); + return totalStrength; + } + + function cachedStrengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public returns (uint256) { uint256 talents = tokenId2Apostle[_tokenId].talents; uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; if (strength == 0) { diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index 6eda29b..3b2252b 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -18,6 +18,22 @@ contract ApostleBaseV3 is ApostleBaseV2 { mapping(uint256 => mapping(uint256 => mapping(address => uint256))) talents2Strength; function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint256 talents = tokenId2Apostle[_tokenId].talents; + uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; + if (strength == 0) { + strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + // V3 + address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); + uint256 enhanceRate = + IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); + uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_PRECISION); + uint256 totalStrength = strength.add(enhanceStrength); + return totalStrength; + } + + function cachedStrengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public returns (uint256) { uint256 talents = tokenId2Apostle[_tokenId].talents; uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; if (strength == 0) { From 27b929a8974927d49940e1c270c0ebe0d429dbb5 Mon Sep 17 00:00:00 2001 From: echo Date: Mon, 4 Jan 2021 11:16:54 +0800 Subject: [PATCH 07/64] flat code --- {contracts-flattener => flat}/ApostleBase.sol | 0 {contracts-flattener => flat}/ApostleBaseAuthority.sol | 0 {contracts-flattener => flat}/ApostleBaseAuthorityV2.sol | 0 {contracts-flattener => flat}/ApostleBaseV2.sol | 0 {contracts-flattener => flat}/ApostleBaseV3.sol | 0 {contracts-flattener => flat}/ApostleClockAuction.sol | 0 {contracts-flattener => flat}/ApostleSettingIds.sol | 0 {contracts-flattener => flat}/ClockAuctionAuthority.sol | 0 {contracts-flattener => flat}/ERC721BridgeAuthority.sol | 0 {contracts-flattener => flat}/Gen0Apostle.sol | 0 {contracts-flattener => flat}/Gen0ApostleV2.sol | 0 {contracts-flattener => flat}/HarbergerPotionShop.sol | 0 {contracts-flattener => flat}/IApostleAuction.sol | 0 {contracts-flattener => flat}/IApostleBase.sol | 0 {contracts-flattener => flat}/IERC721Bridge.sol | 0 {contracts-flattener => flat}/IGeneScience.sol | 0 {contracts-flattener => flat}/IHabergPotionShop.sol | 0 {contracts-flattener => flat}/IItemBar.sol | 0 {contracts-flattener => flat}/ILandBase.sol | 0 {contracts-flattener => flat}/ILandResource.sol | 0 {contracts-flattener => flat}/Migrations.sol | 0 {contracts-flattener => flat}/PetBase.sol | 0 {contracts-flattener => flat}/PetBaseAuthority.sol | 0 {contracts-flattener => flat}/SiringAuctionBase.sol | 0 {contracts-flattener => flat}/SiringClockAuction.sol | 0 {contracts-flattener => flat}/SiringClockAuctionV2.sol | 0 26 files changed, 0 insertions(+), 0 deletions(-) rename {contracts-flattener => flat}/ApostleBase.sol (100%) rename {contracts-flattener => flat}/ApostleBaseAuthority.sol (100%) rename {contracts-flattener => flat}/ApostleBaseAuthorityV2.sol (100%) rename {contracts-flattener => flat}/ApostleBaseV2.sol (100%) rename {contracts-flattener => flat}/ApostleBaseV3.sol (100%) rename {contracts-flattener => flat}/ApostleClockAuction.sol (100%) rename {contracts-flattener => flat}/ApostleSettingIds.sol (100%) rename {contracts-flattener => flat}/ClockAuctionAuthority.sol (100%) rename {contracts-flattener => flat}/ERC721BridgeAuthority.sol (100%) rename {contracts-flattener => flat}/Gen0Apostle.sol (100%) rename {contracts-flattener => flat}/Gen0ApostleV2.sol (100%) rename {contracts-flattener => flat}/HarbergerPotionShop.sol (100%) rename {contracts-flattener => flat}/IApostleAuction.sol (100%) rename {contracts-flattener => flat}/IApostleBase.sol (100%) rename {contracts-flattener => flat}/IERC721Bridge.sol (100%) rename {contracts-flattener => flat}/IGeneScience.sol (100%) rename {contracts-flattener => flat}/IHabergPotionShop.sol (100%) rename {contracts-flattener => flat}/IItemBar.sol (100%) rename {contracts-flattener => flat}/ILandBase.sol (100%) rename {contracts-flattener => flat}/ILandResource.sol (100%) rename {contracts-flattener => flat}/Migrations.sol (100%) rename {contracts-flattener => flat}/PetBase.sol (100%) rename {contracts-flattener => flat}/PetBaseAuthority.sol (100%) rename {contracts-flattener => flat}/SiringAuctionBase.sol (100%) rename {contracts-flattener => flat}/SiringClockAuction.sol (100%) rename {contracts-flattener => flat}/SiringClockAuctionV2.sol (100%) diff --git a/contracts-flattener/ApostleBase.sol b/flat/ApostleBase.sol similarity index 100% rename from contracts-flattener/ApostleBase.sol rename to flat/ApostleBase.sol diff --git a/contracts-flattener/ApostleBaseAuthority.sol b/flat/ApostleBaseAuthority.sol similarity index 100% rename from contracts-flattener/ApostleBaseAuthority.sol rename to flat/ApostleBaseAuthority.sol diff --git a/contracts-flattener/ApostleBaseAuthorityV2.sol b/flat/ApostleBaseAuthorityV2.sol similarity index 100% rename from contracts-flattener/ApostleBaseAuthorityV2.sol rename to flat/ApostleBaseAuthorityV2.sol diff --git a/contracts-flattener/ApostleBaseV2.sol b/flat/ApostleBaseV2.sol similarity index 100% rename from contracts-flattener/ApostleBaseV2.sol rename to flat/ApostleBaseV2.sol diff --git a/contracts-flattener/ApostleBaseV3.sol b/flat/ApostleBaseV3.sol similarity index 100% rename from contracts-flattener/ApostleBaseV3.sol rename to flat/ApostleBaseV3.sol diff --git a/contracts-flattener/ApostleClockAuction.sol b/flat/ApostleClockAuction.sol similarity index 100% rename from contracts-flattener/ApostleClockAuction.sol rename to flat/ApostleClockAuction.sol diff --git a/contracts-flattener/ApostleSettingIds.sol b/flat/ApostleSettingIds.sol similarity index 100% rename from contracts-flattener/ApostleSettingIds.sol rename to flat/ApostleSettingIds.sol diff --git a/contracts-flattener/ClockAuctionAuthority.sol b/flat/ClockAuctionAuthority.sol similarity index 100% rename from contracts-flattener/ClockAuctionAuthority.sol rename to flat/ClockAuctionAuthority.sol diff --git a/contracts-flattener/ERC721BridgeAuthority.sol b/flat/ERC721BridgeAuthority.sol similarity index 100% rename from contracts-flattener/ERC721BridgeAuthority.sol rename to flat/ERC721BridgeAuthority.sol diff --git a/contracts-flattener/Gen0Apostle.sol b/flat/Gen0Apostle.sol similarity index 100% rename from contracts-flattener/Gen0Apostle.sol rename to flat/Gen0Apostle.sol diff --git a/contracts-flattener/Gen0ApostleV2.sol b/flat/Gen0ApostleV2.sol similarity index 100% rename from contracts-flattener/Gen0ApostleV2.sol rename to flat/Gen0ApostleV2.sol diff --git a/contracts-flattener/HarbergerPotionShop.sol b/flat/HarbergerPotionShop.sol similarity index 100% rename from contracts-flattener/HarbergerPotionShop.sol rename to flat/HarbergerPotionShop.sol diff --git a/contracts-flattener/IApostleAuction.sol b/flat/IApostleAuction.sol similarity index 100% rename from contracts-flattener/IApostleAuction.sol rename to flat/IApostleAuction.sol diff --git a/contracts-flattener/IApostleBase.sol b/flat/IApostleBase.sol similarity index 100% rename from contracts-flattener/IApostleBase.sol rename to flat/IApostleBase.sol diff --git a/contracts-flattener/IERC721Bridge.sol b/flat/IERC721Bridge.sol similarity index 100% rename from contracts-flattener/IERC721Bridge.sol rename to flat/IERC721Bridge.sol diff --git a/contracts-flattener/IGeneScience.sol b/flat/IGeneScience.sol similarity index 100% rename from contracts-flattener/IGeneScience.sol rename to flat/IGeneScience.sol diff --git a/contracts-flattener/IHabergPotionShop.sol b/flat/IHabergPotionShop.sol similarity index 100% rename from contracts-flattener/IHabergPotionShop.sol rename to flat/IHabergPotionShop.sol diff --git a/contracts-flattener/IItemBar.sol b/flat/IItemBar.sol similarity index 100% rename from contracts-flattener/IItemBar.sol rename to flat/IItemBar.sol diff --git a/contracts-flattener/ILandBase.sol b/flat/ILandBase.sol similarity index 100% rename from contracts-flattener/ILandBase.sol rename to flat/ILandBase.sol diff --git a/contracts-flattener/ILandResource.sol b/flat/ILandResource.sol similarity index 100% rename from contracts-flattener/ILandResource.sol rename to flat/ILandResource.sol diff --git a/contracts-flattener/Migrations.sol b/flat/Migrations.sol similarity index 100% rename from contracts-flattener/Migrations.sol rename to flat/Migrations.sol diff --git a/contracts-flattener/PetBase.sol b/flat/PetBase.sol similarity index 100% rename from contracts-flattener/PetBase.sol rename to flat/PetBase.sol diff --git a/contracts-flattener/PetBaseAuthority.sol b/flat/PetBaseAuthority.sol similarity index 100% rename from contracts-flattener/PetBaseAuthority.sol rename to flat/PetBaseAuthority.sol diff --git a/contracts-flattener/SiringAuctionBase.sol b/flat/SiringAuctionBase.sol similarity index 100% rename from contracts-flattener/SiringAuctionBase.sol rename to flat/SiringAuctionBase.sol diff --git a/contracts-flattener/SiringClockAuction.sol b/flat/SiringClockAuction.sol similarity index 100% rename from contracts-flattener/SiringClockAuction.sol rename to flat/SiringClockAuction.sol diff --git a/contracts-flattener/SiringClockAuctionV2.sol b/flat/SiringClockAuctionV2.sol similarity index 100% rename from contracts-flattener/SiringClockAuctionV2.sol rename to flat/SiringClockAuctionV2.sol From 8d43d642eeb2a3da2565186c33ce8a396c20a6ac Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 22 Apr 2021 18:22:40 +0800 Subject: [PATCH 08/64] dapp install zeppelin-solidity --- .gitmodules | 3 +++ lib/zeppelin-solidity | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 lib/zeppelin-solidity diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7a166a5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/zeppelin-solidity"] + path = lib/zeppelin-solidity + url = https://github.com/dapphub/zeppelin-solidity diff --git a/lib/zeppelin-solidity b/lib/zeppelin-solidity new file mode 160000 index 0000000..165e6f1 --- /dev/null +++ b/lib/zeppelin-solidity @@ -0,0 +1 @@ +Subproject commit 165e6f19489786c9c6abfcc9bdc8f2815d807935 From 3d19c4b3f26cb6fd1ba7c39eddb0e3273f6dd768 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 22 Apr 2021 19:16:25 +0800 Subject: [PATCH 09/64] lib --- .dapprc | 6 ++++++ .gitignore | 2 +- .gitmodules | 3 +++ lib/common-contracts | 1 + lib/zeppelin-solidity | 2 +- 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .dapprc create mode 160000 lib/common-contracts diff --git a/.dapprc b/.dapprc new file mode 100644 index 0000000..0b01ecf --- /dev/null +++ b/.dapprc @@ -0,0 +1,6 @@ +export DAPP_SRC=contracts +export DAPP_LIB=lib +export DAPP_REMAPPINGS="openzeppelin-solidity/=lib/zeppelin-solidity/ +@evolutionland/common/=lib/common-contracts/" +export DAPP_BUILD_LEGACY=yes +export DAPP_VERBOSE=yes diff --git a/.gitignore b/.gitignore index b0b9383..c279f33 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ package-lock.json contracts/GeneScienceV8.sol waffle.json cache - +out diff --git a/.gitmodules b/.gitmodules index 7a166a5..4cde075 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "lib/zeppelin-solidity"] path = lib/zeppelin-solidity url = https://github.com/dapphub/zeppelin-solidity +[submodule "lib/common-contracts"] + path = lib/common-contracts + url = https://github.com/evolutionlandorg/common-contracts diff --git a/lib/common-contracts b/lib/common-contracts new file mode 160000 index 0000000..2873a4f --- /dev/null +++ b/lib/common-contracts @@ -0,0 +1 @@ +Subproject commit 2873a4f8f970bd442ffcf9c6ae63b3dc79e743db diff --git a/lib/zeppelin-solidity b/lib/zeppelin-solidity index 165e6f1..0e65947 160000 --- a/lib/zeppelin-solidity +++ b/lib/zeppelin-solidity @@ -1 +1 @@ -Subproject commit 165e6f19489786c9c6abfcc9bdc8f2815d807935 +Subproject commit 0e65947efbffc592cffea8c2ae9d3b8e11659854 From 31cf1189671d2cfc1fa0da38d4cf7aa4dc159764 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 22 Apr 2021 19:19:38 +0800 Subject: [PATCH 10/64] dapp install evolutionlandorg/upgradeability-using-unstructured-storage --- .gitmodules | 3 +++ lib/upgradeability-using-unstructured-storage | 1 + 2 files changed, 4 insertions(+) create mode 160000 lib/upgradeability-using-unstructured-storage diff --git a/.gitmodules b/.gitmodules index 4cde075..8e985d9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "lib/common-contracts"] path = lib/common-contracts url = https://github.com/evolutionlandorg/common-contracts +[submodule "lib/upgradeability-using-unstructured-storage"] + path = lib/upgradeability-using-unstructured-storage + url = https://github.com/evolutionlandorg/upgradeability-using-unstructured-storage diff --git a/lib/upgradeability-using-unstructured-storage b/lib/upgradeability-using-unstructured-storage new file mode 160000 index 0000000..5d89ae1 --- /dev/null +++ b/lib/upgradeability-using-unstructured-storage @@ -0,0 +1 @@ +Subproject commit 5d89ae1a00943cbe06d2fb97ad8ade0f9a7f8f08 From 594d5efdd89e9125896e98a1c329d8c5ef3a49be Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 22 Apr 2021 19:37:04 +0800 Subject: [PATCH 11/64] dapp compatible --- .dapprc | 6 - .env | 6 + .gitignore | 1 + Makefile | 1 + flat/ApostleBase.sol | 1235 ------------------ flat/ApostleBaseAuthority.sol | 23 - flat/ApostleBaseAuthorityV2.sol | 25 - flat/ApostleBaseV2.sol | 1251 ------------------- flat/ApostleBaseV3.sol | 1375 --------------------- flat/ApostleClockAuction.sol | 1164 ----------------- flat/ApostleSettingIds.sol | 97 -- flat/ClockAuctionAuthority.sol | 21 - flat/ERC721BridgeAuthority.sol | 20 - flat/Gen0Apostle.sol | 650 ---------- flat/Gen0ApostleV2.sol | 656 ---------- flat/HarbergerPotionShop.sol | 737 ----------- flat/IApostleAuction.sol | 15 - flat/IApostleBase.sol | 30 - flat/IERC721Bridge.sol | 15 - flat/IGeneScience.sol | 26 - flat/IHabergPotionShop.sol | 10 - flat/IItemBar.sol | 10 - flat/ILandBase.sol | 8 - flat/ILandResource.sol | 12 - flat/Migrations.sol | 2060 ------------------------------- flat/PetBase.sol | 842 ------------- flat/PetBaseAuthority.sol | 19 - flat/SiringAuctionBase.sol | 737 ----------- flat/SiringClockAuction.sol | 999 --------------- flat/SiringClockAuctionV2.sol | 1003 --------------- 30 files changed, 8 insertions(+), 13046 deletions(-) delete mode 100644 .dapprc create mode 100644 .env create mode 100644 Makefile delete mode 100644 flat/ApostleBase.sol delete mode 100644 flat/ApostleBaseAuthority.sol delete mode 100644 flat/ApostleBaseAuthorityV2.sol delete mode 100644 flat/ApostleBaseV2.sol delete mode 100644 flat/ApostleBaseV3.sol delete mode 100644 flat/ApostleClockAuction.sol delete mode 100644 flat/ApostleSettingIds.sol delete mode 100644 flat/ClockAuctionAuthority.sol delete mode 100644 flat/ERC721BridgeAuthority.sol delete mode 100644 flat/Gen0Apostle.sol delete mode 100644 flat/Gen0ApostleV2.sol delete mode 100644 flat/HarbergerPotionShop.sol delete mode 100644 flat/IApostleAuction.sol delete mode 100644 flat/IApostleBase.sol delete mode 100644 flat/IERC721Bridge.sol delete mode 100644 flat/IGeneScience.sol delete mode 100644 flat/IHabergPotionShop.sol delete mode 100644 flat/IItemBar.sol delete mode 100644 flat/ILandBase.sol delete mode 100644 flat/ILandResource.sol delete mode 100644 flat/Migrations.sol delete mode 100644 flat/PetBase.sol delete mode 100644 flat/PetBaseAuthority.sol delete mode 100644 flat/SiringAuctionBase.sol delete mode 100644 flat/SiringClockAuction.sol delete mode 100644 flat/SiringClockAuctionV2.sol diff --git a/.dapprc b/.dapprc deleted file mode 100644 index 0b01ecf..0000000 --- a/.dapprc +++ /dev/null @@ -1,6 +0,0 @@ -export DAPP_SRC=contracts -export DAPP_LIB=lib -export DAPP_REMAPPINGS="openzeppelin-solidity/=lib/zeppelin-solidity/ -@evolutionland/common/=lib/common-contracts/" -export DAPP_BUILD_LEGACY=yes -export DAPP_VERBOSE=yes diff --git a/.env b/.env new file mode 100644 index 0000000..b0cc4f2 --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +export DAPP_SRC=contracts +export DAPP_LIB=lib +export DAPP_REMAPPINGS="openzeppelin-solidity/=lib/zeppelin-solidity/ +@evolutionland/common/=lib/common-contracts/ +@evolutionland/upgraeability-using-unstructured-storage/=lib/upgradeability-using-unstructured-storage/" +export DAPP_BUILD_OPTIMIZE=1 diff --git a/.gitignore b/.gitignore index c279f33..66167fa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ contracts/GeneScienceV8.sol waffle.json cache out +flat diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b05c591 --- /dev/null +++ b/Makefile @@ -0,0 +1 @@ +all :; source .env && dapp --use solc:0.4.24 build diff --git a/flat/ApostleBase.sol b/flat/ApostleBase.sol deleted file mode 100644 index 561a93b..0000000 --- a/flat/ApostleBase.sol +++ /dev/null @@ -1,1235 +0,0 @@ -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IObjectOwnership.sol - -// pragma solidity ^0.4.24; - -contract IObjectOwnership { - function mintObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); - - function burnObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol - -// pragma solidity ^0.4.24; - -contract ITokenUse { - uint48 public constant MAX_UINT48_TIME = 281474976710655; - - function isObjectInHireStage(uint256 _tokenId) public view returns (bool); - - function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); - - function getTokenUser(uint256 _tokenId) public view returns (address); - - function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; - - function cancelTokenUseOffer(uint256 _tokenId) public; - - function takeTokenUseOffer(uint256 _tokenId) public; - - function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; - - function removeActivity(uint256 _tokenId, address _user) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IMinerObject.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IMinerObject is ERC165 { - bytes4 internal constant InterfaceId_IMinerObject = 0x64272b75; - - /* - * 0x64272b752 === - * bytes4(keccak256('strengthOf(uint256,address)')) - */ - - function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256); - -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IActivityObject.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IActivityObject is ERC165 { - bytes4 internal constant InterfaceId_IActivityObject = 0x2b9eccc6; - /* - * 0x2b9eccc6 === - * bytes4(keccak256('activityAdded(uint256,address,address)')) ^ - * bytes4(keccak256('activityRemoved(uint256,address,address)')) - */ - - function activityAdded(uint256 _tokenId, address _activity, address _user) public; - - function activityRemoved(uint256 _tokenId, address _activity, address _user) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IActivity.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IActivity is ERC165 { - bytes4 internal constant InterfaceId_IActivity = 0x6086e7f8; - /* - * 0x6086e7f8 === - * bytes4(keccak256('activityStopped(uint256)')) - */ - - function activityStopped(uint256 _tokenId) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol - -// pragma solidity ^0.4.23; - -contract ERC223 { - function transfer(address to, uint amount, bytes data) public returns (bool ok); - - function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); - - event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title SupportsInterfaceWithLookup - * @author Matt Condon (@shrugs) - * @dev Implements ERC165 using a lookup table. - */ -contract SupportsInterfaceWithLookup is ERC165 { - - bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; - /** - * 0x01ffc9a7 === - * bytes4(keccak256('supportsInterface(bytes4)')) - */ - - /** - * @dev a mapping of interface id to whether or not it's supported - */ - mapping(bytes4 => bool) internal supportedInterfaces; - - /** - * @dev A contract implementing SupportsInterfaceWithLookup - * implement ERC165 itself - */ - constructor() - public - { - _registerInterface(InterfaceId_ERC165); - } - - /** - * @dev implement supportsInterface(bytes4) using a lookup table - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool) - { - return supportedInterfaces[_interfaceId]; - } - - /** - * @dev private method for registering an interface - */ - function _registerInterface(bytes4 _interfaceId) - internal - { - require(_interfaceId != 0xffffffff); - supportedInterfaces[_interfaceId] = true; - } -} - - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: contracts/interfaces/IGeneScience.sol - -// pragma solidity ^0.4.24; - - -/// @title defined the interface that will be referenced in main Kitty contract -contract IGeneScience { - /// @dev simply a boolean to indicate this is the contract we expect to be - function isGeneScience() public pure returns (bool); - - /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor - /// @param genes1 genes of mom - /// @param genes2 genes of sire - /// @param talents1 talents of mom - /// @param talents2 talents of sire - /// @return the genes and talents that are supposed to be passed down the child - function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); - - function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); - - function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); - - function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); - - function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); -} - - -// Dependency file: contracts/interfaces/IHabergPotionShop.sol - -// pragma solidity ^0.4.24; - -contract IHabergPotionShop { - function tryKillApostle(uint256 _tokenId, address _killer) public; - - function harbergLifeTime(uint256 _tokenId) public view; - -} - -// Dependency file: contracts/interfaces/ILandBase.sol - -// pragma solidity ^0.4.24; - -contract ILandBase { - - function resourceToken2RateAttrId(address _resourceToken) public view returns (uint256); -} - -// Root file: contracts/ApostleBase.sol - -pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; -// import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; -// import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; -// import "@evolutionland/common/contracts/interfaces/IActivity.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; -// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "contracts/interfaces/IGeneScience.sol"; -// import "contracts/interfaces/IHabergPotionShop.sol"; -// import "contracts/interfaces/ILandBase.sol"; - -// all Ids in this contracts refer to index which is using 128-bit unsigned integers. -// this is CONTRACT_APOSTLE_BASE -contract ApostleBase is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { - - event Birth( - address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime - ); - event Pregnant( - uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex - ); - - /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() - /// function. This is used to notify the auto-birth daemon that this breeding action - /// included a pre-payment of the gas required to call the giveBirth() function. - event AutoBirth(uint256 matronId, uint256 cooldownEndTime); - - event Unbox(uint256 tokenId, uint256 activeTime); - - struct Apostle { - // An apostles genes never change. - uint256 genes; - - uint256 talents; - - // the ID of the parents of this Apostle. set to 0 for gen0 apostle. - // Note that using 128-bit unsigned integers to represent parents IDs, - // which refer to lastApostleObjectId for those two. - uint256 matronId; - uint256 sireId; - - // Set to the ID of the sire apostle for matrons that are pregnant, - // zero otherwise. A non-zero value here is how we know an apostle - // is pregnant. Used to retrieve the genetic material for the new - // apostle when the birth transpires. - uint256 siringWithId; - // Set to the index in the cooldown array (see below) that represents - // the current cooldown duration for this apostle. - uint16 cooldownIndex; - // The "generation number" of this apostle. - uint16 generation; - - uint48 birthTime; - uint48 activeTime; - uint48 deadTime; - uint48 cooldownEndTime; - } - - uint32[14] public cooldowns = [ - uint32(1 minutes), - uint32(2 minutes), - uint32(5 minutes), - uint32(10 minutes), - uint32(30 minutes), - uint32(1 hours), - uint32(2 hours), - uint32(4 hours), - uint32(8 hours), - uint32(16 hours), - uint32(1 days), - uint32(2 days), - uint32(4 days), - uint32(7 days) - ]; - - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - modifier isHuman() { - require(msg.sender == tx.origin, "robot is not permitted"); - _; - } - - - /*** STORAGE ***/ - bool private singletonLock = false; - - uint128 public lastApostleObjectId; - - ISettingsRegistry public registry; - - mapping(uint256 => Apostle) public tokenId2Apostle; - - mapping(uint256 => address) public sireAllowedToAddress; - - function initializeContract(address _registry) public singletonLockCall { - // Ownable constructor - owner = msg.sender; - emit LogSetOwner(msg.sender); - - registry = ISettingsRegistry(_registry); - - _registerInterface(InterfaceId_IActivity); - _registerInterface(InterfaceId_IActivityObject); - _registerInterface(InterfaceId_IMinerObject); - _updateCoolDown(); - - } - - // called by gen0Apostle - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { - _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); - } - - function _createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { - - require(_generation <= 65535); - uint256 coolDownIndex = _generation / 2; - if (coolDownIndex > 13) { - coolDownIndex = 13; - } - - Apostle memory apostle = Apostle({ - genes : _genes, - talents : _talents, - birthTime : uint48(now), - activeTime : 0, - deadTime : 0, - cooldownEndTime : 0, - matronId : _matronId, - sireId : _sireId, - siringWithId : 0, - cooldownIndex : uint16(coolDownIndex), - generation : uint16(_generation) - }); - - lastApostleObjectId += 1; - require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); - uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); - - tokenId2Apostle[tokenId] = apostle; - - emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); - - return tokenId; - } - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ - uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; - return cooldowns[cooldownIndex]; - } - - // @dev Checks to see if a apostle is able to breed. - // @param _apostleId - index of apostles which is within uint128. - function isReadyToBreed(uint256 _apostleId) - public - view - returns (bool) - { - require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); - - require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); - - // In addition to checking the cooldownEndTime, we also need to check to see if - // the cat has a pending birth; there can be some period of time between the end - // of the pregnacy timer and the birth event. - return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); - } - - function approveSiring(address _addr, uint256 _sireId) - public - whenNotPaused - { - ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); - require(objectOwnership.ownerOf(_sireId) == msg.sender); - - sireAllowedToAddress[_sireId] = _addr; - } - - // check apostle's owner or siring permission - function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { - ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); - address matronOwner = objectOwnership.ownerOf(_matronId); - address sireOwner = objectOwnership.ownerOf(_sireId); - - // Siring is okay if they have same owner, or if the matron's owner was given - // permission to breed with this sire. - return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); - } - - function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { - - Apostle storage aps = tokenId2Apostle[_tokenId]; - // Compute the end of the cooldown time (based on current cooldownIndex) - aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); - - // Increment the breeding count, clamping it at 13, which is the length of the - // cooldowns array. We could check the array size dynamically, but hard-coding - // this as a constant saves gas. Yay, Solidity! - if (aps.cooldownIndex < 13) { - aps.cooldownIndex += 1; - } - - // address(0) meaning use by its owner or whitelisted contract - ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); - - return uint256(aps.cooldownEndTime); - - } - - function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { - return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); - } - - /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT - /// check ownership permissions (that is up to the caller). - /// @param _matron A reference to the apostle struct of the potential matron. - /// @param _matronId The matron's ID. - /// @param _sire A reference to the apostle struct of the potential sire. - /// @param _sireId The sire's ID - function _isValidMatingPair( - Apostle storage _matron, - uint256 _matronId, - Apostle storage _sire, - uint256 _sireId - ) - private - view - returns (bool) - { - // An apostle can't breed with itself! - if (_matronId == _sireId) { - return false; - } - - // Apostles can't breed with their parents. - if (_matron.matronId == _sireId || _matron.sireId == _sireId) { - return false; - } - if (_sire.matronId == _matronId || _sire.sireId == _matronId) { - return false; - } - - // We can short circuit the sibling check (below) if either cat is - // gen zero (has a matron ID of zero). - if (_sire.matronId == 0 || _matron.matronId == 0) { - return true; - } - - // Apostles can't breed with full or half siblings. - if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { - return false; - } - if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { - return false; - } - - // Everything seems cool! Let's get DTF. - return true; - } - - - function canBreedWith(uint256 _matronId, uint256 _sireId) - public - view - returns (bool) - { - require(_matronId > 0); - require(_sireId > 0); - Apostle storage matron = tokenId2Apostle[_matronId]; - Apostle storage sire = tokenId2Apostle[_sireId]; - return _isValidMatingPair(matron, _matronId, sire, _sireId) && - _isSiringPermitted(_sireId, _matronId) && - IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); - } - - - // only can be called by SiringClockAuction - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { - - _breedWith(_matronId, _sireId); - - Apostle storage matron = tokenId2Apostle[_matronId]; - emit AutoBirth(_matronId, matron.cooldownEndTime); - return true; - } - - - function _breedWith(uint256 _matronId, uint256 _sireId) internal { - require(canBreedWith(_matronId, _sireId)); - - require(isReadyToBreed(_matronId)); - require(isReadyToBreed(_sireId)); - - // Grab a reference to the Apostles from storage. - Apostle storage sire = tokenId2Apostle[_sireId]; - - Apostle storage matron = tokenId2Apostle[_matronId]; - - // Mark the matron as pregnant, keeping track of who the sire is. - matron.siringWithId = _sireId; - - // Trigger the cooldown for both parents. - uint sireCoolDownEndTime = _triggerCooldown(_sireId); - uint matronCoolDownEndTime = _triggerCooldown(_matronId); - - // Clear siring permission for both parents. This may not be strictly necessary - // but it's likely to avoid confusion! - delete sireAllowedToAddress[_matronId]; - delete sireAllowedToAddress[_sireId]; - - - // Emit the pregnancy event. - emit Pregnant( - _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); - } - - - function breedWithAuto(uint256 _matronId, uint256 _sireId) - public - whenNotPaused - { - // Check for payment - // caller must approve first. - uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); - ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); - require(ring.transferFrom(msg.sender, address(this), autoBirthFee)); - - // Call through the normal breeding flow - _breedWith(_matronId, _sireId); - - // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call - // giveBirth(). - Apostle storage matron = tokenId2Apostle[_matronId]; - emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); - } - /// @notice Have a pregnant apostle give birth! - /// @param _matronId An apostle ready to give birth. - /// @return The apostle tokenId of the new Apostles. - /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, - /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned - /// to the current owner of the matron. Upon successful completion, both the matron and the - /// new Apostles will be ready to breed again. Note that anyone can call this function (if they - /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. - function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level) - public - isHuman - whenNotPaused - { - - Apostle storage matron = tokenId2Apostle[_matronId]; - uint256 sireId = matron.siringWithId; - - if (_resourceToken != address(0)) { - // users must approve enough resourceToken to this contract - // if _resourceToken is registered - // will be checked in mixgenes - ERC20(_resourceToken).transferFrom(msg.sender, address(this), _level * registry.uintOf(UINT_MIX_TALENT)); - } - - - require(_payAndMix(_matronId, sireId, _resourceToken, _level)); - - } - - - function _payAndMix( - uint256 _matronId, - uint256 _sireId, - address _resourceToken, - uint256 _level) - internal returns (bool) { - // Grab a reference to the matron in storage. - Apostle storage matron = tokenId2Apostle[_matronId]; - Apostle storage sire = tokenId2Apostle[_sireId]; - - // Check that the matron is a valid apostle. - require(matron.birthTime > 0); - require(sire.birthTime > 0); - - // Check that the matron is pregnant, and that its time has come! - require(_isReadyToGiveBirth(matron)); - - // Grab a reference to the sire in storage. - // uint256 sireId = matron.siringWithId; - // prevent stack too deep error - // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; - - // Determine the higher generation number of the two parents - uint16 parentGen = matron.generation; - if (sire.generation > matron.generation) { - parentGen = sire.generation; - } - - // Call the sooper-sekret, sooper-expensive, gene mixing operation. - (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); - - address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); - // Make the new Apostle! - _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); - - // Clear the reference to sire from the matron (REQUIRED! Having siringWithId - // set is what marks a matron as being pregnant.) - delete matron.siringWithId; - - return true; - } - - function tokenFallback(address _from, uint256 _value, bytes _data) public { - uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); - - uint matronId; - uint sireId; - uint level; - - if (msg.sender == registry.addressOf(CONTRACT_RING_ERC20_TOKEN)) { - require(_value >= autoBirthFee, 'not enough to breed.'); - ERC223(msg.sender).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), _value, toBytes(_from)); - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - sireId := mload(add(ptr, 164)) - } - - // All checks passed, apostle gets pregnant! - _breedWith(matronId, sireId); - emit AutoBirth(matronId, uint48(tokenId2Apostle[matronId].cooldownEndTime)); - - } else if (isValidResourceToken(msg.sender)){ - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - level := mload(add(ptr, 164)) - } - - require(level > 0 && _value >= level * registry.uintOf(UINT_MIX_TALENT), 'resource for mixing is not enough.'); - - sireId = tokenId2Apostle[matronId].siringWithId; - - // TODO: msg.sender must be valid resource tokens, this is now checked in the implement of IGeneScience. - // better to check add a API in IGeneScience for checking valid msg.sender is one of the resource. - require(_payAndMix(matronId, sireId, msg.sender, level)); - - } - - } - - function isValidResourceToken(address _resourceToken) public view returns (bool) { - uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); - return index > 0; - } - - - /// Anyone can try to kill this Apostle; - function killApostle(uint256 _tokenId) public { - require(tokenId2Apostle[_tokenId].activeTime > 0); - require(defaultLifeTime(_tokenId) < now); - - address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); - IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); - } - - function isDead(uint256 _tokenId) public view returns (bool) { - return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; - } - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { - uint256 start = tokenId2Apostle[_tokenId].birthTime; - - if (tokenId2Apostle[_tokenId].activeTime > 0) { - start = tokenId2Apostle[_tokenId].activeTime; - } - - return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); - } - - /// IMinerObject - function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - uint talents = tokenId2Apostle[_tokenId].talents; - return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); - } - - /// IActivityObject - function activityAdded(uint256 _tokenId, address _activity, address _user) auth public { - // to active the apostle when it do activity the first time - if (tokenId2Apostle[_tokenId].activeTime == 0) { - tokenId2Apostle[_tokenId].activeTime = uint48(now); - - emit Unbox(_tokenId, now); - } - - } - - function activityRemoved(uint256 _tokenId, address _activity, address _user) auth public { - // do nothing. - } - - /// IActivity - function activityStopped(uint256 _tokenId) auth public { - // do nothing. - } - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { - Apostle storage apostle = tokenId2Apostle[_tokenId]; - return ( - apostle.genes, - apostle.talents, - apostle.matronId, - apostle.sireId, - uint256(apostle.cooldownIndex), - uint256(apostle.generation), - uint256(apostle.birthTime), - uint256(apostle.activeTime), - uint256(apostle.deadTime), - uint256(apostle.cooldownEndTime) - ); - } - - function toBytes(address x) public pure returns (bytes b) { - b = new bytes(32); - assembly {mstore(add(b, 32), x)} - } - - - function _updateCoolDown() internal { - cooldowns[0] = uint32(1 minutes); - cooldowns[1] = uint32(2 minutes); - cooldowns[2] = uint32(5 minutes); - cooldowns[3] = uint32(10 minutes); - cooldowns[4] = uint32(30 minutes); - cooldowns[5] = uint32(1 hours); - cooldowns[6] = uint32(2 hours); - cooldowns[7] = uint32(4 hours); - cooldowns[8] = uint32(8 hours); - cooldowns[9] = uint32(16 hours); - cooldowns[10] = uint32(1 days); - cooldowns[11] = uint32(2 days); - cooldowns[12] = uint32(4 days); - cooldowns[13] = uint32(7 days); - } -} - - diff --git a/flat/ApostleBaseAuthority.sol b/flat/ApostleBaseAuthority.sol deleted file mode 100644 index c198476..0000000 --- a/flat/ApostleBaseAuthority.sol +++ /dev/null @@ -1,23 +0,0 @@ -// Root file: contracts/ApostleBaseAuthority.sol - -pragma solidity ^0.4.24; - -contract ApostleBaseAuthority { - mapping (address => bool) public whiteList; - - constructor(address[] _whitelists) public { - for (uint i = 0; i < _whitelists.length; i ++) { - whiteList[_whitelists[i]] = true; - } - } - - function canCall( - address _src, address _dst, bytes4 _sig - ) public view returns (bool) { - return ( whiteList[_src] && _sig == bytes4(keccak256("createApostle(uint256,uint256,uint256,uint256,uint256,address)")) ) || - ( whiteList[_src] && _sig == bytes4(keccak256("breedWithInAuction(uint256,uint256)")) ) || - ( whiteList[_src] && _sig == bytes4(keccak256("activityAdded(uint256,address,address)"))) || - ( whiteList[_src] && _sig == bytes4(keccak256("activityRemoved(uint256,address,address)"))) || - ( whiteList[_src] && _sig == bytes4(keccak256("activityStopped(uint256)"))); - } -} \ No newline at end of file diff --git a/flat/ApostleBaseAuthorityV2.sol b/flat/ApostleBaseAuthorityV2.sol deleted file mode 100644 index 1a7a945..0000000 --- a/flat/ApostleBaseAuthorityV2.sol +++ /dev/null @@ -1,25 +0,0 @@ -// Root file: contracts/ApostleBaseAuthorityV2.sol - -pragma solidity ^0.4.24; - -contract ApostleBaseAuthorityV2 { - mapping (address => bool) public whiteList; - - constructor(address[] _whitelists) public { - for (uint i = 0; i < _whitelists.length; i ++) { - whiteList[_whitelists[i]] = true; - } - } - - function canCall( - address _src, address _dst, bytes4 _sig - ) public view returns (bool) { - return ( whiteList[_src] && _sig == bytes4(keccak256("createApostle(uint256,uint256,uint256,uint256,uint256,address)")) ) || - ( whiteList[_src] && _sig == bytes4(keccak256("breedWithInAuction(uint256,uint256)")) ) || - ( whiteList[_src] && _sig == bytes4(keccak256("activityAdded(uint256,address,address)"))) || - ( whiteList[_src] && _sig == bytes4(keccak256("activityRemoved(uint256,address,address)"))) || - ( whiteList[_src] && _sig == bytes4(keccak256("updateGenesAndTalents(uint256,uint256,uint256)"))) || - ( whiteList[_src] && _sig == bytes4(keccak256("batchUpdate(uint256[],uint256[],uint256[])"))) || - ( whiteList[_src] && _sig == bytes4(keccak256("activityStopped(uint256)"))); - } -} \ No newline at end of file diff --git a/flat/ApostleBaseV2.sol b/flat/ApostleBaseV2.sol deleted file mode 100644 index c64c4a0..0000000 --- a/flat/ApostleBaseV2.sol +++ /dev/null @@ -1,1251 +0,0 @@ -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IObjectOwnership.sol - -// pragma solidity ^0.4.24; - -contract IObjectOwnership { - function mintObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); - - function burnObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol - -// pragma solidity ^0.4.24; - -contract ITokenUse { - uint48 public constant MAX_UINT48_TIME = 281474976710655; - - function isObjectInHireStage(uint256 _tokenId) public view returns (bool); - - function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); - - function getTokenUser(uint256 _tokenId) public view returns (address); - - function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; - - function cancelTokenUseOffer(uint256 _tokenId) public; - - function takeTokenUseOffer(uint256 _tokenId) public; - - function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; - - function removeActivity(uint256 _tokenId, address _user) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IMinerObject.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IMinerObject is ERC165 { - bytes4 internal constant InterfaceId_IMinerObject = 0x64272b75; - - /* - * 0x64272b752 === - * bytes4(keccak256('strengthOf(uint256,address)')) - */ - - function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256); - -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IActivityObject.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IActivityObject is ERC165 { - bytes4 internal constant InterfaceId_IActivityObject = 0x2b9eccc6; - /* - * 0x2b9eccc6 === - * bytes4(keccak256('activityAdded(uint256,address,address)')) ^ - * bytes4(keccak256('activityRemoved(uint256,address,address)')) - */ - - function activityAdded(uint256 _tokenId, address _activity, address _user) public; - - function activityRemoved(uint256 _tokenId, address _activity, address _user) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IActivity.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IActivity is ERC165 { - bytes4 internal constant InterfaceId_IActivity = 0x6086e7f8; - /* - * 0x6086e7f8 === - * bytes4(keccak256('activityStopped(uint256)')) - */ - - function activityStopped(uint256 _tokenId) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol - -// pragma solidity ^0.4.23; - -contract ERC223 { - function transfer(address to, uint amount, bytes data) public returns (bool ok); - - function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); - - event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title SupportsInterfaceWithLookup - * @author Matt Condon (@shrugs) - * @dev Implements ERC165 using a lookup table. - */ -contract SupportsInterfaceWithLookup is ERC165 { - - bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; - /** - * 0x01ffc9a7 === - * bytes4(keccak256('supportsInterface(bytes4)')) - */ - - /** - * @dev a mapping of interface id to whether or not it's supported - */ - mapping(bytes4 => bool) internal supportedInterfaces; - - /** - * @dev A contract implementing SupportsInterfaceWithLookup - * implement ERC165 itself - */ - constructor() - public - { - _registerInterface(InterfaceId_ERC165); - } - - /** - * @dev implement supportsInterface(bytes4) using a lookup table - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool) - { - return supportedInterfaces[_interfaceId]; - } - - /** - * @dev private method for registering an interface - */ - function _registerInterface(bytes4 _interfaceId) - internal - { - require(_interfaceId != 0xffffffff); - supportedInterfaces[_interfaceId] = true; - } -} - - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: contracts/interfaces/IGeneScience.sol - -// pragma solidity ^0.4.24; - - -/// @title defined the interface that will be referenced in main Kitty contract -contract IGeneScience { - /// @dev simply a boolean to indicate this is the contract we expect to be - function isGeneScience() public pure returns (bool); - - /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor - /// @param genes1 genes of mom - /// @param genes2 genes of sire - /// @param talents1 talents of mom - /// @param talents2 talents of sire - /// @return the genes and talents that are supposed to be passed down the child - function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); - - function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); - - function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); - - function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); - - function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); -} - - -// Dependency file: contracts/interfaces/IHabergPotionShop.sol - -// pragma solidity ^0.4.24; - -contract IHabergPotionShop { - function tryKillApostle(uint256 _tokenId, address _killer) public; - - function harbergLifeTime(uint256 _tokenId) public view; - -} - -// Dependency file: contracts/interfaces/ILandBase.sol - -// pragma solidity ^0.4.24; - -contract ILandBase { - - function resourceToken2RateAttrId(address _resourceToken) public view returns (uint256); -} - -// Root file: contracts/ApostleBaseV2.sol - -pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; -// import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; -// import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; -// import "@evolutionland/common/contracts/interfaces/IActivity.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; -// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "contracts/interfaces/IGeneScience.sol"; -// import "contracts/interfaces/IHabergPotionShop.sol"; -// import "contracts/interfaces/ILandBase.sol"; - -// all Ids in this contracts refer to index which is using 128-bit unsigned integers. -// this is CONTRACT_APOSTLE_BASE -contract ApostleBaseV2 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { - - event Birth( - address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime - ); - event Pregnant( - uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex - ); - - /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() - /// function. This is used to notify the auto-birth daemon that this breeding action - /// included a pre-payment of the gas required to call the giveBirth() function. - event AutoBirth(uint256 matronId, uint256 cooldownEndTime); - - event Unbox(uint256 tokenId, uint256 activeTime); - - struct Apostle { - // An apostles genes never change. - uint256 genes; - - uint256 talents; - - // the ID of the parents of this Apostle. set to 0 for gen0 apostle. - // Note that using 128-bit unsigned integers to represent parents IDs, - // which refer to lastApostleObjectId for those two. - uint256 matronId; - uint256 sireId; - - // Set to the ID of the sire apostle for matrons that are pregnant, - // zero otherwise. A non-zero value here is how we know an apostle - // is pregnant. Used to retrieve the genetic material for the new - // apostle when the birth transpires. - uint256 siringWithId; - // Set to the index in the cooldown array (see below) that represents - // the current cooldown duration for this apostle. - uint16 cooldownIndex; - // The "generation number" of this apostle. - uint16 generation; - - uint48 birthTime; - uint48 activeTime; - uint48 deadTime; - uint48 cooldownEndTime; - } - - uint32[14] public cooldowns = [ - uint32(1 minutes), - uint32(2 minutes), - uint32(5 minutes), - uint32(10 minutes), - uint32(30 minutes), - uint32(1 hours), - uint32(2 hours), - uint32(4 hours), - uint32(8 hours), - uint32(16 hours), - uint32(1 days), - uint32(2 days), - uint32(4 days), - uint32(7 days) - ]; - - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - modifier isHuman() { - require(msg.sender == tx.origin, "robot is not permitted"); - _; - } - - - /*** STORAGE ***/ - bool private singletonLock = false; - - uint128 public lastApostleObjectId; - - ISettingsRegistry public registry; - - mapping(uint256 => Apostle) public tokenId2Apostle; - - mapping(uint256 => address) public sireAllowedToAddress; - - function initializeContract(address _registry) public singletonLockCall { - // Ownable constructor - owner = msg.sender; - emit LogSetOwner(msg.sender); - - registry = ISettingsRegistry(_registry); - - _registerInterface(InterfaceId_IActivity); - _registerInterface(InterfaceId_IActivityObject); - _registerInterface(InterfaceId_IMinerObject); - _updateCoolDown(); - - } - - // called by gen0Apostle - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { - _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); - } - - function _createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { - - require(_generation <= 65535); - uint256 coolDownIndex = _generation / 2; - if (coolDownIndex > 13) { - coolDownIndex = 13; - } - - Apostle memory apostle = Apostle({ - genes : _genes, - talents : _talents, - birthTime : uint48(now), - activeTime : 0, - deadTime : 0, - cooldownEndTime : 0, - matronId : _matronId, - sireId : _sireId, - siringWithId : 0, - cooldownIndex : uint16(coolDownIndex), - generation : uint16(_generation) - }); - - lastApostleObjectId += 1; - require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); - uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); - - tokenId2Apostle[tokenId] = apostle; - - emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); - - return tokenId; - } - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ - uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; - return cooldowns[cooldownIndex]; - } - - // @dev Checks to see if a apostle is able to breed. - // @param _apostleId - index of apostles which is within uint128. - function isReadyToBreed(uint256 _apostleId) - public - view - returns (bool) - { - require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); - - require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); - - // In addition to checking the cooldownEndTime, we also need to check to see if - // the cat has a pending birth; there can be some period of time between the end - // of the pregnacy timer and the birth event. - return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); - } - - function approveSiring(address _addr, uint256 _sireId) - public - whenNotPaused - { - ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); - require(objectOwnership.ownerOf(_sireId) == msg.sender); - - sireAllowedToAddress[_sireId] = _addr; - } - - // check apostle's owner or siring permission - function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { - ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); - address matronOwner = objectOwnership.ownerOf(_matronId); - address sireOwner = objectOwnership.ownerOf(_sireId); - - // Siring is okay if they have same owner, or if the matron's owner was given - // permission to breed with this sire. - return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); - } - - function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { - - Apostle storage aps = tokenId2Apostle[_tokenId]; - // Compute the end of the cooldown time (based on current cooldownIndex) - aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); - - // Increment the breeding count, clamping it at 13, which is the length of the - // cooldowns array. We could check the array size dynamically, but hard-coding - // this as a constant saves gas. Yay, Solidity! - if (aps.cooldownIndex < 13) { - aps.cooldownIndex += 1; - } - - // address(0) meaning use by its owner or whitelisted contract - ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); - - return uint256(aps.cooldownEndTime); - - } - - function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { - return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); - } - - /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT - /// check ownership permissions (that is up to the caller). - /// @param _matron A reference to the apostle struct of the potential matron. - /// @param _matronId The matron's ID. - /// @param _sire A reference to the apostle struct of the potential sire. - /// @param _sireId The sire's ID - function _isValidMatingPair( - Apostle storage _matron, - uint256 _matronId, - Apostle storage _sire, - uint256 _sireId - ) - private - view - returns (bool) - { - // An apostle can't breed with itself! - if (_matronId == _sireId) { - return false; - } - - // Apostles can't breed with their parents. - if (_matron.matronId == _sireId || _matron.sireId == _sireId) { - return false; - } - if (_sire.matronId == _matronId || _sire.sireId == _matronId) { - return false; - } - - // We can short circuit the sibling check (below) if either cat is - // gen zero (has a matron ID of zero). - if (_sire.matronId == 0 || _matron.matronId == 0) { - return true; - } - - // Apostles can't breed with full or half siblings. - if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { - return false; - } - if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { - return false; - } - - // Everything seems cool! Let's get DTF. - return true; - } - - - function canBreedWith(uint256 _matronId, uint256 _sireId) - public - view - returns (bool) - { - require(_matronId > 0); - require(_sireId > 0); - Apostle storage matron = tokenId2Apostle[_matronId]; - Apostle storage sire = tokenId2Apostle[_sireId]; - return _isValidMatingPair(matron, _matronId, sire, _sireId) && - _isSiringPermitted(_sireId, _matronId) && - IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); - } - - - // only can be called by SiringClockAuction - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { - - _breedWith(_matronId, _sireId); - - Apostle storage matron = tokenId2Apostle[_matronId]; - emit AutoBirth(_matronId, matron.cooldownEndTime); - return true; - } - - - function _breedWith(uint256 _matronId, uint256 _sireId) internal { - require(canBreedWith(_matronId, _sireId)); - - require(isReadyToBreed(_matronId)); - require(isReadyToBreed(_sireId)); - - // Grab a reference to the Apostles from storage. - Apostle storage sire = tokenId2Apostle[_sireId]; - - Apostle storage matron = tokenId2Apostle[_matronId]; - - // Mark the matron as pregnant, keeping track of who the sire is. - matron.siringWithId = _sireId; - - // Trigger the cooldown for both parents. - uint sireCoolDownEndTime = _triggerCooldown(_sireId); - uint matronCoolDownEndTime = _triggerCooldown(_matronId); - - // Clear siring permission for both parents. This may not be strictly necessary - // but it's likely to avoid confusion! - delete sireAllowedToAddress[_matronId]; - delete sireAllowedToAddress[_sireId]; - - - // Emit the pregnancy event. - emit Pregnant( - _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); - } - - - function breedWithAuto(uint256 _matronId, uint256 _sireId) - public - whenNotPaused - { - // Check for payment - // caller must approve first. - uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); - ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); - require(ring.transferFrom(msg.sender, address(this), autoBirthFee)); - - // Call through the normal breeding flow - _breedWith(_matronId, _sireId); - - // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call - // giveBirth(). - Apostle storage matron = tokenId2Apostle[_matronId]; - emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); - } - /// @notice Have a pregnant apostle give birth! - /// @param _matronId An apostle ready to give birth. - /// @return The apostle tokenId of the new Apostles. - /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, - /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned - /// to the current owner of the matron. Upon successful completion, both the matron and the - /// new Apostles will be ready to breed again. Note that anyone can call this function (if they - /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. - function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level) - public - isHuman - whenNotPaused - { - - Apostle storage matron = tokenId2Apostle[_matronId]; - uint256 sireId = matron.siringWithId; - - if (_resourceToken != address(0)) { - // users must approve enough resourceToken to this contract - // if _resourceToken is registered - // will be checked in mixgenes - ERC20(_resourceToken).transferFrom(msg.sender, address(this), _level * registry.uintOf(UINT_MIX_TALENT)); - } - - - require(_payAndMix(_matronId, sireId, _resourceToken, _level)); - - } - - - function _payAndMix( - uint256 _matronId, - uint256 _sireId, - address _resourceToken, - uint256 _level) - internal returns (bool) { - // Grab a reference to the matron in storage. - Apostle storage matron = tokenId2Apostle[_matronId]; - Apostle storage sire = tokenId2Apostle[_sireId]; - - // Check that the matron is a valid apostle. - require(matron.birthTime > 0); - require(sire.birthTime > 0); - - // Check that the matron is pregnant, and that its time has come! - require(_isReadyToGiveBirth(matron)); - - // Grab a reference to the sire in storage. - // uint256 sireId = matron.siringWithId; - // prevent stack too deep error - // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; - - // Determine the higher generation number of the two parents - uint16 parentGen = matron.generation; - if (sire.generation > matron.generation) { - parentGen = sire.generation; - } - - // Call the sooper-sekret, sooper-expensive, gene mixing operation. - (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); - - address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); - // Make the new Apostle! - _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); - - // Clear the reference to sire from the matron (REQUIRED! Having siringWithId - // set is what marks a matron as being pregnant.) - delete matron.siringWithId; - - return true; - } - - function tokenFallback(address _from, uint256 _value, bytes _data) public { - uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); - - uint matronId; - uint sireId; - uint level; - - if (msg.sender == registry.addressOf(CONTRACT_RING_ERC20_TOKEN)) { - require(_value >= autoBirthFee, 'not enough to breed.'); - ERC223(msg.sender).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), _value, toBytes(_from)); - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - sireId := mload(add(ptr, 164)) - } - - // All checks passed, apostle gets pregnant! - _breedWith(matronId, sireId); - emit AutoBirth(matronId, uint48(tokenId2Apostle[matronId].cooldownEndTime)); - - } else if (isValidResourceToken(msg.sender)){ - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - level := mload(add(ptr, 164)) - } - - require(level > 0 && _value >= level * registry.uintOf(UINT_MIX_TALENT), 'resource for mixing is not enough.'); - - sireId = tokenId2Apostle[matronId].siringWithId; - - // TODO: msg.sender must be valid resource tokens, this is now checked in the implement of IGeneScience. - // better to check add a API in IGeneScience for checking valid msg.sender is one of the resource. - require(_payAndMix(matronId, sireId, msg.sender, level)); - - } - - } - - function isValidResourceToken(address _resourceToken) public view returns (bool) { - uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); - return index > 0; - } - - - /// Anyone can try to kill this Apostle; - function killApostle(uint256 _tokenId) public { - require(tokenId2Apostle[_tokenId].activeTime > 0); - require(defaultLifeTime(_tokenId) < now); - - address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); - IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); - } - - function isDead(uint256 _tokenId) public view returns (bool) { - return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; - } - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { - uint256 start = tokenId2Apostle[_tokenId].birthTime; - - if (tokenId2Apostle[_tokenId].activeTime > 0) { - start = tokenId2Apostle[_tokenId].activeTime; - } - - return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); - } - - /// IMinerObject - function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - uint talents = tokenId2Apostle[_tokenId].talents; - return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); - } - - /// IActivityObject - function activityAdded(uint256 _tokenId, address _activity, address _user) auth public { - // to active the apostle when it do activity the first time - if (tokenId2Apostle[_tokenId].activeTime == 0) { - tokenId2Apostle[_tokenId].activeTime = uint48(now); - - emit Unbox(_tokenId, now); - } - - } - - function activityRemoved(uint256 _tokenId, address _activity, address _user) auth public { - // do nothing. - } - - /// IActivity - function activityStopped(uint256 _tokenId) auth public { - // do nothing. - } - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { - Apostle storage apostle = tokenId2Apostle[_tokenId]; - return ( - apostle.genes, - apostle.talents, - apostle.matronId, - apostle.sireId, - uint256(apostle.cooldownIndex), - uint256(apostle.generation), - uint256(apostle.birthTime), - uint256(apostle.activeTime), - uint256(apostle.deadTime), - uint256(apostle.cooldownEndTime) - ); - } - - function toBytes(address x) public pure returns (bytes b) { - b = new bytes(32); - assembly {mstore(add(b, 32), x)} - } - - - function _updateCoolDown() internal { - cooldowns[0] = uint32(1 minutes); - cooldowns[1] = uint32(2 minutes); - cooldowns[2] = uint32(5 minutes); - cooldowns[3] = uint32(10 minutes); - cooldowns[4] = uint32(30 minutes); - cooldowns[5] = uint32(1 hours); - cooldowns[6] = uint32(2 hours); - cooldowns[7] = uint32(4 hours); - cooldowns[8] = uint32(8 hours); - cooldowns[9] = uint32(16 hours); - cooldowns[10] = uint32(1 days); - cooldowns[11] = uint32(2 days); - cooldowns[12] = uint32(4 days); - cooldowns[13] = uint32(7 days); - } - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { - Apostle storage aps = tokenId2Apostle[_tokenId]; - aps.genes = _genes; - aps.talents = _talents; - } - - function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { - require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); - for(uint i = 0; i < _tokenIds.length; i++) { - Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; - aps.genes = _genesList[i]; - aps.talents = _talentsList[i]; - } - - } -} - - diff --git a/flat/ApostleBaseV3.sol b/flat/ApostleBaseV3.sol deleted file mode 100644 index 2083fc0..0000000 --- a/flat/ApostleBaseV3.sol +++ /dev/null @@ -1,1375 +0,0 @@ -// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol - -// pragma solidity ^0.4.24; - - -/** - * @title SafeMath - * @dev Math operations with safety checks that throw on error - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, throws on overflow. - */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - // Gas optimization: this is cheaper than asserting 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (_a == 0) { - return 0; - } - - 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 _a / _b; - } - - /** - * @dev Subtracts 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 c) { - c = _a + _b; - assert(c >= _a); - return c; - } -} - - -// Dependency file: contracts/interfaces/IItemBar.sol - -// pragma solidity ^0.4.24; - -interface IItemBar { - function enhanceStrengthRateOf( - address _resourceToken, - uint256 _tokenId - ) external view returns (uint256); -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IObjectOwnership.sol - -// pragma solidity ^0.4.24; - -contract IObjectOwnership { - function mintObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); - - function burnObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol - -// pragma solidity ^0.4.24; - -contract ITokenUse { - uint48 public constant MAX_UINT48_TIME = 281474976710655; - - function isObjectInHireStage(uint256 _tokenId) public view returns (bool); - - function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); - - function getTokenUser(uint256 _tokenId) public view returns (address); - - function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; - - function cancelTokenUseOffer(uint256 _tokenId) public; - - function takeTokenUseOffer(uint256 _tokenId) public; - - function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; - - function removeActivity(uint256 _tokenId, address _user) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IMinerObject.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IMinerObject is ERC165 { - bytes4 internal constant InterfaceId_IMinerObject = 0x64272b75; - - /* - * 0x64272b752 === - * bytes4(keccak256('strengthOf(uint256,address)')) - */ - - function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256); - -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IActivityObject.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IActivityObject is ERC165 { - bytes4 internal constant InterfaceId_IActivityObject = 0x2b9eccc6; - /* - * 0x2b9eccc6 === - * bytes4(keccak256('activityAdded(uint256,address,address)')) ^ - * bytes4(keccak256('activityRemoved(uint256,address,address)')) - */ - - function activityAdded(uint256 _tokenId, address _activity, address _user) public; - - function activityRemoved(uint256 _tokenId, address _activity, address _user) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IActivity.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - -contract IActivity is ERC165 { - bytes4 internal constant InterfaceId_IActivity = 0x6086e7f8; - /* - * 0x6086e7f8 === - * bytes4(keccak256('activityStopped(uint256)')) - */ - - function activityStopped(uint256 _tokenId) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol - -// pragma solidity ^0.4.23; - -contract ERC223 { - function transfer(address to, uint amount, bytes data) public returns (bool ok); - - function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); - - event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title SupportsInterfaceWithLookup - * @author Matt Condon (@shrugs) - * @dev Implements ERC165 using a lookup table. - */ -contract SupportsInterfaceWithLookup is ERC165 { - - bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; - /** - * 0x01ffc9a7 === - * bytes4(keccak256('supportsInterface(bytes4)')) - */ - - /** - * @dev a mapping of interface id to whether or not it's supported - */ - mapping(bytes4 => bool) internal supportedInterfaces; - - /** - * @dev A contract implementing SupportsInterfaceWithLookup - * implement ERC165 itself - */ - constructor() - public - { - _registerInterface(InterfaceId_ERC165); - } - - /** - * @dev implement supportsInterface(bytes4) using a lookup table - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool) - { - return supportedInterfaces[_interfaceId]; - } - - /** - * @dev private method for registering an interface - */ - function _registerInterface(bytes4 _interfaceId) - internal - { - require(_interfaceId != 0xffffffff); - supportedInterfaces[_interfaceId] = true; - } -} - - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: contracts/interfaces/IGeneScience.sol - -// pragma solidity ^0.4.24; - - -/// @title defined the interface that will be referenced in main Kitty contract -contract IGeneScience { - /// @dev simply a boolean to indicate this is the contract we expect to be - function isGeneScience() public pure returns (bool); - - /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor - /// @param genes1 genes of mom - /// @param genes2 genes of sire - /// @param talents1 talents of mom - /// @param talents2 talents of sire - /// @return the genes and talents that are supposed to be passed down the child - function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); - - function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); - - function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); - - function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); - - function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); -} - - -// Dependency file: contracts/interfaces/IHabergPotionShop.sol - -// pragma solidity ^0.4.24; - -contract IHabergPotionShop { - function tryKillApostle(uint256 _tokenId, address _killer) public; - - function harbergLifeTime(uint256 _tokenId) public view; - -} - -// Dependency file: contracts/interfaces/ILandBase.sol - -// pragma solidity ^0.4.24; - -contract ILandBase { - - function resourceToken2RateAttrId(address _resourceToken) public view returns (uint256); -} - -// Dependency file: contracts/ApostleBaseV2.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; -// import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; -// import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; -// import "@evolutionland/common/contracts/interfaces/IActivity.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; -// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "contracts/interfaces/IGeneScience.sol"; -// import "contracts/interfaces/IHabergPotionShop.sol"; -// import "contracts/interfaces/ILandBase.sol"; - -// all Ids in this contracts refer to index which is using 128-bit unsigned integers. -// this is CONTRACT_APOSTLE_BASE -contract ApostleBaseV2 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { - - event Birth( - address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime - ); - event Pregnant( - uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex - ); - - /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() - /// function. This is used to notify the auto-birth daemon that this breeding action - /// included a pre-payment of the gas required to call the giveBirth() function. - event AutoBirth(uint256 matronId, uint256 cooldownEndTime); - - event Unbox(uint256 tokenId, uint256 activeTime); - - struct Apostle { - // An apostles genes never change. - uint256 genes; - - uint256 talents; - - // the ID of the parents of this Apostle. set to 0 for gen0 apostle. - // Note that using 128-bit unsigned integers to represent parents IDs, - // which refer to lastApostleObjectId for those two. - uint256 matronId; - uint256 sireId; - - // Set to the ID of the sire apostle for matrons that are pregnant, - // zero otherwise. A non-zero value here is how we know an apostle - // is pregnant. Used to retrieve the genetic material for the new - // apostle when the birth transpires. - uint256 siringWithId; - // Set to the index in the cooldown array (see below) that represents - // the current cooldown duration for this apostle. - uint16 cooldownIndex; - // The "generation number" of this apostle. - uint16 generation; - - uint48 birthTime; - uint48 activeTime; - uint48 deadTime; - uint48 cooldownEndTime; - } - - uint32[14] public cooldowns = [ - uint32(1 minutes), - uint32(2 minutes), - uint32(5 minutes), - uint32(10 minutes), - uint32(30 minutes), - uint32(1 hours), - uint32(2 hours), - uint32(4 hours), - uint32(8 hours), - uint32(16 hours), - uint32(1 days), - uint32(2 days), - uint32(4 days), - uint32(7 days) - ]; - - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - modifier isHuman() { - require(msg.sender == tx.origin, "robot is not permitted"); - _; - } - - - /*** STORAGE ***/ - bool private singletonLock = false; - - uint128 public lastApostleObjectId; - - ISettingsRegistry public registry; - - mapping(uint256 => Apostle) public tokenId2Apostle; - - mapping(uint256 => address) public sireAllowedToAddress; - - function initializeContract(address _registry) public singletonLockCall { - // Ownable constructor - owner = msg.sender; - emit LogSetOwner(msg.sender); - - registry = ISettingsRegistry(_registry); - - _registerInterface(InterfaceId_IActivity); - _registerInterface(InterfaceId_IActivityObject); - _registerInterface(InterfaceId_IMinerObject); - _updateCoolDown(); - - } - - // called by gen0Apostle - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { - _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); - } - - function _createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { - - require(_generation <= 65535); - uint256 coolDownIndex = _generation / 2; - if (coolDownIndex > 13) { - coolDownIndex = 13; - } - - Apostle memory apostle = Apostle({ - genes : _genes, - talents : _talents, - birthTime : uint48(now), - activeTime : 0, - deadTime : 0, - cooldownEndTime : 0, - matronId : _matronId, - sireId : _sireId, - siringWithId : 0, - cooldownIndex : uint16(coolDownIndex), - generation : uint16(_generation) - }); - - lastApostleObjectId += 1; - require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); - uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); - - tokenId2Apostle[tokenId] = apostle; - - emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); - - return tokenId; - } - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ - uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; - return cooldowns[cooldownIndex]; - } - - // @dev Checks to see if a apostle is able to breed. - // @param _apostleId - index of apostles which is within uint128. - function isReadyToBreed(uint256 _apostleId) - public - view - returns (bool) - { - require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); - - require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); - - // In addition to checking the cooldownEndTime, we also need to check to see if - // the cat has a pending birth; there can be some period of time between the end - // of the pregnacy timer and the birth event. - return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); - } - - function approveSiring(address _addr, uint256 _sireId) - public - whenNotPaused - { - ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); - require(objectOwnership.ownerOf(_sireId) == msg.sender); - - sireAllowedToAddress[_sireId] = _addr; - } - - // check apostle's owner or siring permission - function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { - ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); - address matronOwner = objectOwnership.ownerOf(_matronId); - address sireOwner = objectOwnership.ownerOf(_sireId); - - // Siring is okay if they have same owner, or if the matron's owner was given - // permission to breed with this sire. - return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); - } - - function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { - - Apostle storage aps = tokenId2Apostle[_tokenId]; - // Compute the end of the cooldown time (based on current cooldownIndex) - aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); - - // Increment the breeding count, clamping it at 13, which is the length of the - // cooldowns array. We could check the array size dynamically, but hard-coding - // this as a constant saves gas. Yay, Solidity! - if (aps.cooldownIndex < 13) { - aps.cooldownIndex += 1; - } - - // address(0) meaning use by its owner or whitelisted contract - ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); - - return uint256(aps.cooldownEndTime); - - } - - function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { - return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); - } - - /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT - /// check ownership permissions (that is up to the caller). - /// @param _matron A reference to the apostle struct of the potential matron. - /// @param _matronId The matron's ID. - /// @param _sire A reference to the apostle struct of the potential sire. - /// @param _sireId The sire's ID - function _isValidMatingPair( - Apostle storage _matron, - uint256 _matronId, - Apostle storage _sire, - uint256 _sireId - ) - private - view - returns (bool) - { - // An apostle can't breed with itself! - if (_matronId == _sireId) { - return false; - } - - // Apostles can't breed with their parents. - if (_matron.matronId == _sireId || _matron.sireId == _sireId) { - return false; - } - if (_sire.matronId == _matronId || _sire.sireId == _matronId) { - return false; - } - - // We can short circuit the sibling check (below) if either cat is - // gen zero (has a matron ID of zero). - if (_sire.matronId == 0 || _matron.matronId == 0) { - return true; - } - - // Apostles can't breed with full or half siblings. - if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { - return false; - } - if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { - return false; - } - - // Everything seems cool! Let's get DTF. - return true; - } - - - function canBreedWith(uint256 _matronId, uint256 _sireId) - public - view - returns (bool) - { - require(_matronId > 0); - require(_sireId > 0); - Apostle storage matron = tokenId2Apostle[_matronId]; - Apostle storage sire = tokenId2Apostle[_sireId]; - return _isValidMatingPair(matron, _matronId, sire, _sireId) && - _isSiringPermitted(_sireId, _matronId) && - IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); - } - - - // only can be called by SiringClockAuction - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { - - _breedWith(_matronId, _sireId); - - Apostle storage matron = tokenId2Apostle[_matronId]; - emit AutoBirth(_matronId, matron.cooldownEndTime); - return true; - } - - - function _breedWith(uint256 _matronId, uint256 _sireId) internal { - require(canBreedWith(_matronId, _sireId)); - - require(isReadyToBreed(_matronId)); - require(isReadyToBreed(_sireId)); - - // Grab a reference to the Apostles from storage. - Apostle storage sire = tokenId2Apostle[_sireId]; - - Apostle storage matron = tokenId2Apostle[_matronId]; - - // Mark the matron as pregnant, keeping track of who the sire is. - matron.siringWithId = _sireId; - - // Trigger the cooldown for both parents. - uint sireCoolDownEndTime = _triggerCooldown(_sireId); - uint matronCoolDownEndTime = _triggerCooldown(_matronId); - - // Clear siring permission for both parents. This may not be strictly necessary - // but it's likely to avoid confusion! - delete sireAllowedToAddress[_matronId]; - delete sireAllowedToAddress[_sireId]; - - - // Emit the pregnancy event. - emit Pregnant( - _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); - } - - - function breedWithAuto(uint256 _matronId, uint256 _sireId) - public - whenNotPaused - { - // Check for payment - // caller must approve first. - uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); - ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); - require(ring.transferFrom(msg.sender, address(this), autoBirthFee)); - - // Call through the normal breeding flow - _breedWith(_matronId, _sireId); - - // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call - // giveBirth(). - Apostle storage matron = tokenId2Apostle[_matronId]; - emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); - } - /// @notice Have a pregnant apostle give birth! - /// @param _matronId An apostle ready to give birth. - /// @return The apostle tokenId of the new Apostles. - /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, - /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned - /// to the current owner of the matron. Upon successful completion, both the matron and the - /// new Apostles will be ready to breed again. Note that anyone can call this function (if they - /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. - function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level) - public - isHuman - whenNotPaused - { - - Apostle storage matron = tokenId2Apostle[_matronId]; - uint256 sireId = matron.siringWithId; - - if (_resourceToken != address(0)) { - // users must approve enough resourceToken to this contract - // if _resourceToken is registered - // will be checked in mixgenes - ERC20(_resourceToken).transferFrom(msg.sender, address(this), _level * registry.uintOf(UINT_MIX_TALENT)); - } - - - require(_payAndMix(_matronId, sireId, _resourceToken, _level)); - - } - - - function _payAndMix( - uint256 _matronId, - uint256 _sireId, - address _resourceToken, - uint256 _level) - internal returns (bool) { - // Grab a reference to the matron in storage. - Apostle storage matron = tokenId2Apostle[_matronId]; - Apostle storage sire = tokenId2Apostle[_sireId]; - - // Check that the matron is a valid apostle. - require(matron.birthTime > 0); - require(sire.birthTime > 0); - - // Check that the matron is pregnant, and that its time has come! - require(_isReadyToGiveBirth(matron)); - - // Grab a reference to the sire in storage. - // uint256 sireId = matron.siringWithId; - // prevent stack too deep error - // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; - - // Determine the higher generation number of the two parents - uint16 parentGen = matron.generation; - if (sire.generation > matron.generation) { - parentGen = sire.generation; - } - - // Call the sooper-sekret, sooper-expensive, gene mixing operation. - (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); - - address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); - // Make the new Apostle! - _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); - - // Clear the reference to sire from the matron (REQUIRED! Having siringWithId - // set is what marks a matron as being pregnant.) - delete matron.siringWithId; - - return true; - } - - function tokenFallback(address _from, uint256 _value, bytes _data) public { - uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); - - uint matronId; - uint sireId; - uint level; - - if (msg.sender == registry.addressOf(CONTRACT_RING_ERC20_TOKEN)) { - require(_value >= autoBirthFee, 'not enough to breed.'); - ERC223(msg.sender).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), _value, toBytes(_from)); - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - sireId := mload(add(ptr, 164)) - } - - // All checks passed, apostle gets pregnant! - _breedWith(matronId, sireId); - emit AutoBirth(matronId, uint48(tokenId2Apostle[matronId].cooldownEndTime)); - - } else if (isValidResourceToken(msg.sender)){ - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - level := mload(add(ptr, 164)) - } - - require(level > 0 && _value >= level * registry.uintOf(UINT_MIX_TALENT), 'resource for mixing is not enough.'); - - sireId = tokenId2Apostle[matronId].siringWithId; - - // TODO: msg.sender must be valid resource tokens, this is now checked in the implement of IGeneScience. - // better to check add a API in IGeneScience for checking valid msg.sender is one of the resource. - require(_payAndMix(matronId, sireId, msg.sender, level)); - - } - - } - - function isValidResourceToken(address _resourceToken) public view returns (bool) { - uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); - return index > 0; - } - - - /// Anyone can try to kill this Apostle; - function killApostle(uint256 _tokenId) public { - require(tokenId2Apostle[_tokenId].activeTime > 0); - require(defaultLifeTime(_tokenId) < now); - - address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); - IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); - } - - function isDead(uint256 _tokenId) public view returns (bool) { - return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; - } - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { - uint256 start = tokenId2Apostle[_tokenId].birthTime; - - if (tokenId2Apostle[_tokenId].activeTime > 0) { - start = tokenId2Apostle[_tokenId].activeTime; - } - - return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); - } - - /// IMinerObject - function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - uint talents = tokenId2Apostle[_tokenId].talents; - return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); - } - - /// IActivityObject - function activityAdded(uint256 _tokenId, address _activity, address _user) auth public { - // to active the apostle when it do activity the first time - if (tokenId2Apostle[_tokenId].activeTime == 0) { - tokenId2Apostle[_tokenId].activeTime = uint48(now); - - emit Unbox(_tokenId, now); - } - - } - - function activityRemoved(uint256 _tokenId, address _activity, address _user) auth public { - // do nothing. - } - - /// IActivity - function activityStopped(uint256 _tokenId) auth public { - // do nothing. - } - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { - Apostle storage apostle = tokenId2Apostle[_tokenId]; - return ( - apostle.genes, - apostle.talents, - apostle.matronId, - apostle.sireId, - uint256(apostle.cooldownIndex), - uint256(apostle.generation), - uint256(apostle.birthTime), - uint256(apostle.activeTime), - uint256(apostle.deadTime), - uint256(apostle.cooldownEndTime) - ); - } - - function toBytes(address x) public pure returns (bytes b) { - b = new bytes(32); - assembly {mstore(add(b, 32), x)} - } - - - function _updateCoolDown() internal { - cooldowns[0] = uint32(1 minutes); - cooldowns[1] = uint32(2 minutes); - cooldowns[2] = uint32(5 minutes); - cooldowns[3] = uint32(10 minutes); - cooldowns[4] = uint32(30 minutes); - cooldowns[5] = uint32(1 hours); - cooldowns[6] = uint32(2 hours); - cooldowns[7] = uint32(4 hours); - cooldowns[8] = uint32(8 hours); - cooldowns[9] = uint32(16 hours); - cooldowns[10] = uint32(1 days); - cooldowns[11] = uint32(2 days); - cooldowns[12] = uint32(4 days); - cooldowns[13] = uint32(7 days); - } - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { - Apostle storage aps = tokenId2Apostle[_tokenId]; - aps.genes = _genes; - aps.talents = _talents; - } - - function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { - require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); - for(uint i = 0; i < _tokenIds.length; i++) { - Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; - aps.genes = _genesList[i]; - aps.talents = _talentsList[i]; - } - - } -} - - - - -// Root file: contracts/ApostleBaseV3.sol - -pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -// import "contracts/interfaces/IItemBar.sol"; -// import "contracts/ApostleBaseV2.sol"; - -contract ApostleBaseV3 is ApostleBaseV2 { - - using SafeMath for uint256; - - // 0x434f4e54524143545f41504f53544c455f4954454d5f42415200000000000000 - bytes32 public constant CONTRACT_APOSTLE_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; - - // rate precision - uint128 public constant RATE_PRECISION = 10**8; - - //cache for gas saving - mapping(uint256 => mapping(uint256 => mapping(address => uint256))) talents2Strength; - - function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - uint256 talents = tokenId2Apostle[_tokenId].talents; - uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; - if (strength == 0) { - strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); - } - // V3 - address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); - uint256 enhanceRate = - IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); - uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_PRECISION); - uint256 totalStrength = strength.add(enhanceStrength); - return totalStrength; - } - - function cachedStrengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public returns (uint256) { - uint256 talents = tokenId2Apostle[_tokenId].talents; - uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; - if (strength == 0) { - strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); - talents2Strength[talents][_landTokenId][_resourceToken] = strength; - } - // V3 - address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); - uint256 enhanceRate = - IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); - uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_PRECISION); - uint256 totalStrength = strength.add(enhanceStrength); - return totalStrength; - } -} diff --git a/flat/ApostleClockAuction.sol b/flat/ApostleClockAuction.sol deleted file mode 100644 index e16ee50..0000000 --- a/flat/ApostleClockAuction.sol +++ /dev/null @@ -1,1164 +0,0 @@ -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol - -// pragma solidity ^0.4.24; - - -/** - * @title SafeMath - * @dev Math operations with safety checks that throw on error - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, throws on overflow. - */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - // Gas optimization: this is cheaper than asserting 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (_a == 0) { - return 0; - } - - 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 _a / _b; - } - - /** - * @dev Subtracts 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 c) { - c = _a + _b; - assert(c >= _a); - return c; - } -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol - -// pragma solidity ^0.4.23; - -contract ERC223 { - function transfer(address to, uint amount, bytes data) public returns (bool ok); - - function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); - - event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: contracts/interfaces/IApostleBase.sol - -// pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol - -// pragma solidity ^0.4.24; - -contract ITokenUse { - uint48 public constant MAX_UINT48_TIME = 281474976710655; - - function isObjectInHireStage(uint256 _tokenId) public view returns (bool); - - function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); - - function getTokenUser(uint256 _tokenId) public view returns (address); - - function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; - - function cancelTokenUseOffer(uint256 _tokenId) public; - - function takeTokenUseOffer(uint256 _tokenId) public; - - function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; - - function removeActivity(uint256 _tokenId, address _user) public; -} - -// Root file: contracts/ApostleClockAuction.sol - -pragma solidity ^0.4.23; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "contracts/interfaces/IApostleBase.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; - -contract ApostleClockAuction is PausableDSAuth, ApostleSettingIds { - using SafeMath for *; - event AuctionCreated( - uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt - ); - - event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); - event AuctionCancelled(uint256 tokenId); - - // claimedToken event - event ClaimedTokens(address indexed token, address indexed owner, uint amount); - - // new bid event - event NewBid( - uint256 indexed tokenId, address lastBidder, address lastReferer, uint256 lastRecord, address tokenAddress, uint256 bidStartAt, uint256 returnToLastBidder - ); - - // Represents an auction on an NFT - struct Auction { - // Current owner of NFT - address seller; - // Time when auction started - // NOTE: 0 if this auction has been concluded - uint48 startedAt; - // Duration (in seconds) of auction - uint48 duration; - // Price (in token) at beginning of auction - uint128 startingPriceInToken; - // Price (in token) at end of auction - uint128 endingPriceInToken; - // bid the auction through which token - address token; - - // it saves gas in this order - // highest offered price (in RING) - uint128 lastRecord; - // bidder who offer the highest price - address lastBidder; - // latestBidder's bidTime in timestamp - uint48 lastBidStartAt; - // lastBidder's referer - address lastReferer; - } - - bool private singletonLock = false; - - ISettingsRegistry public registry; - - // Map from token ID to their corresponding auction. - mapping(uint256 => Auction) public tokenIdToAuction; - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - modifier isHuman() { - require(msg.sender == tx.origin, "robot is not permitted"); - _; - } - - // Modifiers to check that inputs can be safely stored with a certain - // number of bits. We use constants and multiple modifiers to save gas. - modifier canBeStoredWith48Bits(uint256 _value) { - require(_value <= 281474976710656); - _; - } - - modifier canBeStoredWith128Bits(uint256 _value) { - require(_value < 340282366920938463463374607431768211455); - _; - } - - modifier isOnAuction(uint256 _tokenId) { - require(tokenIdToAuction[_tokenId].startedAt > 0); - _; - } - - /////////////////////// - // Constructor - /////////////////////// - constructor() public { - // initializeContract - } - - /// @dev Constructor creates a reference to the NFT ownership contract - /// and verifies the owner cut is in the valid range. - /// bidWaitingMinutes - biggest waiting time from a bid's starting to ending(in minutes) - function initializeContract( - ISettingsRegistry _registry) public singletonLockCall { - - owner = msg.sender; - emit LogSetOwner(msg.sender); - - registry = _registry; - } - - /// @dev DON'T give me your money. - function() external {} - - /////////////////////// - // Auction Create and Cancel - /////////////////////// - - function createAuction( - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _token) // with any token - public auth { - _createAuction(msg.sender, _tokenId, _startingPriceInToken, _endingPriceInToken, _duration, _startAt, msg.sender, _token); - } - - /// @dev Cancels an auction that hasn't been won yet. - /// Returns the NFT to original owner. - /// @notice This is a state-modifying function that can - /// be called while the contract is paused. - /// @param _tokenId - ID of token on auction - function cancelAuction(uint256 _tokenId) public isOnAuction(_tokenId) - { - Auction storage auction = tokenIdToAuction[_tokenId]; - - address seller = auction.seller; - require((msg.sender == seller && !paused) || msg.sender == owner); - - // once someone has bidden for this auction, no one has the right to cancel it. - require(auction.lastBidder == 0x0); - - delete tokenIdToAuction[_tokenId]; - - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, seller, _tokenId); - emit AuctionCancelled(_tokenId); - } - - //@dev only NFT contract can invoke this - //@param _from - owner of _tokenId - function receiveApproval( - address _from, - uint256 _tokenId, - bytes //_extraData - ) - public - whenNotPaused - { - if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { - uint256 startingPriceInRING; - uint256 endingPriceInRING; - uint256 duration; - address seller; - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - startingPriceInRING := mload(add(ptr, 132)) - endingPriceInRING := mload(add(ptr, 164)) - duration := mload(add(ptr, 196)) - seller := mload(add(ptr, 228)) - } - - // TODO: add parameter _token - _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); - } - - } - - /////////////////////// - // Bid With Auction - /////////////////////// - - // @dev bid with RING. Computes the price and transfers winnings. - function _bidWithToken(address _from, uint256 _tokenId, uint256 _valueInToken, address _referer) internal returns (uint256){ - // Get a reference to the auction struct - Auction storage auction = tokenIdToAuction[_tokenId]; - - // Check that the incoming bid is higher than the current price - uint priceInToken = getCurrentPriceInToken(_tokenId); - require(_valueInToken >= priceInToken, - "your offer is lower than the current price, try again with a higher one."); - uint refund = _valueInToken - priceInToken; - - if (refund > 0) { - ERC20(auction.token).transfer(_from, refund); - } - - uint bidMoment; - uint returnToLastBidder; - (bidMoment, returnToLastBidder) = _bidProcess(_from, auction, priceInToken, _referer); - - // Tell the world! - emit NewBid(_tokenId, _from, _referer, priceInToken, auction.token, bidMoment, returnToLastBidder); - - return priceInToken; - } - - // here to handle bid for LAND(NFT) using RING - // @dev bidder must use RING.transfer(address(this), _valueInRING, bytes32(_tokenId) - // to invoke this function - // @param _data - need to be generated from (tokenId + referer) - - function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { - uint tokenId; - address referer; - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - tokenId := mload(add(ptr, 132)) - referer := mload(add(ptr, 164)) - } - - // safer for users - require(msg.sender == tokenIdToAuction[tokenId].token); - require(tokenIdToAuction[tokenId].startedAt > 0); - - _bidWithToken(_from, tokenId, _valueInToken, referer); - } - - // TODO: advice: offer some reward for the person who claimed - // @dev claim _tokenId for auction's lastBidder - function claimApostleAsset(uint _tokenId) public isHuman isOnAuction(_tokenId) { - // Get a reference to the auction struct - Auction storage auction = tokenIdToAuction[_tokenId]; - - // at least bidWaitingTime after last bidder's bid moment, - // and no one else has bidden during this bidWaitingTime, - // then any one can claim this token(land) for lastBidder. - require(auction.lastBidder != 0x0 && now >= auction.lastBidStartAt + registry.uintOf(ApostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME), - "this auction has not finished yet, try again later"); - - address lastBidder = auction.lastBidder; - uint lastRecord = auction.lastRecord; - - delete tokenIdToAuction[_tokenId]; - - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, lastBidder, _tokenId); - - emit AuctionSuccessful(_tokenId, lastRecord, lastBidder); - } - - function _firstPartBid(uint _auctionCut, uint _refererCut, address _pool, address _buyer, Auction storage _auction, uint _priceInToken, address _referer) internal returns (uint, uint){ - require(now >= uint256(_auction.startedAt)); - // Calculate the auctioneer's cut. - // (NOTE: computeCut() is guaranteed to return a - // value <= price, so this subtraction can't go negative.) - // TODO: token to the seller - uint256 ownerCutAmount = computeCut(_priceInToken, _auctionCut); - - // transfer to the seller - ERC223(_auction.token).transfer(_auction.seller, (_priceInToken - ownerCutAmount), toBytes(_buyer)); - - if (_referer != 0x0) { - uint refererBounty = computeCut(ownerCutAmount, _refererCut); - ERC20(_auction.token).transfer(_referer, refererBounty); - ERC223(_auction.token).transfer(_pool, (ownerCutAmount - refererBounty), toBytes(_buyer)); - } else { - ERC223(_auction.token).transfer(_pool, ownerCutAmount, toBytes(_buyer)); - } - - // modify bid-related member variables - _auction.lastBidder = _buyer; - _auction.lastRecord = uint128(_priceInToken); - _auction.lastBidStartAt = uint48(now); - _auction.lastReferer = _referer; - - return (_auction.lastBidStartAt, 0); - } - - - function _secondPartBid(uint _auctionCut, uint _refererCut, address _pool, address _buyer, Auction storage _auction, uint _priceInToken, address _referer) internal returns (uint, uint){ - // TODO: repair bug of first bid's time limitation - // if this the first bid, there is no time limitation - require(now <= _auction.lastBidStartAt + registry.uintOf(ApostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME), "It's too late."); - - // _priceInToken that is larger than lastRecord - // was assured in _currentPriceInRING(_auction) - // here double check - // 1.1*price + bounty - (price + bounty) = 0.1 * price - uint surplus = _priceInToken.sub(uint256(_auction.lastRecord)); - uint poolCutAmount = computeCut(surplus, _auctionCut); - uint extractFromGap = surplus - poolCutAmount; - uint realReturnForEach = extractFromGap / 2; - - // here use transfer(address,uint256) for safety - ERC223(_auction.token).transfer(_auction.seller, realReturnForEach, toBytes(_buyer)); - ERC20(_auction.token).transfer(_auction.lastBidder, (realReturnForEach + uint256(_auction.lastRecord))); - - if (_referer != 0x0) { - uint refererBounty = computeCut(poolCutAmount, _refererCut); - ERC20(_auction.token).transfer(_referer, refererBounty); - ERC223(_auction.token).transfer(_pool, (poolCutAmount - refererBounty), toBytes(_buyer)); - } else { - ERC223(_auction.token).transfer(_pool, poolCutAmount, toBytes(_buyer)); - } - - // modify bid-related member variables - _auction.lastBidder = _buyer; - _auction.lastRecord = uint128(_priceInToken); - _auction.lastBidStartAt = uint48(now); - _auction.lastReferer = _referer; - - return (_auction.lastBidStartAt, (realReturnForEach + uint256(_auction.lastRecord))); - } - - // TODO: add _token to compatible backwards with ring and eth - function _bidProcess(address _buyer, Auction storage _auction, uint _priceInToken, address _referer) - internal - canBeStoredWith128Bits(_priceInToken) - returns (uint256, uint256){ - - uint auctionCut = registry.uintOf(UINT_AUCTION_CUT); - uint256 refererCut = registry.uintOf(UINT_REFERER_CUT); - address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); - - // uint256 refererBounty; - - // the first bid - if (_auction.lastBidder == 0x0 && _priceInToken > 0) { - - return _firstPartBid(auctionCut, refererCut, revenuePool, _buyer, _auction, _priceInToken, _referer); - } - - // TODO: the math calculation needs further check - // not the first bid - if (_auction.lastRecord > 0 && _auction.lastBidder != 0x0) { - - return _secondPartBid(auctionCut, refererCut, revenuePool, _buyer, _auction, _priceInToken, _referer); - } - - } - - - /// @notice This method can be used by the owner to extract mistakenly - /// sent tokens to this contract. - /// @param _token The address of the token contract that you want to recover - /// set to 0 in case you want to extract ether. - function claimTokens(address _token) public onlyOwner { - if (_token == 0x0) { - owner.transfer(address(this).balance); - return; - } - ERC20 token = ERC20(_token); - uint balance = token.balanceOf(address(this)); - token.transfer(owner, balance); - - emit ClaimedTokens(_token, owner, balance); - } - - /// @dev Computes owner's cut of a sale. - /// @param _price - Sale price of NFT. - function computeCut(uint256 _price, uint256 _cut) public pure returns (uint256) { - // NOTE: We don't use SafeMath (or similar) in this function because - // all of our entry functions carefully cap the maximum values for - // currency (at 128-bits), and ownerCut <= 10000 (see the require() - // statement in the ClockAuction constructor). The result of this - // function is always guaranteed to be <= _price. - return _price * _cut / 10000; - } - - /// @dev Returns auction info for an NFT on auction. - /// @param _tokenId - ID of NFT on auction. - function getAuction(uint256 _tokenId) - public - view - returns - ( - address seller, - uint256 startedAt, - uint256 duration, - uint256 startingPrice, - uint256 endingPrice, - address token, - uint128 lastRecord, - address lastBidder, - uint256 lastBidStartAt, - address lastReferer - ) { - Auction storage auction = tokenIdToAuction[_tokenId]; - return ( - auction.seller, - auction.startingPriceInToken, - auction.endingPriceInToken, - auction.duration, - auction.startedAt, - auction.token, - auction.lastRecord, - auction.lastBidder, - auction.lastBidStartAt, - auction.lastReferer - ); - } - - /// @dev Returns the current price of an auction. - /// Returns current price of an NFT on auction. Broken into two - /// functions (this one, that computes the duration from the auction - /// structure, and the other that does the price computation) so we - /// can easily test that the price computation works correctly. - /// @param _tokenId - ID of the token price we are checking. - function getCurrentPriceInToken(uint256 _tokenId) - public - view - returns (uint256) - { - uint256 secondsPassed = 0; - - // A bit of insurance against negative values (or wraparound). - // Probably not necessary (since Ethereum guarnatees that the - // now variable doesn't ever go backwards). - if (now > tokenIdToAuction[_tokenId].startedAt) { - secondsPassed = now - tokenIdToAuction[_tokenId].startedAt; - } - // if no one has bidden for _auction, compute the price as below. - if (tokenIdToAuction[_tokenId].lastRecord == 0) { - return _computeCurrentPriceInToken( - tokenIdToAuction[_tokenId].startingPriceInToken, - tokenIdToAuction[_tokenId].endingPriceInToken, - tokenIdToAuction[_tokenId].duration, - secondsPassed - ); - } else { - // compatible with first bid - // as long as price_offered_by_buyer >= 1.1 * currentPice, - // this buyer will be the lastBidder - // 1.1 * (lastRecord) - return (11 * (uint256(tokenIdToAuction[_tokenId].lastRecord)) / 10); - } - } - - // to apply for the safeTransferFrom - function onERC721Received( - address, //_operator, - address, //_from, - uint256 _tokenId, - bytes //_data - ) - public - returns (bytes4) { - // owner can put apostle on market - // after coolDownEndTime - return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); - } - - // get auction's price of last bidder offered - // @dev return price of _auction (in RING) - function getLastRecord(uint _tokenId) public view returns (uint256) { - return tokenIdToAuction[_tokenId].lastRecord; - } - - function getLastBidder(uint _tokenId) public view returns (address) { - return tokenIdToAuction[_tokenId].lastBidder; - } - - function getLastBidStartAt(uint _tokenId) public view returns (uint256) { - return tokenIdToAuction[_tokenId].lastBidStartAt; - } - - // @dev if someone new wants to bid, the lowest price he/she need to afford - function computeNextBidRecord(uint _tokenId) public view returns (uint256) { - return getCurrentPriceInToken(_tokenId); - } - - /// @dev Creates and begins a new auction. - /// @param _tokenId - ID of token to auction, sender must be owner. - // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason - /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. - /// @param _endingPriceInToken - Price of item (in token) at end of auction. - /// @param _duration - Length of time to move between starting - /// price and ending price (in seconds). - /// @param _seller - Seller, if not the message sender - function _createAuction( - address _from, - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _seller, - address _token - ) - internal - canBeStoredWith128Bits(_startingPriceInToken) - canBeStoredWith128Bits(_endingPriceInToken) - canBeStoredWith48Bits(_duration) - canBeStoredWith48Bits(_startAt) - whenNotPaused - { - // Require that all auctions have a duration of - // at least one minute. (Keeps our math from getting hairy!) - require(_duration >= 1 minutes, "duration must be at least 1 minutes"); - require(_duration <= 1000 days); - require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); - // escrow - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, this, _tokenId); - - tokenIdToAuction[_tokenId] = Auction({ - seller : _seller, - startedAt : uint48(_startAt), - duration : uint48(_duration), - startingPriceInToken : uint128(_startingPriceInToken), - endingPriceInToken : uint128(_endingPriceInToken), - lastRecord : 0, - token : _token, - // which refer to lastRecord, lastBidder, lastBidStartAt,lastReferer - // all set to zero when initialized - lastBidder : address(0), - lastBidStartAt : 0, - lastReferer : address(0) - }); - - emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); - } - - /// @dev Computes the current price of an auction. Factored out - /// from _currentPrice so we can run extensive unit tests. - /// When testing, make this function public and turn on - /// `Current price computation` test suite. - function _computeCurrentPriceInToken( - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _secondsPassed - ) - internal - pure - returns (uint256) - { - // NOTE: We don't use SafeMath (or similar) in this function because - // all of our public functions carefully cap the maximum values for - // time (at 64-bits) and currency (at 128-bits). _duration is - // also known to be non-zero (see the require() statement in - // _addAuction()) - if (_secondsPassed >= _duration) { - // We've reached the end of the dynamic pricing portion - // of the auction, just return the end price. - return _endingPriceInToken; - } else { - // Starting price can be higher than ending price (and often is!), so - // this delta can be negative. - int256 totalPriceInTokenChange = int256(_endingPriceInToken) - int256(_startingPriceInToken); - - // This multiplication can't overflow, _secondsPassed will easily fit within - // 64-bits, and totalPriceChange will easily fit within 128-bits, their product - // will always fit within 256-bits. - int256 currentPriceInTokenChange = totalPriceInTokenChange * int256(_secondsPassed) / int256(_duration); - - // currentPriceChange can be negative, but if so, will have a magnitude - // less that _startingPrice. Thus, this result will always end up positive. - int256 currentPriceInToken = int256(_startingPriceInToken) + currentPriceInTokenChange; - - return uint256(currentPriceInToken); - } - } - - - function toBytes(address x) public pure returns (bytes b) { - b = new bytes(32); - assembly {mstore(add(b, 32), x)} - } -} diff --git a/flat/ApostleSettingIds.sol b/flat/ApostleSettingIds.sol deleted file mode 100644 index c7bdeb9..0000000 --- a/flat/ApostleSettingIds.sol +++ /dev/null @@ -1,97 +0,0 @@ -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Root file: contracts/ApostleSettingIds.sol - -pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} diff --git a/flat/ClockAuctionAuthority.sol b/flat/ClockAuctionAuthority.sol deleted file mode 100644 index 66505e6..0000000 --- a/flat/ClockAuctionAuthority.sol +++ /dev/null @@ -1,21 +0,0 @@ -// Root file: contracts/ClockAuctionAuthority.sol - -pragma solidity ^0.4.24; - -contract ClockAuctionAuthority { - - mapping (address => bool) public whiteList; - - constructor(address[] _whitelists) public { - for (uint i = 0; i < _whitelists.length; i ++) { - whiteList[_whitelists[i]] = true; - } - } - - function canCall( - address _src, address _dst, bytes4 _sig - ) public view returns (bool) { - return ( whiteList[_src] && _sig == bytes4(keccak256("createAuction(uint256,uint256,uint256,uint256,uint256,address)")) ); - - } -} \ No newline at end of file diff --git a/flat/ERC721BridgeAuthority.sol b/flat/ERC721BridgeAuthority.sol deleted file mode 100644 index 234f30b..0000000 --- a/flat/ERC721BridgeAuthority.sol +++ /dev/null @@ -1,20 +0,0 @@ -// Root file: contracts/pet/ERC721BridgeAuthority.sol - -pragma solidity ^0.4.24; - -// TODO: move this to common -contract ERC721BridgeAuthority { - mapping (address => bool) public whiteList; - - constructor(address[] _whitelists) public { - for (uint i = 0; i < _whitelists.length; i++) { - whiteList[_whitelists[i]] = true; - } - } - - function canCall( - address _src, address _dst, bytes4 _sig - ) public view returns (bool) { - return ( whiteList[_src] && _sig == bytes4(keccak256("bridgeInAuth(address,uint256,address)")) ); - } -} \ No newline at end of file diff --git a/flat/Gen0Apostle.sol b/flat/Gen0Apostle.sol deleted file mode 100644 index 2d6447e..0000000 --- a/flat/Gen0Apostle.sol +++ /dev/null @@ -1,650 +0,0 @@ -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: contracts/interfaces/IApostleBase.sol - -// pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} - -// Dependency file: contracts/interfaces/IApostleAuction.sol - -// pragma solidity ^0.4.24; - -contract IApostleAuction { - function createAuction( - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _token)public; - - function cancelAuction(uint256 _tokenId) public; -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol - -// pragma solidity ^0.4.23; - -contract ERC223 { - function transfer(address to, uint amount, bytes data) public returns (bool ok); - - function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); - - event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Root file: contracts/Gen0Apostle.sol - -pragma solidity ^0.4.24; -// import "contracts/ApostleSettingIds.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "contracts/interfaces/IApostleBase.sol"; -// import "contracts/interfaces/IApostleAuction.sol"; -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; - -contract Gen0Apostle is PausableDSAuth, ApostleSettingIds { - // claimedToken event - event ClaimedTokens(address indexed token, address indexed owner, uint amount); - event ClaimedERC721Token(address indexed owner, uint256 tokenId); - - bool private singletonLock = false; - - uint256 public gen0CreationLimit; - - ISettingsRegistry public registry; - - address public operator; - - uint256 public gen0Count; - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - function initializeContract(ISettingsRegistry _registry, uint _gen0Limit) public singletonLockCall { - owner = msg.sender; - emit LogSetOwner(msg.sender); - - registry = _registry; - gen0CreationLimit = _gen0Limit; - } - - - function createGen0Apostle(uint256 _genes, uint256 _talents, address _owner) public { - require(operator == msg.sender, "you have no rights"); - require(gen0Count + 1 <= gen0CreationLimit, "Exceed Generation Limit"); - IApostleBase apostleBase = IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)); - apostleBase.createApostle(0, 0, 0, _genes, _talents, _owner); - gen0Count++; - } - - function createGen0Auction( - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _token) - public { - require(operator == msg.sender, "you have no rights"); - IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); - - // aprove land to auction contract - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).approve(address(auction), _tokenId); - // create an auciton - // have to set _seller to this - auction.createAuction(_tokenId,_startingPriceInToken, _endingPriceInToken, _duration,_startAt, _token); - - } - - function cancelAuction(uint256 _tokenId) public onlyOwner { - IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); - auction.cancelAuction(_tokenId); - } - - - function setOperator(address _operator) public onlyOwner { - operator = _operator; - } - - function tokenFallback(address _from, uint256 _value, bytes _data) public { - address ring = registry.addressOf(CONTRACT_RING_ERC20_TOKEN); - address kton = registry.addressOf(CONTRACT_KTON_ERC20_TOKEN); - address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); - - if(msg.sender == ring || msg.sender == kton) { - ERC223(msg.sender).transfer(revenuePool, _value, _data); - } - } - - // to apply for the safeTransferFrom - function onERC721Received( - address, //_operator, - address, //_from, - uint256, // _tokenId, - bytes //_data - ) - public - returns (bytes4) { - return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); - } - - /// @notice This method can be used by the owner to extract mistakenly - /// sent tokens to this contract. - /// @param _token The address of the token contract that you want to recover - /// set to 0 in case you want to extract ether. - function claimTokens(address _token) public onlyOwner { - if (_token == 0x0) { - owner.transfer(address(this).balance); - return; - } - ERC20 token = ERC20(_token); - uint balance = token.balanceOf(address(this)); - token.transfer(owner, balance); - - emit ClaimedTokens(_token, owner, balance); - } - - function claimERC721Tokens(uint256 _tokenId) public onlyOwner { - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), owner, _tokenId); - - emit ClaimedERC721Token(owner, _tokenId); - } - -} \ No newline at end of file diff --git a/flat/Gen0ApostleV2.sol b/flat/Gen0ApostleV2.sol deleted file mode 100644 index 3ecb8bf..0000000 --- a/flat/Gen0ApostleV2.sol +++ /dev/null @@ -1,656 +0,0 @@ -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: contracts/interfaces/IApostleBase.sol - -// pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} - -// Dependency file: contracts/interfaces/IApostleAuction.sol - -// pragma solidity ^0.4.24; - -contract IApostleAuction { - function createAuction( - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _token)public; - - function cancelAuction(uint256 _tokenId) public; -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol - -// pragma solidity ^0.4.23; - -contract ERC223 { - function transfer(address to, uint amount, bytes data) public returns (bool ok); - - function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); - - event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Root file: contracts/Gen0ApostleV2.sol - -pragma solidity ^0.4.24; -// import "contracts/ApostleSettingIds.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "contracts/interfaces/IApostleBase.sol"; -// import "contracts/interfaces/IApostleAuction.sol"; -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; - -contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { - // claimedToken event - event ClaimedTokens(address indexed token, address indexed owner, uint amount); - event ClaimedERC721Token(address indexed owner, uint256 tokenId); - event TakeOut(uint256 tokenId); - - bool private singletonLock = false; - - uint256 public gen0CreationLimit; - - ISettingsRegistry public registry; - - address public operator; - - uint256 public gen0Count; - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - function initializeContract(ISettingsRegistry _registry, uint _gen0Limit) public singletonLockCall { - owner = msg.sender; - emit LogSetOwner(msg.sender); - - registry = _registry; - gen0CreationLimit = _gen0Limit; - } - - - function createGen0Apostle(uint256 _genes, uint256 _talents, address _owner) public { - require(operator == msg.sender, "you have no rights"); - require(gen0Count + 1 <= gen0CreationLimit, "Exceed Generation Limit"); - IApostleBase apostleBase = IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)); - apostleBase.createApostle(0, 0, 0, _genes, _talents, _owner); - gen0Count++; - } - - function createGen0Auction( - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _token) - public { - require(operator == msg.sender, "you have no rights"); - IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); - - // aprove land to auction contract - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).approve(address(auction), _tokenId); - // create an auciton - // have to set _seller to this - auction.createAuction(_tokenId,_startingPriceInToken, _endingPriceInToken, _duration,_startAt, _token); - - } - - function cancelAuction(uint256 _tokenId) public onlyOwner { - IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); - auction.cancelAuction(_tokenId); - } - - - function setOperator(address _operator) public onlyOwner { - operator = _operator; - } - - function tokenFallback(address _from, uint256 _value, bytes _data) public { - address ring = registry.addressOf(CONTRACT_RING_ERC20_TOKEN); - address kton = registry.addressOf(CONTRACT_KTON_ERC20_TOKEN); - address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); - - if(msg.sender == ring || msg.sender == kton) { - ERC223(msg.sender).transfer(revenuePool, _value, _data); - } - } - - // to apply for the safeTransferFrom - function onERC721Received( - address, //_operator, - address, //_from, - uint256, // _tokenId, - bytes //_data - ) - public - returns (bytes4) { - return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); - } - - /// @notice This method can be used by the owner to extract mistakenly - /// sent tokens to this contract. - /// @param _token The address of the token contract that you want to recover - /// set to 0 in case you want to extract ether. - function claimTokens(address _token) public onlyOwner { - if (_token == 0x0) { - owner.transfer(address(this).balance); - return; - } - ERC20 token = ERC20(_token); - uint balance = token.balanceOf(address(this)); - token.transfer(owner, balance); - - emit ClaimedTokens(_token, owner, balance); - } - - function claimERC721Tokens(uint256 _tokenId) public onlyOwner { - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), owner, _tokenId); - - emit ClaimedERC721Token(owner, _tokenId); - } - - function setApproval(address _operator, bool _isApproved) public onlyOwner { - ERC721 nft = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); - nft.setApprovalForAll(_operator, _isApproved); - } - -} \ No newline at end of file diff --git a/flat/HarbergerPotionShop.sol b/flat/HarbergerPotionShop.sol deleted file mode 100644 index aab6ddb..0000000 --- a/flat/HarbergerPotionShop.sol +++ /dev/null @@ -1,737 +0,0 @@ -// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol - -// pragma solidity ^0.4.24; - - -/** - * @title SafeMath - * @dev Math operations with safety checks that throw on error - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, throws on overflow. - */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - // Gas optimization: this is cheaper than asserting 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (_a == 0) { - return 0; - } - - 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 _a / _b; - } - - /** - * @dev Subtracts 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 c) { - c = _a + _b; - assert(c >= _a); - return c; - } -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IBurnableERC20.sol - -// pragma solidity ^0.4.23; - -contract IBurnableERC20 { - function burn(address _from, uint _value) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IMintableERC20.sol - -// pragma solidity ^0.4.23; - -contract IMintableERC20 { - - function mint(address _to, uint256 _value) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: contracts/interfaces/IApostleBase.sol - -// pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} - -// Root file: contracts/HarbergerPotionShop.sol - -pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/interfaces/IBurnableERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/IMintableERC20.sol"; -// import "@evolutionland/common/contracts/DSAuth.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "contracts/interfaces/IApostleBase.sol"; - -contract HarbergerPotionShop is DSAuth, ApostleSettingIds { - using SafeMath for *; - - /* - * Events - */ - event ClaimedTokens(address indexed _token, address indexed _owner, uint _amount); - - /* - * Storages - */ - - bool private singletonLock = false; - - ISettingsRegistry public registry; - - /* - * Structs - */ - struct PotionState { - uint256 estimatePrice; - uint256 availablePotionFund; - uint48 startTime; - uint48 boughtLifeTime; - uint48 lastUpdateTime; - bool isDead; - } - - mapping (uint256 => PotionState) public tokenId2PotionState; - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - - /** - * @dev Bank's constructor which set the token address and unitInterest_ - */ - constructor () public { - // initializeContract(_registry); - } - - /** - * @dev Same with constructor, but is used and called by storage proxy as logic contract. - * @param _registry - address of SettingsRegistry - */ - function initializeContract(address _registry) public singletonLockCall { - // call Ownable's constructor - owner = msg.sender; - - emit LogSetOwner(msg.sender); - - registry = ISettingsRegistry(_registry); - } - - function startHabergPotionModel(uint256 _tokenId, uint256 _estimatePrice, uint256 _ringAmount) public { - require( - ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender, "Only apostle owner can start Potion model."); - - - address apostleBase = registry.addressOf(CONTRACT_APOSTLE_BASE); - require(!(IApostleBase(apostleBase).isDead(_tokenId)), "Apostle is dead, can not start Haberg."); - - require(tokenId2PotionState[_tokenId].lastUpdateTime == 0, "Potion model should not started yet."); - require(_estimatePrice > 0, "Apostle estimated price must larger than zero."); - - ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom(msg.sender, address(this), _ringAmount); - - tokenId2PotionState[_tokenId] = PotionState({ - estimatePrice: _estimatePrice, - availablePotionFund: _ringAmount, - startTime: uint48(IApostleBase(apostleBase).defaultLifeTime(_tokenId)), - boughtLifeTime: 0, - lastUpdateTime: uint48(now), - isDead: false - }); - } - - function tryKillApostle(uint256 _tokenId, address _killer) public auth { - if (tokenId2PotionState[_tokenId].lastUpdateTime == 0) { - // didn't start hargberg or already exited. - return; - } else if (tokenId2PotionState[_tokenId].isDead) { - return; - } else { - uint256 currentHarbergLifeTime = harbergLifeTime(_tokenId); - require(currentHarbergLifeTime < now); - - tokenId2PotionState[_tokenId].isDead = true; - tokenId2PotionState[_tokenId].boughtLifeTime += uint48(currentHarbergLifeTime - tokenId2PotionState[_tokenId].startTime); - tokenId2PotionState[_tokenId].availablePotionFund = 0; - tokenId2PotionState[_tokenId].lastUpdateTime = uint48(now); - } - } - - // deposit haberg tax - function buyPotion(uint256 _tokenId, uint256 _ringAmount) public { - require(ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender, "Only apostle owner can buy potion."); - - _buyPotion(msg.sender, _tokenId, _ringAmount); - } - - function _buyPotion(address _payer, uint256 _tokenId, uint256 _ringAmount) internal { - require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); - require(!tokenId2PotionState[_tokenId].isDead, "Apostle must not be dead."); - - ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom(_payer, address(this), _ringAmount); - - tokenId2PotionState[_tokenId].availablePotionFund += _ringAmount; - } - - function changeHabergEstimatePrice(uint256 _tokenId, uint256 _estimatePrice) public { - require(ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender); - require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); - require(!tokenId2PotionState[_tokenId].isDead, "Apostle must not be dead."); - - _updateHabergPotionState(_tokenId); - - tokenId2PotionState[_tokenId].estimatePrice = _estimatePrice; - } - - function _updateHabergPotionState(uint256 _tokenId) internal { - uint256 newBoughtLifeTime = now - tokenId2PotionState[_tokenId].lastUpdateTime; - - uint256 usedPotionFund = tokenId2PotionState[_tokenId].estimatePrice - .mul(registry.uintOf(UINT_HABERG_POTION_TAX_RATE)).div(100000000) - .mul(newBoughtLifeTime).div(1 days); - - tokenId2PotionState[_tokenId].availablePotionFund = tokenId2PotionState[_tokenId].availablePotionFund.sub(usedPotionFund); - - tokenId2PotionState[_tokenId].boughtLifeTime = uint48(tokenId2PotionState[_tokenId].boughtLifeTime + newBoughtLifeTime); - - tokenId2PotionState[_tokenId].lastUpdateTime = uint48(now); - } - - /// stop Haberg will kill the apostle - function stopHabergAndWithdrawFunds(uint256 _tokenId) public { - require(ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender, "Only apostle owner can call this."); - require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); - require(!tokenId2PotionState[_tokenId].isDead, "Apostle must not be dead."); - - _updateHabergPotionState(_tokenId); - - tokenId2PotionState[_tokenId].isDead = true; - tokenId2PotionState[_tokenId].availablePotionFund = 0; - - ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom( - address(this), msg.sender, tokenId2PotionState[_tokenId].availablePotionFund); - } - - function forceBuy(uint256 _tokenId, uint256 _depositPotionFee) public { - require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); - require(!tokenId2PotionState[_tokenId].isDead, "Apostle must not be dead."); - - address tokenOwner = ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId); - - uint256 oldAvailablePotionFund = tokenId2PotionState[_tokenId].availablePotionFund; - - /// new owner must make up the potion fee if the old owner didn't pay enough - _buyPotion(msg.sender, _tokenId, _depositPotionFee); - - _updateHabergPotionState(_tokenId); - - uint256 usedFund = oldAvailablePotionFund + _depositPotionFee - tokenId2PotionState[_tokenId].availablePotionFund; - - if (oldAvailablePotionFund > usedFund) { - ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom( - address(this), tokenOwner, (oldAvailablePotionFund - usedFund) - ); - } - - ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)).transferFrom( - msg.sender, tokenOwner, tokenId2PotionState[_tokenId].estimatePrice); - - // must approve this first, if not, others can kill this apostle in Apostle. - ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).transferFrom(tokenOwner, msg.sender, _tokenId); - } - - function harbergLifeTime(uint256 _tokenId) public view returns (uint256) { - return tokenId2PotionState[_tokenId].startTime + tokenId2PotionState[_tokenId].boughtLifeTime + tokenId2PotionState[_tokenId].availablePotionFund - .mul(1 days).div( - tokenId2PotionState[_tokenId].estimatePrice.mul(registry.uintOf(UINT_HABERG_POTION_TAX_RATE)).div(100000000) - ); - } - - /// @notice This method can be used by the owner to extract mistakenly - /// sent tokens to this contract. - /// @param _token The address of the token contract that you want to recover - /// set to 0 in case you want to extract ether. - function claimTokens(address _token) public onlyOwner { - if (_token == 0x0) { - owner.transfer(address(this).balance); - return; - } - ERC20 token = ERC20(_token); - uint balance = token.balanceOf(address(this)); - token.transfer(owner, balance); - - emit ClaimedTokens(_token, owner, balance); - } - -} diff --git a/flat/IApostleAuction.sol b/flat/IApostleAuction.sol deleted file mode 100644 index db2f8c6..0000000 --- a/flat/IApostleAuction.sol +++ /dev/null @@ -1,15 +0,0 @@ -// Root file: contracts/interfaces/IApostleAuction.sol - -pragma solidity ^0.4.24; - -contract IApostleAuction { - function createAuction( - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _token)public; - - function cancelAuction(uint256 _tokenId) public; -} diff --git a/flat/IApostleBase.sol b/flat/IApostleBase.sol deleted file mode 100644 index 35549bf..0000000 --- a/flat/IApostleBase.sol +++ /dev/null @@ -1,30 +0,0 @@ -// Root file: contracts/interfaces/IApostleBase.sol - -pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} \ No newline at end of file diff --git a/flat/IERC721Bridge.sol b/flat/IERC721Bridge.sol deleted file mode 100644 index a50c5a8..0000000 --- a/flat/IERC721Bridge.sol +++ /dev/null @@ -1,15 +0,0 @@ -// Root file: contracts/interfaces/IERC721Bridge.sol - -pragma solidity ^0.4.24; - -contract IERC721Bridge { - - - function originNft2Adaptor(address _originContract) public view returns (address); - - function ownerOf(uint256 _mirrorTokenId) public view returns (address); - - function isBridged(uint256 _mirrorTokenId) public view returns (bool); - - function bridgeInAuth(address _originNftAddress, uint256 _originTokenId, address _owner) public returns (uint256); -} diff --git a/flat/IGeneScience.sol b/flat/IGeneScience.sol deleted file mode 100644 index f055486..0000000 --- a/flat/IGeneScience.sol +++ /dev/null @@ -1,26 +0,0 @@ -// Root file: contracts/interfaces/IGeneScience.sol - -pragma solidity ^0.4.24; - - -/// @title defined the interface that will be referenced in main Kitty contract -contract IGeneScience { - /// @dev simply a boolean to indicate this is the contract we expect to be - function isGeneScience() public pure returns (bool); - - /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor - /// @param genes1 genes of mom - /// @param genes2 genes of sire - /// @param talents1 talents of mom - /// @param talents2 talents of sire - /// @return the genes and talents that are supposed to be passed down the child - function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); - - function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); - - function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); - - function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); - - function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); -} diff --git a/flat/IHabergPotionShop.sol b/flat/IHabergPotionShop.sol deleted file mode 100644 index 4bf5f20..0000000 --- a/flat/IHabergPotionShop.sol +++ /dev/null @@ -1,10 +0,0 @@ -// Root file: contracts/interfaces/IHabergPotionShop.sol - -pragma solidity ^0.4.24; - -contract IHabergPotionShop { - function tryKillApostle(uint256 _tokenId, address _killer) public; - - function harbergLifeTime(uint256 _tokenId) public view; - -} \ No newline at end of file diff --git a/flat/IItemBar.sol b/flat/IItemBar.sol deleted file mode 100644 index 179422f..0000000 --- a/flat/IItemBar.sol +++ /dev/null @@ -1,10 +0,0 @@ -// Root file: contracts/interfaces/IItemBar.sol - -pragma solidity ^0.4.24; - -interface IItemBar { - function enhanceStrengthRateOf( - address _resourceToken, - uint256 _tokenId - ) external view returns (uint256); -} diff --git a/flat/ILandBase.sol b/flat/ILandBase.sol deleted file mode 100644 index 66620ea..0000000 --- a/flat/ILandBase.sol +++ /dev/null @@ -1,8 +0,0 @@ -// Root file: contracts/interfaces/ILandBase.sol - -pragma solidity ^0.4.24; - -contract ILandBase { - - function resourceToken2RateAttrId(address _resourceToken) public view returns (uint256); -} \ No newline at end of file diff --git a/flat/ILandResource.sol b/flat/ILandResource.sol deleted file mode 100644 index 2d728df..0000000 --- a/flat/ILandResource.sol +++ /dev/null @@ -1,12 +0,0 @@ -// Root file: contracts/interfaces/ILandResource.sol - -pragma solidity ^0.4.23; - -contract ILandResource { - - function updateMinerStrengthWhenStart(uint256 _apostleTokenId) public; - - function updateMinerStrengthWhenStop(uint256 _apostleTokenId) public; - - function landWorkingOn(uint256 _apostleTokenId) public view returns (uint256); -} diff --git a/flat/Migrations.sol b/flat/Migrations.sol deleted file mode 100644 index e2c70ab..0000000 --- a/flat/Migrations.sol +++ /dev/null @@ -1,2060 +0,0 @@ -// Dependency file: @evolutionland/common/contracts/ObjectOwnershipAuthority.sol - -// pragma solidity ^0.4.24; - -contract ObjectOwnershipAuthority { - - mapping (address => bool) public whiteList; - - constructor(address[] _whitelists) public { - for (uint i = 0; i < _whitelists.length; i ++) { - whiteList[_whitelists[i]] = true; - } - } - - function canCall( - address _src, address _dst, bytes4 _sig - ) public view returns (bool) { - return ( whiteList[_src] && _sig == bytes4(keccak256("mintObject(address,uint128)")) ) || - ( whiteList[_src] && _sig == bytes4(keccak256("burnObject(address,uint128)")) ); - } -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/SettingsRegistry.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/DSAuth.sol"; - -/** - * @title SettingsRegistry - * @dev This contract holds all the settings for updating and querying. - */ -contract SettingsRegistry is ISettingsRegistry, DSAuth { - - mapping(bytes32 => uint256) public uintProperties; - mapping(bytes32 => string) public stringProperties; - mapping(bytes32 => address) public addressProperties; - mapping(bytes32 => bytes) public bytesProperties; - mapping(bytes32 => bool) public boolProperties; - mapping(bytes32 => int256) public intProperties; - - mapping(bytes32 => SettingsValueTypes) public valueTypes; - - function uintOf(bytes32 _propertyName) public view returns (uint256) { - require(valueTypes[_propertyName] == SettingsValueTypes.UINT, "Property type does not match."); - return uintProperties[_propertyName]; - } - - function stringOf(bytes32 _propertyName) public view returns (string) { - require(valueTypes[_propertyName] == SettingsValueTypes.STRING, "Property type does not match."); - return stringProperties[_propertyName]; - } - - function addressOf(bytes32 _propertyName) public view returns (address) { - require(valueTypes[_propertyName] == SettingsValueTypes.ADDRESS, "Property type does not match."); - return addressProperties[_propertyName]; - } - - function bytesOf(bytes32 _propertyName) public view returns (bytes) { - require(valueTypes[_propertyName] == SettingsValueTypes.BYTES, "Property type does not match."); - return bytesProperties[_propertyName]; - } - - function boolOf(bytes32 _propertyName) public view returns (bool) { - require(valueTypes[_propertyName] == SettingsValueTypes.BOOL, "Property type does not match."); - return boolProperties[_propertyName]; - } - - function intOf(bytes32 _propertyName) public view returns (int) { - require(valueTypes[_propertyName] == SettingsValueTypes.INT, "Property type does not match."); - return intProperties[_propertyName]; - } - - function setUintProperty(bytes32 _propertyName, uint _value) public auth { - require( - valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.UINT, "Property type does not match."); - uintProperties[_propertyName] = _value; - valueTypes[_propertyName] = SettingsValueTypes.UINT; - - emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.UINT)); - } - - function setStringProperty(bytes32 _propertyName, string _value) public auth { - require( - valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.STRING, "Property type does not match."); - stringProperties[_propertyName] = _value; - valueTypes[_propertyName] = SettingsValueTypes.STRING; - - emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.STRING)); - } - - function setAddressProperty(bytes32 _propertyName, address _value) public auth { - require( - valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.ADDRESS, "Property type does not match."); - - addressProperties[_propertyName] = _value; - valueTypes[_propertyName] = SettingsValueTypes.ADDRESS; - - emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.ADDRESS)); - } - - function setBytesProperty(bytes32 _propertyName, bytes _value) public auth { - require( - valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.BYTES, "Property type does not match."); - - bytesProperties[_propertyName] = _value; - valueTypes[_propertyName] = SettingsValueTypes.BYTES; - - emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.BYTES)); - } - - function setBoolProperty(bytes32 _propertyName, bool _value) public auth { - require( - valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.BOOL, "Property type does not match."); - - boolProperties[_propertyName] = _value; - valueTypes[_propertyName] = SettingsValueTypes.BOOL; - - emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.BOOL)); - } - - function setIntProperty(bytes32 _propertyName, int _value) public auth { - require( - valueTypes[_propertyName] == SettingsValueTypes.NONE || valueTypes[_propertyName] == SettingsValueTypes.INT, "Property type does not match."); - - intProperties[_propertyName] = _value; - valueTypes[_propertyName] = SettingsValueTypes.INT; - - emit ChangeProperty(_propertyName, uint256(SettingsValueTypes.INT)); - } - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint256 /* SettingsValueTypes */ ) { - return uint256(valueTypes[_propertyName]); - } - -} - -// Dependency file: openzeppelin-solidity/contracts/ownership/Ownable.sol - -// pragma solidity ^0.4.24; - - -/** - * @title Ownable - * @dev The Ownable contract has an owner address, and provides basic authorization control - * functions, this simplifies the implementation of "user permissions". - */ -contract Ownable { - address public owner; - - - event OwnershipRenounced(address indexed previousOwner); - event OwnershipTransferred( - address indexed previousOwner, - address indexed newOwner - ); - - - /** - * @dev The Ownable constructor sets the original `owner` of the contract to the sender - * account. - */ - constructor() public { - owner = msg.sender; - } - - /** - * @dev Throws if called by any account other than the owner. - */ - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - /** - * @dev Allows the current owner to relinquish control of the contract. - * @notice Renouncing to ownership will leave the contract without an owner. - * It will not be possible to call the functions with the `onlyOwner` - * modifier anymore. - */ - function renounceOwnership() public onlyOwner { - emit OwnershipRenounced(owner); - owner = address(0); - } - - /** - * @dev Allows the current owner to transfer control of the contract to a newOwner. - * @param _newOwner The address to transfer ownership to. - */ - function transferOwnership(address _newOwner) public onlyOwner { - _transferOwnership(_newOwner); - } - - /** - * @dev Transfers control of the contract to a newOwner. - * @param _newOwner The address to transfer ownership to. - */ - function _transferOwnership(address _newOwner) internal { - require(_newOwner != address(0)); - emit OwnershipTransferred(owner, _newOwner); - owner = _newOwner; - } -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC721 token receiver interface - * @dev Interface for any contract that wants to support safeTransfers - * from ERC721 asset contracts. - */ -contract ERC721Receiver { - /** - * @dev Magic value to be returned upon successful reception of an NFT - * Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`, - * which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` - */ - bytes4 internal constant ERC721_RECEIVED = 0x150b7a02; - - /** - * @notice Handle the receipt of an NFT - * @dev The ERC721 smart contract calls this function on the recipient - * after a `safetransfer`. This function MAY throw to revert and reject the - * transfer. Return of other than the magic value MUST result in the - * transaction being reverted. - * Note: the contract address is always the message sender. - * @param _operator The address which called `safeTransferFrom` function - * @param _from The address which previously owned the token - * @param _tokenId The NFT identifier which is being transferred - * @param _data Additional data with no specified format - * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` - */ - function onERC721Received( - address _operator, - address _from, - uint256 _tokenId, - bytes _data - ) - public - returns(bytes4); -} - - -// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol - -// pragma solidity ^0.4.24; - - -/** - * @title SafeMath - * @dev Math operations with safety checks that throw on error - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, throws on overflow. - */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - // Gas optimization: this is cheaper than asserting 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (_a == 0) { - return 0; - } - - 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 _a / _b; - } - - /** - * @dev Subtracts 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 c) { - c = _a + _b; - assert(c >= _a); - return c; - } -} - - -// Dependency file: openzeppelin-solidity/contracts/AddressUtils.sol - -// pragma solidity ^0.4.24; - - -/** - * Utility library of inline functions on addresses - */ -library AddressUtils { - - /** - * Returns whether the target address is a contract - * @dev This function will return false if invoked during the constructor of a contract, - * as the code is not actually created until after the constructor finishes. - * @param _addr address to check - * @return whether the target address is a contract - */ - function isContract(address _addr) internal view returns (bool) { - uint256 size; - // XXX Currently there is no better way to check if there is a contract in an address - // than to check the size of the code at that address. - // See https://ethereum.stackexchange.com/a/14016/36603 - // for more details about how this works. - // TODO Check this again before the Serenity release, because all addresses will be - // contracts then. - // solium-disable-next-line security/no-inline-assembly - assembly { size := extcodesize(_addr) } - return size > 0; - } - -} - - -// Dependency file: openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title SupportsInterfaceWithLookup - * @author Matt Condon (@shrugs) - * @dev Implements ERC165 using a lookup table. - */ -contract SupportsInterfaceWithLookup is ERC165 { - - bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; - /** - * 0x01ffc9a7 === - * bytes4(keccak256('supportsInterface(bytes4)')) - */ - - /** - * @dev a mapping of interface id to whether or not it's supported - */ - mapping(bytes4 => bool) internal supportedInterfaces; - - /** - * @dev A contract implementing SupportsInterfaceWithLookup - * implement ERC165 itself - */ - constructor() - public - { - _registerInterface(InterfaceId_ERC165); - } - - /** - * @dev implement supportsInterface(bytes4) using a lookup table - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool) - { - return supportedInterfaces[_interfaceId]; - } - - /** - * @dev private method for registering an interface - */ - function _registerInterface(bytes4 _interfaceId) - internal - { - require(_interfaceId != 0xffffffff); - supportedInterfaces[_interfaceId] = true; - } -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721BasicToken.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol"; -// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -// import "openzeppelin-solidity/contracts/AddressUtils.sol"; -// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic implementation - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic { - - using SafeMath for uint256; - using AddressUtils for address; - - // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` - // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` - bytes4 private constant ERC721_RECEIVED = 0x150b7a02; - - // Mapping from token ID to owner - mapping (uint256 => address) internal tokenOwner; - - // Mapping from token ID to approved address - mapping (uint256 => address) internal tokenApprovals; - - // Mapping from owner to number of owned token - mapping (address => uint256) internal ownedTokensCount; - - // Mapping from owner to operator approvals - mapping (address => mapping (address => bool)) internal operatorApprovals; - - constructor() - public - { - // register the supported interfaces to conform to ERC721 via ERC165 - _registerInterface(InterfaceId_ERC721); - _registerInterface(InterfaceId_ERC721Exists); - } - - /** - * @dev Gets the balance of the specified address - * @param _owner address to query the balance of - * @return uint256 representing the amount owned by the passed address - */ - function balanceOf(address _owner) public view returns (uint256) { - require(_owner != address(0)); - return ownedTokensCount[_owner]; - } - - /** - * @dev Gets the owner of the specified token ID - * @param _tokenId uint256 ID of the token to query the owner of - * @return owner address currently marked as the owner of the given token ID - */ - function ownerOf(uint256 _tokenId) public view returns (address) { - address owner = tokenOwner[_tokenId]; - require(owner != address(0)); - return owner; - } - - /** - * @dev Returns whether the specified token exists - * @param _tokenId uint256 ID of the token to query the existence of - * @return whether the token exists - */ - function exists(uint256 _tokenId) public view returns (bool) { - address owner = tokenOwner[_tokenId]; - return owner != address(0); - } - - /** - * @dev Approves another address to transfer the given token ID - * The zero address indicates there is no approved address. - * There can only be one approved address per token at a given time. - * Can only be called by the token owner or an approved operator. - * @param _to address to be approved for the given token ID - * @param _tokenId uint256 ID of the token to be approved - */ - function approve(address _to, uint256 _tokenId) public { - address owner = ownerOf(_tokenId); - require(_to != owner); - require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); - - tokenApprovals[_tokenId] = _to; - emit Approval(owner, _to, _tokenId); - } - - /** - * @dev Gets the approved address for a token ID, or zero if no address set - * @param _tokenId uint256 ID of the token to query the approval of - * @return address currently approved for the given token ID - */ - function getApproved(uint256 _tokenId) public view returns (address) { - return tokenApprovals[_tokenId]; - } - - /** - * @dev Sets or unsets the approval of a given operator - * An operator is allowed to transfer all tokens of the sender on their behalf - * @param _to operator address to set the approval - * @param _approved representing the status of the approval to be set - */ - function setApprovalForAll(address _to, bool _approved) public { - require(_to != msg.sender); - operatorApprovals[msg.sender][_to] = _approved; - emit ApprovalForAll(msg.sender, _to, _approved); - } - - /** - * @dev Tells whether an operator is approved by a given owner - * @param _owner owner address which you want to query the approval of - * @param _operator operator address which you want to query the approval of - * @return bool whether the given operator is approved by the given owner - */ - function isApprovedForAll( - address _owner, - address _operator - ) - public - view - returns (bool) - { - return operatorApprovals[_owner][_operator]; - } - - /** - * @dev Transfers the ownership of a given token ID to another address - * Usage of this method is discouraged, use `safeTransferFrom` whenever possible - * Requires the msg sender to be the owner, approved, or operator - * @param _from current owner of the token - * @param _to address to receive the ownership of the given token ID - * @param _tokenId uint256 ID of the token to be transferred - */ - function transferFrom( - address _from, - address _to, - uint256 _tokenId - ) - public - { - require(isApprovedOrOwner(msg.sender, _tokenId)); - require(_from != address(0)); - require(_to != address(0)); - - clearApproval(_from, _tokenId); - removeTokenFrom(_from, _tokenId); - addTokenTo(_to, _tokenId); - - emit Transfer(_from, _to, _tokenId); - } - - /** - * @dev Safely transfers the ownership of a given token ID to another address - * If the target address is a contract, it must implement `onERC721Received`, - * which is called upon a safe transfer, and return the magic value - * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, - * the transfer is reverted. - * - * Requires the msg sender to be the owner, approved, or operator - * @param _from current owner of the token - * @param _to address to receive the ownership of the given token ID - * @param _tokenId uint256 ID of the token to be transferred - */ - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId - ) - public - { - // solium-disable-next-line arg-overflow - safeTransferFrom(_from, _to, _tokenId, ""); - } - - /** - * @dev Safely transfers the ownership of a given token ID to another address - * If the target address is a contract, it must implement `onERC721Received`, - * which is called upon a safe transfer, and return the magic value - * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, - * the transfer is reverted. - * Requires the msg sender to be the owner, approved, or operator - * @param _from current owner of the token - * @param _to address to receive the ownership of the given token ID - * @param _tokenId uint256 ID of the token to be transferred - * @param _data bytes data to send along with a safe transfer check - */ - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public - { - transferFrom(_from, _to, _tokenId); - // solium-disable-next-line arg-overflow - require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data)); - } - - /** - * @dev Returns whether the given spender can transfer a given token ID - * @param _spender address of the spender to query - * @param _tokenId uint256 ID of the token to be transferred - * @return bool whether the msg.sender is approved for the given token ID, - * is an operator of the owner, or is the owner of the token - */ - function isApprovedOrOwner( - address _spender, - uint256 _tokenId - ) - internal - view - returns (bool) - { - address owner = ownerOf(_tokenId); - // Disable solium check because of - // https://github.com/duaraghav8/Solium/issues/175 - // solium-disable-next-line operator-whitespace - return ( - _spender == owner || - getApproved(_tokenId) == _spender || - isApprovedForAll(owner, _spender) - ); - } - - /** - * @dev Internal function to mint a new token - * Reverts if the given token ID already exists - * @param _to The address that will own the minted token - * @param _tokenId uint256 ID of the token to be minted by the msg.sender - */ - function _mint(address _to, uint256 _tokenId) internal { - require(_to != address(0)); - addTokenTo(_to, _tokenId); - emit Transfer(address(0), _to, _tokenId); - } - - /** - * @dev Internal function to burn a specific token - * Reverts if the token does not exist - * @param _tokenId uint256 ID of the token being burned by the msg.sender - */ - function _burn(address _owner, uint256 _tokenId) internal { - clearApproval(_owner, _tokenId); - removeTokenFrom(_owner, _tokenId); - emit Transfer(_owner, address(0), _tokenId); - } - - /** - * @dev Internal function to clear current approval of a given token ID - * Reverts if the given address is not indeed the owner of the token - * @param _owner owner of the token - * @param _tokenId uint256 ID of the token to be transferred - */ - function clearApproval(address _owner, uint256 _tokenId) internal { - require(ownerOf(_tokenId) == _owner); - if (tokenApprovals[_tokenId] != address(0)) { - tokenApprovals[_tokenId] = address(0); - } - } - - /** - * @dev Internal function to add a token ID to the list of a given address - * @param _to address representing the new owner of the given token ID - * @param _tokenId uint256 ID of the token to be added to the tokens list of the given address - */ - function addTokenTo(address _to, uint256 _tokenId) internal { - require(tokenOwner[_tokenId] == address(0)); - tokenOwner[_tokenId] = _to; - ownedTokensCount[_to] = ownedTokensCount[_to].add(1); - } - - /** - * @dev Internal function to remove a token ID from the list of a given address - * @param _from address representing the previous owner of the given token ID - * @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address - */ - function removeTokenFrom(address _from, uint256 _tokenId) internal { - require(ownerOf(_tokenId) == _from); - ownedTokensCount[_from] = ownedTokensCount[_from].sub(1); - tokenOwner[_tokenId] = address(0); - } - - /** - * @dev Internal function to invoke `onERC721Received` on a target address - * The call is not executed if the target address is not a contract - * @param _from address representing the previous owner of the given token ID - * @param _to target address that will receive the tokens - * @param _tokenId uint256 ID of the token to be transferred - * @param _data bytes optional data to send along with the call - * @return whether the call correctly returned the expected magic value - */ - function checkAndCallSafeTransfer( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - internal - returns (bool) - { - if (!_to.isContract()) { - return true; - } - bytes4 retval = ERC721Receiver(_to).onERC721Received( - msg.sender, _from, _tokenId, _data); - return (retval == ERC721_RECEIVED); - } -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721BasicToken.sol"; -// import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; - - -/** - * @title Full ERC721 Token - * This implementation includes all the required and some optional functionality of the ERC721 standard - * Moreover, it includes approve all functionality using operator terminology - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 { - - // Token name - string internal name_; - - // Token symbol - string internal symbol_; - - // Mapping from owner to list of owned token IDs - mapping(address => uint256[]) internal ownedTokens; - - // Mapping from token ID to index of the owner tokens list - mapping(uint256 => uint256) internal ownedTokensIndex; - - // Array with all token ids, used for enumeration - uint256[] internal allTokens; - - // Mapping from token id to position in the allTokens array - mapping(uint256 => uint256) internal allTokensIndex; - - // Optional mapping for token URIs - mapping(uint256 => string) internal tokenURIs; - - /** - * @dev Constructor function - */ - constructor(string _name, string _symbol) public { - name_ = _name; - symbol_ = _symbol; - - // register the supported interfaces to conform to ERC721 via ERC165 - _registerInterface(InterfaceId_ERC721Enumerable); - _registerInterface(InterfaceId_ERC721Metadata); - } - - /** - * @dev Gets the token name - * @return string representing the token name - */ - function name() external view returns (string) { - return name_; - } - - /** - * @dev Gets the token symbol - * @return string representing the token symbol - */ - function symbol() external view returns (string) { - return symbol_; - } - - /** - * @dev Returns an URI for a given token ID - * Throws if the token ID does not exist. May return an empty string. - * @param _tokenId uint256 ID of the token to query - */ - function tokenURI(uint256 _tokenId) public view returns (string) { - require(exists(_tokenId)); - return tokenURIs[_tokenId]; - } - - /** - * @dev Gets the token ID at a given index of the tokens list of the requested owner - * @param _owner address owning the tokens list to be accessed - * @param _index uint256 representing the index to be accessed of the requested tokens list - * @return uint256 token ID at the given index of the tokens list owned by the requested address - */ - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256) - { - require(_index < balanceOf(_owner)); - return ownedTokens[_owner][_index]; - } - - /** - * @dev Gets the total amount of tokens stored by the contract - * @return uint256 representing the total amount of tokens - */ - function totalSupply() public view returns (uint256) { - return allTokens.length; - } - - /** - * @dev Gets the token ID at a given index of all the tokens in this contract - * Reverts if the index is greater or equal to the total number of tokens - * @param _index uint256 representing the index to be accessed of the tokens list - * @return uint256 token ID at the given index of the tokens list - */ - function tokenByIndex(uint256 _index) public view returns (uint256) { - require(_index < totalSupply()); - return allTokens[_index]; - } - - /** - * @dev Internal function to set the token URI for a given token - * Reverts if the token ID does not exist - * @param _tokenId uint256 ID of the token to set its URI - * @param _uri string URI to assign - */ - function _setTokenURI(uint256 _tokenId, string _uri) internal { - require(exists(_tokenId)); - tokenURIs[_tokenId] = _uri; - } - - /** - * @dev Internal function to add a token ID to the list of a given address - * @param _to address representing the new owner of the given token ID - * @param _tokenId uint256 ID of the token to be added to the tokens list of the given address - */ - function addTokenTo(address _to, uint256 _tokenId) internal { - super.addTokenTo(_to, _tokenId); - uint256 length = ownedTokens[_to].length; - ownedTokens[_to].push(_tokenId); - ownedTokensIndex[_tokenId] = length; - } - - /** - * @dev Internal function to remove a token ID from the list of a given address - * @param _from address representing the previous owner of the given token ID - * @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address - */ - function removeTokenFrom(address _from, uint256 _tokenId) internal { - super.removeTokenFrom(_from, _tokenId); - - // To prevent a gap in the array, we store the last token in the index of the token to delete, and - // then delete the last slot. - uint256 tokenIndex = ownedTokensIndex[_tokenId]; - uint256 lastTokenIndex = ownedTokens[_from].length.sub(1); - uint256 lastToken = ownedTokens[_from][lastTokenIndex]; - - ownedTokens[_from][tokenIndex] = lastToken; - // This also deletes the contents at the last position of the array - ownedTokens[_from].length--; - - // Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to - // be zero. Then we can make sure that we will remove _tokenId from the ownedTokens list since we are first swapping - // the lastToken to the first position, and then dropping the element placed in the last position of the list - - ownedTokensIndex[_tokenId] = 0; - ownedTokensIndex[lastToken] = tokenIndex; - } - - /** - * @dev Internal function to mint a new token - * Reverts if the given token ID already exists - * @param _to address the beneficiary that will own the minted token - * @param _tokenId uint256 ID of the token to be minted by the msg.sender - */ - function _mint(address _to, uint256 _tokenId) internal { - super._mint(_to, _tokenId); - - allTokensIndex[_tokenId] = allTokens.length; - allTokens.push(_tokenId); - } - - /** - * @dev Internal function to burn a specific token - * Reverts if the token does not exist - * @param _owner owner of the token to burn - * @param _tokenId uint256 ID of the token being burned by the msg.sender - */ - function _burn(address _owner, uint256 _tokenId) internal { - super._burn(_owner, _tokenId); - - // Clear metadata (if any) - if (bytes(tokenURIs[_tokenId]).length != 0) { - delete tokenURIs[_tokenId]; - } - - // Reorg all tokens array - uint256 tokenIndex = allTokensIndex[_tokenId]; - uint256 lastTokenIndex = allTokens.length.sub(1); - uint256 lastToken = allTokens[lastTokenIndex]; - - allTokens[tokenIndex] = lastToken; - allTokens[lastTokenIndex] = 0; - - allTokens.length--; - allTokensIndex[_tokenId] = 0; - allTokensIndex[lastToken] = tokenIndex; - } - -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IInterstellarEncoder.sol - -// pragma solidity ^0.4.24; - -contract IInterstellarEncoder { - uint256 constant CLEAR_HIGH = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; - - uint256 public constant MAGIC_NUMBER = 42; // Interstellar Encoding Magic Number. - uint256 public constant CHAIN_ID = 1; // Ethereum mainet. - uint256 public constant CURRENT_LAND = 1; // 1 is Atlantis, 0 is NaN. - - enum ObjectClass { - NaN, - LAND, - APOSTLE, - OBJECT_CLASS_COUNT - } - - function registerNewObjectClass(address _objectContract, uint8 objectClass) public; - - function registerNewTokenContract(address _tokenAddress) public; - - function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectIndex) public view returns (uint256 _tokenId); - - function encodeTokenIdForObjectContract( - address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId); - - function getContractAddress(uint256 _tokenId) public view returns (address); - - function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId); - - function getObjectClass(uint256 _tokenId) public view returns (uint8); - - function getObjectAddress(uint256 _tokenId) public view returns (address); -} - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: @evolutionland/common/contracts/ObjectOwnership.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol"; -// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoder.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/DSAuth.sol"; -// import "@evolutionland/common/contracts/SettingIds.sol"; - -contract ObjectOwnership is ERC721Token("Evolution Land Objects","EVO"), DSAuth, SettingIds { - ISettingsRegistry public registry; - - bool private singletonLock = false; - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - /** - * @dev Atlantis's constructor - */ - constructor () public { - // initializeContract(); - } - - /** - * @dev Same with constructor, but is used and called by storage proxy as logic contract. - */ - function initializeContract(address _registry) public singletonLockCall { - // Ownable constructor - owner = msg.sender; - emit LogSetOwner(msg.sender); - - // SupportsInterfaceWithLookup constructor - _registerInterface(InterfaceId_ERC165); - - // ERC721BasicToken constructor - _registerInterface(InterfaceId_ERC721); - _registerInterface(InterfaceId_ERC721Exists); - - // ERC721Token constructor - name_ = "Evolution Land Objects"; - symbol_ = "EVO"; // Evolution Land Objects - // register the supported interfaces to conform to ERC721 via ERC165 - _registerInterface(InterfaceId_ERC721Enumerable); - _registerInterface(InterfaceId_ERC721Metadata); - - registry = ISettingsRegistry(_registry); - } - - function mintObject(address _to, uint128 _objectId) public auth returns (uint256 _tokenId) { - address interstellarEncoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); - - _tokenId = IInterstellarEncoder(interstellarEncoder).encodeTokenIdForObjectContract( - address(this), msg.sender, _objectId); - super._mint(_to, _tokenId); - } - - function burnObject(address _to, uint128 _objectId) public auth returns (uint256 _tokenId) { - address interstellarEncoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); - - _tokenId = IInterstellarEncoder(interstellarEncoder).encodeTokenIdForObjectContract( - address(this), msg.sender, _objectId); - super._burn(_to, _tokenId); - } - - function mint(address _to, uint256 _tokenId) public auth { - super._mint(_to, _tokenId); - } - - function burn(address _to, uint256 _tokenId) public auth { - super._burn(_to, _tokenId); - } - - //@dev user invoke approveAndCall to create auction - //@param _to - address of auction contractß - function approveAndCall( - address _to, - uint _tokenId, - bytes _extraData - ) public { - // set _to to the auction contract - approve(_to, _tokenId); - - if(!_to.call( - bytes4(keccak256("receiveApproval(address,uint256,bytes)")), abi.encode(msg.sender, _tokenId, _extraData) - )) { - revert(); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol - -// pragma solidity ^0.4.24; - -contract IInterstellarEncoderV3 { - uint256 constant CLEAR_HIGH = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; - - uint256 public constant MAGIC_NUMBER = 42; // Interstellar Encoding Magic Number. - uint256 public constant CHAIN_ID = 1; // Ethereum mainet. - uint256 public constant CURRENT_LAND = 1; // 1 is Atlantis, 0 is NaN. - - enum ObjectClass { - NaN, - LAND, - APOSTLE, - OBJECT_CLASS_COUNT - } - - function registerNewObjectClass(address _objectContract, uint8 objectClass) public; - - function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectIndex) public view returns (uint256 _tokenId); - - function encodeTokenIdForObjectContract( - address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId); - - function encodeTokenIdForOuterObjectContract( - address _objectContract, address nftAddress, address _originNftAddress, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256); - - function getContractAddress(uint256 _tokenId) public view returns (address); - - function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId); - - function getObjectClass(uint256 _tokenId) public view returns (uint8); - - function getObjectAddress(uint256 _tokenId) public view returns (address); - - function getProducerId(uint256 _tokenId) public view returns (uint16); - - function getOriginAddress(uint256 _tokenId) public view returns (address); - -} - -// Dependency file: @evolutionland/common/contracts/InterstellarEncoderV3.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; -// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol"; - -// TODO: upgrade. -contract InterstellarEncoderV3 is IInterstellarEncoderV3, Ownable { - // [magic_number, chain_id, contract_id <2>, origin_chain_id, origin_contract_id<2>, object_class, convert_type, <6>, land, <128>] - mapping(uint8 => address) public ownershipId2Address; - mapping(address => uint8) public ownershipAddress2Id; - - mapping(address => uint8) public classAddress2Id; // class - // extended since V2 - mapping(uint8 => address) public classId2Address; - - function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectId) public view returns (uint256 _tokenId) { - uint16 contractId = ownershipAddress2Id[_tokenAddress]; - require(ownershipAddress2Id[_tokenAddress] > 0, "Contract address does not exist"); - - _tokenId = (MAGIC_NUMBER << 248) + (CHAIN_ID << 240) + (uint256(contractId) << 224) - + (CHAIN_ID << 216) + (uint256(contractId) << 200) + (uint256(_objectClass) << 192) + (CURRENT_LAND << 128) + uint256(_objectId); - } - - function encodeTokenIdForOuter( - address _nftAddress, address _originNftAddress, uint8 _objectClass, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256) { - uint16 contractId = ownershipAddress2Id[_nftAddress]; - uint16 originContractId = ownershipAddress2Id[_originNftAddress]; - require(contractId > 0 && originContractId > 0 && _producerId > 0, "Contract address does not exist"); - - uint256 tokenId = (MAGIC_NUMBER << 248) + (CHAIN_ID << 240) + (uint256(contractId) << 224) - + (CHAIN_ID << 216) + (uint256(originContractId) << 200) + (uint256(_objectClass) << 192) + (uint256(_convertType) << 184)+ (uint256(_producerId) << 128) + uint256(_objectId); - - return tokenId; - } - - // TODO; newly added - // @param _tokenAddress - objectOwnership - // @param _objectContract - xxxBase contract - function encodeTokenIdForOuterObjectContract( - address _objectContract, address _nftAddress, address _originNftAddress, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256) { - require (classAddress2Id[_objectContract] > 0, "Object class for this object contract does not exist."); - - return encodeTokenIdForOuter(_nftAddress, _originNftAddress, classAddress2Id[_objectContract], _objectId, _producerId, _convertType); - - } - // TODO; newly added - function encodeTokenIdForObjectContract( - address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId) { - require (classAddress2Id[_objectContract] > 0, "Object class for this object contract does not exist."); - - _tokenId = encodeTokenId(_tokenAddress, classAddress2Id[_objectContract], _objectId); - } - - function registerNewOwnershipContract(address _nftAddress, uint8 _nftId) public onlyOwner { - ownershipAddress2Id[_nftAddress] = _nftId; - ownershipId2Address[_nftId] = _nftAddress; - } - - function registerNewObjectClass(address _objectContract, uint8 _objectClass) public onlyOwner { - classAddress2Id[_objectContract] = _objectClass; - classId2Address[_objectClass] = _objectContract; - } - - function getProducerId(uint256 _tokenId) public view returns (uint16) { - return uint16((_tokenId >> 128) & 0xff); - } - - function getContractAddress(uint256 _tokenId) public view returns (address) { - return ownershipId2Address[uint8((_tokenId >> 240) & 0xff)]; - } - - function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId) { - return uint128(_tokenId & CLEAR_HIGH); - } - - function getObjectClass(uint256 _tokenId) public view returns (uint8) { - return uint8((_tokenId << 56) >> 248); - } - - function getObjectAddress(uint256 _tokenId) public view returns (address) { - return classId2Address[uint8((_tokenId << 56) >> 248)]; - } - - // TODO; newly added - function getOriginAddress(uint256 _tokenId) public view returns (address) { - uint8 originContractId = uint8((_tokenId >> 200) & 0xff); - return ownershipId2Address[originContractId]; - - } -} - -// Dependency file: @evolutionland/common/contracts/InterstellarEncoderV2.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; -// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoder.sol"; - -// TODO: upgrade. -contract InterstellarEncoderV2 is IInterstellarEncoder, Ownable { - // [magic_number, chain_id, contract_id <2>, origin_chain_id, origin_contract_id<2>, object_class, convert_type, <6>, land, <128>] - mapping(uint16 => address) public contractId2Address; - mapping(address => uint16) public contractAddress2Id; - - mapping(address => uint8) public objectContract2ObjectClass; - - uint16 public lastContractId = 0; - - // extended since V2 - mapping(uint8 => address) public objectClass2ObjectContract; - - function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectId) public view returns (uint256 _tokenId) { - uint16 contractId = contractAddress2Id[_tokenAddress]; - require(contractAddress2Id[_tokenAddress] > 0, "Contract address does not exist"); - - _tokenId = (MAGIC_NUMBER << 248) + (CHAIN_ID << 240) + (uint256(contractId) << 224) - + (CHAIN_ID << 216) + (uint256(contractId) << 200) + (uint256(_objectClass) << 192) + (CURRENT_LAND << 128) + uint256(_objectId); - } - - function encodeTokenIdForObjectContract( - address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId) { - require (objectContract2ObjectClass[_objectContract] > 0, "Object class for this object contract does not exist."); - - _tokenId = encodeTokenId(_tokenAddress, objectContract2ObjectClass[_objectContract], _objectId); - } - - function registerNewTokenContract(address _tokenAddress) public onlyOwner { - require(contractAddress2Id[_tokenAddress] == 0, "Contract address already exist"); - require(lastContractId < 65535, "Contract Id already reach maximum."); - - lastContractId += 1; - - contractAddress2Id[_tokenAddress] = lastContractId; - contractId2Address[lastContractId] = _tokenAddress; - } - - function registerNewObjectClass(address _objectContract, uint8 _objectClass) public onlyOwner { - objectContract2ObjectClass[_objectContract] = _objectClass; - objectClass2ObjectContract[_objectClass] = _objectContract; - } - - function getContractAddress(uint256 _tokenId) public view returns (address) { - return contractId2Address[uint16((_tokenId << 16) >> 240)]; - } - - function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId) { - return uint128(_tokenId & CLEAR_HIGH); - } - - function getObjectClass(uint256 _tokenId) public view returns (uint8) { - return uint8((_tokenId << 56) >> 248); - } - - function getObjectAddress(uint256 _tokenId) public view returns (address) { - return objectClass2ObjectContract[uint8((_tokenId << 56) >> 248)]; - } -} - -// Dependency file: @evolutionland/upgraeability-using-unstructured-storage/contracts/Proxy.sol - -// pragma solidity ^0.4.21; - -/** - * @title Proxy - * @dev Gives the possibility to delegate any call to a foreign implementation. - */ -contract Proxy { - /** - * @dev Tells the address of the implementation where every call will be delegated. - * @return address of the implementation to which it will be delegated - */ - function implementation() public view returns (address); - - /** - * @dev Fallback function allowing to perform a delegatecall to the given implementation. - * This function will return whatever the implementation call returns - */ - function () payable public { - address _impl = implementation(); - require(_impl != address(0)); - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0) - let size := returndatasize - returndatacopy(ptr, 0, size) - - switch result - case 0 { revert(ptr, size) } - default { return(ptr, size) } - } - } -} - - -// Dependency file: @evolutionland/upgraeability-using-unstructured-storage/contracts/UpgradeabilityProxy.sol - -// pragma solidity ^0.4.21; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/upgraeability-using-unstructured-storage/contracts/Proxy.sol'; - -/** - * @title UpgradeabilityProxy - * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded - */ -contract UpgradeabilityProxy is Proxy { - /** - * @dev This event will be emitted every time the implementation gets upgraded - * @param implementation representing the address of the upgraded implementation - */ - event Upgraded(address indexed implementation); - - // Storage position of the address of the current implementation - bytes32 private constant implementationPosition = keccak256("org.zeppelinos.proxy.implementation"); - - /** - * @dev Constructor function - */ - function UpgradeabilityProxy() public {} - - /** - * @dev Tells the address of the current implementation - * @return address of the current implementation - */ - function implementation() public view returns (address impl) { - bytes32 position = implementationPosition; - assembly { - impl := sload(position) - } - } - - /** - * @dev Sets the address of the current implementation - * @param newImplementation address representing the new implementation to be set - */ - function setImplementation(address newImplementation) internal { - bytes32 position = implementationPosition; - assembly { - sstore(position, newImplementation) - } - } - - /** - * @dev Upgrades the implementation address - * @param newImplementation representing the address of the new implementation to be set - */ - function _upgradeTo(address newImplementation) internal { - address currentImplementation = implementation(); - require(currentImplementation != newImplementation); - setImplementation(newImplementation); - emit Upgraded(newImplementation); - } -} - - -// Dependency file: @evolutionland/upgraeability-using-unstructured-storage/contracts/OwnedUpgradeabilityProxy.sol - -// pragma solidity ^0.4.21; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/upgraeability-using-unstructured-storage/contracts/UpgradeabilityProxy.sol'; - -/** - * @title OwnedUpgradeabilityProxy - * @dev This contract combines an upgradeability proxy with basic authorization control functionalities - */ -contract OwnedUpgradeabilityProxy is UpgradeabilityProxy { - /** - * @dev Event to show ownership has been transferred - * @param previousOwner representing the address of the previous owner - * @param newOwner representing the address of the new owner - */ - event ProxyOwnershipTransferred(address previousOwner, address newOwner); - - // Storage position of the owner of the contract - bytes32 private constant proxyOwnerPosition = keccak256("org.zeppelinos.proxy.owner"); - - /** - * @dev the constructor sets the original owner of the contract to the sender account. - */ - function OwnedUpgradeabilityProxy() public { - setUpgradeabilityOwner(msg.sender); - } - - /** - * @dev Throws if called by any account other than the owner. - */ - modifier onlyProxyOwner() { - require(msg.sender == proxyOwner()); - _; - } - - /** - * @dev Tells the address of the owner - * @return the address of the owner - */ - function proxyOwner() public view returns (address owner) { - bytes32 position = proxyOwnerPosition; - assembly { - owner := sload(position) - } - } - - /** - * @dev Sets the address of the owner - */ - function setUpgradeabilityOwner(address newProxyOwner) internal { - bytes32 position = proxyOwnerPosition; - assembly { - sstore(position, newProxyOwner) - } - } - - /** - * @dev Allows the current owner to transfer control of the contract to a newOwner. - * @param newOwner The address to transfer ownership to. - */ - function transferProxyOwnership(address newOwner) public onlyProxyOwner { - require(newOwner != address(0)); - emit ProxyOwnershipTransferred(proxyOwner(), newOwner); - setUpgradeabilityOwner(newOwner); - } - - /** - * @dev Allows the proxy owner to upgrade the current version of the proxy. - * @param implementation representing the address of the new implementation to be set. - */ - function upgradeTo(address implementation) public onlyProxyOwner { - _upgradeTo(implementation); - } - - /** - * @dev Allows the proxy owner to upgrade the current version of the proxy and call the new implementation - * to initialize whatever is needed through a low level call. - * @param implementation representing the address of the new implementation to be set. - * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function - * signature of the implementation to be called with the needed payload - */ - function upgradeToAndCall(address implementation, bytes data) payable public onlyProxyOwner { - upgradeTo(implementation); - require(this.call.value(msg.value)(data)); - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IMintableERC20.sol - -// pragma solidity ^0.4.23; - -contract IMintableERC20 { - - function mint(address _to, uint256 _value) public; -} - -// Dependency file: @evolutionland/common/contracts/interfaces/INFTAdaptor.sol - -// pragma solidity ^0.4.24; - - -contract INFTAdaptor { - function toMirrorTokenId(uint256 _originTokenId) public view returns (uint256); - - function toOriginTokenId(uint256 _mirrorTokenId) public view returns (uint256); - - function approveOriginToken(address _bridge, uint256 _originTokenId) public; - - function ownerInOrigin(uint256 _originTokenId) public view returns (address); - - function cacheMirrorTokenId(uint256 _originTokenId, uint256 _mirrorTokenId) public; -} - - -// Dependency file: @evolutionland/common/contracts/ERC721Bridge.sol - -// pragma solidity ^0.4.23; - -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/SettingIds.sol"; -// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol"; -// import "@evolutionland/common/contracts/interfaces/IMintableERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/INFTAdaptor.sol"; -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; - - -/* - * naming convention: - * originTokenId - token outside evolutionLand - * mirrorTokenId - mirror token - */ -contract ERC721Bridge is SettingIds, PausableDSAuth { - - /* - * Storage - */ - bool private singletonLock = false; - - ISettingsRegistry public registry; - - - // originNFTContract => its adator - // for instance, CryptoKitties => CryptoKittiesAdaptor - // this need to be registered by owner - mapping(address => address) public originNFT2Adaptor; - - // tokenId_inside => tokenId_outside - mapping(uint256 => uint256) public mirrorId2OriginId; - - /* - * Event - */ - event BridgeIn(uint256 originTokenId, uint256 mirrorTokenId, address originContract, address adaptorAddress, address owner); - - event SwapIn(uint256 originTokenId, uint256 mirrorTokenId, address owner); - event SwapOut(uint256 originTokenId, uint256 mirrorTokenId, address owner); - - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - function initializeContract(ISettingsRegistry _registry) public singletonLockCall { - owner = msg.sender; - emit LogSetOwner(msg.sender); - registry = _registry; - } - - function registerAdaptor(address _originNftAddress, address _erc721Adaptor) public whenNotPaused onlyOwner { - originNFT2Adaptor[_originNftAddress] = _erc721Adaptor; - } - - // used by PetBase - function bridgeInAuth(address _originNftAddress, uint256 _originTokenId, address _owner) public auth returns (uint256) { - return _bridgeIn(_originNftAddress, _originTokenId, _owner); - } - - - // generate new mirror token without origin token frozen - function bridgeIn(address _originNftAddress, uint256 _originTokenId) public returns (uint256) { - _bridgeIn(_originNftAddress, _originTokenId, msg.sender); - } - - function _bridgeIn(address _originNftAddress, uint256 _originTokenId, address _owner) internal returns (uint256) { - address adaptor = originNFT2Adaptor[_originNftAddress]; - require(adaptor != address(0), "Not registered!"); - - require(INFTAdaptor(adaptor).ownerInOrigin(_originTokenId) == _owner, "Invalid owner!"); - - uint256 mirrorTokenId = INFTAdaptor(adaptor).toMirrorTokenId(_originTokenId); - - // if it is the first time to bridge in - if (!isBridged(mirrorTokenId)) { - // keep new mirror object in this contract - // before the owner has transferred his/her outerObject into this contract - // mirror object can not be transferred - address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); - IMintableERC20(objectOwnership).mint(address(this), mirrorTokenId); - - // link objects_in and objects_out - INFTAdaptor(adaptor).cacheMirrorTokenId(_originTokenId, mirrorTokenId); - mirrorId2OriginId[mirrorTokenId] = _originTokenId; - - emit BridgeIn(_originTokenId, mirrorTokenId, _originNftAddress, adaptor, _owner); - } - - return mirrorTokenId; - } - - // freeze origin token to free mirror token - function swapIn(address _originNftAddress, uint256 _originTokenId) public { - require(ERC721(_originNftAddress).ownerOf(_originTokenId) == msg.sender, "Invalid owner!"); - - address adaptor = originNFT2Adaptor[_originNftAddress]; - require(adaptor != address(0), "Not registered!"); - - // all specific originTokens are kept in bridge - ERC721(_originNftAddress).transferFrom(msg.sender, address(this), _originTokenId); - - uint256 mirrorTokenId = INFTAdaptor(adaptor).toMirrorTokenId(_originTokenId); - address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); - ERC721(objectOwnership).transferFrom(address(this), msg.sender, mirrorTokenId); - - emit SwapIn(_originTokenId, mirrorTokenId, msg.sender); - } - - function bridgeAndSwapIn(address _originNftAddress, uint256 _originTokenId) public { - bridgeIn(_originNftAddress, _originTokenId); - swapIn(_originNftAddress, _originTokenId); - } - - function swapOut(uint256 _mirrorTokenId) public { - IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); - address nftContract = interstellarEncoder.getContractAddress(_mirrorTokenId); - require(nftContract != address(0), "No such NFT contract"); - address adaptor = originNFT2Adaptor[nftContract]; - require(adaptor != address(0), "not registered!"); - require(ownerOfMirror(_mirrorTokenId) == msg.sender, "you have no right to swap it out!"); - - // TODO: if it is needed to check its current status - uint256 originTokenId = mirrorId2OriginId[_mirrorTokenId]; - address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); - ERC721(objectOwnership).transferFrom(msg.sender, address(this), _mirrorTokenId); - ERC721(nftContract).transferFrom(address(this), msg.sender, originTokenId); - - emit SwapOut(originTokenId, _mirrorTokenId, msg.sender); - } - - function approveOriginToken(address _originNFT, address _approved, uint256 _originTokenId) public auth { - ERC721(_originNFT).approve(_approved, _originTokenId); - } - - function ownerOf(uint256 _mirrorTokenId) public view returns (address) { - return ownerOfMirror(_mirrorTokenId); - } - - // return human owner of the token - function mirrorOfOrigin(address _originNFT, uint256 _originTokenId) public view returns (uint256) { - INFTAdaptor adapter = INFTAdaptor(originNFT2Adaptor[_originNFT]); - - return adapter.toMirrorTokenId(_originTokenId); - } - - // return human owner of the token - function ownerOfMirror(uint256 _mirrorTokenId) public view returns (address) { - address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); - address owner = ERC721(objectOwnership).ownerOf(_mirrorTokenId); - if(owner != address(this)) { - return owner; - } else { - uint originTokenId = mirrorId2OriginId[_mirrorTokenId]; - return INFTAdaptor(originNFT2Adaptor[originOwnershipAddress(_mirrorTokenId)]).ownerInOrigin(originTokenId); - } - } - - function originOwnershipAddress(uint256 _mirrorTokenId) public view returns (address) { - IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); - - return interstellarEncoder.getOriginAddress(_mirrorTokenId); - } - - function isBridged(uint256 _mirrorTokenId) public view returns (bool) { - return (mirrorId2OriginId[_mirrorTokenId] != 0); - } -} - - -// Root file: contracts/Migrations.sol - -pragma solidity ^0.4.23; -// import "@evolutionland/common/contracts/ObjectOwnershipAuthority.sol"; -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/SettingsRegistry.sol'; -// import "@evolutionland/common/contracts/ObjectOwnership.sol"; -// import "@evolutionland/common/contracts/InterstellarEncoderV3.sol"; -// import "@evolutionland/common/contracts/InterstellarEncoderV2.sol"; -// import "@evolutionland/upgraeability-using-unstructured-storage/contracts/OwnedUpgradeabilityProxy.sol"; -// import "@evolutionland/common/contracts/ERC721Bridge.sol"; - -contract Migrations { - address public owner; - uint public last_completed_migration; - - constructor() public { - owner = msg.sender; - } - - modifier restricted() { - if (msg.sender == owner) _; - } - - function setCompleted(uint completed) public restricted { - last_completed_migration = completed; - } - - function upgrade(address new_address) public restricted { - Migrations upgraded = Migrations(new_address); - upgraded.setCompleted(last_completed_migration); - } -} diff --git a/flat/PetBase.sol b/flat/PetBase.sol deleted file mode 100644 index 7951eac..0000000 --- a/flat/PetBase.sol +++ /dev/null @@ -1,842 +0,0 @@ -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/INFTAdaptor.sol - -// pragma solidity ^0.4.24; - - -contract INFTAdaptor { - function toMirrorTokenId(uint256 _originTokenId) public view returns (uint256); - - function toOriginTokenId(uint256 _mirrorTokenId) public view returns (uint256); - - function approveOriginToken(address _bridge, uint256 _originTokenId) public; - - function ownerInOrigin(uint256 _originTokenId) public view returns (address); - - function cacheMirrorTokenId(uint256 _originTokenId, uint256 _mirrorTokenId) public; -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol - -// pragma solidity ^0.4.24; - -contract IInterstellarEncoderV3 { - uint256 constant CLEAR_HIGH = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; - - uint256 public constant MAGIC_NUMBER = 42; // Interstellar Encoding Magic Number. - uint256 public constant CHAIN_ID = 1; // Ethereum mainet. - uint256 public constant CURRENT_LAND = 1; // 1 is Atlantis, 0 is NaN. - - enum ObjectClass { - NaN, - LAND, - APOSTLE, - OBJECT_CLASS_COUNT - } - - function registerNewObjectClass(address _objectContract, uint8 objectClass) public; - - function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectIndex) public view returns (uint256 _tokenId); - - function encodeTokenIdForObjectContract( - address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId); - - function encodeTokenIdForOuterObjectContract( - address _objectContract, address nftAddress, address _originNftAddress, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256); - - function getContractAddress(uint256 _tokenId) public view returns (address); - - function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId); - - function getObjectClass(uint256 _tokenId) public view returns (uint8); - - function getObjectAddress(uint256 _tokenId) public view returns (address); - - function getProducerId(uint256 _tokenId) public view returns (uint16); - - function getOriginAddress(uint256 _tokenId) public view returns (address); - -} - -// Dependency file: contracts/interfaces/IApostleBase.sol - -// pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} - -// Dependency file: contracts/interfaces/IERC721Bridge.sol - -// pragma solidity ^0.4.24; - -contract IERC721Bridge { - - - function originNft2Adaptor(address _originContract) public view returns (address); - - function ownerOf(uint256 _mirrorTokenId) public view returns (address); - - function isBridged(uint256 _mirrorTokenId) public view returns (bool); - - function bridgeInAuth(address _originNftAddress, uint256 _originTokenId, address _owner) public returns (uint256); -} - - -// Dependency file: contracts/interfaces/IGeneScience.sol - -// pragma solidity ^0.4.24; - - -/// @title defined the interface that will be referenced in main Kitty contract -contract IGeneScience { - /// @dev simply a boolean to indicate this is the contract we expect to be - function isGeneScience() public pure returns (bool); - - /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor - /// @param genes1 genes of mom - /// @param genes2 genes of sire - /// @param talents1 talents of mom - /// @param talents2 talents of sire - /// @return the genes and talents that are supposed to be passed down the child - function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); - - function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId) public view returns (uint256); - - function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); - - function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); - - function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); -} - - -// Dependency file: contracts/interfaces/ILandResource.sol - -// pragma solidity ^0.4.23; - -contract ILandResource { - - function updateMinerStrengthWhenStart(uint256 _apostleTokenId) public; - - function updateMinerStrengthWhenStop(uint256 _apostleTokenId) public; - - function landWorkingOn(uint256 _apostleTokenId) public view returns (uint256); -} - - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol - -// pragma solidity ^0.4.24; - - -/** - * @title SafeMath - * @dev Math operations with safety checks that throw on error - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, throws on overflow. - */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - // Gas optimization: this is cheaper than asserting 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (_a == 0) { - return 0; - } - - 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 _a / _b; - } - - /** - * @dev Subtracts 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 c) { - c = _a + _b; - assert(c >= _a); - return c; - } -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IObjectOwnership.sol - -// pragma solidity ^0.4.24; - -contract IObjectOwnership { - function mintObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); - - function burnObject(address _to, uint128 _objectId) public returns (uint256 _tokenId); -} - -// Root file: contracts/pet/PetBase.sol - -pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/interfaces/INFTAdaptor.sol"; -// import "@evolutionland/common/contracts/interfaces/IInterstellarEncoderV3.sol"; -// import "contracts/interfaces/IApostleBase.sol"; -// import "contracts/interfaces/IERC721Bridge.sol"; -// import "contracts/interfaces/IGeneScience.sol"; -// import "contracts/interfaces/ILandResource.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; - -contract PetBase is PausableDSAuth, ApostleSettingIds { - - using SafeMath for *; - - /* - * Storage - */ - bool private singletonLock = false; - - ISettingsRegistry public registry; - - uint128 public lastPetObjectId; - - uint128 public maxTiedNumber; - - struct PetStatus { - uint128 maxTiedNumber; - uint128 tiedCount; - uint256[] tiedList; - } - - struct TiedStatus { - uint256 apostleTokenId; - uint256 index; - } - - mapping(uint256 => PetStatus) public tokenId2PetStatus; - mapping(uint256 => TiedStatus) public pet2TiedStatus; - - event Tied(uint256 apostleTokenId, uint256 mirrorTokenId, uint256 enhancedTalents, bool changed, address originNFT, address owner); - event UnTied(uint256 apostleTokenId, uint256 mirrorTokenId, uint256 enhancedTalents, bool changed, address originNFT, address owner); - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - function initializeContract(ISettingsRegistry _registry, uint128 _number) public singletonLockCall { - owner = msg.sender; - emit LogSetOwner(msg.sender); - registry = _registry; - maxTiedNumber = _number; - } - - - // TODO: it can be more specific afterwards - function createPet(address _owner) public auth returns (uint256) { - - lastPetObjectId += 1; - require(lastPetObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); - uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastPetObjectId)); - - return tokenId; - } - - function bridgeInAndTie(address _originNftAddress, uint256 _originTokenId, uint256 _apostleTokenId) public { - address erc721Bridge = registry.addressOf(SettingIds.CONTRACT_ERC721_BRIDGE); - uint256 mirrorTokenId = IERC721Bridge(erc721Bridge).bridgeInAuth(_originNftAddress, _originTokenId, msg.sender); - _tiePetTokenToApostle(mirrorTokenId, _apostleTokenId, msg.sender, _originNftAddress); - } - - // any one can use it - function tiePetTokenToApostle(uint256 _mirrorTokenId, uint256 _apostleTokenId) public { - IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); - address originAddress = interstellarEncoder.getOriginAddress(_mirrorTokenId); - - _tiePetTokenToApostle(_mirrorTokenId, _apostleTokenId, msg.sender, originAddress); - } - - - function _tiePetTokenToApostle(uint256 _petTokenId, uint256 _apostleTokenId, address _owner, address _originAddress) internal { - if (tokenId2PetStatus[_apostleTokenId].maxTiedNumber == 0) { - tokenId2PetStatus[_apostleTokenId].maxTiedNumber = maxTiedNumber; - } - - require(pet2TiedStatus[_petTokenId].apostleTokenId == 0, "it has already been tied."); - tokenId2PetStatus[_apostleTokenId].tiedCount += 1; - require(tokenId2PetStatus[_apostleTokenId].tiedCount <= tokenId2PetStatus[_apostleTokenId].maxTiedNumber); - - uint256 index = tokenId2PetStatus[_apostleTokenId].tiedList.length; - tokenId2PetStatus[_apostleTokenId].tiedList.push(_petTokenId); - - pet2TiedStatus[_petTokenId] = TiedStatus({ - apostleTokenId : _apostleTokenId, - index : index - }); - - - // TODO: update gene, through apostleBase - address apostleBase = registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE); - uint256 talents; - uint256 genes; - (genes, talents, ,,,,,,,) = IApostleBase(apostleBase).getApostleInfo(_apostleTokenId); - uint256 enhancedTalents = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).enhanceWithMirrorToken(talents, _petTokenId); - - bool changed = _updateTalentsAndMinerStrength(_petTokenId, _apostleTokenId, genes, talents, enhancedTalents, _owner); - - emit Tied(_apostleTokenId, _petTokenId, enhancedTalents, changed, _originAddress, _owner); - } - - - function _updateTalentsAndMinerStrength(uint256 _petTokenId, uint256 _apostleTokenId, uint256 _genes, uint256 _talents, uint256 _modifiedTalents, address _owner) internal returns (bool){ - address erc721Bridge = registry.addressOf(SettingIds.CONTRACT_ERC721_BRIDGE); - IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); - - // if the pet is from outside world - // it need to be bridged in - if (interstellarEncoder.getProducerId(_petTokenId) >= 256) { - - require(IERC721Bridge(erc721Bridge).isBridged(_petTokenId), "please bridged in first."); - } - - address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); - - // if this pet is inside evoland - // it will also be considered in erc721Bridge - require(IERC721Bridge(erc721Bridge).ownerOf(_petTokenId) == _owner || ERC721(objectOwnership).ownerOf(_apostleTokenId) == _owner, "you have no right."); - - - // TODO: update mine - // changed - true - bool changed = _talents == _modifiedTalents ? false : true; - if (changed) { - address landResource = registry.addressOf(CONTRACT_LAND_RESOURCE); - if (ILandResource(landResource).landWorkingOn(_apostleTokenId) != 0) { - // true means minus strength - ILandResource(landResource).updateMinerStrengthWhenStop(_apostleTokenId); - } - - IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).updateGenesAndTalents(_apostleTokenId, _genes, _modifiedTalents); - - if (ILandResource(landResource).landWorkingOn(_apostleTokenId) != 0) { - ILandResource(landResource).updateMinerStrengthWhenStart(_apostleTokenId); - } - } - - return changed; - } - - function untiePetToken(uint256 _petTokenId) public { - uint256 apostleTokenId = pet2TiedStatus[_petTokenId].apostleTokenId; - - // if pet is not tied, do nothing - if(apostleTokenId == 0) { - return; - } - - uint256 index = pet2TiedStatus[_petTokenId].index; - // update count - tokenId2PetStatus[apostleTokenId].tiedCount = uint128(uint256(tokenId2PetStatus[apostleTokenId].tiedCount).sub(1)); - - // update petList - uint256 lastPetIndex = uint128(tokenId2PetStatus[apostleTokenId].tiedList.length.sub(1)); - uint256 lastPet = tokenId2PetStatus[apostleTokenId].tiedList[lastPetIndex]; - - tokenId2PetStatus[apostleTokenId].tiedList[index] = lastPet; - tokenId2PetStatus[apostleTokenId].tiedList[lastPetIndex] = 0; - - tokenId2PetStatus[apostleTokenId].tiedList.length -= 1; - - // update lastPet's index - pet2TiedStatus[lastPet].index = index; - - delete pet2TiedStatus[_petTokenId]; - - - address apostleBase = registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE); - uint256 talents; - uint256 genes; - (genes, talents, ,,,,,,,) = IApostleBase(apostleBase).getApostleInfo(apostleTokenId); - uint256 weakenTalents = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).removeMirrorToken(talents, _petTokenId); - - - bool changed = _updateTalentsAndMinerStrength(_petTokenId, apostleTokenId, genes, talents, weakenTalents, msg.sender); - - IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); - address originAddress = interstellarEncoder.getOriginAddress(_petTokenId); - - emit UnTied(apostleTokenId, _petTokenId, weakenTalents, changed, originAddress, msg.sender); - - } - - function getTiedPet(uint256 _apostleTokenId, uint256 _index) public view returns (uint256) { - return tokenId2PetStatus[_apostleTokenId].tiedList[_index]; - } - -} diff --git a/flat/PetBaseAuthority.sol b/flat/PetBaseAuthority.sol deleted file mode 100644 index ef4ea38..0000000 --- a/flat/PetBaseAuthority.sol +++ /dev/null @@ -1,19 +0,0 @@ -// Root file: contracts/pet/PetBaseAuthority.sol - -pragma solidity ^0.4.24; - -contract PetBaseAuthority { - mapping (address => bool) public whiteList; - - constructor(address[] _whitelists) public { - for (uint i = 0; i < _whitelists.length; i ++) { - whiteList[_whitelists[i]] = true; - } - } - - function canCall( - address _src, address _dst, bytes4 _sig - ) public view returns (bool) { - return ( whiteList[_src] && _sig == bytes4(keccak256("createPet(address)")) ); - } -} \ No newline at end of file diff --git a/flat/SiringAuctionBase.sol b/flat/SiringAuctionBase.sol deleted file mode 100644 index 6805104..0000000 --- a/flat/SiringAuctionBase.sol +++ /dev/null @@ -1,737 +0,0 @@ -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol - -// pragma solidity ^0.4.24; - - -/** - * @title SafeMath - * @dev Math operations with safety checks that throw on error - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, throws on overflow. - */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - // Gas optimization: this is cheaper than asserting 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (_a == 0) { - return 0; - } - - 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 _a / _b; - } - - /** - * @dev Subtracts 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 c) { - c = _a + _b; - assert(c >= _a); - return c; - } -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol - -// pragma solidity ^0.4.24; - -contract ITokenUse { - uint48 public constant MAX_UINT48_TIME = 281474976710655; - - function isObjectInHireStage(uint256 _tokenId) public view returns (bool); - - function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); - - function getTokenUser(uint256 _tokenId) public view returns (address); - - function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; - - function cancelTokenUseOffer(uint256 _tokenId) public; - - function takeTokenUseOffer(uint256 _tokenId) public; - - function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; - - function removeActivity(uint256 _tokenId, address _user) public; -} - -// Dependency file: contracts/interfaces/IApostleBase.sol - -// pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} - -// Root file: contracts/SiringAuctionBase.sol - -pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; -// import "contracts/interfaces/IApostleBase.sol"; - -/// @title Auction Core -/// @dev Contains models, variables, and internal methods for the auction. -contract SiringAuctionBase is ApostleSettingIds, PausableDSAuth { - using SafeMath for *; - - event AuctionCreated( - uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt - ); - event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); - event AuctionCancelled(uint256 tokenId); - - // Represents an auction on an NFT - struct Auction { - // Current owner of NFT - address seller; - // Price (in ring(wei)) at beginning of auction - uint128 startingPriceInToken; - // Price (in ring(wei)) at end of auction - uint128 endingPriceInToken; - // Duration (in seconds) of auction - uint48 duration; - // Time when auction started - // NOTE: 0 if this auction has been concluded - uint48 startedAt; - // bid with which token - address token; - } - - ISettingsRegistry public registry; - - // Map from token ID to their corresponding auction. - mapping (uint256 => Auction) public tokenIdToAuction; - - /// @dev DON'T give me your money. - function() external {} - - // Modifiers to check that inputs can be safely stored with a certain - // number of bits. We use constants and multiple modifiers to save gas. - modifier canBeStoredWith48Bits(uint256 _value) { - require(_value <= 281474976710655); - _; - } - - modifier canBeStoredWith128Bits(uint256 _value) { - require(_value < 340282366920938463463374607431768211455); - _; - } - - - /// @dev Creates and begins a new auction. - /// @param _tokenId - ID of token to auction, sender must be owner. - // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason - /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. - /// @param _endingPriceInToken - Price of item (in token) at end of auction. - /// @param _duration - Length of time to move between starting - /// price and ending price (in seconds). - /// @param _seller - Seller, if not the message sender - function _createAuction( - address _from, - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _seller, - address _token - ) - internal - canBeStoredWith128Bits(_startingPriceInToken) - canBeStoredWith128Bits(_endingPriceInToken) - canBeStoredWith48Bits(_duration) - canBeStoredWith48Bits(_startAt) - whenNotPaused - { - // Require that all auctions have a duration of - // at least one minute. (Keeps our math from getting hairy!) - require(_duration >= 1 minutes, "duration must be at least 1 minutes"); - require(_duration <= 1000 days); - - require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); - // escrow - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, address(this), _tokenId); - - tokenIdToAuction[_tokenId] = Auction({ - seller: _seller, - startedAt: uint48(_startAt), - duration: uint48(_duration), - startingPriceInToken: uint128(_startingPriceInToken), - endingPriceInToken: uint128(_endingPriceInToken), - token: _token - }); - - emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); - } - - /// @dev Cancels an auction unconditionally. - function _cancelAuction(uint256 _tokenId, address _seller) internal { - _removeAuction(_tokenId); - - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), _seller, _tokenId); - emit AuctionCancelled(_tokenId); - } - - - /// @dev Removes an auction from the list of open auctions. - /// @param _tokenId - ID of NFT on auction. - function _removeAuction(uint256 _tokenId) internal { - delete tokenIdToAuction[_tokenId]; - } - - /// @dev Returns true if the NFT is on auction. - /// @param _auction - Auction to check. - function _isOnAuction(Auction storage _auction) internal view returns (bool) { - return (_auction.startedAt > 0); - } - - /// @dev Returns current price of an NFT on auction. Broken into two - /// functions (this one, that computes the duration from the auction - /// structure, and the other that does the price computation) so we - /// can easily test that the price computation works correctly. - function _currentPrice(Auction storage _auction) - internal - view - returns (uint256) - { - uint256 secondsPassed = 0; - - // A bit of insurance against negative values (or wraparound). - // Probably not necessary (since Ethereum guarnatees that the - // now variable doesn't ever go backwards). - if (now > _auction.startedAt) { - secondsPassed = now - _auction.startedAt; - } - - return _computeCurrentPrice( - _auction.startingPriceInToken, - _auction.endingPriceInToken, - _auction.duration, - secondsPassed - ); - } - - /// @dev Computes the current price of an auction. Factored out - /// from _currentPrice so we can run extensive unit tests. - /// When testing, make this function public and turn on - /// `Current price computation` test suite. - function _computeCurrentPrice( - uint256 _startingPrice, - uint256 _endingPrice, - uint256 _duration, - uint256 _secondsPassed - ) - internal - pure - returns (uint256) - { - // NOTE: We don't use SafeMath (or similar) in this function because - // all of our public functions carefully cap the maximum values for - // time (at 64-bits) and currency (at 128-bits). _duration is - // also known to be non-zero (see the require() statement in - // _addAuction()) - if (_secondsPassed >= _duration) { - // We've reached the end of the dynamic pricing portion - // of the auction, just return the end price. - return _endingPrice; - } else { - // Starting price can be higher than ending price (and often is!), so - // this delta can be negative. - int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice); - - // This multiplication can't overflow, _secondsPassed will easily fit within - // 64-bits, and totalPriceChange will easily fit within 128-bits, their product - // will always fit within 256-bits. - int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration); - - // currentPriceChange can be negative, but if so, will have a magnitude - // less that _startingPrice. Thus, this result will always end up positive. - int256 currentPrice = int256(_startingPrice) + currentPriceChange; - - return uint256(currentPrice); - } - } - - /// @dev Computes owner's cut of a sale. - /// @param _price - Sale price of NFT. - function _computeCut(uint256 _price) internal view returns (uint256) { - // NOTE: We don't use SafeMath (or similar) in this function because - // all of our entry functions carefully cap the maximum values for - // currency (at 128-bits), and ownerCut <= 10000 (see the require() - // statement in the ClockAuction constructor). The result of this - // function is always guaranteed to be <= _price. - uint ownerCut = registry.uintOf(UINT_AUCTION_CUT); - return _price * ownerCut / 10000; - } - -} diff --git a/flat/SiringClockAuction.sol b/flat/SiringClockAuction.sol deleted file mode 100644 index e2dd7e8..0000000 --- a/flat/SiringClockAuction.sol +++ /dev/null @@ -1,999 +0,0 @@ -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol - -// pragma solidity ^0.4.23; - -contract ERC223 { - function transfer(address to, uint amount, bytes data) public returns (bool ok); - - function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); - - event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol - -// pragma solidity ^0.4.24; - -contract ITokenUse { - uint48 public constant MAX_UINT48_TIME = 281474976710655; - - function isObjectInHireStage(uint256 _tokenId) public view returns (bool); - - function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); - - function getTokenUser(uint256 _tokenId) public view returns (address); - - function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; - - function cancelTokenUseOffer(uint256 _tokenId) public; - - function takeTokenUseOffer(uint256 _tokenId) public; - - function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; - - function removeActivity(uint256 _tokenId, address _user) public; -} - -// Dependency file: contracts/interfaces/IApostleBase.sol - -// pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} - -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol - -// pragma solidity ^0.4.24; - - -/** - * @title SafeMath - * @dev Math operations with safety checks that throw on error - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, throws on overflow. - */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - // Gas optimization: this is cheaper than asserting 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (_a == 0) { - return 0; - } - - 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 _a / _b; - } - - /** - * @dev Subtracts 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 c) { - c = _a + _b; - assert(c >= _a); - return c; - } -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: contracts/SiringAuctionBase.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; -// import "contracts/interfaces/IApostleBase.sol"; - -/// @title Auction Core -/// @dev Contains models, variables, and internal methods for the auction. -contract SiringAuctionBase is ApostleSettingIds, PausableDSAuth { - using SafeMath for *; - - event AuctionCreated( - uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt - ); - event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); - event AuctionCancelled(uint256 tokenId); - - // Represents an auction on an NFT - struct Auction { - // Current owner of NFT - address seller; - // Price (in ring(wei)) at beginning of auction - uint128 startingPriceInToken; - // Price (in ring(wei)) at end of auction - uint128 endingPriceInToken; - // Duration (in seconds) of auction - uint48 duration; - // Time when auction started - // NOTE: 0 if this auction has been concluded - uint48 startedAt; - // bid with which token - address token; - } - - ISettingsRegistry public registry; - - // Map from token ID to their corresponding auction. - mapping (uint256 => Auction) public tokenIdToAuction; - - /// @dev DON'T give me your money. - function() external {} - - // Modifiers to check that inputs can be safely stored with a certain - // number of bits. We use constants and multiple modifiers to save gas. - modifier canBeStoredWith48Bits(uint256 _value) { - require(_value <= 281474976710655); - _; - } - - modifier canBeStoredWith128Bits(uint256 _value) { - require(_value < 340282366920938463463374607431768211455); - _; - } - - - /// @dev Creates and begins a new auction. - /// @param _tokenId - ID of token to auction, sender must be owner. - // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason - /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. - /// @param _endingPriceInToken - Price of item (in token) at end of auction. - /// @param _duration - Length of time to move between starting - /// price and ending price (in seconds). - /// @param _seller - Seller, if not the message sender - function _createAuction( - address _from, - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _seller, - address _token - ) - internal - canBeStoredWith128Bits(_startingPriceInToken) - canBeStoredWith128Bits(_endingPriceInToken) - canBeStoredWith48Bits(_duration) - canBeStoredWith48Bits(_startAt) - whenNotPaused - { - // Require that all auctions have a duration of - // at least one minute. (Keeps our math from getting hairy!) - require(_duration >= 1 minutes, "duration must be at least 1 minutes"); - require(_duration <= 1000 days); - - require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); - // escrow - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, address(this), _tokenId); - - tokenIdToAuction[_tokenId] = Auction({ - seller: _seller, - startedAt: uint48(_startAt), - duration: uint48(_duration), - startingPriceInToken: uint128(_startingPriceInToken), - endingPriceInToken: uint128(_endingPriceInToken), - token: _token - }); - - emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); - } - - /// @dev Cancels an auction unconditionally. - function _cancelAuction(uint256 _tokenId, address _seller) internal { - _removeAuction(_tokenId); - - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), _seller, _tokenId); - emit AuctionCancelled(_tokenId); - } - - - /// @dev Removes an auction from the list of open auctions. - /// @param _tokenId - ID of NFT on auction. - function _removeAuction(uint256 _tokenId) internal { - delete tokenIdToAuction[_tokenId]; - } - - /// @dev Returns true if the NFT is on auction. - /// @param _auction - Auction to check. - function _isOnAuction(Auction storage _auction) internal view returns (bool) { - return (_auction.startedAt > 0); - } - - /// @dev Returns current price of an NFT on auction. Broken into two - /// functions (this one, that computes the duration from the auction - /// structure, and the other that does the price computation) so we - /// can easily test that the price computation works correctly. - function _currentPrice(Auction storage _auction) - internal - view - returns (uint256) - { - uint256 secondsPassed = 0; - - // A bit of insurance against negative values (or wraparound). - // Probably not necessary (since Ethereum guarnatees that the - // now variable doesn't ever go backwards). - if (now > _auction.startedAt) { - secondsPassed = now - _auction.startedAt; - } - - return _computeCurrentPrice( - _auction.startingPriceInToken, - _auction.endingPriceInToken, - _auction.duration, - secondsPassed - ); - } - - /// @dev Computes the current price of an auction. Factored out - /// from _currentPrice so we can run extensive unit tests. - /// When testing, make this function public and turn on - /// `Current price computation` test suite. - function _computeCurrentPrice( - uint256 _startingPrice, - uint256 _endingPrice, - uint256 _duration, - uint256 _secondsPassed - ) - internal - pure - returns (uint256) - { - // NOTE: We don't use SafeMath (or similar) in this function because - // all of our public functions carefully cap the maximum values for - // time (at 64-bits) and currency (at 128-bits). _duration is - // also known to be non-zero (see the require() statement in - // _addAuction()) - if (_secondsPassed >= _duration) { - // We've reached the end of the dynamic pricing portion - // of the auction, just return the end price. - return _endingPrice; - } else { - // Starting price can be higher than ending price (and often is!), so - // this delta can be negative. - int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice); - - // This multiplication can't overflow, _secondsPassed will easily fit within - // 64-bits, and totalPriceChange will easily fit within 128-bits, their product - // will always fit within 256-bits. - int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration); - - // currentPriceChange can be negative, but if so, will have a magnitude - // less that _startingPrice. Thus, this result will always end up positive. - int256 currentPrice = int256(_startingPrice) + currentPriceChange; - - return uint256(currentPrice); - } - } - - /// @dev Computes owner's cut of a sale. - /// @param _price - Sale price of NFT. - function _computeCut(uint256 _price) internal view returns (uint256) { - // NOTE: We don't use SafeMath (or similar) in this function because - // all of our entry functions carefully cap the maximum values for - // currency (at 128-bits), and ownerCut <= 10000 (see the require() - // statement in the ClockAuction constructor). The result of this - // function is always guaranteed to be <= _price. - uint ownerCut = registry.uintOf(UINT_AUCTION_CUT); - return _price * ownerCut / 10000; - } - -} - - -// Root file: contracts/SiringClockAuction.sol - -pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; -// import "contracts/interfaces/IApostleBase.sol"; -// import "contracts/SiringAuctionBase.sol"; - -/// @title Clock auction for non-fungible tokens. -contract SiringClockAuction is SiringAuctionBase { - - - bool private singletonLock = false; - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - function initializeContract(ISettingsRegistry _registry) public singletonLockCall { - owner = msg.sender; - emit LogSetOwner(msg.sender); - - registry = _registry; - } - - /// @dev Cancels an auction that hasn't been won yet. - /// Returns the NFT to original owner. - /// @notice This is a state-modifying function that can - /// be called while the contract is paused. - /// @param _tokenId - ID of token on auction - function cancelAuction(uint256 _tokenId) - public - { - Auction storage auction = tokenIdToAuction[_tokenId]; - require(_isOnAuction(auction)); - address seller = auction.seller; - require(msg.sender == seller); - _cancelAuction(_tokenId, seller); - } - - /// @dev Cancels an auction when the contract is paused. - /// Only the owner may do this, and NFTs are returned to - /// the seller. This should only be used in emergencies. - /// @param _tokenId - ID of the NFT on auction to cancel. - function cancelAuctionWhenPaused(uint256 _tokenId) - whenPaused - onlyOwner - public - { - Auction storage auction = tokenIdToAuction[_tokenId]; - require(_isOnAuction(auction)); - _cancelAuction(_tokenId, auction.seller); - } - - /// @dev Returns auction info for an NFT on auction. - /// @param _tokenId - ID of NFT on auction. - function getAuction(uint256 _tokenId) - public - view - returns - ( - address seller, - uint256 startingPrice, - uint256 endingPrice, - uint256 duration, - uint256 startedAt, - address token - ) { - Auction storage auction = tokenIdToAuction[_tokenId]; - require(_isOnAuction(auction)); - return ( - auction.seller, - uint256(auction.startingPriceInToken), - uint256(auction.endingPriceInToken), - uint256(auction.duration), - uint256(auction.startedAt), - auction.token - ); - } - - /// @dev Returns the current price of an auction. - /// @param _tokenId - ID of the token price we are checking. - function getCurrentPriceInToken(uint256 _tokenId) - public - view - returns (uint256) - { - Auction storage auction = tokenIdToAuction[_tokenId]; - require(_isOnAuction(auction)); - return _currentPrice(auction); - } - - function receiveApproval( - address _from, - uint256 _tokenId, - bytes //_extraData - ) public whenNotPaused { - if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { - uint256 startingPriceInRING; - uint256 endingPriceInRING; - uint256 duration; - address seller; - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - startingPriceInRING := mload(add(ptr, 132)) - endingPriceInRING := mload(add(ptr, 164)) - duration := mload(add(ptr, 196)) - seller := mload(add(ptr, 228)) - } - - // TODO: add parameter _token - _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); - } - } - - - function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { - uint sireId; - uint matronId; - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - sireId := mload(add(ptr, 164)) - } - // safer for users - require(msg.sender == tokenIdToAuction[sireId].token); - require(tokenIdToAuction[sireId].startedAt > 0); - - uint256 autoBirthFee = registry.uintOf(UINT_AUTOBIRTH_FEE); - - // Check that the incoming bid is higher than the current price - uint priceInToken = getCurrentPriceInToken(sireId); - - require(_valueInToken >= (priceInToken + autoBirthFee), - "your offer is lower than the current price, try again with a higher one."); - Auction storage auction = tokenIdToAuction[sireId]; - require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); - - address seller = auction.seller; - - _removeAuction(sireId); - uint refund = _valueInToken - priceInToken - autoBirthFee; - - if (refund > 0) { - ERC20(msg.sender).transfer(_from, refund); - } - - if (priceInToken > 0) { - _bidWithToken(msg.sender, _from, seller, sireId, matronId, priceInToken, autoBirthFee); - } - } - - - function _bidWithToken( - address _auctionToken, address _from, address _seller, uint256 _sireId, uint256 _matronId, uint256 _priceInToken, uint256 _autoBirthFee) internal { - //uint256 ownerCutAmount = _computeCut(priceInToken); - uint cut = _computeCut(_priceInToken); - ERC223(_auctionToken).transfer(_seller, (_priceInToken - cut), toBytes(_from)); - ERC223(_auctionToken).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), (cut + _autoBirthFee), toBytes(_from)); - - IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).approveSiring(_from, _sireId); - - address apostleBase = registry.addressOf(CONTRACT_APOSTLE_BASE); - - require(IApostleBase(apostleBase).breedWithInAuction(_matronId, _sireId)); - - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), _seller, _sireId); - - // Tell the world! - emit AuctionSuccessful(_sireId, _priceInToken, _from); - - } - - function toBytes(address x) public pure returns (bytes b) { - b = new bytes(32); - assembly {mstore(add(b, 32), x)} - } - - // to apply for the safeTransferFrom - function onERC721Received( - address, //_operator, - address, //_from, - uint256, // _tokenId, - bytes //_data - ) - public - returns (bytes4) { - return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); - - } -} diff --git a/flat/SiringClockAuctionV2.sol b/flat/SiringClockAuctionV2.sol deleted file mode 100644 index 9911bed..0000000 --- a/flat/SiringClockAuctionV2.sol +++ /dev/null @@ -1,1003 +0,0 @@ -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC20Basic - * @dev Simpler version of ERC20 interface - * See https://github.com/ethereum/EIPs/issues/179 - */ -contract ERC20Basic { - function totalSupply() public view returns (uint256); - function balanceOf(address _who) public view returns (uint256); - function transfer(address _to, uint256 _value) public returns (bool); - event Transfer(address indexed from, address indexed to, uint256 value); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; - - -/** - * @title ERC20 interface - * @dev see https://github.com/ethereum/EIPs/issues/20 - */ -contract ERC20 is ERC20Basic { - function allowance(address _owner, address _spender) - public view returns (uint256); - - function transferFrom(address _from, address _to, uint256 _value) - public returns (bool); - - function approve(address _spender, uint256 _value) public returns (bool); - event Approval( - address indexed owner, - address indexed spender, - uint256 value - ); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ISettingsRegistry.sol - -// pragma solidity ^0.4.24; - -contract ISettingsRegistry { - enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } - - function uintOf(bytes32 _propertyName) public view returns (uint256); - - function stringOf(bytes32 _propertyName) public view returns (string); - - function addressOf(bytes32 _propertyName) public view returns (address); - - function bytesOf(bytes32 _propertyName) public view returns (bytes); - - function boolOf(bytes32 _propertyName) public view returns (bool); - - function intOf(bytes32 _propertyName) public view returns (int); - - function setUintProperty(bytes32 _propertyName, uint _value) public; - - function setStringProperty(bytes32 _propertyName, string _value) public; - - function setAddressProperty(bytes32 _propertyName, address _value) public; - - function setBytesProperty(bytes32 _propertyName, bytes _value) public; - - function setBoolProperty(bytes32 _propertyName, bool _value) public; - - function setIntProperty(bytes32 _propertyName, int _value) public; - - function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); - - event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); -} - -// Dependency file: @evolutionland/common/contracts/interfaces/ERC223.sol - -// pragma solidity ^0.4.23; - -contract ERC223 { - function transfer(address to, uint amount, bytes data) public returns (bool ok); - - function transferFrom(address from, address to, uint256 amount, bytes data) public returns (bool ok); - - event ERC223Transfer(address indexed from, address indexed to, uint amount, bytes data); -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/ITokenUse.sol - -// pragma solidity ^0.4.24; - -contract ITokenUse { - uint48 public constant MAX_UINT48_TIME = 281474976710655; - - function isObjectInHireStage(uint256 _tokenId) public view returns (bool); - - function isObjectReadyToUse(uint256 _tokenId) public view returns (bool); - - function getTokenUser(uint256 _tokenId) public view returns (address); - - function createTokenUseOffer(uint256 _tokenId, uint256 _duration, uint256 _price, address _acceptedActivity) public; - - function cancelTokenUseOffer(uint256 _tokenId) public; - - function takeTokenUseOffer(uint256 _tokenId) public; - - function addActivity(uint256 _tokenId, address _user, uint256 _endTime) public; - - function removeActivity(uint256 _tokenId, address _user) public; -} - -// Dependency file: contracts/interfaces/IApostleBase.sol - -// pragma solidity ^0.4.24; - - -// TODO: upgrade common-contacts version then delete this. -contract IApostleBase { - function createApostle( - uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public returns (uint256) ; - - function isReadyToBreed(uint256 _apostleId) public view returns (bool); - - function isAbleToBreed(uint256 _matronId, uint256 _sireId, address _owner) public view returns(bool); - - function breedWithInAuction(uint256 _matronId, uint256 _sireId) public returns (bool); - - function canBreedWith(uint256 _matronId, uint256 _sireId) public view returns (bool); - - function getCooldownDuration(uint256 _tokenId) public view returns (uint256); - - function defaultLifeTime(uint256 _tokenId) public view returns (uint256); - - function isDead(uint256 _tokenId) public view returns (bool); - - function approveSiring(address _addr, uint256 _sireId) public; - - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256); - - function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public; -} - -// Dependency file: openzeppelin-solidity/contracts/introspection/ERC165.sol - -// pragma solidity ^0.4.24; - - -/** - * @title ERC165 - * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md - */ -interface ERC165 { - - /** - * @notice Query if a contract implements an interface - * @param _interfaceId The interface identifier, as specified in ERC-165 - * @dev Interface identification is specified in ERC-165. This function - * uses less than 30,000 gas. - */ - function supportsInterface(bytes4 _interfaceId) - external - view - returns (bool); -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; - - -/** - * @title ERC721 Non-Fungible Token Standard basic interface - * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Basic is ERC165 { - - bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; - /* - * 0x80ac58cd === - * bytes4(keccak256('balanceOf(address)')) ^ - * bytes4(keccak256('ownerOf(uint256)')) ^ - * bytes4(keccak256('approve(address,uint256)')) ^ - * bytes4(keccak256('getApproved(uint256)')) ^ - * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ - * bytes4(keccak256('isApprovedForAll(address,address)')) ^ - * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ - * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) - */ - - bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; - /* - * 0x4f558e79 === - * bytes4(keccak256('exists(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; - /** - * 0x780e9d63 === - * bytes4(keccak256('totalSupply()')) ^ - * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ - * bytes4(keccak256('tokenByIndex(uint256)')) - */ - - bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; - /** - * 0x5b5e139f === - * bytes4(keccak256('name()')) ^ - * bytes4(keccak256('symbol()')) ^ - * bytes4(keccak256('tokenURI(uint256)')) - */ - - event Transfer( - address indexed _from, - address indexed _to, - uint256 indexed _tokenId - ); - event Approval( - address indexed _owner, - address indexed _approved, - uint256 indexed _tokenId - ); - event ApprovalForAll( - address indexed _owner, - address indexed _operator, - bool _approved - ); - - function balanceOf(address _owner) public view returns (uint256 _balance); - function ownerOf(uint256 _tokenId) public view returns (address _owner); - function exists(uint256 _tokenId) public view returns (bool _exists); - - function approve(address _to, uint256 _tokenId) public; - function getApproved(uint256 _tokenId) - public view returns (address _operator); - - function setApprovalForAll(address _operator, bool _approved) public; - function isApprovedForAll(address _owner, address _operator) - public view returns (bool); - - function transferFrom(address _from, address _to, uint256 _tokenId) public; - function safeTransferFrom(address _from, address _to, uint256 _tokenId) - public; - - function safeTransferFrom( - address _from, - address _to, - uint256 _tokenId, - bytes _data - ) - public; -} - - -// Dependency file: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Enumerable is ERC721Basic { - function totalSupply() public view returns (uint256); - function tokenOfOwnerByIndex( - address _owner, - uint256 _index - ) - public - view - returns (uint256 _tokenId); - - function tokenByIndex(uint256 _index) public view returns (uint256); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, optional metadata extension - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721Metadata is ERC721Basic { - function name() external view returns (string _name); - function symbol() external view returns (string _symbol); - function tokenURI(uint256 _tokenId) public view returns (string); -} - - -/** - * @title ERC-721 Non-Fungible Token Standard, full implementation interface - * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md - */ -contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { -} - - -// Dependency file: openzeppelin-solidity/contracts/math/SafeMath.sol - -// pragma solidity ^0.4.24; - - -/** - * @title SafeMath - * @dev Math operations with safety checks that throw on error - */ -library SafeMath { - - /** - * @dev Multiplies two numbers, throws on overflow. - */ - function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { - // Gas optimization: this is cheaper than asserting 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - if (_a == 0) { - return 0; - } - - 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 _a / _b; - } - - /** - * @dev Subtracts 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 c) { - c = _a + _b; - assert(c >= _a); - return c; - } -} - - -// Dependency file: @evolutionland/common/contracts/interfaces/IAuthority.sol - -// pragma solidity ^0.4.24; - -contract IAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} - -// Dependency file: @evolutionland/common/contracts/DSAuth.sol - -// pragma solidity ^0.4.24; - -// import '/Users/echo/workspace/contract/evolutionlandorg/apostle/node_modules/@evolutionland/common/contracts/interfaces/IAuthority.sol'; - -contract DSAuthEvents { - event LogSetAuthority (address indexed authority); - event LogSetOwner (address indexed owner); -} - -/** - * @title DSAuth - * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth - * But in the isAuthorized method, the src from address(this) is remove for safty concern. - */ -contract DSAuth is DSAuthEvents { - IAuthority public authority; - address public owner; - - constructor() public { - owner = msg.sender; - emit LogSetOwner(msg.sender); - } - - function setOwner(address owner_) - public - auth - { - owner = owner_; - emit LogSetOwner(owner); - } - - function setAuthority(IAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(authority); - } - - modifier auth { - require(isAuthorized(msg.sender, msg.sig)); - _; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function isAuthorized(address src, bytes4 sig) internal view returns (bool) { - if (src == owner) { - return true; - } else if (authority == IAuthority(0)) { - return false; - } else { - return authority.canCall(src, this, sig); - } - } -} - - -// Dependency file: @evolutionland/common/contracts/PausableDSAuth.sol - -// pragma solidity ^0.4.24; - -// import "@evolutionland/common/contracts/DSAuth.sol"; - - -/** - * @title Pausable - * @dev Base contract which allows children to implement an emergency stop mechanism. - */ -contract PausableDSAuth is DSAuth { - event Pause(); - event Unpause(); - - bool public paused = false; - - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - */ - modifier whenNotPaused() { - require(!paused); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - */ - modifier whenPaused() { - require(paused); - _; - } - - /** - * @dev called by the owner to pause, triggers stopped state - */ - function pause() public onlyOwner whenNotPaused { - paused = true; - emit Pause(); - } - - /** - * @dev called by the owner to unpause, returns to normal state - */ - function unpause() public onlyOwner whenPaused { - paused = false; - emit Unpause(); - } -} - -// Dependency file: @evolutionland/common/contracts/SettingIds.sol - -// pragma solidity ^0.4.24; - -/** - Id definitions for SettingsRegistry.sol - Can be used in conjunction with the settings registry to get properties -*/ -contract SettingIds { - bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; - - bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; - - bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; - - bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; - - bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; - - bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; - - bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; - - bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; - - bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; - - bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; - - bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; - - // Cut owner takes on each auction, measured in basis points (1/100 of a percent). - // this can be considered as transaction fee. - // Values 0-10,000 map to 0%-100% - // set ownerCut to 4% - // ownerCut = 400; - bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 - - bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 - - // Cut referer takes on each auction, measured in basis points (1/100 of a percent). - // which cut from transaction fee. - // Values 0-10,000 map to 0%-100% - // set refererCut to 4% - // refererCut = 400; - bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; - - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - -// Dependency file: contracts/ApostleSettingIds.sol - -// pragma solidity ^0.4.24; -// import "@evolutionland/common/contracts/SettingIds.sol"; - - -contract ApostleSettingIds is SettingIds { - - bytes32 public constant CONTRACT_GENE_SCIENCE = "CONTRACT_GENE_SCIENCE"; - - /// @notice The minimum payment required to use breedWithAuto(). This fee goes towards - /// the gas cost paid by the auto-birth daemon, and can be dynamically updated by - /// the COO role as the gas price changes. - bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; - - bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; - - bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; - - bytes32 public constant CONTRACT_APOSTLE_AUCTION = "CONTRACT_APOSTLE_AUCTION"; - - bytes32 public constant CONTRACT_HABERG_POTION_SHOP = "CONTRACT_HABERG_POTION_SHOP"; - - // when player wants to buy their apostle some talents - // the minimum or unit they need to pay - bytes32 public constant UINT_MIX_TALENT = "UINT_MIX_TALENT"; - - bytes32 public constant UINT_APOSTLE_BID_WAITING_TIME = "UINT_APOSTLE_BID_WAITING_TIME"; - - /// Denominator is 100000000 - bytes32 public constant UINT_HABERG_POTION_TAX_RATE = "UINT_HABERG_POTION_TAX_RATE"; - - // TODO: move this to common-contract - bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; -} - - -// Dependency file: contracts/SiringAuctionBase.sol - -// pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -// import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/PausableDSAuth.sol"; -// import "contracts/ApostleSettingIds.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; -// import "contracts/interfaces/IApostleBase.sol"; - -/// @title Auction Core -/// @dev Contains models, variables, and internal methods for the auction. -contract SiringAuctionBase is ApostleSettingIds, PausableDSAuth { - using SafeMath for *; - - event AuctionCreated( - uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt - ); - event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); - event AuctionCancelled(uint256 tokenId); - - // Represents an auction on an NFT - struct Auction { - // Current owner of NFT - address seller; - // Price (in ring(wei)) at beginning of auction - uint128 startingPriceInToken; - // Price (in ring(wei)) at end of auction - uint128 endingPriceInToken; - // Duration (in seconds) of auction - uint48 duration; - // Time when auction started - // NOTE: 0 if this auction has been concluded - uint48 startedAt; - // bid with which token - address token; - } - - ISettingsRegistry public registry; - - // Map from token ID to their corresponding auction. - mapping (uint256 => Auction) public tokenIdToAuction; - - /// @dev DON'T give me your money. - function() external {} - - // Modifiers to check that inputs can be safely stored with a certain - // number of bits. We use constants and multiple modifiers to save gas. - modifier canBeStoredWith48Bits(uint256 _value) { - require(_value <= 281474976710655); - _; - } - - modifier canBeStoredWith128Bits(uint256 _value) { - require(_value < 340282366920938463463374607431768211455); - _; - } - - - /// @dev Creates and begins a new auction. - /// @param _tokenId - ID of token to auction, sender must be owner. - // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason - /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. - /// @param _endingPriceInToken - Price of item (in token) at end of auction. - /// @param _duration - Length of time to move between starting - /// price and ending price (in seconds). - /// @param _seller - Seller, if not the message sender - function _createAuction( - address _from, - uint256 _tokenId, - uint256 _startingPriceInToken, - uint256 _endingPriceInToken, - uint256 _duration, - uint256 _startAt, - address _seller, - address _token - ) - internal - canBeStoredWith128Bits(_startingPriceInToken) - canBeStoredWith128Bits(_endingPriceInToken) - canBeStoredWith48Bits(_duration) - canBeStoredWith48Bits(_startAt) - whenNotPaused - { - // Require that all auctions have a duration of - // at least one minute. (Keeps our math from getting hairy!) - require(_duration >= 1 minutes, "duration must be at least 1 minutes"); - require(_duration <= 1000 days); - - require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); - // escrow - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, address(this), _tokenId); - - tokenIdToAuction[_tokenId] = Auction({ - seller: _seller, - startedAt: uint48(_startAt), - duration: uint48(_duration), - startingPriceInToken: uint128(_startingPriceInToken), - endingPriceInToken: uint128(_endingPriceInToken), - token: _token - }); - - emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); - } - - /// @dev Cancels an auction unconditionally. - function _cancelAuction(uint256 _tokenId, address _seller) internal { - _removeAuction(_tokenId); - - ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), _seller, _tokenId); - emit AuctionCancelled(_tokenId); - } - - - /// @dev Removes an auction from the list of open auctions. - /// @param _tokenId - ID of NFT on auction. - function _removeAuction(uint256 _tokenId) internal { - delete tokenIdToAuction[_tokenId]; - } - - /// @dev Returns true if the NFT is on auction. - /// @param _auction - Auction to check. - function _isOnAuction(Auction storage _auction) internal view returns (bool) { - return (_auction.startedAt > 0); - } - - /// @dev Returns current price of an NFT on auction. Broken into two - /// functions (this one, that computes the duration from the auction - /// structure, and the other that does the price computation) so we - /// can easily test that the price computation works correctly. - function _currentPrice(Auction storage _auction) - internal - view - returns (uint256) - { - uint256 secondsPassed = 0; - - // A bit of insurance against negative values (or wraparound). - // Probably not necessary (since Ethereum guarnatees that the - // now variable doesn't ever go backwards). - if (now > _auction.startedAt) { - secondsPassed = now - _auction.startedAt; - } - - return _computeCurrentPrice( - _auction.startingPriceInToken, - _auction.endingPriceInToken, - _auction.duration, - secondsPassed - ); - } - - /// @dev Computes the current price of an auction. Factored out - /// from _currentPrice so we can run extensive unit tests. - /// When testing, make this function public and turn on - /// `Current price computation` test suite. - function _computeCurrentPrice( - uint256 _startingPrice, - uint256 _endingPrice, - uint256 _duration, - uint256 _secondsPassed - ) - internal - pure - returns (uint256) - { - // NOTE: We don't use SafeMath (or similar) in this function because - // all of our public functions carefully cap the maximum values for - // time (at 64-bits) and currency (at 128-bits). _duration is - // also known to be non-zero (see the require() statement in - // _addAuction()) - if (_secondsPassed >= _duration) { - // We've reached the end of the dynamic pricing portion - // of the auction, just return the end price. - return _endingPrice; - } else { - // Starting price can be higher than ending price (and often is!), so - // this delta can be negative. - int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice); - - // This multiplication can't overflow, _secondsPassed will easily fit within - // 64-bits, and totalPriceChange will easily fit within 128-bits, their product - // will always fit within 256-bits. - int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration); - - // currentPriceChange can be negative, but if so, will have a magnitude - // less that _startingPrice. Thus, this result will always end up positive. - int256 currentPrice = int256(_startingPrice) + currentPriceChange; - - return uint256(currentPrice); - } - } - - /// @dev Computes owner's cut of a sale. - /// @param _price - Sale price of NFT. - function _computeCut(uint256 _price) internal view returns (uint256) { - // NOTE: We don't use SafeMath (or similar) in this function because - // all of our entry functions carefully cap the maximum values for - // currency (at 128-bits), and ownerCut <= 10000 (see the require() - // statement in the ClockAuction constructor). The result of this - // function is always guaranteed to be <= _price. - uint ownerCut = registry.uintOf(UINT_AUCTION_CUT); - return _price * ownerCut / 10000; - } - -} - - -// Root file: contracts/SiringClockAuctionV2.sol - -pragma solidity ^0.4.24; - -// import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -// import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -// import "@evolutionland/common/contracts/interfaces/ERC223.sol"; -// import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; -// import "contracts/interfaces/IApostleBase.sol"; -// import "contracts/SiringAuctionBase.sol"; - -/// @title Clock auction for non-fungible tokens. -contract SiringClockAuctionV2 is SiringAuctionBase { - - - bool private singletonLock = false; - - /* - * Modifiers - */ - modifier singletonLockCall() { - require(!singletonLock, "Only can call once"); - _; - singletonLock = true; - } - - function initializeContract(ISettingsRegistry _registry) public singletonLockCall { - owner = msg.sender; - emit LogSetOwner(msg.sender); - - registry = _registry; - } - - /// @dev Cancels an auction that hasn't been won yet. - /// Returns the NFT to original owner. - /// @notice This is a state-modifying function that can - /// be called while the contract is paused. - /// @param _tokenId - ID of token on auction - function cancelAuction(uint256 _tokenId) - public - { - Auction storage auction = tokenIdToAuction[_tokenId]; - require(_isOnAuction(auction)); - address seller = auction.seller; - require(msg.sender == seller); - _cancelAuction(_tokenId, seller); - } - - /// @dev Cancels an auction when the contract is paused. - /// Only the owner may do this, and NFTs are returned to - /// the seller. This should only be used in emergencies. - /// @param _tokenId - ID of the NFT on auction to cancel. - function cancelAuctionWhenPaused(uint256 _tokenId) - whenPaused - onlyOwner - public - { - Auction storage auction = tokenIdToAuction[_tokenId]; - require(_isOnAuction(auction)); - _cancelAuction(_tokenId, auction.seller); - } - - /// @dev Returns auction info for an NFT on auction. - /// @param _tokenId - ID of NFT on auction. - function getAuction(uint256 _tokenId) - public - view - returns - ( - address seller, - uint256 startingPrice, - uint256 endingPrice, - uint256 duration, - uint256 startedAt, - address token - ) { - Auction storage auction = tokenIdToAuction[_tokenId]; - require(_isOnAuction(auction)); - return ( - auction.seller, - uint256(auction.startingPriceInToken), - uint256(auction.endingPriceInToken), - uint256(auction.duration), - uint256(auction.startedAt), - auction.token - ); - } - - /// @dev Returns the current price of an auction. - /// @param _tokenId - ID of the token price we are checking. - function getCurrentPriceInToken(uint256 _tokenId) - public - view - returns (uint256) - { - Auction storage auction = tokenIdToAuction[_tokenId]; - require(_isOnAuction(auction)); - return _currentPrice(auction); - } - - function receiveApproval( - address _from, - uint256 _tokenId, - bytes //_extraData - ) public whenNotPaused { - if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { - uint256 startingPriceInRING; - uint256 endingPriceInRING; - uint256 duration; - address seller; - - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - startingPriceInRING := mload(add(ptr, 132)) - endingPriceInRING := mload(add(ptr, 164)) - duration := mload(add(ptr, 196)) - seller := mload(add(ptr, 228)) - } - - // TODO: add parameter _token - _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); - } - } - - - function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { - uint sireId; - uint matronId; - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - sireId := mload(add(ptr, 164)) - } - // safer for users - require(msg.sender == tokenIdToAuction[sireId].token); - require(tokenIdToAuction[sireId].startedAt > 0); - - uint256 autoBirthFee = registry.uintOf(UINT_AUTOBIRTH_FEE); - - // Check that the incoming bid is higher than the current price - uint priceInToken = getCurrentPriceInToken(sireId); - - require(_valueInToken >= (priceInToken + autoBirthFee), - "your offer is lower than the current price, try again with a higher one."); - Auction storage auction = tokenIdToAuction[sireId]; - require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); - - address seller = auction.seller; - - _removeAuction(sireId); - uint refund = _valueInToken - priceInToken - autoBirthFee; - - if (refund > 0) { - ERC20(msg.sender).transfer(_from, refund); - } - - if (priceInToken > 0) { - _bidWithToken(msg.sender, _from, seller, sireId, matronId, priceInToken, autoBirthFee); - } - } - - - function _bidWithToken( - address _auctionToken, address _from, address _seller, uint256 _sireId, uint256 _matronId, uint256 _priceInToken, uint256 _autoBirthFee) - internal - { - ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); - require(objectOwnership.ownerOf(_matronId) == _from, "You can only breed your own apostle."); - //uint256 ownerCutAmount = _computeCut(priceInToken); - uint cut = _computeCut(_priceInToken); - ERC223(_auctionToken).transfer(_seller, (_priceInToken - cut), toBytes(_from)); - ERC223(_auctionToken).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), (cut + _autoBirthFee), toBytes(_from)); - - IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).approveSiring(_from, _sireId); - - address apostleBase = registry.addressOf(CONTRACT_APOSTLE_BASE); - - require(IApostleBase(apostleBase).breedWithInAuction(_matronId, _sireId)); - - objectOwnership.transferFrom(address(this), _seller, _sireId); - - // Tell the world! - emit AuctionSuccessful(_sireId, _priceInToken, _from); - - } - - function toBytes(address x) public pure returns (bytes b) { - b = new bytes(32); - assembly {mstore(add(b, 32), x)} - } - - // to apply for the safeTransferFrom - function onERC721Received( - address, //_operator, - address, //_from, - uint256, // _tokenId, - bytes //_data - ) - public - returns (bytes4) { - return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); - - } -} From 04e3127cd819648afebe806d3a70340620e08048 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 22 Apr 2021 19:50:24 +0800 Subject: [PATCH 12/64] unset legacy env --- .env | 1 + 1 file changed, 1 insertion(+) diff --git a/.env b/.env index b0cc4f2..8403628 100644 --- a/.env +++ b/.env @@ -4,3 +4,4 @@ export DAPP_REMAPPINGS="openzeppelin-solidity/=lib/zeppelin-solidity/ @evolutionland/common/=lib/common-contracts/ @evolutionland/upgraeability-using-unstructured-storage/=lib/upgradeability-using-unstructured-storage/" export DAPP_BUILD_OPTIMIZE=1 +unset SOLC_FLAGS DAPP_BUILD_LEGACY DAPP_BUILD_EXTRACT From c1183fabf2ad6c4a0fc11154577b61248ea48570 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 22 Apr 2021 20:08:10 +0800 Subject: [PATCH 13/64] fmt --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b05c591..8b2a92c 100644 --- a/Makefile +++ b/Makefile @@ -1 +1 @@ -all :; source .env && dapp --use solc:0.4.24 build +all :; source .env && dapp --use solc:0.4.24 build From d3cf38dfede381c5d3d212969173b88f5b2a807a Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 23 Apr 2021 12:22:33 +0800 Subject: [PATCH 14/64] make cleand --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8b2a92c..5775c51 100644 --- a/Makefile +++ b/Makefile @@ -1 +1,2 @@ -all :; source .env && dapp --use solc:0.4.24 build +all :; source .env && dapp --use solc:0.4.24 build +clean :; dapp clean From d5d9ba6cb5050213f8ef4a3f5d3bfc50d9cf2a03 Mon Sep 17 00:00:00 2001 From: echo Date: Mon, 26 Apr 2021 00:47:20 +0800 Subject: [PATCH 15/64] dapp uninstall upgradeability-using-unstructured-storage --- .gitmodules | 3 --- lib/upgradeability-using-unstructured-storage | 1 - 2 files changed, 4 deletions(-) delete mode 160000 lib/upgradeability-using-unstructured-storage diff --git a/.gitmodules b/.gitmodules index 8e985d9..4cde075 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "lib/common-contracts"] path = lib/common-contracts url = https://github.com/evolutionlandorg/common-contracts -[submodule "lib/upgradeability-using-unstructured-storage"] - path = lib/upgradeability-using-unstructured-storage - url = https://github.com/evolutionlandorg/upgradeability-using-unstructured-storage diff --git a/lib/upgradeability-using-unstructured-storage b/lib/upgradeability-using-unstructured-storage deleted file mode 160000 index 5d89ae1..0000000 --- a/lib/upgradeability-using-unstructured-storage +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5d89ae1a00943cbe06d2fb97ad8ade0f9a7f8f08 From 517958a2d8062f6f4461b7eed927e525dbcdd746 Mon Sep 17 00:00:00 2001 From: echo Date: Mon, 26 Apr 2021 10:12:03 +0800 Subject: [PATCH 16/64] rm outdate proxy --- contracts/Migrations.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol index ec90e6e..a75b61c 100644 --- a/contracts/Migrations.sol +++ b/contracts/Migrations.sol @@ -4,7 +4,7 @@ import '@evolutionland/common/contracts/SettingsRegistry.sol'; import "@evolutionland/common/contracts/ObjectOwnership.sol"; import "@evolutionland/common/contracts/InterstellarEncoderV3.sol"; import "@evolutionland/common/contracts/InterstellarEncoderV2.sol"; -import "@evolutionland/upgraeability-using-unstructured-storage/contracts/OwnedUpgradeabilityProxy.sol"; +// import "@evolutionland/upgraeability-using-unstructured-storage/contracts/OwnedUpgradeabilityProxy.sol"; import "@evolutionland/common/contracts/ERC721Bridge.sol"; contract Migrations { From e6b0286710cf4ea6f5c1957c9c91cbf30b3f4d71 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 12:10:06 +0800 Subject: [PATCH 17/64] rm basev3 --- contracts/ApostleBaseV3.sol | 52 ------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 contracts/ApostleBaseV3.sol diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol deleted file mode 100644 index 3b2252b..0000000 --- a/contracts/ApostleBaseV3.sol +++ /dev/null @@ -1,52 +0,0 @@ -pragma solidity ^0.4.24; - -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -import "./interfaces/IItemBar.sol"; -import "./ApostleBaseV2.sol"; - -contract ApostleBaseV3 is ApostleBaseV2 { - - using SafeMath for uint256; - - // 0x434f4e54524143545f41504f53544c455f4954454d5f42415200000000000000 - bytes32 public constant CONTRACT_APOSTLE_ITEM_BAR = "CONTRACT_APOSTLE_ITEM_BAR"; - - // rate precision - uint128 public constant RATE_PRECISION = 10**8; - - //cache for gas saving - mapping(uint256 => mapping(uint256 => mapping(address => uint256))) talents2Strength; - - function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - uint256 talents = tokenId2Apostle[_tokenId].talents; - uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; - if (strength == 0) { - strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); - } - // V3 - address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); - uint256 enhanceRate = - IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); - uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_PRECISION); - uint256 totalStrength = strength.add(enhanceStrength); - return totalStrength; - } - - function cachedStrengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public returns (uint256) { - uint256 talents = tokenId2Apostle[_tokenId].talents; - uint256 strength = talents2Strength[talents][_landTokenId][_resourceToken]; - if (strength == 0) { - strength = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); - talents2Strength[talents][_landTokenId][_resourceToken] = strength; - } - // V3 - address itemBar = registry.addressOf(CONTRACT_APOSTLE_ITEM_BAR); - uint256 enhanceRate = - IItemBar(itemBar).enhanceStrengthRateOf(_resourceToken, _tokenId); - uint256 enhanceStrength = strength.mul(enhanceRate).div(RATE_PRECISION); - uint256 totalStrength = strength.add(enhanceStrength); - return totalStrength; - } -} From da1ef288b0bb2da6467a7b0ba76e9c8d7ed03a4d Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 12:15:13 +0800 Subject: [PATCH 18/64] rm itembar --- contracts/interfaces/IItemBar.sol | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 contracts/interfaces/IItemBar.sol diff --git a/contracts/interfaces/IItemBar.sol b/contracts/interfaces/IItemBar.sol deleted file mode 100644 index 530ebc8..0000000 --- a/contracts/interfaces/IItemBar.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma solidity ^0.4.24; - -interface IItemBar { - function enhanceStrengthRateOf( - address _resourceToken, - uint256 _tokenId - ) external view returns (uint256); -} From c6123a8f6c8cb94dfedcb969b4adcccb9aead966 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 12:20:04 +0800 Subject: [PATCH 19/64] rm truffle --- .gitignore | 8 -- contracts/Migrations.sol | 30 ----- migrations/10_update_SiringClockAuction.js | 19 --- migrations/11_update_apostleBaseAuthority.js | 30 ----- migrations/1_initial_migration.js | 5 - migrations/2_deploy_migration.js | 131 ------------------- migrations/3_uprade_apostlebaseAuthority.js | 24 ---- migrations/4_upgrade_apostlebase.js | 19 --- migrations/5_upgrade_apostleClockAuction.js | 19 --- migrations/6_updateSiringClockAuction.js | 19 --- migrations/7_update_gen0Apostle.js | 19 --- migrations/8_petBase_migration.js | 77 ----------- migrations/9_update_petBase.js | 19 --- package.json | 34 ----- 14 files changed, 453 deletions(-) delete mode 100644 contracts/Migrations.sol delete mode 100644 migrations/10_update_SiringClockAuction.js delete mode 100644 migrations/11_update_apostleBaseAuthority.js delete mode 100644 migrations/1_initial_migration.js delete mode 100644 migrations/2_deploy_migration.js delete mode 100644 migrations/3_uprade_apostlebaseAuthority.js delete mode 100644 migrations/4_upgrade_apostlebase.js delete mode 100644 migrations/5_upgrade_apostleClockAuction.js delete mode 100644 migrations/6_updateSiringClockAuction.js delete mode 100644 migrations/7_update_gen0Apostle.js delete mode 100644 migrations/8_petBase_migration.js delete mode 100644 migrations/9_update_petBase.js delete mode 100644 package.json diff --git a/.gitignore b/.gitignore index 66167fa..992f356 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,3 @@ .idea -node_modules -build -truffle.js -truffle-config.js -package-lock.json -contracts/GeneScienceV8.sol -waffle.json -cache out flat diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol deleted file mode 100644 index a75b61c..0000000 --- a/contracts/Migrations.sol +++ /dev/null @@ -1,30 +0,0 @@ -pragma solidity ^0.4.23; -import "@evolutionland/common/contracts/ObjectOwnershipAuthority.sol"; -import '@evolutionland/common/contracts/SettingsRegistry.sol'; -import "@evolutionland/common/contracts/ObjectOwnership.sol"; -import "@evolutionland/common/contracts/InterstellarEncoderV3.sol"; -import "@evolutionland/common/contracts/InterstellarEncoderV2.sol"; -// import "@evolutionland/upgraeability-using-unstructured-storage/contracts/OwnedUpgradeabilityProxy.sol"; -import "@evolutionland/common/contracts/ERC721Bridge.sol"; - -contract Migrations { - address public owner; - uint public last_completed_migration; - - constructor() public { - owner = msg.sender; - } - - modifier restricted() { - if (msg.sender == owner) _; - } - - function setCompleted(uint completed) public restricted { - last_completed_migration = completed; - } - - function upgrade(address new_address) public restricted { - Migrations upgraded = Migrations(new_address); - upgraded.setCompleted(last_completed_migration); - } -} diff --git a/migrations/10_update_SiringClockAuction.js b/migrations/10_update_SiringClockAuction.js deleted file mode 100644 index 8363c9f..0000000 --- a/migrations/10_update_SiringClockAuction.js +++ /dev/null @@ -1,19 +0,0 @@ -const Proxy = artifacts.require('OwnedUpgradeabilityProxy'); -const SiringClockAuction = artifacts.require('SiringClockAuctionV2'); - -const conf = { - siringClockAuctionProxy_address: '0x439f118c4ade15ad011f2b8d2350af70fa3046dc' -} - -module.exports = async(deployer, network) => { - - if(network == 'kovan') { - return; - } - - deployer.deploy(SiringClockAuction).then(async() => { - await Proxy.at(conf.siringClockAuctionProxy_address).upgradeTo(SiringClockAuction.address); - }) - - -} \ No newline at end of file diff --git a/migrations/11_update_apostleBaseAuthority.js b/migrations/11_update_apostleBaseAuthority.js deleted file mode 100644 index ca31df0..0000000 --- a/migrations/11_update_apostleBaseAuthority.js +++ /dev/null @@ -1,30 +0,0 @@ -const ApostleBaseV2 = artifacts.require("ApostleBaseV2"); -const ApostleBaseAuthorityV2 = artifacts.require("ApostleBaseAuthorityV2"); - - -const conf = { - registry_address: "0xd8b7a3f6076872c2c37fb4d5cbfeb5bf45826ed7", - kittyCore_address: "0x9782865f91f9aace5582f695bf678121a0359edd", - erc721BridgeProxy_address: "0x3af088062a6ab3b9706eb1c58506fc0fcf898588", - interstellarEncoderV3_address: "0x0700fa0c70ada58ad708e7bf93d032f1fd9a5150", - tokenUseProxy_address: "0xd2bcd143db59ddd43df2002fbf650e46b2b7ea19", - apostleBaseProxy_address: "0x23236af7d03c4b0720f709593f5ace0ea92e77cf", - gen0ApostleProxy_address: "0xd45fe6e402e3c21cd5b3273908121c90a30f5f71", - pet_objectClass: 3, - pet_max_number: 1 -} - -module.exports = async(deployer, network) => { - - if(network != 'kovan') { - return; - } - - deployer.deploy(ApostleBaseAuthorityV2, [conf.tokenUseProxy_address, conf.gen0ApostleProxy_address, conf.petBaseProxy_address]).then(async() => { - let apostleBase = await ApostleBaseV2.at(conf.apostleBaseProxy_address); - await apostleBase.setAuthority(ApostleBaseAuthorityV2.address); - }) - - -} - diff --git a/migrations/1_initial_migration.js b/migrations/1_initial_migration.js deleted file mode 100644 index 4d5f3f9..0000000 --- a/migrations/1_initial_migration.js +++ /dev/null @@ -1,5 +0,0 @@ -var Migrations = artifacts.require("./Migrations.sol"); - -module.exports = function(deployer) { - deployer.deploy(Migrations); -}; diff --git a/migrations/2_deploy_migration.js b/migrations/2_deploy_migration.js deleted file mode 100644 index 55dbbe6..0000000 --- a/migrations/2_deploy_migration.js +++ /dev/null @@ -1,131 +0,0 @@ -const Proxy = artifacts.require('OwnedUpgradeabilityProxy'); -const ApostleBase = artifacts.require('ApostleBase'); -const ApostleSettingIds = artifacts.require('ApostleSettingIds'); -const ApostleClockAuction = artifacts.require('ApostleClockAuction'); -const SiringClockAuction = artifacts.require('SiringClockAuction'); -const Gen0Apostle = artifacts.require('Gen0Apostle'); -const SettingsRegistry = artifacts.require('SettingsRegistry'); -const ObjectOwnershipAuthority = artifacts.require('ObjectOwnershipAuthority'); -const ObjectOwnership = artifacts.require('ObjectOwnership'); -const InterstellarEncoderV2 = artifacts.require('InterstellarEncoderV2'); -const ApostleBaseAuthority = artifacts.require('ApostleBaseAuthority'); -const ClockAuctionAuthority = artifacts.require('ClockAuctionAuthority'); - -const conf = { - registry_address: '0xd8b7a3f6076872c2c37fb4d5cbfeb5bf45826ed7', - objectOwnershipProxy_address: '0xe94b9ebf9609a0d20270e8de317381ff4bcdcd79', - landBaseProxy_address: '0x72eec3a6a9a8628e0f7a2dbbad5df083bd985c5f', - landObject_class: 1, - apostleObject_class: 2, - autoBirthFee: 500 * 10 ** 18, - resourceNeededPerLevel: 5 * 10 ** 18, - bidWaitingTime: 10 * 60, - gen0Limit: 2000 -} - -let apostleBaseProxy_address; -let clockAuctionProxy_address; -let gen0ApostleProxy_address; -let siringClockAuctionProxy_address; - -module.exports = async (deployer, network) => { - if (network == 'kovan') { - return; - } - - deployer.deploy(InterstellarEncoderV2); - deployer.deploy(ApostleSettingIds); - deployer.deploy(Proxy - ).then(async () => { - let apostleProxy = await Proxy.deployed(); - apostleBaseProxy_address = apostleProxy.address; - console.log('ApostleBaseProxy: ', apostleBaseProxy_address); - await deployer.deploy(ApostleBase); - await deployer.deploy(Proxy) - }).then(async () => { - let clockAuctionProxy = await Proxy.deployed(); - clockAuctionProxy_address = clockAuctionProxy.address; - console.log('ClockAuctionProxy: ', clockAuctionProxy_address); - await deployer.deploy(ApostleClockAuction); - await deployer.deploy(Proxy); - }).then(async () => { - let gen0ApostleProxy = await Proxy.deployed(); - gen0ApostleProxy_address = gen0ApostleProxy.address; - console.log('Gen0ApostleProxy: ', gen0ApostleProxy_address); - await deployer.deploy(Gen0Apostle); - await deployer.deploy(Proxy); - }).then(async () => { - let siringClockAuctionProxy = await Proxy.deployed(); - siringClockAuctionProxy_address = siringClockAuctionProxy.address; - console.log('SiringClockAuctionProxy: ', siringClockAuctionProxy_address); - await deployer.deploy(SiringClockAuction); - // deploy authorities - await deployer.deploy(ObjectOwnershipAuthority, [conf.landBaseProxy_address, apostleBaseProxy_address]); - await deployer.deploy(ClockAuctionAuthority, [gen0ApostleProxy_address]); - await deployer.deploy(ApostleBaseAuthority, [gen0ApostleProxy_address, siringClockAuctionProxy_address]); - }).then(async () => { - let registry = await SettingsRegistry.at(conf.registry_address); - let apostleSettingIds = await ApostleSettingIds.deployed(); - - // register in registry - let apostleBaseId = await apostleSettingIds.CONTRACT_APOSTLE_BASE.call(); - await registry.setAddressProperty(apostleBaseId, apostleBaseProxy_address); - - let clockAuctionId = await apostleSettingIds.CONTRACT_APOSTLE_AUCTION.call(); - await registry.setAddressProperty(clockAuctionId, clockAuctionProxy_address); - - let siringAuctionId = await apostleSettingIds.CONTRACT_SIRING_AUCTION.call(); - await registry.setAddressProperty(siringAuctionId, siringClockAuctionProxy_address); - - let birthFeeId = await apostleSettingIds.UINT_AUTOBIRTH_FEE.call(); - await registry.setUintProperty(birthFeeId, conf.autoBirthFee); - - let mixTalentId = await apostleSettingIds.UINT_MIX_TALENT.call(); - await registry.setUintProperty(mixTalentId, conf.resourceNeededPerLevel); - - let bidWaitingTimeId = await apostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME.call(); - await registry.setUintProperty(bidWaitingTimeId, conf.bidWaitingTime); - - let interstellarId = await apostleSettingIds.CONTRACT_INTERSTELLAR_ENCODER.call(); - await registry.setAddressProperty(interstellarId, InterstellarEncoderV2.address); - - console.log("REGISTER DONE!"); - - // upgrade - await Proxy.at(apostleBaseProxy_address).upgradeTo(ApostleBase.address); - await Proxy.at(clockAuctionProxy_address).upgradeTo(ApostleClockAuction.address); - await Proxy.at(gen0ApostleProxy_address).upgradeTo(Gen0Apostle.address); - await Proxy.at(siringClockAuctionProxy_address).upgradeTo(SiringClockAuction.address); - - console.log("UPGRADE DONE!"); - - // initialize - let apostleBaseProxy = await ApostleBase.at(apostleBaseProxy_address); - let clockAuctionProxy = await ApostleClockAuction.at(clockAuctionProxy_address); - let gen0ApostleProxy = await Gen0Apostle.at(gen0ApostleProxy_address); - let siringClockAuctionProxy = await SiringClockAuction.at(siringClockAuctionProxy_address); - - await apostleBaseProxy.initializeContract(registry.address); - await clockAuctionProxy.initializeContract(registry.address); - await gen0ApostleProxy.initializeContract(registry.address, conf.gen0Limit); - await siringClockAuctionProxy.initializeContract(registry.address); - - console.log("INITIALIZE DONE!"); - - // set authority - let objectOwnership = await ObjectOwnership.at(conf.objectOwnershipProxy_address); - await objectOwnership.setAuthority(ObjectOwnershipAuthority.address); - - await apostleBaseProxy.setAuthority(ApostleBaseAuthority.address); - await clockAuctionProxy.setAuthority(ClockAuctionAuthority.address); - - // register object contract address in interstellarEncoder - let interstellarEncoder = await InterstellarEncoderV2.deployed(); - await interstellarEncoder.registerNewTokenContract(conf.objectOwnershipProxy_address); - await interstellarEncoder.registerNewObjectClass(conf.landBaseProxy_address, conf.landObject_class); - await interstellarEncoder.registerNewObjectClass(apostleBaseProxy_address, conf.apostleObject_class); - - console.log('MIGRATION SUCCESS!'); - - }) -} \ No newline at end of file diff --git a/migrations/3_uprade_apostlebaseAuthority.js b/migrations/3_uprade_apostlebaseAuthority.js deleted file mode 100644 index 47349fb..0000000 --- a/migrations/3_uprade_apostlebaseAuthority.js +++ /dev/null @@ -1,24 +0,0 @@ -const ApostleBase = artifacts.require('ApostleBase'); -const ApostleBaseAuthority = artifacts.require('ApostleBaseAuthority'); - -const conf = { - apostleBaseProxy_address: '0x23236af7d03c4b0720f709593f5ace0ea92e77cf', - siringClockAuctionProxy_address: '0x439f118c4ade15ad011f2b8d2350af70fa3046dc', - gen0ApostleProxy_address: '0xd45fe6e402e3c21cd5b3273908121c90a30f5f71', - tokenUseProxy_address: '0xd2bcd143db59ddd43df2002fbf650e46b2b7ea19' -} - -module.exports = async (deployer, network) => { - - if(network == 'kovan') { - return; - } - - deployer.deploy(ApostleBaseAuthority, - [conf.siringClockAuctionProxy_address, - conf.gen0ApostleProxy_address, - conf.tokenUseProxy_address]) - .then(async() => { - await ApostleBase.at(conf.apostleBaseProxy_address).setAuthority(ApostleBaseAuthority.address); - }) -} \ No newline at end of file diff --git a/migrations/4_upgrade_apostlebase.js b/migrations/4_upgrade_apostlebase.js deleted file mode 100644 index 3dd076c..0000000 --- a/migrations/4_upgrade_apostlebase.js +++ /dev/null @@ -1,19 +0,0 @@ -const Proxy = artifacts.require('OwnedUpgradeabilityProxy'); -const ApostleBaseV2 = artifacts.require('ApostleBaseV2'); - -const conf = { - apostleBaseProxy_address: '0x23236af7d03c4b0720f709593f5ace0ea92e77cf' -} - -module.exports = async(deployer, network) => { - - if(network == 'kovan') { - return; - } - - deployer.deploy(ApostleBaseV2).then(async() => { - await Proxy.at(conf.apostleBaseProxy_address).upgradeTo(ApostleBaseV2.address); - }) - - -} \ No newline at end of file diff --git a/migrations/5_upgrade_apostleClockAuction.js b/migrations/5_upgrade_apostleClockAuction.js deleted file mode 100644 index d36b043..0000000 --- a/migrations/5_upgrade_apostleClockAuction.js +++ /dev/null @@ -1,19 +0,0 @@ -const Proxy = artifacts.require('OwnedUpgradeabilityProxy'); -const ApostleClockAuction = artifacts.require('ApostleClockAuction'); - -const conf = { - apostleClockAuctionProxy_address: '0x2fdd8e8da34a8242c04b3d8d6afcb2a6c3afd483' -} - -module.exports = async(deployer, network) => { - - if(network == 'kovan') { - return; - } - - deployer.deploy(ApostleClockAuction).then(async() => { - await Proxy.at(conf.apostleClockAuctionProxy_address).upgradeTo(ApostleClockAuction.address); - }) - - -} \ No newline at end of file diff --git a/migrations/6_updateSiringClockAuction.js b/migrations/6_updateSiringClockAuction.js deleted file mode 100644 index 1bc991a..0000000 --- a/migrations/6_updateSiringClockAuction.js +++ /dev/null @@ -1,19 +0,0 @@ -const Proxy = artifacts.require('OwnedUpgradeabilityProxy'); -const SiringClockAuction = artifacts.require('SiringClockAuction'); - -const conf = { - siringClockAuctionProxy_address: '0x439f118c4ade15ad011f2b8d2350af70fa3046dc' -} - -module.exports = async(deployer, network) => { - - if(network == 'kovan') { - return; - } - - deployer.deploy(SiringClockAuction).then(async() => { - await Proxy.at(conf.siringClockAuctionProxy_address).upgradeTo(SiringClockAuction.address); - }) - - -} \ No newline at end of file diff --git a/migrations/7_update_gen0Apostle.js b/migrations/7_update_gen0Apostle.js deleted file mode 100644 index 15ef239..0000000 --- a/migrations/7_update_gen0Apostle.js +++ /dev/null @@ -1,19 +0,0 @@ -const Proxy = artifacts.require('OwnedUpgradeabilityProxy'); -const Gen0ApostleV2 = artifacts.require('Gen0ApostleV2'); - -const conf = { - gen0ApostleProxy_address: '0xd45fe6e402e3c21cd5b3273908121c90a30f5f71' -} - -module.exports = async(deployer, network) => { - - if(network == 'kovan') { - return; - } - - deployer.deploy(Gen0ApostleV2).then(async() => { - await Proxy.at(conf.gen0ApostleProxy_address).upgradeTo(Gen0ApostleV2.address); - }) - - -} \ No newline at end of file diff --git a/migrations/8_petBase_migration.js b/migrations/8_petBase_migration.js deleted file mode 100644 index 1812b7a..0000000 --- a/migrations/8_petBase_migration.js +++ /dev/null @@ -1,77 +0,0 @@ -const PetBase = artifacts.require("PetBase"); -const Proxy = artifacts.require("OwnedUpgradeabilityProxy"); -const SettingsRegistry = artifacts.require("SettingsRegistry"); -const InterstellarEncoderV3 = artifacts.require('InterstellarEncoderV3'); -const ERC721Bridge = artifacts.require("ERC721Bridge"); -const ERC721BridgeAuthority = artifacts.require("ERC721BridgeAuthority"); -const ApostleBaseV2 = artifacts.require("ApostleBaseV2"); -const ApostleBaseAuthorityV2 = artifacts.require("ApostleBaseAuthorityV2"); - -const conf = { - registry_address: "0xd8b7a3f6076872c2c37fb4d5cbfeb5bf45826ed7", - kittyCore_address: "0x9782865f91f9aace5582f695bf678121a0359edd", - erc721BridgeProxy_address: "0x3af088062a6ab3b9706eb1c58506fc0fcf898588", - interstellarEncoderV3_address: "0x0700fa0c70ada58ad708e7bf93d032f1fd9a5150", - tokenUseProxy_address: "0xd2bcd143db59ddd43df2002fbf650e46b2b7ea19", - apostleBaseProxy_address: "0x23236af7d03c4b0720f709593f5ace0ea92e77cf", - pet_objectClass: 3, - pet_max_number: 1 -} - -var petBaseProxy_address; - -module.exports = async (deployer, network) => { - - if (network == "kovan") { - return; - } - - deployer.deploy(Proxy).then(async() => { - let petBaseProxy = await Proxy.deployed(); - petBaseProxy_address = petBaseProxy.address; - console.log("PetBaseProxy: ", petBaseProxy_address); - await deployer.deploy(PetBase); - await deployer.deploy(ApostleBaseV2); - }).then(async() => { - await deployer.deploy(ApostleBaseAuthorityV2, [conf.tokenUseProxy_address, petBaseProxy_address]); - await deployer.deploy(ERC721BridgeAuthority, [petBaseProxy_address]); - }).then(async() => { - // register - let registry = await SettingsRegistry.at(conf.registry_address); - let petBaseLogic = await PetBase.deployed(); - let petBaseId = await petBaseLogic.CONTRACT_PET_BASE.call(); - await registry.setAddressProperty(petBaseId, petBaseProxy_address); - console.log("REGISTER IN REGISTRY DONE!"); - - // upgrade - let proxy = await Proxy.at(petBaseProxy_address); - await proxy.upgradeTo(PetBase.address); - await Proxy.at(conf.apostleBaseProxy_address).upgradeTo(ApostleBaseV2.address); - console.log("UPGRADE DONE!"); - - - // initialize - let petBaseProxy = await PetBase.at(petBaseProxy_address); - await petBaseProxy.initializeContract(conf.registry_address, conf.pet_max_number); - console.log("INITIALIZATION DONE!"); - - // setAuthority - let bridge = await ERC721Bridge.at(conf.erc721BridgeProxy_address); - await bridge.setAuthority(ERC721BridgeAuthority.address); - - let apostleBase = await ApostleBaseV2.at(conf.apostleBaseProxy_address); - await apostleBase.setAuthority(ApostleBaseAuthorityV2.address); - console.log("AUTHORITY DONE!"); - - - // register token address - let interstellarEncoderV3 = await InterstellarEncoderV3.at(conf.interstellarEncoderV3_address); - await interstellarEncoderV3.registerNewObjectClass(petBaseProxy_address, conf.pet_objectClass); - - console.log("ENCODER REGISTER DONE!"); - - - console.log("SUCCESS!"); - }) - -} \ No newline at end of file diff --git a/migrations/9_update_petBase.js b/migrations/9_update_petBase.js deleted file mode 100644 index dc55b99..0000000 --- a/migrations/9_update_petBase.js +++ /dev/null @@ -1,19 +0,0 @@ -const Proxy = artifacts.require('OwnedUpgradeabilityProxy'); -const PetBase = artifacts.require('PetBase'); - -const conf = { - petBaseProxy_address: '0x9038cf766688c8e9b19552f464b514f9760fdc49' -} - -module.exports = async(deployer, network) => { - - if(network == 'kovan') { - return; - } - - deployer.deploy(PetBase).then(async() => { - await Proxy.at(conf.petBaseProxy_address).upgradeTo(PetBase.address); - }) - - -} \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index 5722097..0000000 --- a/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "@evolutionland/apostle", - "version": "1.2.2", - "description": "Apostle contracts for Evolution Land", - "main": "truffle-config.js", - "directories": { - "test": "test" - }, - "scripts": { - "build": "npx waffle", - "flatten": "npx waffle flatten" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/evolutionlandorg/apostle.git" - }, - "keywords": [ - "smart-contracts" - ], - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/evolutionlandorg/apostle/issues" - }, - "homepage": "https://github.com/evolutionlandorg/apostle#readme", - "dependencies": { - "@evolutionland/common": "^1.7.9", - "@evolutionland/upgraeability-using-unstructured-storage": "^0.1.1", - "openzeppelin-solidity": "^1.12.0" - }, - "devDependencies": { - "ethereum-waffle": "^3.2.1" - } -} From c2efe84e5b1d18dff5e61397c0ea0e809e204071 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 13:06:31 +0800 Subject: [PATCH 20/64] fix warning --- contracts/ApostleBase.sol | 8 ++++---- contracts/ApostleBaseAuthority.sol | 4 ++-- contracts/ApostleBaseAuthorityV2.sol | 4 ++-- contracts/ApostleBaseV2.sol | 8 ++++---- contracts/ApostleClockAuction.sol | 5 +++-- contracts/ClockAuctionAuthority.sol | 4 ++-- contracts/Gen0Apostle.sol | 5 +++-- contracts/Gen0ApostleV2.sol | 5 +++-- contracts/HarbergerPotionShop.sol | 2 +- contracts/SiringClockAuction.sol | 3 ++- contracts/SiringClockAuctionV2.sol | 3 ++- contracts/pet/ERC721BridgeAuthority.sol | 4 ++-- contracts/pet/PetBaseAuthority.sol | 4 ++-- 13 files changed, 32 insertions(+), 27 deletions(-) diff --git a/contracts/ApostleBase.sol b/contracts/ApostleBase.sol index 76743e7..3014bde 100644 --- a/contracts/ApostleBase.sol +++ b/contracts/ApostleBase.sol @@ -422,7 +422,7 @@ contract ApostleBase is SupportsInterfaceWithLookup, IActivity, IActivityObject, return true; } - function tokenFallback(address _from, uint256 _value, bytes _data) public { + function tokenFallback(address _from, uint256 _value, bytes /*_data*/) public { uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); uint matronId; @@ -502,7 +502,7 @@ contract ApostleBase is SupportsInterfaceWithLookup, IActivity, IActivityObject, } /// IActivityObject - function activityAdded(uint256 _tokenId, address _activity, address _user) auth public { + function activityAdded(uint256 _tokenId, address /*_activity*/, address /*_user*/) auth public { // to active the apostle when it do activity the first time if (tokenId2Apostle[_tokenId].activeTime == 0) { tokenId2Apostle[_tokenId].activeTime = uint48(now); @@ -512,12 +512,12 @@ contract ApostleBase is SupportsInterfaceWithLookup, IActivity, IActivityObject, } - function activityRemoved(uint256 _tokenId, address _activity, address _user) auth public { + function activityRemoved(uint256 /*_tokenId*/, address /*_activity*/, address /*_user*/) auth public { // do nothing. } /// IActivity - function activityStopped(uint256 _tokenId) auth public { + function activityStopped(uint256 /*_tokenId*/) auth public { // do nothing. } diff --git a/contracts/ApostleBaseAuthority.sol b/contracts/ApostleBaseAuthority.sol index 0195b1f..1c0d03b 100644 --- a/contracts/ApostleBaseAuthority.sol +++ b/contracts/ApostleBaseAuthority.sol @@ -10,7 +10,7 @@ contract ApostleBaseAuthority { } function canCall( - address _src, address _dst, bytes4 _sig + address _src, address /*_dst*/, bytes4 _sig ) public view returns (bool) { return ( whiteList[_src] && _sig == bytes4(keccak256("createApostle(uint256,uint256,uint256,uint256,uint256,address)")) ) || ( whiteList[_src] && _sig == bytes4(keccak256("breedWithInAuction(uint256,uint256)")) ) || @@ -18,4 +18,4 @@ contract ApostleBaseAuthority { ( whiteList[_src] && _sig == bytes4(keccak256("activityRemoved(uint256,address,address)"))) || ( whiteList[_src] && _sig == bytes4(keccak256("activityStopped(uint256)"))); } -} \ No newline at end of file +} diff --git a/contracts/ApostleBaseAuthorityV2.sol b/contracts/ApostleBaseAuthorityV2.sol index 0cc008c..7650b7c 100644 --- a/contracts/ApostleBaseAuthorityV2.sol +++ b/contracts/ApostleBaseAuthorityV2.sol @@ -10,7 +10,7 @@ contract ApostleBaseAuthorityV2 { } function canCall( - address _src, address _dst, bytes4 _sig + address _src, address /*_dst*/, bytes4 _sig ) public view returns (bool) { return ( whiteList[_src] && _sig == bytes4(keccak256("createApostle(uint256,uint256,uint256,uint256,uint256,address)")) ) || ( whiteList[_src] && _sig == bytes4(keccak256("breedWithInAuction(uint256,uint256)")) ) || @@ -20,4 +20,4 @@ contract ApostleBaseAuthorityV2 { ( whiteList[_src] && _sig == bytes4(keccak256("batchUpdate(uint256[],uint256[],uint256[])"))) || ( whiteList[_src] && _sig == bytes4(keccak256("activityStopped(uint256)"))); } -} \ No newline at end of file +} diff --git a/contracts/ApostleBaseV2.sol b/contracts/ApostleBaseV2.sol index ad44c72..3d7a073 100644 --- a/contracts/ApostleBaseV2.sol +++ b/contracts/ApostleBaseV2.sol @@ -422,7 +422,7 @@ contract ApostleBaseV2 is SupportsInterfaceWithLookup, IActivity, IActivityObjec return true; } - function tokenFallback(address _from, uint256 _value, bytes _data) public { + function tokenFallback(address _from, uint256 _value, bytes /*_data*/) public { uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); uint matronId; @@ -502,7 +502,7 @@ contract ApostleBaseV2 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } /// IActivityObject - function activityAdded(uint256 _tokenId, address _activity, address _user) auth public { + function activityAdded(uint256 _tokenId, address /*_activity*/, address /*_user*/) auth public { // to active the apostle when it do activity the first time if (tokenId2Apostle[_tokenId].activeTime == 0) { tokenId2Apostle[_tokenId].activeTime = uint48(now); @@ -512,12 +512,12 @@ contract ApostleBaseV2 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } - function activityRemoved(uint256 _tokenId, address _activity, address _user) auth public { + function activityRemoved(uint256 /*_tokenId*/, address /*_activity*/, address /*_user*/) auth public { // do nothing. } /// IActivity - function activityStopped(uint256 _tokenId) auth public { + function activityStopped(uint256 /*_tokenId*/) auth public { // do nothing. } diff --git a/contracts/ApostleClockAuction.sol b/contracts/ApostleClockAuction.sol index 4d780dd..971654e 100644 --- a/contracts/ApostleClockAuction.sol +++ b/contracts/ApostleClockAuction.sol @@ -215,7 +215,7 @@ contract ApostleClockAuction is PausableDSAuth, ApostleSettingIds { // to invoke this function // @param _data - need to be generated from (tokenId + referer) - function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { + function tokenFallback(address _from, uint256 _valueInToken, bytes /*_data*/) public whenNotPaused { uint tokenId; address referer; assembly { @@ -446,10 +446,11 @@ contract ApostleClockAuction is PausableDSAuth, ApostleSettingIds { function onERC721Received( address, //_operator, address, //_from, - uint256 _tokenId, + uint256, //_tokenId, bytes //_data ) public + pure returns (bytes4) { // owner can put apostle on market // after coolDownEndTime diff --git a/contracts/ClockAuctionAuthority.sol b/contracts/ClockAuctionAuthority.sol index 17c8396..6e65685 100644 --- a/contracts/ClockAuctionAuthority.sol +++ b/contracts/ClockAuctionAuthority.sol @@ -11,9 +11,9 @@ contract ClockAuctionAuthority { } function canCall( - address _src, address _dst, bytes4 _sig + address _src, address /*_dst*/, bytes4 _sig ) public view returns (bool) { return ( whiteList[_src] && _sig == bytes4(keccak256("createAuction(uint256,uint256,uint256,uint256,uint256,address)")) ); } -} \ No newline at end of file +} diff --git a/contracts/Gen0Apostle.sol b/contracts/Gen0Apostle.sol index a20cd2b..6a86f1f 100644 --- a/contracts/Gen0Apostle.sol +++ b/contracts/Gen0Apostle.sol @@ -77,7 +77,7 @@ contract Gen0Apostle is PausableDSAuth, ApostleSettingIds { operator = _operator; } - function tokenFallback(address _from, uint256 _value, bytes _data) public { + function tokenFallback(address /*_from*/, uint256 _value, bytes _data) public { address ring = registry.addressOf(CONTRACT_RING_ERC20_TOKEN); address kton = registry.addressOf(CONTRACT_KTON_ERC20_TOKEN); address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); @@ -95,6 +95,7 @@ contract Gen0Apostle is PausableDSAuth, ApostleSettingIds { bytes //_data ) public + pure returns (bytes4) { return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); } @@ -121,4 +122,4 @@ contract Gen0Apostle is PausableDSAuth, ApostleSettingIds { emit ClaimedERC721Token(owner, _tokenId); } -} \ No newline at end of file +} diff --git a/contracts/Gen0ApostleV2.sol b/contracts/Gen0ApostleV2.sol index 65d3b50..8a93e63 100644 --- a/contracts/Gen0ApostleV2.sol +++ b/contracts/Gen0ApostleV2.sol @@ -78,7 +78,7 @@ contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { operator = _operator; } - function tokenFallback(address _from, uint256 _value, bytes _data) public { + function tokenFallback(address /*_from*/, uint256 _value, bytes _data) public { address ring = registry.addressOf(CONTRACT_RING_ERC20_TOKEN); address kton = registry.addressOf(CONTRACT_KTON_ERC20_TOKEN); address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); @@ -96,6 +96,7 @@ contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { bytes //_data ) public + pure returns (bytes4) { return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); } @@ -127,4 +128,4 @@ contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { nft.setApprovalForAll(_operator, _isApproved); } -} \ No newline at end of file +} diff --git a/contracts/HarbergerPotionShop.sol b/contracts/HarbergerPotionShop.sol index 3ad2fb3..0c5ccd3 100644 --- a/contracts/HarbergerPotionShop.sol +++ b/contracts/HarbergerPotionShop.sol @@ -93,7 +93,7 @@ contract HarbergerPotionShop is DSAuth, ApostleSettingIds { }); } - function tryKillApostle(uint256 _tokenId, address _killer) public auth { + function tryKillApostle(uint256 _tokenId, address /*_killer*/) public auth { if (tokenId2PotionState[_tokenId].lastUpdateTime == 0) { // didn't start hargberg or already exited. return; diff --git a/contracts/SiringClockAuction.sol b/contracts/SiringClockAuction.sol index f4020a8..698bfdb 100644 --- a/contracts/SiringClockAuction.sol +++ b/contracts/SiringClockAuction.sol @@ -122,7 +122,7 @@ contract SiringClockAuction is SiringAuctionBase { } - function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { + function tokenFallback(address _from, uint256 _valueInToken, bytes /*_data*/) public whenNotPaused { uint sireId; uint matronId; assembly { @@ -193,6 +193,7 @@ contract SiringClockAuction is SiringAuctionBase { bytes //_data ) public + pure returns (bytes4) { return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); diff --git a/contracts/SiringClockAuctionV2.sol b/contracts/SiringClockAuctionV2.sol index 0bd416c..0e3106d 100644 --- a/contracts/SiringClockAuctionV2.sol +++ b/contracts/SiringClockAuctionV2.sol @@ -122,7 +122,7 @@ contract SiringClockAuctionV2 is SiringAuctionBase { } - function tokenFallback(address _from, uint256 _valueInToken, bytes _data) public whenNotPaused { + function tokenFallback(address _from, uint256 _valueInToken, bytes /*_data*/) public whenNotPaused { uint sireId; uint matronId; assembly { @@ -197,6 +197,7 @@ contract SiringClockAuctionV2 is SiringAuctionBase { bytes //_data ) public + pure returns (bytes4) { return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); diff --git a/contracts/pet/ERC721BridgeAuthority.sol b/contracts/pet/ERC721BridgeAuthority.sol index b180018..9afca54 100644 --- a/contracts/pet/ERC721BridgeAuthority.sol +++ b/contracts/pet/ERC721BridgeAuthority.sol @@ -11,8 +11,8 @@ contract ERC721BridgeAuthority { } function canCall( - address _src, address _dst, bytes4 _sig + address _src, address /*_dst*/, bytes4 _sig ) public view returns (bool) { return ( whiteList[_src] && _sig == bytes4(keccak256("bridgeInAuth(address,uint256,address)")) ); } -} \ No newline at end of file +} diff --git a/contracts/pet/PetBaseAuthority.sol b/contracts/pet/PetBaseAuthority.sol index cc456a4..846a469 100644 --- a/contracts/pet/PetBaseAuthority.sol +++ b/contracts/pet/PetBaseAuthority.sol @@ -10,8 +10,8 @@ contract PetBaseAuthority { } function canCall( - address _src, address _dst, bytes4 _sig + address _src, address /*_dst*/, bytes4 _sig ) public view returns (bool) { return ( whiteList[_src] && _sig == bytes4(keccak256("createPet(address)")) ); } -} \ No newline at end of file +} From 76a1c66ef57d760f46c514d065bc28866630c4ae Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 13:54:01 +0800 Subject: [PATCH 21/64] dapp upgrade zeppelin-solidity --- lib/zeppelin-solidity | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zeppelin-solidity b/lib/zeppelin-solidity index 0e65947..3ba2a13 160000 --- a/lib/zeppelin-solidity +++ b/lib/zeppelin-solidity @@ -1 +1 @@ -Subproject commit 0e65947efbffc592cffea8c2ae9d3b8e11659854 +Subproject commit 3ba2a1354f8f830d5a0e711537efdbdd8bcb109e From 4928f521d0f280f0e651ddb43d544e366bc470a4 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 13:56:05 +0800 Subject: [PATCH 22/64] zeppelin-solidity v1.12.0 --- lib/zeppelin-solidity | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zeppelin-solidity b/lib/zeppelin-solidity index 3ba2a13..0e65947 160000 --- a/lib/zeppelin-solidity +++ b/lib/zeppelin-solidity @@ -1 +1 @@ -Subproject commit 3ba2a1354f8f830d5a0e711537efdbdd8bcb109e +Subproject commit 0e65947efbffc592cffea8c2ae9d3b8e11659854 From be04bdac6c0cd4f24e70973ddc93f5b4262e12f0 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 14:46:46 +0800 Subject: [PATCH 23/64] upgrade authority --- contracts/ApostleBaseAuthorityV3.sol | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 contracts/ApostleBaseAuthorityV3.sol diff --git a/contracts/ApostleBaseAuthorityV3.sol b/contracts/ApostleBaseAuthorityV3.sol new file mode 100644 index 0000000..99a596f --- /dev/null +++ b/contracts/ApostleBaseAuthorityV3.sol @@ -0,0 +1,35 @@ +pragma solidity ^0.4.24; + +contract ApostleBaseAuthorityV3 { + address public root; + modifier sudo { require(msg.sender == root); _; } + event LogSetRoot(address indexed newRoot); + function setRoot(address usr) public sudo { + root = usr; + emit LogSetRoot(usr); + } + + mapping (address => bool) public wards; + event LogRely(address indexed usr); + function rely(address usr) public sudo { wards[usr] = true; emit LogRely(usr); } + event LogDeny(address indexed usr); + function deny(address usr) public sudo { wards[usr] = false; emit LogDeny(usr); } + + constructor(address[] _wards) public { + root = msg.sender; + emit LogSetRoot(root); + for (uint i = 0; i < _wards.length; i ++) { rely(_wards[i]); } + } + + function canCall( + address _src, address /*_dst*/, bytes4 _sig + ) public view returns (bool) { + return ( wards[_src] && _sig == bytes4(keccak256("createApostle(uint256,uint256,uint256,uint256,uint256,address)")) ) || + ( wards[_src] && _sig == bytes4(keccak256("breedWithInAuction(uint256,uint256)")) ) || + ( wards[_src] && _sig == bytes4(keccak256("activityAdded(uint256,address,address)"))) || + ( wards[_src] && _sig == bytes4(keccak256("activityRemoved(uint256,address,address)"))) || + ( wards[_src] && _sig == bytes4(keccak256("updateGenesAndTalents(uint256,uint256,uint256)"))) || + ( wards[_src] && _sig == bytes4(keccak256("batchUpdate(uint256[],uint256[],uint256[])"))) || + ( wards[_src] && _sig == bytes4(keccak256("activityStopped(uint256)"))); + } +} From b2efc199c4f60e51d4d98970bd4f31ef5c6201f4 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 15:40:24 +0800 Subject: [PATCH 24/64] upgrade authority --- contracts/ApostleBaseAuthorityV3.sol | 35 ---------------------------- contracts/Authority.sol | 32 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 35 deletions(-) delete mode 100644 contracts/ApostleBaseAuthorityV3.sol create mode 100644 contracts/Authority.sol diff --git a/contracts/ApostleBaseAuthorityV3.sol b/contracts/ApostleBaseAuthorityV3.sol deleted file mode 100644 index 99a596f..0000000 --- a/contracts/ApostleBaseAuthorityV3.sol +++ /dev/null @@ -1,35 +0,0 @@ -pragma solidity ^0.4.24; - -contract ApostleBaseAuthorityV3 { - address public root; - modifier sudo { require(msg.sender == root); _; } - event LogSetRoot(address indexed newRoot); - function setRoot(address usr) public sudo { - root = usr; - emit LogSetRoot(usr); - } - - mapping (address => bool) public wards; - event LogRely(address indexed usr); - function rely(address usr) public sudo { wards[usr] = true; emit LogRely(usr); } - event LogDeny(address indexed usr); - function deny(address usr) public sudo { wards[usr] = false; emit LogDeny(usr); } - - constructor(address[] _wards) public { - root = msg.sender; - emit LogSetRoot(root); - for (uint i = 0; i < _wards.length; i ++) { rely(_wards[i]); } - } - - function canCall( - address _src, address /*_dst*/, bytes4 _sig - ) public view returns (bool) { - return ( wards[_src] && _sig == bytes4(keccak256("createApostle(uint256,uint256,uint256,uint256,uint256,address)")) ) || - ( wards[_src] && _sig == bytes4(keccak256("breedWithInAuction(uint256,uint256)")) ) || - ( wards[_src] && _sig == bytes4(keccak256("activityAdded(uint256,address,address)"))) || - ( wards[_src] && _sig == bytes4(keccak256("activityRemoved(uint256,address,address)"))) || - ( wards[_src] && _sig == bytes4(keccak256("updateGenesAndTalents(uint256,uint256,uint256)"))) || - ( wards[_src] && _sig == bytes4(keccak256("batchUpdate(uint256[],uint256[],uint256[])"))) || - ( wards[_src] && _sig == bytes4(keccak256("activityStopped(uint256)"))); - } -} diff --git a/contracts/Authority.sol b/contracts/Authority.sol new file mode 100644 index 0000000..b68d92a --- /dev/null +++ b/contracts/Authority.sol @@ -0,0 +1,32 @@ +pragma solidity ^0.4.24; + +contract Authority { + event Rely(address indexed usr); + event Deny(address indexed usr); + event Allow(bytes4 indexed usr); + event Forbid(bytes4 indexed usr); + event SetRoot(address indexed newRoot); + + address public root; + mapping (address => uint) public wards; + mapping (bytes4 => uint) public sigs; + modifier sudo { require(msg.sender == root); _; } + function setRoot(address usr) external sudo { root = usr; emit SetRoot(usr); } + function rely(address usr) external sudo { wards[usr] = 1; emit Rely(usr); } + function deny(address usr) external sudo { wards[usr] = 0; emit Deny(usr); } + function allow(bytes4 sig) external sudo { sigs[sig] = 1; emit Allow(sig); } + function forbid(bytes4 sig) external sudo { sigs[sig] = 1; emit Forbid(sig); } + + constructor(address[] _wards, bytes4[] _sigs) public { + root = msg.sender; + emit SetRoot(root); + for (uint i = 0; i < _wards.length; i ++) { rely(_wards[i]); } + for (uint i = 0; i < _sigs.length; i++) { allow(_sigs[i]); } + } + + function canCall( + address _src, address, bytes4 _sig + ) public view returns (bool) { + return ( wards[_src] == 1 && sigs[_sig] == 1) + } +} From 73cd22ad911f852c935d4ec9bd8fdf239e8fc103 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 15:42:53 +0800 Subject: [PATCH 25/64] upgrade authority --- contracts/Authority.sol | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts/Authority.sol b/contracts/Authority.sol index b68d92a..f386dd4 100644 --- a/contracts/Authority.sol +++ b/contracts/Authority.sol @@ -11,22 +11,22 @@ contract Authority { mapping (address => uint) public wards; mapping (bytes4 => uint) public sigs; modifier sudo { require(msg.sender == root); _; } - function setRoot(address usr) external sudo { root = usr; emit SetRoot(usr); } - function rely(address usr) external sudo { wards[usr] = 1; emit Rely(usr); } - function deny(address usr) external sudo { wards[usr] = 0; emit Deny(usr); } - function allow(bytes4 sig) external sudo { sigs[sig] = 1; emit Allow(sig); } - function forbid(bytes4 sig) external sudo { sigs[sig] = 1; emit Forbid(sig); } + function setRoot(address usr) public sudo { root = usr; emit SetRoot(usr); } + function rely(address usr) public sudo { wards[usr] = 1; emit Rely(usr); } + function deny(address usr) public sudo { wards[usr] = 0; emit Deny(usr); } + function allow(bytes4 sig) public sudo { sigs[sig] = 1; emit Allow(sig); } + function forbid(bytes4 sig) public sudo { sigs[sig] = 1; emit Forbid(sig); } constructor(address[] _wards, bytes4[] _sigs) public { root = msg.sender; emit SetRoot(root); - for (uint i = 0; i < _wards.length; i ++) { rely(_wards[i]); } - for (uint i = 0; i < _sigs.length; i++) { allow(_sigs[i]); } + for (uint i = 0; i < _wards.length; i++) { rely(_wards[i]); } + for (uint j = 0; j < _sigs.length; j++) { allow(_sigs[j]); } } function canCall( address _src, address, bytes4 _sig ) public view returns (bool) { - return ( wards[_src] == 1 && sigs[_sig] == 1) + return wards[_src] == 1 && sigs[_sig] == 1; } } From 0b40c554a2bdca42c302e0af853de6a1d2f6f14b Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 15:43:52 +0800 Subject: [PATCH 26/64] upgrade authority --- contracts/Authority.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/Authority.sol b/contracts/Authority.sol index f386dd4..95eabbd 100644 --- a/contracts/Authority.sol +++ b/contracts/Authority.sol @@ -10,7 +10,8 @@ contract Authority { address public root; mapping (address => uint) public wards; mapping (bytes4 => uint) public sigs; - modifier sudo { require(msg.sender == root); _; } + + modifier sudo { require(msg.sender == root); _; } function setRoot(address usr) public sudo { root = usr; emit SetRoot(usr); } function rely(address usr) public sudo { wards[usr] = 1; emit Rely(usr); } function deny(address usr) public sudo { wards[usr] = 0; emit Deny(usr); } From b53aca7f80caf28508f0fe488d6404a464c15f1a Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 15:45:24 +0800 Subject: [PATCH 27/64] upgrade authority --- contracts/Authority.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/Authority.sol b/contracts/Authority.sol index 95eabbd..866c4af 100644 --- a/contracts/Authority.sol +++ b/contracts/Authority.sol @@ -16,7 +16,7 @@ contract Authority { function rely(address usr) public sudo { wards[usr] = 1; emit Rely(usr); } function deny(address usr) public sudo { wards[usr] = 0; emit Deny(usr); } function allow(bytes4 sig) public sudo { sigs[sig] = 1; emit Allow(sig); } - function forbid(bytes4 sig) public sudo { sigs[sig] = 1; emit Forbid(sig); } + function forbid(bytes4 sig) public sudo { sigs[sig] = 0; emit Forbid(sig); } constructor(address[] _wards, bytes4[] _sigs) public { root = msg.sender; From c17597f64df06dbe19845f4c1a516b62b4fb88e0 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 29 Apr 2021 15:54:05 +0800 Subject: [PATCH 28/64] rm authority --- contracts/Authority.sol | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 contracts/Authority.sol diff --git a/contracts/Authority.sol b/contracts/Authority.sol deleted file mode 100644 index 866c4af..0000000 --- a/contracts/Authority.sol +++ /dev/null @@ -1,33 +0,0 @@ -pragma solidity ^0.4.24; - -contract Authority { - event Rely(address indexed usr); - event Deny(address indexed usr); - event Allow(bytes4 indexed usr); - event Forbid(bytes4 indexed usr); - event SetRoot(address indexed newRoot); - - address public root; - mapping (address => uint) public wards; - mapping (bytes4 => uint) public sigs; - - modifier sudo { require(msg.sender == root); _; } - function setRoot(address usr) public sudo { root = usr; emit SetRoot(usr); } - function rely(address usr) public sudo { wards[usr] = 1; emit Rely(usr); } - function deny(address usr) public sudo { wards[usr] = 0; emit Deny(usr); } - function allow(bytes4 sig) public sudo { sigs[sig] = 1; emit Allow(sig); } - function forbid(bytes4 sig) public sudo { sigs[sig] = 0; emit Forbid(sig); } - - constructor(address[] _wards, bytes4[] _sigs) public { - root = msg.sender; - emit SetRoot(root); - for (uint i = 0; i < _wards.length; i++) { rely(_wards[i]); } - for (uint j = 0; j < _sigs.length; j++) { allow(_sigs[j]); } - } - - function canCall( - address _src, address, bytes4 _sig - ) public view returns (bool) { - return wards[_src] == 1 && sigs[_sig] == 1; - } -} From cc8304d3801b07c53a3ad617d96a16022cf481f3 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 27 May 2021 11:25:20 +0800 Subject: [PATCH 29/64] rm erc223 support --- contracts/ApostleBaseV3.sol | 539 +++++++++++++++++++++++++ contracts/ApostleClockAuctionV2.sol | 553 ++++++++++++++++++++++++++ contracts/ApostleSettingIds.sol | 3 + contracts/Gen0ApostleV2.sol | 12 - contracts/SiringClockAuctionV2.sol | 40 +- contracts/interfaces/IRevenuePool.sol | 6 + 6 files changed, 1112 insertions(+), 41 deletions(-) create mode 100644 contracts/ApostleBaseV3.sol create mode 100644 contracts/ApostleClockAuctionV2.sol create mode 100644 contracts/interfaces/IRevenuePool.sol diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol new file mode 100644 index 0000000..6016045 --- /dev/null +++ b/contracts/ApostleBaseV3.sol @@ -0,0 +1,539 @@ +pragma solidity ^0.4.24; + +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; +import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivity.sol"; +import "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; +import "./ApostleSettingIds.sol"; +import "./interfaces/IGeneScience.sol"; +import "./interfaces/IHabergPotionShop.sol"; +import "./interfaces/ILandBase.sol"; +import "./interfaces/IRevenuePool.sol"; + +// all Ids in this contracts refer to index which is using 128-bit unsigned integers. +// this is CONTRACT_APOSTLE_BASE +contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { + + event Birth( + address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime + ); + event Pregnant( + uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex + ); + + /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() + /// function. This is used to notify the auto-birth daemon that this breeding action + /// included a pre-payment of the gas required to call the giveBirth() function. + event AutoBirth(uint256 matronId, uint256 cooldownEndTime); + + event Unbox(uint256 tokenId, uint256 activeTime); + + struct Apostle { + // An apostles genes never change. + uint256 genes; + + uint256 talents; + + // the ID of the parents of this Apostle. set to 0 for gen0 apostle. + // Note that using 128-bit unsigned integers to represent parents IDs, + // which refer to lastApostleObjectId for those two. + uint256 matronId; + uint256 sireId; + + // Set to the ID of the sire apostle for matrons that are pregnant, + // zero otherwise. A non-zero value here is how we know an apostle + // is pregnant. Used to retrieve the genetic material for the new + // apostle when the birth transpires. + uint256 siringWithId; + // Set to the index in the cooldown array (see below) that represents + // the current cooldown duration for this apostle. + uint16 cooldownIndex; + // The "generation number" of this apostle. + uint16 generation; + + uint48 birthTime; + uint48 activeTime; + uint48 deadTime; + uint48 cooldownEndTime; + } + + uint32[14] public cooldowns = [ + uint32(1 minutes), + uint32(2 minutes), + uint32(5 minutes), + uint32(10 minutes), + uint32(30 minutes), + uint32(1 hours), + uint32(2 hours), + uint32(4 hours), + uint32(8 hours), + uint32(16 hours), + uint32(1 days), + uint32(2 days), + uint32(4 days), + uint32(7 days) + ]; + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + + /*** STORAGE ***/ + bool private singletonLock = false; + + uint128 public lastApostleObjectId; + + ISettingsRegistry public registry; + + mapping(uint256 => Apostle) public tokenId2Apostle; + + mapping(uint256 => address) public sireAllowedToAddress; + + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + + _registerInterface(InterfaceId_IActivity); + _registerInterface(InterfaceId_IActivityObject); + _registerInterface(InterfaceId_IMinerObject); + _updateCoolDown(); + + } + + // called by gen0Apostle + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { + _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); + } + + function _createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { + + require(_generation <= 65535); + uint256 coolDownIndex = _generation / 2; + if (coolDownIndex > 13) { + coolDownIndex = 13; + } + + Apostle memory apostle = Apostle({ + genes : _genes, + talents : _talents, + birthTime : uint48(now), + activeTime : 0, + deadTime : 0, + cooldownEndTime : 0, + matronId : _matronId, + sireId : _sireId, + siringWithId : 0, + cooldownIndex : uint16(coolDownIndex), + generation : uint16(_generation) + }); + + lastApostleObjectId += 1; + require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); + + tokenId2Apostle[tokenId] = apostle; + + emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); + + return tokenId; + } + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ + uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; + return cooldowns[cooldownIndex]; + } + + // @dev Checks to see if a apostle is able to breed. + // @param _apostleId - index of apostles which is within uint128. + function isReadyToBreed(uint256 _apostleId) + public + view + returns (bool) + { + require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); + + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); + + // In addition to checking the cooldownEndTime, we also need to check to see if + // the cat has a pending birth; there can be some period of time between the end + // of the pregnacy timer and the birth event. + return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); + } + + function approveSiring(address _addr, uint256 _sireId) + public + whenNotPaused + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_sireId) == msg.sender); + + sireAllowedToAddress[_sireId] = _addr; + } + + // check apostle's owner or siring permission + function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + address matronOwner = objectOwnership.ownerOf(_matronId); + address sireOwner = objectOwnership.ownerOf(_sireId); + + // Siring is okay if they have same owner, or if the matron's owner was given + // permission to breed with this sire. + return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); + } + + function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { + + Apostle storage aps = tokenId2Apostle[_tokenId]; + // Compute the end of the cooldown time (based on current cooldownIndex) + aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); + + // Increment the breeding count, clamping it at 13, which is the length of the + // cooldowns array. We could check the array size dynamically, but hard-coding + // this as a constant saves gas. Yay, Solidity! + if (aps.cooldownIndex < 13) { + aps.cooldownIndex += 1; + } + + // address(0) meaning use by its owner or whitelisted contract + ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); + + return uint256(aps.cooldownEndTime); + + } + + function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { + return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); + } + + /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT + /// check ownership permissions (that is up to the caller). + /// @param _matron A reference to the apostle struct of the potential matron. + /// @param _matronId The matron's ID. + /// @param _sire A reference to the apostle struct of the potential sire. + /// @param _sireId The sire's ID + function _isValidMatingPair( + Apostle storage _matron, + uint256 _matronId, + Apostle storage _sire, + uint256 _sireId + ) + private + view + returns (bool) + { + // An apostle can't breed with itself! + if (_matronId == _sireId) { + return false; + } + + // Apostles can't breed with their parents. + if (_matron.matronId == _sireId || _matron.sireId == _sireId) { + return false; + } + if (_sire.matronId == _matronId || _sire.sireId == _matronId) { + return false; + } + + // We can short circuit the sibling check (below) if either cat is + // gen zero (has a matron ID of zero). + if (_sire.matronId == 0 || _matron.matronId == 0) { + return true; + } + + // Apostles can't breed with full or half siblings. + if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { + return false; + } + if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { + return false; + } + + // Everything seems cool! Let's get DTF. + return true; + } + + + function canBreedWith(uint256 _matronId, uint256 _sireId) + public + view + returns (bool) + { + require(_matronId > 0); + require(_sireId > 0); + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + return _isValidMatingPair(matron, _matronId, sire, _sireId) && + _isSiringPermitted(_sireId, _matronId) && + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + } + + + // only can be called by SiringClockAuction + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { + + _breedWith(_matronId, _sireId); + + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, matron.cooldownEndTime); + return true; + } + + + function _breedWith(uint256 _matronId, uint256 _sireId) internal { + require(canBreedWith(_matronId, _sireId)); + + require(isReadyToBreed(_matronId)); + require(isReadyToBreed(_sireId)); + + // Grab a reference to the Apostles from storage. + Apostle storage sire = tokenId2Apostle[_sireId]; + + Apostle storage matron = tokenId2Apostle[_matronId]; + + // Mark the matron as pregnant, keeping track of who the sire is. + matron.siringWithId = _sireId; + + // Trigger the cooldown for both parents. + uint sireCoolDownEndTime = _triggerCooldown(_sireId); + uint matronCoolDownEndTime = _triggerCooldown(_matronId); + + // Clear siring permission for both parents. This may not be strictly necessary + // but it's likely to avoid confusion! + delete sireAllowedToAddress[_matronId]; + delete sireAllowedToAddress[_sireId]; + + + // Emit the pregnancy event. + emit Pregnant( + _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); + } + + + function breedWithAuto(uint256 _matronId, uint256 _sireId) + public + whenNotPaused + { + // Check for payment + // caller must approve first. + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ring.approve(pool, autoBirthFee); + IRevenuePool(pool).reward(ring, autoBirthFee, msg.sender); + + // Call through the normal breeding flow + _breedWith(_matronId, _sireId); + + // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call + // giveBirth(). + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); + } + /// @notice Have a pregnant apostle give birth! + /// @param _matronId An apostle ready to give birth. + /// @return The apostle tokenId of the new Apostles. + /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, + /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned + /// to the current owner of the matron. Upon successful completion, both the matron and the + /// new Apostles will be ready to breed again. Note that anyone can call this function (if they + /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level) + public + isHuman + whenNotPaused + { + + Apostle storage matron = tokenId2Apostle[_matronId]; + uint256 sireId = matron.siringWithId; + + if (_resourceToken != address(0)) { + // users must approve enough resourceToken to this contract + // if _resourceToken is registered + // will be checked in mixgenes + ERC20(_resourceToken).transferFrom(msg.sender, address(this), _level * registry.uintOf(UINT_MIX_TALENT)); + } + + + require(_payAndMix(_matronId, sireId, _resourceToken, _level)); + + } + + + function _payAndMix( + uint256 _matronId, + uint256 _sireId, + address _resourceToken, + uint256 _level) + internal returns (bool) { + // Grab a reference to the matron in storage. + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + + // Check that the matron is a valid apostle. + require(matron.birthTime > 0); + require(sire.birthTime > 0); + + // Check that the matron is pregnant, and that its time has come! + require(_isReadyToGiveBirth(matron)); + + // Grab a reference to the sire in storage. + // uint256 sireId = matron.siringWithId; + // prevent stack too deep error + // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; + + // Determine the higher generation number of the two parents + uint16 parentGen = matron.generation; + if (sire.generation > matron.generation) { + parentGen = sire.generation; + } + + // Call the sooper-sekret, sooper-expensive, gene mixing operation. + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + + address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); + // Make the new Apostle! + _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); + + // Clear the reference to sire from the matron (REQUIRED! Having siringWithId + // set is what marks a matron as being pregnant.) + delete matron.siringWithId; + + return true; + } + + function isValidResourceToken(address _resourceToken) public view returns (bool) { + uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); + return index > 0; + } + + + /// Anyone can try to kill this Apostle; + function killApostle(uint256 _tokenId) public { + require(tokenId2Apostle[_tokenId].activeTime > 0); + require(defaultLifeTime(_tokenId) < now); + + address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); + IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); + } + + function isDead(uint256 _tokenId) public view returns (bool) { + return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; + } + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { + uint256 start = tokenId2Apostle[_tokenId].birthTime; + + if (tokenId2Apostle[_tokenId].activeTime > 0) { + start = tokenId2Apostle[_tokenId].activeTime; + } + + return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); + } + + /// IMinerObject + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + + /// IActivityObject + function activityAdded(uint256 _tokenId, address /*_activity*/, address /*_user*/) auth public { + // to active the apostle when it do activity the first time + if (tokenId2Apostle[_tokenId].activeTime == 0) { + tokenId2Apostle[_tokenId].activeTime = uint48(now); + + emit Unbox(_tokenId, now); + } + + } + + function activityRemoved(uint256 /*_tokenId*/, address /*_activity*/, address /*_user*/) auth public { + // do nothing. + } + + /// IActivity + function activityStopped(uint256 /*_tokenId*/) auth public { + // do nothing. + } + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + Apostle storage apostle = tokenId2Apostle[_tokenId]; + return ( + apostle.genes, + apostle.talents, + apostle.matronId, + apostle.sireId, + uint256(apostle.cooldownIndex), + uint256(apostle.generation), + uint256(apostle.birthTime), + uint256(apostle.activeTime), + uint256(apostle.deadTime), + uint256(apostle.cooldownEndTime) + ); + } + + function toBytes(address x) public pure returns (bytes b) { + b = new bytes(32); + assembly {mstore(add(b, 32), x)} + } + + + function _updateCoolDown() internal { + cooldowns[0] = uint32(1 minutes); + cooldowns[1] = uint32(2 minutes); + cooldowns[2] = uint32(5 minutes); + cooldowns[3] = uint32(10 minutes); + cooldowns[4] = uint32(30 minutes); + cooldowns[5] = uint32(1 hours); + cooldowns[6] = uint32(2 hours); + cooldowns[7] = uint32(4 hours); + cooldowns[8] = uint32(8 hours); + cooldowns[9] = uint32(16 hours); + cooldowns[10] = uint32(1 days); + cooldowns[11] = uint32(2 days); + cooldowns[12] = uint32(4 days); + cooldowns[13] = uint32(7 days); + } + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { + Apostle storage aps = tokenId2Apostle[_tokenId]; + aps.genes = _genes; + aps.talents = _talents; + } + + function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { + require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); + for(uint i = 0; i < _tokenIds.length; i++) { + Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; + aps.genes = _genesList[i]; + aps.talents = _talentsList[i]; + } + + } +} + + diff --git a/contracts/ApostleClockAuctionV2.sol b/contracts/ApostleClockAuctionV2.sol new file mode 100644 index 0000000..c789732 --- /dev/null +++ b/contracts/ApostleClockAuctionV2.sol @@ -0,0 +1,553 @@ +pragma solidity ^0.4.23; + +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "./ApostleSettingIds.sol"; +import "./interfaces/IApostleBase.sol"; +import "./interfaces/IRevenuePool.sol"; + +contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { + using SafeMath for *; + event AuctionCreated( + uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt + ); + + event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); + event AuctionCancelled(uint256 tokenId); + + // claimedToken event + event ClaimedTokens(address indexed token, address indexed owner, uint amount); + + // new bid event + event NewBid( + uint256 indexed tokenId, address lastBidder, address lastReferer, uint256 lastRecord, address tokenAddress, uint256 bidStartAt, uint256 returnToLastBidder + ); + + // Represents an auction on an NFT + struct Auction { + // Current owner of NFT + address seller; + // Time when auction started + // NOTE: 0 if this auction has been concluded + uint48 startedAt; + // Duration (in seconds) of auction + uint48 duration; + // Price (in token) at beginning of auction + uint128 startingPriceInToken; + // Price (in token) at end of auction + uint128 endingPriceInToken; + // bid the auction through which token + address token; + + // it saves gas in this order + // highest offered price (in RING) + uint128 lastRecord; + // bidder who offer the highest price + address lastBidder; + // latestBidder's bidTime in timestamp + uint48 lastBidStartAt; + // lastBidder's referer + address lastReferer; + } + + bool private singletonLock = false; + + ISettingsRegistry public registry; + + // Map from token ID to their corresponding auction. + mapping(uint256 => Auction) public tokenIdToAuction; + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + // Modifiers to check that inputs can be safely stored with a certain + // number of bits. We use constants and multiple modifiers to save gas. + modifier canBeStoredWith48Bits(uint256 _value) { + require(_value <= 281474976710656); + _; + } + + modifier canBeStoredWith128Bits(uint256 _value) { + require(_value < 340282366920938463463374607431768211455); + _; + } + + modifier isOnAuction(uint256 _tokenId) { + require(tokenIdToAuction[_tokenId].startedAt > 0); + _; + } + + /////////////////////// + // Constructor + /////////////////////// + constructor() public { + // initializeContract + } + + /// @dev Constructor creates a reference to the NFT ownership contract + /// and verifies the owner cut is in the valid range. + /// bidWaitingMinutes - biggest waiting time from a bid's starting to ending(in minutes) + function initializeContract( + ISettingsRegistry _registry) public singletonLockCall { + + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + } + + /// @dev DON'T give me your money. + function() external {} + + /////////////////////// + // Auction Create and Cancel + /////////////////////// + + function createAuction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token) // with any token + public auth { + _createAuction(msg.sender, _tokenId, _startingPriceInToken, _endingPriceInToken, _duration, _startAt, msg.sender, _token); + } + + /// @dev Cancels an auction that hasn't been won yet. + /// Returns the NFT to original owner. + /// @notice This is a state-modifying function that can + /// be called while the contract is paused. + /// @param _tokenId - ID of token on auction + function cancelAuction(uint256 _tokenId) public isOnAuction(_tokenId) + { + Auction storage auction = tokenIdToAuction[_tokenId]; + + address seller = auction.seller; + require((msg.sender == seller && !paused) || msg.sender == owner); + + // once someone has bidden for this auction, no one has the right to cancel it. + require(auction.lastBidder == 0x0); + + delete tokenIdToAuction[_tokenId]; + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, seller, _tokenId); + emit AuctionCancelled(_tokenId); + } + + //@dev only NFT contract can invoke this + //@param _from - owner of _tokenId + function receiveApproval( + address _from, + uint256 _tokenId, + bytes //_extraData + ) + public + whenNotPaused + { + if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { + uint256 startingPriceInRING; + uint256 endingPriceInRING; + uint256 duration; + address seller; + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + startingPriceInRING := mload(add(ptr, 132)) + endingPriceInRING := mload(add(ptr, 164)) + duration := mload(add(ptr, 196)) + seller := mload(add(ptr, 228)) + } + + // TODO: add parameter _token + _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); + } + + } + + /////////////////////// + // Bid With Auction + /////////////////////// + + // @dev bid with RING. Computes the price and transfers winnings. + function bidWithToken(uint256 _tokenId, address _referer) public whenNotPaused returns (uint256){ + Auction storage auction = tokenIdToAuction[_tokenId]; + require(auction.startedAt > 0); + // Get a reference to the auction struct + // Check that the incoming bid is higher than the current price + uint priceInToken = getCurrentPriceInToken(_tokenId); + require(ERC20(auction.token).transferFrom(msg.sender, address(this), priceInToken), 'transfer failed'); + + uint bidMoment; + uint returnToLastBidder; + (bidMoment, returnToLastBidder) = _bidProcess(msg.sender, auction, priceInToken, _referer); + + // Tell the world! + emit NewBid(_tokenId, msg.sender, _referer, priceInToken, auction.token, bidMoment, returnToLastBidder); + + return priceInToken; + } + + // TODO: advice: offer some reward for the person who claimed + // @dev claim _tokenId for auction's lastBidder + function claimApostleAsset(uint _tokenId) public isHuman isOnAuction(_tokenId) { + // Get a reference to the auction struct + Auction storage auction = tokenIdToAuction[_tokenId]; + + // at least bidWaitingTime after last bidder's bid moment, + // and no one else has bidden during this bidWaitingTime, + // then any one can claim this token(land) for lastBidder. + require(auction.lastBidder != 0x0 && now >= auction.lastBidStartAt + registry.uintOf(ApostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME), + "this auction has not finished yet, try again later"); + + address lastBidder = auction.lastBidder; + uint lastRecord = auction.lastRecord; + + delete tokenIdToAuction[_tokenId]; + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, lastBidder, _tokenId); + + emit AuctionSuccessful(_tokenId, lastRecord, lastBidder); + } + + function _sellerPay(address _token, address _pool, address _seller, address _buyer, uint256 _value) internal { + if (_seller == registry.addressOf(ApostleSettingIds.CONTRACT_GEN0_APOSTLE)) { + ERC20(_token).approve(_pool, _value); + IRevenuePool(_pool).reward(_token, _value, _buyer); + } else { + ERC20(_token).transfer(_seller, _value); + } + } + + function _deductFee(address _referer, address _token, address _pool, address _buyer, uint256 _ownerCutAmount) internal { + uint256 refererCut = registry.uintOf(UINT_REFERER_CUT); + if (_referer != 0x0) { + uint256 refererBounty = computeCut(_ownerCutAmount, refererCut); + uint256 fee = _ownerCutAmount - refererBounty; + ERC20(_token).transfer(_referer, refererBounty); + ERC20(_token).approve(_pool, fee); + IRevenuePool(_pool).reward(_token, fee, _buyer); + } else { + ERC20(_token).approve(_pool, _ownerCutAmount); + IRevenuePool(_pool).reward(_token, _ownerCutAmount, _buyer); + } + } + + function _firstPartBid(uint _auctionCut, address _pool, address _buyer, Auction storage _auction, uint _priceInToken, address _referer) internal returns (uint, uint){ + require(now >= uint256(_auction.startedAt)); + // Calculate the auctioneer's cut. + // (NOTE: computeCut() is guaranteed to return a + // value <= price, so this subtraction can't go negative.) + // TODO: token to the seller + uint256 ownerCutAmount = computeCut(_priceInToken, _auctionCut); + + // transfer to the seller + _sellerPay(_auction.token, _pool, _auction.seller, _buyer, (_priceInToken - ownerCutAmount)); + + // deduct fee + _deductFee(_referer, _auction.token, _pool, _buyer, ownerCutAmount); + + // modify bid-related member variables + _auction.lastBidder = _buyer; + _auction.lastRecord = uint128(_priceInToken); + _auction.lastBidStartAt = uint48(now); + _auction.lastReferer = _referer; + + return (_auction.lastBidStartAt, 0); + } + + + function _secondPartBid(uint _auctionCut, address _pool, address _buyer, Auction storage _auction, uint _priceInToken, address _referer) internal returns (uint, uint){ + // TODO: repair bug of first bid's time limitation + // if this the first bid, there is no time limitation + require(now <= _auction.lastBidStartAt + registry.uintOf(ApostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME), "It's too late."); + + // _priceInToken that is larger than lastRecord + // was assured in _currentPriceInRING(_auction) + // here double check + // 1.1*price + bounty - (price + bounty) = 0.1 * price + uint surplus = _priceInToken.sub(uint256(_auction.lastRecord)); + uint poolCutAmount = computeCut(surplus, _auctionCut); + uint realReturnForEach = (surplus - poolCutAmount) / 2; + uint returnToLastBidder = realReturnForEach + uint256(_auction.lastRecord); + + // here use transfer(address,uint256) for safety + _sellerPay(_auction.token, _pool, _auction.seller, _buyer, realReturnForEach); + ERC20(_auction.token).transfer(_auction.lastBidder, returnToLastBidder); + + // deduct fee + _deductFee(_referer, _auction.token, _pool, _buyer, poolCutAmount); + + // modify bid-related member variables + _auction.lastBidder = _buyer; + _auction.lastRecord = uint128(_priceInToken); + _auction.lastBidStartAt = uint48(now); + _auction.lastReferer = _referer; + + return (_auction.lastBidStartAt, (realReturnForEach + uint256(_auction.lastRecord))); + } + + // TODO: add _token to compatible backwards with ring and eth + function _bidProcess(address _buyer, Auction storage _auction, uint _priceInToken, address _referer) + internal + canBeStoredWith128Bits(_priceInToken) + returns (uint256, uint256){ + + uint auctionCut = registry.uintOf(UINT_AUCTION_CUT); + address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); + + // uint256 refererBounty; + + // the first bid + if (_auction.lastBidder == 0x0 && _priceInToken > 0) { + + return _firstPartBid(auctionCut, revenuePool, _buyer, _auction, _priceInToken, _referer); + } + + // TODO: the math calculation needs further check + // not the first bid + if (_auction.lastRecord > 0 && _auction.lastBidder != 0x0) { + + return _secondPartBid(auctionCut, revenuePool, _buyer, _auction, _priceInToken, _referer); + } + + } + + + /// @notice This method can be used by the owner to extract mistakenly + /// sent tokens to this contract. + /// @param _token The address of the token contract that you want to recover + /// set to 0 in case you want to extract ether. + function claimTokens(address _token) public onlyOwner { + if (_token == 0x0) { + owner.transfer(address(this).balance); + return; + } + ERC20 token = ERC20(_token); + uint balance = token.balanceOf(address(this)); + token.transfer(owner, balance); + + emit ClaimedTokens(_token, owner, balance); + } + + /// @dev Computes owner's cut of a sale. + /// @param _price - Sale price of NFT. + function computeCut(uint256 _price, uint256 _cut) public pure returns (uint256) { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our entry functions carefully cap the maximum values for + // currency (at 128-bits), and ownerCut <= 10000 (see the require() + // statement in the ClockAuction constructor). The result of this + // function is always guaranteed to be <= _price. + return _price * _cut / 10000; + } + + /// @dev Returns auction info for an NFT on auction. + /// @param _tokenId - ID of NFT on auction. + function getAuction(uint256 _tokenId) + public + view + returns + ( + address seller, + uint256 startedAt, + uint256 duration, + uint256 startingPrice, + uint256 endingPrice, + address token, + uint128 lastRecord, + address lastBidder, + uint256 lastBidStartAt, + address lastReferer + ) { + Auction storage auction = tokenIdToAuction[_tokenId]; + return ( + auction.seller, + auction.startingPriceInToken, + auction.endingPriceInToken, + auction.duration, + auction.startedAt, + auction.token, + auction.lastRecord, + auction.lastBidder, + auction.lastBidStartAt, + auction.lastReferer + ); + } + + /// @dev Returns the current price of an auction. + /// Returns current price of an NFT on auction. Broken into two + /// functions (this one, that computes the duration from the auction + /// structure, and the other that does the price computation) so we + /// can easily test that the price computation works correctly. + /// @param _tokenId - ID of the token price we are checking. + function getCurrentPriceInToken(uint256 _tokenId) + public + view + returns (uint256) + { + uint256 secondsPassed = 0; + + // A bit of insurance against negative values (or wraparound). + // Probably not necessary (since Ethereum guarnatees that the + // now variable doesn't ever go backwards). + if (now > tokenIdToAuction[_tokenId].startedAt) { + secondsPassed = now - tokenIdToAuction[_tokenId].startedAt; + } + // if no one has bidden for _auction, compute the price as below. + if (tokenIdToAuction[_tokenId].lastRecord == 0) { + return _computeCurrentPriceInToken( + tokenIdToAuction[_tokenId].startingPriceInToken, + tokenIdToAuction[_tokenId].endingPriceInToken, + tokenIdToAuction[_tokenId].duration, + secondsPassed + ); + } else { + // compatible with first bid + // as long as price_offered_by_buyer >= 1.1 * currentPice, + // this buyer will be the lastBidder + // 1.1 * (lastRecord) + return (11 * (uint256(tokenIdToAuction[_tokenId].lastRecord)) / 10); + } + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256, //_tokenId, + bytes //_data + ) + public + pure + returns (bytes4) { + // owner can put apostle on market + // after coolDownEndTime + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + } + + // get auction's price of last bidder offered + // @dev return price of _auction (in RING) + function getLastRecord(uint _tokenId) public view returns (uint256) { + return tokenIdToAuction[_tokenId].lastRecord; + } + + function getLastBidder(uint _tokenId) public view returns (address) { + return tokenIdToAuction[_tokenId].lastBidder; + } + + function getLastBidStartAt(uint _tokenId) public view returns (uint256) { + return tokenIdToAuction[_tokenId].lastBidStartAt; + } + + // @dev if someone new wants to bid, the lowest price he/she need to afford + function computeNextBidRecord(uint _tokenId) public view returns (uint256) { + return getCurrentPriceInToken(_tokenId); + } + + /// @dev Creates and begins a new auction. + /// @param _tokenId - ID of token to auction, sender must be owner. + // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason + /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. + /// @param _endingPriceInToken - Price of item (in token) at end of auction. + /// @param _duration - Length of time to move between starting + /// price and ending price (in seconds). + /// @param _seller - Seller, if not the message sender + function _createAuction( + address _from, + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _seller, + address _token + ) + internal + canBeStoredWith128Bits(_startingPriceInToken) + canBeStoredWith128Bits(_endingPriceInToken) + canBeStoredWith48Bits(_duration) + canBeStoredWith48Bits(_startAt) + whenNotPaused + { + // Require that all auctions have a duration of + // at least one minute. (Keeps our math from getting hairy!) + require(_duration >= 1 minutes, "duration must be at least 1 minutes"); + require(_duration <= 1000 days); + require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); + // escrow + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, this, _tokenId); + + tokenIdToAuction[_tokenId] = Auction({ + seller : _seller, + startedAt : uint48(_startAt), + duration : uint48(_duration), + startingPriceInToken : uint128(_startingPriceInToken), + endingPriceInToken : uint128(_endingPriceInToken), + lastRecord : 0, + token : _token, + // which refer to lastRecord, lastBidder, lastBidStartAt,lastReferer + // all set to zero when initialized + lastBidder : address(0), + lastBidStartAt : 0, + lastReferer : address(0) + }); + + emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); + } + + /// @dev Computes the current price of an auction. Factored out + /// from _currentPrice so we can run extensive unit tests. + /// When testing, make this function public and turn on + /// `Current price computation` test suite. + function _computeCurrentPriceInToken( + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _secondsPassed + ) + internal + pure + returns (uint256) + { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our public functions carefully cap the maximum values for + // time (at 64-bits) and currency (at 128-bits). _duration is + // also known to be non-zero (see the require() statement in + // _addAuction()) + if (_secondsPassed >= _duration) { + // We've reached the end of the dynamic pricing portion + // of the auction, just return the end price. + return _endingPriceInToken; + } else { + // Starting price can be higher than ending price (and often is!), so + // this delta can be negative. + int256 totalPriceInTokenChange = int256(_endingPriceInToken) - int256(_startingPriceInToken); + + // This multiplication can't overflow, _secondsPassed will easily fit within + // 64-bits, and totalPriceChange will easily fit within 128-bits, their product + // will always fit within 256-bits. + int256 currentPriceInTokenChange = totalPriceInTokenChange * int256(_secondsPassed) / int256(_duration); + + // currentPriceChange can be negative, but if so, will have a magnitude + // less that _startingPrice. Thus, this result will always end up positive. + int256 currentPriceInToken = int256(_startingPriceInToken) + currentPriceInTokenChange; + + return uint256(currentPriceInToken); + } + } +} diff --git a/contracts/ApostleSettingIds.sol b/contracts/ApostleSettingIds.sol index dee193c..6b4f287 100644 --- a/contracts/ApostleSettingIds.sol +++ b/contracts/ApostleSettingIds.sol @@ -30,4 +30,7 @@ contract ApostleSettingIds is SettingIds { // TODO: move this to common-contract bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; + + + bytes32 public constant CONTRACT_GEN0_APOSTLE = "CONTRACT_GEN0_APOSTLE"; } diff --git a/contracts/Gen0ApostleV2.sol b/contracts/Gen0ApostleV2.sol index 8a93e63..3a8bd25 100644 --- a/contracts/Gen0ApostleV2.sol +++ b/contracts/Gen0ApostleV2.sol @@ -5,7 +5,6 @@ import "./interfaces/IApostleBase.sol"; import "./interfaces/IApostleAuction.sol"; import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; -import "@evolutionland/common/contracts/interfaces/ERC223.sol"; import "@evolutionland/common/contracts/PausableDSAuth.sol"; contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { @@ -40,7 +39,6 @@ contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { gen0CreationLimit = _gen0Limit; } - function createGen0Apostle(uint256 _genes, uint256 _talents, address _owner) public { require(operator == msg.sender, "you have no rights"); require(gen0Count + 1 <= gen0CreationLimit, "Exceed Generation Limit"); @@ -78,16 +76,6 @@ contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { operator = _operator; } - function tokenFallback(address /*_from*/, uint256 _value, bytes _data) public { - address ring = registry.addressOf(CONTRACT_RING_ERC20_TOKEN); - address kton = registry.addressOf(CONTRACT_KTON_ERC20_TOKEN); - address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); - - if(msg.sender == ring || msg.sender == kton) { - ERC223(msg.sender).transfer(revenuePool, _value, _data); - } - } - // to apply for the safeTransferFrom function onERC721Received( address, //_operator, diff --git a/contracts/SiringClockAuctionV2.sol b/contracts/SiringClockAuctionV2.sol index 0e3106d..5d69e34 100644 --- a/contracts/SiringClockAuctionV2.sol +++ b/contracts/SiringClockAuctionV2.sol @@ -2,9 +2,9 @@ pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; -import "@evolutionland/common/contracts/interfaces/ERC223.sol"; import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; import "./interfaces/IApostleBase.sol"; +import "./interfaces/IRevenuePool.sol"; import "./SiringAuctionBase.sol"; /// @title Clock auction for non-fungible tokens. @@ -122,40 +122,20 @@ contract SiringClockAuctionV2 is SiringAuctionBase { } - function tokenFallback(address _from, uint256 _valueInToken, bytes /*_data*/) public whenNotPaused { - uint sireId; - uint matronId; - assembly { - let ptr := mload(0x40) - calldatacopy(ptr, 0, calldatasize) - matronId := mload(add(ptr, 132)) - sireId := mload(add(ptr, 164)) - } + function bidWithToken(uint256 matronId, uint256 sireId) public whenNotPaused { // safer for users - require(msg.sender == tokenIdToAuction[sireId].token); - require(tokenIdToAuction[sireId].startedAt > 0); - + Auction storage auction = tokenIdToAuction[sireId]; + require(auction.startedAt > 0, "no start"); + require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); uint256 autoBirthFee = registry.uintOf(UINT_AUTOBIRTH_FEE); - // Check that the incoming bid is higher than the current price uint priceInToken = getCurrentPriceInToken(sireId); - - require(_valueInToken >= (priceInToken + autoBirthFee), - "your offer is lower than the current price, try again with a higher one."); - Auction storage auction = tokenIdToAuction[sireId]; - require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); - - address seller = auction.seller; + require(ERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); _removeAuction(sireId); - uint refund = _valueInToken - priceInToken - autoBirthFee; - - if (refund > 0) { - ERC20(msg.sender).transfer(_from, refund); - } if (priceInToken > 0) { - _bidWithToken(msg.sender, _from, seller, sireId, matronId, priceInToken, autoBirthFee); + _bidWithToken(auction.token, msg.sender, auction.seller, sireId, matronId, priceInToken, autoBirthFee); } } @@ -168,8 +148,10 @@ contract SiringClockAuctionV2 is SiringAuctionBase { require(objectOwnership.ownerOf(_matronId) == _from, "You can only breed your own apostle."); //uint256 ownerCutAmount = _computeCut(priceInToken); uint cut = _computeCut(_priceInToken); - ERC223(_auctionToken).transfer(_seller, (_priceInToken - cut), toBytes(_from)); - ERC223(_auctionToken).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), (cut + _autoBirthFee), toBytes(_from)); + ERC20(_auctionToken).transfer(_seller, (_priceInToken - cut)); + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ERC20(_auctionToken).approve(pool, (cut + _autoBirthFee)); + IRevenuePool(pool).reward(_auctionToken, (cut + _autoBirthFee), _from); IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).approveSiring(_from, _sireId); diff --git a/contracts/interfaces/IRevenuePool.sol b/contracts/interfaces/IRevenuePool.sol new file mode 100644 index 0000000..240fbba --- /dev/null +++ b/contracts/interfaces/IRevenuePool.sol @@ -0,0 +1,6 @@ +pragma solidity >=0.4.24; + +interface IRevenuePool { + function reward(address _token, uint256 _value, address _buyer) external; + function settleToken(address _tokenAddress) external; +} From f5b6ee3e8576210a2ddb10a5f44fb27b59808244 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 27 May 2021 11:29:11 +0800 Subject: [PATCH 30/64] rm erc223 support --- contracts/SiringClockAuctionV2.sol | 40 ++++-- contracts/SiringClockAuctionV3.sol | 187 +++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+), 11 deletions(-) create mode 100644 contracts/SiringClockAuctionV3.sol diff --git a/contracts/SiringClockAuctionV2.sol b/contracts/SiringClockAuctionV2.sol index 5d69e34..0e3106d 100644 --- a/contracts/SiringClockAuctionV2.sol +++ b/contracts/SiringClockAuctionV2.sol @@ -2,9 +2,9 @@ pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/interfaces/ERC223.sol"; import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; import "./interfaces/IApostleBase.sol"; -import "./interfaces/IRevenuePool.sol"; import "./SiringAuctionBase.sol"; /// @title Clock auction for non-fungible tokens. @@ -122,20 +122,40 @@ contract SiringClockAuctionV2 is SiringAuctionBase { } - function bidWithToken(uint256 matronId, uint256 sireId) public whenNotPaused { + function tokenFallback(address _from, uint256 _valueInToken, bytes /*_data*/) public whenNotPaused { + uint sireId; + uint matronId; + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + matronId := mload(add(ptr, 132)) + sireId := mload(add(ptr, 164)) + } // safer for users - Auction storage auction = tokenIdToAuction[sireId]; - require(auction.startedAt > 0, "no start"); - require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); + require(msg.sender == tokenIdToAuction[sireId].token); + require(tokenIdToAuction[sireId].startedAt > 0); + uint256 autoBirthFee = registry.uintOf(UINT_AUTOBIRTH_FEE); + // Check that the incoming bid is higher than the current price uint priceInToken = getCurrentPriceInToken(sireId); - require(ERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); + + require(_valueInToken >= (priceInToken + autoBirthFee), + "your offer is lower than the current price, try again with a higher one."); + Auction storage auction = tokenIdToAuction[sireId]; + require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); + + address seller = auction.seller; _removeAuction(sireId); + uint refund = _valueInToken - priceInToken - autoBirthFee; + + if (refund > 0) { + ERC20(msg.sender).transfer(_from, refund); + } if (priceInToken > 0) { - _bidWithToken(auction.token, msg.sender, auction.seller, sireId, matronId, priceInToken, autoBirthFee); + _bidWithToken(msg.sender, _from, seller, sireId, matronId, priceInToken, autoBirthFee); } } @@ -148,10 +168,8 @@ contract SiringClockAuctionV2 is SiringAuctionBase { require(objectOwnership.ownerOf(_matronId) == _from, "You can only breed your own apostle."); //uint256 ownerCutAmount = _computeCut(priceInToken); uint cut = _computeCut(_priceInToken); - ERC20(_auctionToken).transfer(_seller, (_priceInToken - cut)); - address pool = registry.addressOf(CONTRACT_REVENUE_POOL); - ERC20(_auctionToken).approve(pool, (cut + _autoBirthFee)); - IRevenuePool(pool).reward(_auctionToken, (cut + _autoBirthFee), _from); + ERC223(_auctionToken).transfer(_seller, (_priceInToken - cut), toBytes(_from)); + ERC223(_auctionToken).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), (cut + _autoBirthFee), toBytes(_from)); IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).approveSiring(_from, _sireId); diff --git a/contracts/SiringClockAuctionV3.sol b/contracts/SiringClockAuctionV3.sol new file mode 100644 index 0000000..40f45ef --- /dev/null +++ b/contracts/SiringClockAuctionV3.sol @@ -0,0 +1,187 @@ +pragma solidity ^0.4.24; + +import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +import "./interfaces/IApostleBase.sol"; +import "./interfaces/IRevenuePool.sol"; +import "./SiringAuctionBase.sol"; + +/// @title Clock auction for non-fungible tokens. +contract SiringClockAuctionV3 is SiringAuctionBase { + + + bool private singletonLock = false; + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + function initializeContract(ISettingsRegistry _registry) public singletonLockCall { + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + } + + /// @dev Cancels an auction that hasn't been won yet. + /// Returns the NFT to original owner. + /// @notice This is a state-modifying function that can + /// be called while the contract is paused. + /// @param _tokenId - ID of token on auction + function cancelAuction(uint256 _tokenId) + public + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + address seller = auction.seller; + require(msg.sender == seller); + _cancelAuction(_tokenId, seller); + } + + /// @dev Cancels an auction when the contract is paused. + /// Only the owner may do this, and NFTs are returned to + /// the seller. This should only be used in emergencies. + /// @param _tokenId - ID of the NFT on auction to cancel. + function cancelAuctionWhenPaused(uint256 _tokenId) + whenPaused + onlyOwner + public + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + _cancelAuction(_tokenId, auction.seller); + } + + /// @dev Returns auction info for an NFT on auction. + /// @param _tokenId - ID of NFT on auction. + function getAuction(uint256 _tokenId) + public + view + returns + ( + address seller, + uint256 startingPrice, + uint256 endingPrice, + uint256 duration, + uint256 startedAt, + address token + ) { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + return ( + auction.seller, + uint256(auction.startingPriceInToken), + uint256(auction.endingPriceInToken), + uint256(auction.duration), + uint256(auction.startedAt), + auction.token + ); + } + + /// @dev Returns the current price of an auction. + /// @param _tokenId - ID of the token price we are checking. + function getCurrentPriceInToken(uint256 _tokenId) + public + view + returns (uint256) + { + Auction storage auction = tokenIdToAuction[_tokenId]; + require(_isOnAuction(auction)); + return _currentPrice(auction); + } + + function receiveApproval( + address _from, + uint256 _tokenId, + bytes //_extraData + ) public whenNotPaused { + if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { + uint256 startingPriceInRING; + uint256 endingPriceInRING; + uint256 duration; + address seller; + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + startingPriceInRING := mload(add(ptr, 132)) + endingPriceInRING := mload(add(ptr, 164)) + duration := mload(add(ptr, 196)) + seller := mload(add(ptr, 228)) + } + + // TODO: add parameter _token + _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); + } + } + + + function bidWithToken(uint256 matronId, uint256 sireId) public whenNotPaused { + // safer for users + Auction storage auction = tokenIdToAuction[sireId]; + require(auction.startedAt > 0, "no start"); + require(now >= uint256(auction.startedAt), "you cant bid before the auction starts."); + uint256 autoBirthFee = registry.uintOf(UINT_AUTOBIRTH_FEE); + // Check that the incoming bid is higher than the current price + uint priceInToken = getCurrentPriceInToken(sireId); + require(ERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); + + _removeAuction(sireId); + + if (priceInToken > 0) { + _bidWithToken(auction.token, msg.sender, auction.seller, sireId, matronId, priceInToken, autoBirthFee); + } + } + + + function _bidWithToken( + address _auctionToken, address _from, address _seller, uint256 _sireId, uint256 _matronId, uint256 _priceInToken, uint256 _autoBirthFee) + internal + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_matronId) == _from, "You can only breed your own apostle."); + //uint256 ownerCutAmount = _computeCut(priceInToken); + uint cut = _computeCut(_priceInToken); + ERC20(_auctionToken).transfer(_seller, (_priceInToken - cut)); + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ERC20(_auctionToken).approve(pool, (cut + _autoBirthFee)); + IRevenuePool(pool).reward(_auctionToken, (cut + _autoBirthFee), _from); + + IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).approveSiring(_from, _sireId); + + address apostleBase = registry.addressOf(CONTRACT_APOSTLE_BASE); + + require(IApostleBase(apostleBase).breedWithInAuction(_matronId, _sireId)); + + objectOwnership.transferFrom(address(this), _seller, _sireId); + + // Tell the world! + emit AuctionSuccessful(_sireId, _priceInToken, _from); + + } + + function toBytes(address x) public pure returns (bytes b) { + b = new bytes(32); + assembly {mstore(add(b, 32), x)} + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256, // _tokenId, + bytes //_data + ) + public + pure + returns (bytes4) { + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + + } +} From efad827ca8f9cf3cf439826ee975a1db92120fe2 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 27 May 2021 17:42:49 +0800 Subject: [PATCH 31/64] rm erc223 support --- contracts/Gen0ApostleV2.sol | 12 ++++ contracts/Gen0ApostleV3.sol | 118 ++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 contracts/Gen0ApostleV3.sol diff --git a/contracts/Gen0ApostleV2.sol b/contracts/Gen0ApostleV2.sol index 3a8bd25..8a93e63 100644 --- a/contracts/Gen0ApostleV2.sol +++ b/contracts/Gen0ApostleV2.sol @@ -5,6 +5,7 @@ import "./interfaces/IApostleBase.sol"; import "./interfaces/IApostleAuction.sol"; import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@evolutionland/common/contracts/interfaces/ERC223.sol"; import "@evolutionland/common/contracts/PausableDSAuth.sol"; contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { @@ -39,6 +40,7 @@ contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { gen0CreationLimit = _gen0Limit; } + function createGen0Apostle(uint256 _genes, uint256 _talents, address _owner) public { require(operator == msg.sender, "you have no rights"); require(gen0Count + 1 <= gen0CreationLimit, "Exceed Generation Limit"); @@ -76,6 +78,16 @@ contract Gen0ApostleV2 is PausableDSAuth, ApostleSettingIds { operator = _operator; } + function tokenFallback(address /*_from*/, uint256 _value, bytes _data) public { + address ring = registry.addressOf(CONTRACT_RING_ERC20_TOKEN); + address kton = registry.addressOf(CONTRACT_KTON_ERC20_TOKEN); + address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); + + if(msg.sender == ring || msg.sender == kton) { + ERC223(msg.sender).transfer(revenuePool, _value, _data); + } + } + // to apply for the safeTransferFrom function onERC721Received( address, //_operator, diff --git a/contracts/Gen0ApostleV3.sol b/contracts/Gen0ApostleV3.sol new file mode 100644 index 0000000..0adcadc --- /dev/null +++ b/contracts/Gen0ApostleV3.sol @@ -0,0 +1,118 @@ +pragma solidity ^0.4.24; +import "./ApostleSettingIds.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "./interfaces/IApostleBase.sol"; +import "./interfaces/IApostleAuction.sol"; +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@evolutionland/common/contracts/PausableDSAuth.sol"; + +contract Gen0ApostleV3 is PausableDSAuth, ApostleSettingIds { + // claimedToken event + event ClaimedTokens(address indexed token, address indexed owner, uint amount); + event ClaimedERC721Token(address indexed owner, uint256 tokenId); + + bool private singletonLock = false; + + uint256 public gen0CreationLimit; + + ISettingsRegistry public registry; + + address public operator; + + uint256 public gen0Count; + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + function initializeContract(ISettingsRegistry _registry, uint _gen0Limit) public singletonLockCall { + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + gen0CreationLimit = _gen0Limit; + } + + function createGen0Apostle(uint256 _genes, uint256 _talents, address _owner) public { + require(operator == msg.sender, "you have no rights"); + require(gen0Count + 1 <= gen0CreationLimit, "Exceed Generation Limit"); + IApostleBase apostleBase = IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)); + apostleBase.createApostle(0, 0, 0, _genes, _talents, _owner); + gen0Count++; + } + + function createGen0Auction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token) + public { + require(operator == msg.sender, "you have no rights"); + IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); + + // aprove land to auction contract + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).approve(address(auction), _tokenId); + // create an auciton + // have to set _seller to this + auction.createAuction(_tokenId,_startingPriceInToken, _endingPriceInToken, _duration,_startAt, _token); + + } + + function cancelAuction(uint256 _tokenId) public onlyOwner { + IApostleAuction auction = IApostleAuction(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_AUCTION)); + auction.cancelAuction(_tokenId); + } + + + function setOperator(address _operator) public onlyOwner { + operator = _operator; + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256, // _tokenId, + bytes //_data + ) + public + pure + returns (bytes4) { + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + } + + /// @notice This method can be used by the owner to extract mistakenly + /// sent tokens to this contract. + /// @param _token The address of the token contract that you want to recover + /// set to 0 in case you want to extract ether. + function claimTokens(address _token) public onlyOwner { + if (_token == 0x0) { + owner.transfer(address(this).balance); + return; + } + ERC20 token = ERC20(_token); + uint balance = token.balanceOf(address(this)); + token.transfer(owner, balance); + + emit ClaimedTokens(_token, owner, balance); + } + + function claimERC721Tokens(uint256 _tokenId) public onlyOwner { + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).transferFrom(address(this), owner, _tokenId); + + emit ClaimedERC721Token(owner, _tokenId); + } + + function setApproval(address _operator, bool _isApproved) public onlyOwner { + ERC721 nft = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + nft.setApprovalForAll(_operator, _isApproved); + } + +} From 1d7ca848a6d845cfdbc2a4123ede354176baada7 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 28 May 2021 12:01:55 +0800 Subject: [PATCH 32/64] fix amount input issue --- contracts/ApostleBaseV3.sol | 10 +++++++++- contracts/ApostleClockAuctionV2.sol | 8 +++++++- contracts/SiringClockAuctionV3.sol | 10 +++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index 6016045..e14e7e0 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -332,7 +332,7 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } - function breedWithAuto(uint256 _matronId, uint256 _sireId) + function breedWithAuto(uint256 _matronId, uint256 _sireId, uint256 _amountMax) public whenNotPaused { @@ -340,6 +340,14 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec // caller must approve first. uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + + require(_amountMax >= autoBirthFee, + "your offer is lower than the current price, try again with a higher one."); + uint refund = _amountMax - autoBirthFee; + if (refund > 0) { + ERC20(ring).transfer(msg.sender, refund); + } + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); ring.approve(pool, autoBirthFee); IRevenuePool(pool).reward(ring, autoBirthFee, msg.sender); diff --git a/contracts/ApostleClockAuctionV2.sol b/contracts/ApostleClockAuctionV2.sol index c789732..e7be36c 100644 --- a/contracts/ApostleClockAuctionV2.sol +++ b/contracts/ApostleClockAuctionV2.sol @@ -185,12 +185,18 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { /////////////////////// // @dev bid with RING. Computes the price and transfers winnings. - function bidWithToken(uint256 _tokenId, address _referer) public whenNotPaused returns (uint256){ + function bidWithToken(uint256 _tokenId, address _referer, uint256 _amountMax) public whenNotPaused returns (uint256){ Auction storage auction = tokenIdToAuction[_tokenId]; require(auction.startedAt > 0); // Get a reference to the auction struct // Check that the incoming bid is higher than the current price uint priceInToken = getCurrentPriceInToken(_tokenId); + require(_amountMax >= priceInToken, + "your offer is lower than the current price, try again with a higher one."); + uint refund = _amountMax - priceInToken; + if (refund > 0) { + ERC20(auction.token).transfer(msg.sender, refund); + } require(ERC20(auction.token).transferFrom(msg.sender, address(this), priceInToken), 'transfer failed'); uint bidMoment; diff --git a/contracts/SiringClockAuctionV3.sol b/contracts/SiringClockAuctionV3.sol index 40f45ef..43bfedb 100644 --- a/contracts/SiringClockAuctionV3.sol +++ b/contracts/SiringClockAuctionV3.sol @@ -122,7 +122,7 @@ contract SiringClockAuctionV3 is SiringAuctionBase { } - function bidWithToken(uint256 matronId, uint256 sireId) public whenNotPaused { + function bidWithToken(uint256 matronId, uint256 sireId, uint256 _amountMax) public whenNotPaused { // safer for users Auction storage auction = tokenIdToAuction[sireId]; require(auction.startedAt > 0, "no start"); @@ -130,6 +130,14 @@ contract SiringClockAuctionV3 is SiringAuctionBase { uint256 autoBirthFee = registry.uintOf(UINT_AUTOBIRTH_FEE); // Check that the incoming bid is higher than the current price uint priceInToken = getCurrentPriceInToken(sireId); + + require(_amountMax >= priceInToken, + "your offer is lower than the current price, try again with a higher one."); + uint refund = _amountMax - priceInToken; + if (refund > 0) { + ERC20(auction.token).transfer(msg.sender, refund); + } + require(ERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); _removeAuction(sireId); From aa9af379596c9dca7798a38e2bd5a7abffed3aea Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 28 May 2021 13:21:05 +0800 Subject: [PATCH 33/64] fix decuct fee issue --- contracts/ApostleBaseV3.sol | 4 ---- contracts/ApostleClockAuctionV2.sol | 4 ---- contracts/SiringClockAuctionV3.sol | 6 +----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index e14e7e0..0d8179a 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -343,10 +343,6 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec require(_amountMax >= autoBirthFee, "your offer is lower than the current price, try again with a higher one."); - uint refund = _amountMax - autoBirthFee; - if (refund > 0) { - ERC20(ring).transfer(msg.sender, refund); - } address pool = registry.addressOf(CONTRACT_REVENUE_POOL); ring.approve(pool, autoBirthFee); diff --git a/contracts/ApostleClockAuctionV2.sol b/contracts/ApostleClockAuctionV2.sol index e7be36c..0962544 100644 --- a/contracts/ApostleClockAuctionV2.sol +++ b/contracts/ApostleClockAuctionV2.sol @@ -193,10 +193,6 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { uint priceInToken = getCurrentPriceInToken(_tokenId); require(_amountMax >= priceInToken, "your offer is lower than the current price, try again with a higher one."); - uint refund = _amountMax - priceInToken; - if (refund > 0) { - ERC20(auction.token).transfer(msg.sender, refund); - } require(ERC20(auction.token).transferFrom(msg.sender, address(this), priceInToken), 'transfer failed'); uint bidMoment; diff --git a/contracts/SiringClockAuctionV3.sol b/contracts/SiringClockAuctionV3.sol index 43bfedb..6911d45 100644 --- a/contracts/SiringClockAuctionV3.sol +++ b/contracts/SiringClockAuctionV3.sol @@ -131,12 +131,8 @@ contract SiringClockAuctionV3 is SiringAuctionBase { // Check that the incoming bid is higher than the current price uint priceInToken = getCurrentPriceInToken(sireId); - require(_amountMax >= priceInToken, + require(_amountMax >= (priceInToken + autoBirthFee), "your offer is lower than the current price, try again with a higher one."); - uint refund = _amountMax - priceInToken; - if (refund > 0) { - ERC20(auction.token).transfer(msg.sender, refund); - } require(ERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); From 1065261e58b03d3f8ae6561b0a10312c915699d6 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 28 May 2021 13:57:34 +0800 Subject: [PATCH 34/64] fix amount input issue --- contracts/ApostleBaseV3.sol | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index 0d8179a..ddfca59 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -339,10 +339,9 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec // Check for payment // caller must approve first. uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + require(_amountMax >= autoBirthFee, 'not enough to breed.'); ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); - - require(_amountMax >= autoBirthFee, - "your offer is lower than the current price, try again with a higher one."); + require(ring.transferFrom(msg.sender, address(this), autoBirthFee), "transfer failed"); address pool = registry.addressOf(CONTRACT_REVENUE_POOL); ring.approve(pool, autoBirthFee); @@ -364,7 +363,7 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec /// to the current owner of the matron. Upon successful completion, both the matron and the /// new Apostles will be ready to breed again. Note that anyone can call this function (if they /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. - function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level) + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level, uint256 _amountMax) public isHuman whenNotPaused @@ -377,7 +376,9 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec // users must approve enough resourceToken to this contract // if _resourceToken is registered // will be checked in mixgenes - ERC20(_resourceToken).transferFrom(msg.sender, address(this), _level * registry.uintOf(UINT_MIX_TALENT)); + uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); + require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); + ERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); } From 50799314a11d25f4d572cd30e006b62e80c5ced8 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 28 May 2021 20:00:40 +0800 Subject: [PATCH 35/64] check resourve token --- contracts/ApostleBaseV3.sol | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index ddfca59..dc17a48 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -371,15 +371,11 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec Apostle storage matron = tokenId2Apostle[_matronId]; uint256 sireId = matron.siringWithId; - - if (_resourceToken != address(0)) { - // users must approve enough resourceToken to this contract - // if _resourceToken is registered - // will be checked in mixgenes - uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); - require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); - ERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); - } + require(isValidResourceToken(_resourceToken), "Invalid resource"); + // users must approve enough resourceToken to this contract + uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); + require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); + ERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); require(_payAndMix(_matronId, sireId, _resourceToken, _level)); From 19a516266301a2d39c0ca387a44dded4f3ce2dde Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 1 Jun 2021 11:46:35 +0800 Subject: [PATCH 36/64] add abi --- abi/ApostleBase.abi | 1 + abi/ApostleBaseAuthority.abi | 1 + abi/ApostleBaseAuthorityV2.abi | 1 + abi/ApostleBaseV2.abi | 1 + abi/ApostleBaseV3.abi | 1 + abi/ApostleClockAuction.abi | 1 + abi/ApostleClockAuctionV2.abi | 1 + abi/ApostleSettingIds.abi | 1 + abi/ClockAuctionAuthority.abi | 1 + abi/DSAuth.abi | 1 + abi/DSAuthEvents.abi | 1 + abi/ERC165.abi | 1 + abi/ERC20.abi | 1 + abi/ERC20Basic.abi | 1 + abi/ERC223.abi | 1 + abi/ERC721.abi | 1 + abi/ERC721Basic.abi | 1 + abi/ERC721BridgeAuthority.abi | 1 + abi/ERC721Enumerable.abi | 1 + abi/ERC721Metadata.abi | 1 + abi/Gen0Apostle.abi | 1 + abi/Gen0ApostleV2.abi | 1 + abi/Gen0ApostleV3.abi | 1 + abi/HarbergerPotionShop.abi | 1 + abi/IActivity.abi | 1 + abi/IActivityObject.abi | 1 + abi/IApostleAuction.abi | 1 + abi/IApostleBase.abi | 1 + abi/IAuthority.abi | 1 + abi/IBurnableERC20.abi | 1 + abi/IERC721Bridge.abi | 1 + abi/IGeneScience.abi | 1 + abi/IHabergPotionShop.abi | 1 + abi/IInterstellarEncoderV3.abi | 1 + abi/ILandBase.abi | 1 + abi/ILandResource.abi | 1 + abi/IMinerObject.abi | 1 + abi/IMintableERC20.abi | 1 + abi/INFTAdaptor.abi | 1 + abi/IObjectOwnership.abi | 1 + abi/IRevenuePool.abi | 1 + abi/ISettingsRegistry.abi | 1 + abi/ITokenUse.abi | 1 + abi/PausableDSAuth.abi | 1 + abi/PetBase.abi | 1 + abi/PetBaseAuthority.abi | 1 + abi/SafeMath.abi | 1 + abi/SettingIds.abi | 1 + abi/SiringAuctionBase.abi | 1 + abi/SiringClockAuction.abi | 1 + abi/SiringClockAuctionV2.abi | 1 + abi/SiringClockAuctionV3.abi | 1 + abi/SupportsInterfaceWithLookup.abi | 1 + 53 files changed, 53 insertions(+) create mode 100644 abi/ApostleBase.abi create mode 100644 abi/ApostleBaseAuthority.abi create mode 100644 abi/ApostleBaseAuthorityV2.abi create mode 100644 abi/ApostleBaseV2.abi create mode 100644 abi/ApostleBaseV3.abi create mode 100644 abi/ApostleClockAuction.abi create mode 100644 abi/ApostleClockAuctionV2.abi create mode 100644 abi/ApostleSettingIds.abi create mode 100644 abi/ClockAuctionAuthority.abi create mode 100644 abi/DSAuth.abi create mode 100644 abi/DSAuthEvents.abi create mode 100644 abi/ERC165.abi create mode 100644 abi/ERC20.abi create mode 100644 abi/ERC20Basic.abi create mode 100644 abi/ERC223.abi create mode 100644 abi/ERC721.abi create mode 100644 abi/ERC721Basic.abi create mode 100644 abi/ERC721BridgeAuthority.abi create mode 100644 abi/ERC721Enumerable.abi create mode 100644 abi/ERC721Metadata.abi create mode 100644 abi/Gen0Apostle.abi create mode 100644 abi/Gen0ApostleV2.abi create mode 100644 abi/Gen0ApostleV3.abi create mode 100644 abi/HarbergerPotionShop.abi create mode 100644 abi/IActivity.abi create mode 100644 abi/IActivityObject.abi create mode 100644 abi/IApostleAuction.abi create mode 100644 abi/IApostleBase.abi create mode 100644 abi/IAuthority.abi create mode 100644 abi/IBurnableERC20.abi create mode 100644 abi/IERC721Bridge.abi create mode 100644 abi/IGeneScience.abi create mode 100644 abi/IHabergPotionShop.abi create mode 100644 abi/IInterstellarEncoderV3.abi create mode 100644 abi/ILandBase.abi create mode 100644 abi/ILandResource.abi create mode 100644 abi/IMinerObject.abi create mode 100644 abi/IMintableERC20.abi create mode 100644 abi/INFTAdaptor.abi create mode 100644 abi/IObjectOwnership.abi create mode 100644 abi/IRevenuePool.abi create mode 100644 abi/ISettingsRegistry.abi create mode 100644 abi/ITokenUse.abi create mode 100644 abi/PausableDSAuth.abi create mode 100644 abi/PetBase.abi create mode 100644 abi/PetBaseAuthority.abi create mode 100644 abi/SafeMath.abi create mode 100644 abi/SettingIds.abi create mode 100644 abi/SiringAuctionBase.abi create mode 100644 abi/SiringClockAuction.abi create mode 100644 abi/SiringClockAuctionV2.abi create mode 100644 abi/SiringClockAuctionV3.abi create mode 100644 abi/SupportsInterfaceWithLookup.abi diff --git a/abi/ApostleBase.abi b/abi/ApostleBase.abi new file mode 100644 index 0000000..c4734db --- /dev/null +++ b/abi/ApostleBase.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseAuthority.abi b/abi/ApostleBaseAuthority.abi new file mode 100644 index 0000000..75d63a2 --- /dev/null +++ b/abi/ApostleBaseAuthority.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whiteList","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_src","type":"address"},{"name":"","type":"address"},{"name":"_sig","type":"bytes4"}],"name":"canCall","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_whitelists","type":"address[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] diff --git a/abi/ApostleBaseAuthorityV2.abi b/abi/ApostleBaseAuthorityV2.abi new file mode 100644 index 0000000..75d63a2 --- /dev/null +++ b/abi/ApostleBaseAuthorityV2.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whiteList","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_src","type":"address"},{"name":"","type":"address"},{"name":"_sig","type":"bytes4"}],"name":"canCall","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_whitelists","type":"address[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] diff --git a/abi/ApostleBaseV2.abi b/abi/ApostleBaseV2.abi new file mode 100644 index 0000000..b304f07 --- /dev/null +++ b/abi/ApostleBaseV2.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV3.abi b/abi/ApostleBaseV3.abi new file mode 100644 index 0000000..f426951 --- /dev/null +++ b/abi/ApostleBaseV3.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuction.abi b/abi/ApostleClockAuction.abi new file mode 100644 index 0000000..23c6c3e --- /dev/null +++ b/abi/ApostleClockAuction.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuctionV2.abi b/abi/ApostleClockAuctionV2.abi new file mode 100644 index 0000000..f99868f --- /dev/null +++ b/abi/ApostleClockAuctionV2.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleSettingIds.abi b/abi/ApostleSettingIds.abi new file mode 100644 index 0000000..799adb1 --- /dev/null +++ b/abi/ApostleSettingIds.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/ClockAuctionAuthority.abi b/abi/ClockAuctionAuthority.abi new file mode 100644 index 0000000..75d63a2 --- /dev/null +++ b/abi/ClockAuctionAuthority.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whiteList","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_src","type":"address"},{"name":"","type":"address"},{"name":"_sig","type":"bytes4"}],"name":"canCall","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_whitelists","type":"address[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] diff --git a/abi/DSAuth.abi b/abi/DSAuth.abi new file mode 100644 index 0000000..be1f375 --- /dev/null +++ b/abi/DSAuth.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/DSAuthEvents.abi b/abi/DSAuthEvents.abi new file mode 100644 index 0000000..4183aa3 --- /dev/null +++ b/abi/DSAuthEvents.abi @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ERC165.abi b/abi/ERC165.abi new file mode 100644 index 0000000..32bba35 --- /dev/null +++ b/abi/ERC165.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/ERC20.abi b/abi/ERC20.abi new file mode 100644 index 0000000..d45dce9 --- /dev/null +++ b/abi/ERC20.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}] diff --git a/abi/ERC20Basic.abi b/abi/ERC20Basic.abi new file mode 100644 index 0000000..9416175 --- /dev/null +++ b/abi/ERC20Basic.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}] diff --git a/abi/ERC223.abi b/abi/ERC223.abi new file mode 100644 index 0000000..0abc502 --- /dev/null +++ b/abi/ERC223.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"amount","type":"uint256"},{"name":"data","type":"bytes"}],"name":"transferFrom","outputs":[{"name":"ok","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"amount","type":"uint256"},{"name":"data","type":"bytes"}],"name":"transfer","outputs":[{"name":"ok","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"data","type":"bytes"}],"name":"ERC223Transfer","type":"event"}] diff --git a/abi/ERC721.abi b/abi/ERC721.abi new file mode 100644 index 0000000..66d5423 --- /dev/null +++ b/abi/ERC721.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"_name","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"_operator","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"name":"_exists","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"_balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"_symbol","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_approved","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_operator","type":"address"},{"indexed":false,"name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"}] diff --git a/abi/ERC721Basic.abi b/abi/ERC721Basic.abi new file mode 100644 index 0000000..86ea9fd --- /dev/null +++ b/abi/ERC721Basic.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"_operator","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"name":"_exists","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"_balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_approved","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_operator","type":"address"},{"indexed":false,"name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"}] diff --git a/abi/ERC721BridgeAuthority.abi b/abi/ERC721BridgeAuthority.abi new file mode 100644 index 0000000..75d63a2 --- /dev/null +++ b/abi/ERC721BridgeAuthority.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whiteList","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_src","type":"address"},{"name":"","type":"address"},{"name":"_sig","type":"bytes4"}],"name":"canCall","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_whitelists","type":"address[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] diff --git a/abi/ERC721Enumerable.abi b/abi/ERC721Enumerable.abi new file mode 100644 index 0000000..c27d756 --- /dev/null +++ b/abi/ERC721Enumerable.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"_operator","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"name":"_exists","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"_balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_approved","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_operator","type":"address"},{"indexed":false,"name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"}] diff --git a/abi/ERC721Metadata.abi b/abi/ERC721Metadata.abi new file mode 100644 index 0000000..84b5b78 --- /dev/null +++ b/abi/ERC721Metadata.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"_name","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"_operator","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"name":"_exists","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"_balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"_symbol","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_approved","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_operator","type":"address"},{"indexed":false,"name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"}] diff --git a/abi/Gen0Apostle.abi b/abi/Gen0Apostle.abi new file mode 100644 index 0000000..75e4f70 --- /dev/null +++ b/abi/Gen0Apostle.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/Gen0ApostleV2.abi b/abi/Gen0ApostleV2.abi new file mode 100644 index 0000000..4b84730 --- /dev/null +++ b/abi/Gen0ApostleV2.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"TakeOut","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/Gen0ApostleV3.abi b/abi/Gen0ApostleV3.abi new file mode 100644 index 0000000..5f81a6e --- /dev/null +++ b/abi/Gen0ApostleV3.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/HarbergerPotionShop.abi b/abi/HarbergerPotionShop.abi new file mode 100644 index 0000000..d234dff --- /dev/null +++ b/abi/HarbergerPotionShop.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"buyPotion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"harbergLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"}],"name":"changeHabergEstimatePrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"stopHabergAndWithdrawFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"startHabergPotionModel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PotionState","outputs":[{"name":"estimatePrice","type":"uint256"},{"name":"availablePotionFund","type":"uint256"},{"name":"startTime","type":"uint48"},{"name":"boughtLifeTime","type":"uint48"},{"name":"lastUpdateTime","type":"uint48"},{"name":"isDead","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"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":"_tokenId","type":"uint256"},{"name":"_depositPotionFee","type":"uint256"}],"name":"forceBuy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"}],"name":"tryKillApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_token","type":"address"},{"indexed":true,"name":"_owner","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/IActivity.abi b/abi/IActivity.abi new file mode 100644 index 0000000..7d93972 --- /dev/null +++ b/abi/IActivity.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IActivityObject.abi b/abi/IActivityObject.abi new file mode 100644 index 0000000..69cb2dd --- /dev/null +++ b/abi/IActivityObject.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_activity","type":"address"},{"name":"_user","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_activity","type":"address"},{"name":"_user","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IApostleAuction.abi b/abi/IApostleAuction.abi new file mode 100644 index 0000000..bc876a2 --- /dev/null +++ b/abi/IApostleAuction.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IApostleBase.abi b/abi/IApostleBase.abi new file mode 100644 index 0000000..70badd1 --- /dev/null +++ b/abi/IApostleBase.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_owner","type":"address"}],"name":"isAbleToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/IAuthority.abi b/abi/IAuthority.abi new file mode 100644 index 0000000..367dc84 --- /dev/null +++ b/abi/IAuthority.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"src","type":"address"},{"name":"dst","type":"address"},{"name":"sig","type":"bytes4"}],"name":"canCall","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/IBurnableERC20.abi b/abi/IBurnableERC20.abi new file mode 100644 index 0000000..b602dec --- /dev/null +++ b/abi/IBurnableERC20.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IERC721Bridge.abi b/abi/IERC721Bridge.abi new file mode 100644 index 0000000..5e2a04e --- /dev/null +++ b/abi/IERC721Bridge.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_mirrorTokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_originNftAddress","type":"address"},{"name":"_originTokenId","type":"uint256"},{"name":"_owner","type":"address"}],"name":"bridgeInAuth","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_mirrorTokenId","type":"uint256"}],"name":"isBridged","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_originContract","type":"address"}],"name":"originNft2Adaptor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/IGeneScience.abi b/abi/IGeneScience.abi new file mode 100644 index 0000000..e908642 --- /dev/null +++ b/abi/IGeneScience.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_talents","type":"uint256"},{"name":"_mirrorTokenId","type":"uint256"}],"name":"enhanceWithMirrorToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronGenes","type":"uint256"},{"name":"_sireGenes","type":"uint256"}],"name":"isOkWithRaceAndGender","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_addedTalents","type":"uint256"},{"name":"_mirrorTokenId","type":"uint256"}],"name":"removeMirrorToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isGeneScience","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"_talents","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"getStrength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"genes1","type":"uint256"},{"name":"genes2","type":"uint256"},{"name":"talents1","type":"uint256"},{"name":"talents2","type":"uint256"},{"name":"resouceToken","type":"address"},{"name":"level","type":"uint256"}],"name":"mixGenesAndTalents","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IHabergPotionShop.abi b/abi/IHabergPotionShop.abi new file mode 100644 index 0000000..23442a1 --- /dev/null +++ b/abi/IHabergPotionShop.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"harbergLifeTime","outputs":[],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_killer","type":"address"}],"name":"tryKillApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IInterstellarEncoderV3.abi b/abi/IInterstellarEncoderV3.abi new file mode 100644 index 0000000..d60584b --- /dev/null +++ b/abi/IInterstellarEncoderV3.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_tokenAddress","type":"address"},{"name":"_objectContract","type":"address"},{"name":"_objectId","type":"uint128"}],"name":"encodeTokenIdForObjectContract","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getProducerId","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAGIC_NUMBER","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getOriginAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CURRENT_LAND","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenAddress","type":"address"},{"name":"_objectClass","type":"uint8"},{"name":"_objectIndex","type":"uint128"}],"name":"encodeTokenId","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CHAIN_ID","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_objectContract","type":"address"},{"name":"nftAddress","type":"address"},{"name":"_originNftAddress","type":"address"},{"name":"_objectId","type":"uint128"},{"name":"_producerId","type":"uint16"},{"name":"_convertType","type":"uint8"}],"name":"encodeTokenIdForOuterObjectContract","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getContractAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getObjectAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getObjectId","outputs":[{"name":"_objectId","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_objectContract","type":"address"},{"name":"objectClass","type":"uint8"}],"name":"registerNewObjectClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getObjectClass","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/ILandBase.abi b/abi/ILandBase.abi new file mode 100644 index 0000000..4a6e9d3 --- /dev/null +++ b/abi/ILandBase.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"resourceToken2RateAttrId","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/ILandResource.abi b/abi/ILandResource.abi new file mode 100644 index 0000000..9b7281c --- /dev/null +++ b/abi/ILandResource.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_apostleTokenId","type":"uint256"}],"name":"updateMinerStrengthWhenStop","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_apostleTokenId","type":"uint256"}],"name":"landWorkingOn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apostleTokenId","type":"uint256"}],"name":"updateMinerStrengthWhenStart","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IMinerObject.abi b/abi/IMinerObject.abi new file mode 100644 index 0000000..d7fb2c9 --- /dev/null +++ b/abi/IMinerObject.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/IMintableERC20.abi b/abi/IMintableERC20.abi new file mode 100644 index 0000000..37a4fb4 --- /dev/null +++ b/abi/IMintableERC20.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/INFTAdaptor.abi b/abi/INFTAdaptor.abi new file mode 100644 index 0000000..6475bf3 --- /dev/null +++ b/abi/INFTAdaptor.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_bridge","type":"address"},{"name":"_originTokenId","type":"uint256"}],"name":"approveOriginToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_originTokenId","type":"uint256"}],"name":"ownerInOrigin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_mirrorTokenId","type":"uint256"}],"name":"toOriginTokenId","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_originTokenId","type":"uint256"}],"name":"toMirrorTokenId","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_originTokenId","type":"uint256"},{"name":"_mirrorTokenId","type":"uint256"}],"name":"cacheMirrorTokenId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IObjectOwnership.abi b/abi/IObjectOwnership.abi new file mode 100644 index 0000000..786ea75 --- /dev/null +++ b/abi/IObjectOwnership.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_objectId","type":"uint128"}],"name":"mintObject","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_objectId","type":"uint128"}],"name":"burnObject","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/IRevenuePool.abi b/abi/IRevenuePool.abi new file mode 100644 index 0000000..1d273ce --- /dev/null +++ b/abi/IRevenuePool.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_value","type":"uint256"},{"name":"_buyer","type":"address"}],"name":"reward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenAddress","type":"address"}],"name":"settleToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/ISettingsRegistry.abi b/abi/ISettingsRegistry.abi new file mode 100644 index 0000000..e231b5a --- /dev/null +++ b/abi/ISettingsRegistry.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_propertyName","type":"bytes32"},{"name":"_value","type":"uint256"}],"name":"setUintProperty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_propertyName","type":"bytes32"}],"name":"bytesOf","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_propertyName","type":"bytes32"}],"name":"uintOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_propertyName","type":"bytes32"},{"name":"_value","type":"bytes"}],"name":"setBytesProperty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_propertyName","type":"bytes32"},{"name":"_value","type":"bool"}],"name":"setBoolProperty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_propertyName","type":"bytes32"},{"name":"_value","type":"int256"}],"name":"setIntProperty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_propertyName","type":"bytes32"}],"name":"intOf","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_propertyName","type":"bytes32"},{"name":"_value","type":"address"}],"name":"setAddressProperty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_propertyName","type":"bytes32"}],"name":"boolOf","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_propertyName","type":"bytes32"}],"name":"addressOf","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_propertyName","type":"bytes32"}],"name":"stringOf","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_propertyName","type":"bytes32"}],"name":"getValueTypeOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_propertyName","type":"bytes32"},{"name":"_value","type":"string"}],"name":"setStringProperty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_propertyName","type":"bytes32"},{"indexed":false,"name":"_type","type":"uint256"}],"name":"ChangeProperty","type":"event"}] diff --git a/abi/ITokenUse.abi b/abi/ITokenUse.abi new file mode 100644 index 0000000..03e2fec --- /dev/null +++ b/abi/ITokenUse.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_user","type":"address"}],"name":"removeActivity","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getTokenUser","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"takeTokenUseOffer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelTokenUseOffer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isObjectInHireStage","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isObjectReadyToUse","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAX_UINT48_TIME","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_price","type":"uint256"},{"name":"_acceptedActivity","type":"address"}],"name":"createTokenUseOffer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_user","type":"address"},{"name":"_endTime","type":"uint256"}],"name":"addActivity","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/PausableDSAuth.abi b/abi/PausableDSAuth.abi new file mode 100644 index 0000000..8fc788f --- /dev/null +++ b/abi/PausableDSAuth.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/PetBase.abi b/abi/PetBase.abi new file mode 100644 index 0000000..3fab3aa --- /dev/null +++ b/abi/PetBase.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastPetObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_number","type":"uint128"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PetStatus","outputs":[{"name":"maxTiedNumber","type":"uint128"},{"name":"tiedCount","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_petTokenId","type":"uint256"}],"name":"untiePetToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"pet2TiedStatus","outputs":[{"name":"apostleTokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_originNftAddress","type":"address"},{"name":"_originTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"bridgeInAndTie","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"createPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_mirrorTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"tiePetTokenToApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleTokenId","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"getTiedPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxTiedNumber","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"Tied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"UnTied","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/PetBaseAuthority.abi b/abi/PetBaseAuthority.abi new file mode 100644 index 0000000..75d63a2 --- /dev/null +++ b/abi/PetBaseAuthority.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whiteList","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_src","type":"address"},{"name":"","type":"address"},{"name":"_sig","type":"bytes4"}],"name":"canCall","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_whitelists","type":"address[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] diff --git a/abi/SafeMath.abi b/abi/SafeMath.abi new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/abi/SafeMath.abi @@ -0,0 +1 @@ +[] diff --git a/abi/SettingIds.abi b/abi/SettingIds.abi new file mode 100644 index 0000000..76a4475 --- /dev/null +++ b/abi/SettingIds.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/SiringAuctionBase.abi b/abi/SiringAuctionBase.abi new file mode 100644 index 0000000..2609d80 --- /dev/null +++ b/abi/SiringAuctionBase.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuction.abi b/abi/SiringClockAuction.abi new file mode 100644 index 0000000..6200685 --- /dev/null +++ b/abi/SiringClockAuction.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuctionV2.abi b/abi/SiringClockAuctionV2.abi new file mode 100644 index 0000000..6200685 --- /dev/null +++ b/abi/SiringClockAuctionV2.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuctionV3.abi b/abi/SiringClockAuctionV3.abi new file mode 100644 index 0000000..db7dd8e --- /dev/null +++ b/abi/SiringClockAuctionV3.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SupportsInterfaceWithLookup.abi b/abi/SupportsInterfaceWithLookup.abi new file mode 100644 index 0000000..ed3fed4 --- /dev/null +++ b/abi/SupportsInterfaceWithLookup.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] From 63047d3852c43d5a4be5f2b6c264f61a0ea2b16e Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 1 Jun 2021 22:19:43 +0800 Subject: [PATCH 37/64] fix transfer issue --- contracts/ApostleBaseV3.sol | 6 +++--- contracts/ApostleClockAuctionV2.sol | 18 +++++++++--------- contracts/Gen0ApostleV3.sol | 4 ++-- contracts/SiringClockAuctionV3.sol | 8 ++++---- contracts/interfaces/IERC20.sol | 10 ++++++++++ 5 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 contracts/interfaces/IERC20.sol diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index dc17a48..2c975eb 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -1,7 +1,6 @@ pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; @@ -15,6 +14,7 @@ import "./interfaces/IGeneScience.sol"; import "./interfaces/IHabergPotionShop.sol"; import "./interfaces/ILandBase.sol"; import "./interfaces/IRevenuePool.sol"; +import "./interfaces/IERC20.sol"; // all Ids in this contracts refer to index which is using 128-bit unsigned integers. // this is CONTRACT_APOSTLE_BASE @@ -340,7 +340,7 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec // caller must approve first. uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); require(_amountMax >= autoBirthFee, 'not enough to breed.'); - ERC20 ring = ERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + IERC20 ring = IERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); require(ring.transferFrom(msg.sender, address(this), autoBirthFee), "transfer failed"); address pool = registry.addressOf(CONTRACT_REVENUE_POOL); @@ -375,7 +375,7 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec // users must approve enough resourceToken to this contract uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); - ERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); + IERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); require(_payAndMix(_matronId, sireId, _resourceToken, _level)); diff --git a/contracts/ApostleClockAuctionV2.sol b/contracts/ApostleClockAuctionV2.sol index 0962544..b00a138 100644 --- a/contracts/ApostleClockAuctionV2.sol +++ b/contracts/ApostleClockAuctionV2.sol @@ -2,12 +2,12 @@ pragma solidity ^0.4.23; import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; import "@evolutionland/common/contracts/PausableDSAuth.sol"; import "./ApostleSettingIds.sol"; import "./interfaces/IApostleBase.sol"; import "./interfaces/IRevenuePool.sol"; +import "./interfaces/IERC20.sol"; contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { using SafeMath for *; @@ -193,7 +193,7 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { uint priceInToken = getCurrentPriceInToken(_tokenId); require(_amountMax >= priceInToken, "your offer is lower than the current price, try again with a higher one."); - require(ERC20(auction.token).transferFrom(msg.sender, address(this), priceInToken), 'transfer failed'); + require(IERC20(auction.token).transferFrom(msg.sender, address(this), priceInToken), 'transfer failed'); uint bidMoment; uint returnToLastBidder; @@ -229,10 +229,10 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { function _sellerPay(address _token, address _pool, address _seller, address _buyer, uint256 _value) internal { if (_seller == registry.addressOf(ApostleSettingIds.CONTRACT_GEN0_APOSTLE)) { - ERC20(_token).approve(_pool, _value); + IERC20(_token).approve(_pool, _value); IRevenuePool(_pool).reward(_token, _value, _buyer); } else { - ERC20(_token).transfer(_seller, _value); + IERC20(_token).transfer(_seller, _value); } } @@ -241,11 +241,11 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { if (_referer != 0x0) { uint256 refererBounty = computeCut(_ownerCutAmount, refererCut); uint256 fee = _ownerCutAmount - refererBounty; - ERC20(_token).transfer(_referer, refererBounty); - ERC20(_token).approve(_pool, fee); + IERC20(_token).transfer(_referer, refererBounty); + IERC20(_token).approve(_pool, fee); IRevenuePool(_pool).reward(_token, fee, _buyer); } else { - ERC20(_token).approve(_pool, _ownerCutAmount); + IERC20(_token).approve(_pool, _ownerCutAmount); IRevenuePool(_pool).reward(_token, _ownerCutAmount, _buyer); } } @@ -290,7 +290,7 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { // here use transfer(address,uint256) for safety _sellerPay(_auction.token, _pool, _auction.seller, _buyer, realReturnForEach); - ERC20(_auction.token).transfer(_auction.lastBidder, returnToLastBidder); + IERC20(_auction.token).transfer(_auction.lastBidder, returnToLastBidder); // deduct fee _deductFee(_referer, _auction.token, _pool, _buyer, poolCutAmount); @@ -340,7 +340,7 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { owner.transfer(address(this).balance); return; } - ERC20 token = ERC20(_token); + IERC20 token = IERC20(_token); uint balance = token.balanceOf(address(this)); token.transfer(owner, balance); diff --git a/contracts/Gen0ApostleV3.sol b/contracts/Gen0ApostleV3.sol index 0adcadc..f86f16a 100644 --- a/contracts/Gen0ApostleV3.sol +++ b/contracts/Gen0ApostleV3.sol @@ -4,8 +4,8 @@ import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; import "./interfaces/IApostleBase.sol"; import "./interfaces/IApostleAuction.sol"; import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "./interfaces/IERC20.sol"; contract Gen0ApostleV3 is PausableDSAuth, ApostleSettingIds { // claimedToken event @@ -97,7 +97,7 @@ contract Gen0ApostleV3 is PausableDSAuth, ApostleSettingIds { owner.transfer(address(this).balance); return; } - ERC20 token = ERC20(_token); + IERC20 token = IERC20(_token); uint balance = token.balanceOf(address(this)); token.transfer(owner, balance); diff --git a/contracts/SiringClockAuctionV3.sol b/contracts/SiringClockAuctionV3.sol index 6911d45..4464a53 100644 --- a/contracts/SiringClockAuctionV3.sol +++ b/contracts/SiringClockAuctionV3.sol @@ -1,11 +1,11 @@ pragma solidity ^0.4.24; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; import "./interfaces/IApostleBase.sol"; import "./interfaces/IRevenuePool.sol"; import "./SiringAuctionBase.sol"; +import "./interfaces/IERC20.sol"; /// @title Clock auction for non-fungible tokens. contract SiringClockAuctionV3 is SiringAuctionBase { @@ -134,7 +134,7 @@ contract SiringClockAuctionV3 is SiringAuctionBase { require(_amountMax >= (priceInToken + autoBirthFee), "your offer is lower than the current price, try again with a higher one."); - require(ERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); + require(IERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); _removeAuction(sireId); @@ -152,9 +152,9 @@ contract SiringClockAuctionV3 is SiringAuctionBase { require(objectOwnership.ownerOf(_matronId) == _from, "You can only breed your own apostle."); //uint256 ownerCutAmount = _computeCut(priceInToken); uint cut = _computeCut(_priceInToken); - ERC20(_auctionToken).transfer(_seller, (_priceInToken - cut)); + IERC20(_auctionToken).transfer(_seller, (_priceInToken - cut)); address pool = registry.addressOf(CONTRACT_REVENUE_POOL); - ERC20(_auctionToken).approve(pool, (cut + _autoBirthFee)); + IERC20(_auctionToken).approve(pool, (cut + _autoBirthFee)); IRevenuePool(pool).reward(_auctionToken, (cut + _autoBirthFee), _from); IApostleBase(registry.addressOf(CONTRACT_APOSTLE_BASE)).approveSiring(_from, _sireId); diff --git a/contracts/interfaces/IERC20.sol b/contracts/interfaces/IERC20.sol new file mode 100644 index 0000000..329ba4d --- /dev/null +++ b/contracts/interfaces/IERC20.sol @@ -0,0 +1,10 @@ +pragma solidity ^0.4.24; + +interface IERC20 { + function totalSupply() external view returns (uint256); + function balanceOf(address account) external view returns (uint256); + function transfer(address recipient, uint256 amount) external returns (bool); + function allowance(address owner, address spender) external view returns (uint256); + function approve(address spender, uint256 amount) external returns (bool); + function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); +} From b2dc0ca18c336b6be7c54ac470cc32f9324b0f4e Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 2 Jun 2021 16:32:46 +0800 Subject: [PATCH 38/64] pet: give birth by element --- contracts/ApostleBaseV3.sol | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index 2c975eb..4452e30 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -371,13 +371,12 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec Apostle storage matron = tokenId2Apostle[_matronId]; uint256 sireId = matron.siringWithId; - require(isValidResourceToken(_resourceToken), "Invalid resource"); - // users must approve enough resourceToken to this contract - uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); - require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); - IERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); - - + if (isValidResourceToken(_resourceToken)) { + // users must approve enough resourceToken to this contract + uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); + require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); + IERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); + } require(_payAndMix(_matronId, sireId, _resourceToken, _level)); } From 0e4ad6f66f69137b3c27aa1ac70d517b6d9f4e61 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 2 Jun 2021 20:23:47 +0800 Subject: [PATCH 39/64] fix siring bid issue --- contracts/SiringClockAuctionV3.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contracts/SiringClockAuctionV3.sol b/contracts/SiringClockAuctionV3.sol index 4464a53..f81bb6d 100644 --- a/contracts/SiringClockAuctionV3.sol +++ b/contracts/SiringClockAuctionV3.sol @@ -136,16 +136,17 @@ contract SiringClockAuctionV3 is SiringAuctionBase { require(IERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); - _removeAuction(sireId); - if (priceInToken > 0) { _bidWithToken(auction.token, msg.sender, auction.seller, sireId, matronId, priceInToken, autoBirthFee); } + _removeAuction(sireId); } function _bidWithToken( address _auctionToken, address _from, address _seller, uint256 _sireId, uint256 _matronId, uint256 _priceInToken, uint256 _autoBirthFee) + + canBeStoredWith128Bits(_priceInToken) internal { ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); From f95d1a1f0e5d423fd59a10023ed94e0675905197 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 4 Jun 2021 17:50:46 +0800 Subject: [PATCH 40/64] rm unsed code --- contracts/ApostleBaseV3.sol | 6 ------ 1 file changed, 6 deletions(-) diff --git a/contracts/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol index 4452e30..f0c7d25 100644 --- a/contracts/ApostleBaseV3.sol +++ b/contracts/ApostleBaseV3.sol @@ -496,12 +496,6 @@ contract ApostleBaseV3 is SupportsInterfaceWithLookup, IActivity, IActivityObjec ); } - function toBytes(address x) public pure returns (bytes b) { - b = new bytes(32); - assembly {mstore(add(b, 32), x)} - } - - function _updateCoolDown() internal { cooldowns[0] = uint32(1 minutes); cooldowns[1] = uint32(2 minutes); From e71b90abeec9a5cb24ba9b9790bc36c31a0d5110 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 11 Aug 2021 15:32:32 +0800 Subject: [PATCH 41/64] giveBirth must use resource --- contracts/ApostleBaseV4.sol | 533 ++++++++++++++++++++++++++++++++++++ 1 file changed, 533 insertions(+) create mode 100644 contracts/ApostleBaseV4.sol diff --git a/contracts/ApostleBaseV4.sol b/contracts/ApostleBaseV4.sol new file mode 100644 index 0000000..e6c358f --- /dev/null +++ b/contracts/ApostleBaseV4.sol @@ -0,0 +1,533 @@ +pragma solidity ^0.4.24; + +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; +import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivity.sol"; +import "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; +import "./ApostleSettingIds.sol"; +import "./interfaces/IGeneScience.sol"; +import "./interfaces/IHabergPotionShop.sol"; +import "./interfaces/ILandBase.sol"; +import "./interfaces/IRevenuePool.sol"; +import "./interfaces/IERC20.sol"; + +// all Ids in this contracts refer to index which is using 128-bit unsigned integers. +// this is CONTRACT_APOSTLE_BASE +// V4: giveBirth must use resource +contract ApostleBaseV4 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { + + event Birth( + address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime + ); + event Pregnant( + uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex + ); + + /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() + /// function. This is used to notify the auto-birth daemon that this breeding action + /// included a pre-payment of the gas required to call the giveBirth() function. + event AutoBirth(uint256 matronId, uint256 cooldownEndTime); + + event Unbox(uint256 tokenId, uint256 activeTime); + + struct Apostle { + // An apostles genes never change. + uint256 genes; + + uint256 talents; + + // the ID of the parents of this Apostle. set to 0 for gen0 apostle. + // Note that using 128-bit unsigned integers to represent parents IDs, + // which refer to lastApostleObjectId for those two. + uint256 matronId; + uint256 sireId; + + // Set to the ID of the sire apostle for matrons that are pregnant, + // zero otherwise. A non-zero value here is how we know an apostle + // is pregnant. Used to retrieve the genetic material for the new + // apostle when the birth transpires. + uint256 siringWithId; + // Set to the index in the cooldown array (see below) that represents + // the current cooldown duration for this apostle. + uint16 cooldownIndex; + // The "generation number" of this apostle. + uint16 generation; + + uint48 birthTime; + uint48 activeTime; + uint48 deadTime; + uint48 cooldownEndTime; + } + + uint32[14] public cooldowns = [ + uint32(1 minutes), + uint32(2 minutes), + uint32(5 minutes), + uint32(10 minutes), + uint32(30 minutes), + uint32(1 hours), + uint32(2 hours), + uint32(4 hours), + uint32(8 hours), + uint32(16 hours), + uint32(1 days), + uint32(2 days), + uint32(4 days), + uint32(7 days) + ]; + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + + /*** STORAGE ***/ + bool private singletonLock = false; + + uint128 public lastApostleObjectId; + + ISettingsRegistry public registry; + + mapping(uint256 => Apostle) public tokenId2Apostle; + + mapping(uint256 => address) public sireAllowedToAddress; + + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + + _registerInterface(InterfaceId_IActivity); + _registerInterface(InterfaceId_IActivityObject); + _registerInterface(InterfaceId_IMinerObject); + _updateCoolDown(); + + } + + // called by gen0Apostle + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { + _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); + } + + function _createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { + + require(_generation <= 65535); + uint256 coolDownIndex = _generation / 2; + if (coolDownIndex > 13) { + coolDownIndex = 13; + } + + Apostle memory apostle = Apostle({ + genes : _genes, + talents : _talents, + birthTime : uint48(now), + activeTime : 0, + deadTime : 0, + cooldownEndTime : 0, + matronId : _matronId, + sireId : _sireId, + siringWithId : 0, + cooldownIndex : uint16(coolDownIndex), + generation : uint16(_generation) + }); + + lastApostleObjectId += 1; + require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); + + tokenId2Apostle[tokenId] = apostle; + + emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); + + return tokenId; + } + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ + uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; + return cooldowns[cooldownIndex]; + } + + // @dev Checks to see if a apostle is able to breed. + // @param _apostleId - index of apostles which is within uint128. + function isReadyToBreed(uint256 _apostleId) + public + view + returns (bool) + { + require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); + + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); + + // In addition to checking the cooldownEndTime, we also need to check to see if + // the cat has a pending birth; there can be some period of time between the end + // of the pregnacy timer and the birth event. + return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); + } + + function approveSiring(address _addr, uint256 _sireId) + public + whenNotPaused + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_sireId) == msg.sender); + + sireAllowedToAddress[_sireId] = _addr; + } + + // check apostle's owner or siring permission + function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + address matronOwner = objectOwnership.ownerOf(_matronId); + address sireOwner = objectOwnership.ownerOf(_sireId); + + // Siring is okay if they have same owner, or if the matron's owner was given + // permission to breed with this sire. + return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); + } + + function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { + + Apostle storage aps = tokenId2Apostle[_tokenId]; + // Compute the end of the cooldown time (based on current cooldownIndex) + aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); + + // Increment the breeding count, clamping it at 13, which is the length of the + // cooldowns array. We could check the array size dynamically, but hard-coding + // this as a constant saves gas. Yay, Solidity! + if (aps.cooldownIndex < 13) { + aps.cooldownIndex += 1; + } + + // address(0) meaning use by its owner or whitelisted contract + ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); + + return uint256(aps.cooldownEndTime); + + } + + function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { + return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); + } + + /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT + /// check ownership permissions (that is up to the caller). + /// @param _matron A reference to the apostle struct of the potential matron. + /// @param _matronId The matron's ID. + /// @param _sire A reference to the apostle struct of the potential sire. + /// @param _sireId The sire's ID + function _isValidMatingPair( + Apostle storage _matron, + uint256 _matronId, + Apostle storage _sire, + uint256 _sireId + ) + private + view + returns (bool) + { + // An apostle can't breed with itself! + if (_matronId == _sireId) { + return false; + } + + // Apostles can't breed with their parents. + if (_matron.matronId == _sireId || _matron.sireId == _sireId) { + return false; + } + if (_sire.matronId == _matronId || _sire.sireId == _matronId) { + return false; + } + + // We can short circuit the sibling check (below) if either cat is + // gen zero (has a matron ID of zero). + if (_sire.matronId == 0 || _matron.matronId == 0) { + return true; + } + + // Apostles can't breed with full or half siblings. + if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { + return false; + } + if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { + return false; + } + + // Everything seems cool! Let's get DTF. + return true; + } + + + function canBreedWith(uint256 _matronId, uint256 _sireId) + public + view + returns (bool) + { + require(_matronId > 0); + require(_sireId > 0); + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + return _isValidMatingPair(matron, _matronId, sire, _sireId) && + _isSiringPermitted(_sireId, _matronId) && + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + } + + + // only can be called by SiringClockAuction + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { + + _breedWith(_matronId, _sireId); + + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, matron.cooldownEndTime); + return true; + } + + + function _breedWith(uint256 _matronId, uint256 _sireId) internal { + require(canBreedWith(_matronId, _sireId)); + + require(isReadyToBreed(_matronId)); + require(isReadyToBreed(_sireId)); + + // Grab a reference to the Apostles from storage. + Apostle storage sire = tokenId2Apostle[_sireId]; + + Apostle storage matron = tokenId2Apostle[_matronId]; + + // Mark the matron as pregnant, keeping track of who the sire is. + matron.siringWithId = _sireId; + + // Trigger the cooldown for both parents. + uint sireCoolDownEndTime = _triggerCooldown(_sireId); + uint matronCoolDownEndTime = _triggerCooldown(_matronId); + + // Clear siring permission for both parents. This may not be strictly necessary + // but it's likely to avoid confusion! + delete sireAllowedToAddress[_matronId]; + delete sireAllowedToAddress[_sireId]; + + + // Emit the pregnancy event. + emit Pregnant( + _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); + } + + + function breedWithAuto(uint256 _matronId, uint256 _sireId, uint256 _amountMax) + public + whenNotPaused + { + // Check for payment + // caller must approve first. + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + require(_amountMax >= autoBirthFee, 'not enough to breed.'); + IERC20 ring = IERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), autoBirthFee), "transfer failed"); + + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ring.approve(pool, autoBirthFee); + IRevenuePool(pool).reward(ring, autoBirthFee, msg.sender); + + // Call through the normal breeding flow + _breedWith(_matronId, _sireId); + + // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call + // giveBirth(). + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); + } + /// @notice Have a pregnant apostle give birth! + /// @param _matronId An apostle ready to give birth. + /// @return The apostle tokenId of the new Apostles. + /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, + /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned + /// to the current owner of the matron. Upon successful completion, both the matron and the + /// new Apostles will be ready to breed again. Note that anyone can call this function (if they + /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level, uint256 _amountMax) + public + isHuman + whenNotPaused + { + + Apostle storage matron = tokenId2Apostle[_matronId]; + uint256 sireId = matron.siringWithId; + require(isValidResourceToken(_resourceToken), 'invalid resoutce token.'); + // users must approve enough resourceToken to this contract + uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); + require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); + IERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); + require(_payAndMix(_matronId, sireId, _resourceToken, _level)); + + } + + + function _payAndMix( + uint256 _matronId, + uint256 _sireId, + address _resourceToken, + uint256 _level) + internal returns (bool) { + // Grab a reference to the matron in storage. + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + + // Check that the matron is a valid apostle. + require(matron.birthTime > 0); + require(sire.birthTime > 0); + + // Check that the matron is pregnant, and that its time has come! + require(_isReadyToGiveBirth(matron)); + + // Grab a reference to the sire in storage. + // uint256 sireId = matron.siringWithId; + // prevent stack too deep error + // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; + + // Determine the higher generation number of the two parents + uint16 parentGen = matron.generation; + if (sire.generation > matron.generation) { + parentGen = sire.generation; + } + + // Call the sooper-sekret, sooper-expensive, gene mixing operation. + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + + address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); + // Make the new Apostle! + _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); + + // Clear the reference to sire from the matron (REQUIRED! Having siringWithId + // set is what marks a matron as being pregnant.) + delete matron.siringWithId; + + return true; + } + + function isValidResourceToken(address _resourceToken) public view returns (bool) { + uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); + return index > 0; + } + + + /// Anyone can try to kill this Apostle; + function killApostle(uint256 _tokenId) public { + require(tokenId2Apostle[_tokenId].activeTime > 0); + require(defaultLifeTime(_tokenId) < now); + + address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); + IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); + } + + function isDead(uint256 _tokenId) public view returns (bool) { + return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; + } + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { + uint256 start = tokenId2Apostle[_tokenId].birthTime; + + if (tokenId2Apostle[_tokenId].activeTime > 0) { + start = tokenId2Apostle[_tokenId].activeTime; + } + + return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); + } + + /// IMinerObject + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + + /// IActivityObject + function activityAdded(uint256 _tokenId, address /*_activity*/, address /*_user*/) auth public { + // to active the apostle when it do activity the first time + if (tokenId2Apostle[_tokenId].activeTime == 0) { + tokenId2Apostle[_tokenId].activeTime = uint48(now); + + emit Unbox(_tokenId, now); + } + + } + + function activityRemoved(uint256 /*_tokenId*/, address /*_activity*/, address /*_user*/) auth public { + // do nothing. + } + + /// IActivity + function activityStopped(uint256 /*_tokenId*/) auth public { + // do nothing. + } + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + Apostle storage apostle = tokenId2Apostle[_tokenId]; + return ( + apostle.genes, + apostle.talents, + apostle.matronId, + apostle.sireId, + uint256(apostle.cooldownIndex), + uint256(apostle.generation), + uint256(apostle.birthTime), + uint256(apostle.activeTime), + uint256(apostle.deadTime), + uint256(apostle.cooldownEndTime) + ); + } + + function _updateCoolDown() internal { + cooldowns[0] = uint32(1 minutes); + cooldowns[1] = uint32(2 minutes); + cooldowns[2] = uint32(5 minutes); + cooldowns[3] = uint32(10 minutes); + cooldowns[4] = uint32(30 minutes); + cooldowns[5] = uint32(1 hours); + cooldowns[6] = uint32(2 hours); + cooldowns[7] = uint32(4 hours); + cooldowns[8] = uint32(8 hours); + cooldowns[9] = uint32(16 hours); + cooldowns[10] = uint32(1 days); + cooldowns[11] = uint32(2 days); + cooldowns[12] = uint32(4 days); + cooldowns[13] = uint32(7 days); + } + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { + Apostle storage aps = tokenId2Apostle[_tokenId]; + aps.genes = _genes; + aps.talents = _talents; + } + + function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { + require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); + for(uint i = 0; i < _tokenIds.length; i++) { + Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; + aps.genes = _genesList[i]; + aps.talents = _talentsList[i]; + } + + } +} + + From 131a9d917321ccff25b858be1e9d473c898fc2b8 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 11 Aug 2021 16:06:45 +0800 Subject: [PATCH 42/64] fix typo --- contracts/ApostleBaseV4.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ApostleBaseV4.sol b/contracts/ApostleBaseV4.sol index e6c358f..20aa6dc 100644 --- a/contracts/ApostleBaseV4.sol +++ b/contracts/ApostleBaseV4.sol @@ -372,7 +372,7 @@ contract ApostleBaseV4 is SupportsInterfaceWithLookup, IActivity, IActivityObjec Apostle storage matron = tokenId2Apostle[_matronId]; uint256 sireId = matron.siringWithId; - require(isValidResourceToken(_resourceToken), 'invalid resoutce token.'); + require(isValidResourceToken(_resourceToken), 'invalid resource token.'); // users must approve enough resourceToken to this contract uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); From 66e7aff2e7584a85ce40c6e32c8a5472929b1084 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 3 Sep 2021 13:23:43 +0800 Subject: [PATCH 43/64] fix event wrong return amount --- contracts/ApostleClockAuctionV2.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ApostleClockAuctionV2.sol b/contracts/ApostleClockAuctionV2.sol index b00a138..99e3d8d 100644 --- a/contracts/ApostleClockAuctionV2.sol +++ b/contracts/ApostleClockAuctionV2.sol @@ -301,7 +301,7 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { _auction.lastBidStartAt = uint48(now); _auction.lastReferer = _referer; - return (_auction.lastBidStartAt, (realReturnForEach + uint256(_auction.lastRecord))); + return (_auction.lastBidStartAt, returnToLastBidder)); } // TODO: add _token to compatible backwards with ring and eth From 416a1ec61c5536db71bffae5c3e49b6776580634 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 3 Sep 2021 13:24:57 +0800 Subject: [PATCH 44/64] fix typo --- contracts/ApostleClockAuctionV2.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ApostleClockAuctionV2.sol b/contracts/ApostleClockAuctionV2.sol index 99e3d8d..1dca857 100644 --- a/contracts/ApostleClockAuctionV2.sol +++ b/contracts/ApostleClockAuctionV2.sol @@ -301,7 +301,7 @@ contract ApostleClockAuctionV2 is PausableDSAuth, ApostleSettingIds { _auction.lastBidStartAt = uint48(now); _auction.lastReferer = _referer; - return (_auction.lastBidStartAt, returnToLastBidder)); + return (_auction.lastBidStartAt, returnToLastBidder); } // TODO: add _token to compatible backwards with ring and eth From faf21f1a236ed20818b2741e8e9847ec5fdcc649 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 26 Oct 2021 12:43:51 +0800 Subject: [PATCH 45/64] change surplus --- contracts/ApostleClockAuctionV3.sol | 556 ++++++++++++++++++++++++++++ 1 file changed, 556 insertions(+) create mode 100644 contracts/ApostleClockAuctionV3.sol diff --git a/contracts/ApostleClockAuctionV3.sol b/contracts/ApostleClockAuctionV3.sol new file mode 100644 index 0000000..13b5b43 --- /dev/null +++ b/contracts/ApostleClockAuctionV3.sol @@ -0,0 +1,556 @@ +pragma solidity ^0.4.23; + +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "./ApostleSettingIds.sol"; +import "./interfaces/IApostleBase.sol"; +import "./interfaces/IRevenuePool.sol"; +import "./interfaces/IERC20.sol"; + +contract ApostleClockAuctionV3 is PausableDSAuth, ApostleSettingIds { + using SafeMath for *; + event AuctionCreated( + uint256 tokenId, address seller, uint256 startingPriceInToken, uint256 endingPriceInToken, uint256 duration, address token, uint256 startedAt + ); + + event AuctionSuccessful(uint256 tokenId, uint256 totalPrice, address winner); + event AuctionCancelled(uint256 tokenId); + + // claimedToken event + event ClaimedTokens(address indexed token, address indexed owner, uint amount); + + // new bid event + event NewBid( + uint256 indexed tokenId, address lastBidder, address lastReferer, uint256 lastRecord, address tokenAddress, uint256 bidStartAt, uint256 returnToLastBidder + ); + + // Represents an auction on an NFT + struct Auction { + // Current owner of NFT + address seller; + // Time when auction started + // NOTE: 0 if this auction has been concluded + uint48 startedAt; + // Duration (in seconds) of auction + uint48 duration; + // Price (in token) at beginning of auction + uint128 startingPriceInToken; + // Price (in token) at end of auction + uint128 endingPriceInToken; + // bid the auction through which token + address token; + + // it saves gas in this order + // highest offered price (in RING) + uint128 lastRecord; + // bidder who offer the highest price + address lastBidder; + // latestBidder's bidTime in timestamp + uint48 lastBidStartAt; + // lastBidder's referer + address lastReferer; + } + + bool private singletonLock = false; + + ISettingsRegistry public registry; + + // Map from token ID to their corresponding auction. + mapping(uint256 => Auction) public tokenIdToAuction; + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + // Modifiers to check that inputs can be safely stored with a certain + // number of bits. We use constants and multiple modifiers to save gas. + modifier canBeStoredWith48Bits(uint256 _value) { + require(_value <= 281474976710656); + _; + } + + modifier canBeStoredWith128Bits(uint256 _value) { + require(_value < 340282366920938463463374607431768211455); + _; + } + + modifier isOnAuction(uint256 _tokenId) { + require(tokenIdToAuction[_tokenId].startedAt > 0); + _; + } + + /////////////////////// + // Constructor + /////////////////////// + constructor() public { + // initializeContract + } + + /// @dev Constructor creates a reference to the NFT ownership contract + /// and verifies the owner cut is in the valid range. + /// bidWaitingMinutes - biggest waiting time from a bid's starting to ending(in minutes) + function initializeContract( + ISettingsRegistry _registry) public singletonLockCall { + + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = _registry; + } + + /// @dev DON'T give me your money. + function() external {} + + /////////////////////// + // Auction Create and Cancel + /////////////////////// + + function createAuction( + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _token) // with any token + public auth { + _createAuction(msg.sender, _tokenId, _startingPriceInToken, _endingPriceInToken, _duration, _startAt, msg.sender, _token); + } + + /// @dev Cancels an auction that hasn't been won yet. + /// Returns the NFT to original owner. + /// @notice This is a state-modifying function that can + /// be called while the contract is paused. + /// @param _tokenId - ID of token on auction + function cancelAuction(uint256 _tokenId) public isOnAuction(_tokenId) + { + Auction storage auction = tokenIdToAuction[_tokenId]; + + address seller = auction.seller; + require((msg.sender == seller && !paused) || msg.sender == owner); + + // once someone has bidden for this auction, no one has the right to cancel it. + require(auction.lastBidder == 0x0); + + delete tokenIdToAuction[_tokenId]; + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, seller, _tokenId); + emit AuctionCancelled(_tokenId); + } + + //@dev only NFT contract can invoke this + //@param _from - owner of _tokenId + function receiveApproval( + address _from, + uint256 _tokenId, + bytes //_extraData + ) + public + whenNotPaused + { + if (msg.sender == registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)) { + uint256 startingPriceInRING; + uint256 endingPriceInRING; + uint256 duration; + address seller; + + assembly { + let ptr := mload(0x40) + calldatacopy(ptr, 0, calldatasize) + startingPriceInRING := mload(add(ptr, 132)) + endingPriceInRING := mload(add(ptr, 164)) + duration := mload(add(ptr, 196)) + seller := mload(add(ptr, 228)) + } + + // TODO: add parameter _token + _createAuction(_from, _tokenId, startingPriceInRING, endingPriceInRING, duration, now, seller, registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)); + } + + } + + /////////////////////// + // Bid With Auction + /////////////////////// + + // @dev bid with RING. Computes the price and transfers winnings. + function bidWithToken(uint256 _tokenId, address _referer, uint256 _amountMax) public whenNotPaused returns (uint256){ + Auction storage auction = tokenIdToAuction[_tokenId]; + require(auction.startedAt > 0); + // Get a reference to the auction struct + // Check that the incoming bid is higher than the current price + uint priceInToken = getCurrentPriceInToken(_tokenId); + require(_amountMax >= priceInToken, + "your offer is lower than the current price, try again with a higher one."); + require(IERC20(auction.token).transferFrom(msg.sender, address(this), priceInToken), 'transfer failed'); + + uint bidMoment; + uint returnToLastBidder; + (bidMoment, returnToLastBidder) = _bidProcess(msg.sender, auction, priceInToken, _referer); + + // Tell the world! + emit NewBid(_tokenId, msg.sender, _referer, priceInToken, auction.token, bidMoment, returnToLastBidder); + + return priceInToken; + } + + // TODO: advice: offer some reward for the person who claimed + // @dev claim _tokenId for auction's lastBidder + function claimApostleAsset(uint _tokenId) public isHuman isOnAuction(_tokenId) { + // Get a reference to the auction struct + Auction storage auction = tokenIdToAuction[_tokenId]; + + // at least bidWaitingTime after last bidder's bid moment, + // and no one else has bidden during this bidWaitingTime, + // then any one can claim this token(land) for lastBidder. + require(auction.lastBidder != 0x0 && now >= auction.lastBidStartAt + registry.uintOf(ApostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME), + "this auction has not finished yet, try again later"); + + address lastBidder = auction.lastBidder; + uint lastRecord = auction.lastRecord; + + delete tokenIdToAuction[_tokenId]; + + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, lastBidder, _tokenId); + + emit AuctionSuccessful(_tokenId, lastRecord, lastBidder); + } + + function _sellerPay(address _token, address _pool, address _seller, address _buyer, uint256 _value) internal { + if (_seller == registry.addressOf(ApostleSettingIds.CONTRACT_GEN0_APOSTLE)) { + IERC20(_token).approve(_pool, _value); + IRevenuePool(_pool).reward(_token, _value, _buyer); + } else { + IERC20(_token).transfer(_seller, _value); + } + } + + function _deductFee(address _referer, address _token, address _pool, address _buyer, uint256 _ownerCutAmount) internal { + uint256 refererCut = registry.uintOf(UINT_REFERER_CUT); + if (_referer != 0x0) { + uint256 refererBounty = computeCut(_ownerCutAmount, refererCut); + uint256 fee = _ownerCutAmount - refererBounty; + IERC20(_token).transfer(_referer, refererBounty); + IERC20(_token).approve(_pool, fee); + IRevenuePool(_pool).reward(_token, fee, _buyer); + } else { + IERC20(_token).approve(_pool, _ownerCutAmount); + IRevenuePool(_pool).reward(_token, _ownerCutAmount, _buyer); + } + } + + function _firstPartBid(uint _auctionCut, address _pool, address _buyer, Auction storage _auction, uint _priceInToken, address _referer) internal returns (uint, uint){ + require(now >= uint256(_auction.startedAt)); + // Calculate the auctioneer's cut. + // (NOTE: computeCut() is guaranteed to return a + // value <= price, so this subtraction can't go negative.) + // TODO: token to the seller + uint256 ownerCutAmount = computeCut(_priceInToken, _auctionCut); + + // transfer to the seller + _sellerPay(_auction.token, _pool, _auction.seller, _buyer, (_priceInToken - ownerCutAmount)); + + // deduct fee + _deductFee(_referer, _auction.token, _pool, _buyer, ownerCutAmount); + + // modify bid-related member variables + _auction.lastBidder = _buyer; + _auction.lastRecord = uint128(_priceInToken); + _auction.lastBidStartAt = uint48(now); + _auction.lastReferer = _referer; + + return (_auction.lastBidStartAt, 0); + } + + + function _secondPartBid(uint _auctionCut, address _pool, address _buyer, Auction storage _auction, uint _priceInToken, address _referer) internal returns (uint, uint){ + // TODO: repair bug of first bid's time limitation + // if this the first bid, there is no time limitation + require(now <= _auction.lastBidStartAt + registry.uintOf(ApostleSettingIds.UINT_APOSTLE_BID_WAITING_TIME), "It's too late."); + + // _priceInToken that is larger than lastRecord + // was assured in _currentPriceInRING(_auction) + // here double check + // 1.1*price + bounty - (price + bounty) = 0.1 * price + uint surplus = _priceInToken.sub(uint256(_auction.lastRecord)); + uint poolCutAmount = computeCut(surplus, _auctionCut); + uint realReturnForSeller = (surplus - poolCutAmount) * 80 / 100; + uint realReturnForLastBidder = (surplus - poolCutAmount) * 20 / 100; + uint returnToLastBidder = realReturnForLastBidder + uint256(_auction.lastRecord); + + // here use transfer(address,uint256) for safety + _sellerPay(_auction.token, _pool, _auction.seller, _buyer, realReturnForSeller); + IERC20(_auction.token).transfer(_auction.lastBidder, returnToLastBidder); + + // deduct fee + _deductFee(_referer, _auction.token, _pool, _buyer, poolCutAmount); + + // modify bid-related member variables + _auction.lastBidder = _buyer; + _auction.lastRecord = uint128(_priceInToken); + _auction.lastBidStartAt = uint48(now); + _auction.lastReferer = _referer; + + return (_auction.lastBidStartAt, returnToLastBidder); + } + + // TODO: add _token to compatible backwards with ring and eth + function _bidProcess(address _buyer, Auction storage _auction, uint _priceInToken, address _referer) + internal + canBeStoredWith128Bits(_priceInToken) + returns (uint256, uint256){ + + uint auctionCut = registry.uintOf(UINT_AUCTION_CUT); + address revenuePool = registry.addressOf(CONTRACT_REVENUE_POOL); + + // uint256 refererBounty; + + // the first bid + if (_auction.lastBidder == 0x0 && _priceInToken > 0) { + + return _firstPartBid(auctionCut, revenuePool, _buyer, _auction, _priceInToken, _referer); + } + + // TODO: the math calculation needs further check + // not the first bid + if (_auction.lastRecord > 0 && _auction.lastBidder != 0x0) { + + return _secondPartBid(auctionCut, revenuePool, _buyer, _auction, _priceInToken, _referer); + } + + } + + + /// @notice This method can be used by the owner to extract mistakenly + /// sent tokens to this contract. + /// @param _token The address of the token contract that you want to recover + /// set to 0 in case you want to extract ether. + function claimTokens(address _token) public onlyOwner { + if (_token == 0x0) { + owner.transfer(address(this).balance); + return; + } + IERC20 token = IERC20(_token); + uint balance = token.balanceOf(address(this)); + token.transfer(owner, balance); + + emit ClaimedTokens(_token, owner, balance); + } + + /// @dev Computes owner's cut of a sale. + /// @param _price - Sale price of NFT. + function computeCut(uint256 _price, uint256 _cut) public pure returns (uint256) { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our entry functions carefully cap the maximum values for + // currency (at 128-bits), and ownerCut <= 10000 (see the require() + // statement in the ClockAuction constructor). The result of this + // function is always guaranteed to be <= _price. + return _price * _cut / 10000; + } + + /// @dev Returns auction info for an NFT on auction. + /// @param _tokenId - ID of NFT on auction. + function getAuction(uint256 _tokenId) + public + view + returns + ( + address seller, + uint256 startedAt, + uint256 duration, + uint256 startingPrice, + uint256 endingPrice, + address token, + uint128 lastRecord, + address lastBidder, + uint256 lastBidStartAt, + address lastReferer + ) { + Auction storage auction = tokenIdToAuction[_tokenId]; + return ( + auction.seller, + auction.startingPriceInToken, + auction.endingPriceInToken, + auction.duration, + auction.startedAt, + auction.token, + auction.lastRecord, + auction.lastBidder, + auction.lastBidStartAt, + auction.lastReferer + ); + } + + /// @dev Returns the current price of an auction. + /// Returns current price of an NFT on auction. Broken into two + /// functions (this one, that computes the duration from the auction + /// structure, and the other that does the price computation) so we + /// can easily test that the price computation works correctly. + /// @param _tokenId - ID of the token price we are checking. + function getCurrentPriceInToken(uint256 _tokenId) + public + view + returns (uint256) + { + uint256 secondsPassed = 0; + + // A bit of insurance against negative values (or wraparound). + // Probably not necessary (since Ethereum guarnatees that the + // now variable doesn't ever go backwards). + if (now > tokenIdToAuction[_tokenId].startedAt) { + secondsPassed = now - tokenIdToAuction[_tokenId].startedAt; + } + // if no one has bidden for _auction, compute the price as below. + if (tokenIdToAuction[_tokenId].lastRecord == 0) { + return _computeCurrentPriceInToken( + tokenIdToAuction[_tokenId].startingPriceInToken, + tokenIdToAuction[_tokenId].endingPriceInToken, + tokenIdToAuction[_tokenId].duration, + secondsPassed + ); + } else { + // compatible with first bid + // as long as price_offered_by_buyer >= 1.1 * currentPice, + // this buyer will be the lastBidder + // 1.1 * (lastRecord) + return (11 * (uint256(tokenIdToAuction[_tokenId].lastRecord)) / 10); + } + } + + // to apply for the safeTransferFrom + function onERC721Received( + address, //_operator, + address, //_from, + uint256, //_tokenId, + bytes //_data + ) + public + pure + returns (bytes4) { + // owner can put apostle on market + // after coolDownEndTime + return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + } + + // get auction's price of last bidder offered + // @dev return price of _auction (in RING) + function getLastRecord(uint _tokenId) public view returns (uint256) { + return tokenIdToAuction[_tokenId].lastRecord; + } + + function getLastBidder(uint _tokenId) public view returns (address) { + return tokenIdToAuction[_tokenId].lastBidder; + } + + function getLastBidStartAt(uint _tokenId) public view returns (uint256) { + return tokenIdToAuction[_tokenId].lastBidStartAt; + } + + // @dev if someone new wants to bid, the lowest price he/she need to afford + function computeNextBidRecord(uint _tokenId) public view returns (uint256) { + return getCurrentPriceInToken(_tokenId); + } + + /// @dev Creates and begins a new auction. + /// @param _tokenId - ID of token to auction, sender must be owner. + // NOTE: change _startingPrice and _endingPrice in from wei to ring for user-friendly reason + /// @param _startingPriceInToken - Price of item (in token) at beginning of auction. + /// @param _endingPriceInToken - Price of item (in token) at end of auction. + /// @param _duration - Length of time to move between starting + /// price and ending price (in seconds). + /// @param _seller - Seller, if not the message sender + function _createAuction( + address _from, + uint256 _tokenId, + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _startAt, + address _seller, + address _token + ) + internal + canBeStoredWith128Bits(_startingPriceInToken) + canBeStoredWith128Bits(_endingPriceInToken) + canBeStoredWith48Bits(_duration) + canBeStoredWith48Bits(_startAt) + whenNotPaused + { + // Require that all auctions have a duration of + // at least one minute. (Keeps our math from getting hairy!) + require(_duration >= 1 minutes, "duration must be at least 1 minutes"); + require(_duration <= 1000 days); + require(IApostleBase(registry.addressOf(ApostleSettingIds.CONTRACT_APOSTLE_BASE)).isReadyToBreed(_tokenId), "it is still in use or have a baby to give birth."); + // escrow + ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(_from, this, _tokenId); + + tokenIdToAuction[_tokenId] = Auction({ + seller : _seller, + startedAt : uint48(_startAt), + duration : uint48(_duration), + startingPriceInToken : uint128(_startingPriceInToken), + endingPriceInToken : uint128(_endingPriceInToken), + lastRecord : 0, + token : _token, + // which refer to lastRecord, lastBidder, lastBidStartAt,lastReferer + // all set to zero when initialized + lastBidder : address(0), + lastBidStartAt : 0, + lastReferer : address(0) + }); + + emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); + } + + /// @dev Computes the current price of an auction. Factored out + /// from _currentPrice so we can run extensive unit tests. + /// When testing, make this function public and turn on + /// `Current price computation` test suite. + function _computeCurrentPriceInToken( + uint256 _startingPriceInToken, + uint256 _endingPriceInToken, + uint256 _duration, + uint256 _secondsPassed + ) + internal + pure + returns (uint256) + { + // NOTE: We don't use SafeMath (or similar) in this function because + // all of our public functions carefully cap the maximum values for + // time (at 64-bits) and currency (at 128-bits). _duration is + // also known to be non-zero (see the require() statement in + // _addAuction()) + if (_secondsPassed >= _duration) { + // We've reached the end of the dynamic pricing portion + // of the auction, just return the end price. + return _endingPriceInToken; + } else { + // Starting price can be higher than ending price (and often is!), so + // this delta can be negative. + int256 totalPriceInTokenChange = int256(_endingPriceInToken) - int256(_startingPriceInToken); + + // This multiplication can't overflow, _secondsPassed will easily fit within + // 64-bits, and totalPriceChange will easily fit within 128-bits, their product + // will always fit within 256-bits. + int256 currentPriceInTokenChange = totalPriceInTokenChange * int256(_secondsPassed) / int256(_duration); + + // currentPriceChange can be negative, but if so, will have a magnitude + // less that _startingPrice. Thus, this result will always end up positive. + int256 currentPriceInToken = int256(_startingPriceInToken) + currentPriceInTokenChange; + + return uint256(currentPriceInToken); + } + } +} From 96b020b1777754d259589ac2cabd62d795ab744a Mon Sep 17 00:00:00 2001 From: echo Date: Mon, 1 Nov 2021 18:38:52 +0800 Subject: [PATCH 46/64] update abi --- abi/ApostleBaseV3.abi | 2 +- abi/ApostleBaseV4.abi | 1 + abi/ApostleClockAuctionV3.abi | 1 + abi/IERC20.abi | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 abi/ApostleBaseV4.abi create mode 100644 abi/ApostleClockAuctionV3.abi create mode 100644 abi/IERC20.abi diff --git a/abi/ApostleBaseV3.abi b/abi/ApostleBaseV3.abi index f426951..8fbb47c 100644 --- a/abi/ApostleBaseV3.abi +++ b/abi/ApostleBaseV3.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV4.abi b/abi/ApostleBaseV4.abi new file mode 100644 index 0000000..8fbb47c --- /dev/null +++ b/abi/ApostleBaseV4.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuctionV3.abi b/abi/ApostleClockAuctionV3.abi new file mode 100644 index 0000000..f99868f --- /dev/null +++ b/abi/ApostleClockAuctionV3.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/IERC20.abi b/abi/IERC20.abi new file mode 100644 index 0000000..5c3f94f --- /dev/null +++ b/abi/IERC20.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"amount","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"},{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] From 7ce28580e0823c79f340f9b2dcc82329ff6a9b9d Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 3 Nov 2021 12:15:52 +0800 Subject: [PATCH 47/64] change userpoints distribution --- contracts/ApostleClockAuctionV3.sol | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contracts/ApostleClockAuctionV3.sol b/contracts/ApostleClockAuctionV3.sol index 13b5b43..49405f4 100644 --- a/contracts/ApostleClockAuctionV3.sol +++ b/contracts/ApostleClockAuctionV3.sol @@ -51,6 +51,8 @@ contract ApostleClockAuctionV3 is PausableDSAuth, ApostleSettingIds { uint48 lastBidStartAt; // lastBidder's referer address lastReferer; + + uint256 firstPay; } bool private singletonLock = false; @@ -220,6 +222,8 @@ contract ApostleClockAuctionV3 is PausableDSAuth, ApostleSettingIds { address lastBidder = auction.lastBidder; uint lastRecord = auction.lastRecord; + _sellerPay(auction.token, registry.addressOf(CONTRACT_REVENUE_POOL), auction.seller, auction.lastBidder, auction.firstPay); + delete tokenIdToAuction[_tokenId]; ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).safeTransferFrom(this, lastBidder, _tokenId); @@ -258,8 +262,9 @@ contract ApostleClockAuctionV3 is PausableDSAuth, ApostleSettingIds { // TODO: token to the seller uint256 ownerCutAmount = computeCut(_priceInToken, _auctionCut); - // transfer to the seller - _sellerPay(_auction.token, _pool, _auction.seller, _buyer, (_priceInToken - ownerCutAmount)); + // transfer to the address(this) + // _sellerPay(_auction.token, _pool, address(this), _buyer, (_priceInToken - ownerCutAmount)); + _auction.firstPay = _priceInToken - ownerCutAmount; // deduct fee _deductFee(_referer, _auction.token, _pool, _buyer, ownerCutAmount); @@ -507,7 +512,8 @@ contract ApostleClockAuctionV3 is PausableDSAuth, ApostleSettingIds { // all set to zero when initialized lastBidder : address(0), lastBidStartAt : 0, - lastReferer : address(0) + lastReferer : address(0), + firstPay: 0 }); emit AuctionCreated(_tokenId, _seller, _startingPriceInToken, _endingPriceInToken, _duration, _token, _startAt); From f1003e3efe4318c59e60d3d66f69e1b335513f53 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 18 Nov 2021 22:00:24 +0800 Subject: [PATCH 48/64] occupation --- abi/ApostleBase.abi | 2 +- abi/ApostleBaseV2.abi | 2 +- abi/ApostleBaseV3.abi | 2 +- abi/ApostleBaseV4.abi | 2 +- abi/ApostleBaseV5.abi | 1 + abi/ApostleClockAuction.abi | 2 +- abi/ApostleClockAuctionV2.abi | 2 +- abi/ApostleClockAuctionV3.abi | 2 +- abi/ApostleSettingIds.abi | 2 +- abi/Gen0Apostle.abi | 2 +- abi/Gen0ApostleV2.abi | 2 +- abi/Gen0ApostleV3.abi | 2 +- abi/HarbergerPotionShop.abi | 2 +- abi/IInterstellarEncoder.abi | 1 + abi/IItemBase.abi | 1 + abi/PetBase.abi | 2 +- abi/SiringAuctionBase.abi | 2 +- abi/SiringClockAuction.abi | 2 +- abi/SiringClockAuctionV2.abi | 2 +- abi/SiringClockAuctionV3.abi | 2 +- contracts/ApostleBaseV5.sol | 642 ++++++++++++++++++ contracts/ApostleSettingIds.sol | 5 + contracts/interfaces/IInterstellarEncoder.sol | 45 ++ contracts/interfaces/IItemBase.sol | 6 + 24 files changed, 718 insertions(+), 17 deletions(-) create mode 100644 abi/ApostleBaseV5.abi create mode 100644 abi/IInterstellarEncoder.abi create mode 100644 abi/IItemBase.abi create mode 100644 contracts/ApostleBaseV5.sol create mode 100644 contracts/interfaces/IInterstellarEncoder.sol create mode 100644 contracts/interfaces/IItemBase.sol diff --git a/abi/ApostleBase.abi b/abi/ApostleBase.abi index c4734db..634969b 100644 --- a/abi/ApostleBase.abi +++ b/abi/ApostleBase.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV2.abi b/abi/ApostleBaseV2.abi index b304f07..dcafc2b 100644 --- a/abi/ApostleBaseV2.abi +++ b/abi/ApostleBaseV2.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV3.abi b/abi/ApostleBaseV3.abi index 8fbb47c..1f03a19 100644 --- a/abi/ApostleBaseV3.abi +++ b/abi/ApostleBaseV3.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV4.abi b/abi/ApostleBaseV4.abi index 8fbb47c..1f03a19 100644 --- a/abi/ApostleBaseV4.abi +++ b/abi/ApostleBaseV4.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV5.abi b/abi/ApostleBaseV5.abi new file mode 100644 index 0000000..a716886 --- /dev/null +++ b/abi/ApostleBaseV5.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenId","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"extraPrefer","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuction.abi b/abi/ApostleClockAuction.abi index 23c6c3e..f709bcf 100644 --- a/abi/ApostleClockAuction.abi +++ b/abi/ApostleClockAuction.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuctionV2.abi b/abi/ApostleClockAuctionV2.abi index f99868f..c5a87e7 100644 --- a/abi/ApostleClockAuctionV2.abi +++ b/abi/ApostleClockAuctionV2.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuctionV3.abi b/abi/ApostleClockAuctionV3.abi index f99868f..2e9f278 100644 --- a/abi/ApostleClockAuctionV3.abi +++ b/abi/ApostleClockAuctionV3.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"},{"name":"firstPay","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleSettingIds.abi b/abi/ApostleSettingIds.abi index 799adb1..b8a161a 100644 --- a/abi/ApostleSettingIds.abi +++ b/abi/ApostleSettingIds.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/Gen0Apostle.abi b/abi/Gen0Apostle.abi index 75e4f70..1dc2421 100644 --- a/abi/Gen0Apostle.abi +++ b/abi/Gen0Apostle.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/Gen0ApostleV2.abi b/abi/Gen0ApostleV2.abi index 4b84730..c476784 100644 --- a/abi/Gen0ApostleV2.abi +++ b/abi/Gen0ApostleV2.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"TakeOut","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"TakeOut","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/Gen0ApostleV3.abi b/abi/Gen0ApostleV3.abi index 5f81a6e..178050b 100644 --- a/abi/Gen0ApostleV3.abi +++ b/abi/Gen0ApostleV3.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/HarbergerPotionShop.abi b/abi/HarbergerPotionShop.abi index d234dff..b1bcb85 100644 --- a/abi/HarbergerPotionShop.abi +++ b/abi/HarbergerPotionShop.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"buyPotion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"harbergLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"}],"name":"changeHabergEstimatePrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"stopHabergAndWithdrawFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"startHabergPotionModel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PotionState","outputs":[{"name":"estimatePrice","type":"uint256"},{"name":"availablePotionFund","type":"uint256"},{"name":"startTime","type":"uint48"},{"name":"boughtLifeTime","type":"uint48"},{"name":"lastUpdateTime","type":"uint48"},{"name":"isDead","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"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":"_tokenId","type":"uint256"},{"name":"_depositPotionFee","type":"uint256"}],"name":"forceBuy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"}],"name":"tryKillApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_token","type":"address"},{"indexed":true,"name":"_owner","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"buyPotion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"harbergLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"}],"name":"changeHabergEstimatePrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"stopHabergAndWithdrawFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"startHabergPotionModel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PotionState","outputs":[{"name":"estimatePrice","type":"uint256"},{"name":"availablePotionFund","type":"uint256"},{"name":"startTime","type":"uint48"},{"name":"boughtLifeTime","type":"uint48"},{"name":"lastUpdateTime","type":"uint48"},{"name":"isDead","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"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":"_tokenId","type":"uint256"},{"name":"_depositPotionFee","type":"uint256"}],"name":"forceBuy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"}],"name":"tryKillApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_token","type":"address"},{"indexed":true,"name":"_owner","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/IInterstellarEncoder.abi b/abi/IInterstellarEncoder.abi new file mode 100644 index 0000000..c01c049 --- /dev/null +++ b/abi/IInterstellarEncoder.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_tokenAddress","type":"address"},{"name":"_objectContract","type":"address"},{"name":"_objectId","type":"uint128"}],"name":"encodeTokenIdForObjectContract","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getProducerId","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getOriginAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenAddress","type":"address"},{"name":"_objectClass","type":"uint8"},{"name":"_objectIndex","type":"uint128"}],"name":"encodeTokenId","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_objectContract","type":"address"},{"name":"nftAddress","type":"address"},{"name":"_originNftAddress","type":"address"},{"name":"_objectId","type":"uint128"},{"name":"_producerId","type":"uint16"},{"name":"_convertType","type":"uint8"}],"name":"encodeTokenIdForOuterObjectContract","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getContractAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getObjectAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getObjectId","outputs":[{"name":"_objectId","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_objectContract","type":"address"},{"name":"objectClass","type":"uint8"}],"name":"registerNewObjectClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getObjectClass","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/IItemBase.abi b/abi/IItemBase.abi new file mode 100644 index 0000000..f5ee64f --- /dev/null +++ b/abi/IItemBase.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getBaseInfo","outputs":[{"name":"","type":"uint16"},{"name":"","type":"uint16"},{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getPrefer","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/PetBase.abi b/abi/PetBase.abi index 3fab3aa..e1fc289 100644 --- a/abi/PetBase.abi +++ b/abi/PetBase.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastPetObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_number","type":"uint128"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PetStatus","outputs":[{"name":"maxTiedNumber","type":"uint128"},{"name":"tiedCount","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_petTokenId","type":"uint256"}],"name":"untiePetToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"pet2TiedStatus","outputs":[{"name":"apostleTokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_originNftAddress","type":"address"},{"name":"_originTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"bridgeInAndTie","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"createPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_mirrorTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"tiePetTokenToApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleTokenId","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"getTiedPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxTiedNumber","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"Tied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"UnTied","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastPetObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_number","type":"uint128"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PetStatus","outputs":[{"name":"maxTiedNumber","type":"uint128"},{"name":"tiedCount","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_petTokenId","type":"uint256"}],"name":"untiePetToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"pet2TiedStatus","outputs":[{"name":"apostleTokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_originNftAddress","type":"address"},{"name":"_originTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"bridgeInAndTie","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"createPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_mirrorTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"tiePetTokenToApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleTokenId","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"getTiedPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxTiedNumber","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"Tied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"UnTied","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringAuctionBase.abi b/abi/SiringAuctionBase.abi index 2609d80..9d50841 100644 --- a/abi/SiringAuctionBase.abi +++ b/abi/SiringAuctionBase.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuction.abi b/abi/SiringClockAuction.abi index 6200685..61870a8 100644 --- a/abi/SiringClockAuction.abi +++ b/abi/SiringClockAuction.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuctionV2.abi b/abi/SiringClockAuctionV2.abi index 6200685..61870a8 100644 --- a/abi/SiringClockAuctionV2.abi +++ b/abi/SiringClockAuctionV2.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuctionV3.abi b/abi/SiringClockAuctionV3.abi index db7dd8e..bd63f97 100644 --- a/abi/SiringClockAuctionV3.abi +++ b/abi/SiringClockAuctionV3.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol new file mode 100644 index 0000000..51ba272 --- /dev/null +++ b/contracts/ApostleBaseV5.sol @@ -0,0 +1,642 @@ +pragma solidity ^0.4.24; + +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; +import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivity.sol"; +import "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; +import "./ApostleSettingIds.sol"; +import "./interfaces/IGeneScience.sol"; +import "./interfaces/IHabergPotionShop.sol"; +import "./interfaces/ILandBase.sol"; +import "./interfaces/IRevenuePool.sol"; +import "./interfaces/IERC20.sol"; +import "./interfaces/IInterstellarEncoder.sol"; +import "./interfaces/IItemBase.sol"; + +// all Ids in this contracts refer to index which is using 128-bit unsigned integers. +// this is CONTRACT_APOSTLE_BASE +// V4: giveBirth must use resource +// V5: add classes +contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { + + event Birth( + address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime + ); + event Pregnant( + uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex + ); + //V5 add + event ClassChange(uint256 tokenId, uint256 class); + + /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() + /// function. This is used to notify the auto-birth daemon that this breeding action + /// included a pre-payment of the gas required to call the giveBirth() function. + event AutoBirth(uint256 matronId, uint256 cooldownEndTime); + + event Unbox(uint256 tokenId, uint256 activeTime); + + // V5 add + event Equip(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + event Divest(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + + struct Apostle { + // An apostles genes never change. + uint256 genes; + + uint256 talents; + + // the ID of the parents of this Apostle. set to 0 for gen0 apostle. + // Note that using 128-bit unsigned integers to represent parents IDs, + // which refer to lastApostleObjectId for those two. + uint256 matronId; + uint256 sireId; + + // Set to the ID of the sire apostle for matrons that are pregnant, + // zero otherwise. A non-zero value here is how we know an apostle + // is pregnant. Used to retrieve the genetic material for the new + // apostle when the birth transpires. + uint256 siringWithId; + // Set to the index in the cooldown array (see below) that represents + // the current cooldown duration for this apostle. + uint16 cooldownIndex; + // The "generation number" of this apostle. + uint16 generation; + + uint48 birthTime; + uint48 activeTime; + uint48 deadTime; + uint48 cooldownEndTime; + + //v5 add + uint256 class; + uint256 extraPrefer; + } + + uint32[14] public cooldowns = [ + uint32(1 minutes), + uint32(2 minutes), + uint32(5 minutes), + uint32(10 minutes), + uint32(30 minutes), + uint32(1 hours), + uint32(2 hours), + uint32(4 hours), + uint32(8 hours), + uint32(16 hours), + uint32(1 days), + uint32(2 days), + uint32(4 days), + uint32(7 days) + ]; + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + + /*** STORAGE ***/ + bool private singletonLock = false; + + uint128 public lastApostleObjectId; + + ISettingsRegistry public registry; + + mapping(uint256 => Apostle) public tokenId2Apostle; + + mapping(uint256 => address) public sireAllowedToAddress; + + // apostle bar + struct Bar { + address token; + uint256 id; + } + + // bar status + struct Status { + uint256 tokenId; + uint256 index; + } + + // V5 add + // apoTokenId => (apoBarIndex => Bar) + mapping(uint256 => mapping(uint256 => Bar)) public bars; + // equipmentTokenAddress => equipmentId => status + mapping(address => mapping(uint256 => Status)) public statuses; + + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + + _registerInterface(InterfaceId_IActivity); + _registerInterface(InterfaceId_IActivityObject); + _registerInterface(InterfaceId_IMinerObject); + _updateCoolDown(); + + } + + // called by gen0Apostle + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { + _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); + } + + function _createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { + + require(_generation <= 65535); + uint256 coolDownIndex = _generation / 2; + if (coolDownIndex > 13) { + coolDownIndex = 13; + } + + Apostle memory apostle = Apostle({ + genes : _genes, + talents : _talents, + birthTime : uint48(now), + activeTime : 0, + deadTime : 0, + cooldownEndTime : 0, + matronId : _matronId, + sireId : _sireId, + siringWithId : 0, + cooldownIndex : uint16(coolDownIndex), + generation : uint16(_generation), + class: 0, + extraPrefer: 0 + }); + + lastApostleObjectId += 1; + require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); + + tokenId2Apostle[tokenId] = apostle; + + emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); + + return tokenId; + } + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ + uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; + return cooldowns[cooldownIndex]; + } + + // @dev Checks to see if a apostle is able to breed. + // @param _apostleId - index of apostles which is within uint128. + function isReadyToBreed(uint256 _apostleId) + public + view + returns (bool) + { + require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); + + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); + + // In addition to checking the cooldownEndTime, we also need to check to see if + // the cat has a pending birth; there can be some period of time between the end + // of the pregnacy timer and the birth event. + return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); + } + + function approveSiring(address _addr, uint256 _sireId) + public + whenNotPaused + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_sireId) == msg.sender); + + sireAllowedToAddress[_sireId] = _addr; + } + + // check apostle's owner or siring permission + function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + address matronOwner = objectOwnership.ownerOf(_matronId); + address sireOwner = objectOwnership.ownerOf(_sireId); + + // Siring is okay if they have same owner, or if the matron's owner was given + // permission to breed with this sire. + return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); + } + + function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { + + Apostle storage aps = tokenId2Apostle[_tokenId]; + // Compute the end of the cooldown time (based on current cooldownIndex) + aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); + + // Increment the breeding count, clamping it at 13, which is the length of the + // cooldowns array. We could check the array size dynamically, but hard-coding + // this as a constant saves gas. Yay, Solidity! + if (aps.cooldownIndex < 13) { + aps.cooldownIndex += 1; + } + + // address(0) meaning use by its owner or whitelisted contract + ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); + + return uint256(aps.cooldownEndTime); + + } + + function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { + return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); + } + + /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT + /// check ownership permissions (that is up to the caller). + /// @param _matron A reference to the apostle struct of the potential matron. + /// @param _matronId The matron's ID. + /// @param _sire A reference to the apostle struct of the potential sire. + /// @param _sireId The sire's ID + function _isValidMatingPair( + Apostle storage _matron, + uint256 _matronId, + Apostle storage _sire, + uint256 _sireId + ) + private + view + returns (bool) + { + // An apostle can't breed with itself! + if (_matronId == _sireId) { + return false; + } + + // Apostles can't breed with their parents. + if (_matron.matronId == _sireId || _matron.sireId == _sireId) { + return false; + } + if (_sire.matronId == _matronId || _sire.sireId == _matronId) { + return false; + } + + // We can short circuit the sibling check (below) if either cat is + // gen zero (has a matron ID of zero). + if (_sire.matronId == 0 || _matron.matronId == 0) { + return true; + } + + // Apostles can't breed with full or half siblings. + if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { + return false; + } + if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { + return false; + } + + // Everything seems cool! Let's get DTF. + return true; + } + + + function canBreedWith(uint256 _matronId, uint256 _sireId) + public + view + returns (bool) + { + require(_matronId > 0); + require(_sireId > 0); + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + return _isValidMatingPair(matron, _matronId, sire, _sireId) && + _isSiringPermitted(_sireId, _matronId) && + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + } + + + // only can be called by SiringClockAuction + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { + + _breedWith(_matronId, _sireId); + + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, matron.cooldownEndTime); + return true; + } + + + function _breedWith(uint256 _matronId, uint256 _sireId) internal { + require(canBreedWith(_matronId, _sireId)); + + require(isReadyToBreed(_matronId)); + require(isReadyToBreed(_sireId)); + + // Grab a reference to the Apostles from storage. + Apostle storage sire = tokenId2Apostle[_sireId]; + + Apostle storage matron = tokenId2Apostle[_matronId]; + + // Mark the matron as pregnant, keeping track of who the sire is. + matron.siringWithId = _sireId; + + // Trigger the cooldown for both parents. + uint sireCoolDownEndTime = _triggerCooldown(_sireId); + uint matronCoolDownEndTime = _triggerCooldown(_matronId); + + // Clear siring permission for both parents. This may not be strictly necessary + // but it's likely to avoid confusion! + delete sireAllowedToAddress[_matronId]; + delete sireAllowedToAddress[_sireId]; + + + // Emit the pregnancy event. + emit Pregnant( + _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); + } + + + function breedWithAuto(uint256 _matronId, uint256 _sireId, uint256 _amountMax) + public + whenNotPaused + { + // Check for payment + // caller must approve first. + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + require(_amountMax >= autoBirthFee, 'not enough to breed.'); + IERC20 ring = IERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), autoBirthFee), "transfer failed"); + + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ring.approve(pool, autoBirthFee); + IRevenuePool(pool).reward(ring, autoBirthFee, msg.sender); + + // Call through the normal breeding flow + _breedWith(_matronId, _sireId); + + // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call + // giveBirth(). + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); + } + /// @notice Have a pregnant apostle give birth! + /// @param _matronId An apostle ready to give birth. + /// @return The apostle tokenId of the new Apostles. + /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, + /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned + /// to the current owner of the matron. Upon successful completion, both the matron and the + /// new Apostles will be ready to breed again. Note that anyone can call this function (if they + /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level, uint256 _amountMax) + public + isHuman + whenNotPaused + { + + Apostle storage matron = tokenId2Apostle[_matronId]; + uint256 sireId = matron.siringWithId; + require(isValidResourceToken(_resourceToken), 'invalid resource token.'); + // users must approve enough resourceToken to this contract + uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); + require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); + IERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); + require(_payAndMix(_matronId, sireId, _resourceToken, _level)); + + } + + + function _payAndMix( + uint256 _matronId, + uint256 _sireId, + address _resourceToken, + uint256 _level) + internal returns (bool) { + // Grab a reference to the matron in storage. + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + + // Check that the matron is a valid apostle. + require(matron.birthTime > 0); + require(sire.birthTime > 0); + + // Check that the matron is pregnant, and that its time has come! + require(_isReadyToGiveBirth(matron)); + + // Grab a reference to the sire in storage. + // uint256 sireId = matron.siringWithId; + // prevent stack too deep error + // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; + + // Determine the higher generation number of the two parents + uint16 parentGen = matron.generation; + if (sire.generation > matron.generation) { + parentGen = sire.generation; + } + + // Call the sooper-sekret, sooper-expensive, gene mixing operation. + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + + address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); + // Make the new Apostle! + _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); + + // Clear the reference to sire from the matron (REQUIRED! Having siringWithId + // set is what marks a matron as being pregnant.) + delete matron.siringWithId; + + return true; + } + + function isValidResourceToken(address _resourceToken) public view returns (bool) { + uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); + return index > 0; + } + + + /// Anyone can try to kill this Apostle; + function killApostle(uint256 _tokenId) public { + require(tokenId2Apostle[_tokenId].activeTime > 0); + require(defaultLifeTime(_tokenId) < now); + + address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); + IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); + } + + function isDead(uint256 _tokenId) public view returns (bool) { + return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; + } + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { + uint256 start = tokenId2Apostle[_tokenId].birthTime; + + if (tokenId2Apostle[_tokenId].activeTime > 0) { + start = tokenId2Apostle[_tokenId].activeTime; + } + + return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); + } + + /// IMinerObject + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + // (天赋计算得到的基础数值(包括天赋加成装备效果))*(1+职业加成+元素加成)+装备效果+肉鸽卡牌 + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + + /// IActivityObject + function activityAdded(uint256 _tokenId, address /*_activity*/, address /*_user*/) auth public { + // to active the apostle when it do activity the first time + if (tokenId2Apostle[_tokenId].activeTime == 0) { + tokenId2Apostle[_tokenId].activeTime = uint48(now); + + emit Unbox(_tokenId, now); + } + + } + + function activityRemoved(uint256 /*_tokenId*/, address /*_activity*/, address /*_user*/) auth public { + // do nothing. + } + + /// IActivity + function activityStopped(uint256 /*_tokenId*/) auth public { + // do nothing. + } + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + Apostle storage apostle = tokenId2Apostle[_tokenId]; + return ( + apostle.genes, + apostle.talents, + apostle.matronId, + apostle.sireId, + uint256(apostle.cooldownIndex), + uint256(apostle.generation), + uint256(apostle.birthTime), + uint256(apostle.activeTime), + uint256(apostle.deadTime), + uint256(apostle.cooldownEndTime) + ); + } + + function _updateCoolDown() internal { + cooldowns[0] = uint32(1 minutes); + cooldowns[1] = uint32(2 minutes); + cooldowns[2] = uint32(5 minutes); + cooldowns[3] = uint32(10 minutes); + cooldowns[4] = uint32(30 minutes); + cooldowns[5] = uint32(1 hours); + cooldowns[6] = uint32(2 hours); + cooldowns[7] = uint32(4 hours); + cooldowns[8] = uint32(8 hours); + cooldowns[9] = uint32(16 hours); + cooldowns[10] = uint32(1 days); + cooldowns[11] = uint32(2 days); + cooldowns[12] = uint32(4 days); + cooldowns[13] = uint32(7 days); + } + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { + Apostle storage aps = tokenId2Apostle[_tokenId]; + aps.genes = _genes; + aps.talents = _talents; + } + + function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { + require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); + for(uint i = 0; i < _tokenIds.length; i++) { + Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; + aps.genes = _genesList[i]; + aps.talents = _talentsList[i]; + } + + } + + //v5 add + function classes(uint256 id) external pure returns (string memory desc) { + if (id == 0) { + return "None"; + } else if (id == 1) { + return "Saber"; + } else if (id == 2) { + return "Guard"; + } else if (id == 3) { + return "Miner"; + } + } + + function changeClass(uint256 tokenId, uint256 _class, uint256 _amountMax) external { + // require(equipment is null) + Apostle storage apo = tokenId2Apostle[tokenId]; + require(apo.class != _class, '!class'); + + uint256 changeClassFee = registry.uintOf(UINT_CHANGECLASS_FEE); + require(_amountMax >= changeClassFee, '!enough'); + IERC20 ring = IERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), changeClassFee), '!transfer'); + + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ring.approve(pool, changeClassFee); + IRevenuePool(pool).reward(ring, changeClassFee, msg.sender); + + apo.class = _class; + emit ClassChange(tokenId, apo.class); + } + + function get_equip_bar_name(uint256 slot) external pure returns (string memory desc) { + if (slot == 1) { + desc = "Right Hand Bar"; + } + } + + function _equip_check(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) private view { + address ownership = registry.addressOf(CONTRACT_OBJECT_OWNERSHIP); + require(msg.sender == ERC721(ownership).ownerOf(_apo_id), "!owner"); + require(_slot == 1, "!slot"); + require(bars[_apo_id][_slot].token == address(0), "exist"); + require(_equip_token == ownership, "!token"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + } + + function equip(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) external whenNotPaused { + _equip_check(_apo_id, _slot, _equip_token, _equip_id); + address encoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); + uint8 objectClass = IInterstellarEncoder(encoder).getObjectClass(_equip_id); + require(objectClass == ITEM_OBJECT_CLASS || objectClass == EQUIPMENT_OBJECT_CLASS, "!class"); + address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); + if (objectClass == ITEM_OBJECT_CLASS) { + (uint16 objectClassExt,uint16 class,) = IItemBase(objectClass).getBaseInfo(_equip_id); + require(objectClassExt == EQUIPMENT_OBJECT_CLASS, "!class"); + uint16 prefer = IItemBase(objectClass).getPrefer(_equip_id); + // tokenId2Apostle[_apo_id][] + } + ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); + bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); + statuses[_equip_token][_equip_id] = Status(_apo_id, _slot); + emit Equip(_apo_id, _slot, _equip_token, _equip_id); + } + + function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { + Bar memory bar = bars[_apo_id][_slot]; + require(bar.token != address(0), "!exist"); + require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); + delete statuses[bar.token][bar.id]; + delete bars[_apo_id][_slot]; + emit Divest(_apo_id, _slot, bar.token, bar.id); + } +} + + diff --git a/contracts/ApostleSettingIds.sol b/contracts/ApostleSettingIds.sol index 6b4f287..689ac55 100644 --- a/contracts/ApostleSettingIds.sol +++ b/contracts/ApostleSettingIds.sol @@ -11,6 +11,8 @@ contract ApostleSettingIds is SettingIds { /// the COO role as the gas price changes. bytes32 public constant UINT_AUTOBIRTH_FEE = "UINT_AUTOBIRTH_FEE"; + bytes32 public constant UINT_CHANGECLASS_FEE = "UINT_CHANGECLASS_FEE"; + bytes32 public constant CONTRACT_APOSTLE_BASE = "CONTRACT_APOSTLE_BASE"; bytes32 public constant CONTRACT_SIRING_AUCTION = "CONTRACT_SIRING_AUCTION"; @@ -33,4 +35,7 @@ contract ApostleSettingIds is SettingIds { bytes32 public constant CONTRACT_GEN0_APOSTLE = "CONTRACT_GEN0_APOSTLE"; + + uint8 public constant ITEM_OBJECT_CLASS = 5; // Item + uint8 public constant EQUIPMENT_OBJECT_CLASS = 6; //Equipment } diff --git a/contracts/interfaces/IInterstellarEncoder.sol b/contracts/interfaces/IInterstellarEncoder.sol new file mode 100644 index 0000000..eee3674 --- /dev/null +++ b/contracts/interfaces/IInterstellarEncoder.sol @@ -0,0 +1,45 @@ +pragma solidity ^0.4.24; + +interface IInterstellarEncoder { + function registerNewObjectClass(address _objectContract, uint8 objectClass) + external; + + function encodeTokenId( + address _tokenAddress, + uint8 _objectClass, + uint128 _objectIndex + ) external view returns (uint256 _tokenId); + + function encodeTokenIdForObjectContract( + address _tokenAddress, + address _objectContract, + uint128 _objectId + ) external view returns (uint256 _tokenId); + + function encodeTokenIdForOuterObjectContract( + address _objectContract, + address nftAddress, + address _originNftAddress, + uint128 _objectId, + uint16 _producerId, + uint8 _convertType + ) external view returns (uint256); + + function getContractAddress(uint256 _tokenId) + external + view + returns (address); + + function getObjectId(uint256 _tokenId) + external + view + returns (uint128 _objectId); + + function getObjectClass(uint256 _tokenId) external view returns (uint8); + + function getObjectAddress(uint256 _tokenId) external view returns (address); + + function getProducerId(uint256 _tokenId) external view returns (uint16); + + function getOriginAddress(uint256 _tokenId) external view returns (address); +} diff --git a/contracts/interfaces/IItemBase.sol b/contracts/interfaces/IItemBase.sol new file mode 100644 index 0000000..cadfda8 --- /dev/null +++ b/contracts/interfaces/IItemBase.sol @@ -0,0 +1,6 @@ +pragma solidity ^0.4.24; + +interface IItemBase { + function getBaseInfo(uint256 _tokenId) external view returns (uint16, uint16, uint16); + function getPrefer(uint256 _tokenId) external view returns (uint16); +} From 170523a60281080a33084852a96f9db3260e3c35 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 19 Nov 2021 20:45:02 +0800 Subject: [PATCH 49/64] apo support equip bar --- abi/ApostleBaseV5.abi | 2 +- abi/ICraftBase.abi | 1 + abi/IItemBase.abi | 2 +- contracts/ApostleBaseV5.sol | 48 ++++++++++++++++++++++------- contracts/interfaces/ICraftBase.sol | 5 +++ contracts/interfaces/IItemBase.sol | 1 + 6 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 abi/ICraftBase.abi create mode 100644 contracts/interfaces/ICraftBase.sol diff --git a/abi/ApostleBaseV5.abi b/abi/ApostleBaseV5.abi index a716886..ea3f605 100644 --- a/abi/ApostleBaseV5.abi +++ b/abi/ApostleBaseV5.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenId","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"extraPrefer","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenId","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"preferExtra","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ICraftBase.abi b/abi/ICraftBase.abi new file mode 100644 index 0000000..f05cb08 --- /dev/null +++ b/abi/ICraftBase.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"getMetaData","outputs":[{"name":"obj_id","type":"uint256"},{"name":"grade","type":"uint256"},{"name":"prefer","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/IItemBase.abi b/abi/IItemBase.abi index f5ee64f..bb51347 100644 --- a/abi/IItemBase.abi +++ b/abi/IItemBase.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getBaseInfo","outputs":[{"name":"","type":"uint16"},{"name":"","type":"uint16"},{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getPrefer","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"}] +[{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getObjectClassExt","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getBaseInfo","outputs":[{"name":"","type":"uint16"},{"name":"","type":"uint16"},{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getPrefer","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 51ba272..7a1adbc 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -17,6 +17,7 @@ import "./interfaces/IRevenuePool.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/IInterstellarEncoder.sol"; import "./interfaces/IItemBase.sol"; +import "./interfaces/ICraftBase.sol"; // all Ids in this contracts refer to index which is using 128-bit unsigned integers. // this is CONTRACT_APOSTLE_BASE @@ -74,7 +75,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec //v5 add uint256 class; - uint256 extraPrefer; + uint256 preferExtra; } uint32[14] public cooldowns = [ @@ -181,7 +182,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec cooldownIndex : uint16(coolDownIndex), generation : uint16(_generation), class: 0, - extraPrefer: 0 + preferExtra: 0 }); lastApostleObjectId += 1; @@ -600,7 +601,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } } - function _equip_check(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) private view { + function _equip_check(uint256 _apo_id, uint256 _slot, address _equip_token) private view { address ownership = registry.addressOf(CONTRACT_OBJECT_OWNERSHIP); require(msg.sender == ERC721(ownership).ownerOf(_apo_id), "!owner"); require(_slot == 1, "!slot"); @@ -610,28 +611,53 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } function equip(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) external whenNotPaused { - _equip_check(_apo_id, _slot, _equip_token, _equip_id); + _equip_check(_apo_id, _slot, _equip_token); address encoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); uint8 objectClass = IInterstellarEncoder(encoder).getObjectClass(_equip_id); require(objectClass == ITEM_OBJECT_CLASS || objectClass == EQUIPMENT_OBJECT_CLASS, "!class"); - address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); - if (objectClass == ITEM_OBJECT_CLASS) { - (uint16 objectClassExt,uint16 class,) = IItemBase(objectClass).getBaseInfo(_equip_id); - require(objectClassExt == EQUIPMENT_OBJECT_CLASS, "!class"); - uint16 prefer = IItemBase(objectClass).getPrefer(_equip_id); - // tokenId2Apostle[_apo_id][] - } + _update_extra_prefer(_apo_id, _equip_id, true); ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); statuses[_equip_token][_equip_id] = Status(_apo_id, _slot); emit Equip(_apo_id, _slot, _equip_token, _equip_id); } + function _update_extra_prefer(uint256 _apo_id, uint256 _equip_id, bool flag) internal { + uint256 prefer; + uint256 preferExtra = tokenId2Apostle[_apo_id].preferExtra; + address encoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); + address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); + uint8 objectClass = IInterstellarEncoder(encoder).getObjectClass(_equip_id); + if (objectClass == ITEM_OBJECT_CLASS) { + (uint16 objectClassExt, uint16 class,) = IItemBase(objectClass).getBaseInfo(_equip_id); + require(objectClassExt == EQUIPMENT_OBJECT_CLASS, "!class"); + prefer = IItemBase(objectAddress).getPrefer(_equip_id); + preferExtra = _calc_extra_prefer(prefer, preferExtra, class, flag); + } else if (objectClass == EQUIPMENT_OBJECT_CLASS) { + (,,prefer) = ICraftBase(objectAddress).getMetaData(_equip_id); + preferExtra = _calc_extra_prefer(prefer, preferExtra, 0, flag); + } + tokenId2Apostle[_apo_id].preferExtra = preferExtra; + } + + function _calc_extra_prefer(uint256 prefer, uint256 preferExtra, uint256 class, bool flag) internal pure returns (uint256 newPreferExtra) { + for (uint256 i = 1; i < 6; i++) { + if (prefer & (1 << i) > 0) { + if (flag) { + newPreferExtra = preferExtra + ((class + 1) << ((i-1) * 16)); + } else { + newPreferExtra = preferExtra - ((class + 1) << ((i-1) * 16)); + } + } + } + } + function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { Bar memory bar = bars[_apo_id][_slot]; require(bar.token != address(0), "!exist"); require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + _update_extra_prefer(_apo_id, bar.id, false); ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); delete statuses[bar.token][bar.id]; delete bars[_apo_id][_slot]; diff --git a/contracts/interfaces/ICraftBase.sol b/contracts/interfaces/ICraftBase.sol new file mode 100644 index 0000000..723696a --- /dev/null +++ b/contracts/interfaces/ICraftBase.sol @@ -0,0 +1,5 @@ +pragma solidity ^0.4.24; + +interface ICraftBase { + function getMetaData(uint256 tokenId) external view returns (uint obj_id, uint grade, uint prefer); +} diff --git a/contracts/interfaces/IItemBase.sol b/contracts/interfaces/IItemBase.sol index cadfda8..48c118f 100644 --- a/contracts/interfaces/IItemBase.sol +++ b/contracts/interfaces/IItemBase.sol @@ -3,4 +3,5 @@ pragma solidity ^0.4.24; interface IItemBase { function getBaseInfo(uint256 _tokenId) external view returns (uint16, uint16, uint16); function getPrefer(uint256 _tokenId) external view returns (uint16); + function getObjectClassExt(uint256 _tokenId) external view returns (uint16); } From e2aa83368673499ac7a21b3400bedcea9ee3ecad Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 23 Nov 2021 17:22:00 +0800 Subject: [PATCH 50/64] support equip bar & occupation --- abi/ApostleBase.abi | 2 +- abi/ApostleBaseV2.abi | 2 +- abi/ApostleBaseV3.abi | 2 +- abi/ApostleBaseV4.abi | 2 +- abi/ApostleBaseV5.abi | 2 +- abi/ApostleClockAuction.abi | 2 +- abi/ApostleClockAuctionV2.abi | 2 +- abi/ApostleClockAuctionV3.abi | 2 +- abi/ApostleSettingIds.abi | 2 +- abi/Gen0Apostle.abi | 2 +- abi/Gen0ApostleV2.abi | 2 +- abi/Gen0ApostleV3.abi | 2 +- abi/HarbergerPotionShop.abi | 2 +- abi/ICraftBase.abi | 2 +- abi/IGeneScienceV9.abi | 1 + abi/PetBase.abi | 2 +- abi/SiringAuctionBase.abi | 2 +- abi/SiringClockAuction.abi | 2 +- abi/SiringClockAuctionV2.abi | 2 +- abi/SiringClockAuctionV3.abi | 2 +- contracts/ApostleBaseV5.sol | 51 +++++++++++++------------ contracts/ApostleSettingIds.sol | 1 - contracts/interfaces/ICraftBase.sol | 2 +- contracts/interfaces/IGeneScienceV9.sol | 24 ++++++++++++ 24 files changed, 71 insertions(+), 46 deletions(-) create mode 100644 abi/IGeneScienceV9.abi create mode 100644 contracts/interfaces/IGeneScienceV9.sol diff --git a/abi/ApostleBase.abi b/abi/ApostleBase.abi index 634969b..60e8314 100644 --- a/abi/ApostleBase.abi +++ b/abi/ApostleBase.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV2.abi b/abi/ApostleBaseV2.abi index dcafc2b..c18acef 100644 --- a/abi/ApostleBaseV2.abi +++ b/abi/ApostleBaseV2.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV3.abi b/abi/ApostleBaseV3.abi index 1f03a19..c9ca247 100644 --- a/abi/ApostleBaseV3.abi +++ b/abi/ApostleBaseV3.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV4.abi b/abi/ApostleBaseV4.abi index 1f03a19..c9ca247 100644 --- a/abi/ApostleBaseV4.abi +++ b/abi/ApostleBaseV4.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleBaseV5.abi b/abi/ApostleBaseV5.abi index ea3f605..a4ff346 100644 --- a/abi/ApostleBaseV5.abi +++ b/abi/ApostleBaseV5.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenId","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"preferExtra","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenId","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getClassEnhance","outputs":[{"name":"enhance","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"preferExtra","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuction.abi b/abi/ApostleClockAuction.abi index f709bcf..76f74a3 100644 --- a/abi/ApostleClockAuction.abi +++ b/abi/ApostleClockAuction.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuctionV2.abi b/abi/ApostleClockAuctionV2.abi index c5a87e7..1f654d0 100644 --- a/abi/ApostleClockAuctionV2.abi +++ b/abi/ApostleClockAuctionV2.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleClockAuctionV3.abi b/abi/ApostleClockAuctionV3.abi index 2e9f278..9441ca1 100644 --- a/abi/ApostleClockAuctionV3.abi +++ b/abi/ApostleClockAuctionV3.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"},{"name":"firstPay","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimApostleAsset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint256"},{"name":"lastReferer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_referer","type":"address"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_price","type":"uint256"},{"name":"_cut","type":"uint256"}],"name":"computeCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"computeNextBidRecord","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startedAt","type":"uint48"},{"name":"duration","type":"uint48"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"token","type":"address"},{"name":"lastRecord","type":"uint128"},{"name":"lastBidder","type":"address"},{"name":"lastBidStartAt","type":"uint48"},{"name":"lastReferer","type":"address"},{"name":"firstPay","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getLastBidStartAt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"lastBidder","type":"address"},{"indexed":false,"name":"lastReferer","type":"address"},{"indexed":false,"name":"lastRecord","type":"uint256"},{"indexed":false,"name":"tokenAddress","type":"address"},{"indexed":false,"name":"bidStartAt","type":"uint256"},{"indexed":false,"name":"returnToLastBidder","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ApostleSettingIds.abi b/abi/ApostleSettingIds.abi index b8a161a..d75c98b 100644 --- a/abi/ApostleSettingIds.abi +++ b/abi/ApostleSettingIds.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/Gen0Apostle.abi b/abi/Gen0Apostle.abi index 1dc2421..b9d8d01 100644 --- a/abi/Gen0Apostle.abi +++ b/abi/Gen0Apostle.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/Gen0ApostleV2.abi b/abi/Gen0ApostleV2.abi index c476784..1b10880 100644 --- a/abi/Gen0ApostleV2.abi +++ b/abi/Gen0ApostleV2.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"TakeOut","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"TakeOut","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/Gen0ApostleV3.abi b/abi/Gen0ApostleV3.abi index 178050b..ae9942c 100644 --- a/abi/Gen0ApostleV3.abi +++ b/abi/Gen0ApostleV3.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0CreationLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"claimERC721Tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_gen0Limit","type":"uint256"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPriceInToken","type":"uint256"},{"name":"_endingPriceInToken","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_startAt","type":"uint256"},{"name":"_token","type":"address"}],"name":"createGen0Auction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gen0Count","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"},{"name":"_isApproved","type":"bool"}],"name":"setApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createGen0Apostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"ClaimedERC721Token","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/HarbergerPotionShop.abi b/abi/HarbergerPotionShop.abi index b1bcb85..41caa5a 100644 --- a/abi/HarbergerPotionShop.abi +++ b/abi/HarbergerPotionShop.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"buyPotion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"harbergLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"}],"name":"changeHabergEstimatePrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"stopHabergAndWithdrawFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"startHabergPotionModel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PotionState","outputs":[{"name":"estimatePrice","type":"uint256"},{"name":"availablePotionFund","type":"uint256"},{"name":"startTime","type":"uint48"},{"name":"boughtLifeTime","type":"uint48"},{"name":"lastUpdateTime","type":"uint48"},{"name":"isDead","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"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":"_tokenId","type":"uint256"},{"name":"_depositPotionFee","type":"uint256"}],"name":"forceBuy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"}],"name":"tryKillApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_token","type":"address"},{"indexed":true,"name":"_owner","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"buyPotion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"harbergLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"}],"name":"changeHabergEstimatePrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"stopHabergAndWithdrawFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_estimatePrice","type":"uint256"},{"name":"_ringAmount","type":"uint256"}],"name":"startHabergPotionModel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PotionState","outputs":[{"name":"estimatePrice","type":"uint256"},{"name":"availablePotionFund","type":"uint256"},{"name":"startTime","type":"uint48"},{"name":"boughtLifeTime","type":"uint48"},{"name":"lastUpdateTime","type":"uint48"},{"name":"isDead","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"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":"_tokenId","type":"uint256"},{"name":"_depositPotionFee","type":"uint256"}],"name":"forceBuy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"}],"name":"tryKillApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_token","type":"address"},{"indexed":true,"name":"_owner","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/ICraftBase.abi b/abi/ICraftBase.abi index f05cb08..36a8a00 100644 --- a/abi/ICraftBase.abi +++ b/abi/ICraftBase.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"getMetaData","outputs":[{"name":"obj_id","type":"uint256"},{"name":"grade","type":"uint256"},{"name":"prefer","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] +[{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"getMetaData","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/IGeneScienceV9.abi b/abi/IGeneScienceV9.abi new file mode 100644 index 0000000..a58c29c --- /dev/null +++ b/abi/IGeneScienceV9.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"_talents","type":"uint256"},{"name":"_mirrorTokenId","type":"uint256"}],"name":"enhanceWithMirrorToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matronGenes","type":"uint256"},{"name":"_sireGenes","type":"uint256"}],"name":"isOkWithRaceAndGender","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_addedTalents","type":"uint256"},{"name":"_mirrorTokenId","type":"uint256"}],"name":"removeMirrorToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isGeneScience","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"genes1","type":"uint256"},{"name":"genes2","type":"uint256"},{"name":"talents1","type":"uint256"},{"name":"talents2","type":"uint256"},{"name":"resouceToken","type":"address"},{"name":"level","type":"uint256"}],"name":"mixGenesAndTalents","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_talents","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"},{"name":"_preferExtra","type":"uint256"},{"name":"_classEnhance","type":"uint256"}],"name":"getStrength","outputs":[{"name":"miningStrength","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] diff --git a/abi/PetBase.abi b/abi/PetBase.abi index e1fc289..cc63729 100644 --- a/abi/PetBase.abi +++ b/abi/PetBase.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastPetObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_number","type":"uint128"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PetStatus","outputs":[{"name":"maxTiedNumber","type":"uint128"},{"name":"tiedCount","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_petTokenId","type":"uint256"}],"name":"untiePetToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"pet2TiedStatus","outputs":[{"name":"apostleTokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_originNftAddress","type":"address"},{"name":"_originTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"bridgeInAndTie","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"createPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_mirrorTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"tiePetTokenToApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleTokenId","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"getTiedPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxTiedNumber","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"Tied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"UnTied","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastPetObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"},{"name":"_number","type":"uint128"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2PetStatus","outputs":[{"name":"maxTiedNumber","type":"uint128"},{"name":"tiedCount","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_petTokenId","type":"uint256"}],"name":"untiePetToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"pet2TiedStatus","outputs":[{"name":"apostleTokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_originNftAddress","type":"address"},{"name":"_originTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"bridgeInAndTie","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"createPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_mirrorTokenId","type":"uint256"},{"name":"_apostleTokenId","type":"uint256"}],"name":"tiePetTokenToApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleTokenId","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"getTiedPet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxTiedNumber","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"Tied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"mirrorTokenId","type":"uint256"},{"indexed":false,"name":"enhancedTalents","type":"uint256"},{"indexed":false,"name":"changed","type":"bool"},{"indexed":false,"name":"originNFT","type":"address"},{"indexed":false,"name":"owner","type":"address"}],"name":"UnTied","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringAuctionBase.abi b/abi/SiringAuctionBase.abi index 9d50841..781e57a 100644 --- a/abi/SiringAuctionBase.abi +++ b/abi/SiringAuctionBase.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuction.abi b/abi/SiringClockAuction.abi index 61870a8..24fa921 100644 --- a/abi/SiringClockAuction.abi +++ b/abi/SiringClockAuction.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuctionV2.abi b/abi/SiringClockAuctionV2.abi index 61870a8..24fa921 100644 --- a/abi/SiringClockAuctionV2.abi +++ b/abi/SiringClockAuctionV2.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_valueInToken","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/abi/SiringClockAuctionV3.abi b/abi/SiringClockAuctionV3.abi index bd63f97..42faf9d 100644 --- a/abi/SiringClockAuctionV3.abi +++ b/abi/SiringClockAuctionV3.abi @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ITEM_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"bidWithToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPriceInToken","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"address"}],"name":"toBytes","outputs":[{"name":"b","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuctionWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenIdToAuction","outputs":[{"name":"seller","type":"address"},{"name":"startingPriceInToken","type":"uint128"},{"name":"endingPriceInToken","type":"uint128"},{"name":"duration","type":"uint48"},{"name":"startedAt","type":"uint48"},{"name":"token","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"seller","type":"address"},{"indexed":false,"name":"startingPriceInToken","type":"uint256"},{"indexed":false,"name":"endingPriceInToken","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"AuctionSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"AuctionCancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 7a1adbc..9f5617e 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -10,7 +10,7 @@ import "@evolutionland/common/contracts/interfaces/IActivity.sol"; import "@evolutionland/common/contracts/PausableDSAuth.sol"; import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; import "./ApostleSettingIds.sol"; -import "./interfaces/IGeneScience.sol"; +import "./interfaces/IGeneScienceV9.sol"; import "./interfaces/IHabergPotionShop.sol"; import "./interfaces/ILandBase.sol"; import "./interfaces/IRevenuePool.sol"; @@ -322,7 +322,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec Apostle storage sire = tokenId2Apostle[_sireId]; return _isValidMatingPair(matron, _matronId, sire, _sireId) && _isSiringPermitted(_sireId, _matronId) && - IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + IGeneScienceV9(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); } @@ -445,7 +445,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } // Call the sooper-sekret, sooper-expensive, gene mixing operation. - (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + (uint256 childGenes, uint256 childTalents) = IGeneScienceV9(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); // Make the new Apostle! @@ -489,10 +489,9 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec /// IMinerObject function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - // (天赋计算得到的基础数值(包括天赋加成装备效果))*(1+职业加成+元素加成)+装备效果+肉鸽卡牌 - uint talents = tokenId2Apostle[_tokenId].talents; - return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(talents, _resourceToken, _landTokenId); + Apostle memory apo = tokenId2Apostle[_tokenId]; + return IGeneScienceV9(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(apo.talents, _resourceToken, _landTokenId, apo.preferExtra, getClassEnhance(apo.class)); } /// IActivityObject @@ -577,7 +576,17 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } } + function getClassEnhance(uint256 id) public pure returns (uint256 enhance) { + if (id == 3) { + enhance = 3; + } + } + function changeClass(uint256 tokenId, uint256 _class, uint256 _amountMax) external { + require(1 <= _class && _class <= 2, "!class"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(tokenId), "!use"); + require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(tokenId), "!owner"); + // require(equipment is null) Apostle storage apo = tokenId2Apostle[tokenId]; require(apo.class != _class, '!class'); @@ -613,30 +622,20 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec function equip(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) external whenNotPaused { _equip_check(_apo_id, _slot, _equip_token); address encoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); - uint8 objectClass = IInterstellarEncoder(encoder).getObjectClass(_equip_id); - require(objectClass == ITEM_OBJECT_CLASS || objectClass == EQUIPMENT_OBJECT_CLASS, "!class"); - _update_extra_prefer(_apo_id, _equip_id, true); + require(IInterstellarEncoder(encoder).getObjectClass(_equip_id) == EQUIPMENT_OBJECT_CLASS, "!eclass"); + address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); + (uint256 obj_id,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(_equip_id); + require(tokenId2Apostle[_apo_id].class == class, "!aclass"); + _update_extra_prefer(_apo_id, prefer, class, true); ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); statuses[_equip_token][_equip_id] = Status(_apo_id, _slot); emit Equip(_apo_id, _slot, _equip_token, _equip_id); } - function _update_extra_prefer(uint256 _apo_id, uint256 _equip_id, bool flag) internal { - uint256 prefer; + function _update_extra_prefer(uint256 _apo_id, uint256 prefer, uint256 class, bool flag) internal { uint256 preferExtra = tokenId2Apostle[_apo_id].preferExtra; - address encoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); - address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); - uint8 objectClass = IInterstellarEncoder(encoder).getObjectClass(_equip_id); - if (objectClass == ITEM_OBJECT_CLASS) { - (uint16 objectClassExt, uint16 class,) = IItemBase(objectClass).getBaseInfo(_equip_id); - require(objectClassExt == EQUIPMENT_OBJECT_CLASS, "!class"); - prefer = IItemBase(objectAddress).getPrefer(_equip_id); - preferExtra = _calc_extra_prefer(prefer, preferExtra, class, flag); - } else if (objectClass == EQUIPMENT_OBJECT_CLASS) { - (,,prefer) = ICraftBase(objectAddress).getMetaData(_equip_id); - preferExtra = _calc_extra_prefer(prefer, preferExtra, 0, flag); - } + preferExtra = _calc_extra_prefer(prefer, preferExtra, class, flag); tokenId2Apostle[_apo_id].preferExtra = preferExtra; } @@ -657,7 +656,9 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec require(bar.token != address(0), "!exist"); require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); - _update_extra_prefer(_apo_id, bar.id, false); + address objectAddress = IInterstellarEncoder(registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER)).getObjectAddress(bar.id); + (uint256 obj_id,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(bar.id); + _update_extra_prefer(_apo_id, prefer, class, false); ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); delete statuses[bar.token][bar.id]; delete bars[_apo_id][_slot]; diff --git a/contracts/ApostleSettingIds.sol b/contracts/ApostleSettingIds.sol index 689ac55..5aa7acd 100644 --- a/contracts/ApostleSettingIds.sol +++ b/contracts/ApostleSettingIds.sol @@ -36,6 +36,5 @@ contract ApostleSettingIds is SettingIds { bytes32 public constant CONTRACT_GEN0_APOSTLE = "CONTRACT_GEN0_APOSTLE"; - uint8 public constant ITEM_OBJECT_CLASS = 5; // Item uint8 public constant EQUIPMENT_OBJECT_CLASS = 6; //Equipment } diff --git a/contracts/interfaces/ICraftBase.sol b/contracts/interfaces/ICraftBase.sol index 723696a..ff5ff2a 100644 --- a/contracts/interfaces/ICraftBase.sol +++ b/contracts/interfaces/ICraftBase.sol @@ -1,5 +1,5 @@ pragma solidity ^0.4.24; interface ICraftBase { - function getMetaData(uint256 tokenId) external view returns (uint obj_id, uint grade, uint prefer); + function getMetaData(uint256 tokenId) external view returns (uint, uint, uint, uint); } diff --git a/contracts/interfaces/IGeneScienceV9.sol b/contracts/interfaces/IGeneScienceV9.sol new file mode 100644 index 0000000..2a95483 --- /dev/null +++ b/contracts/interfaces/IGeneScienceV9.sol @@ -0,0 +1,24 @@ +pragma solidity ^0.4.24; + + +/// @title defined the interface that will be referenced in main Kitty contract +contract IGeneScienceV9 { + /// @dev simply a boolean to indicate this is the contract we expect to be + function isGeneScience() public pure returns (bool); + + /// @dev given genes of apostle 1 & 2, return a genetic combination - may have a random factor + /// @param genes1 genes of mom + /// @param genes2 genes of sire + /// @param talents1 talents of mom + /// @param talents2 talents of sire + /// @return the genes and talents that are supposed to be passed down the child + function mixGenesAndTalents(uint256 genes1, uint256 genes2, uint256 talents1, uint256 talents2, address resouceToken, uint256 level) public returns (uint256, uint256); + + function getStrength(uint256 _talents, address _resourceToken, uint256 _landTokenId, uint256 _preferExtra, uint256 _classEnhance) public view returns (uint256 miningStrength); + + function isOkWithRaceAndGender(uint _matronGenes, uint _sireGenes) public view returns (bool); + + function enhanceWithMirrorToken(uint256 _talents, uint256 _mirrorTokenId) public view returns (uint256); + + function removeMirrorToken(uint256 _addedTalents, uint256 _mirrorTokenId) public view returns (uint256); +} From 8f01e91c6e1c765b53caa005dfd3a06acaf594d8 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 24 Nov 2021 10:34:37 +0800 Subject: [PATCH 51/64] occupation --- contracts/ApostleBaseV5.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 9f5617e..61e6ea1 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -625,7 +625,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec require(IInterstellarEncoder(encoder).getObjectClass(_equip_id) == EQUIPMENT_OBJECT_CLASS, "!eclass"); address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); (uint256 obj_id,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(_equip_id); - require(tokenId2Apostle[_apo_id].class == class, "!aclass"); + require(tokenId2Apostle[_apo_id].class == obj_id, "!aclass"); _update_extra_prefer(_apo_id, prefer, class, true); ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); From 2f00795f6aac9b5e833a582538673543052c6ff6 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 24 Nov 2021 10:35:32 +0800 Subject: [PATCH 52/64] rm unused va --- contracts/ApostleBaseV5.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 61e6ea1..14284b5 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -657,7 +657,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); address objectAddress = IInterstellarEncoder(registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER)).getObjectAddress(bar.id); - (uint256 obj_id,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(bar.id); + (,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(bar.id); _update_extra_prefer(_apo_id, prefer, class, false); ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); delete statuses[bar.token][bar.id]; From 8cd2ca57e8e2ebdffbbbc4c6382dee8c01a83f58 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 24 Nov 2021 13:07:34 +0800 Subject: [PATCH 53/64] check before change class --- contracts/ApostleBaseV5.sol | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 14284b5..54dd469 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -582,13 +582,13 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } } - function changeClass(uint256 tokenId, uint256 _class, uint256 _amountMax) external { + function changeClass(uint256 _apo_id, uint256 _class, uint256 _amountMax) external { require(1 <= _class && _class <= 2, "!class"); - require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(tokenId), "!use"); - require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(tokenId), "!owner"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); - // require(equipment is null) - Apostle storage apo = tokenId2Apostle[tokenId]; + require(isEmptyBar(_apo_id), "!empty"); + Apostle storage apo = tokenId2Apostle[_apo_id]; require(apo.class != _class, '!class'); uint256 changeClassFee = registry.uintOf(UINT_CHANGECLASS_FEE); @@ -601,7 +601,11 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec IRevenuePool(pool).reward(ring, changeClassFee, msg.sender); apo.class = _class; - emit ClassChange(tokenId, apo.class); + emit ClassChange(_apo_id, apo.class); + } + + function isEmptyBar(uint256 _apo_id) public view returns (bool) { + return bars[_apo_id][1].token == address(0); } function get_equip_bar_name(uint256 slot) external pure returns (string memory desc) { From 2f1452546d71899aaeb99d7b9677930aa1705d65 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 24 Nov 2021 19:34:31 +0800 Subject: [PATCH 54/64] exist --- abi/ApostleBaseV5.abi | 2 +- contracts/ApostleBaseV5.sol | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/abi/ApostleBaseV5.abi b/abi/ApostleBaseV5.abi index a4ff346..bad5c29 100644 --- a/abi/ApostleBaseV5.abi +++ b/abi/ApostleBaseV5.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenId","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getClassEnhance","outputs":[{"name":"enhance","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"preferExtra","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"}],"name":"isEmptyBar","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getClassEnhance","outputs":[{"name":"enhance","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"exist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"preferExtra","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 54dd469..1bfd063 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -604,6 +604,10 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec emit ClassChange(_apo_id, apo.class); } + function exist(uint256 _apo_id, uint256 _slot) public view returns (bool) { + return bars[_apo_id][_slot].token != address(0); + } + function isEmptyBar(uint256 _apo_id) public view returns (bool) { return bars[_apo_id][1].token == address(0); } From 121d7b9fdb4868cf49c2364652dfe74ef3a34f91 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 24 Nov 2021 19:53:50 +0800 Subject: [PATCH 55/64] fmt --- contracts/ApostleBaseV5.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 1bfd063..ef051f0 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -585,7 +585,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec function changeClass(uint256 _apo_id, uint256 _class, uint256 _amountMax) external { require(1 <= _class && _class <= 2, "!class"); require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); - require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); + require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); require(isEmptyBar(_apo_id), "!empty"); Apostle storage apo = tokenId2Apostle[_apo_id]; @@ -620,7 +620,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec function _equip_check(uint256 _apo_id, uint256 _slot, address _equip_token) private view { address ownership = registry.addressOf(CONTRACT_OBJECT_OWNERSHIP); - require(msg.sender == ERC721(ownership).ownerOf(_apo_id), "!owner"); + require(msg.sender == ERC721(ownership).ownerOf(_apo_id), "!owner"); require(_slot == 1, "!slot"); require(bars[_apo_id][_slot].token == address(0), "exist"); require(_equip_token == ownership, "!token"); @@ -662,7 +662,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { Bar memory bar = bars[_apo_id][_slot]; require(bar.token != address(0), "!exist"); - require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); + require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); address objectAddress = IInterstellarEncoder(registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER)).getObjectAddress(bar.id); (,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(bar.id); From 103ef0137a42c3cc610738d96c5b60b099118d9a Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 25 Nov 2021 14:16:17 +0800 Subject: [PATCH 56/64] abi --- abi/ApostleBaseV5.abi | 2 +- contracts/ApostleBaseV5.sol | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/abi/ApostleBaseV5.abi b/abi/ApostleBaseV5.abi index bad5c29..d85807c 100644 --- a/abi/ApostleBaseV5.abi +++ b/abi/ApostleBaseV5.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"}],"name":"isEmptyBar","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getClassEnhance","outputs":[{"name":"enhance","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"exist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"preferExtra","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"}],"name":"isEmptyBar","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getClassEnhance","outputs":[{"name":"enhance","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"exist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"preferExtra","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"},{"indexed":false,"name":"preferExtra","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"},{"indexed":false,"name":"preferExtra","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index ef051f0..1675d19 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -42,8 +42,8 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec event Unbox(uint256 tokenId, uint256 activeTime); // V5 add - event Equip(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); - event Divest(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + event Equip(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id, uint256 preferExtra); + event Divest(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id, uint256 preferExtra); struct Apostle { // An apostles genes never change. @@ -514,7 +514,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec // do nothing. } - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { Apostle storage apostle = tokenId2Apostle[_tokenId]; return ( apostle.genes, @@ -526,7 +526,9 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec uint256(apostle.birthTime), uint256(apostle.activeTime), uint256(apostle.deadTime), - uint256(apostle.cooldownEndTime) + uint256(apostle.cooldownEndTime), + uint256(apostle.class), + uint256(apostle.preferExtra) ); } @@ -634,15 +636,15 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); (uint256 obj_id,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(_equip_id); require(tokenId2Apostle[_apo_id].class == obj_id, "!aclass"); - _update_extra_prefer(_apo_id, prefer, class, true); + uint256 preferExtra = _update_extra_prefer(_apo_id, prefer, class, true); ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); statuses[_equip_token][_equip_id] = Status(_apo_id, _slot); - emit Equip(_apo_id, _slot, _equip_token, _equip_id); + emit Equip(_apo_id, _slot, _equip_token, _equip_id, preferExtra); } - function _update_extra_prefer(uint256 _apo_id, uint256 prefer, uint256 class, bool flag) internal { - uint256 preferExtra = tokenId2Apostle[_apo_id].preferExtra; + function _update_extra_prefer(uint256 _apo_id, uint256 prefer, uint256 class, bool flag) internal returns (uint256 preferExtra) { + preferExtra = tokenId2Apostle[_apo_id].preferExtra; preferExtra = _calc_extra_prefer(prefer, preferExtra, class, flag); tokenId2Apostle[_apo_id].preferExtra = preferExtra; } @@ -666,11 +668,11 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); address objectAddress = IInterstellarEncoder(registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER)).getObjectAddress(bar.id); (,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(bar.id); - _update_extra_prefer(_apo_id, prefer, class, false); + uint256 preferExtra = _update_extra_prefer(_apo_id, prefer, class, false); ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); delete statuses[bar.token][bar.id]; delete bars[_apo_id][_slot]; - emit Divest(_apo_id, _slot, bar.token, bar.id); + emit Divest(_apo_id, _slot, bar.token, bar.id, preferExtra); } } From a16fc46322c6426ba9c3be31ac31186cbd5a917f Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 9 Dec 2021 11:20:38 +0800 Subject: [PATCH 57/64] rm `preferExtra --- contracts/ApostleBaseV5.sol | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 1675d19..0ef8cc8 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -42,8 +42,8 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec event Unbox(uint256 tokenId, uint256 activeTime); // V5 add - event Equip(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id, uint256 preferExtra); - event Divest(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id, uint256 preferExtra); + event Equip(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + event Divest(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); struct Apostle { // An apostles genes never change. @@ -636,11 +636,11 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); (uint256 obj_id,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(_equip_id); require(tokenId2Apostle[_apo_id].class == obj_id, "!aclass"); - uint256 preferExtra = _update_extra_prefer(_apo_id, prefer, class, true); + _update_extra_prefer(_apo_id, prefer, class, true); ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); statuses[_equip_token][_equip_id] = Status(_apo_id, _slot); - emit Equip(_apo_id, _slot, _equip_token, _equip_id, preferExtra); + emit Equip(_apo_id, _slot, _equip_token, _equip_id); } function _update_extra_prefer(uint256 _apo_id, uint256 prefer, uint256 class, bool flag) internal returns (uint256 preferExtra) { @@ -668,11 +668,11 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); address objectAddress = IInterstellarEncoder(registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER)).getObjectAddress(bar.id); (,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(bar.id); - uint256 preferExtra = _update_extra_prefer(_apo_id, prefer, class, false); + _update_extra_prefer(_apo_id, prefer, class, false); ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); delete statuses[bar.token][bar.id]; delete bars[_apo_id][_slot]; - emit Divest(_apo_id, _slot, bar.token, bar.id, preferExtra); + emit Divest(_apo_id, _slot, bar.token, bar.id); } } From de967846a06117605e19c45fc699b83c7bcda08b Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 14 Dec 2021 14:56:08 +0800 Subject: [PATCH 58/64] rm preferExtra --- abi/ApostleBaseV5.abi | 2 +- contracts/ApostleBaseV5.sol | 51 ++++++++----------------------------- 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/abi/ApostleBaseV5.abi b/abi/ApostleBaseV5.abi index d85807c..d0f19ea 100644 --- a/abi/ApostleBaseV5.abi +++ b/abi/ApostleBaseV5.abi @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"}],"name":"isEmptyBar","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getClassEnhance","outputs":[{"name":"enhance","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"exist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"},{"name":"preferExtra","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"},{"indexed":false,"name":"preferExtra","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"},{"indexed":false,"name":"preferExtra","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"}],"name":"updateGenesAndTalents","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_USER_POINTS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUTOBIRTH_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityAdded","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"}],"name":"isEmptyBar","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GEN0_APOSTLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_BRIDGE_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GENE_SCIENCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_BRIDGE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"}],"name":"activityRemoved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WATER_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_GOLD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isDead","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_RING_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_AUCTION_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"},{"name":"_equip_token","type":"address"},{"name":"_equip_id","type":"uint256"}],"name":"equip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"sireAllowedToAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_LOCATION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"divest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"canBreedWith","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_sireId","type":"uint256"}],"name":"approveSiring","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"bars","outputs":[{"name":"token","type":"address"},{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_class","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"changeClass","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_MIX_TALENT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_KTON_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"statuses","outputs":[{"name":"tokenId","type":"uint256"},{"name":"index","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_WOOD_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apo_id","type":"uint256"},{"name":"_slot","type":"uint256"}],"name":"exist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SIRING_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FIRE_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"activityStopped","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_HABERG_POTION_SHOP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tokenId2Apostle","outputs":[{"name":"genes","type":"uint256"},{"name":"talents","type":"uint256"},{"name":"matronId","type":"uint256"},{"name":"sireId","type":"uint256"},{"name":"siringWithId","type":"uint256"},{"name":"cooldownIndex","type":"uint16"},{"name":"generation","type":"uint16"},{"name":"birthTime","type":"uint48"},{"name":"activeTime","type":"uint48"},{"name":"deadTime","type":"uint48"},{"name":"cooldownEndTime","type":"uint48"},{"name":"class","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_INTERSTELLAR_ENCODER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"classes","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_PET_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_SOIL_ERC20_TOKEN","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_AUCTION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_HABERG_POTION_TAX_RATE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"killApostle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"breedWithAuto","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UINT_APOSTLE_BID_WAITING_TIME","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_OBJECT_OWNERSHIP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_CHANGECLASS_FEE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"slot","type":"uint256"}],"name":"get_equip_bar_name","outputs":[{"name":"desc","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_TOKEN_USE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"}],"name":"breedWithInAuction","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"},{"name":"_genesList","type":"uint256[]"},{"name":"_talentsList","type":"uint256[]"}],"name":"batchUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastApostleObjectId","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_level","type":"uint256"},{"name":"_amountMax","type":"uint256"}],"name":"giveBirth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_APOSTLE_BASE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"initializeContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ERC721_BRIDGE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_REVENUE_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EQUIPMENT_OBJECT_CLASS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_resourceToken","type":"address"},{"name":"_landTokenId","type":"uint256"}],"name":"strengthOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_resourceToken","type":"address"}],"name":"isValidResourceToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_apostleId","type":"uint256"}],"name":"isReadyToBreed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_LAND_RESOURCE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matronId","type":"uint256"},{"name":"_sireId","type":"uint256"},{"name":"_generation","type":"uint256"},{"name":"_genes","type":"uint256"},{"name":"_talents","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createApostle","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCooldownDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_REFERER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApostleInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UINT_TOKEN_OFFER_CUT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_DIVIDENDS_POOL","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"defaultLifeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"apostleTokenId","type":"uint256"},{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"genes","type":"uint256"},{"indexed":false,"name":"talents","type":"uint256"},{"indexed":false,"name":"coolDownIndex","type":"uint256"},{"indexed":false,"name":"generation","type":"uint256"},{"indexed":false,"name":"birthTime","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"matronCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"matronCoolDownIndex","type":"uint256"},{"indexed":false,"name":"sireId","type":"uint256"},{"indexed":false,"name":"sireCoolDownEndTime","type":"uint256"},{"indexed":false,"name":"sireCoolDownIndex","type":"uint256"}],"name":"Pregnant","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"class","type":"uint256"}],"name":"ClassChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matronId","type":"uint256"},{"indexed":false,"name":"cooldownEndTime","type":"uint256"}],"name":"AutoBirth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"activeTime","type":"uint256"}],"name":"Unbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Equip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_apo_id","type":"uint256"},{"indexed":false,"name":"_slot","type":"uint256"},{"indexed":false,"name":"_equip_token","type":"address"},{"indexed":false,"name":"_equip_id","type":"uint256"}],"name":"Divest","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 0ef8cc8..520397f 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -10,7 +10,7 @@ import "@evolutionland/common/contracts/interfaces/IActivity.sol"; import "@evolutionland/common/contracts/PausableDSAuth.sol"; import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; import "./ApostleSettingIds.sol"; -import "./interfaces/IGeneScienceV9.sol"; +import "./interfaces/IGeneScience.sol"; import "./interfaces/IHabergPotionShop.sol"; import "./interfaces/ILandBase.sol"; import "./interfaces/IRevenuePool.sol"; @@ -75,7 +75,6 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec //v5 add uint256 class; - uint256 preferExtra; } uint32[14] public cooldowns = [ @@ -181,8 +180,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec siringWithId : 0, cooldownIndex : uint16(coolDownIndex), generation : uint16(_generation), - class: 0, - preferExtra: 0 + class: 0 }); lastApostleObjectId += 1; @@ -322,7 +320,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec Apostle storage sire = tokenId2Apostle[_sireId]; return _isValidMatingPair(matron, _matronId, sire, _sireId) && _isSiringPermitted(_sireId, _matronId) && - IGeneScienceV9(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); } @@ -445,7 +443,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } // Call the sooper-sekret, sooper-expensive, gene mixing operation. - (uint256 childGenes, uint256 childTalents) = IGeneScienceV9(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); // Make the new Apostle! @@ -489,9 +487,9 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec /// IMinerObject function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { - Apostle memory apo = tokenId2Apostle[_tokenId]; - return IGeneScienceV9(registry.addressOf(CONTRACT_GENE_SCIENCE)) - .getStrength(apo.talents, _resourceToken, _landTokenId, apo.preferExtra, getClassEnhance(apo.class)); + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); } /// IActivityObject @@ -514,7 +512,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec // do nothing. } - function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { Apostle storage apostle = tokenId2Apostle[_tokenId]; return ( apostle.genes, @@ -527,8 +525,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec uint256(apostle.activeTime), uint256(apostle.deadTime), uint256(apostle.cooldownEndTime), - uint256(apostle.class), - uint256(apostle.preferExtra) + uint256(apostle.class) ); } @@ -578,12 +575,6 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } } - function getClassEnhance(uint256 id) public pure returns (uint256 enhance) { - if (id == 3) { - enhance = 3; - } - } - function changeClass(uint256 _apo_id, uint256 _class, uint256 _amountMax) external { require(1 <= _class && _class <= 2, "!class"); require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); @@ -634,41 +625,19 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec address encoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); require(IInterstellarEncoder(encoder).getObjectClass(_equip_id) == EQUIPMENT_OBJECT_CLASS, "!eclass"); address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); - (uint256 obj_id,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(_equip_id); + (uint256 obj_id,,,) = ICraftBase(objectAddress).getMetaData(_equip_id); require(tokenId2Apostle[_apo_id].class == obj_id, "!aclass"); - _update_extra_prefer(_apo_id, prefer, class, true); ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); statuses[_equip_token][_equip_id] = Status(_apo_id, _slot); emit Equip(_apo_id, _slot, _equip_token, _equip_id); } - function _update_extra_prefer(uint256 _apo_id, uint256 prefer, uint256 class, bool flag) internal returns (uint256 preferExtra) { - preferExtra = tokenId2Apostle[_apo_id].preferExtra; - preferExtra = _calc_extra_prefer(prefer, preferExtra, class, flag); - tokenId2Apostle[_apo_id].preferExtra = preferExtra; - } - - function _calc_extra_prefer(uint256 prefer, uint256 preferExtra, uint256 class, bool flag) internal pure returns (uint256 newPreferExtra) { - for (uint256 i = 1; i < 6; i++) { - if (prefer & (1 << i) > 0) { - if (flag) { - newPreferExtra = preferExtra + ((class + 1) << ((i-1) * 16)); - } else { - newPreferExtra = preferExtra - ((class + 1) << ((i-1) * 16)); - } - } - } - } - function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { Bar memory bar = bars[_apo_id][_slot]; require(bar.token != address(0), "!exist"); require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); - address objectAddress = IInterstellarEncoder(registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER)).getObjectAddress(bar.id); - (,,uint256 class, uint256 prefer) = ICraftBase(objectAddress).getMetaData(bar.id); - _update_extra_prefer(_apo_id, prefer, class, false); ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); delete statuses[bar.token][bar.id]; delete bars[_apo_id][_slot]; From a7a7669ebb9c56b4189ca4132f1fb14b3551b7c4 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 28 Dec 2021 11:07:08 +0800 Subject: [PATCH 59/64] add usr when equip --- contracts/ApostleBaseV5.sol | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol index 520397f..c53004d 100644 --- a/contracts/ApostleBaseV5.sol +++ b/contracts/ApostleBaseV5.sol @@ -42,7 +42,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec event Unbox(uint256 tokenId, uint256 activeTime); // V5 add - event Equip(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + event Equip(address indexed usr, uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); event Divest(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); struct Apostle { @@ -611,17 +611,18 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } } - function _equip_check(uint256 _apo_id, uint256 _slot, address _equip_token) private view { + function _equip_check(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) private view { address ownership = registry.addressOf(CONTRACT_OBJECT_OWNERSHIP); require(msg.sender == ERC721(ownership).ownerOf(_apo_id), "!owner"); require(_slot == 1, "!slot"); require(bars[_apo_id][_slot].token == address(0), "exist"); require(_equip_token == ownership, "!token"); + require(msg.sender == ERC721(_equip_token).ownerOf(_equip_id), "!owner"); require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); } function equip(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) external whenNotPaused { - _equip_check(_apo_id, _slot, _equip_token); + _equip_check(_apo_id, _slot, _equip_token, _equip_id); address encoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); require(IInterstellarEncoder(encoder).getObjectClass(_equip_id) == EQUIPMENT_OBJECT_CLASS, "!eclass"); address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); @@ -630,7 +631,7 @@ contract ApostleBaseV5 is SupportsInterfaceWithLookup, IActivity, IActivityObjec ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); statuses[_equip_token][_equip_id] = Status(_apo_id, _slot); - emit Equip(_apo_id, _slot, _equip_token, _equip_id); + emit Equip(msg.sender, _apo_id, _slot, _equip_token, _equip_id); } function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { From 83d26667982028dc0ca29f7e12ea98053258ca82 Mon Sep 17 00:00:00 2001 From: echo Date: Mon, 14 Feb 2022 11:11:11 +0800 Subject: [PATCH 60/64] can skip mix talent --- contracts/ApostleBaseV6.sol | 650 ++++++++++++++++++++++++++++++++++++ 1 file changed, 650 insertions(+) create mode 100644 contracts/ApostleBaseV6.sol diff --git a/contracts/ApostleBaseV6.sol b/contracts/ApostleBaseV6.sol new file mode 100644 index 0000000..f121468 --- /dev/null +++ b/contracts/ApostleBaseV6.sol @@ -0,0 +1,650 @@ +pragma solidity ^0.4.24; + +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; +import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivity.sol"; +import "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; +import "./ApostleSettingIds.sol"; +import "./interfaces/IGeneScience.sol"; +import "./interfaces/IHabergPotionShop.sol"; +import "./interfaces/ILandBase.sol"; +import "./interfaces/IRevenuePool.sol"; +import "./interfaces/IERC20.sol"; +import "./interfaces/IInterstellarEncoder.sol"; +import "./interfaces/IItemBase.sol"; +import "./interfaces/ICraftBase.sol"; + +// all Ids in this contracts refer to index which is using 128-bit unsigned integers. +// this is CONTRACT_APOSTLE_BASE +// V4: giveBirth must use resource +// V5: add classes +contract ApostleBaseV6 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { + + event Birth( + address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime + ); + event Pregnant( + uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex + ); + //V5 add + event ClassChange(uint256 tokenId, uint256 class); + + /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() + /// function. This is used to notify the auto-birth daemon that this breeding action + /// included a pre-payment of the gas required to call the giveBirth() function. + event AutoBirth(uint256 matronId, uint256 cooldownEndTime); + + event Unbox(uint256 tokenId, uint256 activeTime); + + // V5 add + event Equip(address indexed usr, uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + event Divest(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + + struct Apostle { + // An apostles genes never change. + uint256 genes; + + uint256 talents; + + // the ID of the parents of this Apostle. set to 0 for gen0 apostle. + // Note that using 128-bit unsigned integers to represent parents IDs, + // which refer to lastApostleObjectId for those two. + uint256 matronId; + uint256 sireId; + + // Set to the ID of the sire apostle for matrons that are pregnant, + // zero otherwise. A non-zero value here is how we know an apostle + // is pregnant. Used to retrieve the genetic material for the new + // apostle when the birth transpires. + uint256 siringWithId; + // Set to the index in the cooldown array (see below) that represents + // the current cooldown duration for this apostle. + uint16 cooldownIndex; + // The "generation number" of this apostle. + uint16 generation; + + uint48 birthTime; + uint48 activeTime; + uint48 deadTime; + uint48 cooldownEndTime; + + //v5 add + uint256 class; + } + + uint32[14] public cooldowns = [ + uint32(1 minutes), + uint32(2 minutes), + uint32(5 minutes), + uint32(10 minutes), + uint32(30 minutes), + uint32(1 hours), + uint32(2 hours), + uint32(4 hours), + uint32(8 hours), + uint32(16 hours), + uint32(1 days), + uint32(2 days), + uint32(4 days), + uint32(7 days) + ]; + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + + /*** STORAGE ***/ + bool private singletonLock = false; + + uint128 public lastApostleObjectId; + + ISettingsRegistry public registry; + + mapping(uint256 => Apostle) public tokenId2Apostle; + + mapping(uint256 => address) public sireAllowedToAddress; + + // apostle bar + struct Bar { + address token; + uint256 id; + } + + // bar status + struct Status { + uint256 tokenId; + uint256 index; + } + + // V5 add + // apoTokenId => (apoBarIndex => Bar) + mapping(uint256 => mapping(uint256 => Bar)) public bars; + // equipmentTokenAddress => equipmentId => status + mapping(address => mapping(uint256 => Status)) public statuses; + + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + + _registerInterface(InterfaceId_IActivity); + _registerInterface(InterfaceId_IActivityObject); + _registerInterface(InterfaceId_IMinerObject); + _updateCoolDown(); + + } + + // called by gen0Apostle + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { + _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); + } + + function _createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { + + require(_generation <= 65535); + uint256 coolDownIndex = _generation / 2; + if (coolDownIndex > 13) { + coolDownIndex = 13; + } + + Apostle memory apostle = Apostle({ + genes : _genes, + talents : _talents, + birthTime : uint48(now), + activeTime : 0, + deadTime : 0, + cooldownEndTime : 0, + matronId : _matronId, + sireId : _sireId, + siringWithId : 0, + cooldownIndex : uint16(coolDownIndex), + generation : uint16(_generation), + class: 0 + }); + + lastApostleObjectId += 1; + require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); + + tokenId2Apostle[tokenId] = apostle; + + emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); + + return tokenId; + } + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ + uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; + return cooldowns[cooldownIndex]; + } + + // @dev Checks to see if a apostle is able to breed. + // @param _apostleId - index of apostles which is within uint128. + function isReadyToBreed(uint256 _apostleId) + public + view + returns (bool) + { + require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); + + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); + + // In addition to checking the cooldownEndTime, we also need to check to see if + // the cat has a pending birth; there can be some period of time between the end + // of the pregnacy timer and the birth event. + return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); + } + + function approveSiring(address _addr, uint256 _sireId) + public + whenNotPaused + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_sireId) == msg.sender); + + sireAllowedToAddress[_sireId] = _addr; + } + + // check apostle's owner or siring permission + function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + address matronOwner = objectOwnership.ownerOf(_matronId); + address sireOwner = objectOwnership.ownerOf(_sireId); + + // Siring is okay if they have same owner, or if the matron's owner was given + // permission to breed with this sire. + return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); + } + + function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { + + Apostle storage aps = tokenId2Apostle[_tokenId]; + // Compute the end of the cooldown time (based on current cooldownIndex) + aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); + + // Increment the breeding count, clamping it at 13, which is the length of the + // cooldowns array. We could check the array size dynamically, but hard-coding + // this as a constant saves gas. Yay, Solidity! + if (aps.cooldownIndex < 13) { + aps.cooldownIndex += 1; + } + + // address(0) meaning use by its owner or whitelisted contract + ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); + + return uint256(aps.cooldownEndTime); + + } + + function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { + return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); + } + + /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT + /// check ownership permissions (that is up to the caller). + /// @param _matron A reference to the apostle struct of the potential matron. + /// @param _matronId The matron's ID. + /// @param _sire A reference to the apostle struct of the potential sire. + /// @param _sireId The sire's ID + function _isValidMatingPair( + Apostle storage _matron, + uint256 _matronId, + Apostle storage _sire, + uint256 _sireId + ) + private + view + returns (bool) + { + // An apostle can't breed with itself! + if (_matronId == _sireId) { + return false; + } + + // Apostles can't breed with their parents. + if (_matron.matronId == _sireId || _matron.sireId == _sireId) { + return false; + } + if (_sire.matronId == _matronId || _sire.sireId == _matronId) { + return false; + } + + // We can short circuit the sibling check (below) if either cat is + // gen zero (has a matron ID of zero). + if (_sire.matronId == 0 || _matron.matronId == 0) { + return true; + } + + // Apostles can't breed with full or half siblings. + if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { + return false; + } + if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { + return false; + } + + // Everything seems cool! Let's get DTF. + return true; + } + + + function canBreedWith(uint256 _matronId, uint256 _sireId) + public + view + returns (bool) + { + require(_matronId > 0); + require(_sireId > 0); + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + return _isValidMatingPair(matron, _matronId, sire, _sireId) && + _isSiringPermitted(_sireId, _matronId) && + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + } + + + // only can be called by SiringClockAuction + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { + + _breedWith(_matronId, _sireId); + + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, matron.cooldownEndTime); + return true; + } + + + function _breedWith(uint256 _matronId, uint256 _sireId) internal { + require(canBreedWith(_matronId, _sireId)); + + require(isReadyToBreed(_matronId)); + require(isReadyToBreed(_sireId)); + + // Grab a reference to the Apostles from storage. + Apostle storage sire = tokenId2Apostle[_sireId]; + + Apostle storage matron = tokenId2Apostle[_matronId]; + + // Mark the matron as pregnant, keeping track of who the sire is. + matron.siringWithId = _sireId; + + // Trigger the cooldown for both parents. + uint sireCoolDownEndTime = _triggerCooldown(_sireId); + uint matronCoolDownEndTime = _triggerCooldown(_matronId); + + // Clear siring permission for both parents. This may not be strictly necessary + // but it's likely to avoid confusion! + delete sireAllowedToAddress[_matronId]; + delete sireAllowedToAddress[_sireId]; + + + // Emit the pregnancy event. + emit Pregnant( + _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); + } + + + function breedWithAuto(uint256 _matronId, uint256 _sireId, uint256 _amountMax) + public + whenNotPaused + { + // Check for payment + // caller must approve first. + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + require(_amountMax >= autoBirthFee, 'not enough to breed.'); + IERC20 ring = IERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), autoBirthFee), "transfer failed"); + + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ring.approve(pool, autoBirthFee); + IRevenuePool(pool).reward(ring, autoBirthFee, msg.sender); + + // Call through the normal breeding flow + _breedWith(_matronId, _sireId); + + // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call + // giveBirth(). + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); + } + /// @notice Have a pregnant apostle give birth! + /// @param _matronId An apostle ready to give birth. + /// @return The apostle tokenId of the new Apostles. + /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, + /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned + /// to the current owner of the matron. Upon successful completion, both the matron and the + /// new Apostles will be ready to breed again. Note that anyone can call this function (if they + /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level, uint256 _amountMax) + public + isHuman + whenNotPaused + { + + Apostle storage matron = tokenId2Apostle[_matronId]; + uint256 sireId = matron.siringWithId; + if (isValidResourceToken(_resourceToken)) { + // users must approve enough resourceToken to this contract + uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); + require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); + IERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); + } + require(_payAndMix(_matronId, sireId, _resourceToken, _level)); + + } + + + function _payAndMix( + uint256 _matronId, + uint256 _sireId, + address _resourceToken, + uint256 _level) + internal returns (bool) { + // Grab a reference to the matron in storage. + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + + // Check that the matron is a valid apostle. + require(matron.birthTime > 0); + require(sire.birthTime > 0); + + // Check that the matron is pregnant, and that its time has come! + require(_isReadyToGiveBirth(matron)); + + // Grab a reference to the sire in storage. + // uint256 sireId = matron.siringWithId; + // prevent stack too deep error + // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; + + // Determine the higher generation number of the two parents + uint16 parentGen = matron.generation; + if (sire.generation > matron.generation) { + parentGen = sire.generation; + } + + // Call the sooper-sekret, sooper-expensive, gene mixing operation. + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + + address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); + // Make the new Apostle! + _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); + + // Clear the reference to sire from the matron (REQUIRED! Having siringWithId + // set is what marks a matron as being pregnant.) + delete matron.siringWithId; + + return true; + } + + function isValidResourceToken(address _resourceToken) public view returns (bool) { + uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); + return index > 0; + } + + + /// Anyone can try to kill this Apostle; + function killApostle(uint256 _tokenId) public { + require(tokenId2Apostle[_tokenId].activeTime > 0); + require(defaultLifeTime(_tokenId) < now); + + address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); + IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); + } + + function isDead(uint256 _tokenId) public view returns (bool) { + return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; + } + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { + uint256 start = tokenId2Apostle[_tokenId].birthTime; + + if (tokenId2Apostle[_tokenId].activeTime > 0) { + start = tokenId2Apostle[_tokenId].activeTime; + } + + return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); + } + + /// IMinerObject + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + + /// IActivityObject + function activityAdded(uint256 _tokenId, address /*_activity*/, address /*_user*/) auth public { + // to active the apostle when it do activity the first time + if (tokenId2Apostle[_tokenId].activeTime == 0) { + tokenId2Apostle[_tokenId].activeTime = uint48(now); + + emit Unbox(_tokenId, now); + } + + } + + function activityRemoved(uint256 /*_tokenId*/, address /*_activity*/, address /*_user*/) auth public { + // do nothing. + } + + /// IActivity + function activityStopped(uint256 /*_tokenId*/) auth public { + // do nothing. + } + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + Apostle storage apostle = tokenId2Apostle[_tokenId]; + return ( + apostle.genes, + apostle.talents, + apostle.matronId, + apostle.sireId, + uint256(apostle.cooldownIndex), + uint256(apostle.generation), + uint256(apostle.birthTime), + uint256(apostle.activeTime), + uint256(apostle.deadTime), + uint256(apostle.cooldownEndTime), + uint256(apostle.class) + ); + } + + function _updateCoolDown() internal { + cooldowns[0] = uint32(1 minutes); + cooldowns[1] = uint32(2 minutes); + cooldowns[2] = uint32(5 minutes); + cooldowns[3] = uint32(10 minutes); + cooldowns[4] = uint32(30 minutes); + cooldowns[5] = uint32(1 hours); + cooldowns[6] = uint32(2 hours); + cooldowns[7] = uint32(4 hours); + cooldowns[8] = uint32(8 hours); + cooldowns[9] = uint32(16 hours); + cooldowns[10] = uint32(1 days); + cooldowns[11] = uint32(2 days); + cooldowns[12] = uint32(4 days); + cooldowns[13] = uint32(7 days); + } + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { + Apostle storage aps = tokenId2Apostle[_tokenId]; + aps.genes = _genes; + aps.talents = _talents; + } + + function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { + require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); + for(uint i = 0; i < _tokenIds.length; i++) { + Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; + aps.genes = _genesList[i]; + aps.talents = _talentsList[i]; + } + + } + + //v5 add + function classes(uint256 id) external pure returns (string memory desc) { + if (id == 0) { + return "None"; + } else if (id == 1) { + return "Saber"; + } else if (id == 2) { + return "Guard"; + } else if (id == 3) { + return "Miner"; + } + } + + function changeClass(uint256 _apo_id, uint256 _class, uint256 _amountMax) external { + require(1 <= _class && _class <= 2, "!class"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); + + require(isEmptyBar(_apo_id), "!empty"); + Apostle storage apo = tokenId2Apostle[_apo_id]; + require(apo.class != _class, '!class'); + + uint256 changeClassFee = registry.uintOf(UINT_CHANGECLASS_FEE); + require(_amountMax >= changeClassFee, '!enough'); + IERC20 ring = IERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), changeClassFee), '!transfer'); + + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ring.approve(pool, changeClassFee); + IRevenuePool(pool).reward(ring, changeClassFee, msg.sender); + + apo.class = _class; + emit ClassChange(_apo_id, apo.class); + } + + function exist(uint256 _apo_id, uint256 _slot) public view returns (bool) { + return bars[_apo_id][_slot].token != address(0); + } + + function isEmptyBar(uint256 _apo_id) public view returns (bool) { + return bars[_apo_id][1].token == address(0); + } + + function get_equip_bar_name(uint256 slot) external pure returns (string memory desc) { + if (slot == 1) { + desc = "Right Hand Bar"; + } + } + + function _equip_check(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) private view { + address ownership = registry.addressOf(CONTRACT_OBJECT_OWNERSHIP); + require(msg.sender == ERC721(ownership).ownerOf(_apo_id), "!owner"); + require(_slot == 1, "!slot"); + require(bars[_apo_id][_slot].token == address(0), "exist"); + require(_equip_token == ownership, "!token"); + require(msg.sender == ERC721(_equip_token).ownerOf(_equip_id), "!owner"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + } + + function equip(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) external whenNotPaused { + _equip_check(_apo_id, _slot, _equip_token, _equip_id); + address encoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); + require(IInterstellarEncoder(encoder).getObjectClass(_equip_id) == EQUIPMENT_OBJECT_CLASS, "!eclass"); + address objectAddress = IInterstellarEncoder(encoder).getObjectAddress(_equip_id); + (uint256 obj_id,,,) = ICraftBase(objectAddress).getMetaData(_equip_id); + require(tokenId2Apostle[_apo_id].class == obj_id, "!aclass"); + ERC721(_equip_token).transferFrom(msg.sender, address(this), _equip_id); + bars[_apo_id][_slot] = Bar(_equip_token, _equip_id); + statuses[_equip_token][_equip_id] = Status(_apo_id, _slot); + emit Equip(msg.sender, _apo_id, _slot, _equip_token, _equip_id); + } + + function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { + Bar memory bar = bars[_apo_id][_slot]; + require(bar.token != address(0), "!exist"); + require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); + delete statuses[bar.token][bar.id]; + delete bars[_apo_id][_slot]; + emit Divest(_apo_id, _slot, bar.token, bar.id); + } +} + + From e40cfc9b1d75ad31cfbd02d59ae909b4fe888068 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 6 May 2022 13:30:37 +0800 Subject: [PATCH 61/64] deprecated pve --- contracts/ApostleBaseV7.sol | 623 ++++++++++++++++++++++++++++++++++++ 1 file changed, 623 insertions(+) create mode 100644 contracts/ApostleBaseV7.sol diff --git a/contracts/ApostleBaseV7.sol b/contracts/ApostleBaseV7.sol new file mode 100644 index 0000000..dec08e7 --- /dev/null +++ b/contracts/ApostleBaseV7.sol @@ -0,0 +1,623 @@ +pragma solidity ^0.4.24; + +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; +import "@evolutionland/common/contracts/interfaces/IObjectOwnership.sol"; +import "@evolutionland/common/contracts/interfaces/ITokenUse.sol"; +import "@evolutionland/common/contracts/interfaces/IMinerObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivityObject.sol"; +import "@evolutionland/common/contracts/interfaces/IActivity.sol"; +import "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; +import "./ApostleSettingIds.sol"; +import "./interfaces/IGeneScience.sol"; +import "./interfaces/IHabergPotionShop.sol"; +import "./interfaces/ILandBase.sol"; +import "./interfaces/IRevenuePool.sol"; +import "./interfaces/IERC20.sol"; +import "./interfaces/IInterstellarEncoder.sol"; +import "./interfaces/IItemBase.sol"; +import "./interfaces/ICraftBase.sol"; + +// all Ids in this contracts refer to index which is using 128-bit unsigned integers. +// this is CONTRACT_APOSTLE_BASE +// V4: giveBirth must use resource +// V5: add classes +contract ApostleBaseV6 is SupportsInterfaceWithLookup, IActivity, IActivityObject, IMinerObject, PausableDSAuth, ApostleSettingIds { + + event Birth( + address indexed owner, uint256 apostleTokenId, uint256 matronId, uint256 sireId, uint256 genes, uint256 talents, uint256 coolDownIndex, uint256 generation, uint256 birthTime + ); + event Pregnant( + uint256 matronId,uint256 matronCoolDownEndTime, uint256 matronCoolDownIndex, uint256 sireId, uint256 sireCoolDownEndTime, uint256 sireCoolDownIndex + ); + //V5 add + event ClassChange(uint256 tokenId, uint256 class); + + /// @dev The AutoBirth event is fired when a cat becomes pregant via the breedWithAuto() + /// function. This is used to notify the auto-birth daemon that this breeding action + /// included a pre-payment of the gas required to call the giveBirth() function. + event AutoBirth(uint256 matronId, uint256 cooldownEndTime); + + event Unbox(uint256 tokenId, uint256 activeTime); + + // V5 add + event Equip(address indexed usr, uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + event Divest(uint256 indexed _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id); + + struct Apostle { + // An apostles genes never change. + uint256 genes; + + uint256 talents; + + // the ID of the parents of this Apostle. set to 0 for gen0 apostle. + // Note that using 128-bit unsigned integers to represent parents IDs, + // which refer to lastApostleObjectId for those two. + uint256 matronId; + uint256 sireId; + + // Set to the ID of the sire apostle for matrons that are pregnant, + // zero otherwise. A non-zero value here is how we know an apostle + // is pregnant. Used to retrieve the genetic material for the new + // apostle when the birth transpires. + uint256 siringWithId; + // Set to the index in the cooldown array (see below) that represents + // the current cooldown duration for this apostle. + uint16 cooldownIndex; + // The "generation number" of this apostle. + uint16 generation; + + uint48 birthTime; + uint48 activeTime; + uint48 deadTime; + uint48 cooldownEndTime; + + //v5 add + uint256 class; + } + + uint32[14] public cooldowns = [ + uint32(1 minutes), + uint32(2 minutes), + uint32(5 minutes), + uint32(10 minutes), + uint32(30 minutes), + uint32(1 hours), + uint32(2 hours), + uint32(4 hours), + uint32(8 hours), + uint32(16 hours), + uint32(1 days), + uint32(2 days), + uint32(4 days), + uint32(7 days) + ]; + + + /* + * Modifiers + */ + modifier singletonLockCall() { + require(!singletonLock, "Only can call once"); + _; + singletonLock = true; + } + + modifier isHuman() { + require(msg.sender == tx.origin, "robot is not permitted"); + _; + } + + + /*** STORAGE ***/ + bool private singletonLock = false; + + uint128 public lastApostleObjectId; + + ISettingsRegistry public registry; + + mapping(uint256 => Apostle) public tokenId2Apostle; + + mapping(uint256 => address) public sireAllowedToAddress; + + // apostle bar + struct Bar { + address token; + uint256 id; + } + + // bar status + struct Status { + uint256 tokenId; + uint256 index; + } + + // V5 add + // apoTokenId => (apoBarIndex => Bar) + mapping(uint256 => mapping(uint256 => Bar)) public bars; + // equipmentTokenAddress => equipmentId => status + mapping(address => mapping(uint256 => Status)) public statuses; + + function initializeContract(address _registry) public singletonLockCall { + // Ownable constructor + owner = msg.sender; + emit LogSetOwner(msg.sender); + + registry = ISettingsRegistry(_registry); + + _registerInterface(InterfaceId_IActivity); + _registerInterface(InterfaceId_IActivityObject); + _registerInterface(InterfaceId_IMinerObject); + _updateCoolDown(); + + } + + // called by gen0Apostle + function createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) public auth returns (uint256) { + _createApostle(_matronId, _sireId, _generation, _genes, _talents, _owner); + } + + function _createApostle( + uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, uint256 _talents, address _owner) internal returns (uint256) { + + require(_generation <= 65535); + uint256 coolDownIndex = _generation / 2; + if (coolDownIndex > 13) { + coolDownIndex = 13; + } + + Apostle memory apostle = Apostle({ + genes : _genes, + talents : _talents, + birthTime : uint48(now), + activeTime : 0, + deadTime : 0, + cooldownEndTime : 0, + matronId : _matronId, + sireId : _sireId, + siringWithId : 0, + cooldownIndex : uint16(coolDownIndex), + generation : uint16(_generation), + class: 0 + }); + + lastApostleObjectId += 1; + require(lastApostleObjectId <= 340282366920938463463374607431768211455, "Can not be stored with 128 bits."); + uint256 tokenId = IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).mintObject(_owner, uint128(lastApostleObjectId)); + + tokenId2Apostle[tokenId] = apostle; + + emit Birth(_owner, tokenId, apostle.matronId, apostle.sireId, _genes, _talents, uint256(coolDownIndex), uint256(_generation), now); + + return tokenId; + } + + function getCooldownDuration(uint256 _tokenId) public view returns (uint256){ + uint256 cooldownIndex = tokenId2Apostle[_tokenId].cooldownIndex; + return cooldowns[cooldownIndex]; + } + + // @dev Checks to see if a apostle is able to breed. + // @param _apostleId - index of apostles which is within uint128. + function isReadyToBreed(uint256 _apostleId) + public + view + returns (bool) + { + require(tokenId2Apostle[_apostleId].birthTime > 0, "Apostle should exist"); + + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apostleId), "Object ready to do activity"); + + // In addition to checking the cooldownEndTime, we also need to check to see if + // the cat has a pending birth; there can be some period of time between the end + // of the pregnacy timer and the birth event. + return (tokenId2Apostle[_apostleId].siringWithId == 0) && (tokenId2Apostle[_apostleId].cooldownEndTime <= now); + } + + function approveSiring(address _addr, uint256 _sireId) + public + whenNotPaused + { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + require(objectOwnership.ownerOf(_sireId) == msg.sender); + + sireAllowedToAddress[_sireId] = _addr; + } + + // check apostle's owner or siring permission + function _isSiringPermitted(uint256 _sireId, uint256 _matronId) internal view returns (bool) { + ERC721 objectOwnership = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)); + address matronOwner = objectOwnership.ownerOf(_matronId); + address sireOwner = objectOwnership.ownerOf(_sireId); + + // Siring is okay if they have same owner, or if the matron's owner was given + // permission to breed with this sire. + return (matronOwner == sireOwner || sireAllowedToAddress[_sireId] == matronOwner); + } + + function _triggerCooldown(uint256 _tokenId) internal returns (uint256) { + + Apostle storage aps = tokenId2Apostle[_tokenId]; + // Compute the end of the cooldown time (based on current cooldownIndex) + aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex])); + + // Increment the breeding count, clamping it at 13, which is the length of the + // cooldowns array. We could check the array size dynamically, but hard-coding + // this as a constant saves gas. Yay, Solidity! + if (aps.cooldownIndex < 13) { + aps.cooldownIndex += 1; + } + + // address(0) meaning use by its owner or whitelisted contract + ITokenUse(registry.addressOf(SettingIds.CONTRACT_TOKEN_USE)).addActivity(_tokenId, address(0), aps.cooldownEndTime); + + return uint256(aps.cooldownEndTime); + + } + + function _isReadyToGiveBirth(Apostle storage _matron) private view returns (bool) { + return (_matron.siringWithId != 0) && (_matron.cooldownEndTime <= now); + } + + /// @dev Internal check to see if a given sire and matron are a valid mating pair. DOES NOT + /// check ownership permissions (that is up to the caller). + /// @param _matron A reference to the apostle struct of the potential matron. + /// @param _matronId The matron's ID. + /// @param _sire A reference to the apostle struct of the potential sire. + /// @param _sireId The sire's ID + function _isValidMatingPair( + Apostle storage _matron, + uint256 _matronId, + Apostle storage _sire, + uint256 _sireId + ) + private + view + returns (bool) + { + // An apostle can't breed with itself! + if (_matronId == _sireId) { + return false; + } + + // Apostles can't breed with their parents. + if (_matron.matronId == _sireId || _matron.sireId == _sireId) { + return false; + } + if (_sire.matronId == _matronId || _sire.sireId == _matronId) { + return false; + } + + // We can short circuit the sibling check (below) if either cat is + // gen zero (has a matron ID of zero). + if (_sire.matronId == 0 || _matron.matronId == 0) { + return true; + } + + // Apostles can't breed with full or half siblings. + if (_sire.matronId == _matron.matronId || _sire.matronId == _matron.sireId) { + return false; + } + if (_sire.sireId == _matron.matronId || _sire.sireId == _matron.sireId) { + return false; + } + + // Everything seems cool! Let's get DTF. + return true; + } + + + function canBreedWith(uint256 _matronId, uint256 _sireId) + public + view + returns (bool) + { + require(_matronId > 0); + require(_sireId > 0); + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + return _isValidMatingPair(matron, _matronId, sire, _sireId) && + _isSiringPermitted(_sireId, _matronId) && + IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).isOkWithRaceAndGender(matron.genes, sire.genes); + } + + + // only can be called by SiringClockAuction + function breedWithInAuction(uint256 _matronId, uint256 _sireId) public auth returns (bool) { + + _breedWith(_matronId, _sireId); + + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, matron.cooldownEndTime); + return true; + } + + + function _breedWith(uint256 _matronId, uint256 _sireId) internal { + require(canBreedWith(_matronId, _sireId)); + + require(isReadyToBreed(_matronId)); + require(isReadyToBreed(_sireId)); + + // Grab a reference to the Apostles from storage. + Apostle storage sire = tokenId2Apostle[_sireId]; + + Apostle storage matron = tokenId2Apostle[_matronId]; + + // Mark the matron as pregnant, keeping track of who the sire is. + matron.siringWithId = _sireId; + + // Trigger the cooldown for both parents. + uint sireCoolDownEndTime = _triggerCooldown(_sireId); + uint matronCoolDownEndTime = _triggerCooldown(_matronId); + + // Clear siring permission for both parents. This may not be strictly necessary + // but it's likely to avoid confusion! + delete sireAllowedToAddress[_matronId]; + delete sireAllowedToAddress[_sireId]; + + + // Emit the pregnancy event. + emit Pregnant( + _matronId, matronCoolDownEndTime, uint256(matron.cooldownIndex), _sireId, sireCoolDownEndTime, uint256(sire.cooldownIndex)); + } + + + function breedWithAuto(uint256 _matronId, uint256 _sireId, uint256 _amountMax) + public + whenNotPaused + { + // Check for payment + // caller must approve first. + uint256 autoBirthFee = registry.uintOf(ApostleSettingIds.UINT_AUTOBIRTH_FEE); + require(_amountMax >= autoBirthFee, 'not enough to breed.'); + IERC20 ring = IERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); + require(ring.transferFrom(msg.sender, address(this), autoBirthFee), "transfer failed"); + + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + ring.approve(pool, autoBirthFee); + IRevenuePool(pool).reward(ring, autoBirthFee, msg.sender); + + // Call through the normal breeding flow + _breedWith(_matronId, _sireId); + + // Emit an AutoBirth message so the autobirth daemon knows when and for what cat to call + // giveBirth(). + Apostle storage matron = tokenId2Apostle[_matronId]; + emit AutoBirth(_matronId, uint48(matron.cooldownEndTime)); + } + /// @notice Have a pregnant apostle give birth! + /// @param _matronId An apostle ready to give birth. + /// @return The apostle tokenId of the new Apostles. + /// @dev Looks at a given apostle and, if pregnant and if the gestation period has passed, + /// combines the genes of the two parents to create a new Apostles. The new apostle is assigned + /// to the current owner of the matron. Upon successful completion, both the matron and the + /// new Apostles will be ready to breed again. Note that anyone can call this function (if they + /// are willing to pay the gas!), but the new Apostles always goes to the mother's owner. + function giveBirth(uint256 _matronId, address _resourceToken, uint256 _level, uint256 _amountMax) + public + isHuman + whenNotPaused + { + + Apostle storage matron = tokenId2Apostle[_matronId]; + uint256 sireId = matron.siringWithId; + if (isValidResourceToken(_resourceToken)) { + // users must approve enough resourceToken to this contract + uint256 expense = _level * registry.uintOf(UINT_MIX_TALENT); + require(_level > 0 && _amountMax >= expense, 'resource for mixing is not enough.'); + IERC20(_resourceToken).transferFrom(msg.sender, address(this), expense); + } + require(_payAndMix(_matronId, sireId, _resourceToken, _level)); + + } + + + function _payAndMix( + uint256 _matronId, + uint256 _sireId, + address _resourceToken, + uint256 _level) + internal returns (bool) { + // Grab a reference to the matron in storage. + Apostle storage matron = tokenId2Apostle[_matronId]; + Apostle storage sire = tokenId2Apostle[_sireId]; + + // Check that the matron is a valid apostle. + require(matron.birthTime > 0); + require(sire.birthTime > 0); + + // Check that the matron is pregnant, and that its time has come! + require(_isReadyToGiveBirth(matron)); + + // Grab a reference to the sire in storage. + // uint256 sireId = matron.siringWithId; + // prevent stack too deep error + // Apostle storage sire = tokenId2Apostle[matron.siringWithId]; + + // Determine the higher generation number of the two parents + uint16 parentGen = matron.generation; + if (sire.generation > matron.generation) { + parentGen = sire.generation; + } + + // Call the sooper-sekret, sooper-expensive, gene mixing operation. + (uint256 childGenes, uint256 childTalents) = IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)).mixGenesAndTalents(matron.genes, sire.genes, matron.talents, sire.talents, _resourceToken, _level); + + address owner = ERC721(registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_matronId); + // Make the new Apostle! + _createApostle(_matronId, matron.siringWithId, parentGen + 1, childGenes, childTalents, owner); + + // Clear the reference to sire from the matron (REQUIRED! Having siringWithId + // set is what marks a matron as being pregnant.) + delete matron.siringWithId; + + return true; + } + + function isValidResourceToken(address _resourceToken) public view returns (bool) { + uint index = ILandBase(registry.addressOf(SettingIds.CONTRACT_LAND_BASE)).resourceToken2RateAttrId(_resourceToken); + return index > 0; + } + + + /// Anyone can try to kill this Apostle; + function killApostle(uint256 _tokenId) public { + require(tokenId2Apostle[_tokenId].activeTime > 0); + require(defaultLifeTime(_tokenId) < now); + + address habergPotionShop = registry.addressOf(CONTRACT_HABERG_POTION_SHOP); + IHabergPotionShop(habergPotionShop).tryKillApostle(_tokenId, msg.sender); + } + + function isDead(uint256 _tokenId) public view returns (bool) { + return tokenId2Apostle[_tokenId].birthTime > 0 && tokenId2Apostle[_tokenId].deadTime > 0; + } + + function defaultLifeTime(uint256 _tokenId) public view returns (uint256) { + uint256 start = tokenId2Apostle[_tokenId].birthTime; + + if (tokenId2Apostle[_tokenId].activeTime > 0) { + start = tokenId2Apostle[_tokenId].activeTime; + } + + return start + (tokenId2Apostle[_tokenId].talents >> 248) * (1 weeks); + } + + /// IMinerObject + function strengthOf(uint256 _tokenId, address _resourceToken, uint256 _landTokenId) public view returns (uint256) { + uint talents = tokenId2Apostle[_tokenId].talents; + return IGeneScience(registry.addressOf(CONTRACT_GENE_SCIENCE)) + .getStrength(talents, _resourceToken, _landTokenId); + } + + /// IActivityObject + function activityAdded(uint256 _tokenId, address /*_activity*/, address /*_user*/) auth public { + // to active the apostle when it do activity the first time + if (tokenId2Apostle[_tokenId].activeTime == 0) { + tokenId2Apostle[_tokenId].activeTime = uint48(now); + + emit Unbox(_tokenId, now); + } + + } + + function activityRemoved(uint256 /*_tokenId*/, address /*_activity*/, address /*_user*/) auth public { + // do nothing. + } + + /// IActivity + function activityStopped(uint256 /*_tokenId*/) auth public { + // do nothing. + } + + function getApostleInfo(uint256 _tokenId) public view returns(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) { + Apostle storage apostle = tokenId2Apostle[_tokenId]; + return ( + apostle.genes, + apostle.talents, + apostle.matronId, + apostle.sireId, + uint256(apostle.cooldownIndex), + uint256(apostle.generation), + uint256(apostle.birthTime), + uint256(apostle.activeTime), + uint256(apostle.deadTime), + uint256(apostle.cooldownEndTime), + uint256(apostle.class) + ); + } + + function _updateCoolDown() internal { + cooldowns[0] = uint32(1 minutes); + cooldowns[1] = uint32(2 minutes); + cooldowns[2] = uint32(5 minutes); + cooldowns[3] = uint32(10 minutes); + cooldowns[4] = uint32(30 minutes); + cooldowns[5] = uint32(1 hours); + cooldowns[6] = uint32(2 hours); + cooldowns[7] = uint32(4 hours); + cooldowns[8] = uint32(8 hours); + cooldowns[9] = uint32(16 hours); + cooldowns[10] = uint32(1 days); + cooldowns[11] = uint32(2 days); + cooldowns[12] = uint32(4 days); + cooldowns[13] = uint32(7 days); + } + + function updateGenesAndTalents(uint256 _tokenId, uint256 _genes, uint256 _talents) public auth { + Apostle storage aps = tokenId2Apostle[_tokenId]; + aps.genes = _genes; + aps.talents = _talents; + } + + function batchUpdate(uint256[] _tokenIds, uint256[] _genesList, uint256[] _talentsList) public auth { + require(_tokenIds.length == _genesList.length && _tokenIds.length == _talentsList.length); + for(uint i = 0; i < _tokenIds.length; i++) { + Apostle storage aps = tokenId2Apostle[_tokenIds[i]]; + aps.genes = _genesList[i]; + aps.talents = _talentsList[i]; + } + + } + + //v5 add + function classes(uint256 id) external pure returns (string memory desc) { + if (id == 0) { + return "None"; + } else if (id == 1) { + return "Saber"; + } else if (id == 2) { + return "Guard"; + } else if (id == 3) { + return "Miner"; + } + } + + function changeClass(uint256 _apo_id, uint256 _class, uint256 _amountMax) external { + revert("deprecated") + } + + function exist(uint256 _apo_id, uint256 _slot) public view returns (bool) { + return bars[_apo_id][_slot].token != address(0); + } + + function isEmptyBar(uint256 _apo_id) public view returns (bool) { + return bars[_apo_id][1].token == address(0); + } + + function get_equip_bar_name(uint256 slot) external pure returns (string memory desc) { + if (slot == 1) { + desc = "Right Hand Bar"; + } + } + + function _equip_check(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) private view { + address ownership = registry.addressOf(CONTRACT_OBJECT_OWNERSHIP); + require(msg.sender == ERC721(ownership).ownerOf(_apo_id), "!owner"); + require(_slot == 1, "!slot"); + require(bars[_apo_id][_slot].token == address(0), "exist"); + require(_equip_token == ownership, "!token"); + require(msg.sender == ERC721(_equip_token).ownerOf(_equip_id), "!owner"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + } + + function equip(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) external { + revert("deprecated") + } + + function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { + Bar memory bar = bars[_apo_id][_slot]; + require(bar.token != address(0), "!exist"); + require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); + require(ITokenUse(registry.addressOf(CONTRACT_TOKEN_USE)).isObjectReadyToUse(_apo_id), "!use"); + ERC721(bar.token).transferFrom(address(this), msg.sender, bar.id); + delete statuses[bar.token][bar.id]; + delete bars[_apo_id][_slot]; + emit Divest(_apo_id, _slot, bar.token, bar.id); + } +} + + From 0d36bb12004bfed88889bced7ada49daf7adfe0a Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 6 May 2022 13:34:56 +0800 Subject: [PATCH 62/64] deprecated pve --- contracts/ApostleBaseV7.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/ApostleBaseV7.sol b/contracts/ApostleBaseV7.sol index dec08e7..b1be8ca 100644 --- a/contracts/ApostleBaseV7.sol +++ b/contracts/ApostleBaseV7.sol @@ -577,7 +577,7 @@ contract ApostleBaseV6 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } function changeClass(uint256 _apo_id, uint256 _class, uint256 _amountMax) external { - revert("deprecated") + revert("deprecated"); } function exist(uint256 _apo_id, uint256 _slot) public view returns (bool) { @@ -605,7 +605,7 @@ contract ApostleBaseV6 is SupportsInterfaceWithLookup, IActivity, IActivityObjec } function equip(uint256 _apo_id, uint256 _slot, address _equip_token, uint256 _equip_id) external { - revert("deprecated") + revert("deprecated"); } function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { From 3918a2f77a0892867c88fcdef07fca857bbf91d4 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 30 Jun 2022 09:14:44 +0800 Subject: [PATCH 63/64] support multi divest --- contracts/ApostleBaseV7.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contracts/ApostleBaseV7.sol b/contracts/ApostleBaseV7.sol index b1be8ca..ea1eb58 100644 --- a/contracts/ApostleBaseV7.sol +++ b/contracts/ApostleBaseV7.sol @@ -618,6 +618,12 @@ contract ApostleBaseV6 is SupportsInterfaceWithLookup, IActivity, IActivityObjec delete bars[_apo_id][_slot]; emit Divest(_apo_id, _slot, bar.token, bar.id); } + + function multiDivest(uint256[] memory _apo_ids, uint256 _slot) external { + for (uint i = 0; i < _apo_ids.length; i++) { + divest(_apo_ids[i], _slot); + } + } } From 8ffdae31778236fcfb866f586bfd6f33f85db0b4 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 30 Jun 2022 09:17:02 +0800 Subject: [PATCH 64/64] fix --- contracts/ApostleBaseV7.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/ApostleBaseV7.sol b/contracts/ApostleBaseV7.sol index ea1eb58..78aaa95 100644 --- a/contracts/ApostleBaseV7.sol +++ b/contracts/ApostleBaseV7.sol @@ -608,7 +608,7 @@ contract ApostleBaseV6 is SupportsInterfaceWithLookup, IActivity, IActivityObjec revert("deprecated"); } - function divest(uint256 _apo_id, uint256 _slot) external whenNotPaused { + function divest(uint256 _apo_id, uint256 _slot) public whenNotPaused { Bar memory bar = bars[_apo_id][_slot]; require(bar.token != address(0), "!exist"); require(msg.sender == ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_apo_id), "!owner"); @@ -619,7 +619,7 @@ contract ApostleBaseV6 is SupportsInterfaceWithLookup, IActivity, IActivityObjec emit Divest(_apo_id, _slot, bar.token, bar.id); } - function multiDivest(uint256[] memory _apo_ids, uint256 _slot) external { + function multiDivest(uint256[] _apo_ids, uint256 _slot) external { for (uint i = 0; i < _apo_ids.length; i++) { divest(_apo_ids[i], _slot); }