Coder Social home page Coder Social logo

drips-contracts's Introduction

Radicle Drips Hub Contracts

Radicle Drips Hub is the smart contract running the drips and splits ecosystem.

Getting started

Radicle Drips Hub uses Foundry for development. You can install it using foundryup. Then, run the following command to install the dependencies:

make install

Run linter

make lint

Run prettier

make prettier

Run all tests

make test

Run specific tests

A regular expression can be used to only run specific tests.

forge test -m <REGEX>
forge test -m testName
forge test -m ':ContractName\.'

Deploy to a local testnet

Start a local testnet node and let it run in the background:

anvil

Set up environment variables. See instructions for public network deployment to see all the options. To automatically set bare minimum environment variables run:

source scripts/local-env.sh

Run deployment:

scripts/deploy.sh

Deploy to a public network

Set up environment variables controlling the deployment process:

# The RPC URL to use, e.g. `https://mainnet.infura.io/MY_INFURA_KEY`.
# Contracts will be deployed to whatever network that endpoint works in.
export ETH_RPC_URL="<URL>"

# Foundry wallet arguments. They will be passed to all commands needing signing.
# Examples:
# "--interactive" - Open an interactive prompt to enter your private key.
# "--private-key <RAW_PRIVATE_KEY>" - Use the provided private key.
# "--mnemonic-path <PATH> --mnemonic-index <INDEX>" - Use the mnemonic file
# "--keystore <PATH> --password <PASSWORD>" - Use the keystore in the given folder or file.
# "--ledger --hd-path <PATH>" - Use a Ledger hardware wallet.
# "--trezor --hd-path <PATH>" - Use a Trezor hardware wallet.
# "--from <ADDRESS>" - Use the Foundry sender account.
# For the full list check Foundry's documentation e.g. by running `cast wallet address --help`.
export WALLET_ARGS="<ARGS>"

# OPTIONAL
# The API key to use to submit contracts' code to Etherscan.
# In case of deployments to networks other than Ethereum an appropriate equivalent service is used.
# If not set, contracts won't be verified.
export ETHERSCAN_API_KEY="<KEY>"

# OPTIONAL
# The JSON file to write deployment addresses to. Default is `./deployment_<NETWORK_NAME>.json`.
export DEPLOYMENT_JSON="<PATH>"

Set up environment variables configuring the deployed contracts:

# OPTIONAL
# Address of the governance of the deployed contracts. If not set, `ETH_FROM` is used.
export GOVERNANCE="<ADDRESS>"

# OPTIONAL
# Address of Reserve to use. If not set, a new instance is deployed.
export RESERVE="<ADDRESS>"

# OPTIONAL
# Address of Reserve owner to set. If not set, `GOVERNANCE` is used.
export RESERVE_OWNER="<ADDRESS>"

# OPTIONAL
# Address of DripsHub to use. If not set, a new instance is deployed.
export DRIPS_HUB="<ADDRESS>"

# OPTIONAL
# Address of the DripsHub admin to set. If not set, `GOVERNANCE` is used.
export DRIPS_HUB_ADMIN="<ADDRESS>"

# OPTIONAL
# Address of the DripsHub logic contract to use in `DRIPS_HUB` when it's deployed.
# If not set, a new instance is deployed.
export DRIPS_HUB_LOGIC="<ADDRESS>"

# OPTIONAL
# Cycle length  to use in `DRIPS_HUB_LOGIC` when it's deployed. Default is 1 week.
export CYCLE_SECS="<SECONDS>"

# OPTIONAL
# Address of AddressApp to use. If not set, a new instance is deployed for `DRIPS_HUB`.
export ADDRESS_APP="<ADDRESS>"

Run deployment:

scripts/deploy.sh

Deploying to Polygon Mumbai

As of now gas estimation isn't working and you need to set it manually to an arbitrary high value:

export ETH_GAS=10000000

For deployment you can use the public MaticVigil RPC endpoint:

export ETH_RPC_URL='https://rpc-mumbai.maticvigil.com/'

To publish smart contracts to https://mumbai.polygonscan.com/ you need to use the API key generated for an account on regular https://polygonscan.com/.

drips-contracts's People

Contributors

codesandwich avatar cloudhead avatar xmxanuel avatar d-xo avatar mrchico 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.