package @zkoracle/opennautilus-contracts

Classes

Name Summary

BasicRequestClient

A basic request client contract that implements the IOracleClient interface.

IBasicTokenContract

Defines the basic interface for a token contract.

All token contracts should inherit from this class and implement its methods.

IERC20

Represents a standard interface for fungible tokens, implementing the ERC20 standard.

IERC677

Defines the interface for an ERC677 token contract.

Extends the standard ERC20 interface with the additional transferAndCall method, enabling token transfers that also trigger contract calls.

{IERC20}

IOracleClient

Abstract class representing an Oracle client.

OracleContract

An Oracle contract implementing the IOracleContract interface.

OracleRequest

from message oracle.OracleRequest

SErc677Contract

Interfaces

Name Summary

IOracleData

Functions

buildBasicTokenContract(address, symbol)

Creates a basic token contract instance.

This function handles the following steps: 1. Compiles the BasicTokenContract class. 2. Initializes the contract with the provided symbol. 3. Sets up necessary permissions for the contract. 4. Returns the newly created contract instance.

Parameters
Name Type Description

address

PublicKey

The address where the contract will be deployed

symbol

string

The symbol for the token (e.g., "MYTOKEN")

Returns

Promise<TokenContract & IBasicTokenContract>

A promise that resolves to the created token contract instance

Signature
export declare function buildBasicTokenContract(address: PublicKey, symbol: string): Promise<TokenContract & IBasicTokenContract>;

buildERC20Contract(address, name, symbol, decimals)

Constructs and deploys an ERC20 token contract.

This function creates a new contract class that implements the IERC20 interface, compiles it, and deploys it to the blockchain. The returned contract instance can be used to interact with the token’s functionality.

Parameters
Name Type Description

address

PublicKey

The address of the token contract on the blockchain.

name

string

The name of the token.

symbol

string

The symbol of the token.

decimals

number

The number of decimals used to represent token amounts.

Returns

Promise<TokenContract & IERC20>

A promise that resolves to the deployed contract instance.

Signature
export declare function buildERC20Contract(address: PublicKey, name: string, symbol: string, decimals: number): Promise<TokenContract & IERC20>;

buildERC677Contract(address, name, symbol, decimals)

Builds and returns an instance of an ERC677 token contract.

Parameters
Name Type Description

address

PublicKey

The contract address.

name

string

The token name.

symbol

string

The token symbol.

decimals

number

The number of decimals for token precision.

Returns

Promise<TokenContract & IERC677>

{Promise<SmartContract & IERC677>} - A promise that resolves to the constructed contract instance.

Signature
export declare function buildERC677Contract(address: PublicKey, name: string, symbol: string, decimals: number): Promise<TokenContract & IERC677>;

buildOracleRequestTx(sender, zkApp, oracleRequest)

Builds a Mina transaction that sends an Oracle request to a designated zkApp.

Parameters
Name Type Description

sender

FeePayerSpec

The fee payer specification for the transaction.

zkApp

SmartContract & IOracleClient

The zkApp contract that accepts Oracle requests, also implementing the IOracleClient interface.

oracleRequest

OracleRequest

The data for the Oracle request, represented as an OracleRequest object.

Returns

Promise<o1js!Transaction<false, false>>

{Promise<Mina.Transaction>} A promise that resolves to a Mina transaction containing the Oracle request.

Signature
export declare function buildOracleRequestTx(sender: Mina.FeePayerSpec, zkApp: SmartContract & IOracleClient, oracleRequest: OracleRequest): Promise<Mina.Transaction<false, false>>;

buildTransferAndCallTx(sender, pk, zkApp, oracleRequest)

Builds a transfer and call transaction.

Parameters
Name Type Description

sender

FeePayerSpec

The sender of the transaction.

pk

PublicKey

zkApp

SmartContract & IOracleClient

The smart contract that implements the OracleClient interface.

oracleRequest

OracleRequest

The oracle request to be sent. {Promise<Mina.Transaction>} A promise that resolves to the built transaction.

Returns

Promise<o1js!Transaction<false, false>>

Signature
export declare function buildTransferAndCallTx(sender: Mina.FeePayerSpec, pk: PublicKey, zkApp: SmartContract & IOracleClient, oracleRequest: OracleRequest): Promise<Mina.Transaction<false, false>>;
© OpenNautilus 2024-