Plugin configuration

Parameters

Most of the configuration parameters are shipped with default values, with normally don't need to be explicitly set. The following list gives an overview over the configurable parameters of the plugin.

codegen configuration block

This configuration block contains the general parameters for the plugin

Parameter

Description

Default / Sample value

initFunctionName

Name of the deploy init function to call right after deploy

Default: init

targetPackage

Java package of the generated contraect classes

Default:com.kryptokrauts.contraect.generated

datatypePackage

Java package of the generated datatypes

Default: com.kryptokrauts.contraect.generated.datatypes

targetPath

Generated Java classes will be stored in this folder

Default: target/generated-sources/contraect

compilerBaseUrl (*)

The base url of the sophia compiler

Sample:https://compiler.aepps.com

numTrials

Number of trials (with 1 sec delay) to wait for transaction to be mined -> relevant for stateful calls and the deploy method

Default: 60

directories (*)

List of directories to be scanned for contract files

Sample:

<directory>

${project.basedir}/src/main/resources

<directory>

contractSuffix

File suffix identifying a contract code file

Default:aes

resultAbortKey

indicates the abort case of a function call, also applies for dryRun call

Default: abort

resultErrorKey

indicates the error case of a function call, also applies for dryRun call

Default: error

resultRevertKey

indicates an revert of a contract deploy

Default: revert

abi-json configuration block

This configuration defines the json key names which are used to parse the contract code. The listed elements are used to parse the contracts JSON ABI and further transform this into the resulting contract java class. Typically this part of the configuration can be completely ommitted unless the basic layout of the sophia contract ABI does not change.

Parameter

Description

Default / Sample value

rootElement

key for contract root

Default: contract

eventElement

key for events

Default: events

functionsElement

key for contract functions

Default: functions

contractNameElement

key for contract name element

Default: name

payableElement

key for contract payable flag

Default: payable

stateElement

key for contracts state definition

Default: state

customTypeElement

key for contracts custom types

Default: type_defs

functionNameElement

key for a custom functions name

Default: name

functionReturnTypeElement

key for a custom functions return type

Default: returns

functionArgumentsElement

key for a custom functions arguments

Default: arguments

functionArgumentTypeElement

key for a custom functions argument type

Default: type

functionArgumentNameElement

key for a custom functions argument name

Default: name

functionStatefulElement

key for a custom function flagging stateful type

Default: stateful

customTypeNameElement

key for a custom types name

Default: name

customTypeTypedefElement

key for a custom types typedefinition list

Default: typedef

customTypeTypedefNameElement

key for one custom types typedefintion name

Default: name

customTypeTypedefTypeElement

key for one custom types typedefinition type

Default: type

* are mandatory fields that need to be set explicitely

Example

This is an example for the minimal required configuration that only provides the required parameters:

<plugin>
<groupId>com.kryptokrauts</groupId>
<artifactId>contraect-maven-plugin</artifactId>
<version>0.9.1</version>
<configuration>
<codegen>
<compilerBaseUrl>https://compiler.aepps.com</compilerBaseUrl>
<directories>
<directory>${project.basedir}/src/main/resources</directory>
</directories>
</codegen>
</configuration>
<executions>
<execution>
<goals>
<goal>generate-contraects</goal>
</goals>
</execution>
</executions>
</plugin>