Skip to content

feat: implement initialize() per issue #14#142

Closed
hartz0 wants to merge 2 commits into
JSE-ORG:mainfrom
hartz0:main
Closed

feat: implement initialize() per issue #14#142
hartz0 wants to merge 2 commits into
JSE-ORG:mainfrom
hartz0:main

Conversation

@hartz0
Copy link
Copy Markdown

@hartz0 hartz0 commented May 28, 2026

closes #14

Implements the one-time initialize(admin, fee_bps, fee_collector) contract constructor per
issue 14. Returns ContractError::AlreadyInitialized on repeat calls, validates fee_bps
against the 300 bps cap, requires admin auth, sets the escrow counter to 0, and emits a
ContractInitialized event. Also removes pre-existing duplicate type definitions that would
have prevented compilation.

hartz0 added 2 commits May 28, 2026 10:36
- Return ContractError::AlreadyInitialized instead of panic
- Validate fee_bps <= MAX_FEE_BPS (FeeExceedsMax on failure)
- Require admin auth before writing state
- Set EscrowCounter to 0; create_escrow pre-increments so first ID = 1
- Emit ContractInitialized event with admin, fee_bps, fee_collector, timestamp
- Add ContractInitialized event struct
- Remove duplicate type/function definitions from lib.rs
- Update all 49 test call sites to new signature (admin, fee_bps, fee_collector)
- Add tracking_id param to mark_shipped to match test expectations
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 28, 2026

@hartz0 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@JSE19
Copy link
Copy Markdown
Contributor

JSE19 commented May 28, 2026

Please resolve conflict

@hartz0 hartz0 closed this by deleting the head repository Jun 2, 2026
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.

Issue #14: Implement initialize function — contract constructor

2 participants