Skip to content

Latest commit

 

History

History

truffle

proofchain-contracts

Smart contracts for the proofchain system.

Installation

npm install

Usage

Available npm script

  • prettier - Reformats solidity files
  • solhint - Solidity linter
  • dev - runs truffle dev
  • test - runs truffle test
  • solc - compiles solidity with solc, used for generating proper bytecode and ABI for the proofchain library
  • migrate:rinkeby - builds and deploys to the rinkeby testnet blockchain
  • migrate:test - builds and deploys to localhost network (ganache must be running)
  • fixtures - runs ./fixtures/index.js. It create transaction containing dummy data. Only works on the test network
  • docs - Generates markdown API docs

Folder structure

├── build
│   ├── contracts
│   │   ├── ...
│   └── solc
│       ├── ...
├── contracts  - Directory for Solidity contracts. See https://www.trufflesuite.com/docs/truffle/getting-started/interacting-with-your-contracts
│   ├── Aggregator.sol - Contains the addresses for Material, Company, CertificateAuthorityManager contracts
│   ├── Certifiable.sol - Base functions for certificates assignment
│   ├── CertificateAuthorityManager.sol - Certificate management functions
│   ├── Company.sol - Company contract
│   ├── Factory.sol - Deploys Aggregator, Material, Company, CertificateAuthorityManager contracts
│   ├── MaterialBase.sol - Clntains Material events, struct definitions and utility functions
│   ├── Material.sol - Material contract
│   ├── Migrations.sol
│   ├── Shipper.sol - Manages transports
│   └── utils - Utility folder
│       ├── CertificateAuthorityManagerReferencer.sol  - Retrieves the address for CertificateAuthorityManager contract from Aggregator
│       ├── CertificateAuthorityOwnable.sol  - Retrieves the address for Material contract from Aggregator
│       ├── CompanyOwnable.sol  - Company related modifiers
│       ├── CompanyReferencer.sol  - Retrieves the address for Material contract from Aggregator
│       ├── MaterialReferencer.sol  - Retrieves the address for Material contract from Aggregator
│       └── Ownable.sol  - Ownable related modifiers and functions
├── docs
│   ├── ...
├── fixtures
│   ├── createBatches.js
│   ├── createCertificates.js
│   ├── createCompanies.js
│   ├── createMaterials.js
│   ├── createRawMaterials.js
│   ├── createTransports.js
│   ├── index.js
│   ├── utils
│   │   └── amountIdentifiers.js
│   └── web3.js
├── migrations  - Directory for scriptable deployment files. See https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations#migration-files
│   ├── 1_initial_migration.js
│   └── 2_deploy_contracts.js
├── package.json
├── package-lock.json
├── README.md
├── sanitize-solc-build.js  - utility script for renaming files generated by solc. Useful for importing inside the ES6 environment
├── test  - Directory for test files. See https://www.trufflesuite.com/docs/truffle/testing/testing-your-contracts
│   ├── aggregator.test.js
│   ├── certificate.test.js
│   ├── company
│   │   ├── company.test.js
│   │   └── shipper.test.js
│   ├── factory.test.js
│   ├── material
│   │   ├── batch.test.js
│   │   ├── certificate.test.js
│   │   ├── create.test.js
│   │   └── material.test.js
│   └── utils.js
└── truffle-config.js  - Truffle configuration file. See https://www.trufflesuite.com/docs/truffle/reference/configuration

Factory contract address

After running the migrate:test or migrate:rinkeby commands, the .env file in the root directory is updated with the newly deployed factory contract address (either DEVELOPMENT_FACTORY_CONTRACT_ADDRESS or PRODUCTION_FACTORY_CONTRACT_ADDRESS)

API DOCS

For a detailed visualization of the API docs please see the ./docs/ directory

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT