Eagle Owl is designed to aid Gliders writing glides on Remedy's Glider platform.
Note: This is a WIP. All code is temporary. Suggestions and feedback are welcome through Github issues.
If you want to use any of the functions, please copy and paste the entire python file that contains the function into your query. Once more work is done on this project there will be a better solution provided. Apologizes in advance.
Any feature/bug requests can be made through Github issues. I will do my best to be as responsive as I can. Thanks!
- Eagle Owl - A helper library for writing Glides
- API Documentation
- Utilities
- Instructions
- find_reverts([]Instruction) -> []Instruction
- has_reverts([]Instruction) -> Bool
- find_requires([]Instruction) -> []Instruction
- has_requires([]Instruction) -> Bool
- find_asserts([]Instruction) -> []Instruction
- has_asserts([]Instruction) -> Bool
- sort_instructions_by_source_line([]Instruction) -> []Instruction
- Instruction
- find_root_variable(Instruction) -> Value | None
- find_root_call(Instruction) -> Value | None
- find_call_in_instruction(Instruction, str) -> Call | None
- is_new_var_instruction(Instruction) -> Bool
- is_require_statement(Instruction) -> Bool
- is_assert_statement(Instruction) -> Bool
- is_revert_statement(Instruction) -> Bool
- Functions
- Call
- Condition
- State Variables
- Values
- Context Library
- Math library
- math_subtraction_function_names() -> []String
- math_addition_function_names() -> []String
- math_multiply_function_names() -> []String
- math_division_function_names() -> []String
- get_all_symbolic_math_operations(Instruction, operand: str) -> [][]Value
- get_symbolic_math_ops([]Value, operand: str) -> [][]Value
- get_solidity_symbolic_arithmetic_operators() -> []String
- is_squared_via_multiplication(Operable, expression: String) -> Bool
- is_squared_via_pow(Operable, expression: String) -> Bool
Note: This documentation and code is a WIP.
Returns a boolean if an object is None or NoneType. If it is None, the function returns true.Otherwise it returns false.
This function accepts any argument.
Returns true if any item from Array A exists in Array B.
The first argument is represented as Array A and the second argument is Array B.
Returns the first line of a string. This function works well when passing a contract source code into the function and you want to get the contract declaration line.
This function also works well when passing in a function source code and you want to retrieve the function declaration.
Filter all Instructions that contain reverts.
Returns a boolean if an array of Instructions contain any reverts.
Filters all Instructions that contain requires.
Returns a boolean if an array of Instructions contain any requires.
Filters all Instructions that contain asserts.
Returns a boolean if an array of Instructions contain any asserts.
Returns a list of instructions sorted by the starting source lines.
Note: EntryPointInstructions may not be guaranteed to be the first item. You may consider filtering out EntryPointInstructions if you desire.
Returns the root variable (aka Value) from the instruction.
For example, the following instruction passed into the function will return token
.:
token.safeTransfer(msg.sender, 100)
Returns the root call from the instruction.
For example, the following instruction passed into the function will return token.balanceOf(msg.sender)
.:
token.balanceOf(msg.sender).add(100)
Given the name of a call, find the Call in a given Instruction. If no calls are found, None is returned.
The first argument represents the instruction to search in. The second argument represents the call name.
Returns true or false if the Instruction is a new var.
Returns true or false if the Instruction contains a require statement.
Returns true or false if the Instruction contains an assert statement.
Returns true or false if the Instruction contains a revert statement.
Returns true or false if the Function is an interface function.
The Function passed into this function is considered an interface function if the function contains no instructions. There is a possibility that a function defined in a contract may return true here. That said, from a querier's perspective, I believe that there is no difference between an interface function and a contract function with no body.
Returns an array of calls made within the provided Call. This function works recursively intra-functionally.
Returns an array of conditions given a set of search criteria.
A description of arguments is below:
- The first argument is an array of Operands which consists of all the Operands you want to look at. You can get the array of Operands via calling Instruction_Instance.get_operands().
- The second argument represents the expression value of
a
. Consider the following example:a < b
. If you want to find this condition, set the second argument toa
. - The third argument represents the operand of the condition. For example,
>
,>=
, '<', etc. - The fourth argument represents the expression value of
b
. Consider the following example:a < b
. If you want to find this condition, set the second argument tob
.
The return value will equal an array where each array item represents the condition found.
To provide a more high-level example, considering the following Instruction:
require(balance < 1e18, "low balance")
By running get_conditional_statements(instruction.get_operands(), 'balance', <, '1e18')
, you will receive an array with a single item. Within that item is an array of Operands which represent balance
, <
, and 1e18
.
This function is used to retrieve all Storage Write Instructions that write to a State Variable.
This function accepts a State Variable as the single argument
This function returns the type for a given Value, rather the Value is a Var, Literal, or ValueExpression. If the function is unable to determine the type, None is returned.
Please note that due to the complexity and varieties of a ValueExpression, this function is limited to returning ValueExpressions for struct attributes and arrays.
Adds utility functions for working with libraries
Returns a list of common functions and variables that represent msg.sender.
Returns an array of common subtraction function names in various popular Math libraries.
Returns an array of common addition function names in various popular Math libraries.
Returns an array of common multiplication function names in various popular Math libraries.
Returns an array of common division function names in various popular Math libraries.
This function returns an array of symbolic math operations given an Instruction. This function recursively goes through all operations.
The first argument accepts an Instruction instance. The second argument represents a string for the math operand you're looking for. For example, if you're looking for multiplication operations, try get_all_symbolic_math_operations(instruction, "*")
.
This function returns an array of symbolic math operations given an array of operations.
The first argument accepts an array of Values. The second argument represents a string for the math operand you're looking for. For example, if you're looking for multiplication operations, try get_all_symbolic_math_operations(instruction, "*")
.
This function returns an array of strings representing all possible symbolic arithmetic operators.
This function checks to see if an Operable (ValueExpression or Instruction) squares the expression input variable. The expression parameter represents the variable that is being squared.
For example, passing in the expression amount
when calling is_squared_via_multiplication()
will check if amount is multiplied by itself via amount * amount
.
This function checks to see if an Operable (ValueExpression or Instruction) squares the expression input variable. The expression parameter represents the variable that is being squared.
For example, passing in the expression amount
when calling is_squared_via_pow()
will check if amount is multiplied by itself via amount ** 2
.