ETH Price: $3,154.16 (+1.12%)
Gas: 2 Gwei

Contract

0x7D1775061A3a713E778aF23806330B532Fa006B0
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Redeem202357512024-07-04 21:12:478 days ago1720127567IN
0x7D177506...32Fa006B0
0 ETH0.004538575.14563096
Redeem201991032024-06-29 18:22:4713 days ago1719685367IN
0x7D177506...32Fa006B0
0 ETH0.002321983.1041382
Redeem201630842024-06-24 17:38:1118 days ago1719250691IN
0x7D177506...32Fa006B0
0 ETH0.008477612.79582361
Redeem201628732024-06-24 16:55:3518 days ago1719248135IN
0x7D177506...32Fa006B0
0 ETH0.0145879422.01856861
Redeem200844712024-06-13 17:44:4729 days ago1718300687IN
0x7D177506...32Fa006B0
0 ETH0.0092319913.9344798
Redeem200839422024-06-13 15:57:4729 days ago1718294267IN
0x7D177506...32Fa006B0
0 ETH0.0165037225.57015818
Redeem199897012024-05-31 12:05:2343 days ago1717157123IN
0x7D177506...32Fa006B0
0 ETH0.0078724710.49595669
Redeem199771962024-05-29 18:07:2344 days ago1717006043IN
0x7D177506...32Fa006B0
0 ETH0.0127659314.15403293
Redeem193681262024-03-05 9:39:59130 days ago1709631599IN
0x7D177506...32Fa006B0
0 ETH0.0391855763.7825504
Redeem193680192024-03-05 9:18:23130 days ago1709630303IN
0x7D177506...32Fa006B0
0 ETH0.0516489358.16727763
Redeem189319532024-01-04 5:42:11191 days ago1704346931IN
0x7D177506...32Fa006B0
0 ETH0.011698613.1038325
Redeem184848982023-11-02 14:10:23253 days ago1698934223IN
0x7D177506...32Fa006B0
0 ETH0.0252133935.28179006
Redeem184816532023-11-02 3:12:59254 days ago1698894779IN
0x7D177506...32Fa006B0
0 ETH0.0184828225.25911166
Redeem184803412023-11-01 22:49:11254 days ago1698878951IN
0x7D177506...32Fa006B0
0 ETH0.0228773632.89260091
Issue184719452023-10-31 18:38:11255 days ago1698777491IN
0x7D177506...32Fa006B0
0 ETH0.0255250334.2305031
Redeem184713612023-10-31 16:40:35255 days ago1698770435IN
0x7D177506...32Fa006B0
0 ETH0.0304223732.04679219
Redeem184707952023-10-31 14:46:35255 days ago1698763595IN
0x7D177506...32Fa006B0
0 ETH0.0235295325.57785959
0x60a06040184606992023-10-30 4:49:23257 days ago1698641363IN
 Create: Issuance
0 ETH0.0085272511

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Issuance

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 13 : Issuance.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.18;

import {VerifiableAddressArray} from "src/lib/VArray.sol";
import {IIndexToken} from "src/interfaces/IIndexToken.sol";
import {TokenInfo} from "src/Common.sol";
import {IVault} from "src/interfaces/IVault.sol";
import {SCALAR, fmul, fdiv} from "src/lib/FixedPoint.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IIssuance} from "src/interfaces/IIssuance.sol";

contract Issuance is IIssuance {
    using VerifiableAddressArray for VerifiableAddressArray.VerifiableArray;
    using SafeERC20 for IERC20;

    IVault public immutable vault;

    uint256 public reentrancyLock = 1;

    modifier invariantCheck() {
        _;
        vault.invariantCheck();
    }

    modifier reentrancyGuard() {
        if (reentrancyLock > 1) revert IssuanceReentrant();
        reentrancyLock = 2;
        _;
        reentrancyLock = 1;
    }

    constructor(address _vault) {
        vault = IVault(_vault);
    }

    /// @notice Issue index tokens
    /// @param amount The amount of index tokens to issue
    /// @dev requires approval of underlying tokens
    /// @dev reentrancy guard in case callback in tokens
    function issue(uint256 amount) external invariantCheck reentrancyGuard {
        TokenInfo[] memory tokens = vault.virtualUnits();

        if (tokens.length == 0) revert IssuanceNoTokens();

        for (uint256 i; i < tokens.length; ) {
            uint256 underlyingAmount = fmul(tokens[i].units + 1, amount) + 1;

            IERC20(tokens[i].token).safeTransferFrom(
                msg.sender,
                address(vault),
                underlyingAmount
            );

            unchecked {
                ++i;
            }
        }

        vault.invokeMint(msg.sender, amount);
    }

    /// @notice Redeem index tokens
    /// @param amount The amount of index tokens to redeem
    /// @dev reentrancy guard in case callback in tokens
    function redeem(uint256 amount) external invariantCheck reentrancyGuard {
        TokenInfo[] memory tokens = vault.virtualUnits();

        if (tokens.length == 0) revert IssuanceNoTokens();

        IVault.InvokeERC20Args[] memory args = new IVault.InvokeERC20Args[](
            tokens.length
        );

        for (uint256 i; i < tokens.length; ) {
            uint256 underlyingAmount = fmul(tokens[i].units, amount);

            args[i] = IVault.InvokeERC20Args({
                token: tokens[i].token,
                to: msg.sender,
                amount: underlyingAmount
            });

            unchecked {
                ++i;
            }
        }

        vault.invokeBurn(msg.sender, amount);

        vault.invokeERC20s(args);
    }
}

File 2 of 13 : VArray.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.18;

/// O(1) insertion / deletion to an array
/// can also check inclusion
library VerifiableAddressArray {
    struct VerifiableArray {
        address[] elements;
        mapping(address => uint256) indexOf;
        // use an additional SSTORE to save a SLOAD at user runtime
        mapping(address => bool) included;
    }

    function size(VerifiableArray storage arr) internal view returns (uint256) {
        return arr.elements.length;
    }

    function add(VerifiableArray storage arr, address element) internal {
        if (includes(arr, element)) {
            revert("VerifiableArray: element already exists");
        } else {
            arr.included[element] = true;
            arr.indexOf[element] = arr.elements.length;
            arr.elements.push(element);
        }
    }

    function remove(VerifiableArray storage arr, address element) internal {
        if (!includes(arr, element)) {
            revert("VerifiableArray: element not found");
        }

        uint256 _size = size(arr);

        if (_size == 1) {
            delete arr.included[element];
            delete arr.indexOf[element];
            arr.elements.pop();
            return;
        }

        uint index = arr.indexOf[element];
        address lastElement = arr.elements[_size - 1];

        arr.indexOf[lastElement] = index;

        delete arr.included[element];
        delete arr.indexOf[element];

        arr.elements[index] = lastElement;
        arr.elements.pop();
    }

    function includes(
        VerifiableArray storage arr,
        address element
    ) internal view returns (bool) {
        return arr.included[element];
    }

    function toStorageArray(
        VerifiableArray storage arr
    ) internal view returns (address[] storage) {
        return arr.elements;
    }

    function toMemoryArray(
        VerifiableArray storage arr
    ) internal view returns (address[] memory) {
        address[] storage stor = toStorageArray(arr);
        uint256 len = stor.length;

        address[] memory mem = new address[](len);

        for (uint256 i; i < len; i++) {
            mem[i] = stor[i];
        }

        return mem;
    }
}

File 3 of 13 : IIndexToken.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.18;

import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";

interface IIndexToken is IERC20Upgradeable {
    event MinterSet(address indexed minter);

    ///=============================================================================================
    /// Initializer
    ///=============================================================================================

    function initialize(address _minter) external;

    ///=============================================================================================
    /// State
    ///=============================================================================================

    function minter() external view returns (address);

    ///=============================================================================================
    /// Mint Logic
    ///=============================================================================================

    /// @notice External mint function
    /// @dev Mint function can only be called externally by the controller
    /// @param to address
    /// @param amount uint256
    function mint(address to, uint256 amount) external;

    /// @notice External burn function
    /// @dev burn function can only be called externally by the controller
    /// @param from address
    /// @param amount uint256
    function burn(address from, uint256 amount) external;
}

File 4 of 13 : Common.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.18;

struct TokenInfo {
    address token;
    uint256 units;
}

File 5 of 13 : IVault.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.18;

import {TokenInfo} from "src/Common.sol";
import {IIndexToken} from "src/interfaces/IIndexToken.sol";

interface IVault {
    error AMKTVaultOnlyInvokers();
    error AMKTVaultOnly(address who);
    error AMKTVaultInflationRateTooLarge();
    error AMKTVaultFeeTooEarly();
    error AMKTVaultFeeTooSmall();
    error AMKTVaultEmergency();
    error VaultInvariant();
    error VaultZeroCheck();

    event VaultIssuanceSet(address issuance);
    event VaultRebalancerSet(address rebalancer);
    event VaultFeeRecipientSet(address feeRecipient);
    event VaultEmergencyResponderSet(address emergencyResponder);
    event VaultInflationRateSet(uint256 inflationRate);
    event VaultEmergencySet(bool emergency);
    event VaultFeeMinted(address indexed to, uint256 amount);

    struct InvokeERC20Args {
        address token;
        address to;
        uint256 amount;
    }

    struct SetNominalArgs {
        address token;
        uint256 virtualUnits;
    }

    function issuance() external view returns (address);

    function rebalancer() external view returns (address);

    function tryInflation() external;

    function inflationRate() external view returns (uint256);

    function feeRecipient() external view returns (address);

    function lastKnownTimestamp() external view returns (uint256);

    function invokeERC20s(InvokeERC20Args[] calldata args) external;

    function invokeSetNominals(SetNominalArgs[] calldata args) external;

    function virtualUnits(address token) external view returns (uint256);

    function virtualUnits() external view returns (TokenInfo[] memory);

    function invariantCheck() external view;

    function isUnderlying(address target) external view returns (bool);

    function underlying() external view returns (address[] memory);

    function underlyingLength() external view returns (uint256);

    function invokeMint(address to, uint256 amount) external;

    function invokeBurn(address from, uint256 amount) external;

    function indexToken() external view returns (IIndexToken);
}

File 6 of 13 : FixedPoint.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.18;

uint256 constant SCALAR = 1e18;

function fmul(uint256 a, uint256 b) pure returns (uint256 ret) {
    ret = (a * b) / SCALAR;
}

function fdiv(uint256 a, uint256 b) pure returns (uint256 ret) {
    ret = (a * SCALAR) / b;
}

function finv(uint256 a) pure returns (uint256 ret) {
    ret = fdiv(SCALAR, a);
}

File 7 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 8 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 9 of 13 : IIssuance.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.18;

import {TokenInfo} from "src/Common.sol";

interface IIssuance {
    error IssuanceReentrant();
    error IssuanceNoTokens();

    function issue(uint256 amount) external;

    function redeem(uint256 amount) external;
}

File 10 of 13 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)

pragma solidity ^0.8.0;

import "../token/ERC20/IERC20Upgradeable.sol";

File 11 of 13 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 12 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 13 of 13 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "src/=src/",
    "test/=test/",
    "invoke-modules/=src/invoke/",
    "core-libs/=src/lib/",
    "core-test/=test/core/",
    "mocks/=test/mocks/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "halmost-cheatcodes/=lib/halmos-cheatcodes/src/",
    "halmos-cheatcodes/=lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"IssuanceNoTokens","type":"error"},{"inputs":[],"name":"IssuanceReentrant","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reentrancyLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a0604052600160005534801561001557600080fd5b50604051610d71380380610d7183398101604081905261003491610045565b6001600160a01b0316608052610075565b60006020828403121561005757600080fd5b81516001600160a01b038116811461006e57600080fd5b9392505050565b608051610caa6100c760003960008181609a01528181610104015281816102000152818161027d015281816102ec0152818161038e01528181610564015281816105dd01526106520152610caa6000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80632446d79f14610051578063cc872b661461006d578063db006a7514610082578063fbfa77cf14610095575b600080fd5b61005a60005481565b6040519081526020015b60405180910390f35b61008061007b36600461099b565b6100d4565b005b61008061009036600461099b565b61035e565b6100bc7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610064565b600160005411156100f857604051630186ad7560e21b815260040160405180910390fd5b600260008190555060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638c30fb7e6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610160573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101889190810190610a24565b905080516000036101ac576040516351152f9960e01b815260040160405180910390fd5b60005b81518110156102605760006101ed8383815181106101cf576101cf610afc565b60200260200101516020015160016101e79190610b28565b856106a9565b6101f8906001610b28565b9050610257337f00000000000000000000000000000000000000000000000000000000000000008386868151811061023257610232610afc565b6020026020010151600001516001600160a01b03166106cf909392919063ffffffff16565b506001016101af565b50604051636f0f177560e11b8152336004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063de1e2eea90604401600060405180830381600087803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b505050505060016000819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634509017e6040518163ffffffff1660e01b815260040160006040518083038186803b15801561034357600080fd5b505afa158015610357573d6000803e3d6000fd5b5050505050565b6001600054111561038257604051630186ad7560e21b815260040160405180910390fd5b600260008190555060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638c30fb7e6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156103ea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104129190810190610a24565b90508051600003610436576040516351152f9960e01b815260040160405180910390fd5b6000815167ffffffffffffffff811115610452576104526109b4565b60405190808252806020026020018201604052801561049d57816020015b60408051606081018252600080825260208083018290529282015282526000199092019101816104705790505b50905060005b82518110156105475760006104d58483815181106104c3576104c3610afc565b602002602001015160200151866106a9565b905060405180606001604052808584815181106104f4576104f4610afc565b6020026020010151600001516001600160a01b03168152602001336001600160a01b031681526020018281525083838151811061053357610533610afc565b6020908102919091010152506001016104a3565b506040516301b6acaf60e61b8152336004820152602481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636dab2bc090604401600060405180830381600087803b1580156105b057600080fd5b505af11580156105c4573d6000803e3d6000fd5b5050604051633c37b54b60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169250633c37b54b9150610614908490600401610b41565b600060405180830381600087803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b50505050505060016000819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634509017e6040518163ffffffff1660e01b815260040160006040518083038186803b15801561034357600080fd5b6000670de0b6b3a76400006106be8385610ba6565b6106c89190610bbd565b9392505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261072990859061072f565b50505050565b6000610784826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661080b9092919063ffffffff16565b80519091501561080657808060200190518101906107a29190610bdf565b6108065760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b505050565b606061081a8484600085610822565b949350505050565b6060824710156108835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107fd565b600080866001600160a01b0316858760405161089f9190610c25565b60006040518083038185875af1925050503d80600081146108dc576040519150601f19603f3d011682016040523d82523d6000602084013e6108e1565b606091505b50915091506108f2878383876108fd565b979650505050505050565b6060831561096c578251600003610965576001600160a01b0385163b6109655760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107fd565b508161081a565b61081a83838151156109815781518083602001fd5b8060405162461bcd60e51b81526004016107fd9190610c41565b6000602082840312156109ad57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156109ed576109ed6109b4565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610a1c57610a1c6109b4565b604052919050565b60006020808385031215610a3757600080fd5b825167ffffffffffffffff80821115610a4f57600080fd5b818501915085601f830112610a6357600080fd5b815181811115610a7557610a756109b4565b610a83848260051b016109f3565b818152848101925060069190911b830184019087821115610aa357600080fd5b928401925b818410156108f25760408489031215610ac15760008081fd5b610ac96109ca565b84516001600160a01b0381168114610ae15760008081fd5b81528486015186820152835260409093019291840191610aa8565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610b3b57610b3b610b12565b92915050565b602080825282518282018190526000919060409081850190868401855b82811015610b9957815180516001600160a01b0390811686528782015116878601528501518585015260609093019290850190600101610b5e565b5091979650505050505050565b8082028115828204841417610b3b57610b3b610b12565b600082610bda57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610bf157600080fd5b815180151581146106c857600080fd5b60005b83811015610c1c578181015183820152602001610c04565b50506000910152565b60008251610c37818460208701610c01565b9190910192915050565b6020815260008251806020840152610c60816040850160208701610c01565b601f01601f1916919091016040019291505056fea26469706673582212207c6c44fa96caf1edae7c0cd674c7b3557bbeb3f142a7f594458625039c85c3ee64736f6c63430008120033000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80632446d79f14610051578063cc872b661461006d578063db006a7514610082578063fbfa77cf14610095575b600080fd5b61005a60005481565b6040519081526020015b60405180910390f35b61008061007b36600461099b565b6100d4565b005b61008061009036600461099b565b61035e565b6100bc7f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c81565b6040516001600160a01b039091168152602001610064565b600160005411156100f857604051630186ad7560e21b815260040160405180910390fd5b600260008190555060007f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c6001600160a01b0316638c30fb7e6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610160573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101889190810190610a24565b905080516000036101ac576040516351152f9960e01b815260040160405180910390fd5b60005b81518110156102605760006101ed8383815181106101cf576101cf610afc565b60200260200101516020015160016101e79190610b28565b856106a9565b6101f8906001610b28565b9050610257337f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c8386868151811061023257610232610afc565b6020026020010151600001516001600160a01b03166106cf909392919063ffffffff16565b506001016101af565b50604051636f0f177560e11b8152336004820152602481018390527f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c6001600160a01b03169063de1e2eea90604401600060405180830381600087803b1580156102c957600080fd5b505af11580156102dd573d6000803e3d6000fd5b505050505060016000819055507f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c6001600160a01b0316634509017e6040518163ffffffff1660e01b815260040160006040518083038186803b15801561034357600080fd5b505afa158015610357573d6000803e3d6000fd5b5050505050565b6001600054111561038257604051630186ad7560e21b815260040160405180910390fd5b600260008190555060007f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c6001600160a01b0316638c30fb7e6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156103ea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104129190810190610a24565b90508051600003610436576040516351152f9960e01b815260040160405180910390fd5b6000815167ffffffffffffffff811115610452576104526109b4565b60405190808252806020026020018201604052801561049d57816020015b60408051606081018252600080825260208083018290529282015282526000199092019101816104705790505b50905060005b82518110156105475760006104d58483815181106104c3576104c3610afc565b602002602001015160200151866106a9565b905060405180606001604052808584815181106104f4576104f4610afc565b6020026020010151600001516001600160a01b03168152602001336001600160a01b031681526020018281525083838151811061053357610533610afc565b6020908102919091010152506001016104a3565b506040516301b6acaf60e61b8152336004820152602481018490527f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c6001600160a01b031690636dab2bc090604401600060405180830381600087803b1580156105b057600080fd5b505af11580156105c4573d6000803e3d6000fd5b5050604051633c37b54b60e01b81526001600160a01b037f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c169250633c37b54b9150610614908490600401610b41565b600060405180830381600087803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b50505050505060016000819055507f000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c6001600160a01b0316634509017e6040518163ffffffff1660e01b815260040160006040518083038186803b15801561034357600080fd5b6000670de0b6b3a76400006106be8385610ba6565b6106c89190610bbd565b9392505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261072990859061072f565b50505050565b6000610784826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661080b9092919063ffffffff16565b80519091501561080657808060200190518101906107a29190610bdf565b6108065760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b505050565b606061081a8484600085610822565b949350505050565b6060824710156108835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107fd565b600080866001600160a01b0316858760405161089f9190610c25565b60006040518083038185875af1925050503d80600081146108dc576040519150601f19603f3d011682016040523d82523d6000602084013e6108e1565b606091505b50915091506108f2878383876108fd565b979650505050505050565b6060831561096c578251600003610965576001600160a01b0385163b6109655760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107fd565b508161081a565b61081a83838151156109815781518083602001fd5b8060405162461bcd60e51b81526004016107fd9190610c41565b6000602082840312156109ad57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156109ed576109ed6109b4565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610a1c57610a1c6109b4565b604052919050565b60006020808385031215610a3757600080fd5b825167ffffffffffffffff80821115610a4f57600080fd5b818501915085601f830112610a6357600080fd5b815181811115610a7557610a756109b4565b610a83848260051b016109f3565b818152848101925060069190911b830184019087821115610aa357600080fd5b928401925b818410156108f25760408489031215610ac15760008081fd5b610ac96109ca565b84516001600160a01b0381168114610ae15760008081fd5b81528486015186820152835260409093019291840191610aa8565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610b3b57610b3b610b12565b92915050565b602080825282518282018190526000919060409081850190868401855b82811015610b9957815180516001600160a01b0390811686528782015116878601528501518585015260609093019290850190600101610b5e565b5091979650505050505050565b8082028115828204841417610b3b57610b3b610b12565b600082610bda57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610bf157600080fd5b815180151581146106c857600080fd5b60005b83811015610c1c578181015183820152602001610c04565b50506000910152565b60008251610c37818460208701610c01565b9190910192915050565b6020815260008251806020840152610c60816040850160208701610c01565b601f01601f1916919091016040019291505056fea26469706673582212207c6c44fa96caf1edae7c0cd674c7b3557bbeb3f142a7f594458625039c85c3ee64736f6c63430008120033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c

-----Decoded View---------------
Arg [0] : _vault (address): 0xf3bCeDaB2998933c6AAD1cB31430D8bAb329dD8C

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000f3bcedab2998933c6aad1cb31430d8bab329dd8c


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.