ProgramContext
_Context of DSL code
One of the core contracts of the project. It provides additional information about program state and point counter (pc)._
ANYONE
address ANYONE
appAddr
address appAddr
stack
contract Stack stack
program
bytes program
pc
uint256 pc
nextpc
uint256 nextpc
msgSender
address msgSender
msgValue
uint256 msgValue
isStructVar
mapping(string => bool) isStructVar
structParams
mapping(bytes4 => mapping(bytes4 => bytes4)) structParams
labelPos
mapping(string => uint256) labelPos
forLoopIterationsRemaining
uint256 forLoopIterationsRemaining
nonZeroAddress
modifier nonZeroAddress(address _addr)
onlyApp
modifier onlyApp()
constructor
constructor() public
setProgram
function setProgram(bytes _data) public
Sets the final version of the program.
Parameters
Name | Type | Description |
---|---|---|
_data | bytes | is the bytecode of the full program |
programSlice
function programSlice(bytes _payload, uint256 _index, uint256 _step) public pure returns (bytes)
Returns the slice of the program using a step value
Parameters
Name | Type | Description |
---|---|---|
_payload | bytes | is bytecode of program that will be sliced |
_index | uint256 | is a last byte of the slice |
_step | uint256 | is the step of the slice |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes | the slice of provided _payload bytecode |
programAt
function programAt(uint256 _start, uint256 _size) external view returns (bytes)
currentProgram
function currentProgram() public view returns (bytes)
Returns the slice of the current program using the index and the step values
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes | the slice of stored bytecode in the program variable |
setPc
function setPc(uint256 _pc) public
Sets the current point counter for the program
Parameters
Name | Type | Description |
---|---|---|
_pc | uint256 | is the new value of the pc |
setNextPc
function setNextPc(uint256 _nextpc) public
Sets the next point counter for the program
Parameters
Name | Type | Description |
---|---|---|
_nextpc | uint256 | is the new value of the nextpc |
incPc
function incPc(uint256 _val) public
Increases the current point counter with the provided value and saves the sum
Parameters
Name | Type | Description |
---|---|---|
_val | uint256 | is the new value that is used for summing it and the current pc value |
setMsgSender
function setMsgSender(address _msgSender) public
Sets/Updates msgSender by the provided value
Parameters
Name | Type | Description |
---|---|---|
_msgSender | address | is the new msgSender |
setMsgValue
function setMsgValue(uint256 _msgValue) public
Sets/Updates msgValue by the provided value
Parameters
Name | Type | Description |
---|---|---|
_msgValue | uint256 | is the new msgValue |
setStructVars
function setStructVars(string _structName, string _varName, string _fullName) public
Sets the full name depends on structure variables
Parameters
Name | Type | Description |
---|---|---|
_structName | string | is the name of the structure |
_varName | string | is the name of the structure variable |
_fullName | string | is the full string of the name of the structure and its variables |
setForLoopIterationsRemaining
function setForLoopIterationsRemaining(uint256 _forLoopIterationsRemaining) external
Sets the number of iterations for the for-loop that is being executed
Parameters
Name | Type | Description |
---|---|---|
_forLoopIterationsRemaining | uint256 | The number of iterations of the loop |
setLabelPos
function setLabelPos(string _name, uint256 _value) external