Skip to content

Commit

Permalink
pass stagingReturnData to protocol allocatingCall
Browse files Browse the repository at this point in the history
  • Loading branch information
jj1980a committed Aug 16, 2023
1 parent ef251c2 commit f7d2de8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/contracts/atlas/Atlas.sol
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ contract Atlas is Test, Factory {
if (_executeSearcherCall(searcherCall, stagingReturnData, auctionAlreadyWon, environment)) {
if (!auctionAlreadyWon) {
auctionAlreadyWon = true;
_executePayments(protocolCall, searcherCall.bids, environment);
_executePayments(protocolCall, searcherCall.bids, stagingReturnData, environment);
}
}
return auctionAlreadyWon;
Expand Down
3 changes: 2 additions & 1 deletion src/contracts/atlas/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ contract Escrow is ProtocolVerifier, SafetyLocks, SearcherWrapper {
function _executePayments(
ProtocolCall calldata protocolCall,
BidData[] calldata winningBids,
bytes memory stagingReturnData,
address environment
) internal paymentsLock(environment) {
// process protocol payments
try IExecutionEnvironment(environment).allocateRewards(winningBids) {}
try IExecutionEnvironment(environment).allocateRewards(winningBids, stagingReturnData) {}
catch {
emit MEVPaymentFailure(protocolCall.to, protocolCall.callConfig, winningBids);
}
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/atlas/ExecutionEnvironment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ contract ExecutionEnvironment is Test {
require(atlas.balance >= escrowBalance, SEARCHER_MSG_VALUE_UNPAID);
}

function allocateRewards(BidData[] calldata bids) external {
function allocateRewards(BidData[] calldata bids, bytes memory stagingReturnData) external {
// msg.sender = escrow
// address(this) = ExecutionEnvironment
require(msg.sender == atlas, "ERR-04 InvalidCaller");
Expand Down Expand Up @@ -306,7 +306,7 @@ contract ExecutionEnvironment is Test {
}
}

bytes memory allocateData = abi.encodeWithSelector(IProtocolControl.allocatingCall.selector, abi.encode(totalEtherReward, bids));
bytes memory allocateData = abi.encodeWithSelector(IProtocolControl.allocatingCall.selector, abi.encode(totalEtherReward, bids, stagingReturnData));

allocateData = abi.encodePacked(
allocateData,
Expand Down
3 changes: 2 additions & 1 deletion src/contracts/interfaces/IExecutionEnvironment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ interface IExecutionEnvironment {
) external payable;

function allocateRewards(
BidData[] calldata bids // Converted to memory
BidData[] calldata bids, // Converted to memory
bytes memory stagingReturnData
) external;

function getUser() external pure returns (address user);
Expand Down

0 comments on commit f7d2de8

Please sign in to comment.