Add integration test suites for dex, lending, crowdfunding, and property management - #1045
Open
prismn wants to merge 1 commit into
Open
Conversation
…rty management Closes MettaChain#918 Closes MettaChain#919 Closes MettaChain#920 Closes MettaChain#921 - dex: pool creation validation (identical tokens, zero reserves, fee cap, duplicate ordered pairs), sqrt LP share minting, price seeding, proportional liquidity shares, fee-adjusted constant-product swaps that move the pool price, slippage guard enforcement, and clean errors for unknown pools. - lending: utilization-driven borrow rates with over-borrow rejection, credit-profile gating of underwriting (thin files stay pending), LTV enforcement at activation, threshold-gated liquidation, and settled loan state that cannot be re-liquidated. - crowdfunding: creator-only activation, KYC + accreditation gating of investment (with admin-only verification), per-investor aggregation without inflating investor counts, target-crossing to Funded status, milestone add/approve/oracle-verify/release flow with double-release protection, and exactly-once refunds after admin cancellation. - property management: admin-gated manager administration, lease term validation (zero rent/periods, fee bps bound), jurisdiction deposit caps rejecting over-collateralized deposits, landlord-role gating, maintenance triage through resolution with manager authorization, manager-reviewed tenant screening with single-review semantics, and expense recording with amount validation. - contracts/dex|lending|crowdfunding|property-management: expose the contract modules as pub and add rlib to crate-type so external test binaries can link them (cdylib alone is not linkable). - tests/Cargo.toml: add the four dependencies plus explicit [[test]] targets - the package root is the tests directory itself, so cargo cannot auto-discover new test files.
|
Hey @prismn! 👋 It looks like this PR isn't linked to any issue. If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g.,
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four integration test suites covering the DEX AMM, lending platform, crowdfunding lifecycle, and property management (14 new tests, all running in CI).
DEX (#918)
InvalidPair.sqrt(base * quote); initial price seeded in bips.Lending (#919)
Pending; qualified loans activate with their computed score stored.LiquidationThresholdNotMet), threshold breach liquidates, and settled state cannot be re-liquidated or re-flagged.Crowdfunding (#920)
Funded.AlreadyRefundedafter), non-investors getNoInvestmentFound.Property management (#921)
ComplianceViolation, within-cap stores Active), and single-use ending.Infrastructure notes
pub(identity/oracle already were), and their[lib] crate-typegains"rlib"alongside cdylib — cdylib alone cannot be linked into test binaries.tests/Cargo.tomlgains the four dependencies plus explicit[[test]]targets: the package root is the tests directory itself, so cargo's auto-discovery never picks up files placed there.#![allow(clippy::clone_on_copy)]added workspace-wide: current nightly fires it inside ink!-generated storage accessors on a pristine checkout of main, failing-D warningsfor every PR. Also one pre-existingclippy::new_without_defaultsuppression on the property-management constructor now needed since the crate links as rlib into tests.Test plan
cargo +nightly fmt --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-features --workspace(626 passed, 0 failed)