Skip to content

Commit

Permalink
Remove protocol gas limits (#675)
Browse files Browse the repository at this point in the history
* Remove protocol gas limits

* Fix upgrade test setup

* Change approach

* Fixing upgrate test

* Remove gas limits

* Fix init v2.2.0 test

* Add _amount parameter to burnPremintedVouchers

* Addings tests to Boson Voucher

* Tidy

* Adding _tokenList parameter to getAvailableFunds

* Add new parameter to getAvailableFunds calls

* Fix rest of tests on FundsHandler

* Fixing interface id

* Resolve conflicts on FundsHandler

* Resolve conflicts on ConfigHandlerTest.js

* Resolve conflicts on BV and ProtocolInitialization

* Remediate tests on MetaTx and ExchangeHandler

* Fix tests broken on FundsHandler

* Tidy

* Add MaxPremintedVouchersChanged event back

* This cleans up the comments in our interfaces and facets ...

* remove natspec comments

---------

Co-authored-by: Mischa <mischa@mmt.me.uk>
Co-authored-by: zajck <klemen@impressieve.com>
Co-authored-by: Klemen <64400885+zajck@users.noreply.github.com>
  • Loading branch information
4 people committed Jul 6, 2023
1 parent 2026a63 commit 7cf35c4
Show file tree
Hide file tree
Showing 45 changed files with 1,145 additions and 2,225 deletions.
12 changes: 3 additions & 9 deletions contracts/domain/BosonConstants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ string constant NO_SUCH_AGENT = "No such agent";
string constant WALLET_OWNS_VOUCHERS = "Wallet address owns vouchers";
string constant NO_SUCH_DISPUTE_RESOLVER = "No such dispute resolver";
string constant INVALID_ESCALATION_PERIOD = "Invalid escalation period";
string constant INVALID_AMOUNT_DISPUTE_RESOLVER_FEES = "Dispute resolver fees are not present or exceed maximum dispute resolver fees in a single transaction";
string constant INEXISTENT_DISPUTE_RESOLVER_FEES = "Dispute resolver fees are not present";
string constant DUPLICATE_DISPUTE_RESOLVER_FEES = "Duplicate dispute resolver fee";
string constant FEE_AMOUNT_NOT_YET_SUPPORTED = "Non-zero dispute resolver fees not yet supported";
string constant DISPUTE_RESOLVER_FEE_NOT_FOUND = "Dispute resolver fee not found";
string constant SELLER_ALREADY_APPROVED = "Seller id is approved already";
string constant SELLER_NOT_APPROVED = "Seller id is not approved";
string constant INVALID_AMOUNT_ALLOWED_SELLERS = "Allowed sellers are not present or exceed maximum allowed sellers in a single transaction";
string constant INEXISTENT_ALLOWED_SELLERS_LIST = "Allowed sellers are not present";
string constant INVALID_AUTH_TOKEN_TYPE = "Invalid AuthTokenType";
string constant ADMIN_OR_AUTH_TOKEN = "An admin address or an auth token is required";
string constant AUTH_TOKEN_MUST_BE_UNIQUE = "Auth token cannot be assigned to another entity of the same type";
Expand Down Expand Up @@ -99,7 +99,6 @@ string constant NO_SUCH_COLLECTION = "No such collection";
// Revert Reasons: Group related
string constant NO_SUCH_GROUP = "No such group";
string constant OFFER_NOT_IN_GROUP = "Offer not part of the group";
string constant TOO_MANY_OFFERS = "Exceeded maximum offers in a single transaction";
string constant NOTHING_UPDATED = "Nothing updated";
string constant INVALID_CONDITION_PARAMETERS = "Invalid condition parameters";
string constant GROUP_HAS_NO_CONDITION = "Offer belongs to a group without a condition. Use commitToOffer instead";
Expand All @@ -116,7 +115,6 @@ string constant VOUCHER_NOT_REDEEMABLE = "Voucher not yet valid or already expir
string constant VOUCHER_EXTENSION_NOT_VALID = "Proposed date is not later than the current one";
string constant VOUCHER_STILL_VALID = "Voucher still valid";
string constant VOUCHER_HAS_EXPIRED = "Voucher has expired";
string constant TOO_MANY_EXCHANGES = "Exceeded maximum exchanges in a single transaction";
string constant EXCHANGE_IS_NOT_IN_A_FINAL_STATE = "Exchange is not in a final state";
string constant EXCHANGE_ALREADY_EXISTS = "Exchange already exists";
string constant INVALID_RANGE_LENGTH = "Range length is too large or zero";
Expand All @@ -139,7 +137,6 @@ string constant INVALID_TOKEN_ADDRESS = "Token address is a contract that doesn'
string constant NO_SUCH_BUNDLE = "No such bundle";
string constant TWIN_NOT_IN_BUNDLE = "Twin not part of the bundle";
string constant OFFER_NOT_IN_BUNDLE = "Offer not part of the bundle";
string constant TOO_MANY_TWINS = "Exceeded maximum twins in a single transaction";
string constant BUNDLE_OFFER_MUST_BE_UNIQUE = "Offer must be unique to a bundle";
string constant BUNDLE_TWIN_MUST_BE_UNIQUE = "Twin must be unique to a bundle";
string constant EXCHANGE_FOR_BUNDLED_OFFERS_EXISTS = "Exchange for the bundled offers exists";
Expand All @@ -151,7 +148,6 @@ string constant NATIVE_WRONG_ADDRESS = "Native token address must be 0";
string constant NATIVE_WRONG_AMOUNT = "Transferred value must match amount";
string constant TOKEN_NAME_UNSPECIFIED = "Token name unspecified";
string constant NATIVE_CURRENCY = "Native currency";
string constant TOO_MANY_TOKENS = "Too many tokens";
string constant TOKEN_AMOUNT_MISMATCH = "Number of amounts should match number of tokens";
string constant NOTHING_TO_WITHDRAW = "Nothing to withdraw";
string constant NOT_AUTHORIZED = "Not authorized to withdraw";
Expand All @@ -174,7 +170,6 @@ string constant DISPUTE_HAS_EXPIRED = "Dispute has expired";
string constant INVALID_BUYER_PERCENT = "Invalid buyer percent";
string constant DISPUTE_STILL_VALID = "Dispute still valid";
string constant INVALID_DISPUTE_TIMEOUT = "Invalid dispute timeout";
string constant TOO_MANY_DISPUTES = "Exceeded maximum disputes in a single transaction";
string constant ESCALATION_NOT_ALLOWED = "Disputes without dispute resolver cannot be escalated";

// Revert Reasons: Config related
Expand All @@ -197,10 +192,9 @@ string constant OFFER_RANGE_ALREADY_RESERVED = "Offer id already associated with
string constant INVALID_RANGE_START = "Range start too low";
string constant INVALID_AMOUNT_TO_MINT = "Amount to mint is greater than remaining un-minted in range";
string constant NO_SILENT_MINT_ALLOWED = "Only owner's mappings can be updated without event";
string constant TOO_MANY_TO_MINT = "Exceeded maximum amount to mint in a single transaction";
string constant OFFER_EXPIRED_OR_VOIDED = "Offer expired or voided";
string constant OFFER_STILL_VALID = "Offer still valid";
string constant NOTHING_TO_BURN = "Nothing to burn";
string constant AMOUNT_EXCEEDS_RANGE_OR_NOTHING_TO_BURN = "Amount exceeds the range or there is nothing to burn";
string constant OWNABLE_ZERO_ADDRESS = "Ownable: new owner is the zero address";
string constant ROYALTY_FEE_INVALID = "ERC2981: royalty fee exceeds protocol limit";
string constant NOT_COMMITTABLE = "Token not committable";
Expand Down
5 changes: 3 additions & 2 deletions contracts/interfaces/clients/IBosonVoucher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { IERC721ReceiverUpgradeable } from "@openzeppelin/contracts-upgradeable/
*
* @notice This is the interface for the Boson Protocol ERC-721 Voucher contract.
*
* The ERC-165 identifier for this interface is: 0xaf16da6e
* The ERC-165 identifier for this interface is: 0x5235dd2b
*/
interface IBosonVoucher is IERC721Upgradeable, IERC721MetadataUpgradeable, IERC721ReceiverUpgradeable {
event ContractURIChanged(string contractURI);
Expand Down Expand Up @@ -189,8 +189,9 @@ interface IBosonVoucher is IERC721Upgradeable, IERC721MetadataUpgradeable, IERC7
* - There is nothing to burn
*
* @param _offerId - the id of the offer
* @param _amount - amount to burn
*/
function burnPremintedVouchers(uint256 _offerId) external;
function burnPremintedVouchers(uint256 _offerId, uint256 _amount) external;

/**
* @notice Gets the number of vouchers available to be pre-minted for an offer.
Expand Down
9 changes: 0 additions & 9 deletions contracts/interfaces/events/IBosonConfigEvents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@ interface IBosonConfigEvents {
event BeaconProxyAddressChanged(address indexed beaconProxyAddress, address indexed executedBy);
event ProtocolFeePercentageChanged(uint256 feePercentage, address indexed executedBy);
event ProtocolFeeFlatBosonChanged(uint256 feeFlatBoson, address indexed executedBy);
event MaxExchangesPerBatchChanged(uint16 maxExchangesPerBatch, address indexed executedBy);
event MaxOffersPerGroupChanged(uint16 maxOffersPerGroup, address indexed executedBy);
event MaxOffersPerBatchChanged(uint16 maxOffersPerBatch, address indexed executedBy);
event MaxTwinsPerBundleChanged(uint16 maxTwinsPerBundle, address indexed executedBy);
event MaxOffersPerBundleChanged(uint16 maxOffersPerBundle, address indexed executedBy);
event MaxTokensPerWithdrawalChanged(uint16 maxTokensPerWithdrawal, address indexed executedBy);
event MaxFeesPerDisputeResolverChanged(uint16 maxFeesPerDisputeResolver, address indexed executedBy);
event MaxEscalationResponsePeriodChanged(uint256 maxEscalationResponsePeriod, address indexed executedBy);
event MaxDisputesPerBatchChanged(uint16 maxDisputesPerBatch, address indexed executedBy);
event MaxAllowedSellersChanged(uint16 maxAllowedSellers, address indexed executedBy);
event BuyerEscalationFeePercentageChanged(uint256 buyerEscalationFeePercentage, address indexed executedBy);
event AuthTokenContractChanged(
BosonTypes.AuthTokenType indexed authTokenType,
Expand Down
5 changes: 0 additions & 5 deletions contracts/interfaces/handlers/IBosonAccountHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ interface IBosonAccountHandler is IBosonAccountEvents {
* - Any address is zero address
* - Any address is not unique to this dispute resolver
* - EscalationResponsePeriod is invalid
* - Number of seller ids in _sellerAllowList array exceeds max
* - Some seller does not exist
* - Some seller id is duplicated
* - DisputeResolver is not active (if active == false)
Expand Down Expand Up @@ -240,7 +239,6 @@ interface IBosonAccountHandler is IBosonAccountEvents {
* - 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
* - Fee amount is a non-zero value. Protocol doesn't yet support fees for dispute resolvers
Expand All @@ -263,7 +261,6 @@ interface IBosonAccountHandler is IBosonAccountEvents {
* - 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
*
Expand All @@ -281,7 +278,6 @@ interface IBosonAccountHandler is IBosonAccountEvents {
* - 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
Expand All @@ -300,7 +296,6 @@ interface IBosonAccountHandler is IBosonAccountEvents {
* - 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
*
Expand Down
2 changes: 0 additions & 2 deletions contracts/interfaces/handlers/IBosonBundleHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ interface IBosonBundleHandler is IBosonBundleEvents {
* - Any of the offers belongs to different seller
* - Any of the offers does not exist
* - Offer exists in a different bundle
* - Number of offers exceeds maximum allowed number per bundle
* - Any of the twins belongs to different seller
* - Any of the twins does not exist
* - Number of twins exceeds maximum allowed number per bundle
* - Duplicate twins added in same bundle
* - Exchange already exists for the offer id in bundle
* - Offers' total quantity is greater than twin supply when token is nonfungible
Expand Down
198 changes: 1 addition & 197 deletions contracts/interfaces/handlers/IBosonConfigHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IBosonConfigEvents } from "../events/IBosonConfigEvents.sol";
*
* @notice Handles management of configuration within the protocol.
*
* The ERC-165 identifier for this interface is: 0x25616ef5
* The ERC-165 identifier for this interface is: 0xbc28d3e6
*/
interface IBosonConfigHandler is IBosonConfigEvents {
/**
Expand Down Expand Up @@ -134,126 +134,6 @@ interface IBosonConfigHandler is IBosonConfigEvents {
*/
function getProtocolFeeFlatBoson() external view returns (uint256);

/**
* @notice Sets the maximum numbers of offers that can be created in a single transaction.
*
* Emits a MaxOffersPerBatchChanged event.
*
* Reverts if _maxOffersPerBatch is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxOffersPerBatch - the maximum length of {BosonTypes.Offer[]}
*/
function setMaxOffersPerBatch(uint16 _maxOffersPerBatch) external;

/**
* @notice Gets the maximum numbers of offers that can be created in a single transaction.
*
* @return the maximum numbers of offers that can be created in a single transaction
*/
function getMaxOffersPerBatch() external view returns (uint16);

/**
* @notice Sets the maximum numbers of offers that can be added to a group in a single transaction.
*
* Emits a MaxOffersPerGroupChanged event.
*
* Reverts if _maxOffersPerGroup is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxOffersPerGroup - the maximum length of {BosonTypes.Group.offerIds}
*/
function setMaxOffersPerGroup(uint16 _maxOffersPerGroup) external;

/**
* @notice Gets the maximum numbers of offers that can be added to a group in a single transaction.
*
* @return the maximum numbers of offers that can be added to a group in a single transaction
*/
function getMaxOffersPerGroup() external view returns (uint16);

/**
* @notice Sets the maximum numbers of twins that can be added to a bundle in a single transaction.
*
* Emits a MaxTwinsPerBundleChanged event.
*
* Reverts if _maxTwinsPerBundle is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxTwinsPerBundle - the maximum length of {BosonTypes.Bundle.twinIds}
*/
function setMaxTwinsPerBundle(uint16 _maxTwinsPerBundle) external;

/**
* @notice Gets the maximum numbers of twins that can be added to a bundle in a single transaction.
*
* @return the maximum numbers of twins that can be added to a bundle in a single transaction.
*/
function getMaxTwinsPerBundle() external view returns (uint16);

/**
* @notice Sets the maximum numbers of offers that can be added to a bundle in a single transaction.
*
* Emits a MaxOffersPerBundleChanged event.
*
* Reverts if _maxOffersPerBundle is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxOffersPerBundle - the maximum length of {BosonTypes.Bundle.offerIds}
*/
function setMaxOffersPerBundle(uint16 _maxOffersPerBundle) external;

/**
* @notice Gets the maximum numbers of offers that can be added to a bundle in a single transaction.
*
* @return the maximum numbers of offers that can be added to a bundle in a single transaction
*/
function getMaxOffersPerBundle() external view returns (uint16);

/**
* @notice Sets the maximum numbers of tokens that can be withdrawn in a single transaction.
*
* Emits a MaxTokensPerWithdrawalChanged event.
*
* Reverts if _maxTokensPerWithdrawal is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxTokensPerWithdrawal - the maximum length of token list when calling {FundsHandlerFacet.withdraw}
*/
function setMaxTokensPerWithdrawal(uint16 _maxTokensPerWithdrawal) external;

/**
* @notice Gets the maximum numbers of tokens that can be withdrawn in a single transaction.
*
* @return the maximum length of token list when calling {FundsHandlerFacet.withdraw}
*/
function getMaxTokensPerWithdrawal() external view returns (uint16);

/**
* @notice Sets the maximum number of dispute resolver fee structs that can be processed in a single transaction.
*
* Emits a MaxFeesPerDisputeResolverChanged event.
*
* Reverts if _maxFeesPerDisputeResolver is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxFeesPerDisputeResolver - the maximum length of dispute resolver fees list when calling {AccountHandlerFacet.createDisputeResolver} or {AccountHandlerFacet.updateDisputeResolver}
*/
function setMaxFeesPerDisputeResolver(uint16 _maxFeesPerDisputeResolver) external;

/**
* @notice Gets the maximum number of dispute resolver fee structs that can be processed in a single transaction.
*
* @return the maximum number of dispute resolver fee structs that can be processed in a single transaction
*/
function getMaxFeesPerDisputeResolver() external view returns (uint16);

/**
* @notice Sets the maximum escalation response period a dispute resolver can specify.
*
Expand All @@ -274,26 +154,6 @@ interface IBosonConfigHandler is IBosonConfigEvents {
*/
function getMaxEscalationResponsePeriod() external view returns (uint256);

/**
* @notice Sets the maximum number of disputes that can be expired in a single transaction.
*
* Emits a MaxDisputesPerBatchChanged event.
*
* Reverts if _maxDisputesPerBatch is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxDisputesPerBatch - the maximum number of disputes that can be expired
*/
function setMaxDisputesPerBatch(uint16 _maxDisputesPerBatch) external;

/**
* @notice Gets the maximum number of disputes that can be expired in a single transaction.
*
* @return the maximum number of disputes that can be expired
*/
function getMaxDisputesPerBatch() external view returns (uint16);

/**
* @notice Sets the total offer fee percentage limit which will validate the sum of (Protocol Fee percentage + Agent Fee percentage) of an offer fee.
*
Expand All @@ -317,26 +177,6 @@ interface IBosonConfigHandler is IBosonConfigEvents {
*/
function getMaxTotalOfferFeePercentage() external view returns (uint16);

/**
* @notice Sets the maximum number of seller ids that can be added to or removed from dispute resolver seller allow list in a single transaction.
*
* Emits a MaxAllowedSellersChanged event.
*
* Reverts if _maxAllowedSellers is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxAllowedSellers - the maximum number of seller ids that can be added or removed
*/
function setMaxAllowedSellers(uint16 _maxAllowedSellers) external;

/**
* @notice Gets the maximum number of seller ids that can be added to or removed from dispute resolver seller allow list in a single transaction.
*
* @return the maximum number of seller ids that can be added or removed
*/
function getMaxAllowedSellers() external view returns (uint16);

/**
* @notice Sets the buyer escalation fee percentage.
*
Expand Down Expand Up @@ -384,26 +224,6 @@ interface IBosonConfigHandler is IBosonConfigEvents {
*/
function getAuthTokenContract(BosonTypes.AuthTokenType _authTokenType) external view returns (address);

/**
* @notice Sets the maximum number of exchanges that can be created in a single transaction.
*
* Emits a MaxExchangesPerBatchChanged event.
*
* Reverts if _maxExchangesPerBatch is zero.
*
* @dev Caller must have ADMIN role.
*
* @param _maxExchangesPerBatch - the maximum length of {BosonTypes.Exchange[]}
*/
function setMaxExchangesPerBatch(uint16 _maxExchangesPerBatch) external;

/**
* @notice Gets the maximum number of exchanges that can be created in a single transaction.
*
* @return the maximum length of {BosonTypes.Exchange[]}
*/
function getMaxExchangesPerBatch() external view returns (uint16);

/**
* @notice Sets the maximum royalty percentage that can be set by the seller.
*
Expand Down Expand Up @@ -485,22 +305,6 @@ interface IBosonConfigHandler is IBosonConfigEvents {
*/
function getMinDisputePeriod() external view returns (uint256);

/**
* @notice Sets the maximum number of vouchers that can be preminted in a single transaction.
*
* Emits a MaxPremintedVouchersChanged event if successful.
*
* Reverts if the _maxPremintedVouchers is zero.
*
* @param _maxPremintedVouchers - the maximum number of vouchers
*/
function setMaxPremintedVouchers(uint256 _maxPremintedVouchers) external;

/**
* @notice Gets the maximum number of vouchers that can be preminted in a single transaction.
*/
function getMaxPremintedVouchers() external view returns (uint256);

/**
* @notice Sets the access controller address.
*
Expand Down
Loading

0 comments on commit 7cf35c4

Please sign in to comment.