types

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2019 License: Apache-2.0 Imports: 7 Imported by: 38

README

Lino Blockchain Types

This directory is used to define all models in our internal blockchain storage. For example we need to define account and post here.

For example, in account model, we need to define all account KVStore models and provide a middleware to interact with all models related operation.

Design Doc. Cosmos Example.

Documentation

Index

Constants

View Source
const (
	// Decimals - Total decimals in Lino Blockchain
	// Used by both LNO and IDA.
	Decimals = 100000

	// KVStoreKey presents store which used by app
	MainKVStoreKey         = "main"
	AccountKVStoreKey      = "account"
	PostKVStoreKey         = "post"
	ValidatorKVStoreKey    = "validator"
	GlobalKVStoreKey       = "global"
	VoteKVStoreKey         = "vote"
	DeveloperKVStoreKey    = "developer"
	ParamKVStoreKey        = "param"
	ProposalKVStoreKey     = "proposal"
	ReputationV2KVStoreKey = "repv2"
	BandwidthKVStoreKey    = "bandwidth"
	PriceKVStoreKey        = "price"
	LinoCoinDenom          = "linocoin"

	// Different permission level for msg
	UnknownPermission                = Permission(0)
	AppPermission                    = Permission(1)
	TransactionPermission            = Permission(2)
	ResetPermission                  = Permission(3)
	GrantAppPermission               = Permission(4)
	PreAuthorizationPermission       = Permission(5)
	AppAndPreAuthorizationPermission = Permission(6)

	// since upgrade2
	// signed by the app or its affiliated accounts.
	AppOrAffiliatedPermission = Permission(7)

	// Different proposal result
	ProposalNotPass = ProposalResult(0)
	ProposalPass    = ProposalResult(1)
	ProposalRevoked = ProposalResult(2)

	// Different proposal types
	ChangeParam       = ProposalType(0)
	ContentCensorship = ProposalType(1)
	ProtocolUpgrade   = ProposalType(2)

	// Different donation types
	DirectDeposit = DonationType(0)
	Inflation     = DonationType(1)

	// Different possible incomes
	TransferIn           = TransferDetailType(0)
	DonationIn           = TransferDetailType(1)
	ClaimReward          = TransferDetailType(2)
	ValidatorInflation   = TransferDetailType(3)
	DeveloperInflation   = TransferDetailType(4)
	VoteReturnCoin       = TransferDetailType(6)
	DelegationReturnCoin = TransferDetailType(7)
	ValidatorReturnCoin  = TransferDetailType(8)
	DeveloperReturnCoin  = TransferDetailType(9)
	ProposalReturnCoin   = TransferDetailType(11)
	GenesisCoin          = TransferDetailType(12)
	ClaimInterest        = TransferDetailType(13)

	// Different possible outcomes
	TransferOut      = TransferDetailType(20)
	DonationOut      = TransferDetailType(21)
	Delegate         = TransferDetailType(22)
	VoterDeposit     = TransferDetailType(23)
	ValidatorDeposit = TransferDetailType(24)
	DeveloperDeposit = TransferDetailType(25)
	ProposalDeposit  = TransferDetailType(27)

	// punishment type
	UnknownPunish      = PunishType(0)
	PunishByzantine    = PunishType(1)
	PunishAbsentCommit = PunishType(2)
	PunishDidntVote    = PunishType(3)
	PunishNoPriceFed   = PunishType(4)

	// UsernameReCheck - UsernameReCheck is used to check user registration
	UsernameReCheck        = "^[a-z]([a-z0-9-\\.]){1,19}[a-z0-9]$"
	IllegalUsernameReCheck = "^[a-z0-9\\.-]*([-\\.]){2,}[a-z0-9\\.-]*$"

	// MinimumUsernameLength - minimum username length
	MinimumUsernameLength = 3

	// MaximumUsernameLength - maximum username length
	MaximumUsernameLength = 20

	// MaximumMemoLength - maximum length of memo
	MaximumMemoLength = 100

	// MaximumJSONMetaLength - maximum length of account JSON meta
	MaximumJSONMetaLength = 500

	// MaxPostTitleLength - maximum length of post title
	MaxPostTitleLength = 100

	// MaxPostContentLength - maximum length of post content
	MaxPostContentLength = 1000

	// MaxGranPermValiditySec - maximum validity period, 10 years
	MaxGranPermValiditySec = 10 * 3600 * 24 * 365

	// KeySeparator - separate different key component
	KeySeparator = "/"

	// HoursPerYear - as defined by a julian year of 365.25 days
	HoursPerYear = 8766

	// MinutesPerYear - as defined by a julian year of 365.25 days
	MinutesPerYear = HoursPerYear * 60

	// MinutesPerMonth - as defined by a julian year of 365.25 days
	MinutesPerMonth = MinutesPerYear / 12

	// MinutesPerDay - as defined by a julian year of 365.25 days
	MinutesPerDay = 60 * 24

	// MaximumSdkRatLength - maximum length of sdk.Dec can pass into blockchain
	MaximumSdkRatLength = 10

	// MaximumLinkIdentifier - maximum length of Links identifier
	MaximumLinkIdentifier = 20

	// MaximumLinkURL - maximum length of Links URL
	MaximumLinkURL = 100

	// MaximumLengthOfPostID - maximum length of post ID
	MaximumLengthOfPostID = 50

	// MaximumNumOfLinks - maximum number of links per post
	MaximumNumOfLinks = 10

	// MaximumLengthOfDeveloperWebsite - maximum length of developer website
	MaximumLengthOfDeveloperWebsite = 100

	// MaximumLengthOfDeveloperDesctiption - maximum length of developer description
	MaximumLengthOfDeveloperDesctiption = 1000

	// MaximumLengthOfAppMetadata - maximum length of developer App meta data
	MaximumLengthOfAppMetadata = 1000

	// MaximumLengthOfProposalReason - maximum length of proposal reason
	MaximumLengthOfProposalReason = 1000

	// InitAccountWithFullCoinDayMemo - init account with full coin day memo
	InitAccountWithFullCoinDayMemo = "open account deposit"

	// InitAccountRegisterDepositMemo - init account deposit fee memo
	InitAccountRegisterDepositMemo = "init deposit"

	// PermlinkSeparator - permlink separator
	PermlinkSeparator = "#"

	// ParamChangeTimeout - time in secs for ParamChange to happen.
	ParamChangeTimeout = 3600

	// BalanceHistoryBundleSize - bundle size for balance history
	BalanceHistoryBundleSize = 100

	// RewardHistoryBundleSize - bundle size for reward history
	RewardHistoryBundleSize = 100

	// CoinDayRecordIntervalSec - coin day record in the same interval bucket will be merged
	CoinDayRecordIntervalSec = 1200

	// TendermintValidatorPower - every validator has const power in tendermint engine.
	TendermintValidatorPower = 1000

	// MaxVotedValidator - the max validators a voter can vote
	MaxVotedValidators = 50

	// ValidatorMaxPower - the max power of validator can have
	ValidatorMaxPower = int64(100000000000)

	// Upgrade3Update1 - lower register fee.
	Upgrade3Update1 = 27000

	// TxSigLimit - max number of sigs in one transaction
	// XXX(yumin): This will actually limit the number of msg per tx to at most 2.
	TxSigLimit = 2
)
View Source
const (
	// updated from int to string.
	// https://github.com/cosmos/cosmos-sdk/pull/2821
	LinoErrorCodeSpace = "lino"

	// Lino common errors reserve 100 ~ 149
	CodeInvalidUsername     sdk.CodeType = 100
	CodeAccountNotFound     sdk.CodeType = 101
	CodeFailedToMarshal     sdk.CodeType = 102
	CodeFailedToUnmarshal   sdk.CodeType = 103
	CodeIllegalWithdraw     sdk.CodeType = 104
	CodeInsufficientDeposit sdk.CodeType = 105
	CodeInvalidCoin         sdk.CodeType = 106
	CodePostNotFound        sdk.CodeType = 107
	CodeDeveloperNotFound   sdk.CodeType = 108
	CodeInvalidCoins        sdk.CodeType = 109
	CodeInvalidInt64Number  sdk.CodeType = 110
	CodeInvalidQueryPath    sdk.CodeType = 111
	CodeInvalidIDAAmount    sdk.CodeType = 112
	CodeUnimplemented       sdk.CodeType = 113
	CodeQueryFailed         sdk.CodeType = 114

	// Lino authenticate errors reserve 150 ~ 199
	CodeIncorrectStdTxType   sdk.CodeType = 150
	CodeNoSignatures         sdk.CodeType = 151
	CodeUnknownMsgType       sdk.CodeType = 152
	CodeWrongNumberOfSigners sdk.CodeType = 153
	CodeInvalidSequence      sdk.CodeType = 154
	CodeUnverifiedBytes      sdk.CodeType = 155
	CodeMsgFeeNotEnough      sdk.CodeType = 156

	// ABCI Response Codes
	CodeGenesisFailed sdk.CodeType = 200

	// Lino account errors reserve 300 ~ 399
	CodeRewardNotFound                       sdk.CodeType = 300
	CodeAccountMetaNotFound                  sdk.CodeType = 301
	CodeAccountInfoNotFound                  sdk.CodeType = 302
	CodeAccountBankNotFound                  sdk.CodeType = 303
	CodePendingCoinDayQueueNotFound          sdk.CodeType = 304
	CodeGrantPubKeyNotFound                  sdk.CodeType = 305
	CodeFailedToMarshalAccountInfo           sdk.CodeType = 306
	CodeFailedToMarshalAccountBank           sdk.CodeType = 307
	CodeFailedToMarshalAccountMeta           sdk.CodeType = 308
	CodeFailedToMarshalFollowerMeta          sdk.CodeType = 309
	CodeFailedToMarshalFollowingMeta         sdk.CodeType = 310
	CodeFailedToMarshalReward                sdk.CodeType = 311
	CodeFailedToMarshalPendingCoinDayQueue   sdk.CodeType = 312
	CodeFailedToMarshalGrantPubKey           sdk.CodeType = 313
	CodeFailedToMarshalRelationship          sdk.CodeType = 314
	CodeFailedToMarshalBalanceHistory        sdk.CodeType = 315
	CodeFailedToUnmarshalAccountInfo         sdk.CodeType = 316
	CodeFailedToUnmarshalAccountBank         sdk.CodeType = 317
	CodeFailedToUnmarshalAccountMeta         sdk.CodeType = 318
	CodeFailedToUnmarshalReward              sdk.CodeType = 319
	CodeFailedToUnmarshalPendingCoinDayQueue sdk.CodeType = 320
	CodeFailedToUnmarshalGrantPubKey         sdk.CodeType = 321
	CodeFailedToUnmarshalRelationship        sdk.CodeType = 322
	CodeFailedToUnmarshalBalanceHistory      sdk.CodeType = 323
	CodeFolloweeNotFound                     sdk.CodeType = 324
	CodeFollowerNotFound                     sdk.CodeType = 325
	CodeReceiverNotFound                     sdk.CodeType = 326
	CodeSenderNotFound                       sdk.CodeType = 327
	CodeReferrerNotFound                     sdk.CodeType = 328
	CodeAddSavingCoinWithFullCoinDay         sdk.CodeType = 329
	CodeAddSavingCoin                        sdk.CodeType = 330
	CodeInvalidMemo                          sdk.CodeType = 331
	CodeInvalidJSONMeta                      sdk.CodeType = 332
	CodeCheckResetKey                        sdk.CodeType = 333
	CodeCheckTransactionKey                  sdk.CodeType = 334
	CodeCheckGrantAppKey                     sdk.CodeType = 335
	CodeCheckAuthenticatePubKeyOwner         sdk.CodeType = 336
	CodeGrantKeyExpired                      sdk.CodeType = 337
	CodeGrantKeyNoLeftTimes                  sdk.CodeType = 338
	CodeGrantKeyMismatch                     sdk.CodeType = 339
	CodeAppGrantKeyMismatch                  sdk.CodeType = 340
	CodeGetResetKey                          sdk.CodeType = 341
	CodeGetTransactionKey                    sdk.CodeType = 342
	CodeGetAppKey                            sdk.CodeType = 343
	CodeGetSavingFromBank                    sdk.CodeType = 344
	CodeGetSequence                          sdk.CodeType = 345
	CodeGetLastReportOrUpvoteAt              sdk.CodeType = 346
	CodeUpdateLastReportOrUpvoteAt           sdk.CodeType = 347
	CodeGetFrozenMoneyList                   sdk.CodeType = 348
	CodeIncreaseSequenceByOne                sdk.CodeType = 349
	CodeGrantTimesExceedsLimitation          sdk.CodeType = 350
	CodeUnsupportGrantLevel                  sdk.CodeType = 351
	CodeRevokePermissionLevelMismatch        sdk.CodeType = 352
	CodeCheckUserTPSCapacity                 sdk.CodeType = 353
	CodeAccountTPSCapacityNotEnough          sdk.CodeType = 354
	CodeAccountSavingCoinNotEnough           sdk.CodeType = 355
	CodeAccountAlreadyExists                 sdk.CodeType = 356
	CodeRegisterFeeInsufficient              sdk.CodeType = 357
	CodeFailedToMarshalRewardHistory         sdk.CodeType = 358
	CodeFailedToUnmarshalRewardHistory       sdk.CodeType = 359
	CodeGetLastPostAt                        sdk.CodeType = 360
	CodeUpdateLastPostAt                     sdk.CodeType = 361
	CodeFrozenMoneyListTooLong               sdk.CodeType = 362
	CodeAccountQueryFailed                   sdk.CodeType = 363
	CodeGetSigningKeyFailed                  sdk.CodeType = 364
	CodeGetAddressFailed                     sdk.CodeType = 365
	CodeAddressIsTaken                       sdk.CodeType = 366

	// Lino post errors reserve 400 ~ 499
	CodePostMetaNotFound                     sdk.CodeType = 400
	CodePostReportOrUpvoteNotFound           sdk.CodeType = 401
	CodePostCommentNotFound                  sdk.CodeType = 402
	CodePostViewNotFound                     sdk.CodeType = 403
	CodePostDonationNotFound                 sdk.CodeType = 404
	CodeFailedToMarshalPostInfo              sdk.CodeType = 405
	CodeFailedToMarshalPostMeta              sdk.CodeType = 406
	CodeFailedToMarshalPostReportOrUpvote    sdk.CodeType = 407
	CodeFailedToMarshalPostComment           sdk.CodeType = 408
	CodeFailedToMarshalPostView              sdk.CodeType = 409
	CodeFailedToMarshalPostDonations         sdk.CodeType = 410
	CodeFailedToUnmarshalPostInfo            sdk.CodeType = 411
	CodeFailedToUnmarshalPostMeta            sdk.CodeType = 412
	CodeFailedToUnmarshalPostReportOrUpvote  sdk.CodeType = 413
	CodeFailedToUnmarshalPostComment         sdk.CodeType = 414
	CodeFailedToUnmarshalPostView            sdk.CodeType = 415
	CodeFailedToUnmarshalPostDonations       sdk.CodeType = 416
	CodePostAlreadyExist                     sdk.CodeType = 417
	CodeInvalidPostRedistributionSplitRate   sdk.CodeType = 418
	CodeDonatePostIsDeleted                  sdk.CodeType = 419
	CodeCannotDonateToSelf                   sdk.CodeType = 420
	CodeProcessSourceDonation                sdk.CodeType = 421
	CodeProcessDonation                      sdk.CodeType = 422
	CodeUpdatePostIsDeleted                  sdk.CodeType = 423
	CodeReportOrUpvoteTooOften               sdk.CodeType = 424
	CodeReportOrUpvoteAlreadyExist           sdk.CodeType = 425
	CodeNoPostID                             sdk.CodeType = 426
	CodePostIDTooLong                        sdk.CodeType = 427
	CodeInvalidAuthor                        sdk.CodeType = 428
	CodeNoUsername                           sdk.CodeType = 429
	CodeCommentAndRepostConflict             sdk.CodeType = 430
	CodePostTitleExceedMaxLength             sdk.CodeType = 431
	CodePostContentExceedMaxLength           sdk.CodeType = 432
	CodeRedistributionSplitRateLengthTooLong sdk.CodeType = 433
	CodeIdentifierLengthTooLong              sdk.CodeType = 434
	CodeURLLengthTooLong                     sdk.CodeType = 435
	CodeTooManyURL                           sdk.CodeType = 436
	CodeInvalidTarget                        sdk.CodeType = 437
	CodeCreatePostSourceInvalid              sdk.CodeType = 438
	CodeGetSourcePost                        sdk.CodeType = 439
	CodePostTooOften                         sdk.CodeType = 440
	CodePostQueryFailed                      sdk.CodeType = 441
	CodeInvalidCreatedBy                     sdk.CodeType = 442
	// Moved to developer's code space.
	// CodeInvalidSigner                        sdk.CodeType = 443
	CodeInvalidApp            sdk.CodeType = 444
	CodeNoDeletedBy           sdk.CodeType = 445
	CodeDonationAmountInvalid sdk.CodeType = 446
	CodeNonPositiveIDAAmount  sdk.CodeType = 447
	CodePostDeleted           sdk.CodeType = 448
	CodeDonateAmountTooLittle sdk.CodeType = 449

	// Lino validator errors reserve 500 ~ 599
	CodeValidatorNotFound              sdk.CodeType = 500
	CodeValidatorListNotFound          sdk.CodeType = 501
	CodeFailedToMarshalValidator       sdk.CodeType = 502
	CodeFailedToMarshalValidatorList   sdk.CodeType = 503
	CodeFailedToUnmarshalValidator     sdk.CodeType = 504
	CodeFailedToUnmarshalValidatorList sdk.CodeType = 505
	CodeUnbalancedAccount              sdk.CodeType = 506
	CodeValidatorPubKeyAlreadyExist    sdk.CodeType = 507
	CodeValidatorQueryFailed           sdk.CodeType = 508
	CodeValidatorAlreadyExist          sdk.CodeType = 509
	CodeInvalidVotedValidators         sdk.CodeType = 510
	CodeElectionListNotFound           sdk.CodeType = 511
	CodeInvalidValidator               sdk.CodeType = 512

	// Lino global errors reserve 600 ~ 699
	CodeContentCreatorCoinConversion           sdk.CodeType = 601
	CodeDeveloperCoinConversion                sdk.CodeType = 602
	CodeValidatorCoinConversion                sdk.CodeType = 603
	CodeGlobalMetaNotFound                     sdk.CodeType = 604
	CodeInflationPoolNotFound                  sdk.CodeType = 605
	CodeGlobalConsumptionMetaNotFound          sdk.CodeType = 606
	CodeGlobalTPSNotFound                      sdk.CodeType = 607
	CodeFailedToMarshalTimeEventList           sdk.CodeType = 608
	CodeFailedToMarshalGlobalMeta              sdk.CodeType = 609
	CodeFailedToMarshalInflationPoll           sdk.CodeType = 610
	CodeFailedToMarshalConsumptionMeta         sdk.CodeType = 611
	CodeFailedToMarshalTPS                     sdk.CodeType = 612
	CodeFailedToUnmarshalTimeEventList         sdk.CodeType = 613
	CodeFailedToUnmarshalGlobalMeta            sdk.CodeType = 614
	CodeFailedToUnmarshalInflationPool         sdk.CodeType = 615
	CodeFailedToUnmarshalConsumptionMeta       sdk.CodeType = 616
	CodeFailedToUnmarshalTPS                   sdk.CodeType = 617
	CodeRegisterExpiredEvent                   sdk.CodeType = 618
	CodeFailedToUnmarshalTime                  sdk.CodeType = 619
	CodeFailedToMarshalTime                    sdk.CodeType = 620
	CodeGlobalTimeNotFound                     sdk.CodeType = 621
	CodeFailedToGetAmountOfConsumptionExponent sdk.CodeType = 622
	CodeLinoStakeStatisticNotFound             sdk.CodeType = 623
	CodeFailedToUnmarshalLinoStakeStatistic    sdk.CodeType = 624
	CodePastDayIsNegative                      sdk.CodeType = 625
	CodeFailedToParseEventCacheList            sdk.CodeType = 626
	CodeGlobalQueryFailed                      sdk.CodeType = 627

	// Vote errors reserve 700 ~ 799
	CodeVoterNotFound                  sdk.CodeType = 700
	CodeVoteNotFound                   sdk.CodeType = 701
	CodeReferenceListNotFound          sdk.CodeType = 702
	CodeDelegationNotFound             sdk.CodeType = 703
	CodeFailedToMarshalVoter           sdk.CodeType = 704
	CodeFailedToMarshalVote            sdk.CodeType = 705
	CodeFailedToMarshalDelegation      sdk.CodeType = 706
	CodeFailedToMarshalReferenceList   sdk.CodeType = 707
	CodeFailedToUnmarshalVoter         sdk.CodeType = 708
	CodeFailedToUnmarshalVote          sdk.CodeType = 709
	CodeFailedToUnmarshalDelegation    sdk.CodeType = 710
	CodeFailedToUnmarshalReferenceList sdk.CodeType = 711
	CodeValidatorCannotRevoke          sdk.CodeType = 712
	CodeVoteAlreadyExist               sdk.CodeType = 713
	CodeVoteQueryFailed                sdk.CodeType = 714
	CodeNotAVoterOrHasDuty             sdk.CodeType = 715
	CodeInsufficientStake              sdk.CodeType = 716
	CodeFrozenAmountIsNotEmpty         sdk.CodeType = 717
	CodeNoDuty                         sdk.CodeType = 718

	// Lino developer errors reserve 900 ~ 999
	CodeDeveloperListNotFound          sdk.CodeType = 900
	CodeFailedToMarshalDeveloper       sdk.CodeType = 901
	CodeFailedToMarshalDeveloperList   sdk.CodeType = 902
	CodeFailedToUnmarshalDeveloper     sdk.CodeType = 903
	CodeFailedToUnmarshalDeveloperList sdk.CodeType = 904
	CodeDeveloperAlreadyExist          sdk.CodeType = 905
	CodeInsufficientDeveloperDeposit   sdk.CodeType = 906
	CodeInvalidAuthorizedApp           sdk.CodeType = 907
	CodeInvalidValidityPeriod          sdk.CodeType = 908
	CodeGrantPermissionTooHigh         sdk.CodeType = 909
	CodeInvalidWebsite                 sdk.CodeType = 910
	CodeInvalidDescription             sdk.CodeType = 911
	CodeInvalidAppMetadata             sdk.CodeType = 912
	CodeInvalidGrantPermission         sdk.CodeType = 913
	CodeDeveloperQueryFailed           sdk.CodeType = 914
	CodeInvalidReserveAmount           sdk.CodeType = 915
	CodeInvalidVoterDuty               sdk.CodeType = 916
	CodeInvalidUserRole                sdk.CodeType = 917
	CodeInvalidIDAName                 sdk.CodeType = 918
	CodeInvalidIDAPrice                sdk.CodeType = 919
	CodeIDATransferSelf                sdk.CodeType = 920
	CodeIDAIssuedBefore                sdk.CodeType = 921
	CodeIDARevoked                     sdk.CodeType = 922
	CodeIDAUnauthed                    sdk.CodeType = 923
	CodeExchangeMiniDollarZeroAmount   sdk.CodeType = 924
	CodeNotEnoughIDA                   sdk.CodeType = 925
	CodeBurnZeroIDA                    sdk.CodeType = 926
	CodeInvalidTransferTarget          sdk.CodeType = 927
	CodeInvalidAffiliatedAccount       sdk.CodeType = 928
	CodeMaxAffiliatedExceeded          sdk.CodeType = 929
	CodeInvalidIDAAuth                 sdk.CodeType = 930
	CodeIDANotFound                    sdk.CodeType = 931
	CodeInvalidSigner                  sdk.CodeType = 932
	CodeInsuffientReservePool          sdk.CodeType = 933

	// Param errors reserve 1000 ~ 1099
	CodeParamHolderGenesisError                      sdk.CodeType = 1000
	CodeDeveloperParamNotFound                       sdk.CodeType = 1001
	CodeValidatorParamNotFound                       sdk.CodeType = 1002
	CodeCoinDayParamNotFound                         sdk.CodeType = 1003
	CodeBandwidthParamNotFound                       sdk.CodeType = 1004
	CodeAccountParamNotFound                         sdk.CodeType = 1005
	CodeVoteParamNotFound                            sdk.CodeType = 1006
	CodeProposalParamNotFound                        sdk.CodeType = 1007
	CodeGlobalAllocationParamNotFound                sdk.CodeType = 1008
	CodePostParamNotFound                            sdk.CodeType = 1010
	CodeInvalidaParameter                            sdk.CodeType = 1011
	CodeEvaluateOfContentValueParamNotFound          sdk.CodeType = 1012
	CodeFailedToUnmarshalGlobalAllocationParam       sdk.CodeType = 1013
	CodeFailedToUnmarshalPostParam                   sdk.CodeType = 1014
	CodeFailedToUnmarshalValidatorParam              sdk.CodeType = 1015
	CodeFailedToUnmarshalEvaluateOfContentValueParam sdk.CodeType = 1016
	CodeFailedToUnmarshalDeveloperParam              sdk.CodeType = 1018
	CodeFailedToUnmarshalVoteParam                   sdk.CodeType = 1019
	CodeFailedToUnmarshalProposalParam               sdk.CodeType = 1020
	CodeFailedToUnmarshalCoinDayParam                sdk.CodeType = 1021
	CodeFailedToUnmarshalBandwidthParam              sdk.CodeType = 1022
	CodeFailedToUnmarshalAccountParam                sdk.CodeType = 1023
	CodeFailedToMarshalGlobalAllocationParam         sdk.CodeType = 1024
	CodeFailedToMarshalPostParam                     sdk.CodeType = 1025
	CodeFailedToMarshalValidatorParam                sdk.CodeType = 1026
	CodeFailedToMarshalEvaluateOfContentValueParam   sdk.CodeType = 1027
	CodeFailedToMarshalDeveloperParam                sdk.CodeType = 1029
	CodeFailedToMarshalVoteParam                     sdk.CodeType = 1030
	CodeFailedToMarshalProposalParam                 sdk.CodeType = 1031
	CodeFailedToMarshalCoinDayParam                  sdk.CodeType = 1032
	CodeFailedToMarshalBandwidthParam                sdk.CodeType = 1033
	CodeFailedToMarshalAccountParam                  sdk.CodeType = 1034
	CodeFailedToMarshalReputationParam               sdk.CodeType = 1035
	CodeFailedToUnmarshalReputationParam             sdk.CodeType = 1036
	CodeReputationParamNotFound                      sdk.CodeType = 1037
	CodeParamQueryFailed                             sdk.CodeType = 1038

	// Proposal errors reserve 1100 ~ 1199
	CodeOngoingProposalNotFound         sdk.CodeType = 1100
	CodeCensorshipPostNotFound          sdk.CodeType = 1101
	CodeProposalNotFound                sdk.CodeType = 1102
	CodeProposalListNotFound            sdk.CodeType = 1103
	CodeNextProposalIDNotFound          sdk.CodeType = 1104
	CodeFailedToMarshalProposal         sdk.CodeType = 1105
	CodeFailedToMarshalProposalList     sdk.CodeType = 1106
	CodeFailedToMarshalNextProposalID   sdk.CodeType = 1107
	CodeFailedToUnmarshalProposal       sdk.CodeType = 1108
	CodeFailedToUnmarshalProposalList   sdk.CodeType = 1109
	CodeFailedToUnmarshalNextProposalID sdk.CodeType = 1110
	CodeCensorshipPostIsDeleted         sdk.CodeType = 1111
	CodeNotOngoingProposal              sdk.CodeType = 1112
	CodeIncorrectProposalType           sdk.CodeType = 1113
	CodeInvalidPermlink                 sdk.CodeType = 1114
	CodeInvalidLink                     sdk.CodeType = 1115
	CodeIllegalParameter                sdk.CodeType = 1116
	CodeReasonTooLong                   sdk.CodeType = 1117
	CodeProposalQueryFailed             sdk.CodeType = 1118

	// reputation errors reserve 1200 ~ 1299
	CodeReputationQueryFailed sdk.CodeType = 1200

	// bandwidth errors reserve 1300 ~ 1399
	CodeBandwidthInfoNotFound    sdk.CodeType = 1300
	CodeBlockInfoNotFound        sdk.CodeType = 1301
	CodeInvalidMsgQuota          sdk.CodeType = 1302
	CodeAppBandwidthInfoNotFound sdk.CodeType = 1303
	CodeInvalidExpectedMPS       sdk.CodeType = 1304
	CodeAppBandwidthNotEnough    sdk.CodeType = 1305
	CodeUserMsgFeeNotEnough      sdk.CodeType = 1306
	CodeBandwidthQueryFailed     sdk.CodeType = 1307

	// price module errors reserve 1400 ~ 1499
	CodeFedPriceNotFound     sdk.CodeType = 1400
	CodeCurrentPriceNotFound sdk.CodeType = 1401
	CodeNoValidatorSet       sdk.CodeType = 1402
	CodeNotAValidator        sdk.CodeType = 1403
	CodeInvalidPriceFeed     sdk.CodeType = 1404
	CodePriceFeedRateLimited sdk.CodeType = 1405

	// testing dummy error 100000
	CodeTestDummyError sdk.CodeType = 100000
	// Unimplemented features.
	CodeUnimplementedError sdk.CodeType = 100001
)
View Source
const (
	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32MainPrefix = "lino"

	// LINO is missing in https://github.com/satoshilabs/slips/blob/master/slip-0044.md
	// Assuming 4937775, https://en.wikipedia.org/wiki/Smith_number
	CoinType = 4937775

	// PrefixAccount is the prefix for account keys
	PrefixAccount = "acc"
	// PrefixValidator is the prefix for validator keys
	PrefixValidator = "val"
	// PrefixConsensus is the prefix for consensus keys
	PrefixConsensus = "cons"
	// PrefixPublic is the prefix for public keys
	PrefixPublic = "pub"
	// PrefixOperator is the prefix for operator keys
	PrefixOperator = "oper"

	// PrefixAddress is the prefix for addresses
	PrefixAddress = "addr"

	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32PrefixAccAddr = Bech32MainPrefix
	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
	Bech32PrefixAccPub = Bech32MainPrefix + PrefixPublic
	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
	Bech32PrefixValAddr = Bech32MainPrefix + PrefixValidator + PrefixOperator
	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
	Bech32PrefixValPub = Bech32MainPrefix + PrefixValidator + PrefixOperator + PrefixPublic
	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
	Bech32PrefixConsAddr = Bech32MainPrefix + PrefixValidator + PrefixConsensus
	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
	Bech32PrefixConsPub = Bech32MainPrefix + PrefixValidator + PrefixConsensus + PrefixPublic
)

