Skip to content
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
2 changes: 2 additions & 0 deletions contracts/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ BASE_SEPOLIA_USDT_ADDR=0x228eE6c1C297E2Eba0e95A71684B26f89385b4eC
BASE_SEPOLIA_WETH_ADDR=0x4200000000000000000000000000000000000006
BASE_SEPOLIA_FILL_BOT_PRIVATE_KEY=

MANAGER_MULTISIG_ADDR=

#xYield
XYIELD_GUARDIAN_ADDR=

Expand Down
3 changes: 3 additions & 0 deletions contracts/script/deploy/DeployArbT1XChainReader.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { T1XChainReader } from "../../src/libraries/xChain/T1XChainReader.sol";
contract DeployArbT1XChainReader is DeploymentUtils {
address internal ARB_T1_PROXY_ADMIN_ADDR = vm.envAddress("ARB_T1_PROXY_ADMIN_ADDR");
address internal PROVER = vm.envAddress("ARB_SIGNER");
address internal MANAGER_MULTISIG = vm.envAddress("MANAGER_MULTISIG_ADDR");

function run() external {
selectMainnetOrSepoliaFork("arbitrum");
Expand All @@ -24,6 +25,8 @@ contract DeployArbT1XChainReader is DeploymentUtils {
T1XChainReader impl = new T1XChainReader(PROVER);
logAddress("ARB_T1_X_CHAIN_READ_IMPLEMENTATION_ADDR", address(impl));

impl.initialize(MANAGER_MULTISIG);

TransparentUpgradeableProxy proxy =
new TransparentUpgradeableProxy(address(impl), address(proxyAdmin), new bytes(0));
logAddress("ARB_T1_X_CHAIN_READ_PROXY_ADDR", address(proxy));
Expand Down
3 changes: 3 additions & 0 deletions contracts/script/deploy/DeployBaseT1XChainReader.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { T1XChainReader } from "../../src/libraries/xChain/T1XChainReader.sol";
contract DeployBaseT1XChainReader is DeploymentUtils {
address internal BASE_T1_PROXY_ADMIN_ADDR = vm.envAddress("BASE_T1_PROXY_ADMIN_ADDR");
address internal PROVER = vm.envAddress("BASE_SIGNER");
address internal MANAGER_MULTISIG = vm.envAddress("MANAGER_MULTISIG_ADDR");

function run() external {
selectMainnetOrSepoliaFork("base");
Expand All @@ -23,6 +24,8 @@ contract DeployBaseT1XChainReader is DeploymentUtils {
T1XChainReader impl = new T1XChainReader(PROVER);
logAddress("BASE_T1_X_CHAIN_READ_IMPLEMENTATION_ADDR", address(impl));

impl.initialize(MANAGER_MULTISIG);

TransparentUpgradeableProxy proxy =
new TransparentUpgradeableProxy(address(impl), address(proxyAdmin), new bytes(0));
logAddress("BASE_T1_X_CHAIN_READ_PROXY_ADDR", address(proxy));
Expand Down
30 changes: 24 additions & 6 deletions contracts/src/7683/T1ERC7683.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ import { IT1XChainReader } from "../libraries/xChain/IT1XChainReader.sol";
contract T1ERC7683 is IT1ERC7683, T1Permit2, AccessControlUpgradeable, EIP712 {
using SafeERC20 for IERC20;

/// @dev Thrown when the destinationSettler does not match the counterpart
error InvalidDestinationSettler(bytes32 provided, bytes32 expected);

/// @dev Thrown when the input fill deadline does not match the stored fill deadline
error InvalidFillDeadline(uint32 provided, uint32 expected);

/// @dev Thrown when the sender is unexpected
error InvalidSender(bytes32 provided, bytes32 expected);

/// @notice Role for pausing/unpausing open operations
bytes32 public constant OPEN_PAUSER_ROLE = keccak256("OPEN_PAUSER_ROLE");
/// @notice Role for pausing/unpausing settlement operations
Expand Down Expand Up @@ -246,10 +255,19 @@ contract T1ERC7683 is IT1ERC7683, T1Permit2, AccessControlUpgradeable, EIP712 {

if (orderData.originDomain != localDomain) revert InvalidOriginDomain(orderData.originDomain);

// enforce fillDeadline into orderData
orderData.fillDeadline = _fillDeadline;
// enforce sender into orderData
orderData.sender = TypeCasts.addressToBytes32(_sender);
bytes32 expectedSettler = TypeCasts.addressToBytes32(counterpart);
if (orderData.destinationSettler != expectedSettler) {
revert InvalidDestinationSettler(orderData.destinationSettler, expectedSettler);
}

if (orderData.fillDeadline != _fillDeadline) {
revert InvalidFillDeadline(orderData.fillDeadline, _fillDeadline);
}

bytes32 expectedSender = TypeCasts.addressToBytes32(_sender);
if (orderData.sender != expectedSender) {
revert InvalidSender(orderData.sender, expectedSender);
}

// this can be used by the filler to approve the tokens to be spent on destination
Output[] memory maxSpent = new Output[](1);
Expand All @@ -260,7 +278,7 @@ contract T1ERC7683 is IT1ERC7683, T1Permit2, AccessControlUpgradeable, EIP712 {
chainId: orderData.destinationDomain
});

// this can be used by the filler know how much it can expect to receive
// this can be used by the filler to know how much it can expect to receive
Output[] memory minReceived = new Output[](1);
minReceived[0] = Output({
token: orderData.inputToken,
Expand All @@ -269,7 +287,7 @@ contract T1ERC7683 is IT1ERC7683, T1Permit2, AccessControlUpgradeable, EIP712 {
chainId: orderData.originDomain
});

// this can be user by the filler to know how to fill the order
// this can be used by the filler to know how to fill the order
FillInstruction[] memory fillInstructions = new FillInstruction[](1);
fillInstructions[0] = FillInstruction({
destinationChainId: orderData.destinationDomain,
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/test/7683/PausableTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ contract PausableTest is T1XChainReaderBaseTestSetup {
senderNonce: 1,
originDomain: origin,
destinationDomain: destination,
destinationSettler: TypeCasts.addressToBytes32(counterpart),
destinationSettler: TypeCasts.addressToBytes32(address(l2T1ERC7683)),
fillDeadline: deadline,
closedAuction: false,
data: ""
Expand Down