From 974afb285c584af5bc3e54b7cf3b049dc83d0dd0 Mon Sep 17 00:00:00 2001 From: zorzal Date: Tue, 26 Nov 2024 09:09:01 -0500 Subject: [PATCH] feat: remove demo related functions out of the deploy script --- script/Deploy.s.sol | 97 +-------------------------------------------- 1 file changed, 2 insertions(+), 95 deletions(-) diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index 1fedb34..2970cfb 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -88,15 +88,7 @@ contract Deploy is Script { uint256 public tyingBuffer; uint256 public disputeDisputeWindow; - // - uint256 public constant ENOUGH_BALANCE = 33e18; - uint256 public constant NOT_ENOUGH_BALANCE = 1e18; - error Deploy_InvalidPrecomputedAddress(); - error Deploy_DeployerNotEnoughBalance(); - - address deployer; - address agent; function setUp() public virtual { // Define The Graph accounts @@ -122,15 +114,10 @@ contract Deploy is Script { disputeDeadline = 10 days; tyingBuffer = 3 days; disputeDisputeWindow = 2 weeks; - - deployer = vm.rememberKey(vm.envUint('DEPLOYER_PRIVATE_KEY')); - agent = vm.rememberKey(vm.envUint('AGENT_PRIVATE_KEY')); - vm.label(deployer, 'deployer'); - vm.label(agent, 'agent'); } function deploy() public { - vm.startBroadcast(deployer); + vm.startBroadcast(); // Precompute address of `EBORequestCreator` IEBORequestCreator _precomputedEBORequestCreator = @@ -204,32 +191,8 @@ contract Deploy is Script { _labelContracts(); } - function setupBalances() public { - // deployer funds agent - vm.startBroadcast(deployer); - - uint256 _balanceD = address(deployer).balance; - console.log('deployer balance', _balanceD / 1e18); - if (_balanceD < NOT_ENOUGH_BALANCE) { - revert Deploy_DeployerNotEnoughBalance(); - } - uint256 _balanceA = address(agent).balance; - if (_balanceA < NOT_ENOUGH_BALANCE) { - agent.call{value: ENOUGH_BALANCE}(''); - console.log('agent balance from %d to %d', _balanceA / 1e18, agent.balance / 1e18); - } else { - console.log('agent balance', address(agent).balance / 1e18); - } - - if (graphToken.balanceOf(agent) < NOT_ENOUGH_BALANCE) { - horizonAccountingExtension.GRT().transfer(agent, ENOUGH_BALANCE); - } - console.log('GRT balance of agent %d', graphToken.balanceOf(agent) / 1e18); - vm.stopBroadcast(); - } - function setupEBO() public { - vm.startBroadcast(deployer); + vm.startBroadcast(); eboRequestModule.addEBORequestCreator(eboRequestCreator); @@ -239,62 +202,6 @@ contract Deploy is Script { vm.stopBroadcast(); } - function setupAgent() public { - /// agent setup - vm.startBroadcast(agent); - - horizonAccountingExtension.GRT().approve(address(horizonAccountingExtension.HORIZON_STAKING()), 20e18); - horizonAccountingExtension.HORIZON_STAKING().stake(1e18); - // approve EBO modules in HAE - horizonAccountingExtension.approveModule(address(bondEscalationModule)); - horizonAccountingExtension.approveModule(address(bondedResponseModule)); - - horizonAccountingExtension.HORIZON_STAKING().provision( - agent, - address(horizonAccountingExtension), - 1e18, - horizonAccountingExtension.MAX_VERIFIER_CUT(), - horizonAccountingExtension.MIN_THAWING_PERIOD() - ); - // horizonAccountingExtension.HORIZON_STAKING().addToProvision(agent, address(horizonAccountingExtension), 0.5e18); - - vm.stopBroadcast(); - } - - function setupDemo() public { - setupBalances(); - setupAgent(); - } - - function all() public { - deploy(); - setupDemo(); - } - - function _create() internal returns (IOracle.Request memory, bytes32) { - string memory chainId = string.concat('eip155:421614'); - - vm.recordLogs(); - - // This is bugged due to a problem in arbitrum block.number estimation in Anvil. - eboRequestCreator.createRequest(epochManager.currentEpoch(), chainId); - - Vm.Log[] memory entries = vm.getRecordedLogs(); - // assert we only have two events emitted - assert(entries.length == 2); - assert(entries[1].emitter == address(eboRequestCreator)); - - // decode the full IOracle.Request - bytes32 _requestId = entries[1].topics[1]; - (IOracle.Request memory _request) = abi.decode(entries[1].data, (IOracle.Request)); - assert(_requestId == keccak256(abi.encode(_request))); - - console.log('request id'); - console.logBytes32(_requestId); - - return (_request, _requestId); - } - function _instantiateRequestData() internal view returns (IOracle.Request memory _requestData) { // Set placeholder nonce _requestData.nonce = 0;