GithubHelp home page GithubHelp logo

isabella232 / dex-liquidity-provision Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gnosis/dex-liquidity-provision

0.0 0.0 0.0 1.56 MB

License: GNU Lesser General Public License v3.0

JavaScript 98.47% Dockerfile 0.07% Solidity 1.47%

dex-liquidity-provision's Introduction

Gnosis Liquidity Provision

Disclaimer: This repository has been archived and is no longer supported

We want to employ different liquidity strategies when the Gnosis Protocol is launched. This repo is responsible for testing and execution.

The code is this repository is work in progress: it will be subject to significant changes and has known rough edges that break some functionalities. Do not use unless you fully understand the code!

How to use

Install needed dependencies:

yarn install

Note that the installation might be successful even if errors are shown in the console output. In case of doubt, running echo $? immediately after yarn install should return 0 if the installation was successful.

Build Truffle artifacts:

yarn build

This concludes the setup procedures. Any liquidity provision script can be run at this point. See scripts/README.md for details.

How to test

Start and keep the test Ethereum network running in the background:

yarn testnet

Run tests:

yarn test

Use scripts as described in scripts/README.md`.

Synthetix Liquidity Provision

This service requires a service that runs a script every 5 minutes. We have configured this to run inside a Docker container that can be interacted with as follows:

docker build -t gnosispm/dex-liquidity-provision .
docker run -e PK=$YOUR_PRIVATE_KEY -t gnosispm/dex-liquidity-provision:latest "truffle exec scripts/synthetix/facilitate_trade.js --network rinkeby"

Safe Token Distribution (Airdrop)

Create your own transferFile, or use our sample examples/sampleTransferFile.json. With a fundAccount (aka Gnosis Safe) containg sufficient funds that you own execute:

 export PK=<your private key>
export INFURA_KEY=<your infura key>
export FUND_ACCOUNT=<your gnosis safe>
export TRANSFER_FILE=<path to your transfer file>

Alternatively, there is a sample .sample_env file that is not tracked by the project where you can paste these values, rename to .env (i.e. mv .sample_env .env) source via source .sample_env

With all configuration in place, we are ready to run the script.

npx truffle exec scripts/airdrop.js --fundAccount=$FUND_ACCOUNT --transferFile=$TRANSFER_FILE --network=$NETWORK_NAME

Then, you will be provided with logs containing all the transfer details followed by a prompt asking "Are you sure you want to send this transaction to the EVM?"

Transfer File Standard

The airdrop script accepts both .json and .csv file extensions with the following format

[
  {
    "amount": "0.001",
    "tokenAddress": "0x4dbcdf9b62e891a7cec5a2568c3f4faf9e8abe2b",
    "receiver": "0x100000000000000000000000000000000000000"
  },
  {
    "amount": "0.002",
    "tokenAddress": "0x4dbcdf9b62e891a7cec5a2568c3f4faf9e8abe2b",
    "receiver": "0x2000000000000000000000000000000000000000"
  }
]
receiver,amount,token_address
0x90d26c3805030a05c7fdd89326a4a2a99cbade31,3.14159,0x6810e776880C02933D47DB1b9fc05908e5386b96
0x399c7819840329e2b73449d6afcf7f4fd71399b2,2.5,0x6810e776880C02933D47DB1b9fc05908e5386b96
0x274df99cf90c55f18f079f482750d03209b02f92,2,0x6810e776880C02933D47DB1b9fc05908e5386b96

Note that additional columns may beincluded in the CSV or JSON, but the above shown must be available.

Selecting yes yields a link to the Gnosis Safe interface where the transaction can be signed and executed.

To do a "verification" run simply add the argument --verify and observe the difference in the last two lines of the logs emitted.

Note that, the gas costs for such transactions can vary based on the tokens you are transfering (since each token could potentially implement their transfer's differently).

dex-liquidity-provision's People

Contributors

dependabot-preview[bot] avatar fedgiac avatar bh2smith avatar josojo avatar fleupold avatar c3rnst avatar dependabot[bot] avatar psybull 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.