Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New voucher name and symbol #477

Merged
merged 6 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Done or in progress are:
- ✅ Developer setup and tasks documentation
- ✅ Role-based access controller contract, with tests
- ✅ High level architecture documentation
- ✅ Proxied voucher NFT contract
- ✅ Proxied voucher contract
- ✅ Protocol Diamond contract, libs, and facets, with tests
- ✅ Shared domain model for contracts (minimal)
- ✅ Domain model expressed in JS, with tests
Expand Down
4 changes: 2 additions & 2 deletions contracts/domain/BosonConstants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ bytes32 constant EIP712_DOMAIN_TYPEHASH = keccak256(
);

// BosonVoucher
string constant VOUCHER_NAME = "Boson Voucher";
string constant VOUCHER_SYMBOL = "BOSON_VOUCHER";
string constant VOUCHER_NAME = "Boson Voucher (rNFT)";
string constant VOUCHER_SYMBOL = "BOSON_VOUCHER_RNFT";

// Meta Transactions - Structs
bytes32 constant META_TRANSACTION_TYPEHASH = keccak256(
Expand Down
6 changes: 3 additions & 3 deletions contracts/interfaces/clients/IBosonVoucher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { BosonTypes } from "../../domain/BosonTypes.sol";
/**
* @title IBosonVoucher
*
* @notice This is the interface for the Boson Protocol ERC-721 Voucher NFT contract.
* @notice This is the interface for the Boson Protocol ERC-721 Voucher contract.
*
* The ERC-165 identifier for this interface is: 0x2249ca21
*/
Expand Down Expand Up @@ -71,8 +71,8 @@ interface IBosonVoucher is IERC721Upgradeable, IERC721MetadataUpgradeable {
* @notice Provides royalty info.
* Called with the sale price to determine how much royalty is owed and to whom.
*
* @param _tokenId - the NFT asset queried for royalty information
* @param _salePrice - the sale price of the NFT asset specified by _tokenId
* @param _tokenId - the voucher queried for royalty information
* @param _salePrice - the sale price of the voucher specified by _tokenId
*
* @return receiver - address of who should be sent the royalty payment
* @return royaltyAmount - the royalty payment amount for the given sale price
Expand Down
8 changes: 4 additions & 4 deletions contracts/protocol/clients/voucher/BosonVoucher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import { IBosonConfigHandler } from "../../../interfaces/handlers/IBosonConfigHa

/**
* @title BosonVoucher
* @notice This is the Boson Protocol ERC-721 NFT Voucher contract.
* @notice This is the Boson Protocol ERC-721 Voucher contract.
*
* Key features:
* - Only PROTOCOL-roled addresses can issue vouchers, i.e., the ProtocolDiamond or an EOA for testing
* - Minted to the buyer when the buyer commits to an offer
* - Burned when the buyer redeems the voucher NFT
* - Burned when the buyer redeems the voucher
*/
contract BosonVoucher is IBosonVoucher, BeaconClientBase, OwnableUpgradeable, ERC721Upgradeable {
string private _contractURI;
Expand Down Expand Up @@ -210,8 +210,8 @@ contract BosonVoucher is IBosonVoucher, BeaconClientBase, OwnableUpgradeable, ER
* @notice Provides royalty info.
* Called with the sale price to determine how much royalty is owed and to whom.
*
* @param _tokenId - the NFT asset queried for royalty information
* @param _salePrice - the sale price of the NFT asset specified by _tokenId
* @param _tokenId - the voucher queried for royalty information
* @param _salePrice - the sale price of the voucher specified by _tokenId
*
* @return receiver - address of who should be sent the royalty payment
* @return royaltyAmount - the royalty payment amount for the given sale price
Expand Down
2 changes: 1 addition & 1 deletion contracts/protocol/facets/SellerHandlerFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ contract SellerHandlerFacet is SellerBase {
// Update operator
seller.operator = sender;

// Transfer ownership of NFT voucher contract to new operator
// Transfer ownership of voucher contract to new operator
IBosonVoucher(lookups.cloneAddress[_sellerId]).transferOwnership(sender);

// Store new seller id by operator mapping
Expand Down
8 changes: 4 additions & 4 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ This pattern gives us some distinct advantages, a few of which are:
- **Maintainability**: Developers can focus on business logic rather than managing contract collaboration patterns and the potential threats that naturally arise.
- **Easier to reason about contract storage**: When using Diamonds storage is a first class consideration. With developers working on different facets, it leads us to consider and declare the data that is maintained and visible to each facet in a uniform way. This means facets can share data while not clobbering each other in the shared storage slots of the diamond proxy.

### Voucher NFT
![Voucher NFT](images/Boson_Protocol_V2_-_Voucher_Clones.png)
### Voucher
![Voucher](images/Boson_Protocol_V2_-_Voucher_Clones.png)
The Boson Voucher implementation is built around the OpenZeppelin [Beacon](https://docs.openzeppelin.com/contracts/4.x/api/proxy#beacon) and [ERC721](https://docs.openzeppelin.com/contracts/4.x/api/token/erc721) contracts.

Every seller needs their own instance of the Boson Voucher NFT so that they can manage their collection separately on marketplaces like OpenSea. For this reason, it cannot exist behind the Protocol Diamond, as an ordinary upgradable Facet.
Every seller needs their own instance of the Boson Voucher so that they can manage their collection separately on marketplaces like OpenSea. For this reason, it cannot exist behind the Protocol Diamond, as an ordinary upgradable Facet.

Still, the Boson Voucher contract must be upgradeable. By using the Beacon Proxy pattern, it can be upgraded for all sellers with a single transaction.

### Protocol Clients
![Protocol Clients](images/Boson_Protocol_V2_-_Protocol_Clients.png)
When contracts need roled access to the Protocol Diamond's functionality, either uni- or bi-directionally, they can be implemented as upgradeable Protocol Clients. This pattern supports a Client that has a one-to-one relationship between its proxy and its logic implementation.

Initially, the Boson Voucher NFT was implemented as an upgradable standalone contract with a one-to-one relationship to its proxy. When the requirement for sellers to have their own voucher collections came to pass, we switched to the Beacon pattern as described above. The pattern for roled, upgradeable standalone client support remains intact if not used at the moment.
Initially, the Boson Voucher was implemented as an upgradable standalone contract with a one-to-one relationship to its proxy. When the requirement for sellers to have their own voucher collections came to pass, we switched to the Beacon pattern as described above. The pattern for roled, upgradeable standalone client support remains intact if not used at the moment.
2 changes: 1 addition & 1 deletion scripts/deploy-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async function main(env, facetConfig) {
// Cast Diamond to the IBosonConfigHandler interface for further interaction with it
const bosonConfigHandler = await ethers.getContractAt("IBosonConfigHandler", protocolDiamond.address);

// Add Voucher NFT addresses to protocol config
// Add Voucher addresses to protocol config
transactionResponse = await bosonConfigHandler.setVoucherBeaconAddress(
bosonClientBeacon.address,
await getFees(maxPriorityFeePerGas)
Expand Down
16 changes: 8 additions & 8 deletions test/protocol/OrchestrationHandlerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ describe("IBosonOrchestrationHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down Expand Up @@ -598,7 +598,7 @@ describe("IBosonOrchestrationHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down Expand Up @@ -4187,7 +4187,7 @@ describe("IBosonOrchestrationHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down Expand Up @@ -4235,7 +4235,7 @@ describe("IBosonOrchestrationHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down Expand Up @@ -4719,7 +4719,7 @@ describe("IBosonOrchestrationHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down Expand Up @@ -4770,7 +4770,7 @@ describe("IBosonOrchestrationHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down Expand Up @@ -5355,7 +5355,7 @@ describe("IBosonOrchestrationHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down Expand Up @@ -5407,7 +5407,7 @@ describe("IBosonOrchestrationHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down
4 changes: 2 additions & 2 deletions test/protocol/SellerHandlerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ describe("SellerHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down Expand Up @@ -358,7 +358,7 @@ describe("SellerHandler", function () {
[exists] = await exchangeHandler.connect(rando).getExchangeState(exchangeId);
expect(exists).to.be.false;

// Get Royalty Information for Exchange id i.e. Voucher NFT token id
// Get Royalty Information for Exchange id i.e. Voucher token id
let receiver, royaltyAmount;
[receiver, royaltyAmount] = await bosonVoucher.connect(operator).royaltyInfo(exchangeId, offerPrice);

Expand Down
4 changes: 2 additions & 2 deletions test/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const oneDay = 86400; // 1 day in seconds
const ninetyDays = oneDay * 90; // 90 days in seconds
const oneWeek = oneDay * 7; // 7 days in seconds
const oneMonth = oneDay * 31; // 31 days in seconds
const VOUCHER_NAME = "Boson Voucher";
const VOUCHER_SYMBOL = "BOSON_VOUCHER";
const VOUCHER_NAME = "Boson Voucher (rNFT)";
const VOUCHER_SYMBOL = "BOSON_VOUCHER_RNFT";

const tipMultiplier = ethers.BigNumber.from(environments.tipMultiplier);
const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block
Expand Down