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: 0x9a56a1ef

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 operator and clerk
- 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

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. Dispute resolver must be activated before it can participate in the protocol.
Emits a DisputeResolverCreated event if successful.
Reverts if:
- Caller is not the supplied admin, operator and clerk
- The dispute resolvers region of protocol is paused
- Any address is zero address
- Any address is not unique to this dispute resolver
- Number of DisputeResolverFee structs in array exceeds max
- DisputeResolverFee array contains duplicates
- EscalationResponsePeriod is invalid
- Number of seller ids in _sellerAllowList array exceeds max
- Some seller does not exist
- Some seller id is duplicated

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[]array of fees dispute resolver charges per token type. Zero address is native currency. Can be empty.
_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, operator, clerk 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, clerk, operator, or auth token.
Holder of new auth token and/or owner(s) of new addresses for admin, clerk, operator 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
- 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

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 for the field being updated
- Caller is not the of the owner of the pending AuthToken being updated
- No pending update exists for this seller
- AuthTokenType is not unique to this seller

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 associated with the buyer account
- 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 a dispute resolver, not including 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.
Reverts if:
- The dispute resolvers region of protocol is paused
- Caller is not the admin address associated with the dispute resolver account
- Any address is zero address
- Any address is not unique to this dispute resolver
- Dispute resolver does not exist

function updateDisputeResolver(struct BosonTypes.DisputeResolver _disputeResolver) 
external

Arguments

NameTypeDescription
_disputeResolverBosonTypes.DisputeResolverthe fully populated dispute resolver struct

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 exceeds max
- Number of DisputeResolverFee structs in array is zero
- DisputeResolverFee array contains duplicates

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}

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 exceeds max
- 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 exceeds max
- 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 in array exceeds max
- 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

activateDisputeResolver

Sets the active flag for this dispute resolver to true.Only callable by the protocol ADMIN role.
Emits a DisputeResolverActivated event if successful.
Reverts if:
- The dispute resolvers region of protocol is paused
- Caller does not have the ADMIN role
- Dispute resolver does not exist

function activateDisputeResolver(uint256 _disputeResolverId) 
external

Arguments

NameTypeDescription
_disputeResolverIduint256id of the dispute resolver

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: operator, admin, or clerk 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 operator, admin, or clerk 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

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: operator, admin, or clerk 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 operator, admin, or clerk 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