IBosonVoucher
View Source: contracts/interfaces/clients/IBosonVoucher.sol
↗ Extends: IERC721Upgradeable, IERC721MetadataUpgradeable
IBosonVoucher
This is the interface for the Boson Protocol ERC-721 Voucher contract.
The ERC-165 identifier for this interface is: 0x2249ca21
Functions
- issueVoucher(uint256 _exchangeId, address _buyer)
- burnVoucher(uint256 _exchangeId)
- getSellerId()
- transferOwnership(address newOwner)
- contractURI()
- setContractURI(string _newContractURI)
- royaltyInfo(uint256 _tokenId, uint256 _salePrice)
- setRoyaltyPercentage(uint256 _newRoyaltyPercentage)
- getRoyaltyPercentage()
issueVoucher
Issues a voucher to a buyer.
Minted voucher supply is sent to the buyer.
Caller must have PROTOCOL role.
function issueVoucher(uint256 _exchangeId,
address _buyer)
external
Arguments
Name | Type | Description |
---|---|---|
_exchangeId | uint256 | the id of the exchange (corresponds to the ERC-721 token id) |
_buyer | address | the buyer address |
burnVoucher
Burns a voucher.
Caller must have PROTOCOL role.
function burnVoucher(uint256 _exchangeId)
external
Arguments
Name | Type | Description |
---|---|---|
_exchangeId | uint256 | the id of the exchange (corresponds to the ERC-721 token id) |
getSellerId
Gets the seller id.
function getSellerId()
external
view
returns(uint256)
Returns
uint256
transferOwnership
Transfers ownership of the contract to a new account (newOwner
).
Can only be called by the protocol. Change is done by calling updateSeller
on the protocol.
function transferOwnership(address newOwner)
external
Arguments
Name | Type | Description |
---|---|---|
newOwner | address | the address to which ownership of the voucher contract will be transferred |
contractURI
Returns storefront-level metadata used by OpenSea.
function contractURI()
external
view
returns(string)
Returns
string
setContractURI
Sets new contract URI.
Can only be called by the owner or during the initialization.
function setContractURI(string _newContractURI)
external
Arguments
Name | Type | Description |
---|---|---|
_newContractURI | string | new contract metadata URI |
royaltyInfo
Provides royalty info.
Called with the sale price to determine how much royalty is owed and to whom.
function royaltyInfo(uint256 _tokenId,
uint256 _salePrice)
external
view
returns(address receiver, uint256 royaltyAmount)
Arguments
Name | Type | Description |
---|---|---|
_tokenId | uint256 | the voucher queried for royalty information |
_salePrice | uint256 | the sale price of the voucher specified by _tokenId |
Returns
Name | Type | Description |
---|---|---|
receiver | address | address of who should be sent the royalty payment |
royaltyAmount | uint256 | the royalty payment amount for the given sale price |
setRoyaltyPercentage
Sets the royalty percentage.
Can only be called by the owner or during the initialization
Emits RoyaltyPercentageChanged if successful.
Reverts if:
- Caller is not the owner.
- _newRoyaltyPercentage
is greater than max royalty percentage defined in the protocol
function setRoyaltyPercentage(uint256 _newRoyaltyPercentage)
external
Arguments
Name | Type | Description |
---|---|---|
_newRoyaltyPercentage | uint256 | fee in percentage. e.g. 500 = 5% |
getRoyaltyPercentage
Gets the royalty percentage.
function getRoyaltyPercentage()
external
view
returns(uint256)
Returns
uint256
Events
ContractURIChanged
event ContractURIChanged(string contractURI)
Parameters
Name | Type | Description |
---|---|---|
contractURI | string |
RoyaltyPercentageChanged
event RoyaltyPercentageChanged(uint256 royaltyPercentage)
Parameters
Name | Type | Description |
---|---|---|
royaltyPercentage | uint256 |
VoucherInitialized
event VoucherInitialized(
uint256 indexed sellerId
uint256 indexed royaltyPercentage
string indexed contractURI
)
Parameters
Name | Type | Description |
---|---|---|
sellerId | uint256 | |
royaltyPercentage | uint256 | |
contractURI | string |