Skip to content

Commit

Permalink
feat: Add IWETH9 with solidity 0.8 to protocol-contracts (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresaiello authored Sep 8, 2023
1 parent 2addfdb commit b2ae423
Show file tree
Hide file tree
Showing 13 changed files with 1,738 additions and 12 deletions.
25 changes: 25 additions & 0 deletions contracts/zevm/interfaces/IWZETA.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

interface IWETH9 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
event Deposit(address indexed dst, uint wad);
event Withdrawal(address indexed src, uint wad);

function totalSupply() external view returns (uint);

function balanceOf(address owner) external view returns (uint);

function allowance(address owner, address spender) external view returns (uint);

function approve(address spender, uint wad) external returns (bool);

function transfer(address to, uint wad) external returns (bool);

function transferFrom(address from, address to, uint wad) external returns (bool);

function deposit() external payable;

function withdraw(uint wad) external;
}
2 changes: 1 addition & 1 deletion lib/address.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const MissingZetaNetworkError = new Error(
export const ProtocolNetworkNetworkNameMap: Record<ZetaProtocolNetwork, NetworkName> = {
baobab_testnet: "klaytn-baobab",
bsc_testnet: "bsc-testnet",
etherum_mainnet: "eth-mainnet",
ethereum_mainnet: "eth-mainnet",
goerli_testnet: "goerli",
mumbai_testnet: "polygon-mumbai",
zeta_testnet: "athens",
Expand Down
4 changes: 2 additions & 2 deletions lib/address.tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export declare type NonZetaAddress = "uniswapV2Router02" | "uniswapV3Factory" |

export const nonZetaAddress: NonZetaAddress[] = ["uniswapV2Router02", "uniswapV3Router", "uniswapV3Factory", "weth9"];

export declare type ZetaProtocolMainNetwork = "etherum_mainnet";
export const zetaProtocolMainNetworks: ZetaProtocolMainNetwork[] = ["etherum_mainnet"];
export declare type ZetaProtocolMainNetwork = "ethereum_mainnet";
export const zetaProtocolMainNetworks: ZetaProtocolMainNetwork[] = ["ethereum_mainnet"];

export declare type ZetaProtocolNetwork = ZetaProtocolMainNetwork | ZetaProtocolTestNetwork;
export const zetaProtocolNetworks: ZetaProtocolNetwork[] = [...zetaProtocolTestNetworks, ...zetaProtocolMainNetworks];
Expand Down
977 changes: 977 additions & 0 deletions pkg/contracts/zevm/interfaces/iwzeta.sol/iweth9.go

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions test/ZetaTokenConsumer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ describe("ZetaTokenConsumer tests", () => {
*/
const createPoolV3 = async (signer: SignerWithAddress, tokenAddress: string) => {
const DAI = getExternalAddress("dai", {
customNetworkName: "etherum_mainnet",
customNetworkName: "ethereum_mainnet",
customZetaNetwork: "mainnet",
});

const UNI_NFT_MANAGER_V3 = getExternalAddress("uniswapV3NftManager", {
customNetworkName: "etherum_mainnet",
customNetworkName: "ethereum_mainnet",
customZetaNetwork: "mainnet",
});

const USDC = getExternalAddress("usdc", {
customNetworkName: "etherum_mainnet",
customNetworkName: "ethereum_mainnet",
customZetaNetwork: "mainnet",
});

Expand Down Expand Up @@ -124,22 +124,22 @@ describe("ZetaTokenConsumer tests", () => {
});

const DAI = getExternalAddress("dai", {
customNetworkName: "etherum_mainnet",
customNetworkName: "ethereum_mainnet",
customZetaNetwork: "mainnet",
});

USDCAddr = getExternalAddress("usdc", {
customNetworkName: "etherum_mainnet",
customNetworkName: "ethereum_mainnet",
customZetaNetwork: "mainnet",
});

uniswapV2RouterAddr = getNonZetaAddress("uniswapV2Router02", "etherum_mainnet");
uniswapV2RouterAddr = getNonZetaAddress("uniswapV2Router02", "ethereum_mainnet");

const UNI_FACTORY_V3 = getNonZetaAddress("uniswapV3Factory", "etherum_mainnet");
const UNI_FACTORY_V3 = getNonZetaAddress("uniswapV3Factory", "ethereum_mainnet");

const UNI_ROUTER_V3 = getNonZetaAddress("uniswapV3Router", "etherum_mainnet");
const UNI_ROUTER_V3 = getNonZetaAddress("uniswapV3Router", "ethereum_mainnet");

const WETH9 = getNonZetaAddress("weth9", "etherum_mainnet");
const WETH9 = getNonZetaAddress("weth9", "ethereum_mainnet");

// For testing purposes we use an existing uni v3 pool
await swapToken(tssUpdater, DAI, parseEther("10000"));
Expand Down
Loading

0 comments on commit b2ae423

Please sign in to comment.