Skip to content

Commit

Permalink
docs: move safe image and refactor multicall page
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekjain23 committed May 9, 2024
1 parent 4be3111 commit a8cb859
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 32 deletions.
54 changes: 22 additions & 32 deletions docs/build/getting-started/multicall.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: 'Multicall3 allows you to bundle multiple calls to various contracts, for both reading and writing data, into a single transaction.'
description: 'It allows you to bundle multiple calls to various contracts, for both reading and writing data, into a single transaction.'
image: /img/logo/WASP_logo_dark.png
---

Expand All @@ -8,29 +8,23 @@ image: /img/logo/WASP_logo_dark.png

Multicall3 is a smart contract on the Ethereum Virtual Machine (EVM) that streamlines transactions. It allows you to bundle multiple calls to various contracts, for both reading and writing data, into a single transaction.

This can be particularly useful when working with decentralized applications that require multiple contract interactions or when batching multiple calls to save on gas costs. You can use the Multicall3 contract on Shimmer EVM deployed at the following address: [0xcA11bde05977b3631167028862bE2a173976CA11](https://explorer.evm.iota.org/address/0xcA11bde05977b3631167028862bE2a173976CA11?tab=write_contract).
This can be particularly useful when working with decentralized applications that require multiple contract interactions or when batching multiple calls to save on gas costs. To use the Multicall3 contract on Shimmer EVM, the Multicall3 contract is deployed at this address: [0xcA11bde05977b3631167028862bE2a173976CA11](https://explorer.evm.iota.org/address/0xcA11bde05977b3631167028862bE2a173976CA11?tab=write_contract).

## Benefits of Multicall3
This contract offers significant advantages for optimizing transaction processing on L2 networks, also known as Layer 2 scaling solutions. Here's how Multicall3 enhances efficiency:

### Reduced Gas Costs
Multicall3 minimizes the total gas fees associated with interacting with the blockchain by grouping calls together.
- **Reduced Gas Costs:** By grouping calls together, Multicall3 minimizes the total gas fees associated with interacting with the blockchain. Gas refers to the computational effort required to execute a transaction on the network.

### Guaranteed Data Consistency:
Multicall3 fetches data from a single block on the blockchain, ensuring that all the information you receive reflects a consistent state. This eliminates discrepancies that might arise from fetching data across separate transactions.
- **Guaranteed Data Consistency:** Multicall3 fetches data from a single block on the blockchain, ensuring that all the information you receive reflects a consistent state. This eliminates discrepancies that might arise from fetching data across separate transactions.

### Faster Execution Speeds:
You no longer need to wait for individual transactions to be confirmed one by one. Multicall3 processes everything efficiently in a single transaction, significantly speeding up the overall process.
- **Faster Execution Speeds:** You no longer need to wait for individual transactions to be confirmed one by one. Multicall3 processes everything efficiently in a single transaction, significantly speeding up the overall process.

### Simplified Workflows:
Multicall3 removes the complexity of worrying about the order in which transactions are processed, eliminating potential issues caused by race conditions. Race conditions occur when multiple transactions compete for resources, and the outcome can depend on the order they are executed.
- **Simplified Workflows:** Multicall3 removes the complexity of worrying about the order in which transactions are processed, eliminating potential issues caused by race conditions. Race conditions occur when multiple transactions compete for resources, and the outcome can depend on the order they are executed.

### All-or-Nothing Execution:
Multicall3 ensures data integrity by functioning on an all-or-nothing basis. This means that either all the calls within the Multicall3 transaction succeed, or none of them do. This prevents partial execution and maintains data consistency.
- **All-or-Nothing Execution:** Multicall3 ensures data integrity by functioning on an all-or-nothing basis. This means that either all the calls within the Multicall3 transaction succeed, or none of them do. This prevents partial execution and maintains data consistency.

:::tip

You can find the ABI of the contract in the [Multicall3 website](https://www.multicall3.com/abi).
TIP: You can find the ABI of the contract [here](https://www.multicall3.com/abi).

:::

Expand Down Expand Up @@ -58,7 +52,7 @@ function aggregate(Call[] calldata calls) public payable returns (uint256 blockN
```solidity
function tryAggregate(bool requireSuccess, Call[] calldata calls) public payable returns (Result[] memory returnData);
```
- Description: This function performs a similar function to aggregate but allows individual calls to fail without halting the entire execution.
- Description: This function performs a similar function to `aggregate` but allows individual calls to fail without halting the entire execution.

| Parameter Name | Description |
|----------------|-----------------------------------------------------------------------------|
Expand All @@ -77,7 +71,7 @@ function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls)
payable
returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);
```
- Description: This function combines features of tryAggregate and retrieves additional block information.
- Description: This function combines features of `tryAggregate` and retrieves additional block information.

| Parameter Name | Description |
|----------------|-----------------------------------------------------------------------------|
Expand All @@ -93,12 +87,9 @@ function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls)


### Function: blockAndAggregate

- Description:

This function is a simplified version of tryBlockAndAggregate that always requires all calls to succeed.

```solidity
- ## Description:
This function is a simplified version of `tryBlockAndAggregate` that always requires all calls to succeed.
```solidity
function blockAndAggregate(Call[] calldata calls)
public
payable
Expand All @@ -116,7 +107,7 @@ function blockAndAggregate(Call[] calldata calls)


### Function: aggregate3
- #### Description:
- ## Description:
This function aggregates calls similar to `aggregate` but allows specifying whether failures are allowed for each call individually.

```solidity
Expand All @@ -132,7 +123,7 @@ function aggregate3(Call3[] calldata calls) public payable returns (Result[] mem


### Function: aggregate3Value
- #### Description:
- ## Description:
This function aggregates calls with a specified value for each call, allowing sending funds along with the call data. It ensures the total sent value matches the sum of individual call values.


Expand All @@ -145,20 +136,19 @@ function aggregate3Value(Call3Value[] calldata calls) public payable returns (Re
| calls (Call[] calldata) | An array of Call3Value structs. Each Call3Value struct includes the target contract address (address), a flag indicating if failure is allowed (bool allowFailure), the value to send along with the call (uint256 value), and the encoded function call data (bytes callData).

- Return Values:
- returnData (Result[] memory): An array of Result structs, as defined in tryAggregate.
- returnData (Result[] memory): An array of Result structs, as defined in `tryAggregate`.



## Additional Functions

The contract also includes several view functions that retrieve blockchain data without modifying the state:

- getBlockHash(uint256 blockNumber): Returns the block hash for a given block number.
- getBlockNumber(): Returns the current block number.
- getCurrentBlockCoinbase(): Returns the address of the block miner (coinbase).
- getCurrentBlockDifficulty(): Returns the difficulty of the current block.
- getCurrentBlockGasLimit(): Returns the gas limit of the current block.
- getCurrentBlockTimestamp(): Returns
- `getBlockHash(uint256 blockNumber)`: Returns the block hash for a given block number.
- `getBlockNumber()`: Returns the current block number.
- `getCurrentBlockCoinbase()`: Returns the address of the block miner (coinbase).
- `getCurrentBlockDifficulty()`: Returns the difficulty of the current block.
- `getCurrentBlockGasLimit()`: Returns the gas limit of the current block.
- `getCurrentBlockTimestamp()`: Returns

## Structs

Expand Down
File renamed without changes

0 comments on commit a8cb859

Please sign in to comment.