Created
December 15, 2017 06:25
-
-
Save blueplanet/8977c4cc5662e8140b00d248b7fc01bf to your computer and use it in GitHub Desktop.
仮想仔猫ゲーム CryptoKitties のコントラクト解読その2 ref: https://qiita.com/blueplanet/items/e257450834a5a32f0f10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract Cat { | |
function color() public constant returns (string); | |
} | |
// エラー内容 | |
This contract does not implement all functions and thus cannot be created. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract Cat { | |
function color() public constant returns (string); | |
} | |
contract BlackCat is Cat { | |
function color() public constant returns (string) { | |
return "Black"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
GeneScienceInterface public geneScience; | |
function setGeneScienceAddress(address _address) external onlyCEO { | |
GeneScienceInterface candidateContract = GeneScienceInterface(_address); | |
require(candidateContract.isGeneScience()); | |
// Set the new contract address | |
geneScience = candidateContract; | |
} | |
// 仔猫の生成処理の中で、`geneScience.mixGenes(...)`を呼び出している | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment