Răsfoiți Sursa

chore: restructure for monorepo

Hendrik Hofstadt 5 ani în urmă
părinte
comite
d4fab1190c

+ 0 - 17
contracts/WrappedSPL.sol

@@ -1,17 +0,0 @@
-// contracts/Wormhole.sol
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.6.0;
-pragma experimental ABIEncoderV2;
-
-import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
-
-contract WrappedSPLToken is ERC20 {
-    constructor(address[] memory _guardians) public {
-        require(_guardians.length > 0, "no guardians specified");
-
-        for (uint i = 0; i < _guardians.length; i++) {
-            guardians.add(_guardians[i]);
-        }
-    }
-}

+ 0 - 0
.openzeppelin/project.json → ethereum/.openzeppelin/project.json


+ 0 - 0
contracts/.gitkeep → ethereum/contracts/.gitkeep


+ 12 - 8
contracts/Wormhole.sol → ethereum/contracts/Wormhole.sol

@@ -58,10 +58,6 @@ contract Wormhole {
         }
     }
 
-    function() public payable  {
-        revert("please use lockETH to transfer ETH to Solana");
-    }
-
     function changeGuardianAdmin(address newAddress) public {
         require(guardians.contains(msg.sender), "sender is not a guardian");
 
@@ -175,6 +171,7 @@ contract Wormhole {
     ) public {
         require(amount != 0, "amount must not be 0");
 
+        // TODO handle tokens that subtract fees
         IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);
         emit LogTokensLocked(asset, recipient, amount);
     }
@@ -184,14 +181,21 @@ contract Wormhole {
     ) public payable {
         require(msg.value != 0, "amount must not be 0");
 
-        WETH(WETHAddress).deposit(msg.value);
+        // Wrap tx value in WETH
+        WETH(WETHAddress).deposit{value : msg.value}();
+
+        // Log deposit of WETH
         emit LogTokensLocked(WETHAddress, recipient, msg.value);
     }
+
+
+    fallback() external payable {revert("please use lockETH to transfer ETH to Solana");}
+    receive() external payable {revert("please use lockETH to transfer ETH to Solana");}
 }
 
 
-contract WETH is IERC20 {
-    function deposit() public payable {}
+interface WETH is IERC20 {
+    function deposit() external payable;
 
-    function withdraw(uint256 amount) public {}
+    function withdraw(uint256 amount) external;
 }

+ 0 - 0
networks.js → ethereum/networks.js


+ 0 - 0
package-lock.json → ethereum/package-lock.json


+ 1 - 0
package.json → ethereum/package.json

@@ -9,6 +9,7 @@
     "@openzeppelin/contracts": "^3.1.0"
   },
   "scripts": {
+    "build": "openzeppelin compile",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "author": "",