private void AssertSymbolToPayTxFeeIsValid(SymbolToPayTXSizeFee tokenInfo) { Assert(!string.IsNullOrEmpty(tokenInfo.TokenSymbol) & tokenInfo.TokenSymbol.All(IsValidSymbolChar), "Invalid symbol."); Assert(tokenInfo.AddedTokenWeight > 0 && tokenInfo.BaseTokenWeight > 0, $"symbol:{tokenInfo.TokenSymbol} weight should be greater than 0"); }
private decimal GetBalanceCalculatedBaseOnPrimaryToken(SymbolToPayTXSizeFee tokenInfo, string baseSymbol, long cost) { var availableBalance = State.Balances[Context.Sender][tokenInfo.TokenSymbol]; if (tokenInfo.TokenSymbol == baseSymbol) { availableBalance -= cost; } return(availableBalance.Mul(tokenInfo.BaseTokenWeight) .Div(tokenInfo.AddedTokenWeight)); }