Variables

View Source
var (
	// LowerBoundRat - the lower bound of Rat
	LowerBoundRat = NewDecFromRat(1, Decimals)
	// UpperBoundRat - the upper bound of Rat
	UpperBoundRat = sdk.NewDec(math.MaxInt64 / Decimals)
)
View Source
var TestnetPrice = NewMiniDollar(1200)

1 LINO = 0.012 USD 10^5 Coin = 12 * 10^7 MiniDollar 1 coin = 1200 minidollar

Functions

func AccountListToSet added in v0.4.0

func AccountListToSet(lst []AccountKey) map[AccountKey]bool

func CheckPathContentAndMinLength added in v0.2.0

func CheckPathContentAndMinLength(path []string, expectMinLength int) sdk.Error

func ConfigAndSealCosmosSDKAddress added in v0.3.0

func ConfigAndSealCosmosSDKAddress()

func ErrAmountOverflow added in v0.1.1

func ErrAmountOverflow() sdk.Error

ErrAmountOverflow - error if coin amount int64 overflow

func ErrInvalidCoins

func ErrInvalidCoins(msg string) sdk.Error

ErrInvalidCoins - error if convert LNO to Coin failed

func ErrInvalidIDAAmount added in v0.3.0

func ErrInvalidIDAAmount() sdk.Error

