Giter Site home page Giter Site logo

algob-c2c's Introduction

This is a boilerplate algob project with ASA deployment and funding a smart contract (in TEAL & PyTEAL)

To run the sample-project:

  • First you need to set the configuration in algob.config.js file:

  • Install Algo Builder

    • yarn add @algo-builder/algob or
    • yarn link @algo-builder/algob (with local installation, this is recommended if you want to use algob with latest, not released version). Read more about it here.
  • Deploy ASA and Smart Contracts:

    • algob deploy
  • Scripts ran with deploy command will store checkpoints in artifacts directory. If a script already has a checkpoint it won’t be run again unless --force | -f flag is provided to deploy command.

    • algob deploy -f
  • To interact with your deployments you can create a script and run it using:

  • algob run scripts/path_to/file1
  • Don’t use algob run for deployments. This should be used only for auxiliary scripts, like ad-hock transactions (example: draining an account).
  • Run tests:

    • algob test (runs mocha in project root)

In the sample-project folder you'll have following items:

  • assets/: Directory for assets and contracts files:

    • accounts_user.yaml : It has sample accounts
    • asa.yaml : It has sample specifications for Algorand Standard Assets (ASA)
    • fee-check.teal : It's a smart contract file. It checks the provided fee is at least 10,000 microalgos
    • escrow.py: Smart contract (in PyTEAL), only approves transfer to a specific address (hardcoded in the contract).
    • You can change or add ASA, Smart Contracts in this folder.
  • scripts/: Directory for scripts to deploy and run your assets and contracts:

    • 0-sampleScript.js : This script shows how to deploy ASA.
    • 1-sampleScript.js : This script shows how to deploy ASC.
    • 2-escrow-account.js: This script funds an escrow contract with a hardcoded template parameter (passed in script)
  • test/: Directory for test files for testing your assets and smart contracts:

    • sample-test.js : This is a basic example of how tests should be and how they work.
    • You can add tests for your scripts here.
  • algob.config.js: Algob configuration file

Before writing smart contracts in PyTEAL:

  • Please follow standard instuctions about 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 algobpy and passing template parameters in /scripts here
  • PyTEAL supports Tmpl fuction which can replace value with a constant and algob supports these replacements. To read more about TMPL Placeholder Support click here

algob-c2c's People

Contributors

vuvoth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.