Ola Developer Documents
  • Introduction
    • What is Ola
    • Advanced Features
    • Roadmap & Release Notes
  • Quick Start
    • Setup Environment
    • Setting up an Account
    • Deploying a Smart Contract
    • Interacting with a Smart Contract
    • Running smart contract locally
  • Ola Language
  • OlaVM
    • Concepts
      • Accounts
      • Contracts
      • Notes
      • Transaction
      • Transition
      • Blocks
    • OlaVM Architecture
      • VM
      • Circuits
    • GPU acceleration
  • OlaOS
    • Installation Guide
    • Run an OlaOS Node
    • Command Line Interface
    • OlaOS Architecture
    • System Contracts
  • API/SDK
    • APIs
    • Javascript SDK
  • Developer Tools and Resources
Powered by GitBook
On this page
  • Prerequisites
  • Introduction
  • Call a function
  • Invoke a function
  1. Quick Start

Interacting with a Smart Contract

PreviousDeploying a Smart ContractNextRunning smart contract locally

Last updated 1 year ago

Prerequisites

Ensure Olatte is installed correctly:

olatte --version

If this command fails, see

Introduction

Olatte enables interaction with smart contracts via two primary methods:

  • call: for read-only functions.

  • invoke: for write functions that modify the state.

Call a function

The call command can query a smart contract function without sending a transaction.

As an example you can use the get_proposer function which expect index of the proposal and returns the address of the proposer:

olatte call --network=pre-alpha vote_simple_abi.json  \
    0x444b2e790621ac6b74923f7ad92....\
    winningProposal
  • vote_simple_abi.json is the smart contract's abi file.

  • 0x444b.. is the contract address

  • winningProposal is function name. For functions with parameters, enter the function's inputs after the function name.

This will return the winner proposal:

    0

Invoke a function

when we need to modify the state of the smart contract, we need to send a transaction. This requires the use of the invoke command in Olatte, which sends a transaction to the Ola network.

In this example, we are sending a transaction to vote for proposal 7.

olatte invoke --network pre-alpha vote_simple_abi.json \
0x444b2e790621ac6b74923f7ad92.... \
vote 7
Setting up your environment.