This repo contains the CashScript smart contracts for ParyonUSD. It also contains the contract documentation and schematics.
contracts- folder containing the CashScript.cashcontract filescontract_docs- documentation for the ParyonUSD smart contract systemcontract_schematics- schematics of the ParyonUSD smart contract systemaudit- smart contract audit reportsartifacts- generated folder with the compiled artifacts output
The compiled contract artifacts are published to npm as @paryonusd/contracts:
npm install @paryonusd/contractsThe package exports a paryonArtifacts object grouping every compiled CashScript artifact, ready to use with the CashScript SDK:
import { paryonArtifacts } from '@paryonusd/contracts';The ParyonUSD contract system consists of a total of 26 contracts:
contracts/ ├── loan/ │ ├── loanContractFunctions/ │ │ ├── changeInterest.cash │ │ ├── liquidate.cash │ │ ├── manage.cash │ │ ├── payInterest.cash │ │ ├── redeem.cash │ │ ├── startRedemption.cash │ │ ├── swapInRedemption.cash │ │ └── swapOutRedemption.cash │ ├── Loan.cash │ └── LoanSidecar.cash ├── loankey/ │ ├── LoanKeyFactory.cash │ ├── LoanKeyOriginEnforcer.cash │ ├── LoanKeyOriginProof.cash ├── redeemer/ │ ├── Redeemer.cash │ ├── Redemption.cash │ └── RedemptionSidecar.cash ├── stabilitypool/ │ ├── poolContractFunctions/ │ │ ├── AddLiquidity.cash │ │ ├── LiquidateLoan.cash │ │ ├── NewPeriodPool.cash │ │ └── WithdrawFromPool.cash │ ├── Collector.cash │ ├── Payout.cash │ ├── StabilityPool.cash │ └── StabilityPoolSidecar.cash ├── Borrowing.cash ├── PriceContract.cash
To recompile the CashScript Artifacts after making contract changes run
pnpm compileThis command generates the CashScript artifacts from the contracts source files.
The artifacts are generated as TS files to the artifacts folder.
Re-compiling artifacts from the same contracts source code will result in identical artifacts except for the updatedAt timestamp.
Changing comments in the contract source code changes the source, sourceMap and requires in the compiled output.
The contract source has been through two external audits. The first was delivered across three passes and its report is published in this repo; a second is still in progress. The table below lists the tree hashes identifying each snapshot of the finalised audit. Tree hashes are derived from repo content and are stable across history rewrites.
| Pass | Tree Hash | CashScript |
|---|---|---|
| First | 873f00ce35477e775cbd66ba499179af1a47ae4a |
cashc v0.11.3 |
| Second | 7446726ac529d1b2e261b16b778e79baf8bdc1f3 |
cashc v0.12.0 |
| Third | e8b122a7faa14b8beda61563a2d17cf9073dc42f |
cashc v0.12.0 |
You can list tree hashes for all commits in the repo with:
git log --format="%T %s"The current repo state includes additional hardening identified by a follow-up AI-assisted review beyond the third-pass snapshot. Six contracts' compiled bytecode has changed; the remaining 20 are bytecode-identical. See post-audit-changes.md for what changed and why, and bytecode-verification.md for how to verify the unchanged 20 against the snapshot.
The contracts have since been updated to the CashScript v0.13.0 language version. To keep the compiled bytecode identical to before, its two new default-on compiler options are explicitly opted out of via the -S and -L flags in compile.ts.
There is a dedicated repo paryon_testing_suite for Paryon Contract tests, the transaction building tests are in the paryon_library repo.