flashloan-rs 0.2.1

Minimal Multicall3 Flashloan Module
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// @title OnlyContract
/// @notice SPDX-License-Identifier: MIT
/// @author asnared <https://github.com/abigger87>
/// @notice Reverts if the caller is not a contract with a tx.origin check.

/// @notice Reverts if the caller is not a contract using tx.origin.
/// @dev WARNING: This is an anti-pattern and prevents interoperability.
///               Additionally, this will become ineffective once either EIP-2938 OR EIP-4337 account abstraction's are implemented.
///               EIP-3074 is another concern as it essentially allows users to delegate control of an EOA to a contract.
///               Additionally, users of wallets like argent, authereum and gnosis multi-sigs are able to "bypass" this access control.
#define macro ONLY_CONTRACT() = takes (0) returns (0) {
    caller              // [msg.sender]
    origin              // [tx.origin, msg.sender]
    eq iszero           // [tx.origin != msg.sender]
    continue jumpi      // []
    0x00 dup1 revert    // []
    continue:
}