Smart Contracts
Dualis Finance settles all lending, collateral, liquidation, and governance operations on the Canton Network using DAML smart contracts. The contract suite comprises 25 modules exposing 38 templates, built with DAML SDK 3.4.11 targeting Ledger Fragment (LF) version 2.1.
Architecture
The DAML contracts are organized into functional categories. Each module defines one or more templates with explicit signatory and observer relationships, enforcing Canton's privacy model at the ledger level. Contract keys have been removed as LF 2.x does not support the key/maintainer syntax — all contract references use contract IDs.
Module Categories
| Category | Modules | Description |
|---|---|---|
| Core | Dualis.Types, Dualis.Utils | Shared type definitions (CreditTier, InterestRateModel, TierLendingParams) and math utilities (Taylor series exp/ln) |
| Lending | Dualis.LendingPool, Dualis.Supply, Dualis.Borrow, Dualis.Repay | Pool creation, supply/withdraw, borrow/repay lifecycle, interest accrual |
| Liquidation | Dualis.Liquidation, Dualis.LiquidationAuction | Health factor monitoring, liquidation triggers, Dutch auction mechanism |
| Credit | Dualis.Credit, Dualis.CreditOracle | Credit tier assignment (Diamond/Gold/Silver/Bronze/Unrated), rate discounts, LTV caps |
| Oracle | Dualis.Oracle, Dualis.PriceFeed | Price feed submissions, staleness checks, multi-source aggregation |
| Token / Governance | Dualis.Token, Dualis.Governance, Dualis.Staking, Dualis.Voting | Protocol token, governance proposals, staking rewards, vote delegation |
| Securities Lending | Dualis.SecLending, Dualis.SecLendingMatch | Offer creation, matching engine, settlement, recall mechanism |
| Institutional | Dualis.Institutional, Dualis.SubAccount, Dualis.Compliance | Institutional onboarding, sub-account management, KYC/AML integration |
| Productive | Dualis.Productive, Dualis.Vault, Dualis.Strategy | Yield vaults, auto-compounding strategies, fee distribution |
| Privacy | Dualis.Privacy, Dualis.PrivacyPolicy | Transaction privacy controls, observer management, disclosure policies |
| Triggers | Dualis.Triggers, Dualis.AutoLiquidation, Dualis.InterestAccrual | Automated DAML triggers for liquidation execution and interest index updates |
Template List
The 38 templates across all modules:
| # | Template | Module | Key Choices |
|---|---|---|---|
| 1 | LendingPool | LendingPool | Supply, Withdraw, UpdateRates |
| 2 | SupplyPosition | Supply | AccrueInterest, Redeem |
| 3 | BorrowPosition | Borrow | AccrueInterest, Repay, AddCollateral |
| 4 | BorrowRequest | Borrow | Approve, Reject |
| 5 | RepaymentReceipt | Repay | Archive |
| 6 | CollateralLock | Borrow | Release, Liquidate |
| 7 | LiquidationTrigger | Liquidation | Execute, Cancel |
| 8 | LiquidationAuction | LiquidationAuction | Bid, Settle, Expire |
| 9 | CreditAssignment | Credit | Upgrade, Downgrade, Revoke |
| 10 | CreditOracleEntry | CreditOracle | UpdateScore, Expire |
| 11 | PriceFeed | PriceFeed | SubmitPrice, Invalidate |
| 12 | OracleConfig | Oracle | AddSource, RemoveSource, UpdateStaleness |
| 13 | ProtocolToken | Token | Transfer, Mint, Burn |
| 14 | TokenAllowance | Token | Spend, Revoke |
| 15 | GovernanceProposal | Governance | Vote, Execute, Cancel |
| 16 | ProposalResult | Governance | Finalize |
| 17 | StakePosition | Staking | Unstake, ClaimRewards |
| 18 | StakeReward | Staking | Distribute, Compound |
| 19 | VoteDelegation | Voting | Delegate, Revoke |
| 20 | VoteRecord | Voting | Archive |
| 21 | SecLendingOffer | SecLending | Match, Cancel, Expire |
| 22 | SecLendingContract | SecLendingMatch | Return, Recall, Default |
| 23 | InstitutionalAccount | Institutional | CreateSubAccount, UpdateLimits |
| 24 | SubAccount | SubAccount | Execute, Freeze, Close |
| 25 | ComplianceRecord | Compliance | Verify, Reject, Expire |
| 26 | KycStatus | Compliance | Approve, Revoke |
| 27 | YieldVault | Vault | Deposit, Withdraw, Rebalance |
| 28 | VaultShare | Vault | Redeem, Transfer |
| 29 | Strategy | Strategy | Execute, Pause, UpdateParams |
| 30 | StrategyResult | Strategy | Distribute, Reinvest |
| 31 | ProductivePosition | Productive | Harvest, Compound, Exit |
| 32 | FeeDistribution | Productive | Claim, Reinvest |
| 33 | PrivacyPolicy | PrivacyPolicy | AddObserver, RemoveObserver |
| 34 | PrivacyConfig | Privacy | UpdateDefaults, GrantException |
| 35 | FlashLoan | LendingPool | Execute, Repay |
| 36 | InterestIndex | InterestAccrual | Accrue, Snapshot |
| 37 | LiquidationBot | AutoLiquidation | Scan, Execute, Report |
| 38 | TriggerConfig | Triggers | Enable, Disable, UpdateFrequency |
Building
The DAML source lives in packages/canton/daml/. Build and test with the DAML SDK (version 3.4.11):
cd packages/canton/daml
~/.daml/bin/daml buildThe build produces a DAR (DAML Archive) file:
.daml/dist/dualis-finance-2.0.0.darTesting
The contract suite includes 8 test files covering all template lifecycle scenarios. Run the full test suite:
cd packages/canton/daml
~/.daml/bin/daml testexp or ln functions. The Dualis.Utils module implements these using Taylor series approximations, validated against the TypeScript math engine in the shared package to ensure cross-platform consistency.Deployment
Upload the compiled DAR to a Canton participant using the deployment script:
./deploy/scripts/upload-dar.sh \
--dar .daml/dist/dualis-finance-2.0.0.dar \
--participant-url http://172.18.0.7:5001On the current devnet, the DAR has been uploaded with 134 packages registered on the participant node (13 from dualis-finance, the rest are DAML standard library dependencies).