-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.go
73 lines (61 loc) · 2.74 KB
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package state
import (
"math/big"
"time"
v110rc1_rewards "github.com/Seb369888/poolsea-go/legacy/v1.1.0-rc1/rewards"
"github.com/Seb369888/poolsea-go/rewards"
"github.com/Seb369888/poolsea-go/rocketpool"
"github.com/Seb369888/smartnode/shared/services/config"
cfgtypes "github.com/Seb369888/smartnode/shared/types/config"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
)
func GetClaimIntervalTime(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (time.Duration, error) {
switch cfg.Smartnode.Network.Value.(cfgtypes.Network) {
case cfgtypes.Network_Prater:
if index < 2 {
contractAddress := cfg.Smartnode.GetPreviousRewardsPoolAddresses()["v1.1.0-rc1"][0]
return v110rc1_rewards.GetClaimIntervalTime(rp, opts, &contractAddress)
}
}
return rewards.GetClaimIntervalTime(rp, opts)
}
func GetNodeOperatorRewardsPercent(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error) {
switch cfg.Smartnode.Network.Value.(cfgtypes.Network) {
case cfgtypes.Network_Prater:
if index < 2 {
contractAddress := cfg.Smartnode.GetPreviousRewardsPoolAddresses()["v1.1.0-rc1"][0]
return v110rc1_rewards.GetNodeOperatorRewardsPercent(rp, opts, &contractAddress)
}
}
return rewards.GetNodeOperatorRewardsPercent(rp, opts)
}
func GetTrustedNodeOperatorRewardsPercent(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error) {
switch cfg.Smartnode.Network.Value.(cfgtypes.Network) {
case cfgtypes.Network_Prater:
if index < 2 {
contractAddress := cfg.Smartnode.GetPreviousRewardsPoolAddresses()["v1.1.0-rc1"][0]
return v110rc1_rewards.GetTrustedNodeOperatorRewardsPercent(rp, opts, &contractAddress)
}
}
return rewards.GetTrustedNodeOperatorRewardsPercent(rp, opts)
}
func GetProtocolDaoRewardsPercent(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error) {
switch cfg.Smartnode.Network.Value.(cfgtypes.Network) {
case cfgtypes.Network_Prater:
if index < 2 {
contractAddress := cfg.Smartnode.GetPreviousRewardsPoolAddresses()["v1.1.0-rc1"][0]
return v110rc1_rewards.GetProtocolDaoRewardsPercent(rp, opts, &contractAddress)
}
}
return rewards.GetProtocolDaoRewardsPercent(rp, opts)
}
func GetPendingRPLRewards(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error) {
switch cfg.Smartnode.Network.Value.(cfgtypes.Network) {
case cfgtypes.Network_Prater:
if index < 2 {
contractAddress := cfg.Smartnode.GetPreviousRewardsPoolAddresses()["v1.1.0-rc1"][0]
return v110rc1_rewards.GetPendingRPLRewards(rp, opts, &contractAddress)
}
}
return rewards.GetPendingRPLRewards(rp, opts)
}