Skip to content

Implement assign_driver for delivery contract - #36

Merged
Tybravo merged 2 commits into
SwiftChainn:mainfrom
rexx010:feat/driver-assignment-delivery-order
Apr 24, 2026
Merged

Implement assign_driver for delivery contract#36
Tybravo merged 2 commits into
SwiftChainn:mainfrom
rexx010:feat/driver-assignment-delivery-order

Conversation

@rexx010

@rexx010 rexx010 commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Closes #21

Description

This PR introduces the secure assign_driver function in the delivery_contract to handle driver assignments for deliveries.

Key Changes

  • Access Control: Enforced require_auth(), restricting callers to either an Admin or the Driver themselves (self-assignment).
  • State Machine: Validated that assignments can only occur when the delivery is in a Pending state, transitioning it to Active.
  • Storage & Events: Extended storage TTL (~30 days) and emitted the driver_assigned event upon successful assignment.
  • Testing: Added comprehensive unit tests covering successful admin/driver assignments, unauthorized rejections, and invalid state panics.
  • Shared Types: Fixed event symbol length limits in the shared_types crate.

Testing

  • cargo test -p delivery_contract passes successfully.

@drips-wave

drips-wave Bot commented Apr 24, 2026

Copy link
Copy Markdown

@rexx010 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

@Tybravo
Tybravo merged commit bab973f into SwiftChainn:main Apr 24, 2026
1 check failed
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.

Smart Contract: Implement Driver Assignment to Delivery Order

2 participants