Skip to main content

Development

Installing dependencies

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