ErrInvalidIDAAmount - error if the IDA amount is invalid.

func ErrInvalidQueryPath added in v0.2.0

func ErrInvalidQueryPath() sdk.Error

ErrInvalidQueryPath - error if query path length is incorrect or content is invalid

func ErrInvalidUsername added in v0.4.0

func ErrInvalidUsername(username AccountKey) sdk.Error

ErrInvalidUsername - error if the username is invalid.

func ErrQueryFailed added in v0.4.0

func ErrQueryFailed(reason string) sdk.Error

ErrQueryFailed - error if query path length is incorrect or content is invalid

func ErrUnimplemented added in v0.3.0

func ErrUnimplemented(msg string) sdk.Error

ErrUnimplemented - error if the feature is not implemented yet.

func FindAccountInList added in v0.1.1

func FindAccountInList(me AccountKey, lst []AccountKey) int

FindAccountInList - find AccountKey in given AccountKey list

func NewDecFromRat added in v0.2.0

func NewDecFromRat(a, b int64) sdk.Dec

NewDecFromRat converting a / b to Dec, no float involved.

func NewError

func NewError(code sdk.CodeType, msg string) sdk.Error

NewError - create an error

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register the lino message type

func TxDecoder added in v0.3.0

func TxDecoder(cdc *wire.Codec) sdk.TxDecoder

