Reuse `wormhole()` and `wormhole.messageFee()` expressions.
This commit is contained in:
parent
315f0909c7
commit
01bd5540a1
|
@ -92,7 +92,9 @@ contract CoreRelayer is CoreRelayerGovernance {
|
||||||
revert FundsTooMuch();
|
revert FundsTooMuch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint256 totalFee = requestFee + wormhole().messageFee();
|
IWormhole wormhole = wormhole();
|
||||||
|
uint256 wormholeMessageFee = wormhole.messageFee();
|
||||||
|
uint256 totalFee = requestFee + wormholeMessageFee;
|
||||||
|
|
||||||
//Make sure the msg.value covers the budget they specified
|
//Make sure the msg.value covers the budget they specified
|
||||||
if (msg.value < totalFee) {
|
if (msg.value < totalFee) {
|
||||||
|
@ -100,10 +102,10 @@ contract CoreRelayer is CoreRelayerGovernance {
|
||||||
}
|
}
|
||||||
|
|
||||||
sequence =
|
sequence =
|
||||||
emitRedelivery(request, nonce, provider.getConsistencyLevel(), receiverValueTarget, maximumRefund, provider);
|
emitRedelivery(request, nonce, provider.getConsistencyLevel(), receiverValueTarget, maximumRefund, provider, wormhole, wormholeMessageFee);
|
||||||
|
|
||||||
//Send the delivery fees to the specified address of the provider.
|
//Send the delivery fees to the specified address of the provider.
|
||||||
pay(provider.getRewardAddress(), msg.value - wormhole().messageFee());
|
pay(provider.getRewardAddress(), msg.value - wormholeMessageFee);
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitRedelivery(
|
function emitRedelivery(
|
||||||
|
@ -112,7 +114,9 @@ contract CoreRelayer is CoreRelayerGovernance {
|
||||||
uint8 consistencyLevel,
|
uint8 consistencyLevel,
|
||||||
uint256 receiverValueTarget,
|
uint256 receiverValueTarget,
|
||||||
uint256 maximumRefund,
|
uint256 maximumRefund,
|
||||||
IRelayProvider provider
|
IRelayProvider provider,
|
||||||
|
IWormhole wormhole,
|
||||||
|
uint256 wormholeMessageFee
|
||||||
) internal returns (uint64 sequence) {
|
) internal returns (uint64 sequence) {
|
||||||
bytes memory instruction = convertToEncodedRedeliveryByTxHashInstruction(
|
bytes memory instruction = convertToEncodedRedeliveryByTxHashInstruction(
|
||||||
request,
|
request,
|
||||||
|
@ -122,7 +126,7 @@ contract CoreRelayer is CoreRelayerGovernance {
|
||||||
provider
|
provider
|
||||||
);
|
);
|
||||||
|
|
||||||
sequence = wormhole().publishMessage{value: wormhole().messageFee()}(nonce, instruction, consistencyLevel);
|
sequence = wormhole.publishMessage{value: wormholeMessageFee}(nonce, instruction, consistencyLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,12 +164,13 @@ contract CoreRelayer is CoreRelayerGovernance {
|
||||||
// emit delivery message
|
// emit delivery message
|
||||||
IWormhole wormhole = wormhole();
|
IWormhole wormhole = wormhole();
|
||||||
IRelayProvider provider = IRelayProvider(deliveryRequests.relayProviderAddress);
|
IRelayProvider provider = IRelayProvider(deliveryRequests.relayProviderAddress);
|
||||||
|
uint256 wormholeMessageFee = wormhole.messageFee();
|
||||||
|
|
||||||
sequence =
|
sequence =
|
||||||
wormhole.publishMessage{value: wormhole.messageFee()}(nonce, container, provider.getConsistencyLevel());
|
wormhole.publishMessage{value: wormholeMessageFee}(nonce, container, provider.getConsistencyLevel());
|
||||||
|
|
||||||
//pay fee to provider
|
//pay fee to provider
|
||||||
pay(provider.getRewardAddress(), totalCost - wormhole.messageFee());
|
pay(provider.getRewardAddress(), totalCost - wormholeMessageFee);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue