Skip to content

Commit

Permalink
chore: use string.concat for string combination instead
Browse files Browse the repository at this point in the history
  • Loading branch information
huyhuynh3103 committed Jan 2, 2024
1 parent 1af4175 commit 0e00588
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
12 changes: 5 additions & 7 deletions src/legacy/transfers/RONTransferHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ library RONTransferHelper {

if (!success) {
revert(
string(
abi.encodePacked(
"TransferHelper: could not transfer RON to ",
Strings.toHexString(uint160(address(to)), 20),
" value ",
Strings.toHexString(value)
)
string.concat(
"TransferHelper: could not transfer RON to ",
Strings.toHexString(uint160(address(to)), 20),
" value ",
Strings.toHexString(value)
)
);
}
Expand Down
20 changes: 9 additions & 11 deletions src/legacy/transfers/TransferFromHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ library TransferFromHelper {

if (!success || !(data.length == 0 || abi.decode(data, (bool)))) {
revert(
string(
abi.encodePacked(
"TransferFromHelper: could not transfer token ",
Strings.toHexString(uint160(token), 20),
" from ",
Strings.toHexString(uint160(from), 20),
" to ",
Strings.toHexString(uint160(to), 20),
" value ",
Strings.toHexString(value)
)
string.concat(
"TransferFromHelper: could not transfer token ",
Strings.toHexString(uint160(token), 20),
" from ",
Strings.toHexString(uint160(from), 20),
" to ",
Strings.toHexString(uint160(to), 20),
" value ",
Strings.toHexString(value)
)
);
}
Expand Down
16 changes: 7 additions & 9 deletions src/legacy/transfers/TransferHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ library TransferHelper {

if (!success || !(data.length == 0 || abi.decode(data, (bool)))) {
revert(
string(
abi.encodePacked(
"TransferHelper: could not transfer token ",
Strings.toHexString(uint160(token), 20),
" to ",
Strings.toHexString(uint160(to), 20),
" value ",
Strings.toHexString(value)
)
string.concat(
"TransferHelper: could not transfer token ",
Strings.toHexString(uint160(token), 20),
" to ",
Strings.toHexString(uint160(to), 20),
" value ",
Strings.toHexString(value)
)
);
}
Expand Down

0 comments on commit 0e00588

Please sign in to comment.