Documentation ¶
Index ¶
- Constants
- Variables
- func AddOP(interpreter *Interpreter) error
- func AddToPCOp(interpreter *Interpreter) error
- func AndOP(interpreter *Interpreter) error
- func DivOP(interpreter *Interpreter) error
- func EqOP(interpreter *Interpreter) error
- func ExecutePeriodicallyOp(interpreter *Interpreter) error
- func GTEQ_OP(interpreter *Interpreter) error
- func GenerateByteCode(fileName string) []byte
- func GeneratePush(a int) []byte
- func GreaterOp(interpreter *Interpreter) error
- func IntToByte(integer uint32) []byte
- func IsNegativeOp(interpreter *Interpreter) error
- func IsZeroOp(interpreter *Interpreter) error
- func JumpIOp(interpreter *Interpreter) error
- func JumpOp(interpreter *Interpreter) error
- func LTEQ_OP(interpreter *Interpreter) error
- func LessOP(interpreter *Interpreter) error
- func LoadOp(interpreter *Interpreter) error
- func MulOP(interpreter *Interpreter) error
- func NotOP(interpreter *Interpreter) error
- func OrOP(interpreter *Interpreter) error
- func PopOp(interpreter *Interpreter) error
- func PushOp(interpreter *Interpreter) error
- func PushStringOp(interpreter *Interpreter) error
- func Read(dir string) []byte
- func SGreaterOP(interpreter *Interpreter) error
- func SLessOP(interpreter *Interpreter) error
- func StoreOp(interpreter *Interpreter) error
- func SubOP(interpreter *Interpreter) error
- func SubscribeOp(interpreter *Interpreter) error
- func Test1()
- func Test2()
- func Test3()
- func Test4()
- func TestInterpreter_Run(t *testing.T)
- func Transfer(interpreter *Interpreter) error
- func WaitOp(interpreter *Interpreter) error
- func XorOP(interpreter *Interpreter) error
- type Frequency
- type Interpreter
- type JumpTable
- type Memory
- type OPCODE
- type Operation
- type OperationType
- type Stack
- type State
Constants ¶
View Source
const ( String dataType = 0 Integer dataType = 1 )
View Source
const MaxSize int = 20000
Variables ¶
View Source
var OpcodeIntToString = map[byte]string{
0: "Halt",
1: "ADD",
2: "SUB",
3: "MUL",
4: "DIV",
10: "GT",
11: "LT",
12: "GT_EQ",
13: "LT_EQ",
14: "SGT",
15: "SLT",
16: "EQ",
17: "AND",
18: "OR",
19: "NOT",
20: "XOR",
21: "ISZERO",
22: "ISNEGATIVE",
30: "POP",
31: "PUSH32",
32: "PUSHBOOl",
33: "PUSHTIME",
34: "PUSH64",
35: "PUSH256",
36: "PUSHSTRING",
37: "LOAD",
38: "STORE",
40: "JUMP",
41: "JUMPI",
42: "AddToPC",
50: "SUBSCRIBE",
51: "EXECUTEPERIODICALLY",
52: "WAIT_FOR_DATA",
53: "TRANSFER",
}
Functions ¶
func AddOP ¶
func AddOP(interpreter *Interpreter) error
func AddToPCOp ¶
func AddToPCOp(interpreter *Interpreter) error
func AndOP ¶
func AndOP(interpreter *Interpreter) error
func DivOP ¶
func DivOP(interpreter *Interpreter) error
func EqOP ¶
func EqOP(interpreter *Interpreter) error
func ExecutePeriodicallyOp ¶
func ExecutePeriodicallyOp(interpreter *Interpreter) error
func GTEQ_OP ¶
func GTEQ_OP(interpreter *Interpreter) error
func GenerateByteCode ¶
func GeneratePush ¶
func IsNegativeOp ¶
func IsNegativeOp(interpreter *Interpreter) error
func IsZeroOp ¶
func IsZeroOp(interpreter *Interpreter) error
func JumpOp ¶
func JumpOp(interpreter *Interpreter) error
func LTEQ_OP ¶
func LTEQ_OP(interpreter *Interpreter) error
func LessOP ¶
func LessOP(interpreter *Interpreter) error
func LoadOp ¶
func LoadOp(interpreter *Interpreter) error
func MulOP ¶
func MulOP(interpreter *Interpreter) error
func NotOP ¶
func NotOP(interpreter *Interpreter) error
func OrOP ¶
func OrOP(interpreter *Interpreter) error
func PopOp ¶
func PopOp(interpreter *Interpreter) error
func PushOp ¶
func PushOp(interpreter *Interpreter) error
func PushStringOp ¶
func PushStringOp(interpreter *Interpreter) error
func SGreaterOP ¶
func SGreaterOP(interpreter *Interpreter) error
func SLessOP ¶
func SLessOP(interpreter *Interpreter) error
func StoreOp ¶
func StoreOp(interpreter *Interpreter) error
func SubOP ¶
func SubOP(interpreter *Interpreter) error
func SubscribeOp ¶
func SubscribeOp(interpreter *Interpreter) error
func TestInterpreter_Run ¶
func WaitOp ¶
func WaitOp(interpreter *Interpreter) error
func XorOP ¶
func XorOP(interpreter *Interpreter) error
Types ¶
type Interpreter ¶
type Interpreter struct { Id int ContractCode []byte OraclePool *OracleListener.OraclePool TimeListener *TimeListener.TimeListener ReceiveChan chan *Messages.BroadcastMsg TransactionChan chan interface{} IsBlocked bool IsTimeDependent bool // contains filtered or unexported fields }
Interpreter TODO Blocked is initially false
func NewInterpreter ¶
func NewInterpreter(id int, contractCode []byte, pool *OracleListener.OraclePool, gasLimit uint64, timeListener *TimeListener.TimeListener) *Interpreter
func (*Interpreter) Run ¶
func (interpreter *Interpreter) Run() error
Run TODO when error happens --> unsubscribe from the oraclePool
type OPCODE ¶
type OPCODE byte
const ( Halt OPCODE = 0 ADD OPCODE = 1 SUB OPCODE = 2 MUL OPCODE = 3 DIV OPCODE = 4 GT OPCODE = 10 LT OPCODE = 11 GT_EQ OPCODE = 12 LT_EQ OPCODE = 13 SGT OPCODE = 14 SLT OPCODE = 15 EQ OPCODE = 16 AND OPCODE = 17 OR OPCODE = 18 NOT OPCODE = 19 XOR OPCODE = 20 ISZERO OPCODE = 21 ISNEGATIVE OPCODE = 22 POP OPCODE = 30 PUSH32 OPCODE = 31 PUSHBOOl OPCODE = 32 PUSHTIME OPCODE = 33 PUSH64 OPCODE = 34 PUSH256 OPCODE = 35 PUSHSTRING OPCODE = 36 LOAD OPCODE = 37 STORE OPCODE = 38 JUMP OPCODE = 40 JUMPI OPCODE = 41 AddToPC OPCODE = 42 SUBSCRIBE OPCODE = 50 EXECUTEPERIODICALLY OPCODE = 51 WAIT_FOR_DATA OPCODE = 52 TRANSFER OPCODE = 53 )
type OperationType ¶
type OperationType func(interpreter *Interpreter) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.