2019-07-12 23:52:25 +00:00
|
|
|
package actors
|
2019-07-05 14:29:17 +00:00
|
|
|
|
|
|
|
import (
|
2019-10-18 04:47:41 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/address"
|
2019-07-05 14:29:17 +00:00
|
|
|
|
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
mh "github.com/multiformats/go-multihash"
|
|
|
|
)
|
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
var AccountCodeCid cid.Cid
|
|
|
|
var StoragePowerCodeCid cid.Cid
|
|
|
|
var StorageMarketCodeCid cid.Cid
|
2019-07-05 14:29:17 +00:00
|
|
|
var StorageMinerCodeCid cid.Cid
|
2019-10-21 18:12:11 +00:00
|
|
|
var MultisigCodeCid cid.Cid
|
|
|
|
var InitCodeCid cid.Cid
|
|
|
|
var PaymentChannelCodeCid cid.Cid
|
2019-07-05 14:29:17 +00:00
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
var InitAddress = mustIDAddress(0)
|
2019-07-05 14:29:17 +00:00
|
|
|
var NetworkAddress = mustIDAddress(1)
|
2019-10-19 08:06:41 +00:00
|
|
|
var StoragePowerAddress = mustIDAddress(2)
|
|
|
|
var StorageMarketAddress = mustIDAddress(3) // TODO: missing from spec
|
2019-09-12 04:12:35 +00:00
|
|
|
var BurntFundsAddress = mustIDAddress(99)
|
2019-07-05 14:29:17 +00:00
|
|
|
|
|
|
|
func mustIDAddress(i uint64) address.Address {
|
|
|
|
a, err := address.NewIDAddress(i)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
pref := cid.NewPrefixV1(cid.Raw, mh.ID)
|
|
|
|
mustSum := func(s string) cid.Cid {
|
|
|
|
c, err := pref.Sum([]byte(s))
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return c
|
|
|
|
}
|
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
AccountCodeCid = mustSum("filecoin/1.0/AccountActor")
|
|
|
|
StoragePowerCodeCid = mustSum("filecoin/1.0/StoragePowerActor")
|
|
|
|
StorageMarketCodeCid = mustSum("filecoin/1.0/StorageMarketActor")
|
2019-10-19 08:06:41 +00:00
|
|
|
StorageMinerCodeCid = mustSum("filecoin/1.0/StorageMinerActor")
|
2019-10-21 18:12:11 +00:00
|
|
|
MultisigCodeCid = mustSum("filecoin/1.0/MultisigActor")
|
|
|
|
InitCodeCid = mustSum("filecoin/1.0/InitActor")
|
|
|
|
PaymentChannelCodeCid = mustSum("filecoin/1.0/PaymentChannelActor")
|
2019-07-05 14:29:17 +00:00
|
|
|
}
|