Fix Compilation Errors: Add Missing Imports and Fix String Conversions#144
Merged
Merged
Conversation
…or cfg-if and addition of memory_units, wee_alloc, and winapi packages
…es in Predictify Hybrid contract, improving code clarity and maintainability
…ad of `Vec`, enhancing code consistency
…manual character manipulation with built-in string methods for improved readability and performance
… enhance oracle configuration and provider functionality
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.
Summary
This PR fixes multiple compilation errors in the Predictify Hybrid contract by adding missing imports and correcting string conversion methods.
Changes Made
1. Fixed Missing
vec!Macro ImportFile:
contracts/predictify-hybrid/src/resolution.rsvecto the main soroban_sdk imports2. Added Missing Type Imports
File:
contracts/predictify-hybrid/src/voting.rsuse crate::types::{OracleConfig, OracleProvider};to test module3. Fixed String Conversion Methods
File:
contracts/predictify-hybrid/src/utils.rss.unpack()calls withs.to_string()s.as_str()calls withs.to_string()to_uppercase,to_lowercase,trim,truncate,split,join,contains,starts_with,ends_with,replace,validate_string_length,sanitize_string,string_to_i128,validate_email,validate_url4. Added Missing Trait Import
File:
contracts/predictify-hybrid/src/test.rsuse crate::oracles::OracleInterface;importget_pricemethod for ReflectorOracleTechnical Details
String Conversion Fix
The main issue was incorrect usage of string conversion methods:
s.unpack()ands.as_str()(not available on soroban_sdk::String)s.to_string()(correct method for soroban_sdk::String)Import Strategy
Testing
Files Changed
contracts/predictify-hybrid/src/resolution.rscontracts/predictify-hybrid/src/voting.rscontracts/predictify-hybrid/src/utils.rscontracts/predictify-hybrid/src/test.rsBreaking Changes
None - this is purely a compilation fix.
Related Issues
Closes #120
Checklist