Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const bRate = 0.015;
- const sRate = 0.025;
- class HelloWorld {
- init () {
- }
- buyPlay(buyer, amount) {
- var nAmount = Number(amount);
- if (isNaN(nAmount)) {
- throw "amount is not number"
- }
- amount = nAmount.toFixed(4);
- blockchain.call("token.iost", "transfer", ["iost", account, blockchain.contractName(), buyer, "Payment successful"]);
- var playOwed = (amount/sRate).toString();
- blockchain.callWithAuth("token.iost", "transfer", ["wert", blockchain.contractName(), buyer, playOwed, "Enjoy your tokens"]);
- }
- can_update(data) {
- return blockchain.requireAuth(blockchain.contractOwner(), "active");
- }
- };
- module.exports = HelloWorld;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement