ETH Price: $3,086.69 (-1.37%)
Gas: 2 Gwei

Contract

0x6bF5EB06201e4ea7C315b1C23BfE79fAE30541F9
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Revoke Delegate159831172022-11-16 14:15:23550 days ago1668608123IN
0x6bF5EB06...AE30541F9
0 ETH0.0004116116
Block Caller146053612022-04-17 22:12:21763 days ago1650233541IN
0x6bF5EB06...AE30541F9
0 ETH0.0005152221.26555535
Allow Caller145611082022-04-11 0:19:27770 days ago1649636367IN
0x6bF5EB06...AE30541F9
0 ETH0.0011763324.4119737

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To Value
145545672022-04-09 23:48:34771 days ago1649548114  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Codex

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 8000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2022-04-10
*/

// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2018 Rain <[email protected]>
pragma solidity ^0.8.4;

interface ICodex {
    function init(address vault) external;

    function setParam(bytes32 param, uint256 data) external;

    function setParam(
        address,
        bytes32,
        uint256
    ) external;

    function credit(address) external view returns (uint256);

    function unbackedDebt(address) external view returns (uint256);

    function balances(
        address,
        uint256,
        address
    ) external view returns (uint256);

    function vaults(address vault)
        external
        view
        returns (
            uint256 totalNormalDebt,
            uint256 rate,
            uint256 debtCeiling,
            uint256 debtFloor
        );

    function positions(
        address vault,
        uint256 tokenId,
        address position
    ) external view returns (uint256 collateral, uint256 normalDebt);

    function globalDebt() external view returns (uint256);

    function globalUnbackedDebt() external view returns (uint256);

    function globalDebtCeiling() external view returns (uint256);

    function delegates(address, address) external view returns (uint256);

    function grantDelegate(address) external;

    function revokeDelegate(address) external;

    function modifyBalance(
        address,
        uint256,
        address,
        int256
    ) external;

    function transferBalance(
        address vault,
        uint256 tokenId,
        address src,
        address dst,
        uint256 amount
    ) external;

    function transferCredit(
        address src,
        address dst,
        uint256 amount
    ) external;

    function modifyCollateralAndDebt(
        address vault,
        uint256 tokenId,
        address user,
        address collateralizer,
        address debtor,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    ) external;

    function transferCollateralAndDebt(
        address vault,
        uint256 tokenId,
        address src,
        address dst,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    ) external;

    function confiscateCollateralAndDebt(
        address vault,
        uint256 tokenId,
        address user,
        address collateralizer,
        address debtor,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    ) external;

    function settleUnbackedDebt(uint256 debt) external;

    function createUnbackedDebt(
        address debtor,
        address creditor,
        uint256 debt
    ) external;

    function modifyRate(
        address vault,
        address creditor,
        int256 rate
    ) external;

    function lock() external;
}interface IPriceFeed {
    function peek() external returns (bytes32, bool);

    function read() external view returns (bytes32);
}

interface ICollybus {
    function vaults(address) external view returns (uint128, uint128);

    function spots(address) external view returns (uint256);

    function rates(uint256) external view returns (uint256);

    function rateIds(address, uint256) external view returns (uint256);

    function redemptionPrice() external view returns (uint256);

    function live() external view returns (uint256);

    function setParam(bytes32 param, uint256 data) external;

    function setParam(
        address vault,
        bytes32 param,
        uint128 data
    ) external;

    function setParam(
        address vault,
        uint256 tokenId,
        bytes32 param,
        uint256 data
    ) external;

    function updateDiscountRate(uint256 rateId, uint256 rate) external;

    function updateSpot(address token, uint256 spot) external;

    function read(
        address vault,
        address underlier,
        uint256 tokenId,
        uint256 maturity,
        bool net
    ) external view returns (uint256 price);

    function lock() external;
}

interface IVault {
    function codex() external view returns (ICodex);

    function collybus() external view returns (ICollybus);

    function token() external view returns (address);

    function tokenScale() external view returns (uint256);

    function underlierToken() external view returns (address);

    function underlierScale() external view returns (uint256);

    function vaultType() external view returns (bytes32);

    function live() external view returns (uint256);

    function lock() external;

    function setParam(bytes32 param, address data) external;

    function maturity(uint256 tokenId) external returns (uint256);

    function fairPrice(
        uint256 tokenId,
        bool net,
        bool face
    ) external view returns (uint256);

    function enter(
        uint256 tokenId,
        address user,
        uint256 amount
    ) external;

    function exit(
        uint256 tokenId,
        address user,
        uint256 amount
    ) external;
}
interface IGuarded {
    function ANY_SIG() external view returns (bytes32);

    function ANY_CALLER() external view returns (address);

    function allowCaller(bytes32 sig, address who) external;

    function blockCaller(bytes32 sig, address who) external;

    function canCall(bytes32 sig, address who) external view returns (bool);
}
/// @title Guarded
/// @notice Mixin implementing an authentication scheme on a method level
abstract contract Guarded is IGuarded {
    /// ======== Custom Errors ======== ///

    error Guarded__notRoot();
    error Guarded__notGranted();

    /// ======== Storage ======== ///

    /// @notice Wildcard for granting a caller to call every guarded method
    bytes32 public constant override ANY_SIG = keccak256("ANY_SIG");
    /// @notice Wildcard for granting a caller to call every guarded method
    address public constant override ANY_CALLER = address(uint160(uint256(bytes32(keccak256("ANY_CALLER")))));

    /// @notice Mapping storing who is granted to which method
    /// @dev Method Signature => Caller => Bool
    mapping(bytes32 => mapping(address => bool)) private _canCall;

    /// ======== Events ======== ///

    event AllowCaller(bytes32 sig, address who);
    event BlockCaller(bytes32 sig, address who);

    constructor() {
        // set root
        _setRoot(msg.sender);
    }

    /// ======== Auth ======== ///

    modifier callerIsRoot() {
        if (_canCall[ANY_SIG][msg.sender]) {
            _;
        } else revert Guarded__notRoot();
    }

    modifier checkCaller() {
        if (canCall(msg.sig, msg.sender)) {
            _;
        } else revert Guarded__notGranted();
    }

    /// @notice Grant the right to call method `sig` to `who`
    /// @dev Only the root user (granted `ANY_SIG`) is able to call this method
    /// @param sig Method signature (4Byte)
    /// @param who Address of who should be able to call `sig`
    function allowCaller(bytes32 sig, address who) public override callerIsRoot {
        _canCall[sig][who] = true;
        emit AllowCaller(sig, who);
    }

    /// @notice Revoke the right to call method `sig` from `who`
    /// @dev Only the root user (granted `ANY_SIG`) is able to call this method
    /// @param sig Method signature (4Byte)
    /// @param who Address of who should not be able to call `sig` anymore
    function blockCaller(bytes32 sig, address who) public override callerIsRoot {
        _canCall[sig][who] = false;
        emit BlockCaller(sig, who);
    }

    /// @notice Returns if `who` can call `sig`
    /// @param sig Method signature (4Byte)
    /// @param who Address of who should be able to call `sig`
    function canCall(bytes32 sig, address who) public view override returns (bool) {
        return (_canCall[sig][who] || _canCall[ANY_SIG][who] || _canCall[sig][ANY_CALLER]);
    }

    /// @notice Sets the root user (granted `ANY_SIG`)
    /// @param root Address of who should be set as root
    function _setRoot(address root) internal {
        _canCall[ANY_SIG][root] = true;
        emit AllowCaller(ANY_SIG, root);
    }

    /// @notice Unsets the root user (granted `ANY_SIG`)
    /// @param root Address of who should be unset as root
    function _unsetRoot(address root) internal {
        _canCall[ANY_SIG][root] = false;
        emit AllowCaller(ANY_SIG, root);
    }
}// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC.

uint256 constant MLN = 10**6;
uint256 constant BLN = 10**9;
uint256 constant WAD = 10**18;
uint256 constant RAY = 10**18;
uint256 constant RAD = 10**18;

/* solhint-disable func-visibility, no-inline-assembly */

error Math__toInt256_overflow(uint256 x);

function toInt256(uint256 x) pure returns (int256) {
    if (x > uint256(type(int256).max)) revert Math__toInt256_overflow(x);
    return int256(x);
}

function min(uint256 x, uint256 y) pure returns (uint256 z) {
    unchecked {
        z = x <= y ? x : y;
    }
}

function max(uint256 x, uint256 y) pure returns (uint256 z) {
    unchecked {
        z = x >= y ? x : y;
    }
}

error Math__diff_overflow(uint256 x, uint256 y);

function diff(uint256 x, uint256 y) pure returns (int256 z) {
    unchecked {
        z = int256(x) - int256(y);
        if (!(int256(x) >= 0 && int256(y) >= 0)) revert Math__diff_overflow(x, y);
    }
}

error Math__add_overflow(uint256 x, uint256 y);

