Skip to main content

IBosonAccountHandler

View Source: contracts/interfaces/handlers/IBosonAccountHandler.sol

↗ Extends: IBosonAccountEvents

IBosonAccountHandler

Handles creation, update, retrieval of accounts within the protocol.
The ERC-165 identifier for this interface is: 0xbc1d7461

Functions

createSeller

Creates a seller.
Emits a SellerCreated event if successful.
Reverts if:
- Caller is not the supplied admin or does not own supplied auth token
- Caller is not the supplied assistant
- Supplied clerk is not a zero address
- The sellers region of protocol is paused
- Address values are zero address
- Addresses are not unique to this seller
- Seller is not active (if active == false)
- Admin address is zero address and AuthTokenType == None
- AuthTokenType is not unique to this seller
- AuthTokenType is Custom
- Seller salt is not unique
- Clone creation fails

function createSeller(struct BosonTypes.Seller _seller,
struct BosonTypes.AuthToken _authToken,
struct BosonTypes.VoucherInitValues _voucherInitValues)
external

Arguments

NameTypeDescription
_sellerBosonTypes.Sellerthe fully populated struct with seller id set to 0x0
_authTokenBosonTypes.AuthTokenoptional AuthToken struct that specifies an AuthToken type and tokenId that the seller can use to do admin functions
_voucherInitValuesBosonTypes.VoucherInitValuesthe fully populated BosonTypes.VoucherInitValues struct

createBuyer

Creates a buyer.
Emits an BuyerCreated event if successful.
Reverts if:
- The buyers region of protocol is paused
- Wallet address is zero address
- Active is not true
- Wallet address is not unique to this buyer

function createBuyer(struct BosonTypes.Buyer _buyer) 
external

Arguments

NameTypeDescription
_buyerBosonTypes.Buyerthe fully populated struct with buyer id set to 0x0

createDisputeResolver

Creates a dispute resolver.
Emits a DisputeResolverCreated event if successful.
Reverts if:
- Caller is not the supplied admin and assistant
- Supplied clerk is not a zero address
- The dispute resolvers region of protocol is paused
- Any address is zero address
- Any address is not unique to this dispute resolver
- EscalationResponsePeriod is invalid
- Some seller does not exist
- Some seller id is duplicated
- DisputeResolver is not active (if active == false)
- Fee amount is a non-zero value. Protocol doesn't yet support fees for dispute resolvers

function createDisputeResolver(struct BosonTypes.DisputeResolver _disputeResolver,
struct BosonTypes.DisputeResolverFee[] _disputeResolverFees,
uint256[] _sellerAllowList)
external

Arguments

NameTypeDescription
_disputeResolverBosonTypes.DisputeResolverthe fully populated struct with dispute resolver id set to 0x0
_disputeResolverFeesBosonTypes.DisputeResolverFee[]list of fees dispute resolver charges per token type. Zero address is native currency. See {BosonTypes.DisputeResolverFee} feeAmount will be ignored because protocol doesn't yet support fees yet but DR still needs to provide array of fees to choose supported tokens
_sellerAllowListuint256[]list of ids of sellers that can choose this dispute resolver. If empty, there are no restrictions on which seller can chose it.

createAgent

Creates a marketplace agent.
Emits an AgentCreated event if successful.
Reverts if:
- The agents region of protocol is paused
- Wallet address is zero address
- Active is not true
- Wallet address is not unique to this agent
- Fee percentage + protocol fee percentage is greater than the max allowable fee percentage for an offer

function createAgent(struct BosonTypes.Agent _agent) 
external

Arguments

NameTypeDescription
_agentBosonTypes.Agentthe fully populated struct with agent id set to 0x0

updateSeller

