From 4d387207ac8431ad8c0f6d58b14df3bf53ba7e19 Mon Sep 17 00:00:00 2001 From: migueldingli1997 Date: Sun, 24 Oct 2021 20:07:56 +0200 Subject: [PATCH 1/3] Added suggestion about offline generation of MsgHarvest (cherry picked from commit 1df697f1fe1c289e18f618e999e7399885d05844) --- x/farming/client/cli/tx.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/x/farming/client/cli/tx.go b/x/farming/client/cli/tx.go index b7d2534f..581d565d 100644 --- a/x/farming/client/cli/tx.go +++ b/x/farming/client/cli/tx.go @@ -308,6 +308,13 @@ $ %s tx %s harvest --all --from mykey if !all { return fmt.Errorf("either staking-coin-denoms or --all flag must be specified") } + + // The transaction cannot be generated offline with --all flag since it + // requires a query to get all the staking denoms. + if clientCtx.Offline { + return fmt.Errorf("cannot generate tx in offline mode with --all flag") + } + queryClient := types.NewQueryClient(clientCtx) resp, err := queryClient.Stakings(cmd.Context(), &types.QueryStakingsRequest{ Farmer: farmer.String(), From ced8790ae9039a3ac01dd520ed6709a9db76ab63 Mon Sep 17 00:00:00 2001 From: dongsam Date: Wed, 24 Nov 2021 13:50:23 +0900 Subject: [PATCH 2/3] docs: add what TerminationAddress is used for --- x/farming/spec/01_concepts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/farming/spec/01_concepts.md b/x/farming/spec/01_concepts.md index 8d480049..8ca9a2d9 100644 --- a/x/farming/spec/01_concepts.md +++ b/x/farming/spec/01_concepts.md @@ -21,7 +21,7 @@ A public farming plan can be created only through governance proposal. A private farming plan can be created with any account. -- The account address of the plan creator account is used as the `TerminationAddress`. +- The account address of the plan creator account is used as the `TerminationAddress`, when the plan ends after the end time, the balance of the farming pool address is transferred to the termination address. - To prevent spamming attacks, the `PlanCreationFee` fee must be paid on plan creation. - Internally, the private plan's farming pool address is derived from the following derivation rule of `address.Module(ModuleName, []byte("PrivatePlan|{planId}|{planName}"))` and it is assigned to the plan. - After creation, need to query the plan and send the amount of coins to the farming pool address so that the plan distributes as intended. From 801b71481b0b02b59821ab775af4ae1038570455 Mon Sep 17 00:00:00 2001 From: dongsam Date: Wed, 24 Nov 2021 14:29:36 +0900 Subject: [PATCH 3/3] Update x/farming/spec/01_concepts.md Co-authored-by: Hanjun Kim --- x/farming/spec/01_concepts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/farming/spec/01_concepts.md b/x/farming/spec/01_concepts.md index 8ca9a2d9..5f2b8617 100644 --- a/x/farming/spec/01_concepts.md +++ b/x/farming/spec/01_concepts.md @@ -21,7 +21,7 @@ A public farming plan can be created only through governance proposal. A private farming plan can be created with any account. -- The account address of the plan creator account is used as the `TerminationAddress`, when the plan ends after the end time, the balance of the farming pool address is transferred to the termination address. +- The address of the plan creator account is used as the `TerminationAddress`. When the plan ends after its end time, the balance of the farming pool address is transferred to the termination address. - To prevent spamming attacks, the `PlanCreationFee` fee must be paid on plan creation. - Internally, the private plan's farming pool address is derived from the following derivation rule of `address.Module(ModuleName, []byte("PrivatePlan|{planId}|{planName}"))` and it is assigned to the plan. - After creation, need to query the plan and send the amount of coins to the farming pool address so that the plan distributes as intended.