Skip to content

Instantly share code, notes, and snippets.

@PhyrexTsai
Created October 29, 2016 15:08
Show Gist options
  • Save PhyrexTsai/cad7b5a8a092f021b7cd15fdb8d35242 to your computer and use it in GitHub Desktop.
Save PhyrexTsai/cad7b5a8a092f021b7cd15fdb8d35242 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.0;
contract BuyNccuCoin {
function buy () returns (bool) {
// buy coin
// 客戶賣回給銀行
// receiver 這邊要放銀行
NccuBank nccuBank = new NccuBank();
if (nccuBank.check() < msg.value) {
return false;
}
return nccuBank._send(nccuBank.minter, msg.value);
}
function sell(uint howMuchNccuCoin) returns (bool) {
// sell coin
// 銀行賣給客戶,要鑄造,之後轉帳
NccuBank nccuBank = new NccuBank();
return nccuBank.mint(nccuBank.minter, howMuchNccuCoin) && nccuBank._send(msg.sender, howMuchNccuCoin);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment