Skip to content

SEATrax/smart-contract

Repository files navigation

Shipping Invoice Funding Platform

A blockchain-based platform that enables exporters to get short-term loans against shipping invoices, with investors funding curated pools of invoices for returns.

Overview

This platform connects exporters, investors, and admins through smart contracts to facilitate secure and transparent shipping invoice financing. The system uses NFTs to represent both individual invoices and pools of curated invoices.

Key Features

  • Invoice NFTs: Individual shipping invoices represented as ERC-721 tokens
  • Pool NFTs: Curated bundles of invoices for investment
  • 70% Funding Threshold: Exporters can withdraw when invoices reach 70% funding
  • Profit Sharing: 4% yield for investors + 1% platform fee
  • Role-based Access: Admin, Exporter, and Investor roles

Prerequisites

  • Node.js: v18.0.0 or higher
  • Git: Latest version
  • Foundry: Ethereum development toolkit

Setup

1. Install Foundry

# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup

2. Clone and Setup Repository

# Clone the repository
git clone https://github.com/SEATrax/smart-contract.git
cd smart-contract

# Initialize dependencies (IMPORTANT!)
git submodule update --init --recursive

# Alternative: use forge install
forge install

# Verify setup
forge build

3. Environment Configuration

Create a .env file in the root directory:

# Lisk Sepolia Testnet Configuration
LISK_SEPOLIA_RPC_URL=https://rpc.sepolia-api.lisk.com
LISK_SEPOLIA_CHAIN_ID=4202
LISK_SEPOLIA_EXPLORER=https://sepolia-blockscout.lisk.com

# Deployment
PRIVATE_KEY=your_private_key_here
ADMIN_ADDRESS=your_admin_address

Development Commands

Build

forge build

Test

forge test

# Run with verbose output
forge test -vvv

# Run specific test
forge test --match-test testInvoiceCreation

Format

forge fmt

Gas Analysis

forge snapshot

Local Development

# Start local blockchain
anvil

# Deploy locally (in another terminal)
forge script script/Deploy.s.sol:DeployScript --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY --broadcast

Deployment

Deploy to Lisk Sepolia Testnet:

# Basic deployment
forge script script/Deploy.s.sol:DeployScript \
  --rpc-url $LISK_SEPOLIA_RPC_URL \
  --private-key $PRIVATE_KEY \
  --broadcast

# With contract verification
forge script script/Deploy.s.sol:DeployScript \
  --rpc-url $LISK_SEPOLIA_RPC_URL \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify \
  --verifier blockscout \
  --verifier-url $LISK_SEPOLIA_EXPLORER/api

Network Details

Project Structure

├── src/                           # Smart contracts
│   ├── AccessControl.sol         # Role-based access control
│   ├── InvoiceNFT.sol           # Individual invoice NFTs
│   ├── PoolNFT.sol              # Pool of invoices NFTs
│   ├── PoolFundingManager.sol   # Investment and funding logic
│   └── PaymentOracle.sol        # Payment confirmation system
├── test/                         # Test files
├── script/                       # Deployment scripts
│   └── Deploy.s.sol
├── .github/                      # Project documentation
│   ├── implementation-checklist.md
│   └── copilot-instruction-overview-project.md
└── foundry.toml                 # Foundry configuration

Troubleshooting

Common Issues

Build fails with missing dependencies:

git submodule update --init --recursive
forge install

Test failures:

forge clean
forge build
forge test

Deployment fails:

  • Check your .env file configuration
  • Ensure you have sufficient ETH on Lisk Sepolia
  • Verify network connectivity

Contributing

  1. Follow the implementation phases in .github/implementation-checklist.md
  2. Ensure all tests pass: forge test
  3. Check code formatting: forge fmt
  4. Verify contracts build: forge build

Resources

Help

forge --help
anvil --help
cast --help

About

smart contract using Solidity and Foundry

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors