2019-07-12 23:52:25 +00:00
|
|
|
package actors
|
2019-07-05 14:29:17 +00:00
|
|
|
|
|
|
|
import (
|
2019-12-19 20:13:17 +00:00
|
|
|
"github.com/filecoin-project/go-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
|
2019-11-22 22:51:44 +00:00
|
|
|
var CronCodeCid cid.Cid
|
2019-10-21 18:12:11 +00:00
|
|
|
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
|
|
|
|
2020-01-23 19:03:01 +00:00
|
|
|
var SystemAddress = mustIDAddress(0)
|
|
|
|
var InitAddress = mustIDAddress(1)
|
|
|
|
var RewardActor = mustIDAddress(2)
|
|
|
|
var CronAddress = mustIDAddress(3)
|
|
|
|
var StoragePowerAddress = mustIDAddress(4)
|
|
|
|
var StorageMarketAddress = mustIDAddress(5)
|
|
|
|
|
|
|
|
var NetworkAddress = mustIDAddress(17) // TODO: needs to be removed in favor of reward actor
|
|
|
|
|
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 {
|
2019-11-16 23:41:14 +00:00
|
|
|
panic(err) // ok
|
2019-07-05 14:29:17 +00:00
|
|
|
}
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2019-12-05 02:04:09 +00:00
|
|
|
pref := cid.NewPrefixV1(cid.Raw, mh.IDENTITY)
|
2019-07-05 14:29:17 +00:00
|
|
|
mustSum := func(s string) cid.Cid {
|
|
|
|
c, err := pref.Sum([]byte(s))
|
|
|
|
if err != nil {
|
2019-11-16 23:41:14 +00:00
|
|
|
panic(err) // ok
|
2019-07-05 14:29:17 +00:00
|
|
|
}
|
|
|
|
return c
|
|
|
|
}
|
|
|
|
|
2019-10-24 15:38:34 +00:00
|
|
|
AccountCodeCid = mustSum("fil/1/account") // TODO: spec
|
2019-11-22 22:51:44 +00:00
|
|
|
CronCodeCid = mustSum("fil/1/cron")
|
2019-10-24 15:38:34 +00:00
|
|
|
StoragePowerCodeCid = mustSum("fil/1/power")
|
|
|
|
StorageMarketCodeCid = mustSum("fil/1/market")
|
|
|
|
StorageMinerCodeCid = mustSum("fil/1/miner")
|
|
|
|
MultisigCodeCid = mustSum("fil/1/multisig")
|
|
|
|
InitCodeCid = mustSum("fil/1/init")
|
|
|
|
PaymentChannelCodeCid = mustSum("fil/1/paych")
|
2020-01-31 23:51:15 +00:00
|
|
|
|
|
|
|
BuiltInActors = map[cid.Cid]bool{
|
|
|
|
StorageMarketCodeCid: true,
|
|
|
|
StoragePowerCodeCid: true,
|
|
|
|
StorageMinerCodeCid: true,
|
|
|
|
AccountCodeCid: true,
|
|
|
|
InitCodeCid: true,
|
|
|
|
MultisigCodeCid: true,
|
|
|
|
PaymentChannelCodeCid: true,
|
|
|
|
}
|
2019-07-05 14:29:17 +00:00
|
|
|
}
|