launchpad_protocol_fee.gno
2.14 Kb · 66 lines
1package launchpad
2
3import (
4 "gno.land/r/gnoswap/access/v1"
5
6 gov_staker "gno.land/r/gnoswap/gov/staker"
7 "gno.land/r/gnoswap/halt/v1"
8)
9
10// CollectProtocolFee collects protocol fee from gov/staker for project recipient wallets.
11// Only project recipients can call this function.
12//
13// Parameters:
14// - _: Noncrossing implementation-call discriminator; pass 0.
15// - rlm: Current realm context forwarded unchanged by the launchpad proxy; validated before collection.
16func (lp *launchpadV1) CollectProtocolFee(_ int, rlm realm) {
17 access.AssertIsRlmCurrent(0, rlm)
18
19 halt.AssertIsNotHaltedWithdraw()
20
21 previousRealm := rlm.Previous()
22
23 caller := previousRealm.Address()
24 lp.assertHasProject(caller)
25
26 gov_staker.CollectRewardFromLaunchPad(cross(rlm), caller)
27}
28
29// CollectEmissionReward collects emission rewards from gov/staker for project recipient wallets.
30// Only project recipients can call this function.
31//
32// Parameters:
33// - _: Noncrossing implementation-call discriminator; pass 0.
34// - rlm: Current realm context forwarded unchanged by the launchpad proxy; validated before collection.
35func (lp *launchpadV1) CollectEmissionReward(_ int, rlm realm) {
36 access.AssertIsRlmCurrent(0, rlm)
37
38 halt.AssertIsNotHaltedWithdraw()
39
40 previousRealm := rlm.Previous()
41
42 caller := previousRealm.Address()
43 lp.assertHasProject(caller)
44
45 gov_staker.CollectEmissionRewardFromLaunchPad(cross(rlm), caller)
46}
47
48// CollectProtocolFeeReward collects one token path of protocol fee rewards from gov/staker for project recipient wallets.
49// Only project recipients can call this function.
50//
51// Parameters:
52// - _: Noncrossing implementation-call discriminator; pass 0.
53// - rlm: Current realm context forwarded unchanged by the launchpad proxy; validated before collection.
54// - tokenPath: token contract path whose protocol-fee reward is collected.
55func (lp *launchpadV1) CollectProtocolFeeReward(_ int, rlm realm, tokenPath string) {
56 access.AssertIsRlmCurrent(0, rlm)
57
58 halt.AssertIsNotHaltedWithdraw()
59
60 previousRealm := rlm.Previous()
61
62 caller := previousRealm.Address()
63 lp.assertHasProject(caller)
64
65 gov_staker.CollectProtocolFeeRewardFromLaunchPad(cross(rlm), caller, tokenPath)
66}