github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/builtin/paych/paych_state.go (about) 1 package paych 2 3 import ( 4 addr "github.com/filecoin-project/go-address" 5 "github.com/filecoin-project/go-state-types/abi" 6 "github.com/filecoin-project/go-state-types/big" 7 "github.com/ipfs/go-cid" 8 ) 9 10 // A given payment channel actor is established by From 11 // to enable off-chain microtransactions to To to be reconciled 12 // and tallied on chain. 13 type State struct { 14 // Channel owner, who has funded the actor 15 From addr.Address 16 // Recipient of payouts from channel 17 To addr.Address 18 19 // Amount successfully redeemed through the payment channel, paid out on `Collect()` 20 ToSend abi.TokenAmount 21 22 // Height at which the channel can be `Collected` 23 SettlingAt abi.ChainEpoch 24 // Height before which the channel `ToSend` cannot be collected 25 MinSettleHeight abi.ChainEpoch 26 27 // Collections of lane states for the channel, maintained in ID order. 28 LaneStates cid.Cid // AMT<LaneState> 29 } 30 31 // The Lane state tracks the latest (highest) voucher nonce used to merge the lane 32 // as well as the amount it has already redeemed. 33 type LaneState struct { 34 Redeemed big.Int 35 Nonce uint64 36 } 37 38 const LaneStatesAmtBitwidth = 3 39 40 func ConstructState(from addr.Address, to addr.Address, emptyArrCid cid.Cid) *State { 41 return &State{ 42 From: from, 43 To: to, 44 ToSend: big.Zero(), 45 SettlingAt: 0, 46 MinSettleHeight: 0, 47 LaneStates: emptyArrCid, 48 } 49 }