HyperDapp Code Editor
  • What is Prolog?
  • Guides
    • Load ABI
    • Call ABI Method
    • Prompt
      • text
      • button
      • input
      • image
    • Custom Predicates
    • Oracle & HTTP Call
    • UI State
    • Context Variables
      • Connected Wallet Address
  • Tutorials
    • ETH <-> WETH
    • Display different views
    • Fetch data from IPFS URI
Powered by GitBook
On this page
  1. Guides

Custom Predicates

  • You can create your own predicates for reusability and better readability:

// SYNTAX
predicate_name :- predicate_body

// EXAMPLE
get_token_owner(OwnerAddress) :- 
  call_fn(hyperdapp, owner, [OwnerAddress]).

prompt :-
  get_token_owner(OwnerAddress),
  show [
    text('Welcome ', OwnerAddress)
  ].

The output value of theownermethod is stored in the OwnerAddressvariable. To expose this value outside of your predicate, we just need to add it as an input.

PreviousimageNextOracle & HTTP Call

Last updated 2 years ago