CosmWasm
Programming API reference for the Stork CosmWasm contract.
Last updated
Programming API reference for the Stork CosmWasm contract.
Last updated
CosmWasm contracts can integrate with the using the stork-cw rust crate available on . This crate contains the full contract code, which can be used as an SDK by enabling the library
feature. For more documentation, please also see the . The Stork contract / SDK are built on top of .
After setting up your CosmWasm project, add the stork-cw crate to your project dependencies by adding the following line to the [dependencies]
section of the programs Cargo.toml
:
or the following command:
You can now import the stork-cw's interfaces with:
Retrieves the latest value for a specified asset without additional checks.
Contains a TemporalNumericValue
instance representing the latest timestamped value for the relevant asset.
StorkError::FeedNotFound
: If the specified feed does not exist.
Retrieves the fee required to update a single feed.
Contains a Coin
instance representing the amount and denomination of the fee.
Retrieves the stored EVM public key used for message verification.
Contains an EvmPubkey
.
Retrieves the stored address of the owner of the Stork contract.
Contains the Addr
of the owner.
Update the latest value of one or more assets based on the provided update values.
update_data: Vec<UpdateData>
: A vector of updates, where each update contains:
id: EncodedAssetId
: Encoded asset ID (byte array) of the asset to update
temporal_numeric_value: TemporalNumericValue
: Struct containing the value and timestamp of the update.
publisher_merkle_root: [u8; 32]
: The publisher's Merkle root.
value_compute_alg_hash: [u8; 32]
: Hash of the compute algorithm.
r: [u8; 32]
: R component of the signature.
s: [u8; 32]
: S component of the signature.
v: u8
: V component of the signature.
Verifies the update data's signature using the Stork EVM public key stored in the contracts state.
Verifies that the update is more recent than the data currently in the feed.
If the signature is invalid, the function errors with StorkError::InvalidSignature
.
If the update is not recent, the function does not error but does no update the feed object.
If both verification pass, updates the TemporalNumericValue
for the asset and emits a temporal_numeric_value_update
event.
StorkError::InsufficientFunds
: If an insufficient fee is included with the message for the number of updates.
StorkError::InvalidSignature
: If the signature verification fails.
id: EncodedAssetId
: The of the feed to read.
Example usage of the Stork CosmWasm contract in both Sylvia and CosmWasm Core contracts can be found in the .