-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ abstract contract UniversalNFT is | |
address public immutable uniswapRouter; | ||
uint256 private _nextTokenId; | ||
bool public isUniversal = true; | ||
Check warning Code scanning / Slither State variables that could be declared constant Warning
UniversalNFT.isUniversal should be constant
|
||
uint256 public immutable gasLimit; | ||
uint256 public immutable gasLimitAmount; | ||
|
||
error TransferFailed(); | ||
error Unauthorized(); | ||
|
@@ -50,7 +50,7 @@ abstract contract UniversalNFT is | |
if (gas == 0) revert InvalidGasLimit(); | ||
gateway = GatewayZEVM(gatewayAddress); | ||
uniswapRouter = uniswapRouterAddress; | ||
gasLimit = gas; | ||
gasLimitAmount = gas; | ||
} | ||
|
||
function setConnected( | ||
|
@@ -71,7 +71,7 @@ abstract contract UniversalNFT is | |
_burn(tokenId); | ||
|
||
(, uint256 gasFee) = IZRC20(destination).withdrawGasFeeWithGasLimit( | ||
gasLimit | ||
gasLimitAmount | ||
); | ||
if ( | ||
!IZRC20(destination).transferFrom(msg.sender, address(this), gasFee) | ||
|
@@ -85,14 +85,14 @@ abstract contract UniversalNFT is | |
msg.sender | ||
); | ||
|
||
CallOptions memory callOptions = CallOptions(gasLimit, false); | ||
CallOptions memory callOptions = CallOptions(gasLimitAmount, false); | ||
|
||
RevertOptions memory revertOptions = RevertOptions( | ||
address(this), | ||
true, | ||
address(0), | ||
abi.encode(tokenId, uri, msg.sender), | ||
gasLimit | ||
gasLimitAmount | ||
); | ||
|
||
gateway.call( | ||
|
@@ -141,7 +141,7 @@ abstract contract UniversalNFT is | |
emit TokenTransferReceived(receiver, tokenId, uri); | ||
} else { | ||
(, uint256 gasFee) = IZRC20(destination).withdrawGasFeeWithGasLimit( | ||
gasLimit | ||
gasLimitAmount | ||
); | ||
|
||
uint256 out = SwapHelperLib.swapExactTokensForTokens( | ||
|
@@ -158,7 +158,7 @@ abstract contract UniversalNFT is | |
out - gasFee, | ||
destination, | ||
abi.encode(receiver, tokenId, uri, out - gasFee, sender), | ||
CallOptions(gasLimit, false), | ||
CallOptions(gasLimitAmount, false), | ||
RevertOptions( | ||
address(this), | ||
true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ abstract contract UniversalToken is | |
address public immutable uniswapRouter; | ||
uint256 private _nextTokenId; | ||
bool public isUniversal = true; | ||
Check warning Code scanning / Slither State variables that could be declared constant Warning
UniversalToken.isUniversal should be constant
|
||
uint256 public immutable gasLimit; | ||
uint256 public immutable gasLimitAmount; | ||
|
||
error TransferFailed(); | ||
error Unauthorized(); | ||
|
@@ -45,7 +45,7 @@ abstract contract UniversalToken is | |
if (gas == 0) revert InvalidGasLimit(); | ||
gateway = GatewayZEVM(gatewayAddress); | ||
uniswapRouter = uniswapRouterAddress; | ||
gasLimit = gas; | ||
gasLimitAmount = gas; | ||
} | ||
|
||
function setConnected( | ||
|
@@ -65,22 +65,22 @@ abstract contract UniversalToken is | |
_burn(msg.sender, amount); | ||
|
||
(, uint256 gasFee) = IZRC20(destination).withdrawGasFeeWithGasLimit( | ||
gasLimit | ||
gasLimitAmount | ||
); | ||
if ( | ||
!IZRC20(destination).transferFrom(msg.sender, address(this), gasFee) | ||
) revert TransferFailed(); | ||
IZRC20(destination).approve(address(gateway), gasFee); | ||
bytes memory message = abi.encode(receiver, amount, 0, msg.sender); | ||
|
||
CallOptions memory callOptions = CallOptions(gasLimit, false); | ||
CallOptions memory callOptions = CallOptions(gasLimitAmount, false); | ||
|
||
RevertOptions memory revertOptions = RevertOptions( | ||
address(this), | ||
true, | ||
address(0), | ||
abi.encode(amount, msg.sender), | ||
gasLimit | ||
gasLimitAmount | ||
); | ||
|
||
gateway.call( | ||
|
@@ -114,7 +114,7 @@ abstract contract UniversalToken is | |
_mint(receiver, tokenAmount); | ||
} else { | ||
(, uint256 gasFee) = IZRC20(destination).withdrawGasFeeWithGasLimit( | ||
gasLimit | ||
gasLimitAmount | ||
); | ||
uint256 out = SwapHelperLib.swapExactTokensForTokens( | ||
uniswapRouter, | ||
|
@@ -129,7 +129,7 @@ abstract contract UniversalToken is | |
out - gasFee, | ||
destination, | ||
abi.encode(receiver, tokenAmount, out - gasFee, sender), | ||
CallOptions(gasLimit, false), | ||
CallOptions(gasLimitAmount, false), | ||
RevertOptions( | ||
address(this), | ||
true, | ||
|