Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Jul 19, 2024
1 parent 6c50fae commit 1cc8ad5
Show file tree
Hide file tree
Showing 25 changed files with 800 additions and 585 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "./ZetaConnectorNewBase.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract ZetaConnectorNewEth is ZetaConnectorNewBase {
contract ZetaConnectorNative is ZetaConnectorNewBase {
using SafeERC20 for IERC20;

constructor(address _gateway, address _zetaToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "./ZetaConnectorNewBase.sol";
import "./IZetaNonEthNew.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";

contract ZetaConnectorNewNonEth is ZetaConnectorNewBase {
contract ZetaConnectorNonNative is ZetaConnectorNewBase {
constructor(address _gateway, address _zetaToken)
ZetaConnectorNewBase(_gateway, _zetaToken)
{}
Expand Down
8 changes: 7 additions & 1 deletion contracts/prototypes/zevm/GatewayZEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import "../../zevm/interfaces/IWZETA.sol";
// The GatewayZEVM contract is the endpoint to call smart contracts on omnichain
// The contract doesn't hold any funds and should never have active allowances
contract GatewayZEVM is IGatewayZEVMEvents, IGatewayZEVMErrors, Initializable, OwnableUpgradeable, UUPSUpgradeable, ReentrancyGuard {
error ZeroAddress();

address public constant FUNGIBLE_MODULE_ADDRESS = 0x735b14BB79463307AAcBED86DAf3322B1e6226aB;
address public zetaToken;

Expand All @@ -23,6 +25,10 @@ contract GatewayZEVM is IGatewayZEVMEvents, IGatewayZEVMErrors, Initializable, O
}

function initialize(address _zetaToken) public initializer {

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

Parameter GatewayZEVM.initialize(address)._zetaToken is not in mixedCase
if (_zetaToken == address(0)) {
revert ZeroAddress();
}

__Ownable_init();
__UUPSUpgradeable_init();
zetaToken = _zetaToken;
Expand All @@ -46,7 +52,7 @@ contract GatewayZEVM is IGatewayZEVMEvents, IGatewayZEVMErrors, Initializable, O
}

function _transferZETA(uint256 amount, address to) internal {
if (!IWETH9(zetaToken).transferFrom(msg.sender, address(this), amount)) revert ZetaTokenTransferFailed();
if (!IWETH9(zetaToken).transferFrom(msg.sender, address(this), amount)) revert FailedZetaSent();
IWETH9(zetaToken).withdraw(amount);
(bool sent, ) = to.call{value: amount}("");
if (!sent) revert FailedZetaSent();
Expand Down
1 change: 0 additions & 1 deletion contracts/prototypes/zevm/IGatewayZEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ interface IGatewayZEVMErrors {
error GasFeeTransferFailed();
error CallerIsNotFungibleModule();
error InvalidTarget();
error ZetaTokenTransferFailed();
error FailedZetaSent();
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/contracts/prototypes/zevm/gatewayzevm.sol/gatewayzevm.go

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/contracts/prototypes/zevm/senderzevm.sol/senderzevm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/prototypes/GatewayEVMUniswap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("Uniswap Integration with GatewayEVM", function () {
// Deploy contracts
const Gateway = await ethers.getContractFactory("GatewayEVM");
const ERC20CustodyNew = await ethers.getContractFactory("ERC20CustodyNew");
const ZetaConnector = await ethers.getContractFactory("ZetaConnectorNewNonEth");
const ZetaConnector = await ethers.getContractFactory("ZetaConnectorNonNative");
const zeta = await TestERC20.deploy("Zeta", "ZETA");
gateway = (await upgrades.deployProxy(Gateway, [tssAddress.address, zeta.address], {
initializer: "initialize",
Expand Down
10 changes: 5 additions & 5 deletions testFoundry/GatewayEVM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "forge-std/Vm.sol";
import "contracts/prototypes/evm/GatewayEVM.sol";
import "contracts/prototypes/evm/ReceiverEVM.sol";
import "contracts/prototypes/evm/ERC20CustodyNew.sol";
import "contracts/prototypes/evm/ZetaConnectorNewNonEth.sol";
import "contracts/prototypes/evm/ZetaConnectorNonNative.sol";
import "contracts/prototypes/evm/TestERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand All @@ -23,7 +23,7 @@ contract GatewayEVMTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IReceiver
GatewayEVM gateway;
ReceiverEVM receiver;
ERC20CustodyNew custody;
ZetaConnectorNewNonEth zetaConnector;
ZetaConnectorNonNative zetaConnector;
TestERC20 token;
TestERC20 zeta;
address owner;
Expand All @@ -47,7 +47,7 @@ contract GatewayEVMTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IReceiver
));
gateway = GatewayEVM(proxy);
custody = new ERC20CustodyNew(address(gateway));
zetaConnector = new ZetaConnectorNewNonEth(address(gateway), address(zeta));
zetaConnector = new ZetaConnectorNonNative(address(gateway), address(zeta));
receiver = new ReceiverEVM();

gateway.setCustody(address(custody));
Expand Down Expand Up @@ -181,7 +181,7 @@ contract GatewayEVMInboundTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IR

GatewayEVM gateway;
ERC20CustodyNew custody;
ZetaConnectorNewNonEth zetaConnector;
ZetaConnectorNonNative zetaConnector;
TestERC20 token;
TestERC20 zeta;
address owner;
Expand All @@ -203,7 +203,7 @@ contract GatewayEVMInboundTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IR
));
gateway = GatewayEVM(proxy);
custody = new ERC20CustodyNew(address(gateway));
zetaConnector = new ZetaConnectorNewNonEth(address(gateway), address(zeta));
zetaConnector = new ZetaConnectorNonNative(address(gateway), address(zeta));

gateway.setCustody(address(custody));
gateway.setConnector(address(zetaConnector));
Expand Down
Loading

0 comments on commit 1cc8ad5

Please sign in to comment.