-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding crowd fund example to sbe #41
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent these fields
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
Adding Crowd Fund example to the Stylus by Example Repo.
Closes STY-117