ETH Price: $2,683.55 (-0.67%)
Gas: 0.71 Gwei

Contract

0x2130aA75d46F1E9997497A440ffd1A586A0dD663
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit127420952021-07-01 13:39:271328 days ago1625146767IN
0x2130aA75...86A0dD663
0 ETH0.0009038217.71
Deposit127418872021-07-01 12:52:101328 days ago1625143930IN
0x2130aA75...86A0dD663
0 ETH0.0011256811

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VaultERC

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity Multiple files format)

File 1 of 2: VaultERC.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC20.sol";

contract VaultERC {

    address private _owner;

    mapping(address => uint) _totalSupply;
    mapping(address => mapping(address => uint)) balances;

    constructor() {
        _owner = msg.sender;
    }

    modifier onlyOwner() {
        require(_owner == msg.sender, 'Ownable: caller is not the owner');
        _;
    }

    function totalSupply(address token) public view returns (uint) {
        return _totalSupply[token];
    }

    function balanceOf(address token, address account) public view returns (uint balance) {
        return balances[token][account];
    }

    function deposit(address token, uint amount) public returns (bool success) {
        IERC20(token).transferFrom(msg.sender, address(this), amount);
        balances[token][msg.sender] = SafeMath.safeAdd(balances[token][msg.sender], amount);
        _totalSupply[token] = SafeMath.safeAdd(_totalSupply[token], amount);
        return true;
    }

    function withdraw(address token, uint amount) public onlyOwner returns (bool success) {
        require (amount < _totalSupply[token], "amount must be less than total supply");
        // if (IERC20(token).allowance(address(this), _owner) < amount) {
        //     _approve(_owner, token, 2**256 - 1);
        // }
        IERC20(token).transfer(_owner, amount);
        _totalSupply[token] = SafeMath.safeSub(_totalSupply[token], amount);
        return true;
    }
    
    function withdrawUnderlying(address token, uint amount) public returns (bool success) {
        require (amount < _totalSupply[token], "amount must be less than total supply");
        // if (IERC20(token).allowance(address(this), msg.sender) < amount) {
        //     _approve(msg.sender, token, amount);
        // }
        IERC20(token).transfer(msg.sender, amount);
        _totalSupply[token] = SafeMath.safeSub(_totalSupply[token], amount);
        return true;
    }
    
    function transferOwner(address newOwner) public onlyOwner {
        require(newOwner != address(0), 'Ownable: new owner is the zero address');
        _owner = newOwner;
    }

    function getOwner() public view returns (address) {
        return _owner;
    }
    
    function _approve(address account, address token, uint amount) private {
        IERC20(token).approve(account, amount);   
    }
}

library SafeMath {

    function safeAdd(uint a, uint b) internal pure returns (uint c) {
        c = a + b;
        require(c >= a);
    }

    function safeSub(uint a, uint b) internal pure returns (uint c) {
        require(b <= a);
        c = a - b;
    }

    function safeMul(uint a, uint b) internal pure returns (uint c) {
        c = a * b;
        require(a == 0 || c / a == b);
    }

    function safeDiv(uint a, uint b) internal pure returns (uint c) {
        require(b > 0);
        c = a / b;
    }
}

library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

