Skip to content

v1.1.0

Latest
Compare
Choose a tag to compare
@thecryptofruit thecryptofruit released this 17 Mar 10:11
· 1 commit to main since this release
430d0b0

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 to UsingHelpers.sol. This struct includes the new threshold member.
  • Voucher sets are now mapped to a ConditionalCommitInfo struct instead of a token Id (voucherToToken replaced by voucherSetToConditionalCommit)
  • The registerVoucherSetId function was changed to accept a struct of type ConditionalCommitInfo instead of individual conditional commit parameters. The gateAddress and registerConditionalCommit members are not used by this function. The default values can be passed in (0 address and false, respectively). The struct data can be passed in as a JSON object from Typescript. See test file 11_gate.ts for examples
  • The registerVoucherSetId function now allows conditional token Id 0 to be registered
  • The registerVoucherSetId function checks that the conditional token type is NONFUNGIBLE_TOKEN if condition OWNERSHIP is chosen
  • The check function was modified to call either the checkOwnership or checkBalance 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 the getConditionalCommitInfo(_tokenIdSupply) function
  • The getNonTransferableTokenContract() function was replaced by the getConditionalTokenContract() function
  • The LogVoucherSetRegistered event now emits the _condition and _threshold parameters

BosonRouter

  • All requestCreateOrder*Conditional functions have been modified to accept the ConditionalCommitInfo 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 the ConditionalCommitInfo to the Gate.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 type DepositsReleased
  • Added field seller of a type address to struct VoucherStatus

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 in VoucherKernel which returns the sum of buyer and seller deposit
  • Function isDepositReleased is added to VoucherKernel. 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 the seller field of voucherStatus. Value is the supplyHolder 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