From 5cecaa679a1efd4f68c940efd71ae379943010d4 Mon Sep 17 00:00:00 2001 From: seanchuang Date: Tue, 24 Jul 2018 14:48:04 +0800 Subject: [PATCH] Support contract withdraw --- contracts/CryptoHerosGame.sol | 6 ++++++ contracts/CryptoHerosToken.sol | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/contracts/CryptoHerosGame.sol b/contracts/CryptoHerosGame.sol index ee032f1..55a496f 100644 --- a/contracts/CryptoHerosGame.sol +++ b/contracts/CryptoHerosGame.sol @@ -81,4 +81,10 @@ contract CryptoHerosGame is Ownable { return uint(sha3(nonce))%(min+max)-min; } + function withdraw(uint amount) public payable onlyOwner returns(bool) { + require(amount <= this.balance); + owner.transfer(amount); + return true; + } + } diff --git a/contracts/CryptoHerosToken.sol b/contracts/CryptoHerosToken.sol index 3496c3d..cfe3cac 100644 --- a/contracts/CryptoHerosToken.sol +++ b/contracts/CryptoHerosToken.sol @@ -89,5 +89,11 @@ contract CryptoHerosToken is ERC721Token, Ownable { function getHerosLength() public returns (uint) { return heros.length; } + + function withdraw(uint amount) public payable onlyOwner returns(bool) { + require(amount <= this.balance); + owner.transfer(amount); + return true; + } } \ No newline at end of file