Skip to content

feat: implement cross-contract token wrapping for interoperability#188

Open
Nonso-Eze wants to merge 1 commit into
BCPathway:mainfrom
Nonso-Eze:implement/issue-168-token-wrapper
Open

feat: implement cross-contract token wrapping for interoperability#188
Nonso-Eze wants to merge 1 commit into
BCPathway:mainfrom
Nonso-Eze:implement/issue-168-token-wrapper

Conversation

@Nonso-Eze
Copy link
Copy Markdown

Closes #168

  • Add WrapperContract (contracts/wrapper) implementing SEP-41 TokenInterface
    • wrap(caller, amount): pulls underlying token via transfer_from, mints wrapped tokens
    • unwrap(caller, wrapped_amount): burns wrapped tokens, returns underlying via transfer
    • Full SEP-41 surface: transfer, transfer_from, approve, burn, burn_from, allowance, balance, decimals, name, symbol
    • Decimal mismatch handling: scale_to_wrapper / scale_to_underlying helpers
    • Reentrancy guard via in-storage lock (DataKey::Lock)
    • Pause/unpause via bc-forge-lifecycle integration
    • Structured events: init, wrap, unwrap, xfer, xfer_frm, approve, burn, paused, unpause
  • Add WrapperClient to SDK (sdk/src/wrapperClient.ts)
    • wrap(), unwrap(), transfer(), approve(), burn(), pause(), unpause()
    • Read queries: getBalance, getTotalSupply, getUnderlyingToken, getName, getSymbol, getDecimals, getAllowance, getVersion
    • Offline builders: buildWrapTx, buildUnwrapTx, signTx
    • Simulation helpers: simulateWrap, simulateUnwrap
    • Re-exported from sdk/src/index.ts

Closes BCPathway#168

- Add WrapperContract (contracts/wrapper) implementing SEP-41 TokenInterface
  - wrap(caller, amount): pulls underlying token via transfer_from, mints wrapped tokens
  - unwrap(caller, wrapped_amount): burns wrapped tokens, returns underlying via transfer
  - Full SEP-41 surface: transfer, transfer_from, approve, burn, burn_from, allowance, balance, decimals, name, symbol
  - Decimal mismatch handling: scale_to_wrapper / scale_to_underlying helpers
  - Reentrancy guard via in-storage lock (DataKey::Lock)
  - Pause/unpause via bc-forge-lifecycle integration
  - Structured events: init, wrap, unwrap, xfer, xfer_frm, approve, burn, paused, unpause
- Add WrapperClient to SDK (sdk/src/wrapperClient.ts)
  - wrap(), unwrap(), transfer(), approve(), burn(), pause(), unpause()
  - Read queries: getBalance, getTotalSupply, getUnderlyingToken, getName, getSymbol, getDecimals, getAllowance, getVersion
  - Offline builders: buildWrapTx, buildUnwrapTx, signTx
  - Simulation helpers: simulateWrap, simulateUnwrap
  - Re-exported from sdk/src/index.ts
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@Nonso-Eze 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

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.

Implement cross-contract token wrapping for interoperability

1 participant