Documentation ¶
Index ¶
- Variables
- func CalcDIPTotalCirculation(year uint64) (value *big.Int)
- func GetMinimumTxFee(txSize common.StorageSize) *big.Int
- func MapMerge(des, src map[common.Address]*big.Int) error
- type AddressDIPProportion
- type DipperinEconomyModel
- func (economyModel *DipperinEconomyModel) CheckAddressType(address common.Address) EconomyModelAddress
- func (economyModel *DipperinEconomyModel) GetAddressLockMoney(address common.Address, blockNumber uint64) (*big.Int, error)
- func (economyModel *DipperinEconomyModel) GetBlockYear(blockNumber uint64) (uint64, error)
- func (economyModel *DipperinEconomyModel) GetDeveloperInitBalance() map[common.Address]*big.Int
- func (economyModel *DipperinEconomyModel) GetDeveloperLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
- func (economyModel *DipperinEconomyModel) GetDiffVerifierAddress(preBlock, block model.AbstractBlock) (map[VerifierType][]common.Address, error)
- func (economyModel *DipperinEconomyModel) GetFoundation() Foundation
- func (economyModel *DipperinEconomyModel) GetInvestorInitBalance() map[common.Address]*big.Int
- func (economyModel *DipperinEconomyModel) GetInvestorLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
- func (economyModel *DipperinEconomyModel) GetMineMasterDIPReward(block model.AbstractBlock) (*big.Int, error)
- func (economyModel *DipperinEconomyModel) GetOneBlockTotalDIPReward(blockNumber uint64) (*big.Int, error)
- func (economyModel *DipperinEconomyModel) GetVerifierDIPReward(block model.AbstractBlock) (map[VerifierType]*big.Int, error)
- type DipperinFoundation
- func (foundation *DipperinFoundation) GetAddressType(address common.Address) FoundationAddressType
- func (foundation *DipperinFoundation) GetEarlyTokenLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
- func (foundation *DipperinFoundation) GetFoundationInfo(usage FoundationDIPUsage) map[common.Address]*big.Int
- func (foundation *DipperinFoundation) GetMaintenanceLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
- func (foundation *DipperinFoundation) GetMineMasterEDIPReward(DIPReward *big.Int, blockNumber uint64, tokenDecimals int) (*big.Int, error)
- func (foundation *DipperinFoundation) GetReMainRewardLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
- func (foundation *DipperinFoundation) GetVerifierEDIPReward(DIPReward map[VerifierType]*big.Int, blockNumber uint64, tokenDecimals int) (map[VerifierType]*big.Int, error)
- type EconomyModel
- type EconomyModelAddress
- type EconomyNeedService
- type Foundation
- type FoundationAddressType
- type FoundationDIPUsage
- type PreMineMainType
- type VerifierType
Constants ¶
This section is empty.
Variables ¶
var ( TotalReWardDIPOneBlock = big.NewInt(20 * consts.DIP) // the reward proportions of mineMaster and verifiers respectively for one block MineMasterRewardProportion = int64(87) //87% VerifierRewardProportion = int64(13) //13% // the reward weight for each type of verifier MainVerifierRewardWeight = 2 CommitVerifierRewardWeight = 4 NoCommitVerifierRewardWeight = 1 // to be adjusted in 10 years ChangeIssuingYear = uint64(10) // the issuing rate 10 years after, // the issuance amount during the nth year = the issuance amount * 3% IssuingRate = 3 // block interval is 8s, namely 8 seconds one block GenerateBlockDuration = 8 // set the minimal deposit to register as a verifier MiniPledgeValue = big.NewInt(1000 * consts.DIP) // the total supply of pre-mining PreMineDIP = big.NewInt(525600000 * consts.DIP) // the supply of pre-mining for investors, developers and maintenance operators PreMineMineDIP = big.NewInt(438000000 * consts.DIP) // the supply of pre-mining of each group InvestorProportion = int64(60) //60% DevelopProportion = int64(20) //20% MaintenanceProportion = int64(20) //20% // the supply of pre-mining for reward PreMineRewardDIP = big.NewInt(87600000 * consts.DIP) // the supply of pre-mining for reward for each group, respectively 50% EarlyTokenReward = int64(50) RemainOtherReward = int64(50) // 5 years EarlyTokenPeriod = uint64(5) //5 // unlocking proportion each year for pre-mining investors InvestorUnlockInfo = map[int]int64{ 1: 10, 2: 20, 3: 25, 4: 25, 5: 20, } // unlocking proportion each year for pre-mining developers DeveloperUnlockInfo = map[int]int64{ 1: 10, 2: 20, 3: 20, 4: 20, 5: 20, 6: 10, } // unlocking times each year for pre-mining, 4 means unlocking each quarter UnlockTimeOneYear = uint64(4) // proportion of pre-mining for each address DIPProportion AddressDIPProportion // the total early token supply measured by token unit EarlyTokenAmount = big.NewInt(1340280000) // the conversion rate of early token with respect to DIP EarlyTokenExchangeBase = int64(10000) )
predetermined system parameters
var ( // the number of blocks to be generated during 1 year HeightAfterOneYear = uint64(365 * 24 * 3600 / GenerateBlockDuration) // the number of blocks to be generated during 10 years, with bias of course due to the non fixed interval for block generation HeightAfterTenYear = 10 * HeightAfterOneYear // total amount possessed by investors InvestorDIP = big.NewInt(0).Div(big.NewInt(0).Mul(PreMineMineDIP, big.NewInt(InvestorProportion)), big.NewInt(100)) // total amount possessed by developers DeveloperDIP = big.NewInt(0).Div(big.NewInt(0).Mul(PreMineMineDIP, big.NewInt(DevelopProportion)), big.NewInt(100)) // total amount possessed by maintenance operators MaintenanceDIP = big.NewInt(0).Div(big.NewInt(0).Mul(PreMineMineDIP, big.NewInt(MaintenanceProportion)), big.NewInt(100)) // total amount possessed by earlyToken EarlyTokenDIP = big.NewInt(0).Div(big.NewInt(0).Mul(PreMineRewardDIP, big.NewInt(EarlyTokenReward)), big.NewInt(100)) // remaining coin rewards reserved RemainRewardDIP = big.NewInt(0).Div(big.NewInt(0).Mul(PreMineRewardDIP, big.NewInt(RemainOtherReward)), big.NewInt(100)) InvestorAddresses = make([]common.Address, 0) DeveloperAddresses = make([]common.Address, 0) MaintenanceAddresses = make([]common.Address, 0) EarlyTokenAddresses = make([]common.Address, 0) RemainRewardAddresses = make([]common.Address, 0) )
unlocking proportion each year for pre-mining investors
var ( ErrBlockNumberIs0Ore1 = errors.New("the block number is 0 or 1") ErrBlockNumberIs0 = errors.New("the blockNumber is 0") ErrLockTypeError = errors.New("the lockType error") ErrAddress = errors.New("the address isn't investor or developer") ErrAddressExist = errors.New("address exist") )
var InitExchangeRate int64
var MercuryDIPProportion = AddressDIPProportion{ BaseNumber: 100, InvestorProportion: map[string]int{ "0x00000aa9bD540140d5c4E9c68685c360a091E46F4c27": 100, }, DeveloperProportion: map[string]int{ "0x0000125f454Cbf30F4354cD343f5cfb4C100D0ccCB34": 100, }, MaintenanceProportion: map[string]int{ "0x00005E3f1964Fad70Da7377BD53a76846E3bEFb734eA": 100, }, EarlyTokenProportion: map[string]int{ "0x0000960854D56506697b387463DB1C601eAb14be763E": 100, }, ReMainRewardProportion: map[string]int{ "0x0000c2FCE2Cf78953BAd21890215d4e2Ae823b56A73e": 100, }, }
use inside mercury
var NotMercuryDIPProportion = AddressDIPProportion{ BaseNumber: 100, InvestorProportion: map[string]int{ "0x000091d97Fa2Fe5Fc2631DB2fEe7A0Bb5E2131abbDcE": 100, }, DeveloperProportion: map[string]int{ "0x0000582B0A461Dd57fAb51Fe106751A2842e1111772c": 100, }, MaintenanceProportion: map[string]int{ "0x0000e79AE36836195aA34143ab2c21Fd56C1493833fE": 100, }, EarlyTokenProportion: map[string]int{ "0x000095Cfdd141b0aF2Bb92F0074d5Dbc9b5F554fF807": 100, }, ReMainRewardProportion: map[string]int{ "0x00002f3bE982378399d87A1351D04A8C5631232cD4D3": 100, }, }
use outside mercury the proportion of each account while pre-mining
Functions ¶
func CalcDIPTotalCirculation ¶
calculate the total supply during the first n years, pre-mining not included
func GetMinimumTxFee ¶
func GetMinimumTxFee(txSize common.StorageSize) *big.Int
get the minimum tracsaction fee according to the size of the transaction minimumTxFee = txSize * 0.0000001 * const.DIP
Types ¶
type AddressDIPProportion ¶
type AddressDIPProportion struct { BaseNumber int64 `json:"base_number"` InvestorProportion map[string]int `json:"investor_proportion"` DeveloperProportion map[string]int `json:"developer_proportion"` // maintenance operator proportion MaintenanceProportion map[string]int `json:"maintenance_proportion"` EarlyTokenProportion map[string]int `json:"early_token_proportion"` // other user reward proportion preserved ReMainRewardProportion map[string]int `json:"remain_reward_proportion"` }
configuration of DIP proportion of each address
type DipperinEconomyModel ¶
type DipperinEconomyModel struct { Service EconomyNeedService Foundation // contains filtered or unexported fields }
func MakeDipperinEconomyModel ¶
func MakeDipperinEconomyModel(service EconomyNeedService, proportion AddressDIPProportion) *DipperinEconomyModel
func (*DipperinEconomyModel) CheckAddressType ¶
func (economyModel *DipperinEconomyModel) CheckAddressType(address common.Address) EconomyModelAddress
identify the type of address
func (*DipperinEconomyModel) GetAddressLockMoney ¶
func (economyModel *DipperinEconomyModel) GetAddressLockMoney(address common.Address, blockNumber uint64) (*big.Int, error)
identify the type of address and return the value of locked coins
func (*DipperinEconomyModel) GetBlockYear ¶
func (economyModel *DipperinEconomyModel) GetBlockYear(blockNumber uint64) (uint64, error)
func (*DipperinEconomyModel) GetDeveloperInitBalance ¶
func (economyModel *DipperinEconomyModel) GetDeveloperInitBalance() map[common.Address]*big.Int
get the pre-mining DIP amount for each address of developers
func (*DipperinEconomyModel) GetDeveloperLockDIP ¶
func (economyModel *DipperinEconomyModel) GetDeveloperLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
lock the pre-mining DIP amount for each address of developers
func (*DipperinEconomyModel) GetDiffVerifierAddress ¶
func (economyModel *DipperinEconomyModel) GetDiffVerifierAddress(preBlock, block model.AbstractBlock) (map[VerifierType][]common.Address, error)
get the address of different verifier type for each block
func (*DipperinEconomyModel) GetFoundation ¶
func (economyModel *DipperinEconomyModel) GetFoundation() Foundation
get foundation
func (*DipperinEconomyModel) GetInvestorInitBalance ¶
func (economyModel *DipperinEconomyModel) GetInvestorInitBalance() map[common.Address]*big.Int
get the pre-mining DIP amount for each address of investors
func (*DipperinEconomyModel) GetInvestorLockDIP ¶
func (economyModel *DipperinEconomyModel) GetInvestorLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
lock the pre-mining DIP amount for each address of investors
func (*DipperinEconomyModel) GetMineMasterDIPReward ¶
func (economyModel *DipperinEconomyModel) GetMineMasterDIPReward(block model.AbstractBlock) (*big.Int, error)
get coin reward of mineMaster for each block
func (*DipperinEconomyModel) GetOneBlockTotalDIPReward ¶
func (economyModel *DipperinEconomyModel) GetOneBlockTotalDIPReward(blockNumber uint64) (*big.Int, error)
func (*DipperinEconomyModel) GetVerifierDIPReward ¶
func (economyModel *DipperinEconomyModel) GetVerifierDIPReward(block model.AbstractBlock) (map[VerifierType]*big.Int, error)
get corresponding reward for different type of verifiers for each block
type DipperinFoundation ¶
type DipperinFoundation struct {
// contains filtered or unexported fields
}
func MakeDipperinFoundation ¶
func MakeDipperinFoundation(proportion AddressDIPProportion) *DipperinFoundation
func (*DipperinFoundation) GetAddressType ¶
func (foundation *DipperinFoundation) GetAddressType(address common.Address) FoundationAddressType
get type of address
func (*DipperinFoundation) GetEarlyTokenLockDIP ¶
func (foundation *DipperinFoundation) GetEarlyTokenLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
get foundation EarlyToken each address unlock DIP
func (*DipperinFoundation) GetFoundationInfo ¶
func (foundation *DipperinFoundation) GetFoundationInfo(usage FoundationDIPUsage) map[common.Address]*big.Int
get foundation address initial DIP
func (*DipperinFoundation) GetMaintenanceLockDIP ¶
func (foundation *DipperinFoundation) GetMaintenanceLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
get foundation Maintenance each address Lock DIP, maintenance not locked
func (*DipperinFoundation) GetMineMasterEDIPReward ¶
func (foundation *DipperinFoundation) GetMineMasterEDIPReward(DIPReward *big.Int, blockNumber uint64, tokenDecimals int) (*big.Int, error)
get mineMaster EDIPReward
func (*DipperinFoundation) GetReMainRewardLockDIP ¶
func (foundation *DipperinFoundation) GetReMainRewardLockDIP(address common.Address, blockNumber uint64) (*big.Int, error)
get foundation Maintenance each address Lock DIP, RemainReward not locked
func (*DipperinFoundation) GetVerifierEDIPReward ¶
func (foundation *DipperinFoundation) GetVerifierEDIPReward(DIPReward map[VerifierType]*big.Int, blockNumber uint64, tokenDecimals int) (map[VerifierType]*big.Int, error)
get verifier EDIPReward
type EconomyModel ¶
type EconomyModel interface { GetMineMasterDIPReward(block model.AbstractBlock) (*big.Int, error) GetVerifierDIPReward(block model.AbstractBlock) (map[VerifierType]*big.Int, error) GetInvestorInitBalance() map[common.Address]*big.Int GetDeveloperInitBalance() map[common.Address]*big.Int GetInvestorLockDIP(address common.Address, blockNumber uint64) (*big.Int, error) GetDeveloperLockDIP(address common.Address, blockNumber uint64) (*big.Int, error) GetFoundation() Foundation CheckAddressType(address common.Address) EconomyModelAddress GetDiffVerifierAddress(preBlock, block model.AbstractBlock) (map[VerifierType][]common.Address, error) GetAddressLockMoney(address common.Address, blockNumber uint64) (*big.Int, error) GetBlockYear(blockNumber uint64) (uint64, error) GetOneBlockTotalDIPReward(blockNumber uint64) (*big.Int, error) }
type EconomyModelAddress ¶
type EconomyModelAddress int
const ( InvestorAddress EconomyModelAddress = iota DeveloperAddress NotEconomyModelAddress )
type EconomyNeedService ¶
type Foundation ¶
type Foundation interface { GetAddressType(address common.Address) FoundationAddressType GetFoundationInfo(usage FoundationDIPUsage) map[common.Address]*big.Int GetMaintenanceLockDIP(address common.Address, blockNumber uint64) (*big.Int, error) GetReMainRewardLockDIP(address common.Address, blockNumber uint64) (*big.Int, error) GetEarlyTokenLockDIP(address common.Address, blockNumber uint64) (*big.Int, error) // set the conversion rate of EDIP w.r.t DIP GetMineMasterEDIPReward(DIPReward *big.Int, blockNumber uint64, tokenDecimals int) (*big.Int, error) GetVerifierEDIPReward(DIPReward map[VerifierType]*big.Int, blockNumber uint64, tokenDecimals int) (map[VerifierType]*big.Int, error) }
type FoundationAddressType ¶
type FoundationAddressType int
const ( EarlyTokenAddress FoundationAddressType = iota MaintenanceAddress RemainRewardAddress NotFoundationAddress )
type FoundationDIPUsage ¶
type FoundationDIPUsage int
const ( EarlyToken FoundationDIPUsage = iota Maintenance RemainReward )
type VerifierType ¶
type VerifierType uint
const ( MasterVerifier VerifierType = iota CommitVerifier NotCommitVerifier )