TxDecoder - default tx decoder, decode tx before authenticate handler

func TxEncoder added in v0.3.0

func TxEncoder(cdc *wire.Codec) sdk.TxEncoder

TxDecoder - default tx decoder, decode tx before authenticate handler

Types

type AccOrAddr added in v0.4.0

type AccOrAddr struct {
	AccountKey AccountKey     `json:"account_key,omitempty"`
	Addr       sdk.AccAddress `json:"addr,omitempty"`
	IsAddr     bool           `json:"is_addr,omitempty"`
}

AccOrAddr is either an address or an account key.

func NewAccOrAddrFromAcc added in v0.4.0

func NewAccOrAddrFromAcc(acc AccountKey) AccOrAddr

func NewAccOrAddrFromAddr added in v0.4.0

func NewAccOrAddrFromAddr(addr sdk.AccAddress) AccOrAddr

func (AccOrAddr) IsValid added in v0.4.0

func (a AccOrAddr) IsValid() bool

func (AccOrAddr) String added in v0.4.0

func (a AccOrAddr) String() string

type AccountKey

type AccountKey string

AccountKey key format in KVStore

func (AccountKey) IsValid added in v0.4.0

func (ak AccountKey) IsValid() bool

type AddrMsg added in v0.4.0

type AddrMsg interface {
	sdk.Msg
	GetAccOrAddrSigners() []AccOrAddr
}

