Smartcontract (#39)

* 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
This commit is contained in:
Anthony De Meulemeester 2018-03-04 14:56:49 +01:00 committed by GitHub
parent 42195b1af4
commit 1a1a19da7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 1066 additions and 170 deletions

View file

@ -0,0 +1,52 @@
package smartcontract
import "github.com/anthdm/neo-go/pkg/util"
// ParamType represent the Type of the contract parameter
type ParamType int
// A list of supported smart contract parameter types.
const (
SignatureType ParamType = iota
BoolType
IntegerType
Hash160Type
Hash256Type
ByteArrayType
PublicKeyType
StringType
ArrayType
)
// Parameter represents a smart contract parameter.
type Parameter struct {
// Type of the parameter
Type ParamType
// The actual value of the parameter.
Value interface{}
}
// NewParameter returns a Parameter with proper initialized Value
// of the given ParamType.
func NewParameter(t ParamType) Parameter {
return Parameter{
Type: t,
Value: nil,
}
}
// ContextItem represents a transaction context item.
type ContextItem struct {
Script util.Uint160
Parameters []Parameter
Signatures []Signature
}
// Signature represents a transaction signature.
type Signature struct {
Data []byte
PublicKey []byte
}
// ParameterContext holds the parameter context.
type ParameterContext struct{}