Skip to content

Latest commit

 

History

History
60 lines (51 loc) · 3.44 KB

File metadata and controls

60 lines (51 loc) · 3.44 KB

🔗 Blockchain Package

This package contains the Solidity smart contracts for the KBC Coffee Trading Project. It leverages Hardhat for development, testing, and local blockchain simulation.


⚙️ Getting Started

  1. Navigate to the blockchain directory:
    cd blockchain
  2. Install dependencies:
    npm install
  3. Copy and configure environment:
    cp .env.template .env
  4. Compile contracts:
    npm run compile
  5. Start local blockchain (in a new terminal):
    npm run node
  6. Deploy contracts:
    npm run deploy -- --network localhost

📝 Environment Variables

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)

🧪 Testing

The package uses Hardhat's local network with Chai for unit testing. To run tests:

  npm run test