아이템 구매 (purchaseItem)

function purchaseItem(
    string memory uuid,
    string memory itemId,
    uint256 purchaseItemPrice
) external nonReentrant whenNotPaused {
    ...        
    emit PurchaseItemSuccess(
        purchaseInfo.buyer,
        purchaseInfo.uuid,
        purchaseInfo.itemId,
        purchaseInfo.purchaseId,
        purchaseInfo.purchasedItemPrice
    );
}

  • Parameters

TypeValueDescription

string

uuid

  • 사용자 UUID

string

itemId

  • 구매할 Item ID

uint256

purchaseItemPrice

  • 구매 지불액 (wei)

  • Errors

MessageCause

FandomShop: Item already purchased

  • 요청한 유저가 이미 구매한 아이템 (중복구매불가)

FandomShop: UUID should not be empty

  • uuid가 비었음

FandomShop: Item id should not be empty

  • itemId가 비었음

FandomShop: Purchase item price should be greater than zero

  • purchaseItemPrice가 비었음

FandomShop: Payment token transfer failed

  • 전송 후 입금이 정상적으로 이루어지지 않음. 재시도 요망

  • Event

    struct PurchaseHistory {
        uint256 purchaseId; // Purchase ID (PK)
        uint256 purchasedItemPrice; // 구매 아이템 가격 (wei)
        address buyer; // 구매자 EOA
        string uuid; // 구매자 UUID
        string itemId; // 구매한 Item ID
    }

Last updated