Documentation ¶
Index ¶
- Constants
- Variables
- func LiquidityRewardForEpoch(epoch uint64) (*big.Int, *big.Int)
- func NetworkQsrRewardPerEpoch(epoch uint64) int64
- func NetworkZnnRewardPerEpoch(epoch uint64) int64
- func PillarRewardPerMomentum(epoch uint64) (*big.Int, *big.Int)
- func SentinelRewardForEpoch(epoch uint64) (*big.Int, *big.Int)
- func StakeQsrRewardPerEpoch(epoch uint64) *big.Int
- type Consensus
- type PlasmaTable
Constants ¶
View Source
const ( Decimals = 100000000 SecsInDay = 24 * 60 * 60 )
View Source
const ( AccountBlockBasePlasma = 21000 ABByteDataPlasma = 68 EmbeddedSimplePlasma = 2.5 * AccountBlockBasePlasma EmbeddedWResponse = 3.5 * AccountBlockBasePlasma EmbeddedWDoubleResponse = 4.5 * AccountBlockBasePlasma NumFusionUnitsForBasePlasma = 10 PlasmaPerFusionUnit = AccountBlockBasePlasma / NumFusionUnitsForBasePlasma CostPerFusionUnit = 100000000 PoWDifficultyPerPlasma = 1500 // MaxDataLength defines limit of account-block data to 16Kb MaxDataLength = 1024 * 16 // MaxPlasmaForAccountBlock defines max available plasma for an account block. MaxPlasmaForAccountBlock = MaxFusionPlasmaForAccount MaxPoWPlasmaForAccountBlock = EmbeddedWDoubleResponse MaxDifficultyForAccountBlock = MaxPoWPlasmaForAccountBlock * PoWDifficultyPerPlasma // MaxFusionUnitsPerAccount limits each account to a maximum of 5000 fusion units. // All units above this will not increase the maximum plasma. MaxFusionUnitsPerAccount = 5000 MaxFusionPlasmaForAccount = MaxFusionUnitsPerAccount * PlasmaPerFusionUnit MaxFussedAmountForAccount = CostPerFusionUnit * MaxFusionUnitsPerAccount )
Variables ¶
View Source
var ( MomentumsPerHour int64 = 3600 / 10 // Number of momentums per hour. Should be used instead of plain '3600' or similar. MomentumsPerEpoch = MomentumsPerHour * 24 RewardTimeLimit int64 = 3600 // UpdateMinNumMomentums is the number momentums between 2 UpdateEmbedded* calls which will execute, used for all applicable contracts UpdateMinNumMomentums = uint64(MomentumsPerHour * 5 / 6) MaxEpochsPerUpdate = 20 ProjectNameLengthMax = 30 ProjectDescriptionLengthMax = 240 ProjectZnnMaximumFunds = big.NewInt(5000 * Decimals) ProjectQsrMaximumFunds = big.NewInt(50000 * Decimals) ProjectCreationAmount = big.NewInt(1 * Decimals) PhaseTimeUnit int64 = 24 * 60 * 60 AcceleratorDuration = 20 * 12 * 30 * PhaseTimeUnit VoteAcceptanceThreshold uint32 = 33 AcceleratorProjectVotingPeriod = 14 * PhaseTimeUnit MaxBlocksPerUpdate = 40 PillarStakeAmount = big.NewInt(15e3 * Decimals) // PillarQsrStakeBaseAmount is the amount of QSR used for legacy pillars and for the first pillar in the network PillarQsrStakeBaseAmount = big.NewInt(150e3 * Decimals) PillarQsrStakeIncreaseAmount = big.NewInt(10e3 * Decimals) // Increase of cost for each pillar after PillarsQsrStakeNumWithInitial PillarEpochLockTime int64 = 83 * SecsInDay PillarEpochRevokeTime int64 = 7 * SecsInDay PillarNameLengthMax = 40 SentinelZnnRegisterAmount = big.NewInt(5e3 * Decimals) // sentinel Znn amount required for registration SentinelQsrDepositAmount = big.NewInt(50e3 * Decimals) // sentinel Qsr amount required for registration SentinelLockTimeWindow int64 = 27 * SecsInDay SentinelRevokeTimeWindow int64 = 3 * SecsInDay // Testnet value StakeTimeUnitSec int64 = 30 * SecsInDay StakeTimeMinSec = StakeTimeUnitSec * 1 StakeTimeMaxSec = StakeTimeUnitSec * 12 StakeMinAmount = big.NewInt(1 * Decimals) FuseMinAmount = big.NewInt(10 * Decimals) FuseExpiration = uint64(MomentumsPerHour * 10) // for testnet, 10 hours TokenIssueAmount = big.NewInt(1 * Decimals) TokenNameLengthMax = 40 // Maximum length of a token name TokenSymbolLengthMax = 10 // Maximum length of a token symbol TokenDomainLengthMax = 128 // Maximum length of a token domain TokenMaxSupplyBig = common.BigP255m1 TokenMaxDecimals = 18 SporkMinHeightDelay = uint64(6) SporkNameMinLength = 5 SporkNameMaxLength = 40 SporkDescriptionMaxLength = 400 // SwapAssetDecayEpochsOffset is the number of epochs before the decay kicks in SwapAssetDecayEpochsOffset = 30 * 3 // SwapAssetDecayTickEpochs is the number of epochs for each decay tick SwapAssetDecayTickEpochs = 30 // SwapAssetDecayTickValuePercentage is the percentage that is lost after in each tick, equal to 10% per SwapAssetDecayTickEpochs, after SwapAssetDecayEpochsOffset SwapAssetDecayTickValuePercentage = 10 InitialBridgeAdministrator = types.ParseAddressPanic("z1qr9vtwsfr2n0nsxl2nfh6l5esqjh2wfj85cfq9") MaximumFee = uint32(10000) MinUnhaltDurationInMomentums = uint64(6 * MomentumsPerHour) //main net MinAdministratorDelay = uint64(2 * MomentumsPerEpoch) // main net MinSoftDelay = uint64(MomentumsPerEpoch) // main net MinGuardians = 5 // main net DecompressedECDSAPubKeyLength = 65 CompressedECDSAPubKeyLength = 33 ECDSASignatureLength = 65 // RewardTickDurationInEpochs represents the duration (in epochs) for each reward tick RewardTickDurationInEpochs uint64 = 30 NetworkZnnRewardConfig = []int64{ 10 * MomentumsPerEpoch / 6 * Decimals, 6 * MomentumsPerEpoch / 6 * Decimals, 5 * MomentumsPerEpoch / 6 * Decimals, 7 * MomentumsPerEpoch / 6 * Decimals, 5 * MomentumsPerEpoch / 6 * Decimals, 4 * MomentumsPerEpoch / 6 * Decimals, 7 * MomentumsPerEpoch / 6 * Decimals, 4 * MomentumsPerEpoch / 6 * Decimals, 3 * MomentumsPerEpoch / 6 * Decimals, 7 * MomentumsPerEpoch / 6 * Decimals, 3 * MomentumsPerEpoch / 6 * Decimals, } NetworkQsrRewardConfig = []int64{ 20000 * Decimals, 20000 * Decimals, 20000 * Decimals, 20000 * Decimals, 15000 * Decimals, 15000 * Decimals, 15000 * Decimals, 5000 * Decimals, } DelegationZnnRewardPercentage int64 = 24 MomentumProducingZnnRewardPercentage int64 = 50 SentinelZnnRewardPercentage int64 = 13 LiquidityZnnRewardPercentage int64 = 13 LiquidityZnnTotalPercentages uint32 = 10000 StakingQsrRewardPercentage int64 = 50 SentinelQsrRewardPercentage int64 = 25 LiquidityQsrRewardPercentage int64 = 25 LiquidityQsrTotalPercentages uint32 = 10000 LiquidityStakeWeights = []int64{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, } )
View Source
var ( ErrVmRunPanic = errors.New("supervisor - VM panic") // Common ErrNothingToWithdraw = errors.New("nothing to withdraw") ErrNotEnoughDepositedQsr = errors.New("not enough deposited Qsr") ErrInvalidTokenOrAmount = errors.New("invalid token or amount") ErrNotContractAddress = errors.New("not a contract address") ErrContractDoesntExist = errors.New("contract doesn't exist") ErrContractMethodNotFound = errors.New("method not found in the abi") ErrDataNonExistent = errors.New("data non existent") ErrUnpackError = errors.New("invalid unpack method data") ErrInsufficientBalance = errors.New("insufficient balance for transfer") ErrPermissionDenied = errors.New("address cannot call this method") ErrInvalidArguments = errors.New("invalid arguments") ErrInvalidB64Decode = errors.New("invalid b64 decode") ErrForbiddenParam = errors.New("forbidden parameter") ErrNotEnoughSlots = errors.New("not enough slots left") // Common - update contract state ErrUpdateTooRecent = errors.New("last update was too recent") ErrEpochUpdateTooRecent = errors.New("epoch update was too recent") // Accelerator ErrAcceleratorEnded = errors.New("accelerator period ended") ErrAcceleratorInvalidFunds = errors.New("invalid accelerator funds") ErrInvalidDescription = errors.New("invalid description") // Pillar ErrInvalidName = errors.New("invalid name") ErrNotUnique = errors.New("name or producing address not unique") ErrNotActive = errors.New("pillar is not active") // Token ErrIDNotUnique = errors.New("there is another token with the same id") ErrTokenInvalidText = errors.New("invalid token name/symbol/domain/decimals") ErrTokenInvalidAmount = errors.New("invalid token total/max supply") // Stake RevokeNotDue = errors.New("staking period still active") ErrInvalidStakingPeriod = errors.New("invalid staking period") // Plasma ErrBlockPlasmaLimitReached = errors.New("plasma limit for account-block reached") ErrNotEnoughPlasma = errors.New("not enough plasma on account") ErrNotEnoughTotalPlasma = errors.New("not enough TotalPlasma provided for account-block (PoW + Fused)") // Swap ErrInvalidSwapCode = errors.New("invalid swap code") ErrInvalidSignature = errors.New("invalid secp256k1 signature") // Sentinel ErrAlreadyRevoked = errors.New("sentinel is already revoked") ErrAlreadyRegistered = errors.New("sentinel is already registered") // Spork ErrAlreadyActivated = errors.New("spork is already activated") // Htlc ReclaimNotDue = errors.New("entry is not expired") ErrInvalidHashType = errors.New("invalid hash type") ErrInvalidHashDigest = errors.New("invalid hash digest") ErrInvalidPreimage = errors.New("invalid preimage") ErrInvalidExpirationTime = errors.New("invalid expiration time") ErrExpired = errors.New("expired") // Bridge ErrUnknownNetwork = errors.New("unknown network") ErrInvalidToAddress = errors.New("invalid destination address") ErrBridgeNotInitialized = errors.New("bridge info is not initialized") ErrOrchestratorNotInitialized = errors.New("orchestrator info is not initialized") ErrTokenNotBridgeable = errors.New("token not bridgeable") ErrNotGuardian = errors.New("sender is not a guardian") ErrTokenNotRedeemable = errors.New("token not redeemable") ErrBridgeHalted = errors.New("bridge is halted") ErrInvalidRedeemPeriod = errors.New("invalid redeem period") ErrInvalidRedeemRequest = errors.New("invalid request") ErrInvalidTransactionHash = errors.New("invalid transaction hash") ErrInvalidNetworkName = errors.New("invalid network name") ErrInvalidContractAddress = errors.New("invalid contract address") ErrInvalidToken = errors.New("invalid token standard or token address") ErrTokenNotFound = errors.New("token not found") ErrInvalidEDDSASignature = errors.New("invalid ed25519 signature") ErrInvalidEDDSAPubKey = errors.New("invalid eddsa public key") ErrInvalidECDSASignature = errors.New("invalid secp256k1 signature") ErrInvalidDecompressedECDSAPubKeyLength = errors.New("invalid decompressed secp256k1 public key length") ErrInvalidCompressedECDSAPubKeyLength = errors.New("invalid compressed secp256k1 public key length") ErrNotAllowedToChangeTss = errors.New("changing the tss public key is not allowed") ErrInvalidJsonContent = errors.New("metadata does not respect the JSON format") ErrInvalidMinAmount = errors.New("invalid min amount") ErrTimeChallengeNotDue = errors.New("time challenge not due") ErrNotEmergency = errors.New("bridge not in emergency") ErrInvalidGuardians = errors.New("invalid guardians") ErrSecurityNotInitialized = errors.New("security not initialized") ErrBridgeNotHalted = errors.New("bridge not halted") // Liquidity ErrInvalidPercentages = errors.New("invalid percentages") ErrInvalidRewards = errors.New("invalid liquidity stake rewards") )
View Source
var ( AlphanetPlasmaTable = PlasmaTable{ TxPlasma: AccountBlockBasePlasma, TxDataPlasma: ABByteDataPlasma, EmbeddedSimple: EmbeddedSimplePlasma, EmbeddedWWithdraw: EmbeddedWResponse, EmbeddedWDoubleWithdraw: EmbeddedWDoubleResponse, } )
View Source
var ( ConsensusConfig = &Consensus{ BlockTime: 10, NodeCount: 30, RandCount: 15, CountingZTS: types.ZnnTokenStandard, } )
View Source
var (
MaxFussedAmountForAccountBig = big.NewInt(MaxFussedAmountForAccount)
)
Functions ¶
func LiquidityRewardForEpoch ¶
LiquidityRewardForEpoch returns liquidity Znn and Qsr reward for a specific epoch.
func PillarRewardPerMomentum ¶
PillarRewardPerMomentum returns delegation & producing reward per momentum.
func SentinelRewardForEpoch ¶
SentinelRewardForEpoch returns sentinel Znn and Qsr reward for a specific epoch.
func StakeQsrRewardPerEpoch ¶
StakeQsrRewardPerEpoch returns staking Qsr reward for a specific epoch
Types ¶
type Consensus ¶
type Consensus struct { BlockTime int64 // Interval in seconds between 2 momentums NodeCount uint8 // NodeCount in an election tick RandCount uint8 // RandCount of pillars which are chosen in an election tick CountingZTS types.ZenonTokenStandard // CountingZTS used to compute pillar weights }
Click to show internal directories.
Click to hide internal directories.