@@ -52,3 +52,37 @@ def test_convex_recursion(convex, test_account):
5252 assert (result ['value' ] == test_number )
5353 with pytest .raises (ConvexAPIError , match = 'DEPTH' ):
5454 convex .query ('(call chain-0 (get))' , test_account )
55+
56+ def test_schedule_transfer (convex , test_account , other_account ):
57+ contract = """
58+ (def transfer-for-ever
59+ (deploy
60+ '(do
61+ (def call-counter 0)
62+ (defn tx-delay [to-address amount event-time]
63+ (schedule event-time (tx-now to-address amount))
64+ )
65+ (defn tx-now [to-address amount]
66+ (def call-counter (+ call-counter 1))
67+ (schedule (+ *timestamp* 1000) (tx-now to-address amount))
68+ (transfer to-address amount)
69+ )
70+ (defn counter [] call-counter)
71+ (export tx-delay tx-now counter)
72+ )
73+ )
74+ )
75+ """
76+ # (call contract-address (tx-to to-address amount))
77+
78+ auto_topup_account (convex , test_account )
79+ result = convex .send (contract , test_account )
80+ contract_address = result ['value' ]
81+ convex .transfer (contract_address , 8000000 , other_account )
82+ auto_topup_account (convex , test_account )
83+ result = convex .send (f'(call transfer-for-ever (tx-now { other_account .address } 1000))' , test_account )
84+ print (result )
85+
86+ #for index in range(0, 10):
87+ #result = convex.query('(call transfer-for-ever (counter))', test_account)
88+ #print(result)
0 commit comments