Listing period
The seller wants to offer an item so the buyers can discover and commit to it.
/
LISTED
COMMITTED
Period actions
Create an offer
Commit to an offer
/
*Premint vouchers
*Commit to price discovery offer
*Create a group
*Create a twin
*Create a bundle
Void an offer
Extend an offer
*Update offer royalty recipients
Actions marked with *
are Advanced use cases and are described at the bottom.
Basic offer parameters
Boson dACP supports a variety of different offers. The basic offer has the following parameters:
Price: the amount the buyer needs to pay in order to receive rNFT. The price can be fixed or unknown at offer creation. If the price is unknown, the seller can put the rNFT in any ERC721 compatible external price discovery mechanism (NFS marketplaces, AMM) and the price is observed only at the commitment time.
Seller deposit: the amount that is added to the price and given to the buyer if the seller revokes the rNFT before it is redeemed.
Buyer cancellation penalty: the amount that is deducted from the price before it is returned to the buyer when the buyer cancels the rNFT before it is redeemed. The cancellation penalty is given to the seller.
Available quantity: the maximal number of rNFTs that can be issued for the offer. After the offer is depleted, new commits are automatically prevented. It is possible to make unlimited offers.
Exchange token: the currency for all financial properties (price, seller deposit, buyer cancelation penalty, dispute resolver fee). It can be any ERC20 address or native token.
Metadata URI and hash: additional metadata, describing the asset and normally stored off-chain. URI is reference to metadata location and hash is used to prove data validity. The metadata format and hashing method are arbitrary and not observable by the protocol.
Collection index: the seller can create multiple rNFT collections and choose for each offer, where corresponding rNFTs are issued.
Offer validity: the starting and ending date when the buyers can commit to the offer.
Redemption parameters: the definition when the rNFT can be redeemed. It can be the same for all rNFTs (fixed starting and ending date), or can be dynamic and starts only when the buyer commits and lasts for a predefined period.
Dispute period: the length of the period during which the asset must be delivered.
Resolution period:the length of the period during which the dispute must be resolved.
Royalty info: the addresses and corresponding percentages that are awarded to them on every secondary trade.
Dispute resolver: the identifier of the dispute resolver that resolves the escalated dispute.
You can read more about other use cases at the bottom of the page in Advanced use cases
TypeScript SDK
The seller creates an offer, which allows the buyers to commit.
const MSEC_PER_DAY = 24 * 60 * 60 * 1000;
const offer = {
collectionIndex: "0",
price: parseEther("0.03"),
sellerDeposit: parseEther("0.01"),
agentId: "0",
buyerCancelPenalty: parseEther("0.01"),
quantityAvailable: 10,
validFromDateInMS: Date.now() + 1000,
validUntilDateInMS: Date.now() + 20 * MSEC_PER_DAY,
voucherRedeemableFromDateInMS: Date.now() + 1000,
voucherRedeemableUntilDateInMS: Date.now() + 30 * MSEC_PER_DAY,
disputePeriodDurationInMS: 40 * MSEC_PER_DAY,
voucherValidDurationInMS: 0,
resolutionPeriodDurationInMS: 50 * MSEC_PER_DAY,
exchangeToken: 0x00000000000000000000000000000000, // native token
disputeResolverId: "1",
metadataUri: "https://offerMetadata.uri",
metadataHash: "0xba5348e4fa8d40f569f0a83ab38ab799a3ef1a35b1",
}
await sellerCoreSDK.createOffer(offerArgs)
Multiple offers can be created in a single transaction.
Solidity
The seller creates an offer, which allows the buyers to commit.
IBosonOfferHandler bosonProtocol = IBosonOfferHandler(_bosonProtocolAddress);
uint256 MSEC_PER_DAY = 24 * 60 * 60 * 1000;
BosonTypes.Offer memory offer = BosonTypes.Offer({
id: 0, // will be ignored and auto-assigned
sellerId: 1, // existing seller ID
price: 30000000000000000, // 0.03 ETH
sellerDeposit: 10000000000000000, // 0.01 ETH
buyerCancelPenalty: 10000000000000000, // 0.01 ETH
quantityAvailable: 10,
exchangeToken: address(0), // native token (ETH)
priceType: BosonTypes.PriceType.Static,
metadataUri: "https://offerMetadata.uri",
metadataHash: "0xba5348e4fa8d40f569f0a83ab38ab799a3ef1a35b1",
voided: false,
collectionIndex: 0,
royaltyInfo: new BosonTypes.RoyaltyInfo[](0) // no royalties
});
BosonTypes.OfferDates memory offerDates = BosonTypes.OfferDates({
validFrom: block.timestamp + 1000,
validUntil: (block.timestamp + 1000) + (20 * MSEC_PER_DAY),
voucherRedeemableFrom: block.timestamp + 2000,
voucherRedeemableUntil: (block.timestamp * 2000) + (30 * MSEC_PER_DAY) // 30 days
});
BosonTypes.OfferDurations memory offerDurations = BosonTypes.OfferDurations({
disputePeriod: 40 * MSEC_PER_DAY, // 40 days
voucherValid: 0,
resolutionPeriod: 50 * MSEC_PER_DAY // 50 days
});
uint256 disputeResolverId = 1;
uint256 agentId = 0; // no agent
uint256 feeLimit = 100000000000000000; // 0.1 ETH
bosonProtocol.createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId, feeLimit);
Multiple offers can be created in a single transaction.
IBosonOfferHandler bosonProtocol = IBosonOfferHandler(_bosonProtocolAddress);
uint256 MSEC_PER_DAY = 24 * 60 * 60 * 1000;
// Create array of 3 offers
BosonTypes.Offer[] memory offers = new BosonTypes.Offer[](3);
BosonTypes.OfferDates[] memory offerDatesArray = new BosonTypes.OfferDates[](3);
BosonTypes.OfferDurations[] memory offerDurationsArray = new BosonTypes.OfferDurations[](3);
uint256[] memory disputeResolverIds = new uint256[](3);
uint256[] memory agentIds = new uint256[](3);
uint256[] memory feeLimits = new uint256[](3);
// Configure each offer
for (uint256 i = 0; i < 3; i++) {
offers[i] = BosonTypes.Offer({
id: 0, // will be ignored and auto-assigned
sellerId: 1, // existing seller ID
price: 30000000000000000, // 0.03 ETH
sellerDeposit: 10000000000000000, // 0.01 ETH
buyerCancelPenalty: 10000000000000000, // 0.01 ETH
quantityAvailable: 10,
exchangeToken: address(0), // native token (ETH)
priceType: BosonTypes.PriceType.Static,
metadataUri: "https://offerMetadata.uri",
metadataHash: "0xba5348e4fa8d40f569f0a83ab38ab799a3ef1a35b1",
voided: false,
collectionIndex: 0,
royaltyInfo: new BosonTypes.RoyaltyInfo[](0) // no royalties
});
offerDatesArray[i] = BosonTypes.OfferDates({
validFrom: (block.timestamp * 1000) + 1000,
validUntil: (block.timestamp * 1000) + (20 * MSEC_PER_DAY),
voucherRedeemableFrom: (block.timestamp * 1000) + 1000,
voucherRedeemableUntil: (block.timestamp * 1000) + (30 * MSEC_PER_DAY)
});
offerDurationsArray[i] = BosonTypes.OfferDurations({
disputePeriod: 40 * MSEC_PER_DAY,
voucherValid: 0,
resolutionPeriod: 50 * MSEC_PER_DAY
});
disputeResolverIds[i] = 1;
agentIds[i] = 0; // no agent
feeLimits[i] = 100000000000000000; // 0.1 ETH
}
bosonProtocol.createOfferBatch(offers, offerDatesArray, offerDurationsArray, disputeResolverIds, agentIds, feeLimits);
Widget
The buyer commits to an offer and receives a tradeable rNFT.
Add the following
<script>
entries, either in<head>
or<body>
of their website:
<script type="text/javascript" src="https://widgets.bosonprotocol.io/scripts/zoid/zoid.min.js"></script>
<script type="text/javascript" src="https://widgets.bosonprotocol.io/scripts/commit-button.js"></script>
Add the following code wherever you want to display the commit button:
<div id="container"></div>
<script>
const instance = CommitButton({
configId: "testing-80002-0",
context: "iframe",
productUuid: "086b32-3fcd-00d1-0624-67513e85415c",
sellerId: "138",
modalMargin: "2%",
lookAndFeel: "modal",
disabled: false,
buttonStyle: {
minWidth: "100px",
minHeight: "100px",
shape: "rounded",
color: "white"
},
onGetDimensions: function (dimensions) {
const { offsetHeight, offsetWidth } = dimensions;
document.querySelector(
"#container"
).style.height = `${offsetHeight}px`;
document.querySelector(
"#container"
).style.minWidth = `${offsetWidth}px`;
}
});
instance.render("#container");
</script>
You can also update properties dynamically with updateProps(updatedPropertiesObject)
:
<script>
let disabled = false;
const instance = CommitButton({
/* ... */
disabled,
});
instance.render("#container");
function toggleDisableState() {
disabled = !disabled;
instance.updateProps({ disabled });
}
</script>
<button onclick="toggleDisableState()" style="margin: 20px;">toggle disable state</button>
The Commit button has been created with zoid so you can use their drivers to have components in your favorite framework.
Discover more...
The Commit Widget is part of the React Component library from Boson Core Component you can discover on this Storybook page. Also, you can play around with the Commit button itself Storybook page.
You can find an example HTML file which embeds the commit button on the the widgets subdomain: https://widgets.bosonprotocol.io/scripts/commit-button-example.html
Advanced use cases
Last updated