Giter Club home page Giter Club logo

generic-fee-collector-contract's Introduction

Fee collector smart contract

A smart contract for registering vaults for payments.

A detailed documentation of the contract can be found in the docs folder.

Setup

To run the project you need Node.js development environment (version 12 or newer).

Pull the repository from GitHub, then install its dependencies by executing this command:

npm install

Certain actions, like deploying to a public network or verifying source code on block explorers, need environment variables in a file named .env. See .env.example for more info.

Some additional steps before deployment

Open scripts/deploy-feecollector.ts. Notice the top constants:

const guildTreasury = "0x..."; // The address that will receive Guild's share from the funds.
const totalFeeBps = 0; // The percentage of Guild's and any partner's share expressed in basis points (e.g 500 for a 5% cut).

Edit them according to your needs.

Contract deployment

To deploy the smart contracts to a network, replace [networkName] with the name of the network and [scriptName] with the name of the script you wish to run in this command:

npx hardhat run scripts/[scriptName] --network [networkName]

Networks can be configured in hardhat.config.ts. We've preconfigured the following:

  • hardhat (for local testing, default)
  • ethereum (Ethereum Mainnet)
  • goerli (Görli Ethereum Testnet)
  • sepolia (Sepolia Ethereum Testnet)
  • bsc (BNB Smart Chain)
  • bsctest (BNB Smart Chain Testnet)
  • polygon (Polygon Mainnet (formerly Matic))
  • mumbai (Matic Mumbai Testnet)
  • gnosis (Gnosis Chain (formerly xDai Chain))
  • arbitrum (Arbitrum One (Mainnet))
  • base (Base Mainnet)
  • optimism (Optimism Mainnet)
  • cronos (Cronos Mainnet)
  • mantle (Mantle Network Mainnet)
  • ontology (Ontology EVM Mainnet)
  • linea (Linea Mainnet)
  • cyber (Cyber Mainnet)

Verification

For source code verification on block explorers, you can use the Etherscan plugin:

npx hardhat verify [contractAddress] [constructorArguments] --network [networkName]

Note: the contract's address and the constructor arguments are printed by the deploy script, so they can easily be copied to this command.

For more detailed instructions, check out the plugin's documentation here.

Linting

The project uses Solhint for Solidity smart contracts and ESLint for TypeScript files. To lint all files, simply execute:

npm run lint

To lint only the Solidity files:

npm run lint-contracts

To lint only the TypeScript files:

npm run lint-ts

Tests

To run the unit tests written for this project, execute this command in a terminal:

npm test

To run the unit tests only in a specific file, just append the path to the command. For example, to run tests just for FeeCollector:

npm test test/FeeCollector.spec.ts

Documentation

The documentation for the contracts is generated via the solidity-docgen package. Run the tool via the following command:

npm run docgen

The output can be found in the docs folder.

generic-fee-collector-contract's People

Contributors

tomiohl 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.