Merged
Conversation
7c655a8 to
b32fdc1
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR disables the legacy offchain receipt support in Sto::invest, introduces new offchain receipt types and validation, and adds explicit extrinsics and weights for on-chain and off-chain funding.
- Define new
FundraiserReceiptandFundraiserReceiptDetailstypes in primitives. - Introduce
Sto::enable_offchain_funding, splitinvestweights intoinvest_onchain/invest_offchain, and wire up receipt validation in the settlement pallet. - Update benchmarks, runtime tests, and integration tests to exercise on-chain and off-chain investment flows.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| primitives/src/sto.rs | Add new receipt ID type and offchain receipt structs. |
| primitives/src/lib.rs | Register the new sto module in primitives. |
| pallets/weights/src/pallet_sto.rs | Split and add weight functions for on-chain/off-chain funding. |
| pallets/sto/src/benchmarking.rs | Add benchmarks for invest_onchain, invest_offchain, and enable_offchain_funding. |
| pallets/settlement/src/lib.rs | Refactor receipt validation, add ensure_valid_receipt and mark_receipt_as_used. |
| pallets/settlement/src/benchmarking.rs | Update receipt signing in settlement benchmarks. |
| pallets/runtime/tests/src/sto_test.rs | Update unit tests to use FundingMethod::OnChain. |
| integration/tests/sto.rs | New end-to-end integration tests for on-chain and off-chain STO funding. |
| integration/tests/settlements.rs | Remove duplicate asset helper, bump test mint amounts. |
| integration/src/lib.rs | Add helper to extract FundraiserId from events. |
| integration/src/asset_helper.rs | Extract shared AssetHelper into a standalone module. |
| integration/Cargo.toml | Add scale codec dependency for off-chain receipt encoding. |
Comments suppressed due to low confidence (1)
pallets/settlement/src/lib.rs:2875
- There are no unit tests covering the new
ensure_valid_receiptormark_receipt_as_usedfunctions. Consider adding tests for valid, duplicate, and unauthorized receipt scenarios to ensure the logic behaves as expected.
pub fn mark_receipt_as_used(
Contributor
Author
|
We are going to allow breaking the STO API, so the |
HenriqueNogara
approved these changes
Jun 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
changelog
new features
modified external API
Sto.investto use support both onchain and offchain funding methods.new external API
Sto.enable_offchain_fundingto enable support for offchain funding receipts.modified events
AssetIdvalue in Sto events:FundraiserCreated,FundraiserFrozen,FundraiserUnfrozen,FundraiserWindowModified, andFundraiserClosed.Invested. Moved the "offering token" to the second value to have the same ordering as the other events. Changed "raise token" type toFundingAssetenum to support both onchain and offchain funding.new events
FundraiserOffchainFundingEnabled.