EVM, it doesn't have its own smart contract. We will get all of the required imports from the
@acala-network/contractsdependency. The precompiles and predeploys are a specific feature of the Acala EVM+, so this tutorial is no longer compatible with traditional EVM development networks (like Ganache).
@acala-network/contractsdependency. Your skeleton
PrecompiedEVMsmart contract should look like this:
@acala-network/contractsis done between the
pragmadefinition and the start od the
@acala-network/contracts, we can set the inheritance of our
EVM.js. Within it we import the
@acala-network/contractsdependency and assign it to
EVM, which is the export from the
@acala-network/contractsdependency, is imported and it holds the value of the address of the predeployed EVM smart contract. We are also importing
truffleAssertin order to ease our verification of the expected values and we are defining the
NULL_ADDRESSconstant, so we don't have to copy-paste the value when needed.
instancewill store the predeployed EVM smart contract instance.
contractwill store the value of the deployed precompiled token smart contract. The
userwill store the accounts that we will be using in our tests. Let's assign them values in the
ADDRESSutility in order to set the address of our predeployed smart contract.
Operationin which we will be checking the following functions (which will each be tested in its own section):
newContractExtraBytes()function to get the NewContractExtraBytes constant.
storageDepositPerByte()function to get the StorageDepositPerByte constant.
maintainerOf()function to get the maintainer of the contract.
developerDeposit()function to get the value of the developer deposit.
publicationFee()function to get the vale of the publication fee.
transferMaintainter()function to transfer the maintainer role of the smart contract.
publishContract()function that publishes a smart contract (makes it available for interactions to the non-developer accounts).
developerStatus()function that returns the development mode status of the address.
developerDisable()function that disables developer mode of the account.
developerEnable()function that enables developer mode of the account.
newContractExtraBytes()function, we will check for the following examples:
storageDepositPerByte()function, we will check for the following examples:
maintainerOf()function, we will check for the following examples:
developerDeposit()function, we will check for the following examples:
publicationFee()function, we will check for the following examples:
transferMaintainter()function, we will check for the following examples:
TransferredMaintainerevent should be emitted when the maintainer is transferred.
publishContract()function, we will check for the following examples:
ContractPublishedevent should be emitted when the contract is published.
developerStatus()function, we will check for the following examples:
developerDisable()function, we will check for the following examples:
DeveloperDisabledevent is emitted when developer mode is disabled.
developerEnable()function, we will check for the following examples:
DeveloperEnabledevent is emitted when developer mode is enabled.
yarn test-mandala, your tests should pass with the following output:
EVMand log all of the changes and information ot the console. The script will be called
userJourney.jsand will reside in the
Tokensmart contracts from
@acala-network/contractsshould look like this:
userand instantiate the predeployed
EVMsmart contract with the help of the
deployeraccount, we need to enable it. After it is enabled, we can query and output the development status of both of the Signers:
deployerhas developer mode enabled, we can use it to deploy the journey smart contract. We can now check for the maintainer of the newly deployed smart contract and output the result to the console:
user, we have to enable the development mode on it. Once we do, we can output the development mode status of both accounts to the console:
userSigner is ready to become the maintainer of the journey smart contract, we can transfer the maintainer and log the result to the console:
yarn user-journey-mandalascript should return the following output:
yarn test-madala:pubDevand to run the user journey script we can use the
yarn user-journey-mandala:pubDev. As we are using utilities only available in the Acala EVM+, we can no longer use a conventional development network like Ganache.