@@ -101,11 +101,19 @@ pub fn tuxedo_verifier(_: TokenStream, body: TokenStream) -> TokenStream {
101
101
let mut redeemer_type_name = outer_type. to_string ( ) ;
102
102
redeemer_type_name. push_str ( "Redeemer" ) ;
103
103
let redeemer_type = Ident :: new ( & redeemer_type_name, outer_type. span ( ) ) ;
104
+ let type_for_new_unspendable = inner_types
105
+ . clone ( )
106
+ . next ( )
107
+ . expect ( "At least one verifier variant expected." ) ;
104
108
105
109
// TODO there must be a better way to do this, right?
106
110
let inner_types2 = inner_types. clone ( ) ;
107
111
let variants2 = variants. clone ( ) ;
108
112
let variants3 = variants. clone ( ) ;
113
+ let variant_for_new_unspendable = variants
114
+ . clone ( )
115
+ . next ( )
116
+ . expect ( "At least one verifier variant expected." ) ;
109
117
110
118
let as_variants = variants. clone ( ) . map ( |v| {
111
119
let s = format ! ( "as_{}" , v) ;
@@ -161,10 +169,13 @@ pub fn tuxedo_verifier(_: TokenStream, body: TokenStream) -> TokenStream {
161
169
}
162
170
}
163
171
164
- //TODO implement the new_unspendable function as well.
165
- // fn new_unspendable() -> Option<Self> {
166
- // todo!()
167
- // }
172
+ // The aggregation macro assumes that the first variant is able to produce a new unspendable instance.
173
+ // In the future this could be made nicer (but maybe not worth the complexity) by allowing an additional
174
+ // annotation to the one that can be used as unspendable eg `#[unspendable]`
175
+ // If this ever becomes a challenge just add an explicit `Unspendable` variant first.
176
+ fn new_unspendable( ) -> Option <Self > {
177
+ #type_for_new_unspendable:: new_unspendable( ) . map( |inner| Self :: #variant_for_new_unspendable( inner) )
178
+ }
168
179
}
169
180
} ;
170
181
output. into ( )
0 commit comments