Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

launchpad_protocol_fee.gno

1.56 Kb · 59 lines
 1package launchpad
 2
 3import (
 4	"errors"
 5
 6	gov_staker "gno.land/r/gnoswap/gov/staker"
 7	"gno.land/r/gnoswap/halt"
 8)
 9
10// CollectProtocolFee collects protocol fee from gov/staker for project recipient wallets.
11// Only project recipients can call this function.
12func (lp *launchpadV1) CollectProtocolFee(_ int, rlm realm) {
13	if !rlm.IsCurrent() {
14		panic(errors.New(errSpoofedRealm))
15	}
16
17	halt.AssertIsNotHaltedWithdraw()
18
19	previousRealm := rlm.Previous()
20
21	caller := previousRealm.Address()
22	lp.assertHasProject(caller)
23
24	gov_staker.CollectRewardFromLaunchPad(cross(rlm), caller)
25}
26
27// CollectEmissionReward collects emission rewards from gov/staker for project recipient wallets.
28// Only project recipients can call this function.
29func (lp *launchpadV1) CollectEmissionReward(_ int, rlm realm) {
30	if !rlm.IsCurrent() {
31		panic(errors.New(errSpoofedRealm))
32	}
33
34	halt.AssertIsNotHaltedWithdraw()
35
36	previousRealm := rlm.Previous()
37
38	caller := previousRealm.Address()
39	lp.assertHasProject(caller)
40
41	gov_staker.CollectEmissionRewardFromLaunchPad(cross(rlm), caller)
42}
43
44// CollectProtocolFeeReward collects one token path of protocol fee rewards from gov/staker for project recipient wallets.
45// Only project recipients can call this function.
46func (lp *launchpadV1) CollectProtocolFeeReward(_ int, rlm realm, tokenPath string) {
47	if !rlm.IsCurrent() {
48		panic(errors.New(errSpoofedRealm))
49	}
50
51	halt.AssertIsNotHaltedWithdraw()
52
53	previousRealm := rlm.Previous()
54
55	caller := previousRealm.Address()
56	lp.assertHasProject(caller)
57
58	gov_staker.CollectProtocolFeeRewardFromLaunchPad(cross(rlm), caller, tokenPath)
59}