type CapacityLevel

type CapacityLevel int

msg CapacityLevel, different level cost different user capacity

type Coin

type Coin struct {
	// Amount *big.Int `json:"amount"`
	Amount sdk.Int `json:"amount"`
}

Coin - 10^5 Coin = 1 LNO

func DecToCoin added in v0.2.0

func DecToCoin(rat sdk.Dec) Coin

DecToCoin - convert sdk.Dec to LNO coin XXX(yumin): the unit of @p rat must be coin.

func LinoToCoin

func LinoToCoin(lino LNO) (Coin, sdk.Error)

LinoToCoin - convert 1 LNO to 10^5 Coin

func NewCoin added in v0.3.0

func NewCoin(amount sdk.Int) Coin

NewCoin - return coin from sdk.Int.

func NewCoinFromBigInt

func NewCoinFromBigInt(amount *big.Int) Coin

NewCoinFromBigInt - return big.Int amount of Coin

func NewCoinFromInt64

func NewCoinFromInt64(amount int64) Coin

NewCoinFromInt64 - return int64 amount of Coin

func NewCoinFromString

func NewCoinFromString(amount string) (Coin, bool)

NewCoinFromString - return string amount of Coin

func (Coin) IsEqual

func (coin Coin) IsEqual(other Coin) bool

