1
1
package v4
2
2
3
3
import (
4
- "fmt"
5
4
"strconv"
6
5
"strings"
7
6
8
7
sdk "github.com/cosmos/cosmos-sdk/types"
9
8
10
9
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
11
10
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
12
-
13
11
"github.com/terpnetwork/terp-core/v2/app/upgrades"
12
+
13
+ v3 "github.com/terpnetwork/terp-core/v2/app/upgrades/v3"
14
14
)
15
15
16
- // revert headstash allocation by depositing funds back into community pool
17
- func ReturnFundsToCommunityPool (ctx sdk.Context , dk keepers.DistrKeeper , bk keepers.BankKeeper ) error {
18
-
19
- headstashes := GetHeadstashPayments ()
20
-
21
- nativeDenom := upgrades .GetChainsDenomToken (ctx .ChainID ())
22
- nativeFeeDenom := upgrades .GetChainsFeeDenomToken (ctx .ChainID ())
23
-
24
- for _ , headstash := range headstashes {
25
- addr , err := sdk .AccAddressFromBech32 (headstash [0 ])
26
- if err != nil {
27
- panic (err )
28
- }
29
- // defines the value associated with a given address
30
- amount , err := strconv .ParseInt (strings .TrimSpace (headstash [1 ]), 10 , 64 )
31
- if err != nil {
32
- panic (err )
33
- }
34
- terpcoins := sdk .NewCoins (
35
- sdk .NewInt64Coin (nativeDenom , amount ),
36
- )
37
- thiolcoins := sdk .NewCoins (
38
- sdk .NewInt64Coin (nativeFeeDenom , amount ),
39
- )
40
- if err := dsk .FundCommunityPool (ctx , terpcoins , addr ); err != nil {
41
- panic (err )
42
- }
43
- if err := dsk .FundCommunityPool (ctx , thiolcoins , addr ); err != nil {
44
- panic (err )
45
- }
46
- total += amount
47
- }
16
+ // revert headstash allocation by depositing funds back into community pool
17
+ func ReturnFundsToCommunityPool (
18
+ ctx sdk.Context ,
19
+ dk distrkeeper.Keeper ,
20
+ bk bankkeeper.Keeper ,
21
+ ) {
22
+
23
+ headstashes := v3 .GetHeadstashPayments ()
24
+ total := int64 (0 )
25
+
26
+ nativeDenom := upgrades .GetChainsDenomToken (ctx .ChainID ())
27
+ nativeFeeDenom := upgrades .GetChainsFeeDenomToken (ctx .ChainID ())
48
28
29
+ for _ , headstash := range headstashes {
30
+ addr , err := sdk .AccAddressFromBech32 (headstash [0 ])
31
+ if err != nil {
32
+ panic (err )
33
+ }
34
+ // defines the value associated with a given address
35
+ amount , err := strconv .ParseInt (strings .TrimSpace (headstash [1 ]), 10 , 64 )
36
+ if err != nil {
37
+ panic (err )
38
+ }
39
+ terpcoins := sdk .NewCoins (
40
+ sdk .NewInt64Coin (nativeDenom , amount ),
41
+ )
42
+ thiolcoins := sdk .NewCoins (
43
+ sdk .NewInt64Coin (nativeFeeDenom , amount ),
44
+ )
45
+ if err := dk .FundCommunityPool (ctx , terpcoins , addr ); err != nil {
46
+ panic (err )
47
+ }
48
+ if err := dk .FundCommunityPool (ctx , thiolcoins , addr ); err != nil {
49
+ panic (err )
50
+ }
51
+ total += amount
49
52
}
50
53
51
- // TODO: handle headstash-patch contract upload & instantiation
54
+ }
55
+
56
+ // TODO: handle headstash-patch contract upload & instantiation
0 commit comments