Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(contracts): Standardize WZETA contract version #127

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions contracts/shared/WZETA.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity ^0.4.18;
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

contract WZETA {
string public name = "Wrapped Zeta";
Expand All @@ -13,29 +14,29 @@ contract WZETA {
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;

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

function deposit() public payable {
balanceOf[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);
payable(msg.sender).transfer(wad);
emit Withdrawal(msg.sender, wad);
}

function totalSupply() public view returns (uint) {
return this.balance;
return address(this).balance;
}

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

Expand All @@ -46,20 +47,20 @@ contract WZETA {
function transferFrom(
address src,
address dst,
uint wad
uint256 wad
) public returns (bool) {
require(balanceOf[src] >= wad);

if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
if (src != msg.sender && allowance[src][msg.sender] != type(uint256).max) {
require(allowance[src][msg.sender] >= wad);
allowance[src][msg.sender] -= wad;
}

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

Transfer(src, dst, wad);
emit Transfer(src, dst, wad);

return true;
}
}
}
1 change: 0 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const config: HardhatUserConfig = {
{ version: "0.8.7" },
{ version: "0.5.10" /** For create2 factory */ },
{ version: "0.5.16" /** For uniswap v2 core*/ },
{ version: "0.4.19" /** For weth*/ },
],
},
};
Expand Down
2 changes: 0 additions & 2 deletions typechain-types/@openzeppelin/contracts/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type * as access from "./access";
export type { access };
import type * as token from "./token";
export type { token };
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
/* eslint-disable */
import type * as interfaces from "./interfaces";
export type { interfaces };
import type * as tools from "./tools";
export type { tools };
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
/* eslint-disable */
import type * as zetaInterfacesSol from "./ZetaInterfaces.sol";
export type { zetaInterfacesSol };
export type { ZetaInteractorErrors } from "./ZetaInteractorErrors";
Loading
Loading