IsEqual - returns true if the two sets of Coins have the same value

func (Coin) IsGT

func (coin Coin) IsGT(other Coin) bool

IsGT - returns true if the receiver is greater value

func (Coin) IsGTE

func (coin Coin) IsGTE(other Coin) bool

IsGTE - returns true if they are the same type and the receiver is an equal or greater value

func (Coin) IsNotNegative

func (coin Coin) IsNotNegative() bool

IsNotNegative - returns true if coin amount is not negative

func (Coin) IsPositive

func (coin Coin) IsPositive() bool

IsPositive - returns true if coin amount is positive

func (Coin) IsZero

func (coin Coin) IsZero() bool

IsZero - returns if this represents no money

func (Coin) Minus

func (coin Coin) Minus(coinB Coin) Coin

Minus - Subtracts amounts of two coins with same denom

func (Coin) Neg added in v0.4.0

func (coin Coin) Neg() Coin

Neg - return a new neged coin.

func (Coin) Plus

func (coin Coin) Plus(coinB Coin) Coin

Plus - Adds amounts of two coins with same denom

func (Coin) String

func (coin Coin) String() string

String - provides a human-readable representation of a coin

func (Coin) ToDec added in v0.2.0

func (coin Coin) ToDec() sdk.Dec

ToDec - convert Coin to sdk.Dec

