diff --git a/.env b/.env new file mode 100644 index 0000000..8403628 --- /dev/null +++ b/.env @@ -0,0 +1,7 @@ +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 +unset SOLC_FLAGS DAPP_BUILD_LEGACY DAPP_BUILD_EXTRACT diff --git a/.gitignore b/.gitignore index 32859b1..992f356 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,3 @@ .idea -node_modules -build -contracts-flattener -truffle.js -truffle-config.js -package-lock.json - +out +flat diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4cde075 --- /dev/null +++ b/.gitmodules @@ -0,0 +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/Makefile b/Makefile new file mode 100644 index 0000000..5775c51 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all :; source .env && dapp --use solc:0.4.24 build +clean :; dapp clean diff --git a/abi/ApostleBase.abi b/abi/ApostleBase.abi new file mode 100644 index 0000000..60e8314 --- /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":"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/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..c18acef --- /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":"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 new file mode 100644 index 0000000..c9ca247 --- /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":"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 new file mode 100644 index 0000000..c9ca247 --- /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":"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..d0f19ea --- /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":"_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/abi/ApostleClockAuction.abi b/abi/ApostleClockAuction.abi new file mode 100644 index 0000000..76f74a3 --- /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":"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 new file mode 100644 index 0000000..1f654d0 --- /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":"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 new file mode 100644 index 0000000..9441ca1 --- /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":"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 new file mode 100644 index 0000000..d75c98b --- /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":"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/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..b9d8d01 --- /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":"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 new file mode 100644 index 0000000..1b10880 --- /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":"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 new file mode 100644 index 0000000..ae9942c --- /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":"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 new file mode 100644 index 0000000..41caa5a --- /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":"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/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/ICraftBase.abi b/abi/ICraftBase.abi new file mode 100644 index 0000000..36a8a00 --- /dev/null +++ b/abi/ICraftBase.abi @@ -0,0 +1 @@ +[{"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/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"}] 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/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/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/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/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/IItemBase.abi b/abi/IItemBase.abi new file mode 100644 index 0000000..bb51347 --- /dev/null +++ b/abi/IItemBase.abi @@ -0,0 +1 @@ +[{"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/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..cc63729 --- /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":"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/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..781e57a --- /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":"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 new file mode 100644 index 0000000..24fa921 --- /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":"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 new file mode 100644 index 0000000..24fa921 --- /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":"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 new file mode 100644 index 0000000..42faf9d --- /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":"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/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"}] 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/ApostleBaseV3.sol b/contracts/ApostleBaseV3.sol new file mode 100644 index 0000000..f0c7d25 --- /dev/null +++ b/contracts/ApostleBaseV3.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 +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, 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) { + 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]; + } + + } +} + + diff --git a/contracts/ApostleBaseV4.sol b/contracts/ApostleBaseV4.sol new file mode 100644 index 0000000..20aa6dc --- /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 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) { + 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]; + } + + } +} + + diff --git a/contracts/ApostleBaseV5.sol b/contracts/ApostleBaseV5.sol new file mode 100644 index 0000000..c53004d --- /dev/null +++ b/contracts/ApostleBaseV5.sol @@ -0,0 +1,649 @@ +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 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(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; + 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) { + 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); + } +} + + 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); + } +} + + diff --git a/contracts/ApostleBaseV7.sol b/contracts/ApostleBaseV7.sol new file mode 100644 index 0000000..78aaa95 --- /dev/null +++ b/contracts/ApostleBaseV7.sol @@ -0,0 +1,629 @@ +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) 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"); + 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); + } + + function multiDivest(uint256[] _apo_ids, uint256 _slot) external { + for (uint i = 0; i < _apo_ids.length; i++) { + divest(_apo_ids[i], _slot); + } + } +} + + 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/ApostleClockAuctionV2.sol b/contracts/ApostleClockAuctionV2.sol new file mode 100644 index 0000000..1dca857 --- /dev/null +++ b/contracts/ApostleClockAuctionV2.sol @@ -0,0 +1,555 @@ +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 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, 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 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); + 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); + } + } +} diff --git a/contracts/ApostleClockAuctionV3.sol b/contracts/ApostleClockAuctionV3.sol new file mode 100644 index 0000000..49405f4 --- /dev/null +++ b/contracts/ApostleClockAuctionV3.sol @@ -0,0 +1,562 @@ +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; + + uint256 firstPay; + } + + 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; + + _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); + + 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 address(this) + // _sellerPay(_auction.token, _pool, address(this), _buyer, (_priceInToken - ownerCutAmount)); + _auction.firstPay = _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), + firstPay: 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..5aa7acd 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"; @@ -30,4 +32,9 @@ 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"; + + uint8 public constant EQUIPMENT_OBJECT_CLASS = 6; //Equipment } 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/Gen0ApostleV3.sol b/contracts/Gen0ApostleV3.sol new file mode 100644 index 0000000..f86f16a --- /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 "@evolutionland/common/contracts/PausableDSAuth.sol"; +import "./interfaces/IERC20.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; + } + IERC20 token = IERC20(_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); + } + +} 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/Migrations.sol b/contracts/Migrations.sol deleted file mode 100644 index ec90e6e..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/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/SiringClockAuctionV3.sol b/contracts/SiringClockAuctionV3.sol new file mode 100644 index 0000000..f81bb6d --- /dev/null +++ b/contracts/SiringClockAuctionV3.sol @@ -0,0 +1,192 @@ +pragma solidity ^0.4.24; + +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 { + + + 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, uint256 _amountMax) 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(_amountMax >= (priceInToken + autoBirthFee), + "your offer is lower than the current price, try again with a higher one."); + + require(IERC20(auction.token).transferFrom(msg.sender, address(this), (priceInToken + autoBirthFee)), 'transfer failed'); + + 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)); + require(objectOwnership.ownerOf(_matronId) == _from, "You can only breed your own apostle."); + //uint256 ownerCutAmount = _computeCut(priceInToken); + uint cut = _computeCut(_priceInToken); + IERC20(_auctionToken).transfer(_seller, (_priceInToken - cut)); + address pool = registry.addressOf(CONTRACT_REVENUE_POOL); + IERC20(_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)")); + + } +} diff --git a/contracts/interfaces/ICraftBase.sol b/contracts/interfaces/ICraftBase.sol new file mode 100644 index 0000000..ff5ff2a --- /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, uint, uint, uint); +} 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); +} 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); +} 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..48c118f --- /dev/null +++ b/contracts/interfaces/IItemBase.sol @@ -0,0 +1,7 @@ +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); +} 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; +} 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 +} 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 new file mode 160000 index 0000000..0e65947 --- /dev/null +++ b/lib/zeppelin-solidity @@ -0,0 +1 @@ +Subproject commit 0e65947efbffc592cffea8c2ae9d3b8e11659854 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 92599e1..0000000 --- a/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@evolutionland/apostle", - "version": "1.2.2", - "description": "Apostle contracts for Evolution Land", - "main": "truffle-config.js", - "directories": { - "test": "test" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "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" - } -}