Skip to content

Commit

Permalink
resolve all TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
hal3e committed Jan 16, 2025
1 parent a8c9754 commit ffb3d11
Show file tree
Hide file tree
Showing 17 changed files with 136 additions and 165 deletions.
6 changes: 3 additions & 3 deletions e2e/tests/configurables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn contract_default_configurables() -> Result<()> {

let wallet = launch_provider_and_get_wallet().await?;

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"sway/contracts/configurables/out/release/configurables.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -125,7 +125,7 @@ async fn contract_configurables() -> Result<()> {
.with_STRUCT(new_struct.clone())?
.with_ENUM(new_enum.clone())?;

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"sway/contracts/configurables/out/release/configurables.bin",
LoadConfiguration::default().with_configurables(configurables),
)?
Expand Down Expand Up @@ -192,7 +192,7 @@ async fn contract_manual_configurables() -> Result<()> {
.with_STRUCT(new_struct.clone())?
.with_ENUM(new_enum.clone())?;

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"sway/contracts/configurables/out/release/configurables.bin",
LoadConfiguration::default(),
)?
Expand Down
28 changes: 14 additions & 14 deletions e2e/tests/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ async fn setup_output_variable_estimation_test() -> Result<(
let wallet_config = WalletsConfig::new(Some(3), None, None);
let wallets = launch_custom_provider_and_get_wallets(wallet_config, None, None).await?;

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"sway/contracts/token_ops/out/release/token_ops.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -1750,7 +1750,7 @@ async fn contract_encoder_config_is_applied() -> Result<()> {
)),
Wallets("wallet")
);
let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"sway/contracts/contract_test/out/release/contract_test.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -1959,7 +1959,7 @@ async fn simulations_can_be_made_without_coins() -> Result<()> {
let wallets = setup_node_with_high_price().await?;
let wallet = wallets.first().expect("has wallet");

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"sway/contracts/contract_test/out/release/contract_test.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -1990,7 +1990,7 @@ async fn simulations_can_be_made_without_coins_multicall() -> Result<()> {
let wallets = setup_node_with_high_price().await?;
let wallet = wallets.first().expect("has wallet");

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"sway/contracts/contract_test/out/release/contract_test.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -2049,7 +2049,7 @@ async fn contract_call_with_non_zero_base_asset_id_and_tip() -> Result<()> {
let wallets = launch_custom_provider_and_get_wallets(wallet_config, None, Some(config)).await?;
let wallet = wallets.first().expect("has wallet");

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"sway/contracts/contract_test/out/release/contract_test.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -2230,7 +2230,7 @@ async fn blob_contract_deployment() -> Result<()> {

let contract = Contract::load_from(contract_binary, LoadConfiguration::default())?;

let contract_id = contract
let (contract_id, _) = contract
.convert_to_loader(100_000)?
.deploy_if_not_exists(&wallets[0], TxPolicies::default())
.await?;
Expand Down Expand Up @@ -2258,7 +2258,7 @@ async fn regular_contract_can_be_deployed() -> Result<()> {
let contract_binary = "sway/contracts/contract_test/out/release/contract_test.bin";

// when
let contract_id = Contract::load_from(contract_binary, LoadConfiguration::default())?
let (contract_id, _) = Contract::load_from(contract_binary, LoadConfiguration::default())?
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;

Expand Down Expand Up @@ -2289,7 +2289,7 @@ async fn unuploaded_loader_can_be_deployed_directly() -> Result<()> {

let contract_binary = "sway/contracts/huge_contract/out/release/huge_contract.bin";

let contract_id = Contract::load_from(contract_binary, LoadConfiguration::default())?
let (contract_id, _) = Contract::load_from(contract_binary, LoadConfiguration::default())?
.convert_to_loader(1024)?
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;
Expand Down Expand Up @@ -2325,7 +2325,7 @@ async fn unuploaded_loader_can_upload_blobs_separately_then_deploy() -> Result<(
// if this were an example for the user we'd just call `deploy` on the contract above
// this way we are testing that the blobs were really deployed above, otherwise the following
// would fail
let contract_id = Contract::loader_from_blob_ids(
let (contract_id, _) = Contract::loader_from_blob_ids(
blob_ids.to_vec(),
contract.salt(),
contract.storage_slots().to_vec(),
Expand Down Expand Up @@ -2361,7 +2361,7 @@ async fn loader_blob_already_uploaded_not_an_issue() -> Result<()> {
.await?;

// this will try to upload the blobs but skip upon encountering an error
let contract_id = contract
let (contract_id, _) = contract
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;

Expand Down Expand Up @@ -2391,14 +2391,14 @@ async fn loader_works_via_proxy() -> Result<()> {

let contract = Contract::load_from(contract_binary, LoadConfiguration::default())?;

let contract_id = contract
let (contract_id, _) = contract
.convert_to_loader(100)?
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;

let contract_binary = "sway/contracts/proxy/out/release/proxy.bin";

let proxy_id = Contract::load_from(contract_binary, LoadConfiguration::default())?
let (proxy_id, _) = Contract::load_from(contract_binary, LoadConfiguration::default())?
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;

Expand Down Expand Up @@ -2442,7 +2442,7 @@ async fn loader_storage_works_via_proxy() -> Result<()> {
let contract = Contract::load_from(contract_binary, LoadConfiguration::default())?;
let contract_storage_slots = contract.storage_slots().to_vec();

let contract_id = contract
let (contract_id, _) = contract
.convert_to_loader(100)?
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;
Expand All @@ -2452,7 +2452,7 @@ async fn loader_storage_works_via_proxy() -> Result<()> {

let combined_storage_slots = [&contract_storage_slots, proxy_contract.storage_slots()].concat();

let proxy_id = proxy_contract
let (proxy_id, _) = proxy_contract
.with_storage_slots(combined_storage_slots)
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;
Expand Down
10 changes: 5 additions & 5 deletions e2e/tests/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ async fn test_multi_call_contract_with_contract_logs() -> Result<()> {
),
);

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"./sway/logs/contract_logs/out/release/contract_logs.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -737,7 +737,7 @@ async fn test_contract_with_contract_logs() -> Result<()> {
)
);

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"./sway/logs/contract_logs/out/release/contract_logs.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -1020,7 +1020,7 @@ async fn test_contract_require_from_contract() -> Result<()> {
)
);

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"./sway/contracts/lib_contract/out/release/lib_contract.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -1074,7 +1074,7 @@ async fn test_multi_call_contract_require_from_contract() -> Result<()> {
),
);

let contract_id = Contract::load_from(
let (contract_id, _) = Contract::load_from(
"./sway/contracts/lib_contract/out/release/lib_contract.bin",
LoadConfiguration::default(),
)?
Expand Down Expand Up @@ -1166,7 +1166,7 @@ async fn test_loader_script_require_from_loader_contract() -> Result<()> {

let contract_binary = "sway/contracts/lib_contract/out/release/lib_contract.bin";
let contract = Contract::load_from(contract_binary, LoadConfiguration::default())?;
let contract_id = contract
let (contract_id, _) = contract
.convert_to_loader(100_000)?
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;
Expand Down
Loading

0 comments on commit ffb3d11

Please sign in to comment.