No configurable field in abi pyth oracle contract

Hi guys
I’m trying to integrate Pyth Oracle with my spark perp market and swaylend but during the deployment of Oracle I have faced a strange bug:

Here is the code of the Pyth Oracle contract, we have the DEPLOYER configurable variable right here:

To automatize the deployment and initialization of the Oracle I built the next script in

mod functions;
mod utils;
use crate::utils::interface::{
    pyth_core::{price, update_fee, update_price_feeds},
use crate::utils::setup::{Price, PriceFeed, PythOracleContract, PythOracleContractConfigurables};

use fuels::{
        fuel_crypto::rand::{self, rngs::StdRng, Rng, SeedableRng},
    prelude::{abigen, Contract, LoadConfiguration, Provider, TxParameters},

const RPC: &str = "";

async fn deploy() {
    let provider = Provider::connect(RPC).await.unwrap();
    let admin_pk = std::env::var("PRIVATE_KEY").unwrap().parse().unwrap();
    let admin = WalletUnlocked::new_from_private_key(admin_pk, Some(provider.clone()));

    let mut rng = rand::thread_rng();
    let salt = rng.gen::<[u8; 32]>();
    let config = LoadConfiguration::default().with_configurables(
    ); //fixme
    let id = Contract::load_from("./out/debug/pyth-contract.bin", config)
        .deploy(&admin, TxParameters::default().with_gas_price(1))

    let block = provider.latest_block_height().await.unwrap();
    println!("✅ Contract deployed on beta-4");
    println!("start_block: {block}",);
    println!("0x..   = 0x{:?}", id.hash());
    println!("fuel.. = {:?}", id.to_string());

    let instance = PythOracleContract::new(id, admin.clone());
    // constructor(
    //     &instance,
    //     default_data_sources(),
    //     EXTENDED_TIME_PERIOD, //As the contract checks against the current timestamp, this allows unit testing with old but real price updates
    //     Bytes(guardian_set_upgrade_3_vaa_bytes()),
    // )
    // .await;

After I run this script using this command

cargo test --package pyth-contract --test integration_tests -- deploy --exact --nocapture 

It fails on that line


With next error

I checked the abi and there is no configurable in abi


Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup

installed toolchains
latest-aarch64-apple-darwin (default)

active toolchain
latest-aarch64-apple-darwin (default)
  forc : 0.46.0
    - forc-client
      - forc-deploy : 0.46.0
      - forc-run : 0.46.0
    - forc-doc : 0.46.0
    - forc-explore : 0.28.1
    - forc-fmt : 0.46.0
    - forc-index : 0.21.1
    - forc-lsp : 0.46.0
    - forc-tx : 0.46.0
    - forc-wallet : 0.3.0
  fuel-core : 0.20.7
  fuel-core-keygen : Error getting version string
  fuel-indexer : 0.21.1

fuels versions
forc : 0.45
forc-wallet : 0.45

Thanks for pointing this out; it seems as though the fact that the configureable constant DEPLOYER is only used in the storage block means that it’s not being recognised as used and is therefore being excluded. The issue to track for the fix: Configureable constant missing from ABI when only used in the storage block · Issue #5242 · FuelLabs/sway · GitHub
In the meantime the configurable constant DEPLOYER will have to manually set in the contract itself.


This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.