mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-30 19:33:36 +00:00
1a1a19da7d
* deleted transfer_output added asset type and transaction result to core * removed writing 0x00 when buffer length is 0 * Refactored emit into VM package + moved tx to own package. * implemented transaction along with claimTransaction. * refactored naming of transaction + added decode address for uint160 types * removed unnecessary folder and files. * transaction/smartcontract logic * bumped version 0.24.0
38 lines
805 B
Go
38 lines
805 B
Go
package transaction
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/util"
|
|
)
|
|
|
|
// ClaimTX represents a claim transaction.
|
|
type ClaimTX struct {
|
|
Claims []*Input
|
|
}
|
|
|
|
// DecodeBinary implements the Payload interface.
|
|
func (tx *ClaimTX) DecodeBinary(r io.Reader) error {
|
|
lenClaims := util.ReadVarUint(r)
|
|
tx.Claims = make([]*Input, lenClaims)
|
|
for i := 0; i < int(lenClaims); i++ {
|
|
tx.Claims[i] = &Input{}
|
|
if err := tx.Claims[i].DecodeBinary(r); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeBinary implements the Payload interface.
|
|
func (tx *ClaimTX) EncodeBinary(w io.Writer) error {
|
|
if err := util.WriteVarUint(w, uint64(len(tx.Claims))); err != nil {
|
|
return err
|
|
}
|
|
for _, claim := range tx.Claims {
|
|
if err := claim.EncodeBinary(w); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|