SHARE
TWEET

Untitled

a guest Apr 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const bRate = 0.015;
  2. const sRate = 0.025;
  3. class HelloWorld {
  4.     init () {
  5.  
  6.     }
  7.      buyPlay(buyer, amount) {
  8.  
  9.         var nAmount = Number(amount);
  10.         if (isNaN(nAmount)) {
  11.             throw "amount is not number"
  12.         }
  13.  
  14.  
  15.         amount = nAmount.toFixed(4);
  16.  
  17.    
  18.         blockchain.call("token.iost", "transfer", ["iost", account, blockchain.contractName(), buyer, "Payment successful"]);
  19.         var playOwed = (amount/sRate).toString();
  20.         blockchain.callWithAuth("token.iost", "transfer", ["wert", blockchain.contractName(), buyer, playOwed, "Enjoy your tokens"]);
  21. }
  22.    can_update(data) {
  23.         return blockchain.requireAuth(blockchain.contractOwner(), "active");
  24.     }
  25. };
  26.  
  27. module.exports = HelloWorld;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top