Updates treasury address, if changed. Puts admin, assistant and AuthToken in pending queue, if changed.
Pending updates can be completed by calling the optInToSellerUpdate function.Active flag passed in by caller will be ignored. The value from storage will be used.
Emits a SellerUpdateApplied event if the seller has changed the treasury.
Emits a SellerUpdatePending event if the seller has requested an update for admin, assistant, or auth token.
Holder of new auth token and/or owner(s) of new addresses for admin, assistant must opt-in to the update.
Reverts if:
- The sellers region of protocol is paused
- Address values are zero address
- Addresses are not unique to this seller
- Supplied clerk is not a zero address
- Caller address is not the admin address of the stored seller with no AuthToken
- Caller is not the owner of the seller's stored AuthToken
- Seller does not exist
- Admin address is zero address and AuthTokenType == None
- AuthTokenType is not unique to this seller
- AuthTokenType is Custom
- No field has been updated or requested to be updated

function updateSeller(struct BosonTypes.Seller _seller,
struct BosonTypes.AuthToken _authToken)
external

Arguments

NameTypeDescription
_sellerBosonTypes.Sellerthe fully populated seller struct
_authTokenBosonTypes.AuthTokenoptional AuthToken struct that specifies an AuthToken type and tokenId that the seller can use to do admin functions

optInToSellerUpdate

Opt-in to a pending seller update
Emits a SellerUpdateApplied event if successful.
Reverts if:
- The sellers region of protocol is paused
- Addresses are not unique to this seller
- Caller address is not pending update for the field being updated
- Caller is not the owner of the pending AuthToken being updated
- No pending update exists for this seller
- AuthTokenType is not unique to this seller
- Seller tries to update the clerk

function optInToSellerUpdate(uint256 _sellerId,
enum BosonTypes.SellerUpdateFields[] _fieldsToUpdate)
external

Arguments

NameTypeDescription
_sellerIduint256seller id
_fieldsToUpdateenum BosonTypes.SellerUpdateFields[]fields to update, see SellerUpdateFields enum

updateBuyer

Updates a buyer, with the exception of the active flag.
All other fields should be filled, even those staying the same.Active flag passed in by caller will be ignored. The value from storage will be used.
Emits a BuyerUpdated event if successful.
Reverts if:
- The buyers region of protocol is paused
- Caller is not the wallet address of the stored buyer
- Wallet address is zero address
- Address is not unique to this buyer
- Buyer does not exist
- Current wallet address has outstanding vouchers

function updateBuyer(struct BosonTypes.Buyer _buyer) 
external

Arguments

NameTypeDescription
_buyerBosonTypes.Buyerthe fully populated buyer struct

updateDisputeResolver

Updates treasury address, escalationResponsePeriod or metadataUri if changed. Puts admin and assistant in pending queue, if changed.
Pending updates can be completed by calling the optInToDisputeResolverUpdate function.
Update doesn't include DisputeResolverFees, allowed seller list or active flag.
All DisputeResolver fields should be filled, even those staying the same.
Use removeFeesFromDisputeResolver and addFeesToDisputeResolver to add and remove fees.
Use addSellersToAllowList and removeSellersFromAllowList to add and remove allowed sellers.Active flag passed in by caller will be ignored. The value from storage will be used.
Emits a DisputeResolverUpdated event if successful.
Emits a DisputeResolverUpdatePending event if the dispute resolver has requested an update for admin or assistant.
Owner(s) of new addresses for admin, assistant must opt-in to the update.
Reverts if:
- The dispute resolvers region of protocol is paused
- Caller is not the admin address of the stored dispute resolver
- Any address is not unique to this dispute resolver
- Supplied clerk is not a zero address
- Dispute resolver does not exist
- EscalationResponsePeriod is invalid
- No field has been updated or requested to be updated

function updateDisputeResolver(struct BosonTypes.DisputeResolver _disputeResolver) 
external

Arguments

NameTypeDescription
_disputeResolverBosonTypes.DisputeResolverthe fully populated dispute resolver struct

optInToDisputeResolverUpdate

Opt-in to a pending dispute resolver update
Emits a DisputeResolverUpdateApplied event if successful.
Reverts if:
- The dispute resolver region of protocol is paused
- Addresses are not unique to this dispute resolver
- Caller address is not pending update for the field being updated
- No pending update exists for this dispute resolver
- Dispute resolver tries to update the clerk