File 2 of 2: IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawUnderlying","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610711806100326000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063e4dc2aa41161005b578063e4dc2aa4146100d5578063f3fef3a3146100f5578063f7888aec14610108578063fdb872521461011b5761007d565b806347e7ef24146100825780634fb2e45d146100ab578063893d20e8146100c0575b600080fd5b610095610090366004610528565b61012e565b6040516100a291906105c2565b60405180910390f35b6100be6100b93660046104dc565b610245565b005b6100c86102c0565b6040516100a29190610571565b6100e86100e33660046104dc565b6102cf565b6040516100a2919061068d565b610095610103366004610528565b6102ee565b6100e86101163660046104f6565b6103fa565b610095610129366004610528565b610425565b6040516323b872dd60e01b81526000906001600160a01b038416906323b872dd9061016190339030908790600401610585565b602060405180830381600087803b15801561017b57600080fd5b505af115801561018f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b39190610551565b506001600160a01b03831660009081526002602090815260408083203384529091529020546101e2908361048a565b6001600160a01b03841660008181526002602090815260408083203384528252808320949094559181526001909152205461021d908361048a565b6001600160a01b03841660009081526001602081905260409091209190915590505b92915050565b6000546001600160a01b031633146102785760405162461bcd60e51b815260040161026f90610658565b60405180910390fd5b6001600160a01b03811661029e5760405162461bcd60e51b815260040161026f906105cd565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b6001600160a01b0381166000908152600160205260409020545b919050565b600080546001600160a01b031633146103195760405162461bcd60e51b815260040161026f90610658565b6001600160a01b03831660009081526001602052604090205482106103505760405162461bcd60e51b815260040161026f90610613565b60005460405163a9059cbb60e01b81526001600160a01b038581169263a9059cbb92610384929091169086906004016105a9565b602060405180830381600087803b15801561039e57600080fd5b505af11580156103b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d69190610551565b506001600160a01b03831660009081526001602052604090205461021d90836104a5565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6001600160a01b038216600090815260016020526040812054821061045c5760405162461bcd60e51b815260040161026f90610613565b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb9061038490339086906004016105a9565b60006104968284610696565b90508281101561023f57600080fd5b6000828211156104b457600080fd5b6104be82846106ae565b9392505050565b80356001600160a01b03811681146102e957600080fd5b6000602082840312156104ed578081fd5b6104be826104c5565b60008060408385031215610508578081fd5b610511836104c5565b915061051f602084016104c5565b90509250929050565b6000806040838503121561053a578182fd5b610543836104c5565b946020939093013593505050565b600060208284031215610562578081fd5b815180151581146104be578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526025908201527f616d6f756e74206d757374206265206c657373207468616e20746f74616c20736040820152647570706c7960d81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b90815260200190565b600082198211156106a9576106a96106c5565b500190565b6000828210156106c0576106c06106c5565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220613dcdcc186ee47e4fcffe0a813b0ac7acffb264273ca54136438b4df350b72464736f6c63430008000033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063e4dc2aa41161005b578063e4dc2aa4146100d5578063f3fef3a3146100f5578063f7888aec14610108578063fdb872521461011b5761007d565b806347e7ef24146100825780634fb2e45d146100ab578063893d20e8146100c0575b600080fd5b610095610090366004610528565b61012e565b6040516100a291906105c2565b60405180910390f35b6100be6100b93660046104dc565b610245565b005b6100c86102c0565b6040516100a29190610571565b6100e86100e33660046104dc565b6102cf565b6040516100a2919061068d565b610095610103366004610528565b6102ee565b6100e86101163660046104f6565b6103fa565b610095610129366004610528565b610425565b6040516323b872dd60e01b81526000906001600160a01b038416906323b872dd9061016190339030908790600401610585565b602060405180830381600087803b15801561017b57600080fd5b505af115801561018f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b39190610551565b506001600160a01b03831660009081526002602090815260408083203384529091529020546101e2908361048a565b6001600160a01b03841660008181526002602090815260408083203384528252808320949094559181526001909152205461021d908361048a565b6001600160a01b03841660009081526001602081905260409091209190915590505b92915050565b6000546001600160a01b031633146102785760405162461bcd60e51b815260040161026f90610658565b60405180910390fd5b6001600160a01b03811661029e5760405162461bcd60e51b815260040161026f906105cd565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b6001600160a01b0381166000908152600160205260409020545b919050565b600080546001600160a01b031633146103195760405162461bcd60e51b815260040161026f90610658565b6001600160a01b03831660009081526001602052604090205482106103505760405162461bcd60e51b815260040161026f90610613565b60005460405163a9059cbb60e01b81526001600160a01b038581169263a9059cbb92610384929091169086906004016105a9565b602060405180830381600087803b15801561039e57600080fd5b505af11580156103b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d69190610551565b506001600160a01b03831660009081526001602052604090205461021d90836104a5565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6001600160a01b038216600090815260016020526040812054821061045c5760405162461bcd60e51b815260040161026f90610613565b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb9061038490339086906004016105a9565b60006104968284610696565b90508281101561023f57600080fd5b6000828211156104b457600080fd5b6104be82846106ae565b9392505050565b80356001600160a01b03811681146102e957600080fd5b6000602082840312156104ed578081fd5b6104be826104c5565b60008060408385031215610508578081fd5b610511836104c5565b915061051f602084016104c5565b90509250929050565b6000806040838503121561053a578182fd5b610543836104c5565b946020939093013593505050565b600060208284031215610562578081fd5b815180151581146104be578182fd5b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526025908201527f616d6f756e74206d757374206265206c657373207468616e20746f74616c20736040820152647570706c7960d81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b90815260200190565b600082198211156106a9576106a96106c5565b500190565b6000828210156106c0576106c06106c5565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220613dcdcc186ee47e4fcffe0a813b0ac7acffb264273ca54136438b4df350b72464736f6c63430008000033

