Skip to content

Commit 7e23d79

Browse files
committed
update feegrant in price-feeder tool
1 parent 9135f7e commit 7e23d79

File tree

6 files changed

+16
-3
lines changed

6 files changed

+16
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ bin
1010
# emacs editor config
1111
\#*\#
1212
.\#*
13+
*.toml

price-feeder/cmd/price-feeder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func priceFeederCmdHandler(cmd *cobra.Command, args []string) error {
142142
cfg.RPC.GRPCEndpoint,
143143
cfg.GasAdjustment,
144144
cfg.GasPrice,
145+
cfg.FeeGrantAddress,
145146
)
146147
if err != nil {
147148
return err

price-feeder/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
gas_adjustment = 1.5
22
provider_min_override = true
33
gas_price = "0.0001stake"
4-
fee_grant_address = "juno1ej3gmuwr5t6jm928fze9dwfd8qu6226uxcwskq"
4+
fee_grant_address = ""
55

66
[server]
77
listen_addr = "0.0.0.0:7171"
@@ -89,7 +89,7 @@ prefix = "juno"
8989

9090
[keyring]
9191
backend = "test"
92-
dir = "/home/vuong/.juno"
92+
dir = "/home/<user>/.juno"
9393

9494
[rpc]
9595
grpc_endpoint = "localhost:9090"

price-feeder/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ type (
7878
ProviderMinOverride bool `mapstructure:"provider_min_override"`
7979
ProviderEndpoints []provider.Endpoint `mapstructure:"provider_endpoints" validate:"dive"`
8080
GasPrice string `mapstructure:"gas_price"`
81+
FeeGrantAddress string `mapstructure:"fee_grant_address"`
8182
}
8283

8384
// Server defines the API server configuration.

price-feeder/oracle/client/client.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type (
4141
ValidatorAddrString string
4242
Encoding junoparams.EncodingConfig
4343
GasPrices string
44+
FeeGrantAddress string
4445
GasAdjustment float64
4546
GRPCEndpoint string
4647
KeyringPassphrase string
@@ -67,6 +68,7 @@ func NewOracleClient(
6768
grpcEndpoint string,
6869
gasAdjustment float64,
6970
gasPrice string,
71+
feeGrantAddress string,
7072
) (OracleClient, error) {
7173

7274
oracleAddr, err := sdk.AccAddressFromBech32(oracleAddrString)
@@ -89,6 +91,7 @@ func NewOracleClient(
8991
GasAdjustment: gasAdjustment,
9092
GRPCEndpoint: grpcEndpoint,
9193
GasPrices: gasPrice,
94+
FeeGrantAddress: feeGrantAddress,
9295
}
9396

9497
clientCtx, err := oracleClient.CreateClientContext()
@@ -164,6 +167,13 @@ func (oc OracleClient) BroadcastTx(nextBlockHeight, timeoutHeight int64, msgs ..
164167

165168
// set last check height to latest block height
166169
lastCheckHeight = latestBlockHeight
170+
if oc.FeeGrantAddress != "" {
171+
feeGrandAccAddress, err := sdk.AccAddressFromBech32(oc.FeeGrantAddress)
172+
if err != nil {
173+
return err
174+
}
175+
clientCtx = clientCtx.WithFeeGranterAddress(feeGrandAccAddress)
176+
}
167177

168178
resp, err := BroadcastTx(clientCtx, factory, oc.GasPrices, msgs...)
169179
if resp != nil && resp.Code != 0 {

price-feeder/oracle/client/tx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ func BroadcastTx(clientCtx client.Context, txf tx.Factory, gasPrice string, msgs
3333

3434
feeAmount, err := calculateFeeAmount(gasPrice, adjusted)
3535
unsignedTx.SetFeeAmount(feeAmount)
36-
3736
unsignedTx.SetFeeGranter(clientCtx.GetFeeGranterAddress())
37+
3838
// unsignedTx.SetFeePayer(clientCtx.GetFeePayerAddress())
3939

4040
if err = tx.Sign(txf, clientCtx.GetFromName(), unsignedTx, true); err != nil {

0 commit comments

Comments
 (0)