Пример #1
0
 protected bool Equals(PurchaseInfo other)
 {
     return(OrderId.Equals(other.OrderId) &&
            TradableId.Equals(other.TradableId) &&
            SellerAgentAddress.Equals(other.SellerAgentAddress) &&
            SellerAvatarAddress.Equals(other.SellerAvatarAddress) &&
            ItemSubType == other.ItemSubType &&
            Price.Equals(other.Price));
 }
Пример #2
0
        private void ValidateForCancelOrder(AvatarState avatarState, Guid tradableId)
        {
            if (!avatarState.address.Equals(SellerAvatarAddress) || !avatarState.agentAddress.Equals(SellerAgentAddress))
            {
                throw new InvalidAddressException(
                          $"Invalid Seller Addresses. Expected Addresses: {SellerAgentAddress}, {SellerAvatarAddress}. Actual: {avatarState.agentAddress}, {avatarState.address}");
            }

            if (!TradableId.Equals(tradableId))
            {
                throw new InvalidTradableIdException($"{tradableId} is not equals {TradableId}");
            }
        }
Пример #3
0
        private int ValidateForTransfer(AvatarState avatarState, Guid tradableId, FungibleAssetValue price, long blockIndex)
        {
            if (!avatarState.address.Equals(SellerAvatarAddress) || !avatarState.agentAddress.Equals(SellerAgentAddress))
            {
                return(Buy.ErrorCodeInvalidAddress);
            }

            if (!TradableId.Equals(tradableId))
            {
                return(Buy.ErrorCodeInvalidTradableId);
            }

            if (!Price.Equals(price))
            {
                return(Buy.ErrorCodeInvalidPrice);
            }

            return(ExpiredBlockIndex < blockIndex ? Buy.ErrorCodeShopItemExpired : 0);
        }