function optInToDisputeResolverUpdate(uint256 _disputeResolverId,
enum BosonTypes.DisputeResolverUpdateFields[] _fieldsToUpdate)
external

Arguments

NameTypeDescription
_disputeResolverIduint256disputeResolver id
_fieldsToUpdateenum BosonTypes.DisputeResolverUpdateFields[]fields to update, see DisputeResolverUpdateFields enum

updateAgent

Updates an agent, with the exception of the active flag.
All other fields should be filled, even those staying the same.Active flag passed in by caller will be ignored. The value from storage will be used.
Emits an AgentUpdated event if successful.
Reverts if:
- The agents region of protocol is paused
- Caller is not the wallet address associated with the agent account
- Wallet address is zero address
- Wallet address is not unique to this agent
- Agent does not exist
- Fee percentage + protocol fee percentage is greater than the max allowable fee percentage for an offer

function updateAgent(struct BosonTypes.Agent _agent) 
external

Arguments

NameTypeDescription
_agentBosonTypes.Agentthe fully populated agent struct

addFeesToDisputeResolver

Adds DisputeResolverFees to an existing dispute resolver.
Emits a DisputeResolverFeesAdded event if successful.
Reverts if:
- The dispute resolvers region of protocol is paused
- Caller is not the admin address associated with the dispute resolver account
- Dispute resolver does not exist
- Number of DisputeResolverFee structs in array is zero
- DisputeResolverFee array contains duplicates
- Fee amount is a non-zero value. Protocol doesn't yet support fees for dispute resolvers

function addFeesToDisputeResolver(uint256 _disputeResolverId,
struct BosonTypes.DisputeResolverFee[] _disputeResolverFees)
external

Arguments

NameTypeDescription
_disputeResolverIduint256id of the dispute resolver
_disputeResolverFeesBosonTypes.DisputeResolverFee[]list of fees dispute resolver charges per token type. Zero address is native currency. See {BosonTypes.DisputeResolverFee} feeAmount will be ignored because protocol doesn't yet support fees yet but DR still needs to provide array of fees to choose supported tokens

removeFeesFromDisputeResolver

Removes DisputeResolverFees from an existing dispute resolver.
Emits a DisputeResolverFeesRemoved event if successful.
Reverts if:
- The dispute resolvers region of protocol is paused
- Caller is not the admin address associated with the dispute resolver account
- Dispute resolver does not exist
- Number of DisputeResolverFee structs in array is zero
- DisputeResolverFee does not exist for the dispute resolver

function removeFeesFromDisputeResolver(uint256 _disputeResolverId,
address[] _feeTokenAddresses)
external

Arguments

NameTypeDescription
_disputeResolverIduint256id of the dispute resolver
_feeTokenAddressesaddress[]list of addresses of dispute resolver fee tokens to remove

addSellersToAllowList

Adds seller ids to set of ids allowed to choose the given dispute resolver for an offer.
Emits an AllowedSellersAdded event if successful.
Reverts if:
- The dispute resolvers region of protocol is paused
- Caller is not the admin address associated with the dispute resolver account
- Dispute resolver does not exist
- Number of seller ids in array is zero
- Some seller does not exist
- Seller id is already approved

function addSellersToAllowList(uint256 _disputeResolverId,
uint256[] _sellerAllowList)
external

Arguments

NameTypeDescription
_disputeResolverIduint256id of the dispute resolver
_sellerAllowListuint256[]List of seller ids to add to allowed list

removeSellersFromAllowList

Removes seller ids from set of ids allowed to choose the given dispute resolver for an offer.
Emits an AllowedSellersRemoved event if successful.
Reverts if:
- The dispute resolvers region of protocol is paused
- Caller is not the admin address associated with the dispute resolver account
- Dispute resolver does not exist
- Number of seller ids structs in array is zero
- Seller id is not approved

function removeSellersFromAllowList(uint256 _disputeResolverId,
uint256[] _sellerAllowList)
external

Arguments

NameTypeDescription
_disputeResolverIduint256id of the dispute resolver
_sellerAllowListuint256[]list of seller ids to remove from allowed list

