Skip to content

Commit

Permalink
feat: update contract offers no expiration (#616)
Browse files Browse the repository at this point in the history
* feat: update contract offers no expiration

* feat: update exchange policy rules template

* chore: update exchage policy rules ipfs
  • Loading branch information
albertfolch-redeemeum authored Dec 1, 2023
1 parent 6d11c62 commit 3954ade
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 5 additions & 3 deletions data/contractualAgreement.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ As Web3’s Commerce Layer, Boson Protocol enables the tokenization, transfer an

#### Offer Creation

The Seller creates an Offer to sell an Item at a particular price, sets the Cancellation Penalty and the Seller Deposit, the Offer Validity Period, the Redemption Period, and the Resolution Period.
The Seller creates an Offer to sell an Item at a particular price, sets the Cancellation Penalty and the Seller Deposit{{#hasExpirationDate}}, the Offer Validity Period{{/hasExpirationDate}}, the Redemption Period, and the Resolution Period.

The Seller puts the Seller Deposit into the seller pool that is locked in a smart contract.

Expand Down Expand Up @@ -155,8 +155,10 @@ The Buyer can cancel the rNFT and receive in exchange the Item Price minus the C
**Item Price** means the price originally paid by the Primary Buyer for an rNFT with the right to redeem an Item at the Commit action. The Item Price is set as **_{{priceValue}} {{exchangeTokenSymbol}}_**. The Item Price includes delivery costs. For customs and import taxes, refer to Exhibit A - Seller’s Shop Policy, clause 1.1.

**Offer** means an expression of intent by the Seller to sell an Item.


{{#hasExpirationDate}}
**Offer Validity Period** means the period during which a Buyer may Commit to the Seller’s Offer, which is from **_{{#toISOString}}{{validFromDateInMS}}{{/toISOString}}_** to **_{{#toISOString}}{{validUntilDateInMS}}{{/toISOString}}_**.
{{/hasExpirationDate}}

**Primary Buyer** means the first buyer who has acquired the rNFT.

Expand All @@ -170,7 +172,7 @@ The Buyer can cancel the rNFT and receive in exchange the Item Price minus the C

**Redeemable NFT (rNFT / NFT Voucher)** means a voucher using NFT technology, representing the right to redeem an Item. It is important to note that an rNFT is a voucher that can be redeemed for a digital and/or physical good and it is subject to the rNFTs T&Cs and it is NOT a digital representation of said good.

**Redemption Period** means the time period during which the Seller promises to comply with the terms of the rNFT, until it expires. The Redemption Period is from **_{{#toISOString}}{{voucherRedeemableFromDateInMS}}{{/toISOString}}_** to **_{{#toISOString}}{{voucherRedeemableUntilDateInMS}}{{/toISOString}}_**.
**Redemption Period** means the time period during which the Seller promises to comply with the terms of the rNFT, until it expires. The Redemption Period is **_{{#msecToDay}}{{voucherValidDurationInMS}}{{/msecToDay}}_** days from and inclusive of the day you sign the transaction as your commitment to the Offer.

**Resolution Period** means the time period during which the Buyer and the Seller may mutually resolve a Dispute, which is within **_{{#msecToDay}}{{resolutionPeriodDurationInMS}}{{/msecToDay}}_** days after the dispute is raised.

Expand Down
2 changes: 1 addition & 1 deletion data/exchangePolicies/exchangePolicyRules.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"description": "Buyer/Seller Agreement Template",
"type": "string",
"flags": "i",
"pattern": "^(fairExchangePolicy|ipfs://QmS6SUVL1mhRq9wyNho914vcHwj3gC491vq7wtdoe34SUz|ipfs://QmZEYfG31PR1SgStg1wCFawQPxtbY9N44vDK9fjj3J9oz2|ipfs://QmS6SUVL1mhRq9wyNho914vcHwj3gC491vq7wtdoe34SUz|ipfs://QmXfDShmggHm7BzMbkzv2rRowwPyJ55mypGp32qKSPGto4|ipfs://QmXxRznUVMkQMb6hLiojbiv9uDw22RcEpVk6Gr3YywihcJ|ipfs://QmQ8ZTmmRV15rFaWG9KRyjFRrpaD1o2sDwZoYiWgBaAto6|ipfs://QmaNj7vGuCEvaM5vyucp5z1S9VprMnZWmVxYGn6FHhgePF)$",
"pattern": "^(fairExchangePolicy|ipfs://QmS6SUVL1mhRq9wyNho914vcHwj3gC491vq7wtdoe34SUz|ipfs://QmZEYfG31PR1SgStg1wCFawQPxtbY9N44vDK9fjj3J9oz2|ipfs://QmS6SUVL1mhRq9wyNho914vcHwj3gC491vq7wtdoe34SUz|ipfs://QmXfDShmggHm7BzMbkzv2rRowwPyJ55mypGp32qKSPGto4|ipfs://QmXxRznUVMkQMb6hLiojbiv9uDw22RcEpVk6Gr3YywihcJ|ipfs://QmQ8ZTmmRV15rFaWG9KRyjFRrpaD1o2sDwZoYiWgBaAto6|ipfs://QmaNj7vGuCEvaM5vyucp5z1S9VprMnZWmVxYGn6FHhgePF|ipfs://QmbkoWec4NcmxJk7xpooNyfvj9ZarkW6RXq2ZJ9W6UGXZu)$",
"required": true
}
},
Expand Down
6 changes: 3 additions & 3 deletions data/ipfs.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
HERE AFTER THE IPFS HASH OF THE UPLOADED FILES (FOR RECORDING AND TRACEABILITY)
===============================================================================

contractualAgreement.template.md QmaNj7vGuCEvaM5vyucp5z1S9VprMnZWmVxYGn6FHhgePF
rNFTLicense.template.md QmdN6tCBkiGiCyr7xEfsEysoYrdkacdU3P2mEdVC5y4nF2
exchangePolicyRules.template.json QmbVmAspK2wi6Xrm6yB75TLqgfv9PAVv3kWxdsyQpEm79D
contractualAgreement.template.md QmbkoWec4NcmxJk7xpooNyfvj9ZarkW6RXq2ZJ9W6UGXZu
rNFTLicense.template.md QmZnkoiGRt9XX5KqyEz1G3UKUXTKfoYECRQz2rxa3m3z3a
exchangePolicyRules.template.json QmbUskZ7q6Vd4ZUHoZc6iQG5Cu4KUPSndRbTFdccWjEZYH
2 changes: 1 addition & 1 deletion data/rNFTLicense.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ By redeeming the rNFT within the Redemption Period and having received from the

**Primary Buyer** means the first buyer who has acquired the rNFT.

**Redemption Period** means the time period during which the Seller promises to comply with the terms of the rNFT, until it expires. The Redemption Period is from **_{{#toISOString}}{{voucherRedeemableFromDateInMS}}{{/toISOString}}_** to **_{{#toISOString}}{{voucherRedeemableUntilDateInMS}}{{/toISOString}}_**.
**Redemption Period** means the time period during which the Seller promises tocomply with the terms of the rNFT, until it expires. The Redemption Period is **{{#msecToDay}}{{voucherValidDurationInMS}}{{/msecToDay}}** days from andinclusive of the day you sign the transaction as your commitment to the Offer.

**Seller** means anyone who offers to sell an Item through an rNFT.
___
Expand Down
6 changes: 6 additions & 0 deletions packages/core-sdk/src/offers/renderContractualAgreement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type TemplateRenderingData = CreateOfferArgs &
buyerCancelPenaltyValue: string; // Convert in decimals value
escalationDepositValue: string; // Convert in decimals value
exchangeTokenSymbol: string;
hasExpirationDate: boolean;
toISOString: () => void;
msecToDay: () => void;
secToDay: () => void;
Expand Down Expand Up @@ -203,6 +204,7 @@ function convertExistingOfferData(offerDataSubGraph: OfferFieldsFragment): {
};
}

const MAX_AND_MIN_DATE_TIMESTAMP = 8.64e15; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
export async function prepareRenderingData(
offerData: CreateOfferArgs,
offerMetadata: AdditionalOfferMetadata,
Expand All @@ -225,6 +227,10 @@ export async function prepareRenderingData(
offerMetadata.escalationDeposit,
tokenInfo.decimals
),
hasExpirationDate:
!!offerData.validUntilDateInMS &&
Number(offerData.validUntilDateInMS.toString()) <
MAX_AND_MIN_DATE_TIMESTAMP,
toISOString: function () {
return function (num, render) {
try {
Expand Down

0 comments on commit 3954ade

Please sign in to comment.