Skip to content

Commit

Permalink
chore(deps): alloy-core patch
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-atreya committed Jan 17, 2025
1 parent 9db483f commit b9eddc8
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 30 deletions.
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,7 @@ serde = "1.0"
serde_json = "1.0"

[patch.crates-io]
# alloy = { git = "https://github.com/alloy-rs/alloy", rev = "65dfbe" }
# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "d113d6e" }
alloy-core = { git = "https://github.com/alloy-rs/core", branch = "yash/fix-fn-ret" }
alloy-sol-types = { git = "https://github.com/alloy-rs/core", branch = "yash/fix-fn-ret" }
alloy-primitives = { git = "https://github.com/alloy-rs/core", branch = "yash/fix-fn-ret" }
alloy-dyn-abi = { git = "https://github.com/alloy-rs/core", branch = "yash/fix-fn-ret" }
2 changes: 1 addition & 1 deletion examples/contracts/examples/deploy_from_artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async fn main() -> Result<()> {
// return value must be accessed by index - as if it is an unnamed value.
// If you prefer to use named return values, it is recommended to embed the Solidity code
// directly in the `sol!` macro as shown in `deploy_from_contract.rs`.
let number = builder.call().await?._0;
let number = builder.call().await?;

println!("Retrieved number: {number}");

Expand Down
2 changes: 1 addition & 1 deletion examples/contracts/examples/deploy_from_bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async fn main() -> Result<()> {

// Retrieve the number, which should be 43.
let builder = contract.number();
let number = builder.call().await?.number.to_string();
let number = builder.call().await?.to_string();

println!("Retrieved number: {number}");

Expand Down
2 changes: 1 addition & 1 deletion examples/contracts/examples/deploy_from_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async fn main() -> Result<()> {

// Retrieve the number, which should be 43.
let builder = contract.number();
let number = builder.call().await?.number.to_string();
let number = builder.call().await?.to_string();

println!("Retrieved number: {number}");

Expand Down
2 changes: 1 addition & 1 deletion examples/contracts/examples/interact_with_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async fn main() -> Result<()> {
let contract = IWETH9::new(address!("C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), provider);

// Call the contract, retrieve the total supply.
let total_supply = contract.totalSupply().call().await?._0;
let total_supply = contract.totalSupply().call().await?;

println!("WETH total supply is {total_supply}");

Expand Down
2 changes: 1 addition & 1 deletion examples/node-bindings/examples/anvil_deploy_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async fn main() -> Result<()> {

// Retrieve the number, which should be 43.
let builder = contract.number();
let number = builder.call().await?.number.to_string();
let number = builder.call().await?.to_string();

println!("Retrieved number: {number}");

Expand Down
4 changes: 2 additions & 2 deletions examples/node-bindings/examples/anvil_set_storage_at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async fn main() -> Result<()> {
let account = address!("F605F9d1cB055E87E30bcAEe4CB9389a35aBe8Ff");

// Get the WETH balance of the target account before mocking.
let balance_before = iweth.balanceOf(account).call().await?._0;
let balance_before = iweth.balanceOf(account).call().await?;
println!("WETH balance before: {}", balance_before);
assert_eq!(balance_before, U256::ZERO);

Expand All @@ -42,7 +42,7 @@ async fn main() -> Result<()> {
provider.anvil_set_storage_at(WETH_ADDR, hashed_slot.into(), mocked_balance.into()).await?;

// Get the WETH balance of the target account after mocking.
let balance_after = iweth.balanceOf(account).call().await?._0;
let balance_after = iweth.balanceOf(account).call().await?;
println!("WETH balance after: {}", balance_after);
assert_eq!(balance_after, mocked_balance);

Expand Down
28 changes: 12 additions & 16 deletions examples/sol-macro/examples/decode_returns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,23 @@ sol!(
);

fn main() -> Result<()> {
let result = getRoundDataCall::abi_decode_returns(
&hex!(
"0000000000000000000000000000000000000000000000060000000000004716
let (round_id, answer, started_at, updated_at, answered_in_round) =
getRoundDataCall::abi_decode_returns(
&hex!(
"0000000000000000000000000000000000000000000000060000000000004716
00000000000000000000000000000000000000000000000000000051faad1c80
000000000000000000000000000000000000000000000000000000006669627b
000000000000000000000000000000000000000000000000000000006669627b
0000000000000000000000000000000000000000000000060000000000004716"
),
true,
);
),
true,
)?;

assert_eq!(
result,
Ok(getRoundDataReturn {
roundId: Uint::<80, 2>::from(110680464442257327894_u128),
answer: I256::from_dec_str("352098000000")?,
startedAt: U256::from(1718182523),
updatedAt: U256::from(1718182523),
answeredInRound: Uint::<80, 2>::from(110680464442257327894_u128),
})
);
assert_eq!(round_id, Uint::<80, 2>::from(110680464442257327894_u128));
assert_eq!(answer, I256::from_dec_str("352098000000")?);
assert_eq!(started_at, U256::from(1718182523));
assert_eq!(updated_at, U256::from(1718182523));
assert_eq!(answered_in_round, Uint::<80, 2>::from(110680464442257327894_u128));

Ok(())
}
8 changes: 4 additions & 4 deletions examples/transactions/examples/transfer_erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ async fn main() -> Result<()> {
let contract = ERC20Example::deploy(provider).await?;

// Register the balances of Alice and Bob before the transfer.
let alice_before_balance = contract.balanceOf(alice).call().await?._0;
let bob_before_balance = contract.balanceOf(bob).call().await?._0;
let alice_before_balance = contract.balanceOf(alice).call().await?;
let bob_before_balance = contract.balanceOf(bob).call().await?;

// Transfer and wait for inclusion.
let amount = U256::from(100);
Expand All @@ -43,8 +43,8 @@ async fn main() -> Result<()> {
println!("Sent transaction: {tx_hash}");

// Register the balances of Alice and Bob after the transfer.
let alice_after_balance = contract.balanceOf(alice).call().await?._0;
let bob_after_balance = contract.balanceOf(bob).call().await?._0;
let alice_after_balance = contract.balanceOf(alice).call().await?;
let bob_after_balance = contract.balanceOf(bob).call().await?;

// Check the balances of Alice and Bob after the transfer.
assert_eq!(alice_before_balance - alice_after_balance, amount);
Expand Down
2 changes: 1 addition & 1 deletion examples/transactions/examples/with_access_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async fn main() -> Result<()> {
println!("Transaction hash: {tx_hash}");

// Check the value of the contract.
let value = contract.getValue().call().await?._0;
let value = contract.getValue().call().await?;

assert_eq!(value, "hello");

Expand Down

0 comments on commit b9eddc8

Please sign in to comment.