patch agen to deal with v8 deal proposals

This commit is contained in:
vyzo 2022-04-08 00:36:10 +03:00
parent 45a65c5d9e
commit 8f121ab0ec
2 changed files with 22 additions and 0 deletions

View File

@ -110,6 +110,7 @@ func generateState(actDir string) error {
err := tpl.Execute(&b, map[string]interface{}{
"v": version,
"import": getVersionImports()[version],
"isv8": version == 8,
})
if err != nil {
return err

View File

@ -231,7 +231,28 @@ func (s *dealProposals{{.v}}) array() adt.Array {
}
func fromV{{.v}}DealProposal(v{{.v}} market{{.v}}.DealProposal) DealProposal {
{{if .isv8 }}
label, err := v8.Label.ToString()
if err != nil {
bs, _ := v8.Label.ToBytes()
label = string(bs)
}
return DealProposal{
PieceCID: v8.PieceCID,
PieceSize: v8.PieceSize,
VerifiedDeal: v8.VerifiedDeal,
Client: v8.Client,
Provider: v8.Provider,
Label: label,
StartEpoch: v8.StartEpoch,
EndEpoch: v8.EndEpoch,
StoragePricePerEpoch: v8.StoragePricePerEpoch,
ProviderCollateral: v8.ProviderCollateral,
ClientCollateral: v8.ClientCollateral,
}
{{else}}
return (DealProposal)(v{{.v}})
{{end}}
}
func (s *state{{.v}}) GetState() interface{} {