Skip to content

Commit

Permalink
Tests and checks for check-transfer, fixes #475
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Dec 15, 2023
1 parent fb678e2 commit a174979
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion convex-core/src/main/cvx/convex/asset.cvx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@
{:code "(check-transfer sender receiver [non-fungible-token-address #{1 4 6}])"}]
:signature [{:params [sender receiver [asset-address quantity]]}]}}
[sender receiver [path quantity]]
(or (callable? path 'check-transfer) (return nil))
(query (call path
(check-transfer sender
(check-transfer sender
receiver
quantity))))

Expand Down
2 changes: 2 additions & 0 deletions convex-core/src/test/java/convex/lib/AssetTester.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import static convex.test.Assertions.*;
Expand Down Expand Up @@ -46,6 +47,7 @@ public static void doFungibleTests (Context ctx, ACell token, Address user) {
Long BAL=evalL(ctx,"(asset/balance token *address*)");
assertEquals(0L, evalL(ctx,"(asset/balance token actor)"));
assertTrue(BAL>0,"Should provide a user account with positive balance!");
assertNull(eval(ctx,"(asset/check-transfer *address* *address* [token "+BAL+"])"));

// New Address gets zero offers
{
Expand Down

0 comments on commit a174979

Please sign in to comment.