Skip to content

Commit

Permalink
Use library; less assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
duncancmt committed Jan 11, 2024
1 parent f4a244b commit 9695016
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/deployer/Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {AddressDerivation} from "../utils/AddressDerivation.sol";
import {IPFS} from "../utils/IPFS.sol";
import {ItoA} from "../utils/ItoA.sol";
import {IFeeCollector} from "../core/IFeeCollector.sol";
import {Revert} from "../utils/Revert.sol";

library UnsafeArray {
function unsafeGet(bytes[] calldata datas, uint256 i) internal pure returns (bytes calldata data) {
Expand Down Expand Up @@ -238,11 +239,7 @@ contract Deployer is TwoStepOwnable, IERC721ViewMetadata {
unchecked {
for (uint256 i; i < datas.length; i++) {
(bool success, bytes memory reason) = address(this).delegatecall(datas.unsafeGet(i));
if (!success) {
assembly ("memory-safe") {
revert(add(reason, 0x20), mload(reason))
}
}
Revert.maybeRevert(success, reason);
assembly ("memory-safe") {
mstore(0x40, freeMemPtr)
}
Expand Down

0 comments on commit 9695016

Please sign in to comment.