Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Safe and Multicall tools #1537

Merged
merged 46 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
4da7c08
added IOTA EVM to networks-endpoints.mdx
lucas-tortora Mar 25, 2024
2879e0b
remove networks warning
lucas-tortora Mar 25, 2024
a3c0e1e
changed Public Testnet To EVM Testnet
lucas-tortora Mar 25, 2024
c23cfcc
changed IOTA EVM to IotaEVM
lucas-tortora Mar 25, 2024
2df12ee
changed IOTA EVM to IotaEVM
lucas-tortora Mar 25, 2024
19834cc
Merge branch 'main' into ISC/updateNetworkInfo
Dr-Electron Apr 28, 2024
e234ba9
Update network info
Dr-Electron Apr 28, 2024
dda80d2
Fix info
Dr-Electron Apr 28, 2024
6966983
Fix links
Dr-Electron Apr 28, 2024
eaddd60
Merge branch 'main' into ISC/updateNetworkInfo
Dr-Electron Apr 30, 2024
172a25d
Format
Dr-Electron May 8, 2024
c5df220
Merge branch 'main' into ISC/updateNetworkInfo
Dr-Electron May 13, 2024
de27bbc
Update sidebar
Dr-Electron May 13, 2024
dc5e599
Format
Dr-Electron May 13, 2024
6fe19c1
Add Safe and Multicall tools
Dr-Electron Apr 26, 2024
ea7c70a
Format
Dr-Electron Apr 26, 2024
ac09260
Fix grammar
Dr-Electron Apr 26, 2024
e3fabbd
Add safe page
Dr-Electron May 6, 2024
5c2d013
docs: add multicall file
vivekjain23 May 8, 2024
d18c705
docs: add multisig(safe) page
vivekjain23 May 8, 2024
ae70192
Refactor multisig and multicall3 pages
vivekjain23 May 9, 2024
0fb2cd5
docs: move safe image and refactor multicall page
vivekjain23 May 9, 2024
7771f19
docs: refactor headings for multicall page
vivekjain23 May 10, 2024
4d2ca7c
Resolve PR comments for safe page
vivekjain23 May 13, 2024
e3e795f
made oracles page IOTA centric
lucas-tortora May 14, 2024
5509a5f
added Blast API info to networks-endpoints.mdx
lucas-tortora May 16, 2024
717c8c9
Added Goldsky to the subgraphs article
lucas-tortora May 20, 2024
ce58105
updated sidebars.ts
lucas-tortora May 20, 2024
46b30a5
added all available tools to tools.mdx
lucas-tortora May 22, 2024
573000f
added partial for _oracles_contract_data.md
lucas-tortora May 22, 2024
8cf8aea
fix header
lucas-tortora May 22, 2024
b1fb8a9
Refactor Blast endpoint section (#1568)
Dr-Electron May 24, 2024
c7e8b59
Merge branch 'main' into ISC/updateNetworkInfoRequestedUpdates
Dr-Electron May 24, 2024
e588aa8
Merge branch 'ISC/updateNetworkInfoRequestedUpdates' into docs/evm/to…
Dr-Electron May 24, 2024
b07eaf6
Update docs/build/getting-started/multicall.md
Dr-Electron May 24, 2024
16926fb
Apply suggestions from code review
Dr-Electron May 24, 2024
68702c1
Merge branch 'main' into ISC/updateNetworkInfo
Dr-Electron May 24, 2024
2c0f5f9
Merge branch 'ISC/updateNetworkInfo' into ISC/updateNetworkInfoReques…
Dr-Electron May 24, 2024
f6b9b4a
Format
Dr-Electron May 24, 2024
7cadf82
Merge branch 'ISC/updateNetworkInfoRequestedUpdates' into docs/evm/to…
Dr-Electron May 24, 2024
325567a
Rename sidebar label
Dr-Electron May 24, 2024
709a63f
Merge branch 'main' into ISC/updateNetworkInfo
Dr-Electron May 26, 2024
abad7e1
Update access guide
Dr-Electron May 26, 2024
d9ea68b
Merge branch 'ISC/updateNetworkInfo' into ISC/updateNetworkInfoReques…
Dr-Electron May 26, 2024
81e8fed
Merge branch 'ISC/updateNetworkInfoRequestedUpdates' into docs/evm/to…
Dr-Electron May 26, 2024
95d99e9
Merge branch 'isc-update' into docs/evm/tooling
Dr-Electron May 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
194 changes: 194 additions & 0 deletions docs/build/getting-started/multicall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
---
description: 'Multicall3 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
---

# Multicall3
## Powering Efficient Batch Transactions on L2 Networks

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. To use the Multicall3 contract on IOTA EVM, the Multicall3 contract is deployed at this address: [0xcA11bde05977b3631167028862bE2a173976CA11](https://explorer.evm.iota.org/address/0xcA11bde05977b3631167028862bE2a173976CA11?tab=write_contract).

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:
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

- **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.
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

- **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.
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

- **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.
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

- **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.
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

- **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.
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

:::tip

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

:::


## Contract Information

### Function: aggregate

#### Description:
This function aggregates the results of multiple function calls made to different contracts within a single transaction.

```solidity
function aggregate(Call[] calldata calls) public payable returns (uint256 blockNumber, bytes[] memory returnData);
```


|Parameter Name | Description|
|-----------|---------------------------------------------------------------------
| calls (Call[] calldata) | An array of Call structs. Each Call struct contains the target contract address (address) and the encoded function call data (bytes).|

#### Return Values:
- blockNumber (uint256): The block number where the calls were executed.
- returnData (bytes[] memory): An array of bytes containing the return data from each call.

### Function: tryAggregate

#### Description:
This function performs a similar function to `aggregate` but allows individual calls to fail without halting the entire execution.


```solidity
function tryAggregate(bool requireSuccess, Call[] calldata calls) public payable returns (Result[] memory returnData);
```

| Parameter Name | Description |
|----------------|-----------------------------------------------------------------------------|
| requireSuccess (bool) | A boolean flag indicating whether all calls must succeed (true) or if failures are allowed (false). |
| calls (Call[] calldata) | An array of Call structs. Each Call struct contains the target contract address (address) and the encoded function call data (bytes). |


#### Return Values:
returnData (Result[] memory): An array of Result structs. Each Result struct contains a bool indicating success (success) and the return data for the corresponding call (bytes returnData).

### Function: tryBlockAndAggregate

#### Description:
This function combines features of `tryAggregate` and retrieves additional block information.


```solidity
function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls)
public
payable
returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);
```

| Parameter Name | Description |
|----------------|-----------------------------------------------------------------------------|
| requireSuccess (bool) | A boolean flag indicating whether all calls must succeed (true) or if failures are allowed (false). |
| calls (Call[] calldata) | An array of Call structs. Each Call struct contains the target contract address (address) and the encoded function call data (bytes). |

#### Return Values:
- blockNumber (uint256): The block number where the calls were executed.
- blockHash (bytes32): The hash of the block where the calls were executed.
- returnData (Result[] memory): An array of Result structs, as defined in tryAggregate.


### Function: blockAndAggregate

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

```solidity
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved
function blockAndAggregate(Call[] calldata calls)
public
payable
returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData);
```

|Parameter Name | Description|
|-----------|---------------------------------------------------------------------
| calls (Call[] calldata) | An array of Call structs, as defined in aggregate.|

#### Return Values:
- blockNumber (uint256): The block number where the calls were executed.
- blockHash (bytes32): The hash of the block where the calls were executed.
- returnData (Result[] memory): An array of Result structs, as defined in tryAggregate.


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

```solidity
function aggregate3(Call3[] calldata calls) public payable returns (Result[] memory returnData);
```

|Parameter Name | Description|
|-----------|---------------------------------------------------------------------
| calls (Call[] calldata) | An array of Call3 structs. Each Call3 struct includes the target contract address (address), a flag indicating if failure is allowed (bool allowFailure), and the encoded function call data (bytes callData).|

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


### Function: aggregate3Value
#### 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.


```solidity
function aggregate3Value(Call3Value[] calldata calls) public payable returns (Result[] memory returnData);
```

|Parameter Name | Description|
|-----------|---------------------------------------------------------------------
| 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`.



## Additional Functions
The contract also includes several view functions that retrieve blockchain data without modifying the state:
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

- `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

- Call
```solidity
struct Call {
address target;
bytes callData;
}
```
- Call3
```solidity
struct Call3 {
address target;
bool allowFailure;
bytes callData;
}

```
- Call3 Value
```solidity
struct Call3Value {
address target;
bool allowFailure;
uint256 value;
bytes callData;
}
```
- Result
```solidity
struct Result {
bool success;
bytes returnData;
}
```
78 changes: 78 additions & 0 deletions docs/build/getting-started/safe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
description: 'Multisig wallet refers to having multiple private keys for a single web3 wallet.'
image: /img/logo/WASP_logo_dark.png
---

# MultiSig Wallet
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

:::note TL;DR;
vivekjain23 marked this conversation as resolved.
Show resolved Hide resolved

[Safe Wallet](https://safe.iotaledger.net/welcome) is a multiSig wallet. The term “
multisig” is short for "multisignature".

:::

The security of cryptocurrency demands greater attention as digital assets gain traction. Individuals and organizations need robust strategies to safeguard their funds. Multisignature (multisig) wallets are emerging as a powerful cybersecurity tool in crypto.

Decentralized digital assets require a different approach to security than traditional finance. Thankfully, innovative technologies like multisig wallets provide an extra layer of protection, allowing you to trade cryptocurrencies on chains like [Shimmer EVM](https://explorer.evm.shimmer.network/) or [IOTA EVM](https://explorer.evm.iota.org/).

![IOTA Sandbox](/img/get-started/safe/safe.png)

## Why Are Multisig Wallets More Secure?
vivekjain23 marked this conversation as resolved.
Show resolved Hide resolved

Traditional crypto wallets rely on a single signature for transactions, making them vulnerable if that key is compromised. Multisig wallets offer superior security by requiring multiple approvals before funds can be moved. This added layer of verification significantly reduces the risk of unauthorized transactions, even if a hacker gains access to one of your keys.

Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved
## Use Cases for Multisig Wallet

### Shared Asset Security

#### Joint Ownership

Securely manage crypto held jointly by couples, business partners, or organizations. Requires approval from all parties for transactions, preventing unauthorized spending.

#### Company Funds

For businesses with substantial crypto holdings, enforce multi-approval workflows for withdrawals, minimizing internal theft risk.

### Enhanced Threat Protection

#### Lost/Compromised Keys

Mitigate the impact of lost or compromised keys. Remaining keys can still safeguard funds, unlike single-signature wallets.

#### Hacking Defense

Add a significant hurdle for attackers. Even with access to one key, they cannot steal funds without additional signatures.

#### Custodial Account Control

Maintain control over crypto held in exchanges or IRA providers. Multisig wallets ensure withdrawals require approval from both the - user and the custodian, preventing unauthorized access.

### Important Considerations

#### Technical Complexity

Setting up and using multisig wallets requires more technical expertise compared to traditional wallets.

#### Signatory Balance

Finding the optimal balance between security (more signatories) and practicality (fewer signatories) is crucial.

#### Individual Suitability

For most individual users with smaller crypto holdings, a standard single-signature wallet might be sufficient.


:::tip

Learn more about safe accounts in the [Safe documentation](https://help.safe.global/en/articles/40835-what-safe-setup-should-i-use).

:::

## IOTA has its own dedicated MultiSig wallet - [safe(Wallet)](https://safe.iotaledger.net/welcome)

:::info Set Up a Safe Account

You can find instructions on setting up a safe account in the [Safe documentation](https://help.safe.global/en/articles/40868-creating-a-safe-on-a-web-browser).

:::
15 changes: 10 additions & 5 deletions docs/build/getting-started/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ module.exports = {
type: 'doc',
id: 'subgraphs',
},
{
label: 'IOTA Safe Wallet',
type: 'doc',
id: 'safe',
},
{
label: 'Multicall3',
type: 'doc',
id: 'multicall',
},
{
type: 'category',
label: 'ShimmerEVM',
Expand Down Expand Up @@ -128,11 +138,6 @@ module.exports = {
},
],
},
{
label: 'Oracles for IOTA EVM and ShimmerEVM',
type: 'doc',
id: 'oracles',
},
{
type: 'link',
label: 'WASP CLI',
Expand Down
Binary file added static/img/get-started/safe/safe.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.