crytic_compile.platform package

Submodules

crytic_compile.platform.abstract_platform module

Abstract Platform

class crytic_compile.platform.abstract_platform.AbstractPlatform(target: str, **kwargs)[source]

Bases: object

This is the abstract class for the platform

HIDE = False
NAME = ''
PROJECT_URL = ''
TYPE = 0
compile(crytic_compile: CryticCompile, **kwargs)[source]

Run the compilation

Parameters:
  • crytic_compile
  • kwargs
Returns:

guessed_tests() → List[str][source]

Guess the potential unit tests commands

Returns:list of unit tests command guessed
is_dependency(path: str) → bool[source]

Check if the target is a dependency

Parameters:path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is a project supported by this platform

Parameters:target
Returns:
platform_name_used

Return the underlying platform used

Returns:
platform_project_url_used

Return the underlying platform url used

Returns:
platform_type_used

Return the underlying platform url used

Returns:
target

Return the target name

Returns:
exception crytic_compile.platform.abstract_platform.IncorrectPlatformInitialization[source]

Bases: Exception

Exception raises if a platform was not properly defined

crytic_compile.platform.all_export module

Module containing all the supported export functions

crytic_compile.platform.all_platforms module

Module containing all the platforms

crytic_compile.platform.archive module

Archive platform. It is similar to the standard platform, except that the file generated contains a “source_content” field Which is a map: filename -> sourcecode

