system-contracts

module
v1.0.0-rc.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2022 License: LGPL-3.0

README

System Contracts

This repo is used to store solidity smart contracts. Also here must be unit tests for smart contracts.

Installing

$ npm i @q-dev/contracts

Usage

pragma solidity 0.8.9;

import "@q-dev/contracts/ContractRegistry.sol";

contract Example{
    address reg = 0xc3E589056Ece16BCB88c6f9318e9a7343b663522;
    function getQUSD() public view returns (address _addr){
        _addr = ContractRegistry(reg).getAddress("defi.QUSD.coin");
    }
}

Generating go code

  1. Compile abigen if you don't have it yet:

    1.1 Pull recent q-client

    1.2. $ make all

    1.3. put abigen from build/bin/abigen of q-client to ./bin of this repo.

  2. Generate code with $ ./generate.sh

Notes:

  • check that generated code have imports like gitlab.com/q-dev/q-client, not github.com/ethereum/go-ethereum

Contribute

pre-commit hook activating
$ npx husky install
prettier

To check and fix codestyle bugs you should run prettier

$ npm run prettier
bytecode size

(python 3 installation required) You may check bytecode size of each contract via

$ npm run contract-size
NatSpec usage

(python 3 installation required) Also all public and external methods used by external users should have complete NatSpec. You may check current conformity via

$ npm run spec-check

Tests

For testing the system you should run Ganache CLI:

$ npm run private-network

Then you may run tests via

$ npm run test

Documentation

There you may find usage examples and descriptions of all methods:

https://q-dev.gitlab.io/system-contracts/

License

LGPL 3.0: https://gitlab.com/q-dev/system-contracts/-/blob/master/LICENSE

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL