Skip to content

Commit 29f92ba

Browse files
committed
fixes from upstream
1 parent 5e8e2ad commit 29f92ba

File tree

4 files changed

+119
-119
lines changed

4 files changed

+119
-119
lines changed

src/CowEvcCollateralSwapWrapper.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8;
33

44
import {IEVC} from "evc/EthereumVaultConnector.sol";
55

6-
import {CowWrapper, CowSettlement} from "./vendor/CowWrapper.sol";
6+
import {CowWrapper, ICowSettlement} from "./CowWrapper.sol";
77
import {IERC20} from "euler-vault-kit/src/EVault/IEVault.sol";
88
import {SafeERC20Lib} from "euler-vault-kit/src/EVault/shared/lib/SafeERC20Lib.sol";
99
import {PreApprovedHashes} from "./PreApprovedHashes.sol";
@@ -83,7 +83,7 @@ contract CowEvcCollateralSwapWrapper is CowWrapper, PreApprovedHashes {
8383
bytes32 kind
8484
);
8585

86-
constructor(address _evc, CowSettlement _settlement) CowWrapper(_settlement) {
86+
constructor(address _evc, ICowSettlement _settlement) CowWrapper(_settlement) {
8787
EVC = IEVC(_evc);
8888
NONCE_NAMESPACE = uint256(uint160(address(this)));
8989

@@ -278,7 +278,7 @@ contract CowEvcCollateralSwapWrapper is CowWrapper, PreApprovedHashes {
278278
returns (uint256 fromVaultPrice, uint256 toVaultPrice)
279279
{
280280
(address[] memory tokens, uint256[] memory clearingPrices,,) = abi.decode(
281-
settleData[4:], (address[], uint256[], CowSettlement.CowTradeData[], CowSettlement.CowInteractionData[][3])
281+
settleData[4:], (address[], uint256[], ICowSettlement.Trade[], ICowSettlement.Interaction[][3])
282282
);
283283
for (uint256 i = 0; i < tokens.length; i++) {
284284
if (tokens[i] == fromVault) {
@@ -335,8 +335,8 @@ contract CowEvcCollateralSwapWrapper is CowWrapper, PreApprovedHashes {
335335
);
336336
}
337337

338-
// Use GPv2Wrapper's _internalSettle to call the settlement contract
338+
// Use GPv2Wrapper's _next to call the settlement contract
339339
// wrapperData is empty since we've already processed it in _wrap
340-
_internalSettle(settleData, remainingWrapperData);
340+
_next(settleData, remainingWrapperData);
341341
}
342342
}

test/CowEvcCollateralSwapWrapper.t.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {IEVC} from "evc/EthereumVaultConnector.sol";
77
import {IEVault, IERC4626, IBorrowing, IERC20} from "euler-vault-kit/src/EVault/IEVault.sol";
88

99
import {CowEvcCollateralSwapWrapper} from "../src/CowEvcCollateralSwapWrapper.sol";
10-
import {CowSettlement, CowWrapper} from "../src/vendor/CowWrapper.sol";
10+
import {ICowSettlement, CowWrapper} from "../src/CowWrapper.sol";
1111
import {GPv2AllowListAuthentication} from "cow/GPv2AllowListAuthentication.sol";
1212

1313
import {CowBaseTest} from "./helpers/CowBaseTest.sol";
@@ -86,8 +86,8 @@ contract CowEvcCollateralSwapWrapperTest is CowBaseTest {
8686
GPv2Order.Data orderData;
8787
address[] tokens;
8888
uint256[] clearingPrices;
89-
CowSettlement.CowTradeData[] trades;
90-
CowSettlement.CowInteractionData[][3] interactions;
89+
ICowSettlement.Trade[] trades;
90+
ICowSettlement.Interaction[][3] interactions;
9191
}
9292

9393
/// @notice Create settlement data for swapping collateral between vaults
@@ -122,7 +122,7 @@ contract CowEvcCollateralSwapWrapperTest is CowBaseTest {
122122
r.orderUid = getOrderUid(owner, r.orderData);
123123

124124
// Get trade data
125-
r.trades = new CowSettlement.CowTradeData[](1);
125+
r.trades = new ICowSettlement.Trade[](1);
126126
r.trades[0] = getTradeData(sellAmount, buyAmount, validTo, owner, r.orderData.receiver, false);
127127

128128
// Get tokens and prices
@@ -136,9 +136,9 @@ contract CowEvcCollateralSwapWrapperTest is CowBaseTest {
136136

137137
// Setup interactions - withdraw from sell vault, swap underlying assets, deposit to buy vault
138138
r.interactions = [
139-
new CowSettlement.CowInteractionData[](0),
140-
new CowSettlement.CowInteractionData[](4),
141-
new CowSettlement.CowInteractionData[](0)
139+
new ICowSettlement.Interaction[](0),
140+
new ICowSettlement.Interaction[](4),
141+
new ICowSettlement.Interaction[](0)
142142
];
143143

144144
// Withdraw from sell vault
@@ -155,7 +155,7 @@ contract CowEvcCollateralSwapWrapperTest is CowBaseTest {
155155
r.interactions[1][2] = getDepositInteraction(buyVaultToken, buyUnderlyingAmount);
156156

157157
// Skim to mint vault shares to receiver
158-
r.interactions[1][3] = CowSettlement.CowInteractionData({
158+
r.interactions[1][3] = ICowSettlement.Interaction({
159159
target: buyVaultToken,
160160
value: 0,
161161
callData: abi.encodeWithSignature("skim(uint256,address)", type(uint256).max, address(COW_SETTLEMENT))
@@ -225,7 +225,7 @@ contract CowEvcCollateralSwapWrapperTest is CowBaseTest {
225225

226226
// Encode settlement data
227227
bytes memory settleData = abi.encodeCall(
228-
CowSettlement.settle,
228+
ICowSettlement.settle,
229229
(settlement.tokens, settlement.clearingPrices, settlement.trades, settlement.interactions)
230230
);
231231

@@ -324,7 +324,7 @@ contract CowEvcCollateralSwapWrapperTest is CowBaseTest {
324324

325325
// Encode settlement data
326326
bytes memory settleData = abi.encodeCall(
327-
CowSettlement.settle,
327+
ICowSettlement.settle,
328328
(settlement.tokens, settlement.clearingPrices, settlement.trades, settlement.interactions)
329329
);
330330

@@ -476,7 +476,7 @@ contract CowEvcCollateralSwapWrapperTest is CowBaseTest {
476476

477477
// Encode settlement data
478478
bytes memory settleData = abi.encodeCall(
479-
CowSettlement.settle,
479+
ICowSettlement.settle,
480480
(settlement.tokens, settlement.clearingPrices, settlement.trades, settlement.interactions)
481481
);
482482

test/helpers/CowBaseTest.sol

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {EVaultTestBase} from "lib/euler-vault-kit/test/unit/evault/EVaultTestBas
88
import {IEVault, IVault, IERC4626, IERC20} from "euler-vault-kit/src/EVault/IEVault.sol";
99

1010
import {GPv2AllowListAuthentication} from "cow/GPv2AllowListAuthentication.sol";
11-
import {CowSettlement} from "../../src/vendor/CowWrapper.sol";
11+
import {ICowSettlement} from "../../src/CowWrapper.sol";
1212

1313
import {MilkSwap} from "./MilkSwap.sol";
1414

@@ -42,7 +42,7 @@ contract CowBaseTest is EVaultTestBase {
4242
address payable constant REAL_EVC = payable(0x0C9a3dd6b8F28529d72d7f9cE918D493519EE383);
4343
address internal swapVerifier = 0xae26485ACDDeFd486Fe9ad7C2b34169d360737c7;
4444

45-
CowSettlement constant COW_SETTLEMENT = CowSettlement(payable(0x9008D19f58AAbD9eD0D60971565AA8510560ab41));
45+
ICowSettlement constant COW_SETTLEMENT = ICowSettlement(payable(0x9008D19f58AAbD9eD0D60971565AA8510560ab41));
4646

4747
MilkSwap public milkSwap;
4848
address user;
@@ -117,20 +117,20 @@ contract CowBaseTest is EVaultTestBase {
117117
public
118118
pure
119119
returns (
120-
IERC20[] memory tokens,
120+
address[] memory tokens,
121121
uint256[] memory clearingPrices,
122-
CowSettlement.CowTradeData[] memory trades,
123-
CowSettlement.CowInteractionData[][3] memory interactions
122+
ICowSettlement.Trade[] memory trades,
123+
ICowSettlement.Interaction[][3] memory interactions
124124
)
125125
{
126126
return (
127-
new IERC20[](0),
127+
new address[](0),
128128
new uint256[](0),
129-
new CowSettlement.CowTradeData[](0),
129+
new ICowSettlement.Trade[](0),
130130
[
131-
new CowSettlement.CowInteractionData[](0),
132-
new CowSettlement.CowInteractionData[](0),
133-
new CowSettlement.CowInteractionData[](0)
131+
new ICowSettlement.Interaction[](0),
132+
new ICowSettlement.Interaction[](0),
133+
new ICowSettlement.Interaction[](0)
134134
]
135135
);
136136
}
@@ -146,9 +146,9 @@ contract CowBaseTest is EVaultTestBase {
146146
function getSwapInteraction(address sellToken, address buyToken, uint256 sellAmount)
147147
public
148148
view
149-
returns (CowSettlement.CowInteractionData memory)
149+
returns (ICowSettlement.Interaction memory)
150150
{
151-
return CowSettlement.CowInteractionData({
151+
return ICowSettlement.Interaction({
152152
target: address(milkSwap),
153153
value: 0,
154154
callData: abi.encodeCall(MilkSwap.swap, (sellToken, buyToken, sellAmount))
@@ -159,9 +159,9 @@ contract CowBaseTest is EVaultTestBase {
159159
function getDepositInteraction(address vault, uint256 sellAmount)
160160
public
161161
view
162-
returns (CowSettlement.CowInteractionData memory)
162+
returns (ICowSettlement.Interaction memory)
163163
{
164-
return CowSettlement.CowInteractionData({
164+
return ICowSettlement.Interaction({
165165
target: address(IEVault(vault).asset()),
166166
value: 0,
167167
callData: abi.encodeCall(IERC20.transfer, (vault, sellAmount))
@@ -171,17 +171,17 @@ contract CowBaseTest is EVaultTestBase {
171171
function getWithdrawInteraction(address vault, uint256 sellAmount)
172172
public
173173
pure
174-
returns (CowSettlement.CowInteractionData memory)
174+
returns (ICowSettlement.Interaction memory)
175175
{
176-
return CowSettlement.CowInteractionData({
176+
return ICowSettlement.Interaction({
177177
target: vault,
178178
value: 0,
179179
callData: abi.encodeCall(IERC4626.withdraw, (sellAmount, address(COW_SETTLEMENT), address(COW_SETTLEMENT)))
180180
});
181181
}
182182

183-
function getSkimInteraction() public pure returns (CowSettlement.CowInteractionData memory) {
184-
return CowSettlement.CowInteractionData({
183+
function getSkimInteraction() public pure returns (ICowSettlement.Interaction memory) {
184+
return ICowSettlement.Interaction({
185185
target: address(ESUSDS),
186186
value: 0,
187187
callData: abi.encodeCall(IVault.skim, (type(uint256).max, address(COW_SETTLEMENT)))
@@ -195,13 +195,13 @@ contract CowBaseTest is EVaultTestBase {
195195
address owner,
196196
address receiver,
197197
bool isBuy
198-
) public pure returns (CowSettlement.CowTradeData memory) {
198+
) public pure returns (ICowSettlement.Trade memory) {
199199
// Set flags for (pre-sign, FoK sell order)
200200
// See
201201
// https://github.com/cowprotocol/contracts/blob/08f8627d8427c8842ae5d29ed8b44519f7674879/src/contracts/libraries/GPv2Trade.sol#L89-L94
202202
uint256 flags = (3 << 5) | (isBuy ? 1 : 0); // 1100000
203203

204-
return CowSettlement.CowTradeData({
204+
return ICowSettlement.Trade({
205205
sellTokenIndex: 0,
206206
buyTokenIndex: 1,
207207
receiver: receiver,

0 commit comments

Comments
 (0)