Skip to content

Feat gnobounty#22

Open
Nezketsu wants to merge 25 commits intognoverse:mainfrom
Nezketsu:feat_gnobounty
Open

Feat gnobounty#22
Nezketsu wants to merge 25 commits intognoverse:mainfrom
Nezketsu:feat_gnobounty

Conversation

@Nezketsu
Copy link
Copy Markdown
Contributor

@Nezketsu Nezketsu commented Nov 6, 2025

This PR introduces gnobounty, a decentralized bounty system built on Gno that allows users to place bounties on GitHub issues using cryptocurrency.

Comment on lines +40 to +42
- `send`: The bounty amount in ugnot (1 GNOT = 1,000,000 ugnot)

**Minimum bounty**: 1 GNOT (1,000,000 ugnot)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gnot will be non-transferrable upon launch so you will not be able to use it to pay for things (usable only for gas)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on staging we can transfer gnot

Comment on lines +68 to +84
// Create the application
application := &Application{
ID: applicationCount,
BountyID: bountyID,
Applicant: caller,
PRLink: prLink,
AppliedAt: time.Now(),
Status: StatusPending,
DAO: dao,
ProposalID: 0, // Will be set when proposal is created
}

// Create a proposal in the DAO to approve this application
proposalDef := NewClaimBountyProposal(bountyID, applicationCount, caller, prLink)

proposal := dao.MustPropose(caller, proposalDef)
application.ProposalID = proposal.ID()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the DAO.MustPropose before creating the application structure so you can directly set the proposalId instead of setting it to 0 by default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +187 to +191
if app.DAO != nil && app.Status == StatusPending {
if app.DAO.Members().Has(validatorAddr) {
apps = append(apps, app)
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do this in only one if

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +73 to +80
for i := 0; i < len(result)-1; i++ {
for j := 0; j < len(result)-i-1; j++ {
if result[j].Score < result[j+1].Score {
// Swap
result[j], result[j+1] = result[j+1], result[j]
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ask @leohhhn if a bubble sort is already implemented

Comment on lines +93 to +116
output += "| Rank | User | Score | 💰 Bounties | 📝 Applications | ⚖️ Validations |\n"
output += "|---|---|---|---|---|---|\n"

for i, entry := range entries {
rank := ""
switch i {
case 0:
rank = "🥇"
case 1:
rank = "🥈"
case 2:
rank = "🥉"
default:
rank = ufmt.Sprintf("%d", i+1)
}

output += ufmt.Sprintf("| %s | %s | **%d** | %d | %d | %d |\n",
rank,
entry.Address,
entry.Score,
entry.BountiesCreated,
entry.BountiesApplied,
entry.ValidationsPerformed,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use gno.land/p/moul/md to create the table

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Refund the creator
bnk := banker.NewBanker(banker.BankerTypeRealmSend)
send := chain.Coins{chain.Coin{Denom: "ugnot", Amount: bounty.Amount}}
pkgAddr := chain.PackageAddress("gno.land/r/greg007/gnobounty")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save the package address into a variable so you can change it easily if it's redeployed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// Transfer rewards
bnk := banker.NewBanker(banker.BankerTypeRealmSend)
pkgAddr := chain.PackageAddress("gno.land/r/greg007/gnobounty")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +28 to +37
output += "## 🎯 Quick Actions\n\n"
output += md.Link("👨‍⚖️ Register as Validator", registerValidatorLink)
output += " | "
output += md.Link("💰 Create a new bounty", createBountyLink)
output += ufmt.Sprintf(" _(minimum reward: %s)_", minSend)
output += " | "
output += md.Link("📋 View All Validators", "/r/greg007/gnobounty:validators")
output += " | "
output += md.Link("🏆 Leaderboard", "/r/greg007/gnobounty:leaderboard")
output += "\n\n"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same use gno.land/p/moul/md package

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output += " | "

// Add view details link
detailsPath := ufmt.Sprintf("/r/greg007/gnobounty:%d", bounty.ID)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, package address into a variable with a setter function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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