Skip to content
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

init release #1

Merged
merged 3 commits into from
Nov 21, 2022
Merged

init release #1

merged 3 commits into from
Nov 21, 2022

Conversation

piux2
Copy link
Contributor

@piux2 piux2 commented Oct 26, 2022

No description provided.

@piux2
Copy link
Contributor Author

piux2 commented Oct 26, 2022

#361
#364

@r3v4s
Copy link

r3v4s commented Oct 27, 2022

Greetings @moul
@piux2 and I had lots of conversation

  • faucet rules are currently implemented in the Discord bot, not r/faucet
  • we think that implementing rules in contract, not in a third-party platform, is the way to go, however given that we're unable to upgrade a /r/ contract for now, implementing rules in the Discord bot would give us more flexible options when we have to change rules for faucet
  • when we are able to upgrade /r/ contracts with upcoming updates of namespace & sub-namespace, we can update faucet rules to the /r/faucet

we can simply change "Transfer" in faucet.gno something like below to migrate rules from the Discord bot

func Transfer(to std.Address, send int64) string {
    if err := assertIsController(); err != nil {
        return err.Error()
    }

    if gInPause {
        return errors.New("faucet in pause").Error()
    }

    var sendCoins std.Coins

    // we should implement more logcis
    if send <= gMaxLimit.AmountOf("ugnot") {
        if getBalance(to) < gMaxLimit.AmountOf("ugnot") {
            sendCoins = std.Coins{std.Coin{Denom: "ugnot", Amount: send}}
        } else {
            sendCoins = std.Coins{std.Coin{Denom: "ugnot", Amount: gLowAmount.AmountOf("ugnot")}}
        }

    } else {
        return errors.New("Per request limit " + gMaxLimit.String() + " exceed").Error()
    }

    gTotalTransferred = gTotalTransferred.Add(sendCoins)
    gTotalTransfers++

    banker := std.GetBanker(std.BankerTypeRealmSend)
    pkgaddr := std.GetOrigPkgAddr()
    banker.SendCoins(pkgaddr, to, sendCoins)
    return ""
}

@moul
Copy link
Member

moul commented Nov 21, 2022

Hey, thank you for your contribution.

Let's merge this and continue iterating over this codebase.

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.

3 participants