From 9b26381f9f0614f14faa7bc6bad515daabe393b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Fingen?= Date: Thu, 23 Jul 2020 18:39:52 +0200 Subject: [PATCH 1/3] agreements: Remove ETH as an option for fees --- contracts/apps/disputable/DisputableAragonApp.sol | 2 +- contracts/apps/disputable/IAgreement.sol | 2 +- contracts/lib/arbitration/IAragonAppFeesCashier.sol | 2 +- .../test/mocks/apps/disputable/DisputableAppMock.sol | 2 +- test/contracts/apps/disputable/disputable_app.js | 9 --------- 5 files changed, 4 insertions(+), 13 deletions(-) diff --git a/contracts/apps/disputable/DisputableAragonApp.sol b/contracts/apps/disputable/DisputableAragonApp.sol index 8e2907e18..cf13062dd 100644 --- a/contracts/apps/disputable/DisputableAragonApp.sol +++ b/contracts/apps/disputable/DisputableAragonApp.sol @@ -129,7 +129,7 @@ contract DisputableAragonApp is IDisputable, AragonApp { */ function _newAgreementAction(uint256 _disputableActionId, bytes _context, address _submitter) internal returns (uint256) { IAgreement agreement = _ensureAgreement(); - return agreement.newAction.value(msg.value)(_disputableActionId, _context, _submitter); + return agreement.newAction(_disputableActionId, _context, _submitter); } /** diff --git a/contracts/apps/disputable/IAgreement.sol b/contracts/apps/disputable/IAgreement.sol index 99d48e96e..105f35958 100644 --- a/contracts/apps/disputable/IAgreement.sol +++ b/contracts/apps/disputable/IAgreement.sol @@ -48,7 +48,7 @@ contract IAgreement is IArbitrable, IACLOracle { function deactivate(address _disputable) external; - function newAction(uint256 _disputableActionId, bytes _context, address _submitter) external payable returns (uint256); + function newAction(uint256 _disputableActionId, bytes _context, address _submitter) external returns (uint256); function closeAction(uint256 _actionId) external; diff --git a/contracts/lib/arbitration/IAragonAppFeesCashier.sol b/contracts/lib/arbitration/IAragonAppFeesCashier.sol index bb3da0505..adbe696c5 100644 --- a/contracts/lib/arbitration/IAragonAppFeesCashier.sol +++ b/contracts/lib/arbitration/IAragonAppFeesCashier.sol @@ -12,6 +12,6 @@ interface IAragonAppFeesCashier { function setAppFees(bytes32[] _appIds, ERC20[] _tokens, uint256[] _amounts) external; function unsetAppFee(bytes32 _appId) external; function unsetAppFees(bytes32[] _appIds) external; - function payAppFees(bytes32 _appId, bytes _data) external payable; + function payAppFees(bytes32 _appId, bytes _data) external; function getAppFee(bytes32 _appId) external view returns (ERC20, uint256); } diff --git a/contracts/test/mocks/apps/disputable/DisputableAppMock.sol b/contracts/test/mocks/apps/disputable/DisputableAppMock.sol index 65c08d209..9a96655d9 100644 --- a/contracts/test/mocks/apps/disputable/DisputableAppMock.sol +++ b/contracts/test/mocks/apps/disputable/DisputableAppMock.sol @@ -16,7 +16,7 @@ contract DisputableAppMock is DisputableAragonApp { initialized(); } - function newAction(uint256 _disputableActionId, bytes _context, address _submitter) external payable { + function newAction(uint256 _disputableActionId, bytes _context, address _submitter) external { _newAgreementAction(_disputableActionId, _context, _submitter); } diff --git a/test/contracts/apps/disputable/disputable_app.js b/test/contracts/apps/disputable/disputable_app.js index 6096657a2..5cbd0b6fa 100644 --- a/test/contracts/apps/disputable/disputable_app.js +++ b/test/contracts/apps/disputable/disputable_app.js @@ -145,15 +145,6 @@ contract('DisputableApp', ([_, owner, agreement, anotherAgreement, someone]) => it('does not revert', async () => { await disputable.newAction(0, '0x00', owner) }) - - it('receives ETH when sent', async () => { - const previousBalance = await web3.eth.getBalance(agreement.address) - - await disputable.newAction(0, '0x00', owner, { value: 1e18 }) - - const currentBalance = await web3.eth.getBalance(agreement.address) - assert.equal(currentBalance.sub(previousBalance).toString(), 1e18, 'agreement balance does not match') - }) }) }) From fd4b8f92744828ac63966221ed5c704875885f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Fingen?= Date: Fri, 24 Jul 2020 19:13:04 +0200 Subject: [PATCH 2/3] agreements: add interface to mock --- contracts/test/mocks/apps/disputable/AgreementMock.sol | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contracts/test/mocks/apps/disputable/AgreementMock.sol b/contracts/test/mocks/apps/disputable/AgreementMock.sol index fef426545..9aea28ae3 100644 --- a/contracts/test/mocks/apps/disputable/AgreementMock.sol +++ b/contracts/test/mocks/apps/disputable/AgreementMock.sol @@ -1,8 +1,10 @@ pragma solidity 0.4.24; +import "../../../../apps/disputable/IAgreement.sol"; -contract AgreementMock { - function newAction(uint256 /* _disputableActionId */, bytes /* _context */, address /* _submitter */) external payable returns (uint256) { + +contract AgreementMock is IAgreement { + function newAction(uint256 /* _disputableActionId */, bytes /* _context */, address /* _submitter */) external returns (uint256) { // do nothing return 0; } From f9b1d24e423fa76dac0bd0454a60ff9c07769afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Fingen?= Date: Fri, 24 Jul 2020 22:15:23 +0200 Subject: [PATCH 3/3] fixup! agreements: add interface to mock --- .../mocks/apps/disputable/AgreementMock.sol | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/contracts/test/mocks/apps/disputable/AgreementMock.sol b/contracts/test/mocks/apps/disputable/AgreementMock.sol index 9aea28ae3..2047acc02 100644 --- a/contracts/test/mocks/apps/disputable/AgreementMock.sol +++ b/contracts/test/mocks/apps/disputable/AgreementMock.sol @@ -4,6 +4,26 @@ import "../../../../apps/disputable/IAgreement.sol"; contract AgreementMock is IAgreement { + function sign() external { + // do nothing + } + + function activate( + address, + ERC20, + uint256, + uint256, + uint64 + ) + external + { + // do nothing + } + + function deactivate(address) external { + // do nothing + } + function newAction(uint256 /* _disputableActionId */, bytes /* _context */, address /* _submitter */) external returns (uint256) { // do nothing return 0; @@ -12,4 +32,100 @@ contract AgreementMock is IAgreement { function closeAction(uint256 /* _actionId */) external { // do nothing } + + function challengeAction(uint256, uint256, bool, bytes) external { + // do nothing + } + + function settleAction(uint256) external { + // do nothing + } + + function disputeAction(uint256, bool) external { + // do nothing + } + + function getSigner(address) external view returns (uint256, bool) { + // do nothing + } + + function getCurrentSettingId() external view returns (uint256) { + // do nothing + } + + function getSetting(uint256) external view + returns ( + IArbitrator, + IAragonAppFeesCashier, + string, + bytes + ) + { + // do nothing + } + + function getDisputableInfo(address) external view returns (bool, uint256) { + // do nothing + } + + function getCollateralRequirement(address, uint256) external view + returns ( + ERC20, + uint256, + uint256, + uint64 + ) + { + // do nothing + } + + function getAction(uint256) external view + returns ( + address, + uint256, + uint256, + uint256, + address, + bool, + bytes, + uint256 + ) + { + // do nothing + } + + function getChallenge(uint256) external view + returns ( + uint256, + address, + uint64, + bytes, + uint256, + uint256, + ERC20, + ChallengeState, + bool, + bool, + uint256, + uint256 + ) + { + // do nothing + } + + function submitEvidence(uint256 _disputeId, bytes _evidence, bool _finished) external { + // do nothing + } + + function rule(uint256 _disputeId, uint256 _ruling) external { + // do nothing + } + + function supportsInterface(bytes4 _interfaceId) external pure returns (bool) { + // do nothing + } + + function canPerform(address, address, address, bytes32, uint256[]) external view returns (bool) { + // do nothing + } }