Deployed Bytecode Sourcemap

86:2362:1:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;695:349;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2034:178;;;;;;:::i;:::-;;:::i;:::-;;2220:82;;;:::i;:::-;;;;;;;:::i;435:108::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;1052:475::-;;;;;;:::i;:::-;;:::i;551:136::-;;;;;;:::i;:::-;;:::i;1539:483::-;;;;;;:::i;:::-;;:::i;695:349::-;781:61;;-1:-1:-1;;;781:61:1;;756:12;;-1:-1:-1;;;;;781:26:1;;;;;:61;;808:10;;828:4;;835:6;;781:61;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;;900:15:1;;;;;;:8;:15;;;;;;;;916:10;900:27;;;;;;;;883:53;;929:6;883:16;:53::i;:::-;-1:-1:-1;;;;;853:15:1;;;;;;:8;:15;;;;;;;;869:10;853:27;;;;;;;:83;;;;986:19;;;:12;:19;;;;;969:45;;1007:6;969:16;:45::i;:::-;-1:-1:-1;;;;;947:19:1;;;;;;:12;:19;;;;;;;;:67;;;;:12;-1:-1:-1;695:349:1;;;;;:::o;2034:178::-;350:6;;-1:-1:-1;;;;;350:6:1;360:10;350:20;342:65;;;;-1:-1:-1;;;342:65:1;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;2111:22:1;::::1;2103:73;;;;-1:-1:-1::0;;;2103:73:1::1;;;;;;;:::i;:::-;2187:6;:17:::0;;-1:-1:-1;;;;;;2187:17:1::1;-1:-1:-1::0;;;;;2187:17:1;;;::::1;::::0;;;::::1;::::0;;2034:178::o;2220:82::-;2261:7;2288:6;-1:-1:-1;;;;;2288:6:1;2220:82;:::o;435:108::-;-1:-1:-1;;;;;516:19:1;;492:4;516:19;;;:12;:19;;;;;;435:108;;;;:::o;1052:475::-;1124:12;350:6;;-1:-1:-1;;;;;350:6:1;360:10;350:20;342:65;;;;-1:-1:-1;;;342:65:1;;;;;;;:::i;:::-;-1:-1:-1;;;;;1167:19:1;::::1;;::::0;;;:12:::1;:19;::::0;;;;;1158:28;::::1;1149:79;;;;-1:-1:-1::0;;;1149:79:1::1;;;;;;;:::i;:::-;1404:6;::::0;1381:38:::1;::::0;-1:-1:-1;;;1381:38:1;;-1:-1:-1;;;;;1381:22:1;;::::1;::::0;::::1;::::0;:38:::1;::::0;1404:6;;::::1;::::0;1412;;1381:38:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;;1469:19:1;::::1;;::::0;;;:12:::1;:19;::::0;;;;;1452:45:::1;::::0;1490:6;1452:16:::1;:45::i;551:136::-:0;-1:-1:-1;;;;;655:15:1;;;623:12;655:15;;;:8;:15;;;;;;;;:24;;;;;;;;;;;;;551:136::o;1539:483::-;-1:-1:-1;;;;;1654:19:1;;1611:12;1654:19;;;:12;:19;;;;;;1645:28;;1636:79;;;;-1:-1:-1;;;1636:79:1;;;;;;;:::i;:::-;1872:42;;-1:-1:-1;;;1872:42:1;;-1:-1:-1;;;;;1872:22:1;;;;;:42;;1895:10;;1907:6;;1872:42;;;:::i;2478:118::-;2534:6;2557:5;2561:1;2557;:5;:::i;:::-;2553:9;;2586:1;2581;:6;;2573:15;;;;;2604:118;2660:6;2692:1;2687;:6;;2679:15;;;;;;2709:5;2713:1;2709;:5;:::i;:::-;2705:9;2604:118;-1:-1:-1;;;2604:118:1:o;14:175:2:-;84:20;;-1:-1:-1;;;;;133:31:2;;123:42;;113:2;;179:1;176;169:12;194:198;;306:2;294:9;285:7;281:23;277:32;274:2;;;327:6;319;312:22;274:2;355:31;376:9;355:31;:::i;397:274::-;;;526:2;514:9;505:7;501:23;497:32;494:2;;;547:6;539;532:22;494:2;575:31;596:9;575:31;:::i;:::-;565:41;;625:40;661:2;650:9;646:18;625:40;:::i;:::-;615:50;;484:187;;;;;:::o;676:266::-;;;805:2;793:9;784:7;780:23;776:32;773:2;;;826:6;818;811:22;773:2;854:31;875:9;854:31;:::i;:::-;844:41;932:2;917:18;;;;904:32;;-1:-1:-1;;;763:179:2:o;947:297::-;;1067:2;1055:9;1046:7;1042:23;1038:32;1035:2;;;1088:6;1080;1073:22;1035:2;1125:9;1119:16;1178:5;1171:13;1164:21;1157:5;1154:32;1144:2;;1205:6;1197;1190:22;1249:203;-1:-1:-1;;;;;1413:32:2;;;;1395:51;;1383:2;1368:18;;1350:102::o;1457:375::-;-1:-1:-1;;;;;1715:15:2;;;1697:34;;1767:15;;;;1762:2;1747:18;;1740:43;1814:2;1799:18;;1792:34;;;;1647:2;1632:18;;1614:218::o;1837:274::-;-1:-1:-1;;;;;2029:32:2;;;;2011:51;;2093:2;2078:18;;2071:34;1999:2;1984:18;;1966:145::o;2116:187::-;2281:14;;2274:22;2256:41;;2244:2;2229:18;;2211:92::o;2308:402::-;2510:2;2492:21;;;2549:2;2529:18;;;2522:30;2588:34;2583:2;2568:18;;2561:62;-1:-1:-1;;;2654:2:2;2639:18;;2632:36;2700:3;2685:19;;2482:228::o;2715:401::-;2917:2;2899:21;;;2956:2;2936:18;;;2929:30;2995:34;2990:2;2975:18;;2968:62;-1:-1:-1;;;3061:2:2;3046:18;;3039:35;3106:3;3091:19;;2889:227::o;3121:356::-;3323:2;3305:21;;;3342:18;;;3335:30;3401:34;3396:2;3381:18;;3374:62;3468:2;3453:18;;3295:182::o;3482:177::-;3628:25;;;3616:2;3601:18;;3583:76::o;3664:128::-;;3735:1;3731:6;3728:1;3725:13;3722:2;;;3741:18;;:::i;:::-;-1:-1:-1;3777:9:2;;3712:80::o;3797:125::-;;3865:1;3862;3859:8;3856:2;;;3870:18;;:::i;:::-;-1:-1:-1;3907:9:2;;3846:76::o;3927:127::-;3988:10;3983:3;3979:20;3976:1;3969:31;4019:4;4016:1;4009:15;4043:4;4040:1;4033:15

Swarm Source

ipfs://613dcdcc186ee47e4fcffe0a813b0ac7acffb264273ca54136438b4df350b724

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.