class crytic_compile.platform.archive.Archive(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Archive platform. It is similar to the Standard platform, but contains also the source code

HIDE = True
NAME = 'Archive'
PROJECT_URL = 'https://github.com/crytic/crytic-compile'
TYPE = 101
compile(crytic_compile: CryticCompile, **_kwargs)[source]

Compile

Parameters:
  • crytic_compile
  • _kwargs
Returns:

is_dependency(_path: str) → bool[source]

Check if the _path is a dependency. Always false

Parameters:_path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is an archive

Parameters:target
Returns:
crytic_compile.platform.archive.export_to_archive(crytic_compile: CryticCompile, **kwargs) → str[source]

Export the archive

Parameters:
  • crytic_compile
  • kwargs
Returns:

crytic_compile.platform.archive.generate_archive_export(crytic_compile: CryticCompile) → Tuple[Dict[KT, VT], str][source]

Generate the archive export

Parameters:crytic_compile
Returns:

crytic_compile.platform.brownie module

Brownie platform. https://github.com/iamdefinitelyahuman/brownie

class crytic_compile.platform.brownie.Brownie(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Brownie class

NAME = 'Brownie'
PROJECT_URL = 'https://github.com/iamdefinitelyahuman/brownie'
TYPE = 9
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:
  • crytic_compile
  • target
  • kwargs
Returns:

is_dependency(_path: str) → bool[source]

Check if the path is a dependency

Parameters:_path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is a brownie env

Parameters:target
Returns:

crytic_compile.platform.dapp module

Dapp platform. https://github.com/dapphub/dapptools

class crytic_compile.platform.dapp.Dapp(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Dapp class

NAME = 'Dapp'
PROJECT_URL = 'https://github.com/dapphub/dapptools'
TYPE = 4
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:
  • crytic_compile
  • target
  • kwargs
Returns:

is_dependency(path: str) → bool[source]

Check if the path is a dependency

Parameters:path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Heuristic used: check if “dapp build” is present in Makefile

Parameters:target
Returns:

crytic_compile.platform.embark module

Embark platform. https://github.com/embark-framework/embark

class crytic_compile.platform.embark.Embark(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Embark platform

NAME = 'Embark'
PROJECT_URL = 'https://github.com/embarklabs/embark'
TYPE = 3
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:
  • crytic_compile
  • target
  • kwargs
Returns:

is_dependency(path: str) → bool[source]

Check if the path is a dependency

Parameters:path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is an embark project

Parameters:target
Returns:

crytic_compile.platform.etherlime module

Etherlime platform. https://github.com/LimeChain/etherlime

class crytic_compile.platform.etherlime.Etherlime(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Etherlime platform

NAME = 'Etherlime'
PROJECT_URL = 'https://github.com/LimeChain/etherlime'
TYPE = 5
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:
  • crytic_compile
  • target
  • kwargs
Returns:

is_dependency(path: str) → bool[source]

Check if the path is a dependency

Parameters:path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is an etherlime project

Parameters:target
Returns:

crytic_compile.platform.etherscan module

Etherscan platform.

class crytic_compile.platform.etherscan.Etherscan(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Etherscan platform

NAME = 'Etherscan'
PROJECT_URL = 'https://etherscan.io/'
TYPE = 6
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the tharget :param crytic_compile: :param target: :param kwargs: :return:

is_dependency(_path: str) → bool[source]

Always return false

Parameters:_path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is an etherscan address

Parameters:target
Returns:
crytic_compile.platform.etherscan.convert_version(version: str) → str[source]

Convert the compiler version :param version: :return:

crytic_compile.platform.exceptions module

Crytic Compile Exceptions

exception crytic_compile.platform.exceptions.InvalidCompilation[source]

Bases: Exception

Invalid compilation exception

crytic_compile.platform.solc module

Solc platform

class crytic_compile.platform.solc.Solc(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Solc platform

NAME = 'solc'
PROJECT_URL = 'https://github.com/ethereum/solidity'
TYPE = 1
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:
  • crytic_compile
  • kwargs
Returns:

is_dependency(_path: str) → bool[source]

Always return false

Parameters:_path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is a solc project

Parameters:target
Returns:
crytic_compile.platform.solc.export_to_solc(crytic_compile: CryticCompile, **kwargs) → Optional[str][source]

Export the project to the solc format

Parameters:
  • crytic_compile
  • kwargs
Returns:

crytic_compile.platform.solc.get_version(solc: str) → str[source]

Get the compiler verison used

Parameters:solc
Returns:
crytic_compile.platform.solc.is_optimized(solc_arguments: str) → bool[source]

Check if optimization are used

Parameters:solc_arguments
Returns:
crytic_compile.platform.solc.relative_to_short(relative)[source]

Convert relative to short

Parameters:relative
Returns:

crytic_compile.platform.solc_standard_json module

Handle compilation through the standard solc json format

class crytic_compile.platform.solc_standard_json.SolcStandardJson(target: Union[str, dict] = None, **kwargs)[source]

Bases: crytic_compile.platform.solc.Solc

Represent the Standard solc Json object

NAME = 'Solc-json'
PROJECT_URL = 'https://solidity.readthedocs.io/en/latest/using-the-compiler.html#compiler-input-and-output-json-description'
TYPE = 10
add_remapping(remapping: str)[source]

Append our remappings

Parameters:remapping
Returns:
add_source_file(file_path: str)[source]

Append file

Parameters:file_path
Returns:
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:
  • crytic_compile
  • target
  • kwargs
Returns:

to_dict() → Dict[KT, VT][source]

Patch in our desired output types

Returns:

crytic_compile.platform.standard module

Standard crytic-compile export

class crytic_compile.platform.standard.Standard(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Standard platform (crytic-compile specific)

HIDE = True
NAME = 'Standard'
PROJECT_URL = 'https://github.com/crytic/crytic-compile'
TYPE = 100
compile(crytic_compile: CryticCompile, **_kwargs)[source]

Compile the target (load file)

Parameters:
  • crytic_compile
  • target
  • kwargs
Returns:

is_dependency(path: str) → bool[source]

Always return False

Parameters:path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is the standard crytic compile export

Parameters:target
Returns:
platform_name_used

Return the underlying platform used

Returns:
platform_project_url_used

Return the underlying platform url used

Returns:
platform_type_used

Return the underlying platform url used

Returns:
crytic_compile.platform.standard.export_to_standard(crytic_compile: CryticCompile, **kwargs) → str[source]

Export the project to the standard crytic compile format :param crytic_compile: :param kwargs: :return:

crytic_compile.platform.standard.generate_standard_export(crytic_compile: CryticCompile) → Dict[KT, VT][source]

Export the standard crytic compile export

Parameters:crytic_compile
Returns:
crytic_compile.platform.standard.load_from_compile(crytic_compile: CryticCompile, loaded_json: Dict[KT, VT]) → Tuple[int, List[str]][source]

Load from json

Parameters:
  • crytic_compile
  • loaded_json
Returns:

crytic_compile.platform.truffle module

Truffle platform

class crytic_compile.platform.truffle.Truffle(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Truffle platform

NAME = 'Truffle'
PROJECT_URL = 'https://github.com/trufflesuite/truffle'
TYPE = 2
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:kwargs
Returns:
is_dependency(path: str) → bool[source]

Check if the target is a dependency

Parameters:path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is a truffle project

Parameters:target
Returns:
crytic_compile.platform.truffle.export_to_truffle(crytic_compile: CryticCompile, **kwargs) → Optional[str][source]

Export to the truffle format

Parameters:
  • crytic_compile
  • kwargs
Returns:

crytic_compile.platform.types module

Handle the platform type

class crytic_compile.platform.types.Type[source]

Bases: enum.IntEnum

Represent the different platform

ARCHIVE = 101
BROWNIE = 9
DAPP = 4
EMBARK = 3
ETHERLIME = 5
ETHERSCAN = 6
NOT_IMPLEMENTED = 0
SOLC = 1
SOLC_STANDARD_JSON = 10
STANDARD = 100
TRUFFLE = 2
VYPER = 7
WAFFLE = 8

crytic_compile.platform.vyper module

Vyper platform

class crytic_compile.platform.vyper.Vyper(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Vyper platform

NAME = 'vyper'
PROJECT_URL = 'https://github.com/vyperlang/vyper'
TYPE = 7
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:
  • crytic_compile
  • target
  • kwargs
Returns:

is_dependency(_path)[source]

Always return false

Parameters:_path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is a vyper project

Parameters:target
Returns:

crytic_compile.platform.waffle module

Waffle platform

class crytic_compile.platform.waffle.Waffle(target: str, **kwargs)[source]

Bases: crytic_compile.platform.abstract_platform.AbstractPlatform

Waffle platform

NAME = 'Waffle'
PROJECT_URL = 'https://github.com/EthWorks/Waffle'
TYPE = 8
compile(crytic_compile: CryticCompile, **kwargs)[source]

Compile the target

Parameters:
  • crytic_compile
  • target
  • kwargs
Returns:

is_dependency(path: str) → bool[source]

Check if the path is a dependency

Parameters:path
Returns:
static is_supported(target: str, **kwargs) → bool[source]

Check if the target is a waffle project

Parameters:target
Returns:

Module contents

Init module