Skip to content

Commit

Permalink
slither checks
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Oct 12, 2023
1 parent f82b23c commit f0a7e29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions contracts/token-registrars/CanonicalTokenRegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ contract CanonicalTokenRegistrar is ICanonicalTokenRegistrar, ITokenManagerType,
tokenId = service.getCustomTokenId(address(this), getCanonicalTokenSalt(tokenAddress));
}

function registerCanonicalToken(address tokenAddress) external payable {
function registerCanonicalToken(address tokenAddress) external payable returns (bytes32 tokenId) {
bytes memory params = abi.encode('', tokenAddress);
bytes32 salt = getCanonicalTokenSalt(tokenAddress);
service.deployCustomTokenManager(salt, TokenManagerType.LOCK_UNLOCK, params);
tokenId = service.deployCustomTokenManager(salt, TokenManagerType.LOCK_UNLOCK, params);
}

function deployAndRegisterRemoteCanonicalToken(bytes32 salt, string calldata destinationChain, uint256 gasValue) external payable {
Expand All @@ -45,6 +45,8 @@ contract CanonicalTokenRegistrar is ICanonicalTokenRegistrar, ITokenManagerType,
string memory tokenName = token.name();
string memory tokenSymbol = token.symbol();
uint8 tokenDecimals = token.decimals();

// slither-disable-next-line arbitrary-send-eth
service.deployAndRegisterRemoteStandardizedToken{ value: gasValue }(
salt,
tokenName,
Expand Down
8 changes: 6 additions & 2 deletions contracts/token-registrars/StandardizedTokenRegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

pragma solidity ^0.8.0;

import { SafeTokenTransfer } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeTransfer.sol';

import { IInterchainTokenService } from '../interfaces/IInterchainTokenService.sol';
import { IStandardizedTokenRegistrar } from '../interfaces/IStandardizedTokenRegistrar.sol';
import { ITokenManagerType } from '../interfaces/ITokenManagerType.sol';
Expand All @@ -15,6 +17,7 @@ import { AddressBytesUtils } from '../libraries/AddressBytesUtils.sol';
contract StandardizedTokenRegistrar is IStandardizedTokenRegistrar, ITokenManagerType, Multicall {
using AddressBytesUtils for bytes;
using AddressBytesUtils for address;
using SafeTokenTransfer for IStandardizedToken;

IInterchainTokenService public immutable service;
string public chainName;
Expand Down Expand Up @@ -66,7 +69,7 @@ contract StandardizedTokenRegistrar is IStandardizedTokenRegistrar, ITokenManage
tokenManager.transferOperatorship(sender);

IStandardizedToken token = IStandardizedToken(service.getStandardizedTokenAddress(tokenId));
token.transfer(sender, mintAmount);
token.safeTransfer(sender, mintAmount);
}

function deployRemoteStandarizedToken(
Expand All @@ -78,7 +81,7 @@ contract StandardizedTokenRegistrar is IStandardizedTokenRegistrar, ITokenManage
string memory tokenName;
string memory tokenSymbol;
uint8 tokenDecimals;
bytes memory distributor;
bytes memory distributor = '';
bytes memory operator;

{
Expand Down Expand Up @@ -118,6 +121,7 @@ contract StandardizedTokenRegistrar is IStandardizedTokenRegistrar, ITokenManage
string memory destinationChain,
uint256 gasValue
) internal {
// slither-disable-next-line arbitrary-send-eth
service.deployAndRegisterRemoteStandardizedToken{ value: gasValue }(
salt,
tokenName,
Expand Down

0 comments on commit f0a7e29

Please sign in to comment.