@@ -128,12 +128,34 @@ module wormhole_transceiver::wormhole_transceiver {
128
128
broadcast_peer (chain, peer, state)
129
129
}
130
130
131
+ /*
132
+ Broadcast Peer in Solana
133
+ Transceiver Registration in EVM
134
+
135
+ NTT Accountant must know which transceivers registered each other as peers.
136
+ */
137
+ fun broadcast_peer (chain_id: u16 , peer_address: ExternalAddress , state: &mut State ): Option <MessageTicket >{
138
+
139
+ let transceiver_registration_struct = wormhole_transceiver::wormhole_transceiver_registration ::new (chain_id, peer_address);
140
+ let message_ticket = wormhole::publish_message ::prepare_message (
141
+ &mut state.emitter_cap,
142
+ 0 ,
143
+ transceiver_registration_struct.to_bytes (),
144
+ );
145
+ option::some (message_ticket)
146
+ }
147
+
131
148
/*
132
149
TransceiverInit on EVM
133
150
BroadCastId on Solana
151
+
152
+ Deployment of a new transceiver and notice to the NTT accountant.
153
+ Added as a separate function instead of in `init/complete` because
154
+ we want to keep these functions simple and dependency free. Additionally, the deployer of NTT may not want
155
+ the NTT accountant to begin with but does want it in the future.
156
+ If wanted in the future, an admin would call this function to allow the NTT accountant to work.
134
157
*/
135
158
public fun broadcast_id <CoinType , Auth >(_: &AdminCap , coin_meta: &CoinMetadata <CoinType >, state: &mut State , manager_state: &ManagerState <CoinType >): Option <MessageTicket > {
136
- // MessageTicket cannot be dropped. Means that the WH message is forced to be emitted, since only the `publish_message` call can get rid of it.
137
159
138
160
let mut manager_address_opt: Option <address > = ntt_common::contract_auth ::get_auth_address <Auth >();
139
161
let manager_address = option::extract (&mut manager_address_opt);
@@ -150,21 +172,6 @@ module wormhole_transceiver::wormhole_transceiver {
150
172
option::some (message_ticket)
151
173
}
152
174
153
- /*
154
- Broadcast Peer in Solana
155
- Transceiver Registration in EVM
156
- */
157
- fun broadcast_peer (chain_id: u16 , peer_address: ExternalAddress , state: &mut State ): Option <MessageTicket >{
158
-
159
- let transceiver_registration_struct = wormhole_transceiver::wormhole_transceiver_registration ::new (chain_id, peer_address);
160
- let message_ticket = wormhole::publish_message ::prepare_message (
161
- &mut state.emitter_cap,
162
- 0 ,
163
- transceiver_registration_struct.to_bytes (),
164
- );
165
- option::some (message_ticket)
166
- }
167
-
168
175
#[test]
169
176
public fun test_auth_type () {
170
177
assert !(ntt_common::contract_auth ::is_auth_type <wormhole_transceiver::wormhole_transceiver ::Auth >(), 0 );
0 commit comments