createNewCollection

Creates a new seller collection.
Emits a CollectionCreated event if successful.
Reverts if:
- The sellers region of protocol is paused
- Caller is not the seller assistant

function createNewCollection(string _externalId,
struct BosonTypes.VoucherInitValues _voucherInitValues)
external

Arguments

NameTypeDescription
_externalIdstringexternal collection id
_voucherInitValuesBosonTypes.VoucherInitValuesthe fully populated BosonTypes.VoucherInitValues struct

updateSellerSalt

Updates a salt.
Use this if the admin address is updated and there exists a possibility that the old admin will try to create the vouchers
with matching addresses on other chains.
Reverts if:
- The sellers region of protocol is paused
- Caller is not the admin of any seller
- Seller salt is not unique

function updateSellerSalt(uint256 _sellerId,
bytes32 _newSalt)
external

Arguments

NameTypeDescription
_sellerIduint256the id of the seller
_newSaltbytes32new salt

getSeller

Gets the details about a seller.

function getSeller(uint256 _sellerId) 
external
view
returns(bool exists,
BosonTypes.Seller memory seller,
BosonTypes.AuthToken memory authToken)

Arguments

NameTypeDescription
_sellerIduint256the id of the seller to check

Returns

NameTypeDescription
existsboolthe seller was found
sellerBosonTypes.Sellerthe seller details. See {BosonTypes.Seller}
authTokenBosonTypes.AuthTokenoptional AuthToken struct that specifies an AuthToken type and tokenId that the seller can use to do admin functions

getSellerByAddress

Gets the details about a seller by an address associated with that seller: assistant, or admin address.
A seller will have either an admin address or an auth token.
If seller's admin uses NFT Auth the seller should call getSellerByAuthToken instead.

function getSellerByAddress(address _associatedAddress) 
external
view
returns(bool exists,
BosonTypes.Seller memory seller,
BosonTypes.AuthToken memory authToken)

Arguments

NameTypeDescription
_associatedAddressaddressthe address associated with the seller. Must be an assistant, or admin address.

Returns

NameTypeDescription
existsboolthe seller was found
sellerBosonTypes.Sellerthe seller details. See {BosonTypes.Seller}
authTokenBosonTypes.AuthTokenoptional AuthToken struct that specifies an AuthToken type and tokenId that the seller can use to do admin functions

getSellerByAuthToken

Gets the details about a seller by an auth token associated with that seller.
A seller will have either an admin address or an auth token.
If seller's admin uses an admin address, the seller should call getSellerByAddress instead.

function getSellerByAuthToken(struct BosonTypes.AuthToken _associatedAuthToken) 
external
view
returns(bool exists,
BosonTypes.Seller memory seller,
BosonTypes.AuthToken memory authToken)

Arguments

NameTypeDescription
_associatedAuthTokenBosonTypes.AuthTokenthe auth token that may be associated with the seller.

Returns

NameTypeDescription
existsboolthe seller was found
sellerBosonTypes.Sellerthe seller details. See {BosonTypes.Seller}
authTokenBosonTypes.AuthTokenoptional AuthToken struct that specifies an AuthToken type and tokenId that the seller can use to do admin functions

getSellersCollections

Gets the details about a seller's collections.

function getSellersCollections(uint256 _sellerId) 
external
view
returns(address defaultVoucherAddress, BosonTypes.Collection[] memory additionalCollections)

Arguments

NameTypeDescription
_sellerIduint256the id of the seller to check

Returns

NameTypeDescription
defaultVoucherAddressaddressthe address of the default voucher contract for the seller
additionalCollectionsBosonTypes.Collection[]an array of additional collections that the seller has created

isSellerSaltAvailable

Returns the availability of salt for a seller.

function isSellerSaltAvailable(address _adminAddres,
bytes32 _salt)
external
view
returns(bool isAvailable)

Arguments

NameTypeDescription
_adminAddresaddressthe admin address to check
_saltbytes32the salt to check (corresponds to collectionSalt when createSeler or createNewCollection is called or newSalt when updateSellerSalt is called)

