Skip to content
Open
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
35 changes: 31 additions & 4 deletions contracts/SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1673,8 +1673,23 @@ abstract contract SpokePool is
if (fillStatuses[relayHash] == uint256(FillStatus.Filled)) revert RelayFilled();
fillStatuses[relayHash] = uint256(FillStatus.Filled);

// @dev Before returning early, emit events to assist the dataworker in being able to know which fills were
// successful.
_emitFilledRelayEvent(relayExecution, relayData, relayer, fillType);
_transferTokensToRecipient(relayExecution, relayData, isSlowFill);
}

/**
* @notice Emits the FilledRelay event for a completed relay fill.
* @param relayExecution The relay execution parameters.
* @param relayData The relay data.
* @param relayer The relayer address.
* @param fillType The type of fill being executed.
*/
function _emitFilledRelayEvent(
V3RelayExecutionParams memory relayExecution,
V3RelayData memory relayData,
bytes32 relayer,
FillType fillType
) internal {
emit FilledRelay(
relayData.inputToken,
relayData.outputToken,
Expand All @@ -1697,13 +1712,25 @@ abstract contract SpokePool is
fillType: fillType
})
);
}

/**
* @notice Transfers tokens to the recipient based on the relay execution parameters.
* @param relayExecution The relay execution parameters.
* @param relayData The relay data.
* @param isSlowFill Whether this is a slow fill execution.
*/
function _transferTokensToRecipient(
V3RelayExecutionParams memory relayExecution,
V3RelayData memory relayData,
bool isSlowFill
) internal {
address outputToken = relayData.outputToken.toAddress();
uint256 amountToSend = relayExecution.updatedOutputAmount;
address recipientToSend = relayExecution.updatedRecipient.toAddress();

// If relay token is wrappedNativeToken then unwrap and send native token.
// Stack too deep.
if (relayData.outputToken.toAddress() == address(wrappedNativeToken)) {
if (outputToken == address(wrappedNativeToken)) {
// Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,
// otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the
// recipient wants wrappedNativeToken, then we can assume that wrappedNativeToken is already in the
Expand Down
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ remappings = [
]
via_ir = true
optimizer_runs = 800
solc_version = "0.8.24"
solc_version = "0.8.30"
revert_strings = "strip"
fs_permissions = [{ access = "read", path = "./"}]

solc = "0.8.24"
solc = "0.8.30"
evm_version = "prague"

[profile.zksync.zksync]
Expand Down
8 changes: 7 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ const isTest = process.env.IS_TEST === "true" || process.env.CI === "true";
// the following config is true.
const compileZk = process.env.COMPILE_ZK === "true";

const solcVersion = "0.8.24";
const solcVersion = "0.8.30";

// Hardhat 2.14.0 doesn't support prague yet, so we use paris instead (need to upgrade to v3 to use prague)
const evmVersion = isTest ? "paris" : "prague";

// Compilation settings are overridden for large contracts to allow them to compile without going over the bytecode
// limit.
Expand All @@ -65,6 +68,7 @@ const LARGE_CONTRACT_COMPILER_SETTINGS = {
settings: {
optimizer: { enabled: true, runs: 800 },
viaIR: true,
evmVersion,
debug: { revertStrings: isTest ? "debug" : "strip" },
},
};
Expand All @@ -73,6 +77,7 @@ const DEFAULT_CONTRACT_COMPILER_SETTINGS = {
settings: {
optimizer: { enabled: true, runs: 1000000 },
viaIR: true,
evmVersion,
// Only strip revert strings if not testing or in ci.
debug: { revertStrings: isTest ? "debug" : "strip" },
},
Expand All @@ -83,6 +88,7 @@ const LARGEST_CONTRACT_COMPILER_SETTINGS = {
settings: {
optimizer: { enabled: true, runs: 50 },
viaIR: true,
evmVersion,
debug: { revertStrings: isTest ? "debug" : "strip" },
},
};
Expand Down
Loading