@@ -158,6 +158,43 @@ pub fn claim_ownership(ctx: Context<ClaimOwnership>) -> Result<()> {
158
158
159
159
// * Set token authority
160
160
161
+ #[ derive( Accounts ) ]
162
+ pub struct AcceptTokenAuthority < ' info > {
163
+ #[ account(
164
+ has_one = mint,
165
+ constraint = config. paused @ NTTError :: NotPaused ,
166
+ ) ]
167
+ pub config : Account < ' info , Config > ,
168
+
169
+ #[ account( mut ) ]
170
+ pub mint : InterfaceAccount < ' info , token_interface:: Mint > ,
171
+
172
+ #[ account(
173
+ seeds = [ crate :: TOKEN_AUTHORITY_SEED ] ,
174
+ bump,
175
+ ) ]
176
+ /// CHECK: The constraints enforce this is valid mint authority
177
+ pub token_authority : UncheckedAccount < ' info > ,
178
+
179
+ pub current_authority : Signer < ' info > ,
180
+
181
+ pub token_program : Interface < ' info , token_interface:: TokenInterface > ,
182
+ }
183
+
184
+ pub fn accept_token_authority ( ctx : Context < AcceptTokenAuthority > ) -> Result < ( ) > {
185
+ token_interface:: set_authority (
186
+ CpiContext :: new (
187
+ ctx. accounts . token_program . to_account_info ( ) ,
188
+ token_interface:: SetAuthority {
189
+ account_or_mint : ctx. accounts . mint . to_account_info ( ) ,
190
+ current_authority : ctx. accounts . current_authority . to_account_info ( ) ,
191
+ } ,
192
+ ) ,
193
+ AuthorityType :: MintTokens ,
194
+ Some ( ctx. accounts . token_authority . key ( ) ) ,
195
+ )
196
+ }
197
+
161
198
#[ derive( Accounts ) ]
162
199
pub struct SetTokenAuthority < ' info > {
163
200
#[ account(
@@ -170,7 +207,6 @@ pub struct SetTokenAuthority<'info> {
170
207
pub owner : Signer < ' info > ,
171
208
172
209
#[ account( mut ) ]
173
- /// CHECK: the mint address matches the config
174
210
pub mint : InterfaceAccount < ' info , token_interface:: Mint > ,
175
211
176
212
#[ account(
@@ -244,6 +280,8 @@ pub fn set_token_authority_one_step_unchecked(
244
280
)
245
281
}
246
282
283
+ // * Claim token authority
284
+
247
285
#[ derive( Accounts ) ]
248
286
pub struct RevertTokenAuthority < ' info > {
249
287
#[ account(
@@ -253,7 +291,6 @@ pub struct RevertTokenAuthority<'info> {
253
291
pub config : Account < ' info , Config > ,
254
292
255
293
#[ account( mut ) ]
256
- /// CHECK: the mint address matches the config
257
294
pub mint : InterfaceAccount < ' info , token_interface:: Mint > ,
258
295
259
296
#[ account(
@@ -264,7 +301,7 @@ pub struct RevertTokenAuthority<'info> {
264
301
pub token_authority : UncheckedAccount < ' info > ,
265
302
266
303
#[ account( mut ) ]
267
- /// CHECK: the constraint enforces that this is the correct address
304
+ /// CHECK: the `pending_token_authority` constraint enforces that this is the correct address
268
305
pub rent_payer : UncheckedAccount < ' info > ,
269
306
270
307
#[ account(
0 commit comments