Skip to content

Commit

Permalink
Verification split out and compiling, some tests failing
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSparksCode committed Nov 3, 2023
1 parent da4963a commit 85ff2a9
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 264 deletions.
29 changes: 22 additions & 7 deletions script/deploy-atlas.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ import "forge-std/Test.sol";
import {DeployBaseScript} from "script/base/deploy-base.s.sol";

import {Atlas} from "src/contracts/atlas/Atlas.sol";
import {AtlasFactory} from "src/contracts/atlas/AtlasFactory.sol";
import {AtlasVerification} from "src/contracts/atlas/AtlasVerification.sol";
import {SwapIntentController} from "src/contracts/examples/intents-example/SwapIntent.sol";
import {TxBuilder} from "src/contracts/helpers/TxBuilder.sol";
import {Simulator} from "src/contracts/helpers/Simulator.sol";

contract DeployAtlasScript is DeployBaseScript {
// TODO move commons vars like these to base deploy script
Atlas public atlas;
AtlasFactory public atlasFactory;
AtlasVerification public atlasVerification;
Simulator public simulator;

function run() external {
Expand All @@ -26,7 +31,9 @@ contract DeployAtlasScript is DeployBaseScript {
vm.startBroadcast(deployerPrivateKey);

simulator = new Simulator();
atlas = new Atlas(64, address(simulator), address(0)); //TODO update to Factory addr arg
atlas = new Atlas(64, address(simulator), address(0), address(0)); //TODO update to Factory and Verification addr arg
atlasFactory = new AtlasFactory(address(atlas));
atlasVerification = new AtlasVerification();

vm.stopBroadcast();

Expand All @@ -41,6 +48,8 @@ contract DeployAtlasScript is DeployBaseScript {

contract DeployAtlasAndSwapIntentDAppControlScript is DeployBaseScript {
Atlas public atlas;
AtlasFactory public atlasFactory;
AtlasVerification public atlasVerification;
Simulator public simulator;
SwapIntentController public swapIntentControl;

Expand All @@ -56,14 +65,16 @@ contract DeployAtlasAndSwapIntentDAppControlScript is DeployBaseScript {

// Deploy the Atlas contract
simulator = new Simulator();
atlas = new Atlas(64, address(simulator), address(0)); //TODO update to Factory addr arg
atlas = new Atlas(64, address(simulator), address(0), address(0)); //TODO update to Factory and Verification addr arg
atlasFactory = new AtlasFactory(address(atlas));
atlasVerification = new AtlasVerification();

// Deploy the SwapIntent DAppControl contract
swapIntentControl = new SwapIntentController(address(atlas));

// Integrate SwapIntent with Atlas
atlas.initializeGovernance(address(swapIntentControl));
atlas.integrateDApp(address(swapIntentControl));
atlasVerification.initializeGovernance(address(swapIntentControl));
atlasVerification.integrateDApp(address(swapIntentControl));

vm.stopBroadcast();

Expand All @@ -80,6 +91,8 @@ contract DeployAtlasAndSwapIntentDAppControlScript is DeployBaseScript {

contract DeployAtlasAndSwapIntentDAppControlAndTxBuilderScript is DeployBaseScript {
Atlas public atlas;
AtlasFactory public atlasFactory;
AtlasVerification public atlasVerification;
Simulator public simulator;
SwapIntentController public swapIntentControl;
TxBuilder public txBuilder;
Expand All @@ -96,14 +109,16 @@ contract DeployAtlasAndSwapIntentDAppControlAndTxBuilderScript is DeployBaseScri

// Deploy the Atlas contract
simulator = new Simulator();
atlas = new Atlas(64, address(simulator), address(0)); //TODO update to Factory addr arg
atlas = new Atlas(64, address(simulator), address(0), address(0)); //TODO update to Factory and Verification addr arg
atlasFactory = new AtlasFactory(address(atlas));
atlasVerification = new AtlasVerification();

// Deploy the SwapIntent DAppControl contract
swapIntentControl = new SwapIntentController(address(atlas));

// Integrate SwapIntent with Atlas
atlas.initializeGovernance(address(swapIntentControl));
atlas.integrateDApp(address(swapIntentControl));
atlasVerification.initializeGovernance(address(swapIntentControl));
atlasVerification.integrateDApp(address(swapIntentControl));

// Deploy the TxBuilder
txBuilder = new TxBuilder(address(swapIntentControl), address(atlas), address(atlas));
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/atlas/Atlas.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contract Atlas is Escrow {
uint256 private constant _MAX_GAS = 1_500_000;
address public immutable FACTORY;

constructor(uint32 _escrowDuration, address _simulator, address _factory) Escrow(_escrowDuration, _simulator) {
constructor(uint32 _escrowDuration, address _simulator, address _factory, address _verification) Escrow(_escrowDuration, _simulator, _verification) {
FACTORY = _factory;
}

Expand Down
6 changes: 0 additions & 6 deletions src/contracts/atlas/AtlasFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import {Mimic} from "./Mimic.sol";
import {DAppConfig} from "src/contracts/types/DAppApprovalTypes.sol";
import {ExecutionEnvironment} from "./ExecutionEnvironment.sol";

// NOTE: Experimental - Splitting contracts into [AtlETH, Atlas, AtlasFactory]

// AtlasFactory needs:
// Factory - everything for creating new Execution Environments
// Exec Env template deployed separately, no internal deploy functions

// TODO make sure no cases of address(this) when Atlas address is intended

contract AtlasFactory {
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/atlas/AtlasVerification.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract AtlasVerification is EIP712, DAppIntegration {
return (result, gasLimit, solverEscrow);
}

function _getSolverPayload(SolverOperation calldata solverOp) internal view returns (bytes32 payload) {
function getSolverPayload(SolverOperation calldata solverOp) external view returns (bytes32 payload) {
payload = _hashTypedDataV4(_getSolverHash(solverOp));
}

Expand Down
Loading

0 comments on commit 85ff2a9

Please sign in to comment.