This package contains the Solidity smart contracts for the KBC Coffee Trading Project. It leverages Hardhat for development, testing, and local blockchain simulation.
- Navigate to the blockchain directory:
cd blockchain
- Install dependencies:
npm install
- Copy and configure environment:
cp .env.template .env
- Compile contracts:
npm run compile
- Start local blockchain (in a new terminal):
npm run node
- Deploy contracts:
npm run deploy -- --network localhost
Variable | Description |
---|---|
FEE_RECIPIENT_ADDRESS |
Ethereum address for down payment fees |
DOWN_PAYMENT_BASE_FEE |
Base fee for withdrawals from DownPayment.sol |
DOWN_PAYMENT_COMMISSIONER_FEE |
Percentage fee (0-100) for withdrawals |
RPC_URL |
RPC node URL for contract deployment |
DEPLOYER_PRIVATE_KEY |
Private key of the deploying account |
TOKEN_OWNER_PRIVATE_KEY |
Private key for token recipient account |
ENTITY_MANAGER_CANISTER_ADDRESS |
Entity manager canister address |
TOKEN_ADDRESS |
Token contract address |
DOWN_PAYMENT_ADDRESS |
Down payment contract address |
SUPPLIER_ADDRESS |
Supplier address |
COMMISSIONER_ADDRESS |
Commissioner address |
COMMISSIONER_PRIVATE_KEY |
Commissioner's private key |
DEFAULT_DEPLOY_NETWORK |
Target deployment network (see hardhat.config.ts ) |
The package uses Hardhat's local network with Chai for unit testing. To run tests:
npm run test