function add(uint256 x, uint256 y) pure returns (uint256 z) {
    unchecked {
        if ((z = x + y) < x) revert Math__add_overflow(x, y);
    }
}

error Math__add48_overflow(uint256 x, uint256 y);

function add48(uint48 x, uint48 y) pure returns (uint48 z) {
    unchecked {
        if ((z = x + y) < x) revert Math__add48_overflow(x, y);
    }
}

error Math__add_overflow_signed(uint256 x, int256 y);

function add(uint256 x, int256 y) pure returns (uint256 z) {
    unchecked {
        z = x + uint256(y);
        if (!(y >= 0 || z <= x)) revert Math__add_overflow_signed(x, y);
        if (!(y <= 0 || z >= x)) revert Math__add_overflow_signed(x, y);
    }
}

error Math__sub_overflow(uint256 x, uint256 y);

function sub(uint256 x, uint256 y) pure returns (uint256 z) {
    unchecked {
        if ((z = x - y) > x) revert Math__sub_overflow(x, y);
    }
}

error Math__sub_overflow_signed(uint256 x, int256 y);

function sub(uint256 x, int256 y) pure returns (uint256 z) {
    unchecked {
        z = x - uint256(y);
        if (!(y <= 0 || z <= x)) revert Math__sub_overflow_signed(x, y);
        if (!(y >= 0 || z >= x)) revert Math__sub_overflow_signed(x, y);
    }
}

error Math__mul_overflow(uint256 x, uint256 y);

function mul(uint256 x, uint256 y) pure returns (uint256 z) {
    unchecked {
        if (!(y == 0 || (z = x * y) / y == x)) revert Math__mul_overflow(x, y);
    }
}

error Math__mul_overflow_signed(uint256 x, int256 y);

function mul(uint256 x, int256 y) pure returns (int256 z) {
    unchecked {
        z = int256(x) * y;
        if (int256(x) < 0) revert Math__mul_overflow_signed(x, y);
        if (!(y == 0 || z / y == int256(x))) revert Math__mul_overflow_signed(x, y);
    }
}

function wmul(uint256 x, uint256 y) pure returns (uint256 z) {
    unchecked {
        z = mul(x, y) / WAD;
    }
}

function wmul(uint256 x, int256 y) pure returns (int256 z) {
    unchecked {
        z = mul(x, y) / int256(WAD);
    }
}

error Math__div_overflow(uint256 x, uint256 y);

function div(uint256 x, uint256 y) pure returns (uint256 z) {
    unchecked {
        if (y == 0) revert Math__div_overflow(x, y);
        return x / y;
    }
}

function wdiv(uint256 x, uint256 y) pure returns (uint256 z) {
    unchecked {
        z = mul(x, WAD) / y;
    }
}

// optimized version from dss PR #78
function wpow(
    uint256 x,
    uint256 n,
    uint256 b
) pure returns (uint256 z) {
    unchecked {
        assembly {
            switch n
            case 0 {
                z := b
            }
            default {
                switch x
                case 0 {
                    z := 0
                }
                default {
                    switch mod(n, 2)
                    case 0 {
                        z := b
                    }
                    default {
                        z := x
                    }
                    let half := div(b, 2) // for rounding.
                    for {
                        n := div(n, 2)
                    } n {
                        n := div(n, 2)
                    } {
                        let xx := mul(x, x)
                        if shr(128, x) {
                            revert(0, 0)
                        }
                        let xxRound := add(xx, half)
                        if lt(xxRound, xx) {
                            revert(0, 0)
                        }
                        x := div(xxRound, b)
                        if mod(n, 2) {
                            let zx := mul(z, x)
                            if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) {
                                revert(0, 0)
                            }
                            let zxRound := add(zx, half)
                            if lt(zxRound, zx) {
                                revert(0, 0)
                            }
                            z := div(zxRound, b)
                        }
                    }
                }
            }
        }
    }
}

