@@ -227,6 +227,62 @@ describe("test `get-delegation-info`", () => {
227
227
} ) ;
228
228
} ) ;
229
229
230
+ describe ( "test `get-allowance-contract-callers`" , ( ) => {
231
+ it ( "returns `none` when not allowed" , ( ) => {
232
+ const response = simnet . callReadOnlyFn (
233
+ POX_CONTRACT ,
234
+ "get-allowance-contract-callers" ,
235
+ [ Cl . principal ( address1 ) , Cl . contractPrincipal ( deployer , "indirect" ) ] ,
236
+ address1
237
+ ) ;
238
+ expect ( response . result ) . toBeNone ( ) ;
239
+ } ) ;
240
+
241
+ it ( "returns `(some none)` when allowed indefinitely" , ( ) => {
242
+ allowContractCaller ( `${ deployer } .indirect` , null , address1 ) ;
243
+
244
+ const delegateInfo = simnet . callReadOnlyFn (
245
+ POX_CONTRACT ,
246
+ "get-allowance-contract-callers" ,
247
+ [ Cl . principal ( address1 ) , Cl . contractPrincipal ( deployer , "indirect" ) ] ,
248
+ address1
249
+ ) ;
250
+ expect ( delegateInfo . result ) . toBeSome (
251
+ Cl . tuple ( {
252
+ "until-burn-ht" : Cl . none ( ) ,
253
+ } )
254
+ ) ;
255
+ } ) ;
256
+
257
+ it ( "returns `(some (some X))` when allowed until burn height X" , ( ) => {
258
+ const untilBurnHeight = 10 ;
259
+ allowContractCaller ( `${ deployer } .indirect` , untilBurnHeight , address1 ) ;
260
+
261
+ const delegateInfo = simnet . callReadOnlyFn (
262
+ POX_CONTRACT ,
263
+ "get-allowance-contract-callers" ,
264
+ [ Cl . principal ( address1 ) , Cl . contractPrincipal ( deployer , "indirect" ) ] ,
265
+ address1
266
+ ) ;
267
+ expect ( delegateInfo . result ) . toBeSome (
268
+ Cl . tuple ( {
269
+ "until-burn-ht" : Cl . some ( Cl . uint ( untilBurnHeight ) ) ,
270
+ } )
271
+ ) ;
272
+ } ) ;
273
+
274
+ it ( "returns `none` when a different caller is allowed" , ( ) => {
275
+ allowContractCaller ( `${ deployer } .not-indirect` , null , address1 ) ;
276
+ const response = simnet . callReadOnlyFn (
277
+ POX_CONTRACT ,
278
+ "get-allowance-contract-callers" ,
279
+ [ Cl . principal ( address1 ) , Cl . contractPrincipal ( deployer , "indirect" ) ] ,
280
+ address1
281
+ ) ;
282
+ expect ( response . result ) . toBeNone ( ) ;
283
+ } ) ;
284
+ } ) ;
285
+
230
286
describe ( "test `delegate-stack-stx`" , ( ) => {
231
287
it ( "does not delegate if principal is not delegated" , ( ) => {
232
288
const amount = getStackingMinimum ( ) * 2n ;
0 commit comments