Closed fadeev closed 6 months ago
OnlySystem modifier which can be imported into contracts and used like so:
OnlySystem
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "@zetachain/protocol-contracts/contracts/zevm/SystemContract.sol"; import "@zetachain/protocol-contracts/contracts/zevm/interfaces/zContract.sol"; import "@zetachain/toolkit/contracts/SwapHelperLib.sol"; import "@zetachain/toolkit/contracts/BytesHelperLib.sol"; import "@zetachain/toolkit/contracts/OnlySystem.sol"; contract Swap is zContract, OnlySystem { SystemContract public systemContract; constructor(address systemContractAddress) { systemContract = SystemContract(systemContractAddress); } function onCrossChainCall( zContext calldata context, address zrc20, uint256 amount, bytes calldata message ) external virtual override onlySystem(address(systemContract)) { //... }
@andresaiello please, review and lmk if this is the right way to ship a modifier. Thanks!
OnlySystem
modifier which can be imported into contracts and used like so: