Aptos
Programming API reference for the Stork Aptos contract.
Last updated
Programming API reference for the Stork Aptos contract.
Last updated
Aptos contracts can integrate with the including it as a project dependency.
After setting up your Aptos Move project, add the Stork contract to your project dependencies by adding the following lines to your projects Move.toml
:
For the official Stork contract addresses, see . You can now import the Stork interfaces with:
Updates the latest value in the relevant feed object based on the provided update values.
signer: &signer
: A reference to the signer of the transaction, automatically provided by the MoveVM.
asset_id: vector<u8>
: Encoded asset ID as a byte vector for the update .
temporal_numeric_value_timestamp_ns: u64
: Timestamp of the temporal numeric value.
temporal_numeric_value_magnitude: u128
: The magnitude of the numeric value.
temporal_numeric_value_negative: bool
: Indicates whether the value is negative.
publisher_merkle_root: vector<u8>
: The publisher's Merkle root.
value_compute_alg_hash: vector<u8>
: Hash of the compute algorithm.
r: vector<u8>
: R component of the signature.
s: vector<u8>
: 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 StorkState
resource.
Verifies that the update is more recent than the data currently in the feed.
If the signature is invalid, the function errors with E_INVALID_SIGNATURE
.
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 TemporalNumericValueUpdateEvent
.
E_INVALID_SIGNATURE:
If the signature verification fails.
Efficiently updates the latest values for multiple assets based on the proved update data vectors, where the corresponding update data is keyed by index. For example:
ids[i]
temporal_numeric_value_timestamp_nss[i]
temporal_numeric_value_magnitudes[i]
...
all belong to the same update.
signer: &signer
: A reference to the signer of the transaction, automatically provided by the MoveVM.
ids: vector<vector<u8>>
: Asset IDs for the updates.
temporal_numeric_value_timestamp_nss: vector<u64>
: Timestamps for the updates.
temporal_numeric_value_magnitudes: vector<u128>
: Magnitudes of the numeric values.
temporal_numeric_value_negatives: vector<bool>
: Indicates whether each value is negative.
publisher_merkle_roots: vector<vector<u8>>
: Publisher Merkle roots.
value_compute_alg_hashes: vector<vector<u8>>
: Hashes of the compute algorithms.
rs: vector<vector<u8>>
: R components of the signatures.
ss: vector<vector<u8>>
: S components of the signatures.
vs: vector<u8>
: V components of the signatures.
Validates that all input vectors have the same length.
Verifies the signature for each update using the Stork EVM public key.
Verifies that each update is more recent than the current asset data.
If any signature fails verification, the function errors with E_INVALID_SIGNATURE
for all updates.
If some updates are not recent, those updates are skipped without erroring.
Successfully verified and recent updates are applied.
Emits a TemporalNumericValueUpdateEvent
for each successful update.
E_INVALID_SIGNATURE:
If any update's signature verification fails.
E_NO_UPDATES
: If the ids vector is empty
E_INVALID_LENGTHS
: If not all the input vectors are the same length.
View function that retrieves the latest value for a specified asset without additional checks.
TemporalNumericValue
: The latest value for the relevant asset.
E_FEED_NOT_FOUND
: If the specified feed does exist.
View function that retrieves the stored address of the owner of the Stork contract from the the StorkState
.
address
: The value of the owner
field of the state.
View function that retrieves the stored EVM public key from the StorkState
.
EvmPubkey
: The value of the stork_evm_public_key
field of the state.
View function that retrieves the fee required to update a single value from the StorkState.
u64
: The value of the single_update_fee_in_octas
field of the state.
View function that checks whether or not the StorkState
resource exists. This can be used as a proxy for whether or not the Stork contract has been initialized.
bool
: Whether or not the StorkState
resource exists.
asset_id: vector<u8>
: The of the feed to read.
Example usage of the Stork Aptos contract can be found in the .