Skip to content

Commit

Permalink
More AtlasVerification test and interface fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSparksCode committed Nov 3, 2023
1 parent 85ff2a9 commit 5e2b066
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 63 deletions.
13 changes: 7 additions & 6 deletions src/contracts/helpers/TxBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {IDAppControl} from "../interfaces/IDAppControl.sol";
import {IDAppIntegration} from "../interfaces/IDAppIntegration.sol";
import {IAtlas} from "../interfaces/IAtlas.sol";
import {IAtlETH} from "../interfaces/IAtlETH.sol";
import {IAtlasVerification} from "../interfaces/IAtlasVerification.sol";

import "../types/SolverCallTypes.sol";
import "../types/UserCallTypes.sol";
Expand All @@ -19,28 +20,28 @@ contract TxBuilder {
using CallVerification for UserOperation;

address public immutable control;
address public immutable escrow;
address public immutable atlas;
address public immutable verification;

uint256 public immutable gas;

constructor(address controller, address escrowAddress, address atlasAddress) {
constructor(address controller, address atlasAddress, address _verification) {
control = controller;
escrow = escrowAddress;
atlas = atlasAddress;
verification = _verification;
gas = 1_000_000;
}

function solverNextNonce(address solverSigner) public view returns (uint256) {
return IAtlETH(escrow).nextAccountNonce(solverSigner);
return IAtlETH(atlas).nextAccountNonce(solverSigner);
}

function governanceNextNonce(address signatory) public view returns (uint256) {
return IAtlas(atlas).getNextNonce(signatory);
return IAtlasVerification(verification).getNextNonce(signatory);
}

function userNextNonce(address user) public view returns (uint256) {
return IAtlas(atlas).getNextNonce(user);
return IAtlasVerification(verification).getNextNonce(user);
}

function getControlCodeHash(address dAppControl) external view returns (bytes32) {
Expand Down
11 changes: 1 addition & 10 deletions src/contracts/interfaces/IAtlas.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface IAtlas {
function withdrawERC20(address token, uint256 amount, DAppConfig memory dConfig) external;
function withdrawEther(uint256 amount, DAppConfig memory dConfig) external;

// TODO remove this and inside Atlas - escrow addr is Atlas addr
function getEscrowAddress() external view returns (address escrowAddress);

function userDirectVerifyDApp(
Expand All @@ -26,14 +27,4 @@ interface IAtlas {
) external returns (bool);

function userDirectReleaseLock(address userOpFrom, bytes32 key, DAppConfig calldata dConfig) external;

function getDAppOperationPayload(DAppOperation memory verification) external view returns (bytes32 payload);

function getSolverPayload(SolverOperation calldata solverOp) external view returns (bytes32 payload);

function getUserOperationPayload(UserOperation memory userOp) external view returns (bytes32 payload);

function getNextNonce(address account) external view returns (uint256 nextNonce);

function getDomainSeparator() external view returns (bytes32 domainSeparator);
}
10 changes: 10 additions & 0 deletions src/contracts/interfaces/IAtlasVerification.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ interface IAtlasVerification {
external
view
returns (uint256 result, uint256 gasLimit, EscrowAccountData memory);


function getUserOperationPayload(UserOperation memory userOp) external view returns (bytes32 payload);
function getNextNonce(address account) external view returns (uint256 nextNonce);

function initializeGovernance(address controller) external;
function addSignatory(address controller, address signatory) external;
function removeSignatory(address controller, address signatory) external;
function integrateDApp(address dAppControl) external;
function disableDApp(address dAppControl) external;
}
13 changes: 2 additions & 11 deletions test/Accounting.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,11 @@ contract AccountingTest is BaseTest {

txBuilder = new TxBuilder({
controller: address(swapIntentController),
escrowAddress: address(escrow),
atlasAddress: address(atlas)
atlasAddress: address(atlas),
_verification: address(atlasVerification)
});
}

function testDELEET() public {
uint16 lockState = uint16(61711); // phase 4 - HandlingPayments
uint16 phase = SafetyBits.getCurrentExecutionPhase(lockState);
console.log(TestUtils.uint16ToBinaryString(61711));
console.log("phase", phase);
console.log("Exec Phase", uint8(ExecutionPhase.Releasing));
}


function testSolverBorrowRepaySuccessfully() public {

// Solver deploys the RFQ solver contract (defined at bottom of this file)
Expand Down
33 changes: 0 additions & 33 deletions test/DAppOperationSigner.sol

This file was deleted.

1 change: 0 additions & 1 deletion test/MainTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import "../src/contracts/types/DAppApprovalTypes.sol";

import {BaseTest} from "./base/BaseTest.t.sol";
import {V2Helper} from "./V2Helper.sol";
import {DAppOperationSigner} from "./DAppOperationSigner.sol";

import "forge-std/Test.sol";

Expand Down
4 changes: 2 additions & 2 deletions test/SwapIntent.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ contract SwapIntentTest is BaseTest {

txBuilder = new TxBuilder({
controller: address(swapIntentController),
escrowAddress: address(escrow),
atlasAddress: address(atlas)
atlasAddress: address(atlas),
_verification: address(atlasVerification)
});

// Deposit ETH from Searcher signer to pay for searcher's gas
Expand Down

0 comments on commit 5e2b066

Please sign in to comment.