Skip to content

Latest commit

 

History

History
75 lines (49 loc) · 4.17 KB

README.md

File metadata and controls

75 lines (49 loc) · 4.17 KB

Repository of verified smart contract templates

Algo Builder team maintains this repository of of verified smart contract templates which will speedup your dapp design and development process.

Templates

  • [JS] asa: a project that demonstrates how to create and manage Algorand Standard Assets (ASA).

  • [JS] bond: fixed interest rate token, modelled based on corporate bonds.

  • [JS] crowdfunding: crowdfunding smart contract based on tutorial.

  • [JS] DAO: template to create, manage and participate in a DAO.

  • [JS] multisig: demonstration of creating a logic signature (lsig) signed by multiple accounts.

  • [JS] nft: Non-Fungible-Token using stateful TEAL.

  • [JS] permissioned voting: a Permissioned Voting smart contract. tutorial.

  • [JS] permissioned token - approach with unfreezing: a Permissioned Token template based on a freeze and unfreeze logic to transfer assets.

  • [JS] permissioned token: main template for creating Permissioned Tokens.

  • [JS] ref-templates: best practices and templates using the Algorand reference smart contracts.

  • [JS] signed-txn: demonstrates loading a serialized transaction from a file. A user can create a transaction and sign it (using goal) and send it to someone else to execute it in algob.

  • [JS] unique-nft example of an ASA generation process based on a guaranteed unique parameter.

  • [TS] htlc: a Hash-Time-Lock-Contract Example using PyTeal. In this project we transpile TypeScript files to JavaScript using algob.

Interesting Test Suites

  • [Runtime Test] atomic transfer: tests demonstrating how to do atomic transfers.
  • [Runtime Test] loop: demonstrates how to use loop.
  • [Runtime Test] fibonacci: demonstrates fibonacci implementation in teal using sub-routines.
  • [Runtime Test] shared space: demonstrates shared space between transactions in a group.

Setup

In this section we describe a common instructions for all examples.

Create your local network:

https://developer.algorand.org/tutorials/create-private-network/

Start whole network:

goal network start -r ~/.algorand-local/

Start/stop a single node:

goal node start -d ~/.algorand-local/Node/

Install dependencies

All dependencies are managed by npm / yarn. To install:

yarn install

If want to use a development version of algob, you can use yarn link:

yarn remove @algo-builder/algob
yarn link @algo-builder/algob

After that, algob will be in your local yarn context. To use it we either access algob through yarn run (recommended), or through node_modules/.bin.

The examples are already initialized. So we don't need to run yarn run algob init .

PyTEAL

  • Many examples are using PyTEAL. Please follow our PyTEAL setup.
  • For passing template parameters dynamically in PyTEAL contract you will need to add algobpy in your project directory. Read more about usage of algoby and passing template parameters in /scripts here

Update config

We created one config file for all examples in this repository. To use customize it: copy the /examples/algob.confg-template.js to /examples/algob.config-local.js and update the following positions in the latter file:

  • master-account: must be an account with some ALGOs - it will be used for deployment and for activating / funding other accounts.