githubEdit

file-signatureContract API

Programming API reference for the Stork Fast EVM contract.

SDK

EVM contracts can program against the Stork Fast contract'arrow-up-rights interface by using the stork-fast-evm-sdk npm package available on npmjs.comarrow-up-right. This SDK provides an interface and useful struct for interacting with the Stork contract. The Stork contract is built using Hardhatarrow-up-right.

Getting Started

Solidity

After setting up your Hardhat project, add the stork-fast-evm-sdk to your project dependencies by adding the following line to the "dependencies" section of the programs package.json

// package.json
"dependencies": {
    "@storknetwork/stork-fast-evm-sdk": "^1.0.0"
}

or with the following command:

npm i @storknetwork/stork-fast-evm-sdk

You can now import the SDK's interface and types with:

// YourContract.sol
import "@storknetwork/stork-fast-evm-sdk/IStorkFast.sol";
import "@storknetwork/stork-fast-evm-sdk/StorkFastStructs.sol";

Concepts

Upgradeability

The Stork contract is designed to be upgradeable using OpenZeppelin's proxy patternarrow-up-right. Ensure the proxy address remains consistent when interacting with the contract to avoid version mismatches.

Usage

In contrast to the Stork Core contract, there is no expectation that users store data on the StorkFast contract. Instead, users should verify a stork update as part of the same transaction used in their application, and only proceed if verification is successful.

Methods

Verify Signed ECDSA Payload

Description

Receives a stork batch update and returns a bool whether the update is verified or not.

Parameters

Behavior

  • Verifies the signature of the update batch using the stored EVM public key.

  • Only requires one signature verification as the entire batch is signed once.

  • Requires sufficient fee based on the number of updates.

Errors

  • InvalidPayload (0x7c6953f9): If the update itself is malformed.

  • InsufficientFee (0x025dbdd4): If the provided fee is less than the required amount.

Verify And Deserialize Signed ECDSA Payload

Description

Receives a stork batch update and returns deserialized StorkAssets if the update is verifiable.

Parameters

Behavior

  • Same as Verify Signed ECDSA Payload

  • Also returns deserialized data, but reverts on verification failure

Errors

  • InvalidPayload (0x7c6953f9): If the update itself is malformed.

  • InvalidSignature (0x8baa579f) : If the signature verification failes.

  • InsufficientFee (0x025dbdd4): If the provided fee is less than the required amount.

Version

Description

Retrieves the current version of the contract.

Returns

  • string: The version string (e.g., "1.0.0").

Examples

An example contract can be found in the the stork-external github repoarrow-up-right.

Last updated