Skip to content

Commit

Permalink
bring back contract balance and atspec
Browse files Browse the repository at this point in the history
  • Loading branch information
hensha256 committed Aug 4, 2024
1 parent a997cfd commit c5fe893
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
134497
134520
Original file line number Diff line number Diff line change
@@ -1 +1 @@
134635
134658
Original file line number Diff line number Diff line change
@@ -1 +1 @@
127667
127690
Original file line number Diff line number Diff line change
@@ -1 +1 @@
127805
127828
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_Bytecode.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8142
8199
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
120546
120569
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
119741
119764
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
128613
128636
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
135443
135466
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactIn2Hops.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
186950
186973
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
178885
178908
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactIn3Hops.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
238482
238505
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
230441
230464
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactInputSingle.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
134497
134520
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
119600
119623
2 changes: 1 addition & 1 deletion .forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
118778
118801
8 changes: 7 additions & 1 deletion src/base/DeltaResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ abstract contract DeltaResolver is ImmutableState {
}

/// @notice Calculates the amount for a swap action
/// @dev This is to be used for swaps where the input amount isn't known before the transaction, and
/// isn't possible using a v4 multi-hop command.
/// For example USDC-v2->DAI-v4->USDT. This intermediate DAI amount could be swapped using CONTRACT_BALANCE
/// or settled using CONTRACT_BALANCE then swapped using OPEN_DELTA.
function _mapInputAmount(uint128 amount, Currency currency) internal view returns (uint128) {
if (amount == Constants.OPEN_DELTA) {
if (amount == Constants.CONTRACT_BALANCE) {
return currency.balanceOfSelf().toUint128();
} else if (amount == Constants.OPEN_DELTA) {
return _getFullCredit(currency).toUint128();
}
return amount;
Expand Down

0 comments on commit c5fe893

Please sign in to comment.