Skip to content

Commit

Permalink
Merge pull request #516 from algorandfoundation/fix/non_abi_only
Browse files Browse the repository at this point in the history
fix: non abi routing when there is no other methods for the given OC
  • Loading branch information
joe-p authored Jul 16, 2024
2 parents c4a5294 + c05ebe2 commit 4aefae4
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 98 deletions.
18 changes: 17 additions & 1 deletion examples/non_abi/artifacts/NonABIExample.approval.teal
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int 6
*
txn OnCompletion
+
switch *call_NoOp *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *create_NoOp *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED
switch *call_NoOp *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *call_UpdateApplication *NOT_IMPLEMENTED *create_NoOp *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED *NOT_IMPLEMENTED

*NOT_IMPLEMENTED:
// The requested action is not implemented in this contract. Are you using the correct OnComplete? Did you set your app ID?
Expand Down Expand Up @@ -94,6 +94,16 @@ nonAbiAdd:
log
retsub

// nonAbiUpdate(): void
nonAbiUpdate:
proto 0 0

// examples/non_abi/non_abi.algo.ts:22
// log('Updated!')
byte 0x5570646174656421 // "Updated!"
log
retsub

*abi_route_createApplication:
int 1
return
Expand All @@ -114,4 +124,10 @@ nonAbiAdd:
// !!!! WARNING: non-ABI routing
callsub nonAbiAdd
int 1
return

*call_UpdateApplication:
// !!!! WARNING: non-ABI routing
callsub nonAbiUpdate
int 1
return
2 changes: 1 addition & 1 deletion examples/non_abi/artifacts/NonABIExample.arc32.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
},
"source": {
"approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgovLyBUaGl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wbGVtZW50IHRoZSBnaXZlbiBBQkkgbWV0aG9kIGZvciBjcmVhdGUgTm9PcAoJZXJyCgoqY2FsbF9Ob09wOgoJbWV0aG9kICJhYmlBZGQodWludDY0LHVpbnQ2NCl1aW50NjQiCgl0eG5hIEFwcGxpY2F0aW9uQXJncyAwCgltYXRjaCAqYWJpX3JvdXRlX2FiaUFkZAoKCS8vICEhISEgV0FSTklORzogbm9uLUFCSSByb3V0aW5nCgljYWxsc3ViIG5vbkFiaUFkZAoJaW50IDEKCXJldHVybgoKKmNhbGxfVXBkYXRlQXBwbGljYXRpb246CgkvLyAhISEhIFdBUk5JTkc6IG5vbi1BQkkgcm91dGluZwoJY2FsbHN1YiBub25BYmlVcGRhdGUKCWludCAxCglyZXR1cm4=",
"clear": "I3ByYWdtYSB2ZXJzaW9uIDEw"
},
"contract": {
Expand Down
Loading

0 comments on commit 4aefae4

Please sign in to comment.