/* solhint-disable func-visibility, no-inline-assembly */
/// @title Codex
/// @notice `Codex` is responsible for the accounting of collateral and debt balances
/// Uses Vat.sol from DSS (MakerDAO) / SafeEngine.sol from GEB (Reflexer Labs) as a blueprint
/// Changes from Vat.sol / SafeEngine.sol:
/// - only WAD precision is used (no RAD and RAY)
/// - uses a method signature based authentication scheme
/// - supports ERC1155, ERC721 style assets by TokenId
contract Codex is Guarded, ICodex {
    /// ======== Custom Errors ======== ///

    error Codex__init_vaultAlreadyInit();
    error Codex__setParam_notLive();
    error Codex__setParam_unrecognizedParam();
    error Codex__transferBalance_notAllowed();
    error Codex__transferCredit_notAllowed();
    error Codex__modifyCollateralAndDebt_notLive();
    error Codex__modifyCollateralAndDebt_vaultNotInit();
    error Codex__modifyCollateralAndDebt_ceilingExceeded();
    error Codex__modifyCollateralAndDebt_notSafe();
    error Codex__modifyCollateralAndDebt_notAllowedSender();
    error Codex__modifyCollateralAndDebt_notAllowedCollateralizer();
    error Codex__modifyCollateralAndDebt_notAllowedDebtor();
    error Codex__modifyCollateralAndDebt_debtFloor();
    error Codex__transferCollateralAndDebt_notAllowed();
    error Codex__transferCollateralAndDebt_notSafeSrc();
    error Codex__transferCollateralAndDebt_notSafeDst();
    error Codex__transferCollateralAndDebt_debtFloorSrc();
    error Codex__transferCollateralAndDebt_debtFloorDst();
    error Codex__modifyRate_notLive();

    /// ======== Storage ======== ///

    // Vault Data
    struct Vault {
        // Total Normalised Debt in Vault [wad]
        uint256 totalNormalDebt;
        // Vault's Accumulation Rate [wad]
        uint256 rate;
        // Vault's Debt Ceiling [wad]
        uint256 debtCeiling;
        // Debt Floor for Positions corresponding to this Vault [wad]
        uint256 debtFloor;
    }
    // Position Data
    struct Position {
        // Locked Collateral in Position [wad]
        uint256 collateral;
        // Normalised Debt (gross debt before rate is applied) generated by Position [wad]
        uint256 normalDebt;
    }

    /// @notice Map of delegatees who can modify collateral, debt and credit on behalf of a delegator
    /// @dev Delegator => Delegatee => hasDelegate
    mapping(address => mapping(address => uint256)) public override delegates;
    /// @notice Vaults
    /// @dev Vault => Vault Data
    mapping(address => Vault) public override vaults;
    /// @notice Positions
    /// @dev Vault => TokenId => Owner => Position
    mapping(address => mapping(uint256 => mapping(address => Position))) public override positions;
    /// @notice Token balances not put up for collateral in a Position
    /// @dev Vault => TokenId => Owner => Balance [wad]
    mapping(address => mapping(uint256 => mapping(address => uint256))) public override balances;
    /// @notice Credit balances
    /// @dev Account => Credit [wad]
    mapping(address => uint256) public override credit;
    /// @notice Unbacked Debt balances
    /// @dev Account => Unbacked Debt [wad]
    mapping(address => uint256) public override unbackedDebt;

    /// @notice Global Debt (incl. rate) outstanding == Credit Issued [wad]
    uint256 public override globalDebt;
    /// @notice Global Unbacked Debt (incl. rate) oustanding == Total Credit [wad]
    uint256 public override globalUnbackedDebt;
    /// @notice Global Debt Ceiling [wad]
    uint256 public override globalDebtCeiling;

    /// @notice Boolean indicating if this contract is live (0 - not live, 1 - live)
    uint256 public live;

    /// ======== Events ======== ///
    event Init(address indexed vault);
    event SetParam(bytes32 indexed param, uint256 data);
    event SetParam(address indexed vault, bytes32 indexed param, uint256 data);
    event GrantDelegate(address indexed delegator, address indexed delegatee);
    event RevokeDelegate(address indexed delegator, address indexed delegatee);
    event ModifyBalance(
        address indexed vault,
        uint256 indexed tokenId,
        address indexed user,
        int256 amount,
        uint256 balance
    );
    event TransferBalance(
        address indexed vault,
        uint256 indexed tokenId,
        address indexed src,
        address dst,
        uint256 amount,
        uint256 srcBalance,
        uint256 dstBalance
    );
    event TransferCredit(
        address indexed src,
        address indexed dst,
        uint256 amount,
        uint256 srcCredit,
        uint256 dstCredit
    );
    event ModifyCollateralAndDebt(
        address indexed vault,
        uint256 indexed tokenId,
        address indexed user,
        address collateralizer,
        address creditor,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    );
    event TransferCollateralAndDebt(
        address indexed vault,
        uint256 indexed tokenId,
        address indexed src,
        address dst,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    );
    event ConfiscateCollateralAndDebt(
        address indexed vault,
        uint256 indexed tokenId,
        address indexed user,
        address collateralizer,
        address debtor,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    );
    event SettleUnbackedDebt(address indexed debtor, uint256 debt);
    event CreateUnbackedDebt(address indexed debtor, address indexed creditor, uint256 debt);
    event ModifyRate(address indexed vault, address indexed creditor, int256 deltaRate);
    event Lock();

    constructor() Guarded() {
        live = 1;
    }

    /// ======== Configuration ======== ///

    /// @notice Initializes a new Vault
    /// @dev Sender has to be allowed to call this method
    /// @param vault Address of the Vault
    function init(address vault) external override checkCaller {
        if (vaults[vault].rate != 0) revert Codex__init_vaultAlreadyInit();
        vaults[vault].rate = WAD;
        emit Init(vault);
    }

    /// @notice Sets various variables for this contract
    /// @dev Sender has to be allowed to call this method
    /// @param param Name of the variable to set
    /// @param data New value to set for the variable [wad]
    function setParam(bytes32 param, uint256 data) external override checkCaller {
        if (live == 0) revert Codex__setParam_notLive();
        if (param == "globalDebtCeiling") globalDebtCeiling = data;
        else revert Codex__setParam_unrecognizedParam();
        emit SetParam(param, data);
    }

    /// @notice Sets various variables for a Vault
    /// @dev Sender has to be allowed to call this method
    /// @param vault Address of the Vault
    /// @param param Name of the variable to set
    /// @param data New value to set for the variable [wad]
    function setParam(
        address vault,
        bytes32 param,
        uint256 data
    ) external override checkCaller {
        if (live == 0) revert Codex__setParam_notLive();
        if (param == "debtCeiling") vaults[vault].debtCeiling = data;
        else if (param == "debtFloor") vaults[vault].debtFloor = data;
        else revert Codex__setParam_unrecognizedParam();
        emit SetParam(vault, param, data);
    }

    /// ======== Caller Delegation ======== ///

    /// @notice Grants the delegatee the ability to modify collateral, debt and credit balances on behalf of the caller
    /// @param delegatee Address of the delegatee
    function grantDelegate(address delegatee) external override {
        delegates[msg.sender][delegatee] = 1;
        emit GrantDelegate(msg.sender, delegatee);
    }

    /// @notice Revokes the delegatee's ability to modify collateral, debt and credit balances on behalf of the caller
    /// @param delegatee Address of the delegatee
    function revokeDelegate(address delegatee) external override {
        delegates[msg.sender][delegatee] = 0;
        emit RevokeDelegate(msg.sender, delegatee);
    }

    /// @notice Checks the delegate
    /// @param delegator Address of the delegator
    /// @param delegatee Address of the delegatee
    /// @return True if delegate is granted
    function hasDelegate(address delegator, address delegatee) internal view returns (bool) {
        return delegator == delegatee || delegates[delegator][delegatee] == 1;
    }

    /// ======== Credit and Token Balance Administration ======== ///

    /// @notice Updates the token balance for a `user`
    /// @dev Sender has to be allowed to call this method
    /// @param vault Address of the Vault
    /// @param tokenId ERC1155 or ERC721 style TokenId (leave at 0 for ERC20)
    /// @param user Address of the user
    /// @param amount Amount to add (positive) or subtract (negative) [wad]
    function modifyBalance(
        address vault,
        uint256 tokenId,
        address user,
        int256 amount
    ) external override checkCaller {
        balances[vault][tokenId][user] = add(balances[vault][tokenId][user], amount);
        emit ModifyBalance(vault, tokenId, user, amount, balances[vault][tokenId][user]);
    }

    /// @notice Transfer an `amount` of tokens from `src` to `dst`
    /// @dev Sender has to be delegated by `src`
    /// @param vault Address of the Vault
    /// @param tokenId ERC1155 or ERC721 style TokenId (leave at 0 for ERC20)
    /// @param src From address
    /// @param dst To address
    /// @param amount Amount to be transferred [wad]
    function transferBalance(
        address vault,
        uint256 tokenId,
        address src,
        address dst,
        uint256 amount
    ) external override {
        if (!hasDelegate(src, msg.sender)) revert Codex__transferBalance_notAllowed();
        balances[vault][tokenId][src] = sub(balances[vault][tokenId][src], amount);
        balances[vault][tokenId][dst] = add(balances[vault][tokenId][dst], amount);
        emit TransferBalance(
            vault,
            tokenId,
            src,
            dst,
            amount,
            balances[vault][tokenId][src],
            balances[vault][tokenId][dst]
        );
    }

    /// @notice Transfer an `amount` of Credit from `src` to `dst`
    /// @dev Sender has to be delegated by `src`
    /// @param src From address
    /// @param dst To address
    /// @param amount Amount to be transferred [wad]
    function transferCredit(
        address src,
        address dst,
        uint256 amount
    ) external override {
        if (!hasDelegate(src, msg.sender)) revert Codex__transferCredit_notAllowed();
        credit[src] = sub(credit[src], amount);
        credit[dst] = add(credit[dst], amount);
        emit TransferCredit(src, dst, amount, credit[src], credit[dst]);
    }

    /// ======== Position Administration ======== ///

    /// @notice Modifies a Position's collateral and debt balances
    /// @dev Checks that the global debt ceiling and the vault's debt ceiling have not been exceeded,
    /// that the Position is still safe after the modification,
    /// that the sender is delegated by the owner if the collateral-to-debt ratio decreased,
    /// that the sender is delegated by the collateralizer if new collateral is put up,
    /// that the sender is delegated by the creditor if debt is settled,
    /// and that the vault debt floor is exceeded
    /// @param vault Address of the Vault
    /// @param tokenId ERC1155 or ERC721 style TokenId (leave at 0 for ERC20)
    /// @param user Address of the user
    /// @param collateralizer Address of who puts up or receives the collateral delta
    /// @param creditor Address of who provides or receives the credit delta for the debt delta
    /// @param deltaCollateral Amount of collateral to put up (+) for or remove (-) from this Position [wad]
    /// @param deltaNormalDebt Amount of normalized debt (gross, before rate is applied) to generate (+) or
    /// settle (-) on this Position [wad]
    function modifyCollateralAndDebt(
        address vault,
        uint256 tokenId,
        address user,
        address collateralizer,
        address creditor,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    ) external override {
        // system is live
        if (live == 0) revert Codex__modifyCollateralAndDebt_notLive();

        Position memory p = positions[vault][tokenId][user];
        Vault memory v = vaults[vault];
        // vault has been initialised
        if (v.rate == 0) revert Codex__modifyCollateralAndDebt_vaultNotInit();

        p.collateral = add(p.collateral, deltaCollateral);
        p.normalDebt = add(p.normalDebt, deltaNormalDebt);
        v.totalNormalDebt = add(v.totalNormalDebt, deltaNormalDebt);

        int256 deltaDebt = wmul(v.rate, deltaNormalDebt);
        uint256 debt = wmul(v.rate, p.normalDebt);
        globalDebt = add(globalDebt, deltaDebt);

        // either debt has decreased, or debt ceilings are not exceeded
        if (deltaNormalDebt > 0 && (wmul(v.totalNormalDebt, v.rate) > v.debtCeiling || globalDebt > globalDebtCeiling))
            revert Codex__modifyCollateralAndDebt_ceilingExceeded();
        // position is either less risky than before, or it is safe
        if (
            (deltaNormalDebt > 0 || deltaCollateral < 0) &&
            debt > wmul(p.collateral, IVault(vault).fairPrice(tokenId, true, false))
        ) revert Codex__modifyCollateralAndDebt_notSafe();

        // position is either more safe, or the owner consents
        if ((deltaNormalDebt > 0 || deltaCollateral < 0) && !hasDelegate(user, msg.sender))
            revert Codex__modifyCollateralAndDebt_notAllowedSender();
        // collateralizer consents if new collateral is put up
        if (deltaCollateral > 0 && !hasDelegate(collateralizer, msg.sender))
            revert Codex__modifyCollateralAndDebt_notAllowedCollateralizer();

        // creditor consents if debt is settled with credit
        if (deltaNormalDebt < 0 && !hasDelegate(creditor, msg.sender))
            revert Codex__modifyCollateralAndDebt_notAllowedDebtor();

        // position has no debt, or a non-dusty amount
        if (p.normalDebt != 0 && debt < v.debtFloor) revert Codex__modifyCollateralAndDebt_debtFloor();

        balances[vault][tokenId][collateralizer] = sub(balances[vault][tokenId][collateralizer], deltaCollateral);
        credit[creditor] = add(credit[creditor], deltaDebt);

        positions[vault][tokenId][user] = p;
        vaults[vault] = v;

        emit ModifyCollateralAndDebt(vault, tokenId, user, collateralizer, creditor, deltaCollateral, deltaNormalDebt);
    }

    /// @notice Transfers a Position's collateral and debt balances to another Position
    /// @dev Checks that the sender is delegated by `src` and `dst` Position owners,
    /// that the `src` and `dst` Positions are still safe after the transfer,
    /// and that the `src` and `dst` Positions' debt exceed the vault's debt floor
    /// @param vault Address of the Vault
    /// @param tokenId ERC1155 or ERC721 style TokenId (leave at 0 for ERC20)
    /// @param src Address of the `src` Positions owner
    /// @param dst Address of the `dst` Positions owner
    /// @param deltaCollateral Amount of collateral to send to (+) or from (-) the `src` Position [wad]
    /// @param deltaNormalDebt Amount of normalized debt (gross, before rate is applied) to send to (+) or
    /// from (-) the `dst` Position [wad]
    function transferCollateralAndDebt(
        address vault,
        uint256 tokenId,
        address src,
        address dst,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    ) external override {
        Position storage pSrc = positions[vault][tokenId][src];
        Position storage pDst = positions[vault][tokenId][dst];
        Vault storage v = vaults[vault];

        pSrc.collateral = sub(pSrc.collateral, deltaCollateral);
        pSrc.normalDebt = sub(pSrc.normalDebt, deltaNormalDebt);
        pDst.collateral = add(pDst.collateral, deltaCollateral);
        pDst.normalDebt = add(pDst.normalDebt, deltaNormalDebt);

        uint256 debtSrc = wmul(pSrc.normalDebt, v.rate);
        uint256 debtDst = wmul(pDst.normalDebt, v.rate);

        // both sides consent
        if (!hasDelegate(src, msg.sender) || !hasDelegate(dst, msg.sender))
            revert Codex__transferCollateralAndDebt_notAllowed();

        // both sides safe
        if (debtSrc > wmul(pSrc.collateral, IVault(vault).fairPrice(tokenId, true, false)))
            revert Codex__transferCollateralAndDebt_notSafeSrc();
        if (debtDst > wmul(pDst.collateral, IVault(vault).fairPrice(tokenId, true, false)))
            revert Codex__transferCollateralAndDebt_notSafeDst();

        // both sides non-dusty
        if (pSrc.normalDebt != 0 && debtSrc < v.debtFloor) revert Codex__transferCollateralAndDebt_debtFloorSrc();
        if (pDst.normalDebt != 0 && debtDst < v.debtFloor) revert Codex__transferCollateralAndDebt_debtFloorDst();

        emit TransferCollateralAndDebt(vault, tokenId, src, dst, deltaCollateral, deltaNormalDebt);
    }

    /// @notice Confiscates a Position's collateral and debt balances
    /// @dev Sender has to be allowed to call this method
    /// @param vault Address of the Vault
    /// @param tokenId ERC1155 or ERC721 style TokenId (leave at 0 for ERC20)
    /// @param user Address of the user
    /// @param collateralizer Address of who puts up or receives the collateral delta
    /// @param debtor Address of who provides or receives the debt delta
    /// @param deltaCollateral Amount of collateral to put up (+) for or remove (-) from this Position [wad]
    /// @param deltaNormalDebt Amount of normalized debt (gross, before rate is applied) to generate (+) or
    /// settle (-) on this Position [wad]
    function confiscateCollateralAndDebt(
        address vault,
        uint256 tokenId,
        address user,
        address collateralizer,
        address debtor,
        int256 deltaCollateral,
        int256 deltaNormalDebt
    ) external override checkCaller {
        Position storage position = positions[vault][tokenId][user];
        Vault storage v = vaults[vault];

        position.collateral = add(position.collateral, deltaCollateral);
        position.normalDebt = add(position.normalDebt, deltaNormalDebt);
        v.totalNormalDebt = add(v.totalNormalDebt, deltaNormalDebt);

        int256 deltaDebt = wmul(v.rate, deltaNormalDebt);

        balances[vault][tokenId][collateralizer] = sub(balances[vault][tokenId][collateralizer], deltaCollateral);
        unbackedDebt[debtor] = sub(unbackedDebt[debtor], deltaDebt);
        globalUnbackedDebt = sub(globalUnbackedDebt, deltaDebt);

        emit ConfiscateCollateralAndDebt(
            vault,
            tokenId,
            user,
            collateralizer,
            debtor,
            deltaCollateral,
            deltaNormalDebt
        );
    }

    /// ======== Unbacked Debt ======== ///

    /// @notice Settles unbacked debt with the sender's credit
    /// @dev Reverts if the sender does not have sufficient credit available to settle the debt
    /// @param debt Amount of debt to settle [wawd]
    function settleUnbackedDebt(uint256 debt) external override {
        address debtor = msg.sender;
        unbackedDebt[debtor] = sub(unbackedDebt[debtor], debt);
        credit[debtor] = sub(credit[debtor], debt);
        globalUnbackedDebt = sub(globalUnbackedDebt, debt);
        globalDebt = sub(globalDebt, debt);
        emit SettleUnbackedDebt(debtor, debt);
    }

    /// @notice Create unbacked debt / credit
    /// @dev Sender has to be allowed to call this method
    /// @param debtor Address of the account who takes the unbacked debt
    /// @param creditor Address of the account who gets the credit
    /// @param debt Amount of unbacked debt / credit to generate [wad]
    function createUnbackedDebt(
        address debtor,
        address creditor,
        uint256 debt
    ) external override checkCaller {
        unbackedDebt[debtor] = add(unbackedDebt[debtor], debt);
        credit[creditor] = add(credit[creditor], debt);
        globalUnbackedDebt = add(globalUnbackedDebt, debt);
        globalDebt = add(globalDebt, debt);
        emit CreateUnbackedDebt(debtor, creditor, debt);
    }

    /// ======== Debt Interest Rates ======== ///

    /// @notice Updates the rate value and collects the accrued interest for a Vault
    /// @dev Sender has to be allowed to call this method
    /// @param vault Address of the vault
    /// @param creditor Address of the account who gets the accrued interest
    /// @param deltaRate Delta to increase (+) or decrease (-) the rate [percentage in wad]
    function modifyRate(
        address vault,
        address creditor,
        int256 deltaRate
    ) external override checkCaller {
        if (live == 0) revert Codex__modifyRate_notLive();
        Vault storage v = vaults[vault];
        v.rate = add(v.rate, deltaRate);
        int256 wad = wmul(v.totalNormalDebt, deltaRate);
        credit[creditor] = add(credit[creditor], wad);
        globalDebt = add(globalDebt, wad);
        emit ModifyRate(vault, creditor, deltaRate);
    }

    /// ======== Shutdown ======== ///

    /// @notice Locks the contract
    /// @dev Sender has to be allowed to call this method
    function lock() external override checkCaller {
        live = 0;
        emit Lock();
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Codex__init_vaultAlreadyInit","type":"error"},{"inputs":[],"name":"Codex__modifyCollateralAndDebt_ceilingExceeded","type":"error"},{"inputs":[],"name":"Codex__modifyCollateralAndDebt_debtFloor","type":"error"},{"inputs":[],"name":"Codex__modifyCollateralAndDebt_notAllowedCollateralizer","type":"error"},{"inputs":[],"name":"Codex__modifyCollateralAndDebt_notAllowedDebtor","type":"error"},{"inputs":[],"name":"Codex__modifyCollateralAndDebt_notAllowedSender","type":"error"},{"inputs":[],"name":"Codex__modifyCollateralAndDebt_notLive","type":"error"},{"inputs":[],"name":"Codex__modifyCollateralAndDebt_notSafe","type":"error"},{"inputs":[],"name":"Codex__modifyCollateralAndDebt_vaultNotInit","type":"error"},{"inputs":[],"name":"Codex__modifyRate_notLive","type":"error"},{"inputs":[],"name":"Codex__setParam_notLive","type":"error"},{"inputs":[],"name":"Codex__setParam_unrecognizedParam","type":"error"},{"inputs":[],"name":"Codex__transferBalance_notAllowed","type":"error"},{"inputs":[],"name":"Codex__transferCollateralAndDebt_debtFloorDst","type":"error"},{"inputs":[],"name":"Codex__transferCollateralAndDebt_debtFloorSrc","type":"error"},{"inputs":[],"name":"Codex__transferCollateralAndDebt_notAllowed","type":"error"},{"inputs":[],"name":"Codex__transferCollateralAndDebt_notSafeDst","type":"error"},{"inputs":[],"name":"Codex__transferCollateralAndDebt_notSafeSrc","type":"error"},{"inputs":[],"name":"Codex__transferCredit_notAllowed","type":"error"},{"inputs":[],"name":"Guarded__notGranted","type":"error"},{"inputs":[],"name":"Guarded__notRoot","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"Math__add_overflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"int256","name":"y","type":"int256"}],"name":"Math__add_overflow_signed","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"Math__mul_overflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"int256","name":"y","type":"int256"}],"name":"Math__mul_overflow_signed","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"Math__sub_overflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"int256","name":"y","type":"int256"}],"name":"Math__sub_overflow_signed","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"sig","type":"bytes32"},{"indexed":false,"internalType":"address","name":"who","type":"address"}],"name":"AllowCaller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"sig","type":"bytes32"},{"indexed":false,"internalType":"address","name":"who","type":"address"}],"name":"BlockCaller","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"collateralizer","type":"address"},{"indexed":false,"internalType":"address","name":"debtor","type":"address"},{"indexed":false,"internalType":"int256","name":"deltaCollateral","type":"int256"},{"indexed":false,"internalType":"int256","name":"deltaNormalDebt","type":"int256"}],"name":"ConfiscateCollateralAndDebt","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"debtor","type":"address"},{"indexed":true,"internalType":"address","name":"creditor","type":"address"},{"indexed":false,"internalType":"uint256","name":"debt","type":"uint256"}],"name":"CreateUnbackedDebt","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"delegatee","type":"address"}],"name":"GrantDelegate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"}],"name":"Init","type":"event"},{"anonymous":false,"inputs":[],"name":"Lock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"int256","name":"amount","type":"int256"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"ModifyBalance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"collateralizer","type":"address"},{"indexed":false,"internalType":"address","name":"creditor","type":"address"},{"indexed":false,"internalType":"int256","name":"deltaCollateral","type":"int256"},{"indexed":false,"internalType":"int256","name":"deltaNormalDebt","type":"int256"}],"name":"ModifyCollateralAndDebt","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"creditor","type":"address"},{"indexed":false,"internalType":"int256","name":"deltaRate","type":"int256"}],"name":"ModifyRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"delegatee","type":"address"}],"name":"RevokeDelegate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"param","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"SetParam","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"bytes32","name":"param","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"SetParam","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"debtor","type":"address"},{"indexed":false,"internalType":"uint256","name":"debt","type":"uint256"}],"name":"SettleUnbackedDebt","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":false,"internalType":"address","name":"dst","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstBalance","type":"uint256"}],"name":"TransferBalance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":false,"internalType":"address","name":"dst","type":"address"},{"indexed":false,"internalType":"int256","name":"deltaCollateral","type":"int256"},{"indexed":false,"internalType":"int256","name":"deltaNormalDebt","type":"int256"}],"name":"TransferCollateralAndDebt","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":true,"internalType":"address","name":"dst","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcCredit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstCredit","type":"uint256"}],"name":"TransferCredit","type":"event"},{"inputs":[],"name":"ANY_CALLER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ANY_SIG","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"sig","type":"bytes32"},{"internalType":"address","name":"who","type":"address"}],"name":"allowCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"sig","type":"bytes32"},{"internalType":"address","name":"who","type":"address"}],"name":"blockCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"sig","type":"bytes32"},{"internalType":"address","name":"who","type":"address"}],"name":"canCall","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"collateralizer","type":"address"},{"internalType":"address","name":"debtor","type":"address"},{"internalType":"int256","name":"deltaCollateral","type":"int256"},{"internalType":"int256","name":"deltaNormalDebt","type":"int256"}],"name":"confiscateCollateralAndDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"debtor","type":"address"},{"internalType":"address","name":"creditor","type":"address"},{"internalType":"uint256","name":"debt","type":"uint256"}],"name":"createUnbackedDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"credit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"delegates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalDebtCeiling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalUnbackedDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"grantDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"live","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"int256","name":"amount","type":"int256"}],"name":"modifyBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"collateralizer","type":"address"},{"internalType":"address","name":"creditor","type":"address"},{"internalType":"int256","name":"deltaCollateral","type":"int256"},{"internalType":"int256","name":"deltaNormalDebt","type":"int256"}],"name":"modifyCollateralAndDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"creditor","type":"address"},{"internalType":"int256","name":"deltaRate","type":"int256"}],"name":"modifyRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"positions","outputs":[{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"uint256","name":"normalDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"revokeDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"param","type":"bytes32"},{"internalType":"uint256","name":"data","type":"uint256"}],"name":"setParam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"bytes32","name":"param","type":"bytes32"},{"internalType":"uint256","name":"data","type":"uint256"}],"name":"setParam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"debt","type":"uint256"}],"name":"settleUnbackedDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"int256","name":"deltaCollateral","type":"int256"},{"internalType":"int256","name":"deltaNormalDebt","type":"int256"}],"name":"transferCollateralAndDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferCredit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"unbackedDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vaults","outputs":[{"internalType":"uint256","name":"totalNormalDebt","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"debtCeiling","type":"uint256"},{"internalType":"uint256","name":"debtFloor","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061001a33610024565b6001600a556100c4565b6001600160a01b03811660008181527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b29006020908152604091829020805460ff1916600117905581517f13eb61d6467453b8d8e0d2a40b8dcee776dde376f951013dfdab1b9189651b618152908101929092527f9c21fb13a2f9c0e9222fe9a6810fe483b60248132981e1e0554bae602e93a9dd910160405180910390a150565b61238b806100d36000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c8063957aa58c11610104578063bbd91c46116100a2578063e584324211610071578063e5843242146104c0578063f63b0f3d146104eb578063f83d08ba146104fe578063fa352c001461050657600080fd5b8063bbd91c461461041d578063c07455451461045c578063d52dddf41461046f578063d5d44d80146104a057600080fd5b8063a622ee7c116100de578063a622ee7c1461038d578063a71d515f146103e4578063a746d489146103f7578063a757acd91461040a57600080fd5b8063957aa58c1461035e5780639f30490a14610367578063a015d1091461037a57600080fd5b80632efcc8661161017c5780635d6f82f01161014b5780635d6f82f0146102e257806383797bfc146102f55780638543d5e01461030857806385db1df51461031157600080fd5b80632efcc86614610290578063472f0d6b146102995780634aedbd7c146102ac57806352b43adf146102bf57600080fd5b80631d2a783d116101b85780631d2a783d1461021a5780631ffeaa221461023657806328f8f6ab146102565780632936ff2b1461026957600080fd5b8063012abbe9146101df57806319ab453c146101f45780631b14282014610207575b600080fd5b6101f26101ed36600461204d565b610519565b005b6101f2610202366004612079565b610607565b6101f2610215366004612094565b61070f565b61022360085481565b6040519081526020015b60405180910390f35b610223610244366004612079565b60066020526000908152604090205481565b6101f26102643660046120d0565b61081d565b6102237f13eb61d6467453b8d8e0d2a40b8dcee776dde376f951013dfdab1b9189651b6181565b61022360095481565b6101f26102a7366004612094565b610dfc565b6101f26102ba366004612094565b610f3f565b6102d26102cd36600461204d565b61103d565b604051901515815260200161022d565b6101f26102f03660046120d0565b6110e2565b6101f2610303366004612141565b6112a6565b61022360075481565b61034961031f366004612185565b60036020908152600093845260408085208252928452828420905282529020805460019091015482565b6040805192835260208301919091520161022d565b610223600a5481565b6101f26103753660046121c1565b611386565b6101f26103883660046121e3565b611496565b6103c461039b366004612079565b600260208190526000918252604090912080546001820154928201546003909201549092919084565b60408051948552602085019390935291830152606082015260800161022d565b6101f26103f23660046121fc565b611553565b6101f261040536600461204d565b61186e565b6101f2610418366004612079565b611925565b6104447f48a48edb17b6277f3d9897feeb510d1503580c3997a055cb5a635e86f81c243a81565b6040516001600160a01b03909116815260200161022d565b6101f261046a36600461225b565b611978565b61022361047d366004612185565b600460209081526000938452604080852082529284528284209052825290205481565b6102236104ae366004612079565b60056020526000908152604090205481565b6102236104ce3660046122b0565b600160209081526000928352604080842090915290825290205481565b6101f26104f93660046122da565b611ac4565b6101f2611c00565b6101f2610514366004612079565b611c63565b3360009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff16156105d5576000828152602081815260408083206001600160a01b0385168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690558051858152918201929092527faec761575684e54a883064093131de012d7a9e8fc898f13474e50fcfbdce7d0b91015b60405180910390a15050565b6040517f6d6b83b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6106357fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576001600160a01b0381166000908152600260205260409020600101541561068d576040517f3e5f9dc100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038116600081815260026020526040808220670de0b6b3a7640000600190910155517f4f8cfde3439a1a302c21ca51eec26086efbfd940b8c0279889fc6bb6e73ecc669190a250565b6040517faa68b5bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61073d7fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576001600160a01b0383166000908152600660205260409020546107659082611cb4565b6001600160a01b0380851660009081526006602090815260408083209490945591851681526005909152205461079b9082611cb4565b6001600160a01b0383166000908152600560205260409020556008546107c19082611cb4565b6008556007546107d19082611cb4565b6007556040518181526001600160a01b0380841691908516907ff182230004e4ab0b80cf979f234e9b748a02a0d127edcd65602583796a86a6cd906020015b60405180910390a3505050565b600a54600003610859576040517fe969c9ac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0380881660008181526003602081815260408084208c85528252808420958b168452948152848320855180870187528154815260019182015481840152948452600280835286852087516080810189528154815292810154938301849052908101549682019690965294909101546060850152919291900361090e576040517fd334386c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815161091a9085611d00565b8252602082015161092b9084611d00565b6020830152805161093c9084611d00565b815260208101516000906109509085611da3565b9050600061096683602001518560200151611dcd565b905061097460075483611d00565b6007556000851380156109a85750826040015161099984600001518560200151611dcd565b11806109a85750600954600754115b156109df576040517f36ab49f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008513806109ee5750600086125b8015610a95575083516040517f06edbf77000000000000000000000000000000000000000000000000000000008152600481018c90526001602482015260006044820152610a9291906001600160a01b038e16906306edbf77906064015b602060405180830381865afa158015610a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8d919061230d565b611dcd565b81115b15610acc576040517ff313cb6700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000851380610adb5750600086125b8015610aee5750610aec8933611df7565b155b15610b25576040517f313605f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600086138015610b3c5750610b3a8833611df7565b155b15610b73576040517f207c937400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600085128015610b8a5750610b888733611df7565b155b15610bc1576040517f4dd8065500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602084015115801590610bd75750826060015181105b15610c0e576040517f8a6a431e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03808c1660009081526004602090815260408083208e84528252808320938c1683529290522054610c469087611e44565b6001600160a01b03808d1660009081526004602090815260408083208f845282528083208d85168452825280832094909455918a16815260059091522054610c8e9083611d00565b60056000896001600160a01b03166001600160a01b031681526020019081526020016000208190555083600360008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008c815260200190815260200160002060008b6001600160a01b03166001600160a01b03168152602001908152602001600020600082015181600001556020820151816001015590505082600260008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000155602082015181600101556040820151816002015560608201518160030155905050886001600160a01b03168a8c6001600160a01b03167f3f1610e0fdfc07838a756ae82a3dc0707086852ee0bb77e10d25f746c8f950ab8b8b8b8b604051610de794939291906001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b60405180910390a45050505050505050505050565b610e2a7fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd57600a54600003610e6b576040517ff8826c3b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03831660009081526002602052604090206001810154610e929083611d00565b60018201558054600090610ea69084611da3565b6001600160a01b038516600090815260056020526040902054909150610ecc9082611d00565b6001600160a01b038516600090815260056020526040902055600754610ef29082611d00565b6007556040518381526001600160a01b0380861691908716907f2820d04983e463b5762259e28fe5e45474c47c03ab72eae8c8635dde1598b4d29060200160405180910390a35050505050565b610f498333611df7565b610f7f576040517fb2bbbb5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038316600090815260056020526040902054610fa29082611ee7565b6001600160a01b038085166000908152600560205260408082209390935590841681522054610fd19082611cb4565b6001600160a01b03838116600081815260056020908152604080832086905593881680835284832054928490528451878152918201929092529283019390935291907fe6b6b491c170d7630585b4c52db10cf546fb281ce4d616e7438ee27d9e804d4490606001610810565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16806110a357506001600160a01b03821660009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff165b806110d9575060008381526020818152604080832073eb510d1503580c3997a055cb5a635e86f81c243a845290915290205460ff165b90505b92915050565b6111107fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576001600160a01b0380881660008181526003602090815260408083208b84528252808320948a1683529381528382209282526002905291909120815461115b9085611d00565b8255600182015461116c9084611d00565b6001830155805461117d9084611d00565b815560018101546000906111919085611da3565b6001600160a01b03808c1660009081526004602090815260408083208e84528252808320938c16835292905220549091506111cc9086611e44565b6001600160a01b03808c1660009081526004602090815260408083208e845282528083208c851684528252808320949094559189168152600690915220546112149082611e44565b6001600160a01b03871660009081526006602052604090205560085461123a9082611e44565b600855604080516001600160a01b038981168252888116602083015291810187905260608101869052818a16918b91908d16907fa3e7a860992bc893a9abe1f4aa858ca49dbb1b32e252376516d28cf17e043dc59060800160405180910390a450505050505050505050565b6112d47fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576001600160a01b0380851660009081526004602090815260408083208784528252808320938616835292905220546113119082611d00565b6001600160a01b038581166000818152600460209081526040808320898452825280832094881680845294825291829020859055815186815290810194909452919286927f4782a28466dc90762919a253b656d2f1de365df15e3499771bcc06d1c6b41614910160405180910390a450505050565b6113b47fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd57600a546000036113f5576040517f401dbfe900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817f676c6f62616c446562744365696c696e6700000000000000000000000000000003611426576009819055611458565b6040517fa492034600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817ff04ee4a7c5e0072de141f68fbec4aba82bfa0866ce04ad1f286b8602e0cbcfa68260405161148a91815260200190565b60405180910390a25050565b336000818152600660205260409020546114b09083611ee7565b6001600160a01b0382166000908152600660209081526040808320939093556005905220546114df9083611ee7565b6001600160a01b0382166000908152600560205260409020556008546115059083611ee7565b6008556007546115159083611ee7565b6007556040518281526001600160a01b038216907f4a754603a47f03808723af6ad9b9ebde994c77c27e04b71fea77deb0eefb81389060200161148a565b6001600160a01b0386811660008181526003602090815260408083208a8452825280832089861684528252808320948816835280832093835260029091529020825461159f9086611e44565b835560018301546115b09085611e44565b600184015581546115c19086611d00565b825560018201546115d29085611d00565b826001018190555060006115ee84600101548360010154611dcd565b9050600061160484600101548460010154611dcd565b90506116108933611df7565b158061162357506116218833611df7565b155b1561165a576040517fe5acee9300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84546040517f06edbf77000000000000000000000000000000000000000000000000000000008152600481018c905260016024820152600060448201526116b591906001600160a01b038e16906306edbf7790606401610a4c565b8211156116ee576040517f1647c46700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83546040517f06edbf77000000000000000000000000000000000000000000000000000000008152600481018c9052600160248201526000604482015261174991906001600160a01b038e16906306edbf7790606401610a4c565b811115611782576040517f3fb0681600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001850154158015906117985750826003015482105b156117cf576040517f55e9d37c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001840154158015906117e55750826003015481105b1561181c576040517f67bde1ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b038a81168252602082018a9052918101889052818b16918c91908e16907ffd179184648392cfaa71ae9a075520dd3aeb15a160df1dffe5efa2f418b2fc0e90606001610de7565b3360009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff16156105d5576000828152602081815260408083206001600160a01b0385168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558051858152918201929092527f9c21fb13a2f9c0e9222fe9a6810fe483b60248132981e1e0554bae602e93a9dd91016105c9565b3360008181526001602081815260408084206001600160a01b03871680865292528084209290925590519092917f40fa2cce8ebb736e780591431c31b95f5760d5d731014c68875581f184bf2c5d91a350565b6119828333611df7565b6119b8576040517f94eab1d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0380861660009081526004602090815260408083208884528252808320938716835292905220546119f09082611ee7565b6001600160a01b038681166000908152600460209081526040808320898452825280832088851684529091528082209390935590841681522054611a349082611cb4565b6001600160a01b0386811660008181526004602090815260408083208a8452825280832088861680855290835281842087905594891680845281842054938690528151958652918501879052840191909152606083019390935286917fdbe6f5a54bf1c3a5fc035c87b02a2c8c764a3dca54a0b81e603519ce62c8abe89060800160405180910390a45050505050565b611af27fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd57600a54600003611b33576040517f401dbfe900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817f646562744365696c696e6700000000000000000000000000000000000000000003611b7e576001600160a01b038316600090815260026020819052604090912001819055611bc4565b817f64656274466c6f6f72000000000000000000000000000000000000000000000003611426576001600160a01b03831660009081526002602052604090206003018190555b81836001600160a01b03167feae3e9da3f1d1474fb6ee1e0ad900272b38c9fd0c29d51b5f35a21823d0bbd478360405161081091815260200190565b611c2e7fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576000600a8190556040517f46620e39f4e119bf05f13544f8ef38338fc06c17f6b731c7f95bee356572db969190a1565b3360008181526001602090815260408083206001600160a01b0386168085529252808320839055519092917f3e34a3ee53064fb79c0ee57448f03774a627a9270b0c41286efb7d8e32dcde9391a350565b808201828110156110dc576040517f2c203e7200000000000000000000000000000000000000000000000000000000815260048101849052602481018390526044015b60405180910390fd5b818101600082121580611d135750828111155b611d53576040517fe58c5c9d0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b600082131580611d635750828110155b6110dc576040517fe58c5c9d0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b6000670de0b6b3a7640000611db88484611f2d565b81611dc557611dc5612326565b059392505050565b6000670de0b6b3a7640000611de28484611fd0565b81611def57611def612326565b049392505050565b6000816001600160a01b0316836001600160a01b031614806110d95750506001600160a01b0391821660009081526001602081815260408084209490951683529290925291909120541490565b808203600082131580611e575750828111155b611e97576040517fdd9d2f9e0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b600082121580611ea75750828110155b6110dc576040517fdd9d2f9e0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b808203828111156110dc576040517e5318ee0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b8181026000831215611f75576040517f31a805450000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b811580611f90575082828281611f8d57611f8d612326565b05145b6110dc576040517f31a805450000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b6000811580611ff157505080820282828281611fee57611fee612326565b04145b6110dc576040517fa3b82a410000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b80356001600160a01b038116811461204857600080fd5b919050565b6000806040838503121561206057600080fd5b8235915061207060208401612031565b90509250929050565b60006020828403121561208b57600080fd5b6110d982612031565b6000806000606084860312156120a957600080fd5b6120b284612031565b92506120c060208501612031565b9150604084013590509250925092565b600080600080600080600060e0888a0312156120eb57600080fd5b6120f488612031565b96506020880135955061210960408901612031565b945061211760608901612031565b935061212560808901612031565b925060a0880135915060c0880135905092959891949750929550565b6000806000806080858703121561215757600080fd5b61216085612031565b93506020850135925061217560408601612031565b9396929550929360600135925050565b60008060006060848603121561219a57600080fd5b6121a384612031565b9250602084013591506121b860408501612031565b90509250925092565b600080604083850312156121d457600080fd5b50508035926020909101359150565b6000602082840312156121f557600080fd5b5035919050565b60008060008060008060c0878903121561221557600080fd5b61221e87612031565b95506020870135945061223360408801612031565b935061224160608801612031565b92506080870135915060a087013590509295509295509295565b600080600080600060a0868803121561227357600080fd5b61227c86612031565b94506020860135935061229160408701612031565b925061229f60608701612031565b949793965091946080013592915050565b600080604083850312156122c357600080fd5b6122cc83612031565b915061207060208401612031565b6000806000606084860312156122ef57600080fd5b6122f884612031565b95602085013595506040909401359392505050565b60006020828403121561231f57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122054c8a470dd72a8493bbfad5dce37198451d9c587378210cdbc3c7ef0273ea4ac64736f6c634300080d0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101da5760003560e01c8063957aa58c11610104578063bbd91c46116100a2578063e584324211610071578063e5843242146104c0578063f63b0f3d146104eb578063f83d08ba146104fe578063fa352c001461050657600080fd5b8063bbd91c461461041d578063c07455451461045c578063d52dddf41461046f578063d5d44d80146104a057600080fd5b8063a622ee7c116100de578063a622ee7c1461038d578063a71d515f146103e4578063a746d489146103f7578063a757acd91461040a57600080fd5b8063957aa58c1461035e5780639f30490a14610367578063a015d1091461037a57600080fd5b80632efcc8661161017c5780635d6f82f01161014b5780635d6f82f0146102e257806383797bfc146102f55780638543d5e01461030857806385db1df51461031157600080fd5b80632efcc86614610290578063472f0d6b146102995780634aedbd7c146102ac57806352b43adf146102bf57600080fd5b80631d2a783d116101b85780631d2a783d1461021a5780631ffeaa221461023657806328f8f6ab146102565780632936ff2b1461026957600080fd5b8063012abbe9146101df57806319ab453c146101f45780631b14282014610207575b600080fd5b6101f26101ed36600461204d565b610519565b005b6101f2610202366004612079565b610607565b6101f2610215366004612094565b61070f565b61022360085481565b6040519081526020015b60405180910390f35b610223610244366004612079565b60066020526000908152604090205481565b6101f26102643660046120d0565b61081d565b6102237f13eb61d6467453b8d8e0d2a40b8dcee776dde376f951013dfdab1b9189651b6181565b61022360095481565b6101f26102a7366004612094565b610dfc565b6101f26102ba366004612094565b610f3f565b6102d26102cd36600461204d565b61103d565b604051901515815260200161022d565b6101f26102f03660046120d0565b6110e2565b6101f2610303366004612141565b6112a6565b61022360075481565b61034961031f366004612185565b60036020908152600093845260408085208252928452828420905282529020805460019091015482565b6040805192835260208301919091520161022d565b610223600a5481565b6101f26103753660046121c1565b611386565b6101f26103883660046121e3565b611496565b6103c461039b366004612079565b600260208190526000918252604090912080546001820154928201546003909201549092919084565b60408051948552602085019390935291830152606082015260800161022d565b6101f26103f23660046121fc565b611553565b6101f261040536600461204d565b61186e565b6101f2610418366004612079565b611925565b6104447f48a48edb17b6277f3d9897feeb510d1503580c3997a055cb5a635e86f81c243a81565b6040516001600160a01b03909116815260200161022d565b6101f261046a36600461225b565b611978565b61022361047d366004612185565b600460209081526000938452604080852082529284528284209052825290205481565b6102236104ae366004612079565b60056020526000908152604090205481565b6102236104ce3660046122b0565b600160209081526000928352604080842090915290825290205481565b6101f26104f93660046122da565b611ac4565b6101f2611c00565b6101f2610514366004612079565b611c63565b3360009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff16156105d5576000828152602081815260408083206001600160a01b0385168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690558051858152918201929092527faec761575684e54a883064093131de012d7a9e8fc898f13474e50fcfbdce7d0b91015b60405180910390a15050565b6040517f6d6b83b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6106357fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576001600160a01b0381166000908152600260205260409020600101541561068d576040517f3e5f9dc100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038116600081815260026020526040808220670de0b6b3a7640000600190910155517f4f8cfde3439a1a302c21ca51eec26086efbfd940b8c0279889fc6bb6e73ecc669190a250565b6040517faa68b5bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61073d7fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576001600160a01b0383166000908152600660205260409020546107659082611cb4565b6001600160a01b0380851660009081526006602090815260408083209490945591851681526005909152205461079b9082611cb4565b6001600160a01b0383166000908152600560205260409020556008546107c19082611cb4565b6008556007546107d19082611cb4565b6007556040518181526001600160a01b0380841691908516907ff182230004e4ab0b80cf979f234e9b748a02a0d127edcd65602583796a86a6cd906020015b60405180910390a3505050565b600a54600003610859576040517fe969c9ac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0380881660008181526003602081815260408084208c85528252808420958b168452948152848320855180870187528154815260019182015481840152948452600280835286852087516080810189528154815292810154938301849052908101549682019690965294909101546060850152919291900361090e576040517fd334386c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815161091a9085611d00565b8252602082015161092b9084611d00565b6020830152805161093c9084611d00565b815260208101516000906109509085611da3565b9050600061096683602001518560200151611dcd565b905061097460075483611d00565b6007556000851380156109a85750826040015161099984600001518560200151611dcd565b11806109a85750600954600754115b156109df576040517f36ab49f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008513806109ee5750600086125b8015610a95575083516040517f06edbf77000000000000000000000000000000000000000000000000000000008152600481018c90526001602482015260006044820152610a9291906001600160a01b038e16906306edbf77906064015b602060405180830381865afa158015610a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8d919061230d565b611dcd565b81115b15610acc576040517ff313cb6700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000851380610adb5750600086125b8015610aee5750610aec8933611df7565b155b15610b25576040517f313605f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600086138015610b3c5750610b3a8833611df7565b155b15610b73576040517f207c937400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600085128015610b8a5750610b888733611df7565b155b15610bc1576040517f4dd8065500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602084015115801590610bd75750826060015181105b15610c0e576040517f8a6a431e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03808c1660009081526004602090815260408083208e84528252808320938c1683529290522054610c469087611e44565b6001600160a01b03808d1660009081526004602090815260408083208f845282528083208d85168452825280832094909455918a16815260059091522054610c8e9083611d00565b60056000896001600160a01b03166001600160a01b031681526020019081526020016000208190555083600360008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008c815260200190815260200160002060008b6001600160a01b03166001600160a01b03168152602001908152602001600020600082015181600001556020820151816001015590505082600260008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000155602082015181600101556040820151816002015560608201518160030155905050886001600160a01b03168a8c6001600160a01b03167f3f1610e0fdfc07838a756ae82a3dc0707086852ee0bb77e10d25f746c8f950ab8b8b8b8b604051610de794939291906001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b60405180910390a45050505050505050505050565b610e2a7fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd57600a54600003610e6b576040517ff8826c3b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03831660009081526002602052604090206001810154610e929083611d00565b60018201558054600090610ea69084611da3565b6001600160a01b038516600090815260056020526040902054909150610ecc9082611d00565b6001600160a01b038516600090815260056020526040902055600754610ef29082611d00565b6007556040518381526001600160a01b0380861691908716907f2820d04983e463b5762259e28fe5e45474c47c03ab72eae8c8635dde1598b4d29060200160405180910390a35050505050565b610f498333611df7565b610f7f576040517fb2bbbb5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038316600090815260056020526040902054610fa29082611ee7565b6001600160a01b038085166000908152600560205260408082209390935590841681522054610fd19082611cb4565b6001600160a01b03838116600081815260056020908152604080832086905593881680835284832054928490528451878152918201929092529283019390935291907fe6b6b491c170d7630585b4c52db10cf546fb281ce4d616e7438ee27d9e804d4490606001610810565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16806110a357506001600160a01b03821660009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff165b806110d9575060008381526020818152604080832073eb510d1503580c3997a055cb5a635e86f81c243a845290915290205460ff165b90505b92915050565b6111107fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576001600160a01b0380881660008181526003602090815260408083208b84528252808320948a1683529381528382209282526002905291909120815461115b9085611d00565b8255600182015461116c9084611d00565b6001830155805461117d9084611d00565b815560018101546000906111919085611da3565b6001600160a01b03808c1660009081526004602090815260408083208e84528252808320938c16835292905220549091506111cc9086611e44565b6001600160a01b03808c1660009081526004602090815260408083208e845282528083208c851684528252808320949094559189168152600690915220546112149082611e44565b6001600160a01b03871660009081526006602052604090205560085461123a9082611e44565b600855604080516001600160a01b038981168252888116602083015291810187905260608101869052818a16918b91908d16907fa3e7a860992bc893a9abe1f4aa858ca49dbb1b32e252376516d28cf17e043dc59060800160405180910390a450505050505050505050565b6112d47fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576001600160a01b0380851660009081526004602090815260408083208784528252808320938616835292905220546113119082611d00565b6001600160a01b038581166000818152600460209081526040808320898452825280832094881680845294825291829020859055815186815290810194909452919286927f4782a28466dc90762919a253b656d2f1de365df15e3499771bcc06d1c6b41614910160405180910390a450505050565b6113b47fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd57600a546000036113f5576040517f401dbfe900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817f676c6f62616c446562744365696c696e6700000000000000000000000000000003611426576009819055611458565b6040517fa492034600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817ff04ee4a7c5e0072de141f68fbec4aba82bfa0866ce04ad1f286b8602e0cbcfa68260405161148a91815260200190565b60405180910390a25050565b336000818152600660205260409020546114b09083611ee7565b6001600160a01b0382166000908152600660209081526040808320939093556005905220546114df9083611ee7565b6001600160a01b0382166000908152600560205260409020556008546115059083611ee7565b6008556007546115159083611ee7565b6007556040518281526001600160a01b038216907f4a754603a47f03808723af6ad9b9ebde994c77c27e04b71fea77deb0eefb81389060200161148a565b6001600160a01b0386811660008181526003602090815260408083208a8452825280832089861684528252808320948816835280832093835260029091529020825461159f9086611e44565b835560018301546115b09085611e44565b600184015581546115c19086611d00565b825560018201546115d29085611d00565b826001018190555060006115ee84600101548360010154611dcd565b9050600061160484600101548460010154611dcd565b90506116108933611df7565b158061162357506116218833611df7565b155b1561165a576040517fe5acee9300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84546040517f06edbf77000000000000000000000000000000000000000000000000000000008152600481018c905260016024820152600060448201526116b591906001600160a01b038e16906306edbf7790606401610a4c565b8211156116ee576040517f1647c46700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83546040517f06edbf77000000000000000000000000000000000000000000000000000000008152600481018c9052600160248201526000604482015261174991906001600160a01b038e16906306edbf7790606401610a4c565b811115611782576040517f3fb0681600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001850154158015906117985750826003015482105b156117cf576040517f55e9d37c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001840154158015906117e55750826003015481105b1561181c576040517f67bde1ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b038a81168252602082018a9052918101889052818b16918c91908e16907ffd179184648392cfaa71ae9a075520dd3aeb15a160df1dffe5efa2f418b2fc0e90606001610de7565b3360009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff16156105d5576000828152602081815260408083206001600160a01b0385168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558051858152918201929092527f9c21fb13a2f9c0e9222fe9a6810fe483b60248132981e1e0554bae602e93a9dd91016105c9565b3360008181526001602081815260408084206001600160a01b03871680865292528084209290925590519092917f40fa2cce8ebb736e780591431c31b95f5760d5d731014c68875581f184bf2c5d91a350565b6119828333611df7565b6119b8576040517f94eab1d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0380861660009081526004602090815260408083208884528252808320938716835292905220546119f09082611ee7565b6001600160a01b038681166000908152600460209081526040808320898452825280832088851684529091528082209390935590841681522054611a349082611cb4565b6001600160a01b0386811660008181526004602090815260408083208a8452825280832088861680855290835281842087905594891680845281842054938690528151958652918501879052840191909152606083019390935286917fdbe6f5a54bf1c3a5fc035c87b02a2c8c764a3dca54a0b81e603519ce62c8abe89060800160405180910390a45050505050565b611af27fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd57600a54600003611b33576040517f401dbfe900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817f646562744365696c696e6700000000000000000000000000000000000000000003611b7e576001600160a01b038316600090815260026020819052604090912001819055611bc4565b817f64656274466c6f6f72000000000000000000000000000000000000000000000003611426576001600160a01b03831660009081526002602052604090206003018190555b81836001600160a01b03167feae3e9da3f1d1474fb6ee1e0ad900272b38c9fd0c29d51b5f35a21823d0bbd478360405161081091815260200190565b611c2e7fffffffff00000000000000000000000000000000000000000000000000000000600035163361103d565b156106dd576000600a8190556040517f46620e39f4e119bf05f13544f8ef38338fc06c17f6b731c7f95bee356572db969190a1565b3360008181526001602090815260408083206001600160a01b0386168085529252808320839055519092917f3e34a3ee53064fb79c0ee57448f03774a627a9270b0c41286efb7d8e32dcde9391a350565b808201828110156110dc576040517f2c203e7200000000000000000000000000000000000000000000000000000000815260048101849052602481018390526044015b60405180910390fd5b818101600082121580611d135750828111155b611d53576040517fe58c5c9d0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b600082131580611d635750828110155b6110dc576040517fe58c5c9d0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b6000670de0b6b3a7640000611db88484611f2d565b81611dc557611dc5612326565b059392505050565b6000670de0b6b3a7640000611de28484611fd0565b81611def57611def612326565b049392505050565b6000816001600160a01b0316836001600160a01b031614806110d95750506001600160a01b0391821660009081526001602081815260408084209490951683529290925291909120541490565b808203600082131580611e575750828111155b611e97576040517fdd9d2f9e0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b600082121580611ea75750828110155b6110dc576040517fdd9d2f9e0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b808203828111156110dc576040517e5318ee0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b8181026000831215611f75576040517f31a805450000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b811580611f90575082828281611f8d57611f8d612326565b05145b6110dc576040517f31a805450000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b6000811580611ff157505080820282828281611fee57611fee612326565b04145b6110dc576040517fa3b82a410000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401611cf7565b80356001600160a01b038116811461204857600080fd5b919050565b6000806040838503121561206057600080fd5b8235915061207060208401612031565b90509250929050565b60006020828403121561208b57600080fd5b6110d982612031565b6000806000606084860312156120a957600080fd5b6120b284612031565b92506120c060208501612031565b9150604084013590509250925092565b600080600080600080600060e0888a0312156120eb57600080fd5b6120f488612031565b96506020880135955061210960408901612031565b945061211760608901612031565b935061212560808901612031565b925060a0880135915060c0880135905092959891949750929550565b6000806000806080858703121561215757600080fd5b61216085612031565b93506020850135925061217560408601612031565b9396929550929360600135925050565b60008060006060848603121561219a57600080fd5b6121a384612031565b9250602084013591506121b860408501612031565b90509250925092565b600080604083850312156121d457600080fd5b50508035926020909101359150565b6000602082840312156121f557600080fd5b5035919050565b60008060008060008060c0878903121561221557600080fd5b61221e87612031565b95506020870135945061223360408801612031565b935061224160608801612031565b92506080870135915060a087013590509295509295509295565b600080600080600060a0868803121561227357600080fd5b61227c86612031565b94506020860135935061229160408701612031565b925061229f60608701612031565b949793965091946080013592915050565b600080604083850312156122c357600080fd5b6122cc83612031565b915061207060208401612031565b6000806000606084860312156122ef57600080fd5b6122f884612031565b95602085013595506040909401359392505050565b60006020828403121561231f57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122054c8a470dd72a8493bbfad5dce37198451d9c587378210cdbc3c7ef0273ea4ac64736f6c634300080d0033

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  ]
[ 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.