-
Notifications
You must be signed in to change notification settings - Fork 47
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
2 changed files
with
17 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ contract Connected is | |
error InvalidAddress(); | ||
error Unauthorized(); | ||
error InvalidGasLimit(); | ||
error GasTokenTransferFailed(); | ||
|
||
function setCounterparty(address contractAddress) external onlyOwner { | ||
if (contractAddress == address(0)) revert InvalidAddress(); | ||
|
@@ -104,13 +105,19 @@ contract Connected is | |
) external payable onlyGateway returns (bytes4) { | ||
if (context.sender != counterparty) revert Unauthorized(); | ||
|
||
(address receiver, uint256 tokenId, string memory uri) = abi.decode( | ||
message, | ||
(address, uint256, string) | ||
); | ||
( | ||
address receiver, | ||
Check notice Code scanning / Slither Missing zero address validation Low
Connected.onCall(MessageContext,bytes).receiver lacks a zero-check on :
- (success,None) = receiver.call{value: amount}() |
||
uint256 tokenId, | ||
string memory uri, | ||
uint256 amount | ||
) = abi.decode(message, (address, uint256, string, uint256)); | ||
|
||
_safeMint(receiver, tokenId); | ||
_setTokenURI(tokenId, uri); | ||
if (amount > 0) { | ||
(bool success, ) = receiver.call{value: amount}(""); | ||
if (!success) revert GasTokenTransferFailed(); | ||
} | ||
emit TokenTransferReceived(receiver, tokenId, uri); | ||
return ""; | ||
} | ||
|
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