Skip to content

Commit

Permalink
docs: use best practices in arc4 examples of dealing with native type…
Browse files Browse the repository at this point in the history
…s and letting the router do encode/decode, which generally saves at least one op.
  • Loading branch information
achidlow committed Apr 5, 2024
1 parent 1a29ad6 commit 7504ed5
Show file tree
Hide file tree
Showing 55 changed files with 2,704 additions and 2,900 deletions.
6 changes: 2 additions & 4 deletions examples/amm/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def set_governor(self, new_governor: Account) -> None:
self.governor = new_governor

@arc4.abimethod()
def bootstrap(
self, seed: gtxn.PaymentTransaction, a_asset: Asset, b_asset: Asset
) -> arc4.UInt64:
def bootstrap(self, seed: gtxn.PaymentTransaction, a_asset: Asset, b_asset: Asset) -> UInt64:
"""bootstraps the contract by opting into the assets and creating the pool token.
Note this method will fail if it is attempted more than once on the same contract
Expand Down Expand Up @@ -78,7 +76,7 @@ def bootstrap(

self._do_opt_in(self.asset_a)
self._do_opt_in(self.asset_b)
return arc4.UInt64(self.pool_token.id)
return self.pool_token.id

@arc4.abimethod(
default_args={
Expand Down
1,664 changes: 832 additions & 832 deletions examples/amm/out/ConstantProductAMM.approval.mir

Large diffs are not rendered by default.

Loading

0 comments on commit 7504ed5

Please sign in to comment.