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 harness.rs
mod functions;
mod utils;
use crate::utils::interface::{
pyth_core::{price, update_fee, update_price_feeds},
pyth_init::constructor,
};
use crate::utils::setup::{Price, PriceFeed, PythOracleContract, PythOracleContractConfigurables};
use fuels::{
accounts::{
fuel_crypto::rand::{self, rngs::StdRng, Rng, SeedableRng},
wallet::WalletUnlocked,
},
prelude::{abigen, Contract, LoadConfiguration, Provider, TxParameters},
};
const RPC: &str = "beta-4.fuel.network";
#[tokio::test]
async fn deploy() {
dotenv::dotenv().ok();
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(
PythOracleContractConfigurables::new().with_DEPLOYER(admin.address().into()),
); //fixme
let id = Contract::load_from("./out/debug/pyth-contract.bin", config)
.unwrap()
.with_salt(salt)
.deploy(&admin, TxParameters::default().with_gas_price(1))
.await
.unwrap();
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(),
// DEFAULT_SINGLE_UPDATE_FEE,
// 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
PythOracleContractConfigurables::new().with_DEPLOYER(admin.address().into())
With next error
I checked the abi and there is no configurable in abi
toolchain
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup
installed toolchains
--------------------
beta-3-aarch64-apple-darwin
beta-4-rc.2-aarch64-apple-darwin
latest-aarch64-apple-darwin (default)
beta-4-aarch64-apple-darwin
hotfix
latest-2023-09-25-aarch64-apple-darwin
my-custom-toolchain
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