Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
chrisco512
requested changes
Sep 16, 2024
Collaborator
There was a problem hiding this comment.
Are these .cargo files still necessary?
| sol_interface! { | ||
| interface IERC20 { | ||
| function transfer(address, uint256) external returns (bool); | ||
| function transferFrom(address, address, uint256) external returns (bool); |
Collaborator
There was a problem hiding this comment.
indent these 2 functions
| // Mapping from id to Campaign | ||
| CampaignStruct[] campaigns; // The transactions array | ||
| // Mapping from campaign id => pledger => amount pledged | ||
| mapping(uint256 => mapping(address => uint256)) pledged_amount; |
| pub fn launch(&mut self, goal: U256, start_at: U256, end_at: U256) { | ||
| assert!(start_at < U256::from(block::timestamp())); | ||
| assert!(end_at < start_at); | ||
| assert!(end_at > U256::from(block::timestamp() + 7 * Self::ONE_DAY)); |
Collaborator
There was a problem hiding this comment.
These Rust-native assertions add to code bloat, iirc. I don't think we should be recommending their usage except in off-chain testing scripts. Just use if or match statements. (you can also try commenting out all assertions to see if it makes an appreciable difference in code size / execution gas)
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.
Adding Crowd Fund example to the Stylus by Example Repo.
Closes STY-117