2020-09-30 17:04:10 +00:00
|
|
|
package paych
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/go-address"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
"github.com/filecoin-project/lotus/chain/actors"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
2020-10-08 20:32:54 +00:00
|
|
|
|
2021-04-23 12:29:46 +00:00
|
|
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
2020-09-30 17:04:10 +00:00
|
|
|
)
|
|
|
|
|
2021-04-23 12:29:46 +00:00
|
|
|
var Methods = builtin4.MethodsPaych
|
2020-10-08 20:32:54 +00:00
|
|
|
|
2020-09-30 17:58:34 +00:00
|
|
|
func Message(version actors.Version, from address.Address) MessageBuilder {
|
2020-09-30 17:04:10 +00:00
|
|
|
switch version {
|
|
|
|
case actors.Version0:
|
2020-09-30 17:58:34 +00:00
|
|
|
return message0{from}
|
2020-09-30 17:04:10 +00:00
|
|
|
case actors.Version2:
|
2020-09-30 17:58:34 +00:00
|
|
|
return message2{from}
|
2021-01-21 19:26:55 +00:00
|
|
|
case actors.Version3:
|
|
|
|
return message3{from}
|
2021-04-23 12:29:46 +00:00
|
|
|
case actors.Version4:
|
|
|
|
return message4{from}
|
2020-09-30 17:04:10 +00:00
|
|
|
default:
|
|
|
|
panic(fmt.Sprintf("unsupported actors version: %d", version))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type MessageBuilder interface {
|
2020-09-30 17:58:34 +00:00
|
|
|
Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error)
|
|
|
|
Update(paych address.Address, voucher *SignedVoucher, secret []byte) (*types.Message, error)
|
|
|
|
Settle(paych address.Address) (*types.Message, error)
|
|
|
|
Collect(paych address.Address) (*types.Message, error)
|
2020-09-30 17:04:10 +00:00
|
|
|
}
|