Code Monkey home page Code Monkey logo

chainlink_defi's Introduction

chainlink_defi

This repo allows you to stake your FAU/LINK/DAPP or any accepted ERC20 and receive DAPP token as a reward (and can do yeild farming). It gets the Kovan price feed of the ERC with ETH to calculate value.

To get started clone this repo.

Quickstart

Set your MNEMONIC and RPC_URL

export MNEMONIC="apple, cheese, etc...."
export KOVAN_RPC_URL="https://kovan.infura.io/v3/adfdsfasdfadsfasdfadfadfadf"

You will need Truffle installed too Then run:

yarn
truffle migrate --reset --network live
yarn start

You can now stake and unstake your mDAI. Once you have some staked, you can issue tokens.

To issue tokens run

truffle exec scripts/issue-tokens.js

chainlink_defi's People

Contributors

gwmccubbin avatar patrickalphac avatar samlaf 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

chainlink_defi's Issues

Several questions

Hello sir! When calling the get-stats.js file in the terminal, it always returns 0 for price. Not sure how this really works as in the tutorial there is no example of the function returning and what it is supposed to display.

Another problem I have is when I call issue-token.js, there is no response from Kovan. It states "using network Kovan" but there is never a return output. It just sits there.

The tutorial could also be clearer on this statement: "And then the getTokenEthPrice is where we make the call to the Chainlink price feeds. You’ll have to add the mapping of the token -> Eth price feed for the token, in order to get the correct value. <- what does this mean and could you provide an example?

I realize that you don't want to hold people's hand and there are things that I need to find out on my own, but Solidity and it's related problems can be very difficult to troubleshoot.

Any help is appreciated thank you!

Error: Mnemonic invalid or undefined

I've created an account at https://infura.io/ and made a project where under keys I've selected the kovan endpoint to use in the following commands:

export MNEMONIC="apple, cheese, etc...." export RPC_URL="https://kovan.infura.io/v3/adfdsfasdfadsfasdfadfadfadf"

...replacing the RPC_URL with mine from Infura.

Now for the MNEMONIC. I've just made up a string of words for this: (prevent indoor veteran upgrade salad limit prefer sausage december write giggle battle wisdom remind giant).

I run:
truffle migrate --network live --reset

I get:
Error: Mnemonic invalid or undefined at checkBIP39Mnemonic (/Users/User1/Desktop/chainlink_defi/node_modules/@truffle/hdwallet-provider/src/index.ts:79:15) at new HDWalletProvider (/Users/User1/Desktop/chainlink_defi/node_modules/@truffle/hdwallet-provider/src/index.ts:109:23) at Object.provider (/Users/User1/Desktop/chainlink_defi/truffle-config.js:14:16) at Object.getProvider (/usr/local/lib/node_modules/truffle/build/webpack:/packages/provider/index.js:20:1) at Object.create (/usr/local/lib/node_modules/truffle/build/webpack:/packages/provider/index.js:13:1) at TruffleConfig.get [as provider] (/usr/local/lib/node_modules/truffle/build/webpack:/packages/config/dist/configDefaults.js:204:1) at Object.detect (/usr/local/lib/node_modules/truffle/build/webpack:/packages/environment/environment.js:19:1) at /usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:206:1

I am missing something obviously. Any idea?

Error when approving metamask tx quickly while trying to stake

Hi Patrick,

thanks for this awesome repo and accompanying tutorial.
I noticed a bug while trying to use your app, which I'm not 100% sure how to fix so decided to submit this issue.

When I click on STAKE!, the app first asks to approve the LINK token, and then sends the staking transaction.
If I approve the first metamask tx very very fast after the "confirm" buttons becomes available:
image

I get this error
image

Potential Solution

Even if the stack traces are useless (or at least I don't understand them), I figured the error happens in the stakeTokens function:

  stakeTokens = (amount, tokenAddress) => {
    this.setState({ loading: true })
    this.state.erc20.methods
      .approve(this.state.tokenFarm._address, amount)
      .send({ from: this.state.account })
      .on("transactionHash", (hash) => {
        this.state.tokenFarm.methods
          .stakeTokens(amount, tokenAddress)
          .send({ from: this.state.account })
          .on("transactionHash", (hash) => {
            this.setState({ loading: false })
          })
      })
  };

One potential solution is to change .on("transactionHash") to .on("receipt) but that makes for a much worse UI since we have to wait for the first tx to be written to a block. Is there any other way that this could be solved?

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.