Returns

NameTypeDescription
isAvailableboolsalt can be used

calculateCollectionAddress

Calculates the expected collection address and tells if it's still avaialble.

function calculateCollectionAddress(uint256 _sellerId,
bytes32 _collectionSalt)
external
view
returns(address collectionAddress, bool isAvailable)

Arguments

NameTypeDescription
_sellerIduint256the seller id
_collectionSaltbytes32the collection specific salt

Returns

NameTypeDescription
collectionAddressaddressthe collection address
isAvailableboolwhether the collection address is available

getBuyer

Gets the details about a buyer.

function getBuyer(uint256 _buyerId) 
external
view
returns(bool exists, BosonTypes.Buyer memory buyer)

Arguments

NameTypeDescription
_buyerIduint256the id of the buyer to check

Returns

NameTypeDescription
existsboolwhether the buyer was found
buyerBosonTypes.Buyerthe buyer details. See {BosonTypes.Buyer}

getDisputeResolver

Gets the details about a dispute resolver.

function getDisputeResolver(uint256 _disputeResolverId) 
external
view
returns(bool exists,
BosonTypes.DisputeResolver memory disputeResolver,
BosonTypes.DisputeResolverFee[] memory disputeResolverFees,
uint256[] sellerAllowList)

Arguments

NameTypeDescription
_disputeResolverIduint256the id of the dispute resolver to check

Returns

NameTypeDescription
existsboolthe dispute resolver was found
disputeResolverBosonTypes.DisputeResolverthe dispute resolver details. See {BosonTypes.DisputeResolver}
disputeResolverFeesBosonTypes.DisputeResolverFee[]list of fees dispute resolver charges per token type. Zero address is native currency. See {BosonTypes.DisputeResolverFee[]}
sellerAllowListuint256[]list of sellers that are allowed to choose this dispute resolver

getDisputeResolverByAddress

Gets the details about a dispute resolver by an address associated with that dispute resolver: assistant, or admin address.

function getDisputeResolverByAddress(address _associatedAddress) 
external
view
returns(bool exists,
BosonTypes.DisputeResolver memory disputeResolver,
BosonTypes.DisputeResolverFee[] memory disputeResolverFees,
uint256[] sellerAllowList)

Arguments

NameTypeDescription
_associatedAddressaddressthe address associated with the dispute resolver. Must be an assistant, or admin address.

Returns

NameTypeDescription
existsboolthe dispute resolver was found
disputeResolverBosonTypes.DisputeResolverthe dispute resolver details. See {BosonTypes.DisputeResolver}
disputeResolverFeesBosonTypes.DisputeResolverFee[]list of fees dispute resolver charges per token type. Zero address is native currency. See {BosonTypes.DisputeResolverFee[]}
sellerAllowListuint256[]list of sellers that are allowed to chose this dispute resolver

getAgent

Gets the details about an agent.

function getAgent(uint256 _agentId) 
external
view
returns(bool exists, BosonTypes.Agent memory agent)

Arguments

NameTypeDescription
_agentIduint256the id of the agent to check

Returns

NameTypeDescription
existsboolwhether the agent was found
agentBosonTypes.Agentthe agent details. See {BosonTypes.Agent}

areSellersAllowed

Checks whether given sellers are allowed to choose the given dispute resolver.

function areSellersAllowed(uint256 _disputeResolverId,
uint256[] _sellerIds)
external
view
returns(bool[] sellerAllowed)

Arguments

NameTypeDescription
_disputeResolverIduint256id of dispute resolver to check
_sellerIdsuint256[]list of seller ids to check

Returns

NameTypeDescription
sellerAllowedbool[]array with indicator (true/false) if seller is allowed to choose the dispute resolver. Index in this array corresponds to indices of the incoming _sellerIds

getNextAccountId

Gets the next account id that can be assigned to an account.Does not increment the counter.

function getNextAccountId() 
external
view
returns(uint256 nextAccountId)

Returns

NameTypeDescription
nextAccountIduint256the account id