Fireblocks (Fireblocks Contract v0.1.2)

Copy Markdown View Source

Fireblocks Contract Interaction Library for Elixir.

This library allows you to read Solidity ABI JSON files and turn them into Elixir modules with proper documentation on each method. The generated modules can be used with Fireblocks.Evm.Contract.read/2 and Fireblocks.Evm.Contract.write/3 to interact with deployed smart contracts via the Fireblocks API.

Usage

Define a contract module using your ABI file:

defmodule MyApp.Contracts.ERC20 do
  use Fireblocks.Evm.Contract,
    abi_file: "priv/erc20-abi.json"
end

Then read state:

MyApp.Contracts.ERC20.name()
|> Fireblocks.Evm.Contract.read(
  baseAssetId: "ETH",
  contractAddress: "0x..."
)
# {:ok, "My Token"}

Or write state:

MyApp.Contracts.ERC20.transfer("0x...", 1_000)
|> Fireblocks.Evm.Contract.write(
  baseAssetId: "ETH",
  contractAddress: "0x...",
  vaultId: "1",
  feeLevel: :medium
)