Git Product home page Git Product logo

contracts-starter's Introduction

Dark Forest Plugin Starter Repo

This repository is a quick starter for Dark Forest plugin developers who want to deploy contracts that interact with the core Dark Forest contracts. This repository allows you to quickly get up and running with the ability to:

  • Compile a Solidity contract with references to the core Dark Forest contracts
  • Synchronise the source code of the Dark Forest core contracts from the official contract repository
  • Deploy your Solidity contract to the XDai net, and initialise the contract with the address of the core contract

How to use this repo

Do once:

  • yarn install
  • cp .env.example .env and change the env file to include the mnemonic of your XDai account from which you want to deploy your contract
  • yarn sync-core-contracts will download the latest version of the core contracts to the local directory and move them to the right place

To check that your contract compiles correctly:

  • yarn compile

To deploy your contract to the XDai chain (make sure to have ran the Do once steps)

  • yarn deploy
  • Copy the contract address somewhere

To use your contract in the Dark Forest client with a plugin

  • Upload the ./ContractABI.json file generated when deploying the contract to GithubGist/CDN/S3/Whatever
  • Use df.loadContract(ContractAddres, ABIUrl) in your plugin to get an interface to your contract

Example usage

An example achievement contract can be found in ./contracts/Contract.sol. It is an ERC721 implementation of a simple achievement system. This contrat calls the Dark Forest core contract to verify the claim of the users requesting an achievement. An example plugin interacting with this contract can be found in ./example/plugin.js

contracts-starter's People

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.