func (Coin) ToInt64

func (coin Coin) ToInt64() (int64, sdk.Error)

ToInt64 - convert Coin to int64

type DonationType

type DonationType int

indicates donation type

type Event

type Event interface{}

Event - event executed in app.go

type IDAStr added in v0.3.0

type IDAStr string

IDAStr - string representation of the number of IDA. same as coin, support at most 5 digits precision(log10(Decimals)).

func (IDAStr) ToMiniIDA added in v0.3.0

func (i IDAStr) ToMiniIDA() (MiniIDA, sdk.Error)

type LNO

type LNO = string

LNO - exposed type

type MiniDollar added in v0.3.0

type MiniDollar struct {
	// embeding sdk.Int, inheriting marshal/unmarshal function from
	// sdk.Int, so DO NOT add any other field in this struct.
	sdk.Int
}

1 MiniDollar = 10^(-10) USD.

func MiniIDAToMiniDollar added in v0.3.0

func MiniIDAToMiniDollar(amount MiniIDA, miniIDAPrice MiniDollar) MiniDollar

func NewMiniDollar added in v0.3.0

func NewMiniDollar(v int64) MiniDollar

func NewMiniDollarFromBig added in v0.3.0

func NewMiniDollarFromBig(v *big.Int) MiniDollar

func NewMiniDollarFromInt added in v0.3.0

