Skip to content

refactored contracts#92

Merged
vedhapprakashni merged 1 commit intoNitya-003:mainfrom
surajsbhoj0101:refactor-contract
Feb 14, 2026
Merged

refactored contracts#92
vedhapprakashni merged 1 commit intoNitya-003:mainfrom
surajsbhoj0101:refactor-contract

Conversation

@surajsbhoj0101
Copy link
Contributor

I made a security-focused refactor of the Solidity side:

Rebuilt CropChain.sol with safer marketplace logic (listing, buying, withdrawing).
Applied CEI pattern to value-transfer flows so state updates happen before external ETH calls.
Added reentrancy protection (nonReentrant) on all external state-changing functions.
Added emergency pause/unpause circuit breaker for admin incident response.
Added oracle price recording + TWAP checks so buys reject prices that deviate too much (flash-loan resistance).
Added a mock attacker contract to simulate reentrancy attacks.
Added security tests proving:
reentrancy withdrawal attack is blocked,
paused contract blocks marketplace actions,
manipulated listing prices fail TWAP validation.

@netlify
Copy link

netlify bot commented Feb 14, 2026

Deploy Preview for roaring-ganache-c7465f failed. Why did it fail? →

Name Link
🔨 Latest commit 41f4004
🔍 Latest deploy log https://app.netlify.com/projects/roaring-ganache-c7465f/deploys/6990bb36f0dddf00080ec196

@vedhapprakashni vedhapprakashni linked an issue Feb 14, 2026 that may be closed by this pull request
3 tasks
@vedhapprakashni vedhapprakashni merged commit 2d5cc3c into Nitya-003:main Feb 14, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor contracts for advanced exploit protection

2 participants