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(struct BosonTypes.Seller _seller, struct BosonTypes.AuthToken _authToken, struct BosonTypes.VoucherInitValues _voucherInitValues)
- createBuyer(struct BosonTypes.Buyer _buyer)
- createDisputeResolver(struct BosonTypes.DisputeResolver _disputeResolver, struct BosonTypes.DisputeResolverFee[] _disputeResolverFees, uint256[] _sellerAllowList)
- createAgent(struct BosonTypes.Agent _agent)
- updateSeller(struct BosonTypes.Seller _seller, struct BosonTypes.AuthToken _authToken)
- optInToSellerUpdate(uint256 _sellerId, enum BosonTypes.SellerUpdateFields[] _fieldsToUpdate)
- updateBuyer(struct BosonTypes.Buyer _buyer)
- updateDisputeResolver(struct BosonTypes.DisputeResolver _disputeResolver)
- optInToDisputeResolverUpdate(uint256 _disputeResolverId, enum BosonTypes.DisputeResolverUpdateFields[] _fieldsToUpdate)
- updateAgent(struct BosonTypes.Agent _agent)
- addFeesToDisputeResolver(uint256 _disputeResolverId, struct BosonTypes.DisputeResolverFee[] _disputeResolverFees)
- removeFeesFromDisputeResolver(uint256 _disputeResolverId, address[] _feeTokenAddresses)
- addSellersToAllowList(uint256 _disputeResolverId, uint256[] _sellerAllowList)
- removeSellersFromAllowList(uint256 _disputeResolverId, uint256[] _sellerAllowList)
- createNewCollection(string _externalId, struct BosonTypes.VoucherInitValues _voucherInitValues)
- updateSellerSalt(uint256 _sellerId, bytes32 _newSalt)
- getSeller(uint256 _sellerId)
- getSellerByAddress(address _associatedAddress)
- getSellerByAuthToken(struct BosonTypes.AuthToken _associatedAuthToken)
- getSellersCollections(uint256 _sellerId)
- isSellerSaltAvailable(address _adminAddres, bytes32 _salt)
- calculateCollectionAddress(uint256 _sellerId, bytes32 _collectionSalt)
- getBuyer(uint256 _buyerId)
- getDisputeResolver(uint256 _disputeResolverId)
- getDisputeResolverByAddress(address _associatedAddress)
- getAgent(uint256 _agentId)
- areSellersAllowed(uint256 _disputeResolverId, uint256[] _sellerIds)
- getNextAccountId()
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
Name | Type | Description |
---|---|---|
_seller | BosonTypes.Seller | the fully populated struct with seller id set to 0x0 |
_authToken | BosonTypes.AuthToken | optional AuthToken struct that specifies an AuthToken type and tokenId that the seller can use to do admin functions |
_voucherInitValues | BosonTypes.VoucherInitValues | the 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
Name | Type | Description |
---|---|---|
_buyer | BosonTypes.Buyer | the 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
Name | Type | Description |
---|---|---|
_disputeResolver | BosonTypes.DisputeResolver | the fully populated struct with dispute resolver id set to 0x0 |
_disputeResolverFees | BosonTypes.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 |
_sellerAllowList | uint256[] | 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
Name | Type | Description |
---|---|---|
_agent | BosonTypes.Agent | the 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
Name | Type | Description |
---|---|---|
_seller | BosonTypes.Seller | the fully populated seller struct |
_authToken | BosonTypes.AuthToken | optional 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
Name | Type | Description |
---|---|---|
_sellerId | uint256 | seller id |
_fieldsToUpdate | enum 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
Name | Type | Description |
---|---|---|
_buyer | BosonTypes.Buyer | the 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
Name | Type | Description |
---|---|---|
_disputeResolver | BosonTypes.DisputeResolver | the 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
Name | Type | Description |
---|---|---|
_disputeResolverId | uint256 | disputeResolver id |
_fieldsToUpdate | enum 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
Name | Type | Description |
---|---|---|
_agent | BosonTypes.Agent | the 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
Name | Type | Description |
---|---|---|
_disputeResolverId | uint256 | id of the dispute resolver |
_disputeResolverFees | BosonTypes.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
Name | Type | Description |
---|---|---|
_disputeResolverId | uint256 | id of the dispute resolver |
_feeTokenAddresses | address[] | 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
Name | Type | Description |
---|---|---|
_disputeResolverId | uint256 | id of the dispute resolver |
_sellerAllowList | uint256[] | 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
Name | Type | Description |
---|---|---|
_disputeResolverId | uint256 | id of the dispute resolver |
_sellerAllowList | uint256[] | 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
Name | Type | Description |
---|---|---|
_externalId | string | external collection id |
_voucherInitValues | BosonTypes.VoucherInitValues | the 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
Name | Type | Description |
---|---|---|
_sellerId | uint256 | the id of the seller |
_newSalt | bytes32 | new 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
Name | Type | Description |
---|---|---|
_sellerId | uint256 | the id of the seller to check |
Returns
Name | Type | Description |
---|---|---|
exists | bool | the seller was found |
seller | BosonTypes.Seller | the seller details. See {BosonTypes.Seller} |
authToken | BosonTypes.AuthToken | optional 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
Name | Type | Description |
---|---|---|
_associatedAddress | address | the address associated with the seller. Must be an assistant, or admin address. |
Returns
Name | Type | Description |
---|---|---|
exists | bool | the seller was found |
seller | BosonTypes.Seller | the seller details. See {BosonTypes.Seller} |
authToken | BosonTypes.AuthToken | optional 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
Name | Type | Description |
---|---|---|
_associatedAuthToken | BosonTypes.AuthToken | the auth token that may be associated with the seller. |
Returns
Name | Type | Description |
---|---|---|
exists | bool | the seller was found |
seller | BosonTypes.Seller | the seller details. See {BosonTypes.Seller} |
authToken | BosonTypes.AuthToken | optional 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
Name | Type | Description |
---|---|---|
_sellerId | uint256 | the id of the seller to check |
Returns
Name | Type | Description |
---|---|---|
defaultVoucherAddress | address | the address of the default voucher contract for the seller |
additionalCollections | BosonTypes.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
Name | Type | Description |
---|---|---|
_adminAddres | address | the admin address to check |
_salt | bytes32 | the salt to check (corresponds to collectionSalt when createSeler or createNewCollection is called or newSalt when updateSellerSalt is called) |
Returns
Name | Type | Description |
---|---|---|
isAvailable | bool | salt 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
Name | Type | Description |
---|---|---|
_sellerId | uint256 | the seller id |
_collectionSalt | bytes32 | the collection specific salt |
Returns
Name | Type | Description |
---|---|---|
collectionAddress | address | the collection address |
isAvailable | bool | whether 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
Name | Type | Description |
---|---|---|
_buyerId | uint256 | the id of the buyer to check |
Returns
Name | Type | Description |
---|---|---|
exists | bool | whether the buyer was found |
buyer | BosonTypes.Buyer | the 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
Name | Type | Description |
---|---|---|
_disputeResolverId | uint256 | the id of the dispute resolver to check |
Returns
Name | Type | Description |
---|---|---|
exists | bool | the dispute resolver was found |
disputeResolver | BosonTypes.DisputeResolver | the dispute resolver details. See {BosonTypes.DisputeResolver} |
disputeResolverFees | BosonTypes.DisputeResolverFee[] | list of fees dispute resolver charges per token type. Zero address is native currency. See {BosonTypes.DisputeResolverFee[]} |
sellerAllowList | uint256[] | 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
Name | Type | Description |
---|---|---|
_associatedAddress | address | the address associated with the dispute resolver. Must be an assistant, or admin address. |
Returns
Name | Type | Description |
---|---|---|
exists | bool | the dispute resolver was found |
disputeResolver | BosonTypes.DisputeResolver | the dispute resolver details. See {BosonTypes.DisputeResolver} |
disputeResolverFees | BosonTypes.DisputeResolverFee[] | list of fees dispute resolver charges per token type. Zero address is native currency. See {BosonTypes.DisputeResolverFee[]} |
sellerAllowList | uint256[] | 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
Name | Type | Description |
---|---|---|
_agentId | uint256 | the id of the agent to check |
Returns
Name | Type | Description |
---|---|---|
exists | bool | whether the agent was found |
agent | BosonTypes.Agent | the 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
Name | Type | Description |
---|---|---|
_disputeResolverId | uint256 | id of dispute resolver to check |
_sellerIds | uint256[] | list of seller ids to check |
Returns
Name | Type | Description |
---|---|---|
sellerAllowed | bool[] | 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
Name | Type | Description |
---|---|---|
nextAccountId | uint256 | the account id |