Skip to content

Adding a new platform

Feist Josselin edited this page Jun 27, 2019 · 1 revision

New platforms can be added to: https://github.com/crytic/crytic-compile/tree/master/crytic_compile/platform

A platform must have the following functions:

def compile(crytic_compile, target, **kwargs):
    '''
    Is called to compile the project
    Args:
     crytic_compile: the crytic-compile object
     target (str): file/directory to compile
     kwargs: additional kwargs arguments
    '''

A call to compile must set:

  • crytic_compile.contracts_names
  • crytic_compile.contracts_filenames
  • crytic_compile.abis
  • crytic_compile.bytecodes_init
  • crytic_compile.bytecodes_runtime
  • crytic_compile.srcmaps_init
  • crytic_compile.srcmaps_runtime
  • crytic_compile.compiler_version
  • crytic_compile.filenames
  • crytic_compile.asts
  • crytic_compile.type

type requires to create a new type in https://github.com/crytic/crytic-compile/blob/master/crytic_compile/platform/types.py

def is_platform_name(target):
    '''
    Return true if the platform is detected
    Args:
     target (str): file/directory to compile
    '''
def is_dependency(path):
    '''
    Return true if the path is a dependency
    Args:
     path (str): file/directory to compile
    '''

crytic.compile.py must also be updated:

Clone this wiki locally