Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Updated uint cast to not truncate #5

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/tokenbridge/ethereum/ICustomToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
pragma solidity >=0.6.9 <0.9.0;

interface ArbitrumEnabledToken {
/// @notice should return `0xa4b1` if token is enabled for arbitrum gateways
/// @notice should return `0xb1` if token is enabled for arbitrum gateways
function isArbitrumEnabled() external view returns (uint8);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenbridge/ethereum/gateway/L1CustomGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ contract L1CustomGateway is L1ArbitrumExtendedGateway, ICustomGateway {
address _creditBackAddress
) public payable returns (uint256) {
require(
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xa4b1),
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xb1),
"NOT_ARB_ENABLED"
);

Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ contract L1GatewayRouter is
address _creditBackAddress
) public payable override returns (uint256) {
require(
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xa4b1),
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xb1),
"NOT_ARB_ENABLED"
);
require(_gateway.isContract(), "NOT_TO_CONTRACT");
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenbridge/test/TestCustomTokenL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract TestCustomTokenL1 is aeERC20, ICustomToken {
/// @dev we only set shouldRegisterGateway to true when in `registerTokenOnL2`
function isArbitrumEnabled() external view override returns (uint8) {
require(shouldRegisterGateway, "NOT_EXPECTED_CALL");
return uint8(0xa4b1);
return uint8(0xb1);
}

function registerTokenOnL2(
Expand Down