Skip to content

Commit

Permalink
Merge pull request #22 from karnotxyz/feat/added_proxy_versions
Browse files Browse the repository at this point in the history
feat : updated unsafe proxy function
  • Loading branch information
apoorvsadana authored Jul 3, 2024
2 parents aa18f67 + 05e234a commit dab8928
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/l2/starknet-proxy-client/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use ethers::prelude::ContractInstance;
use ethers::providers::ProviderError;
use ethers::types::U256;
use ethers::utils::hex::{self};
use std::cmp::PartialEq;
use std::sync::Arc;
use utils::LocalWalletSignerMiddleware;

Expand Down Expand Up @@ -32,6 +33,7 @@ const UNSAFE_PROXY: &str = include_str!("artifacts/UnsafeProxy.json");
const SAFE_PROXY_3_0_2: &str = include_str!("artifacts/Proxy_3_0_2.json");
const SAFE_PROXY_5_0_0: &str = include_str!("artifacts/Proxy_5_0_0.json");

#[derive(PartialEq)]
pub enum ProxyVersion {
/// deploys unsafe proxy.
UnsafeProxy,
Expand Down Expand Up @@ -63,8 +65,12 @@ pub async fn deploy_contract_behind_proxy<T: Tokenize>(
ProxyVersion::UnsafeProxy => UNSAFE_PROXY,
};

let proxy_contract =
deploy_contract(client.clone(), proxy_code, Token::Uint(U256::from(0))).await?;
let proxy_contract = match proxy_type {
ProxyVersion::UnsafeProxy => {
deploy_contract(client.clone(), proxy_code, contract.address()).await?
}
_ => deploy_contract(client.clone(), proxy_code, Token::Uint(U256::from(0))).await?,
};

log::debug!(
"ℹ️ Proxy for contract [{:?}] deployed : {:?}",
Expand Down

0 comments on commit dab8928

Please sign in to comment.