better pseudocode
This commit is contained in:
parent
9c1918efdc
commit
d56e3a7ef9
|
@ -35,8 +35,12 @@ type ContinuousVestingAccount struct {
|
||||||
EndTime int64
|
EndTime int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConvertAccount converts VestingAccount into BaseAccount
|
||||||
|
// Will convert only after account has fully vested
|
||||||
ConvertAccount(vacc ContinuousVestingAccount) (BaseAccount):
|
ConvertAccount(vacc ContinuousVestingAccount) (BaseAccount):
|
||||||
if Now > vacc.EndTime then // Convert to BaseAccount
|
if Now > vacc.EndTime:
|
||||||
|
account = NewBaseAccount(vacc.Address, vacc.OriginalCoins + vacc.ReceivedCoins)
|
||||||
|
return account
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -101,15 +105,22 @@ type GenesisAccount struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
initChainer:
|
initChainer:
|
||||||
for genesis_acc in GenesisAccounts:
|
for gacc in GenesisAccounts:
|
||||||
if EndTime == 0 then // Create BaseAccount
|
baseAccount := BaseAccount{
|
||||||
else:
|
Address: gacc.Address,
|
||||||
vesting_account = ContinuouslyVestingAccount{
|
Coins: gacc.GenesisCoins,
|
||||||
OriginalCoins: GenesisCoins,
|
}
|
||||||
|
if gacc.EndTime != 0:
|
||||||
|
vestingAccount := ContinuouslyVestingAccount{
|
||||||
|
BaseAccount: baseAccount,
|
||||||
|
OriginalCoins: gacc.GenesisCoins,
|
||||||
StartTime: RequestInitChain.Time,
|
StartTime: RequestInitChain.Time,
|
||||||
EndTime: EndTime,
|
EndTime: gacc.EndTime,
|
||||||
}
|
}
|
||||||
// Add account to initial state
|
AddAccountToState(vestingAccount)
|
||||||
|
else:
|
||||||
|
AddAccountToState(baseAccount)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Formulas
|
### Formulas
|
||||||
|
|
Loading…
Reference in New Issue