Skip to content

Resolves four open issues covering governance, credit scoring, insurance fund, and flash loan integration.#538

Merged
Smartdevs17 merged 2 commits into
Smartdevs17:mainfrom
JONAH-6:fix/issues-329-330-331-332
Jun 24, 2026
Merged

Resolves four open issues covering governance, credit scoring, insurance fund, and flash loan integration.#538
Smartdevs17 merged 2 commits into
Smartdevs17:mainfrom
JONAH-6:fix/issues-329-330-331-332

Conversation

@JONAH-6

@JONAH-6 JONAH-6 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

#332 — Governance system

  • storage.rs — rewrote the file; it was missing GovernanceDataKey, DataKey, and GuardianConfig, which caused compilation
    failures across governance, recovery, timelock, and credit score modules
  • governance.rs — fixed a critical flash-loan attack: vote() computed snapshot-based voting power via
    get_vote_power_with_delegation() then immediately shadowed it with a live token_client.balance() call, completely defeating
    the anti-flash-loan protection; the two overwriting lines were removed
  • governance_test.rs — replaced 70 stub tests (assert_eq!(1u32, 1)) with real behavioural tests across 7 phases: proposal
    lifecycle, voting mechanics, timelock & execution, multisig operations, error handling, event validation, and integration
    scenarios
  • lib.rs — removed the #[path = "tests/governance_test.rs"] override on mod governance_test so src/governance_test.rs is
    actually compiled

#329 — Credit scoring system

  • storage.rs — added the DataKey::CreditScore(Address) variant that credit_score.rs depends on for persistent storage; the
    module was uncompilable without it

#330 — Insurance fund pool

  • insurance.rs — added the missing Vec import; Vec::new(env) and Vec were used in get_all_claim_ids but Vec was not in
    scope

#331 — Flash loan integration with AMM arbitrage

  • contracts/hello-world/src/flash_loan.rs — uncollateralized flash loan with callback pattern, 0.09 % base fee, TWAP deviation
    detection, pool-relative liquidity cap (default 50 %), constant-product price-impact check, per-asset concurrent-loan guard,
    and reentrancy protection via RAII guard
  • contracts/lending/src/flash_loan.rs — lending-side flash loan with attack-prevention checks (TWAP, liquidity cap, price
    impact, sandwich guard) and AMM callback integration via the on_flash_loan receiver interface
  • contracts/amm/src/amm.rs — AMM swap and liquidity functions used as the arbitrage target inside flash loan callbacks

Closes #332
Closes #329
Closes #330
Closes #331

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

@JONAH-6 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

Hey @JONAH-6! 👋 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., Closes #123), or by clicking a button below:

Issue Title
#329 Implement credit scoring system for uncollateralized borrowing Link to this issue
#331 Add flash loan integration with AMM arbitrage support Link to this issue
#330 Build insurance fund pool with risk-adjusted premiums Link to this issue
#332 Build comprehensive governance system with proposal lifecycle Link to this issue

ℹ️ Learn more about linking PRs to issues

@Smartdevs17 Smartdevs17 merged commit d554a18 into Smartdevs17:main Jun 24, 2026
3 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants