Skip to content

Commit 348570f

Browse files
authored
evm: Add transceiver type getter to Transceiver base contract (#456)
1 parent 9a84561 commit 348570f

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

evm/src/Transceiver/Transceiver.sol

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ abstract contract Transceiver is
9090
return nttManagerToken;
9191
}
9292

93+
function getTransceiverType() external view virtual returns (string memory);
94+
9395
/// =============== TRANSCEIVING LOGIC ===============================================
9496

9597
/// @inheritdoc ITransceiver

evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ contract WormholeTransceiver is
3333
{
3434
using BytesParsing for bytes;
3535

36-
string public constant WORMHOLE_TRANSCEIVER_VERSION = "1.0.0";
36+
string public constant WORMHOLE_TRANSCEIVER_VERSION = "1.1.0";
3737

3838
constructor(
3939
address nttManager,
@@ -55,6 +55,10 @@ contract WormholeTransceiver is
5555

5656
// ==================== External Interface ===============================================
5757

58+
function getTransceiverType() external pure override returns (string memory) {
59+
return "wormhole";
60+
}
61+
5862
/// @inheritdoc IWormholeTransceiver
5963
function receiveMessage(bytes memory encodedMessage) external {
6064
uint16 sourceChainId;

evm/src/interfaces/ITransceiver.sol

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ interface ITransceiver {
3737
bytes32 recipientNttManagerAddress, bytes32 expectedRecipientNttManagerAddress
3838
);
3939

40+
/// @notice Returns the string type of the transceiver. E.g. "wormhole", "axelar", etc.
41+
function getTransceiverType() external view returns (string memory);
42+
4043
/// @notice Fetch the delivery price for a given recipient chain transfer.
4144
/// @param recipientChain The Wormhole chain ID of the target chain.
4245
/// @param instruction An additional Instruction provided by the Transceiver to be

evm/test/mocks/DummyTransceiver.sol

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ contract DummyTransceiver is Transceiver, ITransceiverReceiver {
1212

1313
constructor(address nttManager) Transceiver(nttManager) {}
1414

15+
function getTransceiverType() external pure override returns (string memory) {
16+
return "dummy";
17+
}
18+
1519
function _quoteDeliveryPrice(
1620
uint16, /* recipientChain */
1721
TransceiverStructs.TransceiverInstruction memory /* transceiverInstruction */

0 commit comments

Comments
 (0)