2020-04-24 00:04:12 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/multiformats/go-multihash"
|
|
|
|
|
2020-09-28 21:09:04 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
2020-04-24 00:04:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
if _, err := os.Stat("code.json"); err != nil {
|
|
|
|
panic(err) // note: must run in lotuspond/front/src/chain
|
|
|
|
}
|
|
|
|
|
2020-09-28 21:09:04 +00:00
|
|
|
// TODO: ActorUpgrade: this is going to be a problem.
|
2020-04-24 00:04:12 +00:00
|
|
|
names := map[string]string{
|
|
|
|
"system": "fil/1/system",
|
|
|
|
"init": "fil/1/init",
|
|
|
|
"cron": "fil/1/cron",
|
|
|
|
"account": "fil/1/account",
|
|
|
|
"power": "fil/1/storagepower",
|
|
|
|
"miner": "fil/1/storageminer",
|
|
|
|
"market": "fil/1/storagemarket",
|
|
|
|
"paych": "fil/1/paymentchannel",
|
|
|
|
"multisig": "fil/1/multisig",
|
|
|
|
"reward": "fil/1/reward",
|
|
|
|
"verifreg": "fil/1/verifiedregistry",
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
b, err := json.MarshalIndent(names, "", " ")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := ioutil.WriteFile("code.json", b, 0664); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out := map[string][]string{}
|
2020-09-28 21:09:04 +00:00
|
|
|
|
|
|
|
for c, methods := range stmgr.MethodsMap {
|
2020-04-24 00:04:12 +00:00
|
|
|
cmh, err := multihash.Decode(c.Hash())
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2020-09-28 21:09:04 +00:00
|
|
|
name := string(cmh.Digest)
|
|
|
|
remaining := len(methods)
|
2020-04-24 00:04:12 +00:00
|
|
|
|
2020-09-28 21:09:04 +00:00
|
|
|
// iterate over actor methods in order.
|
|
|
|
for i := abi.MethodNum(0); remaining > 0; i++ {
|
|
|
|
m, ok := methods[i]
|
|
|
|
if !ok {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
out[name] = append(out[name], m.Name)
|
|
|
|
remaining--
|
2020-04-24 00:04:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
b, err := json.MarshalIndent(out, "", " ")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := ioutil.WriteFile("methods.json", b, 0664); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|