public static bool Deploy() { Runtime.Log("Deploy called"); if (!Runtime.CheckWitness(AppGlobals.FishEffectScriptHash)) { return(false); } BigInteger totalSupply = FishCoinDao.GetTotalSupply(); if (totalSupply != 0) { //Already deployed return(false); } BigInteger maximumSupply = MaxSupplyUnits * DecimalsFactor; FishCoinDao.SetTotalSupply(maximumSupply); UtilityDao.UpdateRandomStep(1); FishCoinDao.UpdateBalance(AppGlobals.FishEffectScriptHash, maximumSupply); Notifier.Transfer(null, AppGlobals.FishEffectScriptHash, maximumSupply); Runtime.Log("Deploy ok"); return(true); }
public bool CalculateCanExchange(byte[] scriptHash, BigInteger amount) { BigInteger height = Blockchain.GetHeight(); BigInteger currentInCirculation = FishCoinDao.GetCurrentInCirculation(); BigInteger newAmount = currentInCirculation + amount; if (newAmount > FishCoinDao.GetTotalSupply()) { return(false); } if (height < IcoInitialBlock) { return(false); } if (amount > MaxExchangeLimitPerRound) { return(false); } if (height <= IcoFinalBlock) { BigInteger exchangedByThisScriptHash = FishCoinDao.GetExchangedGasByScriptHash(scriptHash); BigInteger finalAmount = exchangedByThisScriptHash + amount; if (finalAmount > MaxExchangeLimitPerRound) { return(false); } } //Mudar de local //FishCoinDao.UpdateExchangeByScriptHash(scriptHash, finalAmount); return(true); }