Boson Protocol Release v1.1.0
17 March 2022
https://github.com/bosonprotocol/contracts/tree/v1.1.0
The purpose of this release is to enhance the protocol with more flexible conditional commits and more flexible withdrawal pattern.
It will replace the protocol, used by the metaverse commerce application - The Portal
Functionality
It incorporates the following major changes, compared to v1.0.0.
- Gate contract is not limited to non transferable ERC1155 anymore. Now it supports conditions based on holding of ERC20, ERC721 or ERC1155 tokens. It allows checking for ownership of specific ERC721 token and enables the seller to specify a minimal balance of tokens that users need to hold in order to take the offer.
- BosonRouter methods for creating the voucherSet are modified to support new gate functionality. Interface was changed so function now accept all information about conditions in struct ConditionalCommitInfo
- Function
withdrawSingle
is added, which allows withdrawal for specific entity{ISSUER, HOLDER, POOL}
for specific voucher - Fixed the mismatch in escrow state if voucherSet was transferred when some of previously issued vouchers were not finalized yet
- Some minor changes, optimization and refactoring.
- For complete list of changes in code, refer to the bottom of these release notes
Ethereum Mainnet Contract addresses:
Contract Name | Address |
---|---|
TokenRegistry | 0xcaf39b7bcfc3aEd00D62488d3668230B7599CF05 |
VoucherSets | 0xcF6d79E65C49a93a42dd8c474b46998eea4aDEc8 |
Vouchers | 0xDE41a99562adA9Ee04d9750C99A91C1181EbD875 |
VoucherKernel | 0x19c10A47C9356eFD0E4377411Db627636Ee9E3C6 |
Cashier | 0x244154F58e9Bf6C15c3a09846eFB7bEcFe92A880 |
Boson Router | 0x0A393AEF6dbCd7e7088AcF323f9d28b093B9aB5a |
DaiTokenWrapper | 0xc762e8f2Ce9831b7278e2939dFFcD9367dE7e6C8 |
Gate | 0xb3f8AeF4D9E54a17514f40a59AdfC35758A7EC8E |
Erc1155NonTransferable (Quest NFTs for Conditional Commit) | 0xBAd188Ec8B4E168dF2a39C462A7293955EF04bf8 |
Code changes
Gate
enum TokenType {FUNGIBLE_TOKEN, NONFUNGIBLE_TOKEN, MULTI_TOKEN}
was added to keep track of the type of conditional commit token associated with the instance of the Gate contract- The
ConditionalCommitInfo
struct was added toUsingHelpers.sol
. This struct includes the new threshold member. - Voucher sets are now mapped to a
ConditionalCommitInfo
struct instead of a token Id (voucherToToken
replaced byvoucherSetToConditionalCommit
) - The
registerVoucherSetId
function was changed to accept a struct of typeConditionalCommitInfo
instead of individual conditional commit parameters. ThegateAddress
andregisterConditionalCommit
members are not used by this function. The default values can be passed in (0
address andfalse
, respectively). The struct data can be passed in as a JSON object from Typescript. See test file11_gate.ts
for examples - The
registerVoucherSetId
function now allows conditional token Id0
to be registered - The
registerVoucherSetId
function checks that the conditional token type isNONFUNGIBLE_TOKEN
if conditionOWNERSHIP
is chosen - The
check
function was modified to call either thecheckOwnership
orcheckBalance
function, depending on the condition registered for the voucher set - The
checkBalance
function now checks whether balance is>= threshold
instead of> 0
- The
getNftTokenId(_tokenIdSupply)
function was replaced by thegetConditionalCommitInfo(_tokenIdSupply)
function - The
getNonTransferableTokenContract()
function was replaced by thegetConditionalTokenContract()
function - The
LogVoucherSetRegistered
event now emits the_condition
and_threshold
parameters
BosonRouter
- All
requestCreateOrder*Conditional
functions have been modified to accept theConditionalCommitInfo
struct. This modification was necessary for technical reasons. Adding the condition and threshold parameters separately triggered a stack too deep error. The only way to mitigate the error was to reduce the number of parameters being passed into the functions. - The
finalizeConditionalOrder
internal function now passes theConditionalCommitInfo
to theGate.registerVoucherSetId
function - The
LogConditionalOrderCreated
event now also emits_condition
and_threshold
parameters
UsingHelpers
enum Entity {ISSUER, HOLDER, POOL}
is added- New struct
DepositsReleased
is introduced. I holds the information who has already withdrawn deposits and the total withdrawal amount VoucherStatus
has additional field of typeDepositsReleased
- Added field
seller
of a typeaddress
to structVoucherStatus
Cashier
- Function
withdrawSingle
is added. It allows withdrawal for specific entity for specific voucher - Function
withdraw
is refactored, but otherwise its behaviour does not change for an external caller - Introduced
distributeAndWithdraw
internal function which calculates what entity should receive and distribute funds - When withdrawing funds, issuer is no longer determined as supply holder, but rather as voucher seller (by calling
getVoucherSeller
instead of getSupplyHolder)
VoucherKernel
- New function
getTotalDepositsForVoucher
inVoucherKernel
which returns the sum of buyer and seller deposit - Function
isDepositReleased
is added toVoucherKernel
. It tells if if entity has already withdrawn the deposits for a given voucher - Function
setDepositsReleased
is changed so it properly stores the information about deposit withdrawals - When voucher is created (function
extract721
), we now set theseller
field ofvoucherStatus
. Value is thesupplyHolder
at the time of the transaction - Function
getVoucherSeller
is added. It returns the address of the seller at the time, when the buyer committed to a voucher. - In
cancelOrFault
we check now that COF was requested by voucher seller, not by current supply holder