private void Burn(BigInteger amount, Address from, ITokenPicker customPicker = null) { if (amount <= 0) { throw new NonPositiveTokenAmountException(nameof(amount), amount); } customPicker = customPicker ?? this.DefaultTokenPicker; IReadOnlyTaggedTokens tokensToBurn = customPicker.Pick(this.GetBalances(from), amount); this.RemoveFromBalances(tokensToBurn, from); }
private void Transfer(BigInteger amount, Address from, Address to, ITokenPicker customPicker = null) { if (from.Equals(to)) { throw new ArgumentException("Addresses can't transfer to themselves"); } if (amount <= 0) { throw new NonPositiveTokenAmountException(nameof(amount), amount); } customPicker = customPicker ?? this.DefaultTokenPicker; IReadOnlyTaggedTokens tokensToTransfer = customPicker.Pick(this.GetBalances(from), amount); this.RemoveFromBalances(tokensToTransfer, from); this.AddToBalances(tokensToTransfer, to); this.NotifyReceived(tokensToTransfer, from, to); }