-
Notifications
You must be signed in to change notification settings - Fork 8
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
Allows DR creation without the need for activation by protocol admin #466
Conversation
5f96245
to
b450bc3
Compare
887c838
to
4cb5e71
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few cosmetic things and a couple of questions.
* | ||
* @param _disputeResolverId - id of the dispute resolver | ||
* @param _disputeResolverFees - 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -177,15 +173,16 @@ contract OfferBase is ProtocolBase, IBosonOfferEvents { | |||
uint256 feeIndex = lookups.disputeResolverFeeTokenIndex[_disputeResolverId][_offer.exchangeToken]; | |||
require(feeIndex > 0, DR_UNSUPPORTED_FEE); | |||
|
|||
uint256 feeAmount = disputeResolverFees[feeIndex - 1].feeAmount; | |||
// uint256 feeAmount = disputeResolverFees[feeIndex - 1].feeAmount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the // Protocol doesn't yet support DR fees
comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we should simply keep this in. Yes, it is a redundant operation, since feeAmount
will be always zero (which is effectively the same as it is now). But if we comment this out and want that the change is actually applied to diamon, we need to upgrade both OfferHandler and OrchestrationHandler.
Then when we finally enable non-zero fee amount, we'd need to do the upgrade again (or at least do the cuts to point back to the current implementation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it back
* | ||
* @param _disputeResolver - the fully populated struct with dispute resolver id set to 0x0 | ||
* @param _disputeResolverFees - array of fees dispute resolver charges per token type. Zero address is native currency. Can be empty. | ||
* @param _disputeResolverFees - 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 DR fees but DR still needs to provide array of fees to choose supported tokens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment for this function in the IBosonAccountHandler
interface 👆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
* @param _sellerAllowList - list of ids of sellers that can choose this dispute resolver. If empty, there are no restrictions on which seller can chose it. | ||
*/ | ||
function createDisputeResolver( | ||
DisputeResolver memory _disputeResolver, | ||
DisputeResolverFee[] calldata _disputeResolverFees, | ||
DisputeResolverFee[] memory _disputeResolverFees, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does _disputeResolverFees
change from calldata
to memory
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it because at first I was setting feeAmount = 0
but I forgot to put it back to calldata after we decided to revert instead of set to 0. Fixed
* | ||
* @param _disputeResolverId - id of the dispute resolver | ||
* @param _disputeResolverFees - 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 DR fees but DR still needs to provide array of fees to choose supported tokens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment in the IBosonAccountHandler
interface 👆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -253,13 +253,13 @@ describe("IBosonOrchestrationHandler", function () { | |||
adminDR.address, | |||
clerkDR.address, | |||
treasuryDR.address, | |||
false | |||
true | |||
); | |||
expect(disputeResolver.isValid()).is.true; | |||
|
|||
//Create DisputeResolverFee array so offer creation will succeed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it was pre-existing, but could you also fix this while you're at it? I've noticed these are randomly sprinkled around, we should fix as we go.
//Create
// Create
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -177,15 +173,16 @@ contract OfferBase is ProtocolBase, IBosonOfferEvents { | |||
uint256 feeIndex = lookups.disputeResolverFeeTokenIndex[_disputeResolverId][_offer.exchangeToken]; | |||
require(feeIndex > 0, DR_UNSUPPORTED_FEE); | |||
|
|||
uint256 feeAmount = disputeResolverFees[feeIndex - 1].feeAmount; | |||
// uint256 feeAmount = disputeResolverFees[feeIndex - 1].feeAmount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we should simply keep this in. Yes, it is a redundant operation, since feeAmount
will be always zero (which is effectively the same as it is now). But if we comment this out and want that the change is actually applied to diamon, we need to upgrade both OfferHandler and OrchestrationHandler.
Then when we finally enable non-zero fee amount, we'd need to do the upgrade again (or at least do the cuts to point back to the current implementation).
scripts/util/create-DR.js
Outdated
@@ -44,7 +43,7 @@ const addressNotFound = (address) => { | |||
process.exit(1); | |||
}; | |||
|
|||
const createAndActivateDR = async (path, createOnly, activateOnly) => { | |||
const createDR = async (path) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this method name is shorter now, I believe we should call it createDisputeResolver
. We don't want to abbreviate unless we have to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
This PR allows DR creation without the need for activation by protocol admin.
Contracts changes:
activateDisputeResolver
functioncreateDisputeResolver
:addFeesToDisputeResolver
:feeAmount
onstoreOffer
Scripts changes
activeDisputeResolver
callsactivateDisputeResolver
from estimate-limitsUnit tests