Skip to content

Security & Audit

All AsiliChain contracts follow OpenZeppelin’s battle-tested patterns:

PatternContracts using itPurpose
UUPS UpgradeableAll contractsAllow bug fixes without redeployment
AccessControlAll contractsRole-based permission gating
ReentrancyGuardLendingVaultPrevent reentrancy on USDC transfers
PausableLendingVault, BatchTokenEmergency circuit breaker
ERC-1155BatchTokenSemi-fungible batch tokens
ERC-4626LendingVaultStandard vault interface for MFI deposits
RoleGranted toCan doCannot do
DEFAULT_ADMIN_ROLE3-of-5 multisigGrant/revoke roles, upgrade contractsSingle-signer actions
VAULT_ROLELendingVault address onlyLock/unlock collateral, burn settled tokens, record repaymentRegister farmers, update stages
COOP_ROLECooperative walletUpdate stages (GRADED→EXPORTED), deactivate farmersOriginate loans, collect fees
AGENT_ROLEField agent walletsRegister farmers, mint BatchTokensUpdate later stages, originate loans
BUYER_ROLEBuyer portal hot walletCreate PurchaseOrdersConfirm POs (coop required), originate loans
MULTISIG_ROLE3-of-5 multisigDistribute protocol fees, approve forbearanceAny single-party action

Target auditors (in priority order):

  1. OpenZeppelin Security (https://www.openzeppelin.com/security-audits)
  2. Trail of Bits (https://www.trailofbits.com)
  3. Certik (https://www.certik.com)

Audit scope:

  • All 7 contracts (FarmerRegistry, BatchToken, TraceLog, CreditScore, PurchaseOrder, ProtocolFee, LendingVault)
  • Focus: LendingVault USDC handling, collateral locking invariants, upgrade authority

Timeline: Commission audit at Week 10 of Phase 1 (after Sepolia testing complete). Receive report by Week 16. Deploy mainnet Week 18.

Budget estimate: $15,000–$40,000 depending on auditor and scope complexity.

These invariants must hold at all times. The test suite and auditors should verify these:

1. A BatchToken cannot be used as collateral for two simultaneous loans
2. batchToken.hasActiveLoan(id) == true iff and only iff LendingVault has active loan for id
3. TraceStage can only increase (DELIVERED=0 → SETTLED=6), never decrease
4. Only VAULT_ROLE can call BatchToken.burnSettled() or CreditScore.recordRepayment()
5. LendingVault cannot originate a loan if Chainlink price feed is stale (> 1 hour)
6. ProtocolFee distributions require 3-of-5 multisig — no single-signer withdrawal possible
7. Upgrade authority (UUPS) requires DEFAULT_ADMIN_ROLE (3-of-5 multisig)
// If a critical vulnerability is discovered — immediately pause:
lendingVault.pause(); // Stops loan origination and repayment
batchToken.pause(); // Stops minting and transfers
// Existing positions are frozen in place — no liquidation during pause

All multisig actions use Gnosis Safe on Mantle:

  • Protocol fee distributions
  • Contract upgrades
  • Forbearance approvals
  • Emergency pause/unpause

Safe address: To be created at deployment. 3-of-5 signers defined above in ProtocolFee.sol documentation.

A bug bounty programme will be announced before Phase 2 mainnet (MFI capital entry). Scope: all deployed contracts on Mantle mainnet.

Severity → Payout:

  • Critical (funds at risk): Up to $10,000 USDC
  • High (access control bypass): Up to $3,000 USDC
  • Medium (logic errors): Up to $500 USDC
  • Low (informational): Recognition only