From 7d0de57259904cc07b0ce779a5c24c4c085ef21c Mon Sep 17 00:00:00 2001 From: Lee ByeongJun Date: Mon, 23 Dec 2024 15:09:40 +0900 Subject: [PATCH] chore: remove function prefix from error messages --- gov/governance/_GET_proposal.gno | 18 ++--- gov/governance/_GET_vote.gno | 22 +++--- gov/governance/config.gno | 2 +- gov/governance/execute.gno | 76 ++++++++++---------- gov/governance/proposal.gno | 12 ++-- gov/governance/vote.gno | 22 +++--- gov/staker/_RPC_api_history.gno | 4 +- gov/staker/clean_delegation_stat_history.gno | 2 - gov/staker/delegate_undelegate.gno | 8 +-- gov/staker/history.gno | 4 +- gov/staker/staker.gno | 24 +++---- gov/staker/token_register.gno | 16 ++--- 12 files changed, 104 insertions(+), 106 deletions(-) diff --git a/gov/governance/_GET_proposal.gno b/gov/governance/_GET_proposal.gno index 496b89dba..b66119020 100644 --- a/gov/governance/_GET_proposal.gno +++ b/gov/governance/_GET_proposal.gno @@ -9,7 +9,7 @@ func GetProposerByProposalId(proposalId uint64) string { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetProposerByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } @@ -21,7 +21,7 @@ func GetProposalTypeByProposalId(proposalId uint64) string { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetProposalTypeByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } @@ -33,7 +33,7 @@ func GetYeaByProposalId(proposalId uint64) string { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetYeaByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } @@ -45,7 +45,7 @@ func GetNayByProposalId(proposalId uint64) string { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetNayByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } @@ -57,7 +57,7 @@ func GetConfigVersionByProposalId(proposalId uint64) uint64 { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetConfigVersionByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } @@ -69,7 +69,7 @@ func GetQuorumAmountByProposalId(proposalId uint64) uint64 { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetQuorumAmountByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } @@ -81,7 +81,7 @@ func GetTitleByProposalId(proposalId uint64) string { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetTitleByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } @@ -93,7 +93,7 @@ func GetDescriptionByProposalId(proposalId uint64) string { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetDescriptionByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } @@ -105,7 +105,7 @@ func GetExecutionStateByProposalId(proposalId uint64) ExecutionState { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_proposal.gno__GetExecutionStateByProposalId() || proposalId(%d) not found", proposalId), + ufmt.Sprintf("proposalId(%d) not found", proposalId), )) } diff --git a/gov/governance/_GET_vote.gno b/gov/governance/_GET_vote.gno index 65780763f..b24aaea41 100644 --- a/gov/governance/_GET_vote.gno +++ b/gov/governance/_GET_vote.gno @@ -14,7 +14,7 @@ func GetVoteByVoteKey(voteKey string) bool { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVoteByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -26,7 +26,7 @@ func GetVoteYesByVoteKey(voteKey string) bool { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVoteYesByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -36,7 +36,7 @@ func GetVoteYesByVoteKey(voteKey string) bool { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVoteYesByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -48,7 +48,7 @@ func GetVoteWeightByVoteKey(voteKey string) uint64 { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVoteWeightByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -58,7 +58,7 @@ func GetVoteWeightByVoteKey(voteKey string) uint64 { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVoteWeightByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -70,7 +70,7 @@ func GetVotedHeightByVoteKey(voteKey string) uint64 { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVotedHeightByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -80,7 +80,7 @@ func GetVotedHeightByVoteKey(voteKey string) uint64 { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVotedHeightByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -92,7 +92,7 @@ func GetVotedAtByVoteKey(voteKey string) uint64 { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVotedAtByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -102,7 +102,7 @@ func GetVotedAtByVoteKey(voteKey string) uint64 { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("_GET_vote.gno__GetVotedAtByVoteKey() || voteKey(%s) not found", voteKey), + ufmt.Sprintf("voteKey(%s) not found", voteKey), )) } @@ -114,7 +114,7 @@ func divideVoteKeyToProposalIdAndUser(voteKey string) (uint64, std.Address) { if err != nil { panic(addDetailToError( errInvalidInput, - ufmt.Sprintf("_GET_vote.gno__divideVoteKeyToProposalIdAndUser() || voteKey(%s) is invalid", voteKey), + ufmt.Sprintf("voteKey(%s) is invalid", voteKey), )) } @@ -122,7 +122,7 @@ func divideVoteKeyToProposalIdAndUser(voteKey string) (uint64, std.Address) { if err != nil { panic(addDetailToError( errInvalidInput, - ufmt.Sprintf("_GET_vote.gno__divideVoteKeyToProposalIdAndUser() || proposalId(%s) is invalid", parts[0]), + ufmt.Sprintf("proposalId(%s) is invalid", parts[0]), )) } diff --git a/gov/governance/config.gno b/gov/governance/config.gno index f1501492e..a7c42fc21 100644 --- a/gov/governance/config.gno +++ b/gov/governance/config.gno @@ -147,7 +147,7 @@ func GetConfigVersion(version uint64) Config { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("config.gno__GetConfigVersion() || config version(%d) does not exist", version), + ufmt.Sprintf("config version(%d) does not exist", version), )) } diff --git a/gov/governance/execute.gno b/gov/governance/execute.gno index 48aceb63d..1ce3e2dfe 100644 --- a/gov/governance/execute.gno +++ b/gov/governance/execute.gno @@ -35,28 +35,28 @@ func Execute(proposalId uint64) { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("execute.gno__Execute() || proposalId(%d) does not exist, failed to execute", proposalId), + ufmt.Sprintf("proposalId(%d) does not exist, failed to execute", proposalId), )) } if proposal.ProposalType == "TEXT" { panic(addDetailToError( errTextProposalNotExecutable, - ufmt.Sprintf("execute.gno__Execute() || proposalId(%d) is a TEXT proposal, not executable", proposalId), + ufmt.Sprintf("proposalId(%d) is a TEXT proposal, not executable", proposalId), )) } if proposal.ExecutionState.Executed || proposal.ExecutionState.Canceled || proposal.ExecutionState.Rejected { panic(addDetailToError( errUnableToExecuteProposal, - ufmt.Sprintf("execute.gno__Execute() || proposalId(%d) has already executed(%t) or canceled(%t) or rejected(%t), failed to execute", proposalId, proposal.ExecutionState.Executed, proposal.ExecutionState.Canceled, proposal.ExecutionState.Rejected), + ufmt.Sprintf("proposalId(%d) has already executed(%t) or canceled(%t) or rejected(%t), failed to execute", proposalId, proposal.ExecutionState.Executed, proposal.ExecutionState.Canceled, proposal.ExecutionState.Rejected), )) } if !proposal.ExecutionState.Passed { panic(addDetailToError( errUnableToExecuteProposal, - ufmt.Sprintf("execute.gno__Execute() || proposalId(%d) has not passed, failed to execute", proposalId), + ufmt.Sprintf("proposalId(%d) has not passed, failed to execute", proposalId), )) } @@ -68,7 +68,7 @@ func Execute(proposalId uint64) { if now < windowStart { panic(addDetailToError( errBeforeProposalExecutionTime, - ufmt.Sprintf("execute.gno__Execute() || EXECUTION_WINDOW_NOT_STARTED (now(%d) < windowStart(%d))", now, windowStart), + ufmt.Sprintf("EXECUTION_WINDOW_NOT_STARTED (now(%d) < windowStart(%d))", now, windowStart), )) } @@ -76,7 +76,7 @@ func Execute(proposalId uint64) { if now >= windowEnd { panic(addDetailToError( errProposalExecutionTimeExpired, - ufmt.Sprintf("execute.gno__Execute() || EXECUTION_WINDOW_OVER (now(%d) >= windowEnd(%d))", now, windowEnd), + ufmt.Sprintf("EXECUTION_WINDOW_OVER (now(%d) >= windowEnd(%d))", now, windowEnd), )) } @@ -87,14 +87,14 @@ func Execute(proposalId uint64) { if yeaUint < quorumUint { panic(addDetailToError( errProposalQuorumNotSatisfied, - ufmt.Sprintf("execute.gno__Execute() || QUORUM_NOT_MET (yes(%d) < quorum(%d))", yeaUint, quorumUint), + ufmt.Sprintf("QUORUM_NOT_MET (yes(%d) < quorum(%d))", yeaUint, quorumUint), )) } if yeaUint < nayUint { panic(addDetailToError( errMoreNoVotesThanYesVotes, - ufmt.Sprintf("execute.gno__Execute() || NO_MAJORITY (yes(%d) < no(%d))", yeaUint, nayUint), + ufmt.Sprintf("NO_MAJORITY (yes(%d) < no(%d))", yeaUint, nayUint), )) } @@ -104,7 +104,7 @@ func Execute(proposalId uint64) { if !contains(registered, proposal.CommunityPoolSpend.TokenPath) { panic(addDetailToError( errNotRegisteredToCommunityPool, - ufmt.Sprintf("execute.gno__Execute() || token(%s) is not registered to community_pool", proposal.CommunityPoolSpend.TokenPath), + ufmt.Sprintf("token(%s) is not registered to community_pool", proposal.CommunityPoolSpend.TokenPath), )) } @@ -143,14 +143,14 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 8 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 8 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 8 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } @@ -160,14 +160,14 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } @@ -177,14 +177,14 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 7 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 7 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 7 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } @@ -194,7 +194,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 2 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 2 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 2 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -203,7 +203,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -212,7 +212,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -220,7 +220,7 @@ func callableMsg(pkgPath, function, params string) bool { default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } @@ -230,14 +230,14 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } @@ -247,14 +247,14 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } @@ -264,7 +264,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -273,7 +273,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 2 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 2 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 2 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -282,7 +282,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 2 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 2 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 2 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -291,7 +291,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -300,7 +300,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -309,7 +309,7 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 2 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 2 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 2 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true @@ -317,7 +317,7 @@ func callableMsg(pkgPath, function, params string) bool { default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } @@ -327,14 +327,14 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 1 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 1 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } @@ -344,21 +344,21 @@ func callableMsg(pkgPath, function, params string) bool { if len(param) != 3 { panic(addDetailToError( errInvalidFunctionParameters, - ufmt.Sprintf("execute.gno__callableMsg() || len(param) should be 3 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), + ufmt.Sprintf("len(param) should be 3 but got %d, for param %s (pkgPath %s and function %s)", len(param), params, pkgPath, function), )) } return true default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid function %s for pkgPath %s", function, pkgPath), + ufmt.Sprintf("invalid function %s for pkgPath %s", function, pkgPath), )) } default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__callableMsg() || invalid pkgPath(%s)", pkgPath), + ufmt.Sprintf("invalid pkgPath(%s)", pkgPath), )) } } @@ -369,7 +369,7 @@ func executeParameterChange(msgs []string) { if len(splitExe) != 3 { panic(addDetailToError( errInvalidInput, - ufmt.Sprintf("execute.gno__executeParameterChange() || invalid execution(%s) to split by *EXE*, seems like param didn't inputed", msg), + ufmt.Sprintf("invalid execution(%s) to split by *EXE*, seems like param didn't inputed", msg), )) } @@ -465,7 +465,7 @@ func executeParameterChange(msgs []string) { default: panic(addDetailToError( errNonExecutableFunction, - ufmt.Sprintf("execute.gno__executeParameterChange() || invalid package path(%s) and function name(%s)", pkgPath, funcName), + ufmt.Sprintf("invalid package path(%s) and function name(%s)", pkgPath, funcName), )) } @@ -616,7 +616,7 @@ func handleSingleBool(params []string) bool { default: panic(addDetailToError( errInvalidInput, - ufmt.Sprintf("execute.gno__handleSingleBool() || invalid bool(%s)", params[0]), + ufmt.Sprintf("invalid bool(%s)", params[0]), )) } } diff --git a/gov/governance/proposal.gno b/gov/governance/proposal.gno index b1ab82be4..a6306b66a 100644 --- a/gov/governance/proposal.gno +++ b/gov/governance/proposal.gno @@ -40,7 +40,7 @@ func ProposeText( if !enough { panic(addDetailToError( errNotEnoughBalance, - ufmt.Sprintf("governance.gno__ProposeText() || proposer(%s) has not enough xGNS, balance(%d), wanted(%d)", proposer.String(), balance, wanted), + ufmt.Sprintf("proposer(%s) has not enough xGNS, balance(%d), wanted(%d)", proposer.String(), balance, wanted), )) } @@ -104,7 +104,7 @@ func ProposeCommunityPoolSpend( if !enough { panic(addDetailToError( errNotEnoughBalance, - ufmt.Sprintf("governance.gno__ProposeCommunityPoolSpend() || proposer(%s) has not enough xGNS, balance(%d), wanted(%d)", proposer.String(), balance, wanted), + ufmt.Sprintf("proposer(%s) has not enough xGNS, balance(%d), wanted(%d)", proposer.String(), balance, wanted), )) } @@ -175,14 +175,14 @@ func ProposeParameterChange( if !enough { panic(addDetailToError( errNotEnoughBalance, - ufmt.Sprintf("governance.gno__ProposeParameterChange() || proposer(%s) has not enough xGNS, balance(%d), wanted(%d)", proposer.String(), balance, wanted), + ufmt.Sprintf("proposer(%s) has not enough xGNS, balance(%d), wanted(%d)", proposer.String(), balance, wanted), )) } if numToExecute == 0 { panic(addDetailToError( errInvalidInput, - ufmt.Sprintf("governance.gno__ProposeParameterChange() || numToExecute is 0"), + ufmt.Sprintf("numToExecute is 0"), )) } @@ -191,7 +191,7 @@ func ProposeParameterChange( if uint64(len(splitGov)) != numToExecute { panic(addDetailToError( errInvalidInput, - ufmt.Sprintf("governance.gno__ProposeParameterChange() || numToExecute(%d) does not match the number of executions(%d)", numToExecute, len(splitGov)), + ufmt.Sprintf("numToExecute(%d) does not match the number of executions(%d)", numToExecute, len(splitGov)), )) } @@ -201,7 +201,7 @@ func ProposeParameterChange( if len(splitExe) != 3 { panic(addDetailToError( errInvalidInput, - ufmt.Sprintf("governance.gno__ProposeParameterChange() || invalid execution(%s) to split by *EXE*, seems like param didn't passed", gov), + ufmt.Sprintf("invalid execution(%s) to split by *EXE*, seems like param didn't passed", gov), )) } diff --git a/gov/governance/vote.gno b/gov/governance/vote.gno index 5ab43f17c..2580ee8c0 100644 --- a/gov/governance/vote.gno +++ b/gov/governance/vote.gno @@ -38,7 +38,7 @@ func Vote(proposalId uint64, yes bool) string { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("vote.gno__Vote() || proposalId(%d) does not exist", proposalId), + ufmt.Sprintf("proposalId(%d) does not exist", proposalId), )) } @@ -51,7 +51,7 @@ func Vote(proposalId uint64, yes bool) string { if now < votingStartTime { panic(addDetailToError( errUnableToVoteBeforeStarting, - ufmt.Sprintf("vote.gno__Vote() || voting has not started yet. now(%d) < votingStart(%d)", now, votingStartTime), + ufmt.Sprintf("voting has not started yet. now(%d) < votingStart(%d)", now, votingStartTime), )) } @@ -59,7 +59,7 @@ func Vote(proposalId uint64, yes bool) string { if now >= votingEndTime { panic(addDetailToError( errUnableToVoteAfterEnding, - ufmt.Sprintf("vote.gno__Vote() || voting has ended. now(%d) >= votingEnd(%d)", now, votingEndTime), + ufmt.Sprintf("voting has ended. now(%d) >= votingEnd(%d)", now, votingEndTime), )) } @@ -67,7 +67,7 @@ func Vote(proposalId uint64, yes bool) string { if proposal.ExecutionState.Canceled { panic(addDetailToError( errUnableToVoteCanceledProposal, - ufmt.Sprintf("vote.gno__Vote() || proposalId(%d) has canceled(%t)", proposalId, proposal.ExecutionState.Canceled), + ufmt.Sprintf("proposalId(%d) has canceled(%t)", proposalId, proposal.ExecutionState.Canceled), )) } @@ -76,7 +76,7 @@ func Vote(proposalId uint64, yes bool) string { if voted { panic(addDetailToError( errAlreadyVoted, - ufmt.Sprintf("vote.gno__Vote() || user(%s) has already voted on proposalId(%d)", voter.String(), proposalId), + ufmt.Sprintf("user(%s) has already voted on proposalId(%d)", voter.String(), proposalId), )) } @@ -84,7 +84,7 @@ func Vote(proposalId uint64, yes bool) string { if !exist || weight == 0 { panic(addDetailToError( errNotEnoughVotingWeight, - ufmt.Sprintf("vote.gno__Vote() || no voting weight found for voter(%s)", voter.String()), + ufmt.Sprintf("no voting weight found for voter(%s)", voter.String()), )) } @@ -94,7 +94,7 @@ func Vote(proposalId uint64, yes bool) string { if overflow { panic(addDetailToError( errOutOfRange, - "vote.gno__Vote() || VOTE YES OVERFLOW", + "VOTE YES OVERFLOW", )) } } else { @@ -102,7 +102,7 @@ func Vote(proposalId uint64, yes bool) string { if overflow { panic(addDetailToError( errOutOfRange, - "vote.gno__Vote() || VOTE NO OVERFLOW", + "VOTE NO OVERFLOW", )) } } @@ -146,14 +146,14 @@ func Cancel(proposalId uint64) { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("vote.gno__Cancel() || proposalId(%d) does not exist", proposalId), + ufmt.Sprintf("proposalId(%d) does not exist", proposalId), )) } if proposal.ExecutionState.Canceled { panic(addDetailToError( errAlreadyCanceledProposal, - ufmt.Sprintf("vote.gno__Cancel() || proposalId(%d) has already canceled", proposalId), + ufmt.Sprintf("proposalId(%d) has already canceled", proposalId), )) } @@ -162,7 +162,7 @@ func Cancel(proposalId uint64) { if now >= (proposal.ExecutionState.CreatedAt + config.VotingStartDelay) { panic(addDetailToError( errUnableToCancleVotingProposal, - ufmt.Sprintf("vote.gno__Cancel() || voting has already started for proposalId(%d)", proposalId), + ufmt.Sprintf("voting has already started for proposalId(%d)", proposalId), )) } diff --git a/gov/staker/_RPC_api_history.gno b/gov/staker/_RPC_api_history.gno index b001042c0..7500b2824 100644 --- a/gov/staker/_RPC_api_history.gno +++ b/gov/staker/_RPC_api_history.gno @@ -18,7 +18,7 @@ func GetPossibleVotingAddressWithWeight(endTimestamp uint64) (uint64, map[std.Ad if endTimestamp > uint64(time.Now().Unix()) { panic(addDetailToError( errFutureTime, - ufmt.Sprintf("_RPC_api_history.gno__GetPossibleVotingAddressWithWeight() || endTimestamp(%d) > now(%d)", endTimestamp, time.Now().Unix()), + ufmt.Sprintf("endTimestamp(%d) > now(%d)", endTimestamp, time.Now().Unix()), )) } @@ -52,7 +52,7 @@ func GetPossibleVotingAddressWithWeightJSON(endTimestamp uint64) (uint64, string if endTimestamp > uint64(time.Now().Unix()) { panic(addDetailToError( errFutureTime, - ufmt.Sprintf("_RPC_api_history.gno__GetPossibleVotingAddressWithWeightJSON() || endTimestamp(%d) > now(%d)", endTimestamp, time.Now().Unix()), + ufmt.Sprintf("endTimestamp(%d) > now(%d)", endTimestamp, time.Now().Unix()), )) } diff --git a/gov/staker/clean_delegation_stat_history.gno b/gov/staker/clean_delegation_stat_history.gno index d8178d914..ec54ebcdc 100644 --- a/gov/staker/clean_delegation_stat_history.gno +++ b/gov/staker/clean_delegation_stat_history.gno @@ -3,8 +3,6 @@ package staker import ( "std" - "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/v1/consts" "gno.land/r/gnoswap/v1/common" ) diff --git a/gov/staker/delegate_undelegate.gno b/gov/staker/delegate_undelegate.gno index 0b3177f4e..e07f3e1d6 100644 --- a/gov/staker/delegate_undelegate.gno +++ b/gov/staker/delegate_undelegate.gno @@ -62,7 +62,7 @@ func undelegate(to std.Address, amount uint64) { if !exist { panic(addDetailToError( errNoDelegatedAmount, - ufmt.Sprintf("delegate_undelegate.gno__Undelegate() || caller(%s) has no delegated amount", caller), + ufmt.Sprintf("caller(%s) has no delegated amount", caller), )) } @@ -70,14 +70,14 @@ func undelegate(to std.Address, amount uint64) { if !exist { panic(addDetailToError( errNoDelegatedTarget, - ufmt.Sprintf("delegate_undelegate.gno__Undelegate() || caller(%s) has no delegated amount to %s", caller, to), + ufmt.Sprintf("caller(%s) has no delegated amount to %s", caller, to), )) } if delegatedAmount < amount { panic(addDetailToError( errNotEnoughDelegated, - ufmt.Sprintf("delegate_undelegate.gno__Undelegate() || caller(%s) has only %d delegated amount(request: %d) to %s", caller, delegatedAmount, amount, to), + ufmt.Sprintf("caller(%s) has only %d delegated amount(request: %d) to %s", caller, delegatedAmount, amount, to), )) } @@ -101,7 +101,7 @@ func undelegate(to std.Address, amount uint64) { if !exist { panic(addDetailToError( errDataNotFound, - ufmt.Sprintf("delegate_undelegate.gno__Undelegate() || caller(%s) has no delegation stat history", caller), + ufmt.Sprintf("caller(%s) has no delegation stat history", caller), )) } diff --git a/gov/staker/history.gno b/gov/staker/history.gno index 76f9e0ba4..25e825e33 100644 --- a/gov/staker/history.gno +++ b/gov/staker/history.gno @@ -40,14 +40,14 @@ func GetDelegatedCumulative(delegator std.Address, endTimestamp uint64) uint64 { if !delegator.IsValid() { panic(addDetailToError( errInvalidAddress, - ufmt.Sprintf("history.gno__GetDelegatedCumulative() || invalid delegator address: %s", delegator.String()), + ufmt.Sprintf("invalid delegator address: %s", delegator.String()), )) } if endTimestamp > uint64(time.Now().Unix()) { panic(addDetailToError( errFutureTime, - ufmt.Sprintf("history.gno__GetDelegatedCumulative() || endTimestamp(%d) > now(%d)", endTimestamp, time.Now().Unix()), + ufmt.Sprintf("endTimestamp(%d) > now(%d)", endTimestamp, time.Now().Unix()), )) } diff --git a/gov/staker/staker.gno b/gov/staker/staker.gno index 3ee23a17e..28fd9ac24 100644 --- a/gov/staker/staker.gno +++ b/gov/staker/staker.gno @@ -46,14 +46,14 @@ func Delegate(to std.Address, amount uint64) { if !to.IsValid() { panic(addDetailToError( errInvalidAddress, - ufmt.Sprintf("staker.gno__Delegate() || invalid address %s to delegate", to.String()), + ufmt.Sprintf("invalid address %s to delegate", to.String()), )) } if amount < minimumAmount { panic(addDetailToError( errLessThanMinimum, - ufmt.Sprintf("staker.gno__Delegate() || minimum amount to delegate is %d (requested:%d)", minimumAmount, amount), + ufmt.Sprintf("minimum amount to delegate is %d (requested:%d)", minimumAmount, amount), )) } @@ -90,21 +90,21 @@ func Redelegate(from, to std.Address, amount uint64) { if !from.IsValid() { panic(addDetailToError( errInvalidAddress, - ufmt.Sprintf("staker.gno__Redelegate() || invalid from address %s to redelegate", to.String()), + ufmt.Sprintf("invalid from address %s to redelegate", to.String()), )) } if !to.IsValid() { panic(addDetailToError( errInvalidAddress, - ufmt.Sprintf("staker.gno__Redelegate() || invalid to address %s to redelegate", to.String()), + ufmt.Sprintf("invalid to address %s to redelegate", to.String()), )) } if amount < minimumAmount { panic(addDetailToError( errLessThanMinimum, - ufmt.Sprintf("staker.gno__Redelegate() || minimum amount to redelegate is %d (requested:%d)", minimumAmount, amount), + ufmt.Sprintf("minimum amount to redelegate is %d (requested:%d)", minimumAmount, amount), )) } @@ -114,7 +114,7 @@ func Redelegate(from, to std.Address, amount uint64) { if delegated < amount { panic(addDetailToError( errNotEnoughBalance, - ufmt.Sprintf("staker.gno__Redelegate() || not enough xGNS delegated(%d) to redelegate(%d)", delegated, amount), + ufmt.Sprintf("not enough xGNS delegated(%d) to redelegate(%d)", delegated, amount), )) } @@ -144,14 +144,14 @@ func Undelegate(from std.Address, amount uint64) { if !from.IsValid() { panic(addDetailToError( errInvalidAddress, - ufmt.Sprintf("staker.gno__Undelegate() || invalid address %s to undelegate", from.String()), + ufmt.Sprintf("invalid address %s to undelegate", from.String()), )) } if amount < minimumAmount { panic(addDetailToError( errLessThanMinimum, - ufmt.Sprintf("staker.gno__Undelegate() || minimum amount to undelegate is %d (requested:%d)", minimumAmount, amount), + ufmt.Sprintf("minimum amount to undelegate is %d (requested:%d)", minimumAmount, amount), )) } @@ -161,7 +161,7 @@ func Undelegate(from std.Address, amount uint64) { if delegated < amount { panic(addDetailToError( errNotEnoughBalance, - ufmt.Sprintf("staker.gno__Undelegate() || not enough xGNS delegated(%d) to undelegate(%d)", delegated, amount), + ufmt.Sprintf("not enough xGNS delegated(%d) to undelegate(%d)", delegated, amount), )) } @@ -248,7 +248,7 @@ func CollectReward() { if govStakerGnsBalance < emissionReward { panic(addDetailToError( errNotEnoughBalance, - ufmt.Sprintf("staker.gno__CollectReward() || not enough GNS(%d) in the realm to send emission reward(%d) for user %s", govStakerGnsBalance, emissionReward, caller.String()), + ufmt.Sprintf("ot enough GNS(%d) in the realm to send emission reward(%d) for user %s", govStakerGnsBalance, emissionReward, caller.String()), )) } @@ -307,7 +307,7 @@ func CollectRewardFromLaunchPad(to std.Address) { if caller != consts.LAUNCHPAD_ADDR { panic(addDetailToError( errNoPermission, - ufmt.Sprintf("staker.gno__CollectRewardFromLaunchPad() || only launchpad can call CollectRewardFromLaunchPad(), called from %s", caller.String()), + ufmt.Sprintf("only launchpad can call CollectRewardFromLaunchPad(), called from %s", caller.String()), )) } @@ -325,7 +325,7 @@ func CollectRewardFromLaunchPad(to std.Address) { if govStakerGnsBalance < emissionReward { panic(addDetailToError( errNotEnoughBalance, - ufmt.Sprintf("staker.gno__CollectRewardFromLaunchPad() || not enough GNS(%d) in the realm to send emission reward(%d) for user %s", govStakerGnsBalance, emissionReward, to.String()), + ufmt.Sprintf("not enough GNS(%d) in the realm to send emission reward(%d) for user %s", govStakerGnsBalance, emissionReward, to.String()), )) } diff --git a/gov/staker/token_register.gno b/gov/staker/token_register.gno index 8f57bef17..94ad41836 100644 --- a/gov/staker/token_register.gno +++ b/gov/staker/token_register.gno @@ -44,7 +44,7 @@ func RegisterGRC20Interface(pkgPath string, igrc20 GRC20Interface) { if !(prevAddr == consts.TOKEN_REGISTER || prevPath == consts.INIT_REGISTER_PATH || strings.HasPrefix(prevPath, consts.TOKEN_REGISTER_NAMESPACE)) { panic(addDetailToError( errNoPermission, - ufmt.Sprintf("token_register.gno__RegisterGRC20Interface() || only register(%s) can register token, called from %s", consts.TOKEN_REGISTER, prevAddr), + ufmt.Sprintf("only register(%s) can register token, called from %s", consts.TOKEN_REGISTER, prevAddr), )) } @@ -54,7 +54,7 @@ func RegisterGRC20Interface(pkgPath string, igrc20 GRC20Interface) { if found { panic(addDetailToError( errAlreadyRegistered, - ufmt.Sprintf("token_register.gno__RegisterGRC20Interface() || token(%s) already registered", pkgPath), + ufmt.Sprintf("token(%s) already registered", pkgPath), )) } @@ -90,7 +90,7 @@ func transferByRegisterCall(pkgPath string, to std.Address, amount uint64) bool if !found { panic(addDetailToError( errNotRegistered, - ufmt.Sprintf("token_register.gno__transferByRegisterCall() || token(%s) not registered", pkgPath), + ufmt.Sprintf("token(%s) not registered", pkgPath), )) } @@ -104,7 +104,7 @@ func transferByRegisterCall(pkgPath string, to std.Address, amount uint64) bool } else { panic(addDetailToError( errLocked, - ufmt.Sprintf("token_register.gno__transferByRegisterCall() || expected locked(%t) to be false", locked), + ufmt.Sprintf("expected locked(%t) to be false", locked), )) } return true @@ -117,7 +117,7 @@ func transferFromByRegisterCall(pkgPath string, from, to std.Address, amount uin if !found { panic(addDetailToError( errNotRegistered, - ufmt.Sprintf("token_register.gno__transferFromByRegisterCall() || token(%s) not registered", pkgPath), + ufmt.Sprintf("token(%s) not registered", pkgPath), )) } @@ -131,7 +131,7 @@ func transferFromByRegisterCall(pkgPath string, from, to std.Address, amount uin } else { panic(addDetailToError( errLocked, - ufmt.Sprintf("token_register.gno__transferFromByRegisterCall() || expected locked(%t) to be false", locked), + ufmt.Sprintf("expected locked(%t) to be false", locked), )) } return true @@ -144,7 +144,7 @@ func balanceOfByRegisterCall(pkgPath string, owner std.Address) uint64 { if !found { panic(addDetailToError( errNotRegistered, - ufmt.Sprintf("token_register.gno__balanceOfByRegisterCall() || token(%s) not registered", pkgPath), + ufmt.Sprintf("token(%s) not registered", pkgPath), )) } @@ -159,7 +159,7 @@ func approveByRegisterCall(pkgPath string, spender std.Address, amount uint64) b if !found { panic(addDetailToError( errNotRegistered, - ufmt.Sprintf("token_register.gno__approveByRegisterCall() || token(%s) not registered", pkgPath), + ufmt.Sprintf("token(%s) not registered", pkgPath), )) }