func NewMiniDollarFromInt(i sdk.Int) MiniDollar

func NewMiniDollarFromTestnetCoin added in v0.3.0

func NewMiniDollarFromTestnetCoin(c Coin) MiniDollar

TODO(yumin): MUST DELETE on upgrade3

func (MiniDollar) Equal added in v0.4.0

func (m MiniDollar) Equal(other MiniDollar) bool

func (MiniDollar) LT added in v0.4.0

func (m MiniDollar) LT(other MiniDollar) bool

func (MiniDollar) Minus added in v0.3.0

func (m MiniDollar) Minus(other MiniDollar) MiniDollar

func (MiniDollar) Multiply added in v0.3.0

func (m MiniDollar) Multiply(other MiniDollar) MiniDollar

func (MiniDollar) Plus added in v0.3.0

func (m MiniDollar) Plus(other MiniDollar) MiniDollar

type MiniIDA added in v0.3.0

type MiniIDA = sdk.Int

MiniIDA is an integer. 100000 MiniIDA = one IDA(Decimals).

type Msg

type Msg interface {
	sdk.Msg
	GetPermission() Permission
	GetConsumeAmount() Coin
}

Transactions messages must fulfill the Msg

type Permission

type Permission int

user permission type to present different permission for different msg

type Permlink string

Permlink key format in KVStore

func GetPermlink(author AccountKey, postID string) Permlink

GetPermlink try to generate Permlink from AccountKey and PostID

type ProposalKey

type ProposalKey string

ProposalKey key format in KVStore

type ProposalResult

type ProposalResult int

indicates the current proposal status

type ProposalType

type ProposalType int

indicates proposal type

type PunishType

type PunishType int

indicates the type of punishment for oncall validators

type TimeEventList

type TimeEventList struct {
	Events []Event `json:"events"`
}

Minute -> TimeEventList

type TransferDetailType

type TransferDetailType int

indicates all possible balance behavior types

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL