Contracts & Integration

All contracts are deployed on Polkadot Asset Hub Testnet (Chain ID 420420417). EVM contracts are compatible with standard ethers.js and viem tooling. The ink! Wasm and PVM contracts are invoked internally by the backend service layer.

Network: Polkadot Asset Hub Testnet · RPC: https://eth-rpc-testnet.polkadot.io/ · Explorer: blockscout-testnet.polkadot.io

EVM Contracts

ContractAddressDescription
KredioLending0x61c6b46f5094f2867Dce66497391d0fd41796CEamUSDC lending pool with credit-scored borrowing and yield routing
KredioPASMarket0x5617dBa1b13155fD6fD62f82ef6D9e8F0F3B0E86Native PAS collateral market; oracle-priced LTV and liquidation
KredioSwap0xaF1d183F4550500Beb517A3249780290A88E6e39Oracle-priced PAS → mUSDC swap with slippage guard
KredioXCMSettler0xE0C102eCe5F6940D5CAF77B6980456F188974e52XCM intent settlement engine; decodes and executes parachain Transact payloads
KredioAccountRegistry0xe3603f70ACeBe6A7f3975cf3Edbd12EfeA78aDeASR25519 Substrate key ↔ EVM address binding with on-chain verification
GovernanceCache0xe4DE7eadE2c0A65BdA6863Ad7bA22416c77F3e55On-chain OpenGov vote count and conviction cache (Phase 4 credit input)
PASOracle0x1494432a8Af6fa8c03C0d7DD7720E298D85C55c7Chainlink AggregatorV3-compatible PAS/USD price feed
mUSDC0x5998cE005b4f3923c988Ae31940fAa1DEAC0c646Protocol stablecoin; 6 decimals; public testnet faucet via mint()
YieldPool0x12CEF08cb9D58357A170ee2fA70b3cE2c0419bd6External yield destination for idle lending capital
KredioBridgeMinterconfigured via MINTER_ADDR envHub-side ETH → mUSDC bridge minter; replay-protected by source tx hash
EthBridgeInbox (Sepolia)configured via INBOX_ADDR envSource-chain ETH deposit contract; emits EthDeposited trigger event

ink! Contracts

KreditAgent

ink! Wasm

0x8c13E6fFDf27bB51304Efff108C9B646d148E5F3

Deterministic credit scorer; invoked atomically via SCALE staticcall from EVM markets

NeuralScorer

ink! PVM

0xac6bd3ff3447d8d1689dd4f02899ff558f108e0d

Neural cross-validation; emits ScoreInferred with confidence delta

RiskAssessor

ink! PVM

0xdB9E48932E061D95E22370235ac3a35332d289f7

Forward-looking liquidation risk; emits RiskAssessed with blocks-to-liq

YieldMind

ink! PVM

0x0b68fbfb596846e4f3a23da10365e0888a182ef3

Optimal capital allocation across yield buckets; emits AllocationComputed

Build from Source

Prerequisites

  • Foundry (forge, cast) - curl -L https://foundry.paradigm.xyz | bash && foundryup
  • Rust + cargo-contract - rustup target add wasm32-unknown-unknown && cargo install cargo-contract
  • Node.js ≥ 18 (for deployment scripts)

EVM Contracts

cd contracts
forge install       # install lib/ dependencies
forge build         # compile all Solidity contracts
forge test          # run full test suite
forge test -vvv     # with traces and logs

KreditAgent (ink! Wasm)

cd contracts/kredit_agent
cargo contract build --release
# Output: target/ink/kredit_agent.contract

PVM ink! Contracts

cargo contract build --release   --manifest-path contracts/pvm/neural_scorer/Cargo.toml

cargo contract build --release   --manifest-path contracts/pvm/risk_assessor/Cargo.toml

cargo contract build --release   --manifest-path contracts/pvm/yield_mind/Cargo.toml

Deploy

Create contracts/.env:

ADMIN=<private_key_hex>   # no 0x prefix
PASET_RPC=https://eth-rpc-testnet.polkadot.io/
SEPOLIA_RPC=https://rpc.sepolia.org
# Core protocol (Asset Hub)
cd contracts && source .env
forge script script/Deploy.s.sol   --rpc-url $PASET_RPC --broadcast --private-key $ADMIN -vvv

# Bridge contracts
forge script script/DeployBridge.s.sol:DeployInbox   --rpc-url $SEPOLIA_RPC --chain-id 11155111   --private-key $ADMIN --broadcast

forge script script/DeployBridge.s.sol:DeployMinter   --rpc-url $PASET_RPC --chain-id 420420417   --private-key $ADMIN --broadcast

After deployment, update contract addresses in backend/.env and frontend/config/contracts.ts.

Frontend Integration

All contract ABIs are available in frontend/lib/constants.ts and addresses are centralised in frontend/config/contracts.ts, keyed by Chain ID. The useProtocolData and useProtocolActions hooks cover the full set of read and write operations for all user-facing contracts.

// Read all protocol state in a single batched RPC call
const {
  creditScore, creditTier, collateralRatio, interestRate,
  healthRatio, lendingPosition, borrowPosition,
  pasPrice, protocolTotals,
} = useProtocolData()

// Execute any protocol action
const { deposit, borrow, repay, liquidate, swap } = useProtocolActions()