Skip to content
Closed
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
27 changes: 22 additions & 5 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.8.26;

import {IOracle, Oracle} from '@defi-wonderland/prophet-core/solidity/contracts/Oracle.sol';

import {
BondEscalationModule,
IBondEscalationModule
Expand Down Expand Up @@ -112,7 +113,7 @@ contract Deploy is Script {
disputeDisputeWindow = 2 weeks;
}

function run() public {
function deploy() public {
vm.startBroadcast();

// Precompute address of `EBORequestCreator`
Expand All @@ -121,50 +122,67 @@ contract Deploy is Script {

// Deploy `Oracle`
oracle = new Oracle();
vm.label(address(oracle), 'Oracle');
console.log('`Oracle` deployed at:', address(oracle));

// Deploy `Arbitrable`
arbitrable = new Arbitrable(arbitrator, council);
vm.label(address(arbitrable), 'Arbitrable');
console.log('`Arbitrable` deployed at:', address(arbitrable));

// Deploy `EBORequestModule`
eboRequestModule = new EBORequestModule(oracle, _precomputedEBORequestCreator, arbitrable);
vm.label(address(eboRequestModule), 'EBORequestModule');
console.log('`EBORequestModule` deployed at:', address(eboRequestModule));

// Deploy `BondedResponseModule`
bondedResponseModule = new BondedResponseModule(oracle);
vm.label(address(bondedResponseModule), 'BondedResponseModule');
console.log('`BondedResponseModule` deployed at:', address(bondedResponseModule));

// Deploy `BondEscalationModule`
bondEscalationModule = new BondEscalationModule(oracle);
vm.label(address(bondEscalationModule), 'BondEscalationModule');
console.log('`BondEscalationModule` deployed at:', address(bondEscalationModule));

// Deploy `ArbitratorModule`
arbitratorModule = new ArbitratorModule(oracle);
vm.label(address(arbitratorModule), 'ArbitratorModule');
console.log('`ArbitratorModule` deployed at:', address(arbitratorModule));

// Deploy `EBOFinalityModule`
eboFinalityModule = new EBOFinalityModule(oracle, _precomputedEBORequestCreator, arbitrable);
vm.label(address(eboFinalityModule), 'EBOFinalityModule');
console.log('`EBOFinalityModule` deployed at:', address(eboFinalityModule));

// Deploy `HorizonAccountingExtension`
address[] memory _authorizedCallers = _instantiateAuthorizedCallers();
horizonAccountingExtension = new HorizonAccountingExtension(
horizonStaking, oracle, graphToken, arbitrable, _MIN_THAWING_PERIOD, _MAX_USERS_TO_CHECK, _authorizedCallers
);
horizonAccountingExtension = new HorizonAccountingExtension({
_horizonStaking: horizonStaking,
_oracle: oracle,
_grt: graphToken,
_arbitrable: arbitrable,
_minThawingPeriod: _MIN_THAWING_PERIOD,
_maxUsersToCheck: _MAX_USERS_TO_CHECK,
_authorizedCallers: _authorizedCallers
});
vm.label(address(horizonAccountingExtension), 'HorizonAccountingExtension');
console.log('`HorizonAccountingExtension` deployed at:', address(horizonAccountingExtension));

// Deploy `CouncilArbitrator`
councilArbitrator = new CouncilArbitrator(arbitratorModule, arbitrable);
vm.label(address(councilArbitrator), 'CouncilArbitrator');
console.log('`CouncilArbitrator` deployed at:', address(councilArbitrator));

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

// Deploy `EBORequestCreator`
IOracle.Request memory _requestData = _instantiateRequestData();
eboRequestCreator = new EBORequestCreator(oracle, epochManager, arbitrable, _requestData);
vm.label(address(eboRequestCreator), 'EBORequestCreator');
console.log('`EBORequestCreator` deployed at:', address(eboRequestCreator));

// Assert that `EBORequestCreator` was deployed at the precomputed address
Expand All @@ -178,7 +196,6 @@ contract Deploy is Script {
_requestData.nonce = 0;

// Set requester and modules

_requestData.requester = address(eboRequestCreator);
_requestData.accessModule = address(eboAccessModule);
_requestData.requestModule = address(eboRequestModule);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/arbitrum/IntegrationBase.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.26;

import {IAccessController} from '@defi-wonderland/prophet-core/solidity/interfaces/access/IAccessController.sol';

Check warning on line 4 in test/integration/arbitrum/IntegrationBase.t.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Variable "IAccessController" is unused
import {ValidatorLib} from '@defi-wonderland/prophet-core/solidity/libraries/ValidatorLib.sol';

import 'forge-std/Test.sol';
Expand Down Expand Up @@ -38,7 +38,7 @@

// Run deployment script
super.setUp();
run();
deploy();

// Set user accounts
_requester = makeAddr('requester');
Expand Down
6 changes: 3 additions & 3 deletions test/unit/Deploy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
function test_RunRevertWhen_TheGraphAccountsAreNotSetUp() public {
// it should revert
vm.expectRevert();
deploy.run();
deploy.deploy();
}

modifier givenTheGraphAccountsAreSetUp() {
Expand All @@ -82,21 +82,21 @@
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);

// it should revert
vm.expectRevert(Deploy.Deploy_InvalidPrecomputedAddress.selector);
deploy.run();
deploy.deploy();
}

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();
deploy.deploy();
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
Loading