GithubHelp home page GithubHelp logo

eth's Introduction

Dark Forest Smart Contracts

Development Guide

Folder setup

All of our smartcontract related code are located in the /eth directory.

  • /eth/contracts contains the smartcontract code written in solidity
  • /eth/test contains the test for the smartcontract written in Javascript

Installing Core Dependencies

  • Node (v14.x OR v16.x)
  • Yarn (Javascript Package Manager)

Installing The Correct Node Version Using NVM

Dark Forest is built and tested using Node.js v14/v16 and might not run properly on other Node.js versions. We recommend using NVM to switch between multiple Node.js version on your machine.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
nvm install

After the installation is finished, you can run node --version to verify that you are running v14 or v16

Installing Yarn & Other Dev Dependencies

Refer to Yarn's official documentation for the installation guide.

After you have Yarn installed, run yarn to install dev dependencies:

Run Locally

To run the tests run yarn test

To deploy contracts locally, you'll need to run 2 commands:

  1. Start a node by running yarn hardhat:node
  2. Then (in another terminal) deploy contracts by running yarn hardhat:dev deploy --whitelist false

You can import the private key of one of the accounts hardhat node created and funded, which are printed when you started the node such as:

Account #2: 0x3097403b64fe672467345bf159f4c9c5464bd89e (100 ETH)
Private Key: 0x67195c963ff445314e667112ab22f4a7404bad7f9746564eb409b9bb8c6aed32

subgraph

Assuming you already have your contracts deployed be it on a local node or on a mainnet, you'll have the abi/DarkForest.json file, the CONTRACT_ADDRESS address, and the block the diamond contract was initialized at (so you dont waste time syncing from the genesis block) inside the @darkforest_eth/contracts packag. In development, the start block will be set at 0.

TheGraph hosted solution

For TheGraph hosted service, you need to create an account on thegraph.com, and create a subgraph using the web interface and note the namespace yourloginname/graphname. Find the access token for this graph (it should be on the top row of the interface), and run

graph auth https://api.thegraph.com/deploy/ <ACCESS_TOKEN>

in your terminal.

Then put the contract addresses into the templates and codgen thegraph files yarn subgraph:template:prod

Finally ask them to start the indexing yarn subgraph:deploy:prod yourloginname/graphname

local development

To run a local copy of thegraph make sure docker is installed and then run yarn start --subgraph df OR if you already have your contracts deployed and running run yarn hardhat:dev subgraph:deploy --name df and find your local hosted explorer at http://localhost:8000/subgraphs/name/df

eth's People

Contributors

actions-user avatar github-actions[bot] avatar gubsheep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eth's Issues

MoveFacet goes in out of gas

Hi everyone, I am currently trying to deploy the smart contract on Ganache for local development but, when it comes to DFMoveFacet the transaction goes in out of gas. TBH, I am not using hardhat but only the web3 library ( it is for a university project and we are not allowed to use truffle and hardhat). I want to ask you guys if you handle the DFMoveFacet in some particular ways to deploy it?

Thank you in advance

Compile error

eth> node --version
v16.13.0
eth> tsc -v        
Version 4.5.2
eth> yarn --version
1.22.17

> yarn
yarn install v1.22.17
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
$ yarn run compile
yarn run v1.22.17
$ hardhat compile
An unexpected error occurred:

tasks/deploy-more.ts:119:5 - error TS2740: Type 'Contract' is missing the following properties from type 'DarkForestUtils': _calculateByteUInt, _getBiome, _getPlanetLevelTypeAndSpaceType, _getRadius, and 11 more.

119     utils: utils,
        ~~~~~

  task-types.ts:27:3
    27   utils: DarkForestUtils;
         ~~~~~
    The expected type comes from property 'utils' which is declared here on type 'LibraryContracts'
tasks/deploy-more.ts:120:5 - error TS2740: Type 'Contract' is missing the following properties from type 'DarkForestPlanet': _getDecayedPop, checkPlayerInit, getRefreshedPlanet, isDefBoost, and 4 more.

120     planet: planet,
        ~~~~~~

  task-types.ts:28:3
    28   planet: DarkForestPlanet;
         ~~~~~~
    The expected type comes from property 'planet' which is declared here on type 'LibraryContracts'
tasks/deploy-more.ts:122:5 - error TS2739: Type 'Contract' is missing the following properties from type 'Verifier': verifyBiomebaseProof, verifyInitProof, verifyMoveProof, verifyRevealProof

122     verifier: verifier,
        ~~~~~~~~

  task-types.ts:30:3
    30   verifier: Verifier;
         ~~~~~~~~
    The expected type comes from property 'verifier' which is declared here on type 'LibraryContracts'
tasks/deploy-more.ts:123:5 - error TS2741: Property 'checkFindArtifact' is missing in type 'Contract' but required in type 'DarkForestArtifactUtils'.

123     artifactUtils: artifactUtils,
        ~~~~~~~~~~~~~

  node_modules/@darkforest_eth/contracts/typechain/DarkForestArtifactUtils.d.ts:178:3
    178   checkFindArtifact(
          ~~~~~~~~~~~~~~~~~
    'checkFindArtifact' is declared here.
  task-types.ts:31:3
    31   artifactUtils: DarkForestArtifactUtils;
         ~~~~~~~~~~~~~
    The expected type comes from property 'artifactUtils' which is declared here on type 'LibraryContracts'

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

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.