Skip to content

Commit

Permalink
Updated blockchain calls on Phantasma Game sample
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoCatarinoDev committed Jun 26, 2019
1 parent 3299d33 commit 2e26ca2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void BuyAsset(Car car)

var script = ScriptUtils.BeginScript()
.AllowGas(car.OwnerAddress, Address.Null, 1, 9999)
.CallContract("market", "BuyToken", PhantasmaDemo.Instance.Key.Address, PhantasmaDemo.TOKEN_SYMBOL, car.TokenID)
.CallContract("market", "BuyToken", PhantasmaDemo.Instance.Key.Address, PhantasmaDemo.TOKEN_SYMBOL, BigInteger.Parse(car.TokenID))
.SpendGas(car.OwnerAddress)
.EndScript();

Expand Down Expand Up @@ -233,7 +233,7 @@ public void SellAsset(Car car, Address from, BigInteger price, Timestamp endDate

var script = ScriptUtils.BeginScript()
.AllowGas(car.OwnerAddress, Address.Null, 1, 9999)
.CallContract("market", "SellToken", from, PhantasmaDemo.TOKEN_SYMBOL, "SOUL", car.TokenID, price, endDate)
.CallContract("market", "SellToken", from, PhantasmaDemo.TOKEN_SYMBOL, PhantasmaDemo.SOUL_TOKEN_SYMBOL, BigInteger.Parse(car.TokenID), price, endDate)
.SpendGas(from)
.EndScript();

Expand Down Expand Up @@ -325,7 +325,7 @@ public void RemoveAsset(Car car)

var script = ScriptUtils.BeginScript()
.AllowGas(car.OwnerAddress, Address.Null, 1, 9999)
.CallContract("market", "BuyToken", PhantasmaDemo.Instance.Key.Address, PhantasmaDemo.TOKEN_SYMBOL, car.TokenID)
.CallContract("market", "BuyToken", PhantasmaDemo.Instance.Key.Address, PhantasmaDemo.TOKEN_SYMBOL, BigInteger.Parse(car.TokenID))
.SpendGas(car.OwnerAddress)
.EndScript();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;

using UnityEngine;

Expand All @@ -13,6 +12,7 @@
using Phantasma.Numerics;
using Phantasma.SDK;
using Phantasma.VM.Utils;

using Random = UnityEngine.Random;
using Token = Phantasma.SDK.Token;

Expand Down Expand Up @@ -47,10 +47,12 @@ public enum EBLOCKCHAIN_OPERATION
public const string TOKEN_SYMBOL = "CAR";
public const string TOKEN_NAME = "Car Demo Token";

public const string SOUL_TOKEN_SYMBOL = "SOUL";

private const string _SERVER_ADDRESS = "http://localhost:7077/rpc";

private const float _TRANSACTION_CONFIRMATION_DELAY = 10f;

public Market market;
public List<Sprite> carImages;

Expand Down Expand Up @@ -492,7 +494,7 @@ public void MintToken(string tokenName)

var script = ScriptUtils.BeginScript()
.AllowGas(Key.Address, Address.Null, 1, 9999)
.CallContract("token", "MintToken", Key.Address, TOKEN_SYMBOL, txData, txMutableData)
.CallContract("token", "MintToken", Key.Address, TOKEN_SYMBOL, txData, txMutableData, 0)
.SpendGas(Key.Address)
.EndScript();

Expand Down

0 comments on commit 2e26ca2

Please sign in to comment.