Skip to content

Commit 8df356a

Browse files
committed
Upgrade OIF
1 parent c37a162 commit 8df356a

12 files changed

Lines changed: 79 additions & 55 deletions

lib/OIF

Submodule OIF updated from d81ecf1 to 225afb5

script/orderId.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ contract GetOrderId is Script {
2323
token: 0x000000000000000000000000036cbd53842c5426634e7929541ec2318f3dcf7e,
2424
amount: 20000,
2525
recipient: 0x000000000000000000000000529cebf485dee1d68073afb75244022f048b0157,
26-
call: hex"",
26+
callbackData: hex"",
2727
context: hex""
2828
});
2929
StandardOrder memory order = StandardOrder({

script/polymer.s.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ contract deployPolymer is multichain {
1818

1919
constructor() {
2020
polymerSalts[0x03Fb5bFA4EB2Cba072A477A372bB87880A60fC96] =
21-
0x00000000000000000000000000000000000000003f5a1d9c8d66f846fc58000c;
21+
0x00000000000000000000000000000000000000003f5a1d9c8d66f846fc58000c;
2222
polymerSalts[0x95ccEAE71605c5d97A0AC0EA13013b058729d075] =
23-
0x00000000000000000000000000000000000000004f09241f65a03e2a3e020030;
23+
0x00000000000000000000000000000000000000004f09241f65a03e2a3e020030;
2424
}
2525

2626
function run(

snapshots/inputSettler.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
"CompactFinaliseFor": "101978",
33
"CompactFinaliseSelf": "94549",
44
"CompactFinaliseTo": "94549",
5-
"EscrowFinalise": "44343",
6-
"IntegrationCoinFill": "64943",
5+
"EscrowFinalise": "44316",
6+
"IntegrationCoinFill": "64965",
77
"IntegrationCompactFinaliseSelf": "85359",
88
"IntegrationWormholeReceiveMessage": "45665",
99
"IntegrationWormholeSubmit": "13837",
1010
"broadcast": "14904",
1111
"compactFinaliseSelfWithFee": "164087",
1212
"depositAndRegisterFor": "129887",
13-
"escrowFinaliseSelfWithFee": "106546",
14-
"escrowFinaliseWithSignature": "51532",
15-
"escrowOpen": "56800",
16-
"escrowOpenFor3009Single": "85401",
17-
"escrowOpenFor3009SingleArray": "90505",
18-
"escrowOpenFor3009Two": "140507",
19-
"escrowOpenForMsgSender": "57023",
20-
"escrowOpenForPermit2": "94692"
13+
"escrowFinaliseSelfWithFee": "106519",
14+
"escrowFinaliseWithSignature": "51505",
15+
"escrowOpen": "56999",
16+
"escrowOpenFor3009Single": "85640",
17+
"escrowOpenFor3009SingleArray": "90796",
18+
"escrowOpenFor3009Two": "140807",
19+
"escrowOpenForMsgSender": "57219",
20+
"escrowOpenForPermit2": "94897"
2121
}

src/input/compact/InputSettlerCompactLIFI.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ contract InputSettlerCompactLIFI is InputSettlerCompact, GovernanceFee {
3030

3131
event IntentRegistered(bytes32 indexed orderId, StandardOrder order);
3232

33-
constructor(address compact, address initialOwner) InputSettlerCompact(compact) {
33+
constructor(
34+
address compact,
35+
address initialOwner
36+
) InputSettlerCompact(compact) {
3437
_initializeOwner(initialOwner);
3538
}
3639

src/input/escrow/InputSettlerEscrowLIFI.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ contract InputSettlerEscrowLIFI is InputSettlerEscrow, GovernanceFee {
5454
* msg.sender.
5555
* Does not validate fillDeadline.
5656
*/
57-
function _validateFillsNow(address inputOracle, MandateOutput[] calldata outputs, bytes32 orderId) internal view {
57+
function _validateFillsNow(
58+
address inputOracle,
59+
MandateOutput[] calldata outputs,
60+
bytes32 orderId
61+
) internal view {
5862
uint256 numOutputs = outputs.length;
5963
bytes memory proofSeries = new bytes(32 * 4 * numOutputs);
6064
for (uint256 i; i < numOutputs; ++i) {

src/libs/GovernanceFee.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ abstract contract GovernanceFee is Ownable {
8585
* @param fee Fee to subtract from amount. Is percentage and GOVERNANCE_FEE_DENOM based.
8686
* @return amountFee Fee
8787
*/
88-
function _calcFee(uint256 amount, uint256 fee) internal pure returns (uint256 amountFee) {
88+
function _calcFee(
89+
uint256 amount,
90+
uint256 fee
91+
) internal pure returns (uint256 amountFee) {
8992
unchecked {
9093
// Check if amount * fee overflows. If it does, don't take the fee.
9194
if (fee == 0 || amount >= type(uint256).max / fee) return amountFee = 0;

src/libs/RegisterIntentLib.sol

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ library RegisterIntentLib {
2121

2222
bytes32 constant STANDARD_ORDER_BATCH_COMPACT_TYPE_HASH = keccak256(
2323
bytes(
24-
"BatchCompact(address arbiter,address sponsor,uint256 nonce,uint256 expires,Lock[] commitments,Mandate mandate)Lock(bytes12 lockTag,address token,uint256 amount)Mandate(uint32 fillDeadline,address inputOracle,MandateOutput[] outputs)MandateOutput(bytes32 oracle,bytes32 settler,uint256 chainId,bytes32 token,uint256 amount,bytes32 recipient,bytes call,bytes context)"
24+
"BatchCompact(address arbiter,address sponsor,uint256 nonce,uint256 expires,Lock[] commitments,Mandate mandate)Lock(bytes12 lockTag,address token,uint256 amount)Mandate(uint32 fillDeadline,address inputOracle,MandateOutput[] outputs)MandateOutput(bytes32 oracle,bytes32 settler,uint256 chainId,bytes32 token,uint256 amount,bytes32 recipient,bytes callbackData,bytes context)"
2525
)
2626
);
2727

@@ -42,7 +42,7 @@ library RegisterIntentLib {
4242
output.token,
4343
output.amount,
4444
output.recipient,
45-
keccak256(output.call),
45+
keccak256(output.callbackData),
4646
keccak256(output.context)
4747
)
4848
);
@@ -112,7 +112,10 @@ library RegisterIntentLib {
112112
}
113113
}
114114

115-
function compactClaimHash(address settler, StandardOrder calldata order) internal pure returns (bytes32) {
115+
function compactClaimHash(
116+
address settler,
117+
StandardOrder calldata order
118+
) internal pure returns (bytes32) {
116119
return keccak256(
117120
abi.encode(
118121
STANDARD_ORDER_BATCH_COMPACT_TYPE_HASH,
@@ -133,7 +136,10 @@ library RegisterIntentLib {
133136
if (block.chainid != originChainId) revert WrongChain(block.chainid, originChainId);
134137
}
135138

136-
function _validateExpiry(uint32 fillDeadline, uint32 expires) internal view {
139+
function _validateExpiry(
140+
uint32 fillDeadline,
141+
uint32 expires
142+
) internal view {
137143
// Check if the fill deadline has been passed
138144
if (block.timestamp > fillDeadline) revert DeadlinePassed();
139145
// Check if expiry has been passed
@@ -163,14 +169,15 @@ library RegisterIntentLib {
163169
}
164170
}
165171

166-
(claimHash,) = TheCompact(COMPACT).batchDepositAndRegisterFor(
167-
order.user,
168-
idsAndAmounts,
169-
arbiter,
170-
order.nonce,
171-
order.expires,
172-
STANDARD_ORDER_BATCH_COMPACT_TYPE_HASH,
173-
witnessHash(order)
174-
);
172+
(claimHash,) = TheCompact(COMPACT)
173+
.batchDepositAndRegisterFor(
174+
order.user,
175+
idsAndAmounts,
176+
arbiter,
177+
order.nonce,
178+
order.expires,
179+
STANDARD_ORDER_BATCH_COMPACT_TYPE_HASH,
180+
witnessHash(order)
181+
);
175182
}
176183
}

test/input/compact/InputSettlerCompactLIFI.t.sol

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ contract InputSettlerCompactLIFITest is InputSettlerCompactTest {
3939
InputSettlerCompactLIFI(inputSettlerCompact).setGovernanceFee(type(uint64).max);
4040
}
4141

42-
function test_governance_fee_change_not_ready(uint64 fee, uint256 timeDelay) public {
42+
function test_governance_fee_change_not_ready(
43+
uint64 fee,
44+
uint256 timeDelay
45+
) public {
4346
vm.assume(fee <= MAX_GOVERNANCE_FEE);
4447
vm.assume(timeDelay < uint32(block.timestamp) + GOVERNANCE_FEE_CHANGE_DELAY);
4548

@@ -96,7 +99,7 @@ contract InputSettlerCompactLIFITest is InputSettlerCompactTest {
9699
token: bytes32(uint256(uint160(address(anotherToken)))),
97100
amount: amount,
98101
recipient: bytes32(uint256(uint160(swapper))),
99-
call: hex"",
102+
callbackData: hex"",
100103
context: hex""
101104
});
102105
StandardOrder memory order = StandardOrder({
@@ -125,14 +128,12 @@ contract InputSettlerCompactLIFITest is InputSettlerCompactTest {
125128

126129
InputSettlerBase.SolveParams[] memory solveParams = new InputSettlerBase.SolveParams[](1);
127130
solveParams[0] = InputSettlerBase.SolveParams({
128-
solver: bytes32(uint256(uint160((solver)))),
129-
timestamp: uint32(block.timestamp)
131+
solver: bytes32(uint256(uint160((solver)))), timestamp: uint32(block.timestamp)
130132
});
131133

132134
vm.prank(solver);
133-
InputSettlerCompactLIFI(inputSettlerCompact).finalise(
134-
order, signature, solveParams, bytes32(uint256(uint160((solver)))), hex""
135-
);
135+
InputSettlerCompactLIFI(inputSettlerCompact)
136+
.finalise(order, signature, solveParams, bytes32(uint256(uint160((solver)))), hex"");
136137
vm.snapshotGasLastCall("inputSettler", "compactFinaliseSelfWithFee");
137138

138139
assertEq(token.balanceOf(solver), amountPostFee);

test/input/escrow/InputSettlerEscrowLIFI.t.sol

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ contract InputSettlerEscrowLIFIHarness is InputSettlerEscrowLIFI {
1414
address initialOwner
1515
) InputSettlerEscrowLIFI(initialOwner) { }
1616

17-
function validateFillsNow(address inputOracle, MandateOutput[] calldata outputs, bytes32 orderId) external view {
17+
function validateFillsNow(
18+
address inputOracle,
19+
MandateOutput[] calldata outputs,
20+
bytes32 orderId
21+
) external view {
1822
_validateFillsNow(inputOracle, outputs, orderId);
1923
}
2024
}
@@ -60,7 +64,7 @@ contract inputSettlerEscrowTestBaseLIFI is InputSettlerEscrowTest {
6064
output.token,
6165
output.amount,
6266
output.recipient,
63-
output.call,
67+
output.callbackData,
6468
output.context
6569
)
6670
)
@@ -91,7 +95,10 @@ contract inputSettlerEscrowTestBaseLIFI is InputSettlerEscrowTest {
9195
InputSettlerEscrowLIFI(inputSettlerEscrow).setGovernanceFee(type(uint64).max);
9296
}
9397

94-
function test_governance_fee_change_not_ready(uint64 fee, uint256 timeDelay) public {
98+
function test_governance_fee_change_not_ready(
99+
uint64 fee,
100+
uint256 timeDelay
101+
) public {
95102
vm.assume(fee <= MAX_GOVERNANCE_FEE);
96103
vm.assume(timeDelay < uint32(block.timestamp) + GOVERNANCE_FEE_CHANGE_DELAY);
97104

@@ -140,7 +147,7 @@ contract inputSettlerEscrowTestBaseLIFI is InputSettlerEscrowTest {
140147
token: bytes32(uint256(uint160(address(anotherToken)))),
141148
amount: amount,
142149
recipient: bytes32(uint256(uint160(swapper))),
143-
call: hex"",
150+
callbackData: hex"",
144151
context: hex""
145152
});
146153
uint256[2][] memory inputs = new uint256[2][](1);
@@ -181,14 +188,12 @@ contract inputSettlerEscrowTestBaseLIFI is InputSettlerEscrowTest {
181188

182189
InputSettlerBase.SolveParams[] memory solveParams = new InputSettlerBase.SolveParams[](1);
183190
solveParams[0] = InputSettlerBase.SolveParams({
184-
timestamp: uint32(block.timestamp),
185-
solver: bytes32(uint256(uint160((solver))))
191+
timestamp: uint32(block.timestamp), solver: bytes32(uint256(uint160((solver))))
186192
});
187193

188194
vm.prank(solver);
189-
InputSettlerEscrowLIFI(inputSettlerEscrow).finalise(
190-
order, solveParams, bytes32(uint256(uint160((solver)))), hex""
191-
);
195+
InputSettlerEscrowLIFI(inputSettlerEscrow)
196+
.finalise(order, solveParams, bytes32(uint256(uint160((solver)))), hex"");
192197
vm.snapshotGasLastCall("inputSettler", "escrowFinaliseSelfWithFee");
193198

194199
uint256 govFeeAmount = (amount * fee) / 10 ** 18;

0 commit comments

Comments
 (0)