neo-project / examples

MIT License
138 stars 135 forks source link

structural adjustment and fix some bug #10

Closed tanZiWen closed 6 years ago

tanZiWen commented 6 years ago

split some logic of mintToken function to three function, change now time equal previous block time add 15 seconds, remove some redundant code, fix some bug.

yfhuang521 commented 6 years ago

private static ulong CurrentSwapToken(byte[] sender, ulong value, ulong swap_rate) { ulong token = value / neo_decimals * swap_rate; BigInteger total_supply = Storage.Get(Storage.CurrentContext, "totalSupply").AsBigInteger(); BigInteger balance_token = total_amount - total_supply; if (balance_token <= 0) { Refund(sender, value); return 0; } *else if (balance_token < (tokenfactor))* { Refund(sender, (token - balance_token) / swap_rate neo_decimals); token = (ulong)balance_token; } return token; }

tanZiWen commented 6 years ago

hi, you can see the parameter basic_rate has been multiplied factor.