Skip to content

Commit

Permalink
fix(writeContract): Incorrect code is generated for recv_external
Browse files Browse the repository at this point in the history
The external recevier generated the following code:

```
;; Handle operation
int handled = ...;
;; Throw if not handled
throw_unless(handled, ${contractErrors.invalidMessage.id});
```

Which uses the incorrect order of argument in `throw_unless`.
  • Loading branch information
byakuren-hijiri committed Jul 22, 2024
1 parent b119b7b commit 8983b02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/generator/writers/writeContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export function writeMainContract(
// Throw if not handled
ctx.append(`;; Throw if not handled`);
ctx.append(
`throw_unless(handled, ${contractErrors.invalidMessage.id});`,
`throw_unless(${contractErrors.invalidMessage.id}, handled);`,
);
ctx.append();

Expand Down

0 comments on commit 8983b02

Please sign in to comment.