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

feat: update deploy script #55

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 11 additions & 5 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ import {
IBondEscalationAccounting
} from '@defi-wonderland/prophet-modules/solidity/interfaces/extensions/IBondEscalationAccounting.sol';
import {IERC20} from '@openzeppelin/contracts/interfaces/IERC20.sol';
import {IEpochManager} from 'interfaces/external/IEpochManager.sol';
import {IHorizonStaking} from 'interfaces/external/IHorizonStaking.sol';

import {Arbitrable, IArbitrable} from 'contracts/Arbitrable.sol';
import {CouncilArbitrator, ICouncilArbitrator} from 'contracts/CouncilArbitrator.sol';
import {IEpochManager} from 'interfaces/external/IEpochManager.sol';
import {IHorizonStaking} from 'interfaces/external/IHorizonStaking.sol';

import {EBOAccessModule, IEBOAccessModule} from 'contracts/EBOAccessModule.sol';
import {EBOFinalityModule, IEBOFinalityModule} from 'contracts/EBOFinalityModule.sol';
import {EBORequestCreator, IEBORequestCreator} from 'contracts/EBORequestCreator.sol';
import {EBORequestModule, IEBORequestModule} from 'contracts/EBORequestModule.sol';
Expand All @@ -42,7 +44,7 @@ import {
import 'forge-std/Script.sol';

contract Deploy is Script {
uint256 public constant DEPLOYMENT_COUNT = 10;
uint256 public constant DEPLOYMENT_COUNT = 11;
uint256 public constant OFFSET_EBO_REQUEST_CREATOR = DEPLOYMENT_COUNT - 1;

// Oracle
Expand All @@ -54,6 +56,7 @@ contract Deploy is Script {
IBondEscalationModule public bondEscalationModule;
IArbitratorModule public arbitratorModule;
IEBOFinalityModule public eboFinalityModule;
IEBOAccessModule public eboAccessModule;

// Extensions
IHorizonAccountingExtension public horizonAccountingExtension;
Expand Down Expand Up @@ -155,6 +158,10 @@ contract Deploy is Script {
councilArbitrator = new CouncilArbitrator(arbitratorModule, arbitrable);
console.log('`CouncilArbitrator` deployed at:', address(councilArbitrator));

// Deploy `EBOAccessModule`
eboAccessModule = new EBOAccessModule(oracle, arbitrable, horizonAccountingExtension);
console.log('`EBOAccessModule` deployed at:', address(eboAccessModule));

// Deploy `EBORequestCreator`
IOracle.Request memory _requestData = _instantiateRequestData();
eboRequestCreator = new EBORequestCreator(oracle, epochManager, arbitrable, _requestData);
Expand All @@ -173,8 +180,7 @@ contract Deploy is Script {
// Set requester and modules

_requestData.requester = address(eboRequestCreator);
// todo : replace with HorizonOperatorAccessModule
_requestData.accessModule = address(0);
_requestData.accessModule = address(eboAccessModule);
_requestData.requestModule = address(eboRequestModule);
_requestData.responseModule = address(bondedResponseModule);
_requestData.disputeModule = address(bondEscalationModule);
Expand Down
1 change: 1 addition & 0 deletions test/unit/Deploy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
public
givenTheGraphAccountsAreSetUp
{
uint256 _nonceEBORequestCreator = vm.getNonce(tx.origin) + deploy.OFFSET_EBO_REQUEST_CREATOR();

Check warning on line 85 in test/unit/Deploy.t.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Avoid to use tx.origin
address _precomputedEBORequestCreator = vm.computeCreateAddress(tx.origin, _nonceEBORequestCreator);

Check warning on line 86 in test/unit/Deploy.t.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Avoid to use tx.origin
vm.assume(_precomputedEBORequestCreator != _precomputedAddress);

deploy.mock_setPrecomputedAddress(_precomputedAddress);
Expand All @@ -94,9 +94,9 @@
}

function test_RunWhenPrecomputedAddressIsCorrect() public givenTheGraphAccountsAreSetUp {
uint256 _nonceBefore = vm.getNonce(tx.origin);

Check warning on line 97 in test/unit/Deploy.t.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Avoid to use tx.origin
deploy.run();
uint256 _nonceAfter = vm.getNonce(tx.origin);

Check warning on line 99 in test/unit/Deploy.t.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Avoid to use tx.origin

// it should deploy all contracts using a single EOA
assertEq(deploy.DEPLOYMENT_COUNT(), _nonceAfter - _nonceBefore);
Expand Down Expand Up @@ -181,6 +181,7 @@
_requestData.nonce = 0;

_requestData.requester = address(deploy.eboRequestCreator());
_requestData.accessModule = address(deploy.eboAccessModule());
_requestData.requestModule = address(deploy.eboRequestModule());
_requestData.responseModule = address(deploy.bondedResponseModule());
_requestData.disputeModule = address(deploy.bondEscalationModule());
Expand Down
Loading