2019-11-25 04:45:13 +00:00
|
|
|
package genesis
|
|
|
|
|
2019-11-28 22:50:58 +00:00
|
|
|
import (
|
2020-02-12 00:58:55 +00:00
|
|
|
"encoding/json"
|
|
|
|
|
2022-06-14 15:00:51 +00:00
|
|
|
"github.com/ipfs/go-cid"
|
2022-08-25 18:20:41 +00:00
|
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
2022-05-15 19:26:52 +00:00
|
|
|
|
2019-12-19 20:13:17 +00:00
|
|
|
"github.com/filecoin-project/go-address"
|
2020-09-07 03:49:10 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2022-10-10 08:54:07 +00:00
|
|
|
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
2022-03-12 18:07:35 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/network"
|
2022-10-05 04:30:52 +00:00
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
2020-02-12 00:58:55 +00:00
|
|
|
)
|
2020-02-08 02:18:32 +00:00
|
|
|
|
2020-02-12 00:58:55 +00:00
|
|
|
type ActorType string
|
2020-02-13 00:15:33 +00:00
|
|
|
|
2020-02-12 00:58:55 +00:00
|
|
|
const (
|
|
|
|
TAccount ActorType = "account"
|
|
|
|
TMultisig ActorType = "multisig"
|
2019-11-28 22:50:58 +00:00
|
|
|
)
|
2019-11-25 04:45:13 +00:00
|
|
|
|
|
|
|
type PreSeal struct {
|
2022-05-15 19:26:52 +00:00
|
|
|
CommR cid.Cid
|
|
|
|
CommD cid.Cid
|
|
|
|
SectorID abi.SectorNumber
|
2022-10-10 08:54:07 +00:00
|
|
|
Deal markettypes.DealProposal
|
2022-10-05 14:10:04 +00:00
|
|
|
DealClientKey types.KeyInfo
|
2022-05-15 19:26:52 +00:00
|
|
|
ProofType abi.RegisteredSealProof
|
2019-11-25 04:45:13 +00:00
|
|
|
}
|
|
|
|
|
2020-02-12 00:58:55 +00:00
|
|
|
type Miner struct {
|
2020-08-19 19:54:33 +00:00
|
|
|
ID address.Address
|
2019-11-28 22:50:58 +00:00
|
|
|
Owner address.Address
|
|
|
|
Worker address.Address
|
2020-05-27 20:53:20 +00:00
|
|
|
PeerId peer.ID //nolint:golint
|
2019-11-28 22:50:58 +00:00
|
|
|
|
2020-02-11 20:48:03 +00:00
|
|
|
MarketBalance abi.TokenAmount
|
|
|
|
PowerBalance abi.TokenAmount
|
|
|
|
|
2020-02-08 02:18:32 +00:00
|
|
|
SectorSize abi.SectorSize
|
2019-11-28 22:50:58 +00:00
|
|
|
|
|
|
|
Sectors []*PreSeal
|
2020-02-12 00:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type AccountMeta struct {
|
|
|
|
Owner address.Address // bls / secpk
|
|
|
|
}
|
|
|
|
|
2020-02-12 21:41:59 +00:00
|
|
|
func (am *AccountMeta) ActorMeta() json.RawMessage {
|
|
|
|
out, err := json.Marshal(am)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return out
|
|
|
|
}
|
|
|
|
|
2020-02-12 00:58:55 +00:00
|
|
|
type MultisigMeta struct {
|
2020-07-07 23:39:32 +00:00
|
|
|
Signers []address.Address
|
|
|
|
Threshold int
|
|
|
|
VestingDuration int
|
|
|
|
VestingStart int
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mm *MultisigMeta) ActorMeta() json.RawMessage {
|
|
|
|
out, err := json.Marshal(mm)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return out
|
2020-02-12 00:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Actor struct {
|
|
|
|
Type ActorType
|
|
|
|
Balance abi.TokenAmount
|
|
|
|
|
|
|
|
Meta json.RawMessage
|
|
|
|
}
|
|
|
|
|
|
|
|
type Template struct {
|
2021-05-15 01:11:23 +00:00
|
|
|
NetworkVersion network.Version
|
|
|
|
Accounts []Actor
|
|
|
|
Miners []Miner
|
2019-11-28 22:50:58 +00:00
|
|
|
|
2020-02-12 00:58:55 +00:00
|
|
|
NetworkName string
|
2020-02-21 20:56:30 +00:00
|
|
|
Timestamp uint64 `json:",omitempty"`
|
2020-07-20 08:28:45 +00:00
|
|
|
|
2020-08-18 21:30:49 +00:00
|
|
|
VerifregRootKey Actor
|
|
|
|
RemainderAccount Actor
|
2019-11-25 04:45:13 +00:00
|
|
|
}
|