EVM network plugin
The EVM Network Plugin acts as a bridge between TCE and Web3, allowing your game to interact with Web3 by managing assets through an EVM bridge contract.
Any of the plugin operations will only happens when a majority of the TCE session (> 2/3) has sent exactly the same transaction.
As a game developer, you have control over when assets are transferred to the contract. You can lock an asset during the TCE session and release it to participants based on the game's logic. To lock an asset, the game needs to perform an approve operation on the desired asset on the network, granting permission to the public key holder that will be set later.
Setup
In order to setup this plugin you will need first to follow the steps mentioned here, once that is done , set up a network_config.toml
file at the top level of your game engine. For example, in a Unity game, this file should be at the same level as the Assets folder.
Load plugin bindings on your desired platform
Now that the plugin is setup to load on TCE, you will need to load the EvmPlugin
into your platform, this library contains the necessary bindings to facilitate plugin transactions. How to do that will depend on your game engine.
Take unity for example, you would load plugins simply by adding them to any folder under the Assets folder, as described here.
Sending plugin transactions
Once the plugin is configured, you can use the EvmPlugin
bindings to send transactions. The supported transactions are TransferAsset
or ReleaseAsset
.
Common structures:
Transfer asset :
Before trying to transfer an asset the game will need to get an approval of the AssetType
that it is trying to transfer to the contract account, otherwise the transfer transaction will fail.
Release asset :
Getting the plugin events
You will be able to catch the events in the same way as showed here but with the specifics:
Last updated