-
Notifications
You must be signed in to change notification settings - Fork 389
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
feat(examples): Gnofundme #2085
base: master
Are you sure you want to change the base?
Conversation
…n getters, reshaped testfiles
Hey @MalekLahbib, Can you please move your code to your personal namespace in this PR? Also, if the PR is ready for review, change it from draft to ready for review. I'll take a look after that. |
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.
LGTM after resolving comments 👍
return string(value) | ||
} | ||
|
||
func FormatBool(b bool) string { |
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.
This function now exists in the strconv
package
uassert.Equal(t, contributor.GetUser().Address, user.Address) | ||
|
||
uassert.False(t, contributor.Date.IsZero()) | ||
|
||
uassert.Equal(t, contributor.Amount, amount) | ||
|
||
uassert.Equal(t, contributor.GetDisplay(), display) |
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.
No need for these newlines
wal/cs.wal/wal
Outdated
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.
Remove this file
if beneficiary != caller { | ||
beneficiaryU = users.GetUserByAddress(beneficiary) | ||
if beneficiaryU == nil { | ||
panic("beneficiary not registered in 'gno.land/r/demo/users'") | ||
} | ||
} else { | ||
beneficiaryU = owner | ||
} |
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.
If you're forcing the beneficiary to be registered in r/demo/users, why not just have the username as the input to the function?
campaign := camp.(*gfm.Campaign) | ||
// Verfiy that the dates are correct | ||
if time.Now().Unix() < campaign.Begin.Unix() { | ||
panic(ufmt.Sprintf("The campaign didn't start yet. Begin: %d,", campaign.Begin.Unix())) |
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.
Extra ,
here. Also, do you think it would be practical to display a user-friendly begin time here, instead of unix seconds?
if campaigns.Size() == 0 { | ||
return "[]" | ||
} | ||
campaignsArray := make([]*gfm.Campaign, 0, campaigns.Size()) | ||
campaigns.Iterate("", "", func(key string, value interface{}) bool { | ||
c := value.(*gfm.Campaign) | ||
campaignsArray = append(campaignsArray, c) | ||
return false | ||
}) | ||
return gfm.CampaignsToJSONString(campaignsArray) | ||
} |
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.
Newlines
if campaigns.Size() == 0 { | |
return "[]" | |
} | |
campaignsArray := make([]*gfm.Campaign, 0, campaigns.Size()) | |
campaigns.Iterate("", "", func(key string, value interface{}) bool { | |
c := value.(*gfm.Campaign) | |
campaignsArray = append(campaignsArray, c) | |
return false | |
}) | |
return gfm.CampaignsToJSONString(campaignsArray) | |
} | |
if campaigns.Size() == 0 { | |
return "[]" | |
} | |
campaignsArray := make([]*gfm.Campaign, 0, campaigns.Size()) | |
campaigns.Iterate("", "", func(key string, value interface{}) bool { | |
c := value.(*gfm.Campaign) | |
campaignsArray = append(campaignsArray, c) | |
return false | |
}) | |
return gfm.CampaignsToJSONString(campaignsArray) | |
} |
// XXX TO BE DISCUSSED: the funds can be withdrawn even if the goal is not reached or not? | ||
// verify that the campaign is successful | ||
// if campaign.Current < campaign.Goal { | ||
// panic("the campaign is not successful") | ||
// } |
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.
Decide on this and remove the comment :)
campaignsTotal[campaignId] = 0 | ||
// transfer the amount to the beneficiary | ||
banker.SendCoins(std.CurrentRealm().Addr(), beneficiaryAddress, std.Coins{std.NewCoin("ugnot", amount)}) | ||
std.Emit("Withdraw", "withdraw", "withdrawn successfully") |
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.
Better add some more useful information; like, how much was withdrawn.
b.WriteString("\n") | ||
return b.String() |
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.
b.WriteString("\n") | |
return b.String() | |
b.WriteString("\n") | |
return b.String() |
|
||
func TestWithdraw(t *testing.T) { | ||
banktestAddr := std.DerivePkgAddr("gno.land/r/demo/gnofundme") | ||
mainaddr := std.DerivePkgAddr("main") |
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.
Better use testutils.TestAddress("main")
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.
LGTM after resolving comments 👍
Also, think about how the user interface will look like in |
GnoFundMe is a fundraising/crowdfunding platform built with React, TypeScript and Tailwind CSS.
It allows you to connect your Adena Wallet to identify and make actions/transactions.
I created this PR to open a space for discussion/suggestions from anyone that wants to participate and give ideas about this project, the repo of the project with the front is here.
I have this miro where I put my ideas, anyone is welcome to modify and suggest things. Feel free to participate.
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description