Contract 0xD8fDAAF19CF20D4c672Edd9587660144EE67bc07

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x7604743e495f6a8fae9d0f4f9ba006270ab04a8d3cb5ff683f1c7ad8fadd4b080x60806040168750832021-07-15 5:06:51192 days 16 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  Create: WrapLogic0 MATIC0.0001795210171.0000001
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WrapLogic

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 3 : 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);
}

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

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

abstract contract IWETH is IERC20 {
	function deposit() external payable virtual;

	function withdraw(uint256 amount) external virtual;
}

File 3 of 3 : WrapLogic.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../interfaces/IWETH.sol";

contract WrapLogic {
	IWETH internal constant wMatic =
		IWETH(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);

	function wrap(uint256 amount) external payable {
		uint256 realAmt = amount == type(uint256).max
			? address(this).balance
			: amount;
		wMatic.deposit{value: realAmt}();
	}

	function unwrap(uint256 amount) external {
		uint256 realAmt = amount == type(uint256).max
			? wMatic.balanceOf(address(this))
			: amount;
		wMatic.withdraw(realAmt);
	}
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unwrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"wrap","outputs":[],"stateMutability":"payable","type":"function"}]

608060405234801561001057600080fd5b50610249806100206000396000f3fe6080604052600436106100295760003560e01c8063de0e9a3e1461002e578063ea598cb014610050575b600080fd5b34801561003a57600080fd5b5061004e6100493660046101e3565b610063565b005b61004e61005e3660046101e3565b610162565b6000600019821461007457816100f6565b6040516370a0823160e01b8152306004820152730d500b1d8e8ef31e21c99d1db9a6444d3adf1270906370a082319060240160206040518083038186803b1580156100be57600080fd5b505afa1580156100d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f691906101fb565b604051632e1a7d4d60e01b815260048101829052909150730d500b1d8e8ef31e21c99d1db9a6444d3adf127090632e1a7d4d90602401600060405180830381600087803b15801561014657600080fd5b505af115801561015a573d6000803e3d6000fd5b505050505050565b600060001982146101735781610175565b475b9050730d500b1d8e8ef31e21c99d1db9a6444d3adf12706001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101c657600080fd5b505af11580156101da573d6000803e3d6000fd5b50505050505050565b6000602082840312156101f4578081fd5b5035919050565b60006020828403121561020c578081fd5b505191905056fea2646970667358221220d5226632d3ad5097793de3acbaad468462ccd69e28637b9e21dbf7415d1209e864736f6c63430008040033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.