Cargando el resto de esta comparación.

WETH / wMNT

Creado El diff nunca expira
63 eliminaciones
519 líneas
55 adiciones
509 líneas
/**
// SPDX-License-Identifier: MIT
*Submitted for verification at Etherscan.io on 2017-12-12
*/

// Copyright (C) 2015, 2016, 2017 Dapphub


// This program is free software: you can redistribute it and/or modify
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// (at your option) any later version.


// This program is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU General Public License for more details.


// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// along with this program. If not, see <http://www.gnu.org/licenses/>.


pragma solidity ^0.4.18;
pragma solidity ^0.8.9;


contract WETH9 {
import { ERC20 } from "openzeppelin-contracts/token/ERC20/ERC20.sol";
string public name = "Wrapped Ether";
string public symbol = "WETH";
uint8 public decimals = 18;


event Approval(address indexed src, address indexed guy, uint wad);
contract WMANTLE is ERC20 {
event Transfer(address indexed src, address indexed dst, uint wad);
constructor() ERC20("Wrapped Mantle", "WMNT") {}
event Deposit(address indexed dst, uint wad);
event Deposit(address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint wad);
event Withdrawal(address indexed src, uint256 wad);


mapping (address => uint) public balanceOf;
fallback() external payable {
mapping (address => mapping (address => uint)) public allowance;
deposit();
}


function() public payable {
receive() external payable {
deposit();
deposit();
}
}

/// @dev mint tokens for sender based on amount of mantle sent.
function deposit() public payable {
function deposit() public payable {
balanceOf[msg.sender] += msg.value;
_mint(msg.sender, msg.value);
Deposit(msg.sender, msg.value);
emit Deposit(msg.sender, msg.value);
}
function withdraw(uint wad) public {
require(balanceOf[msg.sender] >= wad);
balanceOf[msg.sender] -= wad;
msg.sender.transfer(wad);
Withdrawal(msg.sender, wad);
}
}


function totalSupply() public view returns (uint) {
/// @dev withdraw mantle based on requested amount and user balance.
return this.balance;
function withdraw(uint256 _amount) external {
require(balanceOf(msg.sender) >= _amount, "insufficient balance.");
_burn(msg.sender, _amount);
payable(msg.sender).transfer(_amount);
emit Withdrawal(msg.sender, _amount);
}
}

function approve(address guy, uint wad) public returns (bool) {
allowance[msg.sender][guy] = wad;
Approval(msg.sender, guy, wad);
return true;
}
}


function transfer(address dst, uint wad) public returns (bool) {
contract WMANTLEDeployer {
return transferFrom(msg.sender, dst, wad);
function deploy() public returns(address addr) {
bytes32 salt = keccak256(abi.encodePacked("WMANTLE"));

WMANTLE w = new WMANTLE{salt: salt}();
return address(w);
}
}


function transferFrom(address src, address dst, uint wad)
function calculateAddr() public view returns(address predictedAddress){
public
bytes32 salt = keccak256(abi.encodePacked("WMANTLE"));
returns (bool)
predictedAddress = address(uint160(uint(keccak256(abi.encodePacked(
{
bytes1(0xff),
require(balanceOf[src] >= wad);
address(this),

salt,
if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
keccak256(type(WMANTLE).creationCode)
require(allowance[src][msg.sender] >= wad);
)))));
allowance[src][msg.sender] -= wad;
}

balanceOf[src] -= wad;
balanceOf[dst] += wad;

Transfer(src, dst, wad);

return true;
}
}
}
}




/*
/*
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Version 3, 29 June 2007


Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
of this license document, but changing it is not allowed.


Preamble
Preamble


The GNU General Public License is a free, copyleft license for
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
software and other kinds of works.


The licenses for most software and other practical works are designed
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
any other work released this way by its authors. You can apply it to
your programs, too.
your programs, too.


When we speak of free software, we are referring to freedom, not
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
free programs, and that you know you can do these things.


To protect your rights, we need to prevent others from denying you
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
you modify it: responsibilities to respect the freedom of others.


For example, if you distribute copies of such a program, whether
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
or can get the source code. And you must show them these terms so they
know their rights.
know their rights.


Developers that use the GNU GPL protect your rights with two steps:
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
giving you legal permission to copy, distribute and/or modify it.


For the developers' and authors' protection, the GPL clearly explains
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
authors of previous versions.


Some devices are designed to deny users access to install or run
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
use, which is precisely where it is most unacceptable. Therefore, we