You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicfunc receive(caller : Principal, tokenId : Types.TokenIdentifier) : asyncResult.Result<(), Types.CommonError> {
// if token is not available refund ICPif (not tokenAvailable(tokenId)) {
addRefund(caller, tokenId);
return #err;
};
let paid =await checkPayment(caller, tokenId);
if (not paid) {
return #err;
};
if (not tokenAvailable(tokenId)) {
addRefund(caller, tokenId);
return #err;
};
transferToken(caller, tokenId);
addDisbursement(fees);
addDisbursement(tokenOwner);
return #ok;
};
accountId for payment computed from canisterPrincipal + userPrincipal + tokenId
In addRefund we add cron job to return icp to user if payment was recieved and token was sold to another user.
In addRefund we also check if there any deferred disbursements in conflict with refund. (if the same user is calls receive multiple times)
Pros:
Fewer steps to buy NFT
No lock logic. No one can lock entire collection
???
Cons:
Backwards incompatible. Other marketplaces should implement the new logic.
Sometimes(rarely?) we need to refund ICP(fee but low)
???
The text was updated successfully, but these errors were encountered:
Diagram:
Pseudo code:
accountId
for payment computed from canisterPrincipal + userPrincipal + tokenIdIn
addRefund
we add cron job to return icp to user if payment was recieved and token was sold to another user.In
addRefund
we also check if there any deferred disbursements in conflict with refund. (if the same user is callsreceive
multiple times)Pros:
Cons:
The text was updated successfully, but these errors were encountered: