EthSign
Search…
Specifications

Overview

A generalized EthSign Smart Agreement workflow can be split into three major parts:
  • Data sources
  • Trigger conditions
  • Execution logic
Let's dive into each of them!

Defining Data Sources

Data source is managed by IEthSignSATrigger and supports retrieving data from both on-chain and off-chain sources. Note that the final retrieved value must be no longer than 32 characters.

On-Chain Data Sources

Setting up on-chain data sources is quite straightforward. You need to supply initializeOnChainData() with the following parameters:
  • address[] calldata targetContracts: The address(es) of the contracts that you intend to retrieve data from.
  • bytes[] memory encodedSelectors: The encoded function selectors of the functions that returns the data in the target contract.
Note that both arrays must be ordered.

Off-Chain Data Sources

Setting up an off-chain data source is a bit more technically challenging since the blockchain network is fundamentally siloed off from the Web 2 world. However, with the help of Chainlink Any API, we are able to procure off-chain data in a decentralized manner, all the while abstracting complexities from you, our users.
To define off-chain data sources, you need to supply initializeOffChainData() with the following parameters:
  • string[] memory urls: The URL(s) of the endpoints that you intend to retrieve data from. Note that only GET endpoints and JSON return types are supported.
  • string[] memory paths: The JSONPath(s) that determines the location of the data within the JSON return data.
Note that both arrays must be ordered.

Defining Trigger Conditions

As return values are retrieved from various sources, IEthSignSATrigger must decide if the predefined execution logic should be run. In order to make that decision, we must define the expected values that would be compared against the returned values. At this moment, we only support checking for equality. In the future, we plan to support size comparisons for numerical values.
To define trigger conditions, we need to supply initializeOnChainData() or initializeOffChainData() with the following parameter:
  • bytes32[] calldata expectedResults: The expected value(s) that would be compared against retrieved data.
Note that the array must be ordered and correspond to the data source.

Defining Execution Logic

Once preset conditions are met, IEthSignSATrigger will call IEthSignSAExecutor and run the predefined execution logic. By default, the logic only consists of a token transfer. This can be defined by calling IEthSignSAExecutor: initialize() with the following parameters:
  • IERC20 rewardTokenContract: The address of the ERC-20 token that you intend to transfer.
  • address beneficiary: The receiver of the token.
  • uint256[] memory rewards: An array of rewards that will be paid out in stages. Note that this must match values provided in IEthSignSATrigger.
However, simple fund transfers is far from enough for some of our users. As a result, we support custom execution logic by inheriting from IEthSignSAExecutor and overriding customExecute(). With this approach, the possibilities are endless.
Last modified 1mo ago