GithubHelp home page GithubHelp logo

overflow's Introduction

Overflow

Tooling to help develop application on the the Flow Blockchain

Set of go scripts to make it easer to run a story consisting of creating accounts, deploying contracts, executing transactions and running scripts on the Flow Blockchain. These go scripts also make writing integration tests of your smart contracts much easier.

Information

Main features

  • Create a single go file that will start emulator, deploy contracts, create accounts and run scripts and transactions. see examples/demo/main.go
  • Fetch events, store progress in a file and send results to Discord. see examples/event/main.go
  • Support inline scripts if you do not want to store everything in a file when testing
  • Supports writing tests against transactions and scripts with some limitations on how to implement them.
  • Asserts to make it easier to use the library in writing tests see examples/transaction_test.go for examples

Gotchas

  • When specifying extra accounts that are created on emulator they are created in alphabetical order, the addresses the emulator assign is always fixed.
  • tldr; Name your stakeholder accounts in alphabetical order
  • When writing integration tests, tests must be in the same folder as flow.json with contracts and transactions/scripts in subdirectories in order for the path resolver to work correctly

Resources

  • Run the demo example in this project with cd example && make. The emulator will be run in memory.
  • Check other codebases that use this project
  • Feel free to ask questions to @bjartek in the Flow Discord.

Usage

First create a project directory, initialize the go module and install overflow:

mkdir test-overflow && cd test-overflow
flow init
go mod init example.com/test-overflow
go get github.com/bjartek/overflow/overflow

Then create a task file:

touch tasks/main.go

In that task file, you can then import overflow and use it to your convenience, for example:

package main

import (
    "fmt"

    "github.com/bjartek/overflow/overflow"
)

func main() {
    o := overflow.NewOverflow().Start()
    fmt.Printf("%v", o.State.Accounts())
}

Then you can run

go run ./tasks/main.go

This is a minimal example that only prints accounts, but from there you can branch out.

The following env vars are supported

  • OVERFLOW_ENV : set the environment to run against "emulator|embedded|testnet|mainnet" (embedded is standard)
  • OVEFFLOW_CONTINUE: if you do not want overflow to deploy contracts and accounts on emulator you can set this to true
  • OVERFLOW_LOGGING: Set this to 0-4 to get increasing log

Credits

This project is the successor of https://github.com/bjartek/go-with-the-flow

overflow's People

Contributors

bjartek avatar nvdtf 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.