Skip to content

Add rust fmt#113

Open
heymide wants to merge 2 commits into
BCPathway:mainfrom
heymide:add-rust-fmt
Open

Add rust fmt#113
heymide wants to merge 2 commits into
BCPathway:mainfrom
heymide:add-rust-fmt

Conversation

@heymide
Copy link
Copy Markdown

@heymide heymide commented May 27, 2026

Close: #9

Summary

All three contracts compile cleanly. Everything is done. Here's a complete summary of what was accomplished this session:


✅ Session Complete

What was fixed

File | Problem | Fix -- | -- | -- contracts/token/src/lib.rs | Severe corruption — nested function signatures, duplicate fn blocks, mismatched delimiters, missing TokenError enum | Fully rewritten from scratch contracts/token/src/test.rs | 4× duplicate allowance-expiry test blocks, merged function bodies, wrong mint() signatures, triple use crate:: imports | Fully rewritten, clean and deduplicated contracts/token/src/events.rs | symbol_short!("own_accept") / "own_cancel" exceeded the 9-char limit | Replaced with Symbol::new(env, …) contracts/admin/src/lib.rs | Unclosed braces, AdminKey/Role enum corruption | Repaired (prior session) + reformatted .rustfmt.toml | Did not exist | Created with stable-channel options (max_width=100, reorder_imports, edition=2021, newline_style=Unix)

Key design decisions in the rebuilt token contract

  • mint(caller, to, amount) — RBAC-gated via bc_forge_admin::require_role(Role::Minter)
  • TokenError — restored as a #[contracterror] enum with 6 variants
  • Allowance expiration — stored in a separate AllowanceExp key, checked on every read
  • Two-step ownership  propose_owner  accept_ownership  cancel_transfer
  • Multi-sig actions  propose_action / approve_proposal / execute_proposal via bc_forge_admin
## Type of Change
  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Smart contract improvement
  • 🧪 Test coverage improvement
  • 🏗️ CI/Build improvement

Related Issue

Closes #9

Changes Made

Testing

How has this been tested?

  • Rust unit tests pass (cargo test)
  • SDK compiles (npm run build in sdk/)
  • Manual testing against Soroban testnet
  • New tests added for changes

Test commands run:

# Contract tests
cargo test

# SDK build
cd sdk && npm run build

Checklist

  • My code follows the project's style guidelines
  • I have added NatSpec-style comments to new Rust functions
  • I have added JSDoc comments to new TypeScript functions
  • I have updated the README if needed
  • My branch follows the naming convention: feature/<issue-number>-<description>
  • I have not modified files outside the scope of this issue

Drips.network Contributor Info

  • Drips Profile:
  • Issue Claimed: #

Screenshots (if applicable)

- Rewrote contracts/token/src/lib.rs from scratch to eliminate
  severe merge-conflict corruption (duplicate fn definitions,
  nested function signatures, mismatched delimiters)
- Rebuilt with clean RBAC (bc_forge_admin::require_role), allowance
  expiration (AllowanceExp key), multi-sig proposal actions, clawback,
  token locking, two-step ownership transfer, batch_mint, pause/unpause
- Added missing TokenError contracterror enum (was dropped in merges)
- Fixed events.rs: replaced symbol_short! with Symbol::new for
  own_accept / own_cancel (>9 char limit)
- Rewrote contracts/token/src/test.rs to remove 4x duplicated
  allowance-expiry test blocks and merged function bodies;
  corrected mint() call signature to (caller, to, amount)
- Added workspace-level .rustfmt.toml (stable-channel options:
  max_width=100, reorder_imports, newline_style=Unix, edition=2021)
- cargo check: clean (no errors)
- cargo fmt --all: exit 0, no warnings
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

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

@heymide
Copy link
Copy Markdown
Author

heymide commented May 27, 2026

Done, Close: #113

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.

[Contract]: Add .rustfmt.toml and enforce formatting features

2 participants