Skip to content

adding crowd fund example to sbe#41

Open
GreatSoshiant wants to merge 8 commits intomasterfrom
crowd-find
Open

adding crowd fund example to sbe#41
GreatSoshiant wants to merge 8 commits intomasterfrom
crowd-find

Conversation

@GreatSoshiant
Copy link
Member

Adding Crowd Fund example to the Stylus by Example Repo.

Closes STY-117

@vercel
Copy link

vercel bot commented Sep 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
stylus-by-example ✅ Ready (Inspect) Visit Preview Sep 26, 2024 8:33pm

Copy link
Collaborator

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);
Copy link
Collaborator

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;
Copy link
Collaborator

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));
Copy link
Collaborator

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants