diff --git a/control/preimage/src/commands.rs b/control/preimage/src/commands.rs index 13568b6a01..cc3dd2934d 100644 --- a/control/preimage/src/commands.rs +++ b/control/preimage/src/commands.rs @@ -27,6 +27,10 @@ use crate::bridge_hub_runtime::runtime_types::{ snowbridge_pallet_outbound_queue, snowbridge_pallet_system, }; use crate::bridge_hub_runtime::RuntimeCall as BridgeHubRuntimeCall; +use hex_literal::hex; +use sp_crypto_hashing::twox_64; + +const ASSET_HUB_CHANNEL_ID: [u8; 32] = hex!("c173fac324158e77fb5840738a1a541f633cbec8884c6a601c567d2b376a0539"); #[cfg(feature = "polkadot")] pub mod asset_hub_polkadot_types { @@ -149,12 +153,21 @@ pub fn outbound_queue_operating_mode(param: &OperatingModeEnum) -> BridgeHubRunt } pub fn upgrade(params: &UpgradeArgs) -> BridgeHubRuntimeCall { + let initializer = if params.initializer { + Some(( + params.initializer_params.as_ref().unwrap().clone(), + params.initializer_gas.unwrap(), + )) + } else { + None + }; + BridgeHubRuntimeCall::EthereumSystem(snowbridge_pallet_system::pallet::Call::upgrade { impl_address: params.logic_address.into_array().into(), impl_code_hash: params.logic_code_hash.0.into(), - initializer: Some(Initializer { - params: params.initializer_params.clone().into(), - maximum_required_gas: params.initializer_gas, + initializer: initializer.map(|(params, gas)| Initializer { + params: params.into(), + maximum_required_gas: gas, }), }) } @@ -263,6 +276,41 @@ pub fn set_assethub_fee(fee: u128) -> AssetHubRuntimeCall { ) } +pub fn set_inbound_nonce() -> BridgeHubRuntimeCall { + set_nonce("EthereumInboundQueue") +} + +pub fn set_outbound_nonce() -> BridgeHubRuntimeCall { + set_nonce("EthereumOutboundQueue") +} + +fn set_nonce(pallet_name: &str) -> BridgeHubRuntimeCall { + let new_nonce: Vec = 0u64.encode(); + + let mut key = Vec::new(); + let pallet_prefix = pallet_name.as_bytes(); + key.extend_from_slice(&twox_128(&pallet_prefix)); + + let storage_prefix = b"Nonce"; + key.extend_from_slice(&twox_128(storage_prefix)); + + let encoded_id = ASSET_HUB_CHANNEL_ID.encode(); + let hash_id_64 = twox_64(&encoded_id); + key.extend_from_slice(&hash_id_64); + key.extend_from_slice(&encoded_id); + + println!("nonce key for {}: 0x{}", pallet_name, hex::encode(&key)); + + BridgeHubRuntimeCall::System( + crate::bridge_hub_runtime::runtime_types::frame_system::pallet::Call::set_storage { + items: vec![( + key, + new_nonce, + )], + }, + ) +} + pub fn force_checkpoint(params: &ForceCheckpointArgs) -> BridgeHubRuntimeCall { let mut file = File::open(params.checkpoint.clone()).expect("File not found"); let mut data = String::new(); diff --git a/control/preimage/src/main.rs b/control/preimage/src/main.rs index b27e8a8523..ffd949b88b 100644 --- a/control/preimage/src/main.rs +++ b/control/preimage/src/main.rs @@ -61,6 +61,8 @@ pub enum Command { TreasuryProposal2024(TreasuryProposal2024Args), /// Governance update 202501 GovUpdate202501(GovUpdate202501Args), + /// Reinitialize bridge + ReinitializeBridge(ReinitializeBridgeArgs), } #[derive(Debug, Args)] @@ -112,13 +114,17 @@ pub struct UpgradeArgs { #[arg(long, value_name = "HASH", value_parser=parse_hex_bytes32)] logic_code_hash: FixedBytes<32>, + /// Initialize the logic contract + #[arg(long, requires_all=["initializer_params", "initializer_gas"])] + initializer: bool, + /// ABI-encoded params to pass to initializer - #[arg(long, value_name = "BYTES", value_parser=parse_hex_bytes)] - initializer_params: Bytes, + #[arg(long, requires = "initializer", value_name = "BYTES", value_parser=parse_hex_bytes)] + initializer_params: Option, /// Maximum gas required by the initializer - #[arg(long, value_name = "GAS")] - initializer_gas: u64, + #[arg(long, requires = "initializer", value_name = "GAS")] + initializer_gas: Option, } #[derive(Debug, Args)] @@ -242,6 +248,16 @@ pub struct RegisterEtherArgs { ether_decimals: u8, } +#[derive(Debug, Args)] +pub struct ReinitializeBridgeArgs { + //#[arg(long, value_name = "FILE")] + // pub checkpoint: PathBuf, + #[command(flatten)] + register_ether: RegisterEtherArgs, + #[command(flatten)] + gateway_address: GatewayAddressArgs, +} + #[derive(Debug, Args)] pub struct ApiEndpoints { #[arg(long, value_name = "URL")] @@ -318,14 +334,14 @@ async fn run() -> Result<(), Box> { .bridge_hub_api .unwrap_or(BRIDGE_HUB_API.to_owned()), ) - .await?; + .await?; let asset_hub_api: OnlineClient = OnlineClient::from_url( cli.api_endpoints .asset_hub_api .unwrap_or(ASSET_HUB_API.to_owned()), ) - .await?; + .await?; let relay_api: OnlineClient = OnlineClient::from_url(cli.api_endpoints.relay_api.unwrap_or(RELAY_API.to_owned())).await?; @@ -355,7 +371,7 @@ async fn run() -> Result<(), Box> { commands::force_checkpoint(¶ms.force_checkpoint), ], ) - .await?; + .await?; let (register_ether_call, set_ether_metadata_call) = commands::register_ether(¶ms.register_ether); let asset_hub_call = send_xcm_asset_hub( @@ -367,7 +383,7 @@ async fn run() -> Result<(), Box> { set_ethereum_fee, ], ) - .await?; + .await?; utility_force_batch(vec![bridge_hub_call, asset_hub_call]) } Command::UpdateAsset(params) => { @@ -378,7 +394,7 @@ async fn run() -> Result<(), Box> { commands::force_set_metadata(params), ], ) - .await? + .await? } Command::GatewayOperatingMode(params) => { let call = commands::gateway_operating_mode(¶ms.gateway_operating_mode); @@ -448,9 +464,9 @@ async fn run() -> Result<(), Box> { } Command::TreasuryProposal2024(params) => treasury_commands::treasury_proposal(¶ms), Command::GovUpdate202501(GovUpdate202501Args { - pricing_parameters, - register_ether, - }) => { + pricing_parameters, + register_ether, + }) => { let (set_pricing_parameters, set_ethereum_fee) = commands::pricing_parameters(&context, pricing_parameters).await?; @@ -470,6 +486,33 @@ async fn run() -> Result<(), Box> { ah_set_pricing_call, ah_register_ether_call, ]) + }, + Command::ReinitializeBridge(params) => { + //let force_checkpoint_call = commands::force_checkpoint(&ForceCheckpointArgs{ + // checkpoint: params.checkpoint.clone(), + // }); + let gateway_address_call = commands::set_gateway_address(¶ms.gateway_address); + let inbound_nonce_call = commands::set_inbound_nonce(); + let outbound_nonce_call = commands::set_outbound_nonce(); + let (register_ether_call, set_ether_metadata_call) = + commands::register_ether(¶ms.register_ether); + + let bridge_hub_call = send_xcm_bridge_hub(&context, vec![ + // force_checkpoint_call, + gateway_address_call, + inbound_nonce_call, + outbound_nonce_call, + ]).await?; + + let asset_hub_call = send_xcm_asset_hub( + &context, + vec![ + register_ether_call, + set_ether_metadata_call, + ], + ) + .await?; + utility_force_batch(vec![bridge_hub_call, asset_hub_call]) } }; diff --git a/control/runtimes/bridge-hub-paseo/bridge-hub-metadata.bin b/control/runtimes/bridge-hub-paseo/bridge-hub-metadata.bin index 44ff98ef80..b34a5c2fb1 100644 Binary files a/control/runtimes/bridge-hub-paseo/bridge-hub-metadata.bin and b/control/runtimes/bridge-hub-paseo/bridge-hub-metadata.bin differ diff --git a/control/runtimes/paseo/polkadot-metadata.bin b/control/runtimes/paseo/polkadot-metadata.bin index 53bb1448f4..241a943a6e 100644 Binary files a/control/runtimes/paseo/polkadot-metadata.bin and b/control/runtimes/paseo/polkadot-metadata.bin differ diff --git a/relayer/contracts/gateway.go b/relayer/contracts/gateway.go index 1a4eba075a..19207c678d 100644 --- a/relayer/contracts/gateway.go +++ b/relayer/contracts/gateway.go @@ -91,7 +91,7 @@ type VerificationProof struct { // GatewayMetaData contains all meta data concerning the Gateway contract. var GatewayMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"function\",\"name\":\"agentOf\",\"inputs\":[{\"name\":\"agentID\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"channelNoncesOf\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"internalType\":\"ChannelID\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"channelOperatingModeOf\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"internalType\":\"ChannelID\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumOperatingMode\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"implementation\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isTokenRegistered\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"operatingMode\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumOperatingMode\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pricingParameters\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"UD60x18\"},{\"name\":\"\",\"type\":\"uint128\",\"internalType\":\"uint128\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"queryForeignTokenID\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"quoteRegisterTokenFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"quoteSendTokenFee\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"destinationChain\",\"type\":\"uint32\",\"internalType\":\"ParaID\"},{\"name\":\"destinationFee\",\"type\":\"uint128\",\"internalType\":\"uint128\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"registerToken\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"sendToken\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"destinationChain\",\"type\":\"uint32\",\"internalType\":\"ParaID\"},{\"name\":\"destinationAddress\",\"type\":\"tuple\",\"internalType\":\"structMultiAddress\",\"components\":[{\"name\":\"kind\",\"type\":\"uint8\",\"internalType\":\"enumKind\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"name\":\"destinationFee\",\"type\":\"uint128\",\"internalType\":\"uint128\"},{\"name\":\"amount\",\"type\":\"uint128\",\"internalType\":\"uint128\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"submitV1\",\"inputs\":[{\"name\":\"message\",\"type\":\"tuple\",\"internalType\":\"structInboundMessage\",\"components\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"internalType\":\"ChannelID\"},{\"name\":\"nonce\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"command\",\"type\":\"uint8\",\"internalType\":\"enumCommand\"},{\"name\":\"params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"maxDispatchGas\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxFeePerGas\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"reward\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"id\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"leafProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"headerProof\",\"type\":\"tuple\",\"internalType\":\"structVerification.Proof\",\"components\":[{\"name\":\"header\",\"type\":\"tuple\",\"internalType\":\"structVerification.ParachainHeader\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"number\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extrinsicsRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"digestItems\",\"type\":\"tuple[]\",\"internalType\":\"structVerification.DigestItem[]\",\"components\":[{\"name\":\"kind\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"consensusEngineID\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}]},{\"name\":\"headProof\",\"type\":\"tuple\",\"internalType\":\"structVerification.HeadProof\",\"components\":[{\"name\":\"pos\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"width\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"proof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}]},{\"name\":\"leafPartial\",\"type\":\"tuple\",\"internalType\":\"structVerification.MMRLeafPartial\",\"components\":[{\"name\":\"version\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"parentNumber\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"nextAuthoritySetID\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextAuthoritySetLen\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"nextAuthoritySetRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"leafProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"leafProofOrder\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AgentCreated\",\"inputs\":[{\"name\":\"agentID\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"agent\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"AgentFundsWithdrawn\",\"inputs\":[{\"name\":\"agentID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"recipient\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ChannelCreated\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"ChannelID\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ChannelUpdated\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"ChannelID\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ForeignTokenRegistered\",\"inputs\":[{\"name\":\"tokenID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"token\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InboundMessageDispatched\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"ChannelID\"},{\"name\":\"nonce\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"messageID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"success\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OperatingModeChanged\",\"inputs\":[{\"name\":\"mode\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"enumOperatingMode\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OutboundMessageAccepted\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"ChannelID\"},{\"name\":\"nonce\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"messageID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"payload\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PricingParametersChanged\",\"inputs\":[],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TokenRegistrationSent\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TokenSent\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"destinationChain\",\"type\":\"uint32\",\"indexed\":true,\"internalType\":\"ParaID\"},{\"name\":\"destinationAddress\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structMultiAddress\",\"components\":[{\"name\":\"kind\",\"type\":\"uint8\",\"internalType\":\"enumKind\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"name\":\"amount\",\"type\":\"uint128\",\"indexed\":false,\"internalType\":\"uint128\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TokenTransferFeesChanged\",\"inputs\":[],\"anonymous\":false}]", + ABI: "[{\"type\":\"function\",\"name\":\"agentOf\",\"inputs\":[{\"name\":\"agentID\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"channelNoncesOf\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"internalType\":\"ChannelID\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"channelOperatingModeOf\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"internalType\":\"ChannelID\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumOperatingMode\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"depositEther\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"implementation\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isTokenRegistered\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"operatingMode\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumOperatingMode\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pricingParameters\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"UD60x18\"},{\"name\":\"\",\"type\":\"uint128\",\"internalType\":\"uint128\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"queryForeignTokenID\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"quoteRegisterTokenFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"quoteSendTokenFee\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"destinationChain\",\"type\":\"uint32\",\"internalType\":\"ParaID\"},{\"name\":\"destinationFee\",\"type\":\"uint128\",\"internalType\":\"uint128\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"registerToken\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"sendToken\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"destinationChain\",\"type\":\"uint32\",\"internalType\":\"ParaID\"},{\"name\":\"destinationAddress\",\"type\":\"tuple\",\"internalType\":\"structMultiAddress\",\"components\":[{\"name\":\"kind\",\"type\":\"uint8\",\"internalType\":\"enumKind\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"name\":\"destinationFee\",\"type\":\"uint128\",\"internalType\":\"uint128\"},{\"name\":\"amount\",\"type\":\"uint128\",\"internalType\":\"uint128\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"submitV1\",\"inputs\":[{\"name\":\"message\",\"type\":\"tuple\",\"internalType\":\"structInboundMessage\",\"components\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"internalType\":\"ChannelID\"},{\"name\":\"nonce\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"command\",\"type\":\"uint8\",\"internalType\":\"enumCommand\"},{\"name\":\"params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"maxDispatchGas\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"maxFeePerGas\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"reward\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"id\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"leafProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"headerProof\",\"type\":\"tuple\",\"internalType\":\"structVerification.Proof\",\"components\":[{\"name\":\"header\",\"type\":\"tuple\",\"internalType\":\"structVerification.ParachainHeader\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"number\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"extrinsicsRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"digestItems\",\"type\":\"tuple[]\",\"internalType\":\"structVerification.DigestItem[]\",\"components\":[{\"name\":\"kind\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"consensusEngineID\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}]},{\"name\":\"headProof\",\"type\":\"tuple\",\"internalType\":\"structVerification.HeadProof\",\"components\":[{\"name\":\"pos\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"width\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"proof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}]},{\"name\":\"leafPartial\",\"type\":\"tuple\",\"internalType\":\"structVerification.MMRLeafPartial\",\"components\":[{\"name\":\"version\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"parentNumber\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"nextAuthoritySetID\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"nextAuthoritySetLen\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"nextAuthoritySetRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"leafProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"leafProofOrder\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AgentCreated\",\"inputs\":[{\"name\":\"agentID\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"agent\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ChannelCreated\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"ChannelID\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ChannelUpdated\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"ChannelID\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Deposited\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ForeignTokenRegistered\",\"inputs\":[{\"name\":\"tokenID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"token\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InboundMessageDispatched\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"ChannelID\"},{\"name\":\"nonce\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"messageID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"success\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OperatingModeChanged\",\"inputs\":[{\"name\":\"mode\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"enumOperatingMode\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OutboundMessageAccepted\",\"inputs\":[{\"name\":\"channelID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"ChannelID\"},{\"name\":\"nonce\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"messageID\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"payload\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PricingParametersChanged\",\"inputs\":[],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TokenRegistrationSent\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TokenSent\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"destinationChain\",\"type\":\"uint32\",\"indexed\":true,\"internalType\":\"ParaID\"},{\"name\":\"destinationAddress\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structMultiAddress\",\"components\":[{\"name\":\"kind\",\"type\":\"uint8\",\"internalType\":\"enumKind\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"name\":\"amount\",\"type\":\"uint128\",\"indexed\":false,\"internalType\":\"uint128\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TokenTransferFeesChanged\",\"inputs\":[],\"anonymous\":false}]", } // GatewayABI is the input ABI used to generate the binding from. @@ -552,6 +552,27 @@ func (_Gateway *GatewayCallerSession) QuoteSendTokenFee(token common.Address, de return _Gateway.Contract.QuoteSendTokenFee(&_Gateway.CallOpts, token, destinationChain, destinationFee) } +// DepositEther is a paid mutator transaction binding the contract method 0x98ea5fca. +// +// Solidity: function depositEther() payable returns() +func (_Gateway *GatewayTransactor) DepositEther(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Gateway.contract.Transact(opts, "depositEther") +} + +// DepositEther is a paid mutator transaction binding the contract method 0x98ea5fca. +// +// Solidity: function depositEther() payable returns() +func (_Gateway *GatewaySession) DepositEther() (*types.Transaction, error) { + return _Gateway.Contract.DepositEther(&_Gateway.TransactOpts) +} + +// DepositEther is a paid mutator transaction binding the contract method 0x98ea5fca. +// +// Solidity: function depositEther() payable returns() +func (_Gateway *GatewayTransactorSession) DepositEther() (*types.Transaction, error) { + return _Gateway.Contract.DepositEther(&_Gateway.TransactOpts) +} + // RegisterToken is a paid mutator transaction binding the contract method 0x09824a80. // // Solidity: function registerToken(address token) payable returns() @@ -750,9 +771,9 @@ func (_Gateway *GatewayFilterer) ParseAgentCreated(log types.Log) (*GatewayAgent return event, nil } -// GatewayAgentFundsWithdrawnIterator is returned from FilterAgentFundsWithdrawn and is used to iterate over the raw logs and unpacked data for AgentFundsWithdrawn events raised by the Gateway contract. -type GatewayAgentFundsWithdrawnIterator struct { - Event *GatewayAgentFundsWithdrawn // Event containing the contract specifics and raw log +// GatewayChannelCreatedIterator is returned from FilterChannelCreated and is used to iterate over the raw logs and unpacked data for ChannelCreated events raised by the Gateway contract. +type GatewayChannelCreatedIterator struct { + Event *GatewayChannelCreated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -766,7 +787,7 @@ type GatewayAgentFundsWithdrawnIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *GatewayAgentFundsWithdrawnIterator) Next() bool { +func (it *GatewayChannelCreatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -775,7 +796,7 @@ func (it *GatewayAgentFundsWithdrawnIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(GatewayAgentFundsWithdrawn) + it.Event = new(GatewayChannelCreated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -790,7 +811,7 @@ func (it *GatewayAgentFundsWithdrawnIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(GatewayAgentFundsWithdrawn) + it.Event = new(GatewayChannelCreated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -806,61 +827,51 @@ func (it *GatewayAgentFundsWithdrawnIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *GatewayAgentFundsWithdrawnIterator) Error() error { +func (it *GatewayChannelCreatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *GatewayAgentFundsWithdrawnIterator) Close() error { +func (it *GatewayChannelCreatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// GatewayAgentFundsWithdrawn represents a AgentFundsWithdrawn event raised by the Gateway contract. -type GatewayAgentFundsWithdrawn struct { - AgentID [32]byte - Recipient common.Address - Amount *big.Int +// GatewayChannelCreated represents a ChannelCreated event raised by the Gateway contract. +type GatewayChannelCreated struct { + ChannelID [32]byte Raw types.Log // Blockchain specific contextual infos } -// FilterAgentFundsWithdrawn is a free log retrieval operation binding the contract event 0xf953871855f78d5ccdd6268f2d9d69fc67f26542a35d2bba1c615521aed57054. +// FilterChannelCreated is a free log retrieval operation binding the contract event 0xe7e6b36c9bc4c7817d3879c45d6ce1edd3c61b1966c488f1817697bb0b704525. // -// Solidity: event AgentFundsWithdrawn(bytes32 indexed agentID, address indexed recipient, uint256 amount) -func (_Gateway *GatewayFilterer) FilterAgentFundsWithdrawn(opts *bind.FilterOpts, agentID [][32]byte, recipient []common.Address) (*GatewayAgentFundsWithdrawnIterator, error) { +// Solidity: event ChannelCreated(bytes32 indexed channelID) +func (_Gateway *GatewayFilterer) FilterChannelCreated(opts *bind.FilterOpts, channelID [][32]byte) (*GatewayChannelCreatedIterator, error) { - var agentIDRule []interface{} - for _, agentIDItem := range agentID { - agentIDRule = append(agentIDRule, agentIDItem) - } - var recipientRule []interface{} - for _, recipientItem := range recipient { - recipientRule = append(recipientRule, recipientItem) + var channelIDRule []interface{} + for _, channelIDItem := range channelID { + channelIDRule = append(channelIDRule, channelIDItem) } - logs, sub, err := _Gateway.contract.FilterLogs(opts, "AgentFundsWithdrawn", agentIDRule, recipientRule) + logs, sub, err := _Gateway.contract.FilterLogs(opts, "ChannelCreated", channelIDRule) if err != nil { return nil, err } - return &GatewayAgentFundsWithdrawnIterator{contract: _Gateway.contract, event: "AgentFundsWithdrawn", logs: logs, sub: sub}, nil + return &GatewayChannelCreatedIterator{contract: _Gateway.contract, event: "ChannelCreated", logs: logs, sub: sub}, nil } -// WatchAgentFundsWithdrawn is a free log subscription operation binding the contract event 0xf953871855f78d5ccdd6268f2d9d69fc67f26542a35d2bba1c615521aed57054. +// WatchChannelCreated is a free log subscription operation binding the contract event 0xe7e6b36c9bc4c7817d3879c45d6ce1edd3c61b1966c488f1817697bb0b704525. // -// Solidity: event AgentFundsWithdrawn(bytes32 indexed agentID, address indexed recipient, uint256 amount) -func (_Gateway *GatewayFilterer) WatchAgentFundsWithdrawn(opts *bind.WatchOpts, sink chan<- *GatewayAgentFundsWithdrawn, agentID [][32]byte, recipient []common.Address) (event.Subscription, error) { +// Solidity: event ChannelCreated(bytes32 indexed channelID) +func (_Gateway *GatewayFilterer) WatchChannelCreated(opts *bind.WatchOpts, sink chan<- *GatewayChannelCreated, channelID [][32]byte) (event.Subscription, error) { - var agentIDRule []interface{} - for _, agentIDItem := range agentID { - agentIDRule = append(agentIDRule, agentIDItem) - } - var recipientRule []interface{} - for _, recipientItem := range recipient { - recipientRule = append(recipientRule, recipientItem) + var channelIDRule []interface{} + for _, channelIDItem := range channelID { + channelIDRule = append(channelIDRule, channelIDItem) } - logs, sub, err := _Gateway.contract.WatchLogs(opts, "AgentFundsWithdrawn", agentIDRule, recipientRule) + logs, sub, err := _Gateway.contract.WatchLogs(opts, "ChannelCreated", channelIDRule) if err != nil { return nil, err } @@ -870,8 +881,8 @@ func (_Gateway *GatewayFilterer) WatchAgentFundsWithdrawn(opts *bind.WatchOpts, select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(GatewayAgentFundsWithdrawn) - if err := _Gateway.contract.UnpackLog(event, "AgentFundsWithdrawn", log); err != nil { + event := new(GatewayChannelCreated) + if err := _Gateway.contract.UnpackLog(event, "ChannelCreated", log); err != nil { return err } event.Raw = log @@ -892,21 +903,21 @@ func (_Gateway *GatewayFilterer) WatchAgentFundsWithdrawn(opts *bind.WatchOpts, }), nil } -// ParseAgentFundsWithdrawn is a log parse operation binding the contract event 0xf953871855f78d5ccdd6268f2d9d69fc67f26542a35d2bba1c615521aed57054. +// ParseChannelCreated is a log parse operation binding the contract event 0xe7e6b36c9bc4c7817d3879c45d6ce1edd3c61b1966c488f1817697bb0b704525. // -// Solidity: event AgentFundsWithdrawn(bytes32 indexed agentID, address indexed recipient, uint256 amount) -func (_Gateway *GatewayFilterer) ParseAgentFundsWithdrawn(log types.Log) (*GatewayAgentFundsWithdrawn, error) { - event := new(GatewayAgentFundsWithdrawn) - if err := _Gateway.contract.UnpackLog(event, "AgentFundsWithdrawn", log); err != nil { +// Solidity: event ChannelCreated(bytes32 indexed channelID) +func (_Gateway *GatewayFilterer) ParseChannelCreated(log types.Log) (*GatewayChannelCreated, error) { + event := new(GatewayChannelCreated) + if err := _Gateway.contract.UnpackLog(event, "ChannelCreated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// GatewayChannelCreatedIterator is returned from FilterChannelCreated and is used to iterate over the raw logs and unpacked data for ChannelCreated events raised by the Gateway contract. -type GatewayChannelCreatedIterator struct { - Event *GatewayChannelCreated // Event containing the contract specifics and raw log +// GatewayChannelUpdatedIterator is returned from FilterChannelUpdated and is used to iterate over the raw logs and unpacked data for ChannelUpdated events raised by the Gateway contract. +type GatewayChannelUpdatedIterator struct { + Event *GatewayChannelUpdated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -920,7 +931,7 @@ type GatewayChannelCreatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *GatewayChannelCreatedIterator) Next() bool { +func (it *GatewayChannelUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -929,7 +940,7 @@ func (it *GatewayChannelCreatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(GatewayChannelCreated) + it.Event = new(GatewayChannelUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -944,7 +955,7 @@ func (it *GatewayChannelCreatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(GatewayChannelCreated) + it.Event = new(GatewayChannelUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -960,51 +971,51 @@ func (it *GatewayChannelCreatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *GatewayChannelCreatedIterator) Error() error { +func (it *GatewayChannelUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *GatewayChannelCreatedIterator) Close() error { +func (it *GatewayChannelUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// GatewayChannelCreated represents a ChannelCreated event raised by the Gateway contract. -type GatewayChannelCreated struct { +// GatewayChannelUpdated represents a ChannelUpdated event raised by the Gateway contract. +type GatewayChannelUpdated struct { ChannelID [32]byte Raw types.Log // Blockchain specific contextual infos } -// FilterChannelCreated is a free log retrieval operation binding the contract event 0xe7e6b36c9bc4c7817d3879c45d6ce1edd3c61b1966c488f1817697bb0b704525. +// FilterChannelUpdated is a free log retrieval operation binding the contract event 0x66e174b5e03ba247add8660a34e70bdd484239fe794c2567772e8e93a5c1696b. // -// Solidity: event ChannelCreated(bytes32 indexed channelID) -func (_Gateway *GatewayFilterer) FilterChannelCreated(opts *bind.FilterOpts, channelID [][32]byte) (*GatewayChannelCreatedIterator, error) { +// Solidity: event ChannelUpdated(bytes32 indexed channelID) +func (_Gateway *GatewayFilterer) FilterChannelUpdated(opts *bind.FilterOpts, channelID [][32]byte) (*GatewayChannelUpdatedIterator, error) { var channelIDRule []interface{} for _, channelIDItem := range channelID { channelIDRule = append(channelIDRule, channelIDItem) } - logs, sub, err := _Gateway.contract.FilterLogs(opts, "ChannelCreated", channelIDRule) + logs, sub, err := _Gateway.contract.FilterLogs(opts, "ChannelUpdated", channelIDRule) if err != nil { return nil, err } - return &GatewayChannelCreatedIterator{contract: _Gateway.contract, event: "ChannelCreated", logs: logs, sub: sub}, nil + return &GatewayChannelUpdatedIterator{contract: _Gateway.contract, event: "ChannelUpdated", logs: logs, sub: sub}, nil } -// WatchChannelCreated is a free log subscription operation binding the contract event 0xe7e6b36c9bc4c7817d3879c45d6ce1edd3c61b1966c488f1817697bb0b704525. +// WatchChannelUpdated is a free log subscription operation binding the contract event 0x66e174b5e03ba247add8660a34e70bdd484239fe794c2567772e8e93a5c1696b. // -// Solidity: event ChannelCreated(bytes32 indexed channelID) -func (_Gateway *GatewayFilterer) WatchChannelCreated(opts *bind.WatchOpts, sink chan<- *GatewayChannelCreated, channelID [][32]byte) (event.Subscription, error) { +// Solidity: event ChannelUpdated(bytes32 indexed channelID) +func (_Gateway *GatewayFilterer) WatchChannelUpdated(opts *bind.WatchOpts, sink chan<- *GatewayChannelUpdated, channelID [][32]byte) (event.Subscription, error) { var channelIDRule []interface{} for _, channelIDItem := range channelID { channelIDRule = append(channelIDRule, channelIDItem) } - logs, sub, err := _Gateway.contract.WatchLogs(opts, "ChannelCreated", channelIDRule) + logs, sub, err := _Gateway.contract.WatchLogs(opts, "ChannelUpdated", channelIDRule) if err != nil { return nil, err } @@ -1014,8 +1025,8 @@ func (_Gateway *GatewayFilterer) WatchChannelCreated(opts *bind.WatchOpts, sink select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(GatewayChannelCreated) - if err := _Gateway.contract.UnpackLog(event, "ChannelCreated", log); err != nil { + event := new(GatewayChannelUpdated) + if err := _Gateway.contract.UnpackLog(event, "ChannelUpdated", log); err != nil { return err } event.Raw = log @@ -1036,21 +1047,21 @@ func (_Gateway *GatewayFilterer) WatchChannelCreated(opts *bind.WatchOpts, sink }), nil } -// ParseChannelCreated is a log parse operation binding the contract event 0xe7e6b36c9bc4c7817d3879c45d6ce1edd3c61b1966c488f1817697bb0b704525. +// ParseChannelUpdated is a log parse operation binding the contract event 0x66e174b5e03ba247add8660a34e70bdd484239fe794c2567772e8e93a5c1696b. // -// Solidity: event ChannelCreated(bytes32 indexed channelID) -func (_Gateway *GatewayFilterer) ParseChannelCreated(log types.Log) (*GatewayChannelCreated, error) { - event := new(GatewayChannelCreated) - if err := _Gateway.contract.UnpackLog(event, "ChannelCreated", log); err != nil { +// Solidity: event ChannelUpdated(bytes32 indexed channelID) +func (_Gateway *GatewayFilterer) ParseChannelUpdated(log types.Log) (*GatewayChannelUpdated, error) { + event := new(GatewayChannelUpdated) + if err := _Gateway.contract.UnpackLog(event, "ChannelUpdated", log); err != nil { return nil, err } event.Raw = log return event, nil } -// GatewayChannelUpdatedIterator is returned from FilterChannelUpdated and is used to iterate over the raw logs and unpacked data for ChannelUpdated events raised by the Gateway contract. -type GatewayChannelUpdatedIterator struct { - Event *GatewayChannelUpdated // Event containing the contract specifics and raw log +// GatewayDepositedIterator is returned from FilterDeposited and is used to iterate over the raw logs and unpacked data for Deposited events raised by the Gateway contract. +type GatewayDepositedIterator struct { + Event *GatewayDeposited // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1064,7 +1075,7 @@ type GatewayChannelUpdatedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *GatewayChannelUpdatedIterator) Next() bool { +func (it *GatewayDepositedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1073,7 +1084,7 @@ func (it *GatewayChannelUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(GatewayChannelUpdated) + it.Event = new(GatewayDeposited) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1088,7 +1099,7 @@ func (it *GatewayChannelUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(GatewayChannelUpdated) + it.Event = new(GatewayDeposited) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1104,51 +1115,42 @@ func (it *GatewayChannelUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *GatewayChannelUpdatedIterator) Error() error { +func (it *GatewayDepositedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *GatewayChannelUpdatedIterator) Close() error { +func (it *GatewayDepositedIterator) Close() error { it.sub.Unsubscribe() return nil } -// GatewayChannelUpdated represents a ChannelUpdated event raised by the Gateway contract. -type GatewayChannelUpdated struct { - ChannelID [32]byte - Raw types.Log // Blockchain specific contextual infos +// GatewayDeposited represents a Deposited event raised by the Gateway contract. +type GatewayDeposited struct { + Sender common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterChannelUpdated is a free log retrieval operation binding the contract event 0x66e174b5e03ba247add8660a34e70bdd484239fe794c2567772e8e93a5c1696b. +// FilterDeposited is a free log retrieval operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. // -// Solidity: event ChannelUpdated(bytes32 indexed channelID) -func (_Gateway *GatewayFilterer) FilterChannelUpdated(opts *bind.FilterOpts, channelID [][32]byte) (*GatewayChannelUpdatedIterator, error) { - - var channelIDRule []interface{} - for _, channelIDItem := range channelID { - channelIDRule = append(channelIDRule, channelIDItem) - } +// Solidity: event Deposited(address sender, uint256 amount) +func (_Gateway *GatewayFilterer) FilterDeposited(opts *bind.FilterOpts) (*GatewayDepositedIterator, error) { - logs, sub, err := _Gateway.contract.FilterLogs(opts, "ChannelUpdated", channelIDRule) + logs, sub, err := _Gateway.contract.FilterLogs(opts, "Deposited") if err != nil { return nil, err } - return &GatewayChannelUpdatedIterator{contract: _Gateway.contract, event: "ChannelUpdated", logs: logs, sub: sub}, nil + return &GatewayDepositedIterator{contract: _Gateway.contract, event: "Deposited", logs: logs, sub: sub}, nil } -// WatchChannelUpdated is a free log subscription operation binding the contract event 0x66e174b5e03ba247add8660a34e70bdd484239fe794c2567772e8e93a5c1696b. +// WatchDeposited is a free log subscription operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. // -// Solidity: event ChannelUpdated(bytes32 indexed channelID) -func (_Gateway *GatewayFilterer) WatchChannelUpdated(opts *bind.WatchOpts, sink chan<- *GatewayChannelUpdated, channelID [][32]byte) (event.Subscription, error) { - - var channelIDRule []interface{} - for _, channelIDItem := range channelID { - channelIDRule = append(channelIDRule, channelIDItem) - } +// Solidity: event Deposited(address sender, uint256 amount) +func (_Gateway *GatewayFilterer) WatchDeposited(opts *bind.WatchOpts, sink chan<- *GatewayDeposited) (event.Subscription, error) { - logs, sub, err := _Gateway.contract.WatchLogs(opts, "ChannelUpdated", channelIDRule) + logs, sub, err := _Gateway.contract.WatchLogs(opts, "Deposited") if err != nil { return nil, err } @@ -1158,8 +1160,8 @@ func (_Gateway *GatewayFilterer) WatchChannelUpdated(opts *bind.WatchOpts, sink select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(GatewayChannelUpdated) - if err := _Gateway.contract.UnpackLog(event, "ChannelUpdated", log); err != nil { + event := new(GatewayDeposited) + if err := _Gateway.contract.UnpackLog(event, "Deposited", log); err != nil { return err } event.Raw = log @@ -1180,12 +1182,12 @@ func (_Gateway *GatewayFilterer) WatchChannelUpdated(opts *bind.WatchOpts, sink }), nil } -// ParseChannelUpdated is a log parse operation binding the contract event 0x66e174b5e03ba247add8660a34e70bdd484239fe794c2567772e8e93a5c1696b. +// ParseDeposited is a log parse operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. // -// Solidity: event ChannelUpdated(bytes32 indexed channelID) -func (_Gateway *GatewayFilterer) ParseChannelUpdated(log types.Log) (*GatewayChannelUpdated, error) { - event := new(GatewayChannelUpdated) - if err := _Gateway.contract.UnpackLog(event, "ChannelUpdated", log); err != nil { +// Solidity: event Deposited(address sender, uint256 amount) +func (_Gateway *GatewayFilterer) ParseDeposited(log types.Log) (*GatewayDeposited, error) { + event := new(GatewayDeposited) + if err := _Gateway.contract.UnpackLog(event, "Deposited", log); err != nil { return nil, err } event.Raw = log diff --git a/web/packages/test/config/beacon-relay.json b/web/packages/test/config/beacon-relay.json index e8b6d40c00..f838d2a15e 100644 --- a/web/packages/test/config/beacon-relay.json +++ b/web/packages/test/config/beacon-relay.json @@ -1,15 +1,15 @@ { "source": { "beacon": { - "endpoint": "http://127.0.0.1:9596", - "stateEndpoint": "http://127.0.0.1:9596", + "endpoint": "https://lodestar-sepolia.chainsafe.io", + "stateEndpoint": "https://lodestar-sepolia.chainsafe.io", "spec": { "syncCommitteeSize": 512, "slotsInEpoch": 32, "epochsPerSyncCommitteePeriod": 256, "forkVersions": { - "deneb": 0, - "electra": 2000000 + "deneb": 132608, + "electra": 222464 } }, "datastore": { @@ -27,3 +27,4 @@ "updateSlotInterval": 30 } } +