Implement deposit_fiat and withdraw_fiat functions#7
Closed
jobbykings wants to merge 3 commits intocaxtonacollins:mainfrom
Closed
Implement deposit_fiat and withdraw_fiat functions#7jobbykings wants to merge 3 commits intocaxtonacollins:mainfrom
jobbykings wants to merge 3 commits intocaxtonacollins:mainfrom
Conversation
jobbykings
commented
May 30, 2025
- Added deposit_fiat function to allow users to deposit fiat currency.
- Added withdraw_fiat function to enable fiat withdrawal to specified recipient.
- Both functions update storage and emit appropriate events.
- Added storage mappings for fiat_balance and token_address.
|
|
||
| // -- New functions added here -- | ||
|
|
||
| fn deposit_fiat(ref self: ContractState, currency: felt252, amount: u128) { |
Owner
There was a problem hiding this comment.
assert that currency is provided
| // -- New functions added here -- | ||
|
|
||
| fn deposit_fiat(ref self: ContractState, currency: felt252, amount: u128) { | ||
| assert(amount > 0, 'Amount must be > 0'); |
Owner
There was a problem hiding this comment.
assert takes in felt252, therefore you should use single quotes.
your test should cover the whole implementation, test every assertion, insufficient balance and more
| fn deposit_fiat(ref self: ContractState, currency: felt252, amount: u128) { | ||
| assert(amount > 0, 'Amount must be > 0'); | ||
| let caller = get_caller_address(); | ||
| let current_balance = self.fiat_balance.read((caller, currency)); |
Owner
There was a problem hiding this comment.
you need to check if the user have sufficient balance
Owner
|
@jobbykings are yo still working on this? |
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.