diff --git a/.gitmodules b/.gitmodules index 690924b..506403b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts url = https://github.com/OpenZeppelin/openzeppelin-contracts +[submodule "lib/solmate"] + path = lib/solmate + url = https://github.com/transmissions11/solmate diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index cac10ec..0000000 --- a/.prettierrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "overrides": [ - { - "files": "*.sol", - "options": { - "printWidth": 120, - "tabWidth": 4, - "useTabs": false, - "singleQuote": false, - "bracketSpacing": false, - "explicitTypes": "always" - } - } - ] -} diff --git a/foundry.toml b/foundry.toml index f6b373c..74e382c 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,4 +5,14 @@ evm_version = "paris" # to prevent usage of PUSH0, which is not supported on optimizer = true optimizer_runs = 200 -test = 'src/test' \ No newline at end of file +test = 'src/test' + +[fmt] +bracket_spacing = true +int_types = "long" +line_length = 120 +multiline_func_header = "all" +number_underscore = "thousands" +quote_style = "double" +tab_width = 4 +wrap_comments = true \ No newline at end of file diff --git a/lib/solmate b/lib/solmate new file mode 160000 index 0000000..fadb2e2 --- /dev/null +++ b/lib/solmate @@ -0,0 +1 @@ +Subproject commit fadb2e2778adbf01c80275bfb99e5c14969d964b diff --git a/src/ERC1155A.sol b/src/ERC1155A.sol index fba62ec..a3f2c36 100644 --- a/src/ERC1155A.sol +++ b/src/ERC1155A.sol @@ -1,8 +1,8 @@ /// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.21; -import {IERC1155A} from "./interfaces/IERC1155A.sol"; -import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol"; +import { IERC1155A } from "./interfaces/IERC1155A.sol"; +import { Strings } from "openzeppelin-contracts/contracts/utils/Strings.sol"; /** * @title ERC1155A @@ -37,11 +37,19 @@ abstract contract ERC1155A is IERC1155A { /// @notice Transfer singleApproved id with this function /// @dev If caller is owner of ids, transfer just executes. - /// @dev If caller singleApproved > transferAmount, function executes and reduces allowance (even if setApproveForAll is true) - /// @dev If caller singleApproved < transferAmount && isApprovedForAll, function executes without reducing allowance (full trust assumed) + /// @dev If caller singleApproved > transferAmount, function executes and reduces allowance (even if + /// setApproveForAll is true) + /// @dev If caller singleApproved < transferAmount && isApprovedForAll, function executes without reducing allowance + /// (full trust assumed) /// @dev If caller only approvedForAll, function executes without reducing allowance (full trust assumed) /// @dev SingleApprove is senior in execution flow, but isApprovedForAll is senior in allowance management - function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes calldata data + ) public virtual override @@ -49,7 +57,8 @@ abstract contract ERC1155A is IERC1155A { address operator = msg.sender; uint256 allowed = allowances[from][operator][id]; - /// NOTE: This function order makes it more costly to use isApprovedForAll but cheaper to user single approval and owner transfer + /// NOTE: This function order makes it more costly to use isApprovedForAll but cheaper to user single approval + /// and owner transfer /// @dev operator is an owner of ids if (operator == from) { @@ -80,7 +89,8 @@ abstract contract ERC1155A is IERC1155A { } /// @notice Internal safeTranferFrom function called after all checks from the public function are done - /// @dev Notice `operator` param. It's msg.sender to the safeTransferFrom function. Function is specific to SuperForm singleId approve logic. + /// @dev Notice `operator` param. It's msg.sender to the safeTransferFrom function. Function is specific to + /// SuperForm singleId approve logic. function _safeTransferFrom( address operator, address from, @@ -88,7 +98,10 @@ abstract contract ERC1155A is IERC1155A { uint256 id, uint256 amount, bytes calldata data - ) internal virtual { + ) + internal + virtual + { balanceOf[from][id] -= amount; balanceOf[to][id] += amount; @@ -122,7 +135,11 @@ abstract contract ERC1155A is IERC1155A { uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data - ) public virtual override { + ) + public + virtual + override + { bool singleApproval; uint256 len = ids.length; @@ -168,7 +185,10 @@ abstract contract ERC1155A is IERC1155A { } /// @dev Implementation copied from solmate/ERC1155 - function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) + function balanceOfBatch( + address[] calldata owners, + uint256[] calldata ids + ) public view virtual @@ -241,7 +261,11 @@ abstract contract ERC1155A is IERC1155A { /// @notice Public function for increasing multiple id approval amount at once /// @dev extension of single id increase allowance - function increaseAllowanceForMany(address spender, uint256[] memory ids, uint256[] memory addedValues) + function increaseAllowanceForMany( + address spender, + uint256[] memory ids, + uint256[] memory addedValues + ) public virtual returns (bool) @@ -261,7 +285,11 @@ abstract contract ERC1155A is IERC1155A { /// @notice Public function for decreasing multiple id approval amount at once /// @dev extension of single id decrease allowance - function decreaseAllowanceForMany(address spender, uint256[] memory ids, uint256[] memory subtractedValues) + function decreaseAllowanceForMany( + address spender, + uint256[] memory ids, + uint256[] memory subtractedValues + ) public virtual returns (bool) @@ -283,7 +311,12 @@ abstract contract ERC1155A is IERC1155A { /// @dev Only to be used by address(this) /// @dev Notice `owner` param, only contract functions should be able to define it /// @dev Re-adapted from ERC20 - function _decreaseAllowance(address owner, address spender, uint256 id, uint256 subtractedValue) + function _decreaseAllowance( + address owner, + address spender, + uint256 id, + uint256 subtractedValue + ) internal virtual returns (bool) @@ -366,7 +399,12 @@ abstract contract ERC1155A is IERC1155A { } /// @dev Implementation copied from solmate/ERC1155 - function _batchMint(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) + function _batchMint( + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { @@ -454,7 +492,13 @@ abstract contract ERC1155TokenReceiver { return ERC1155TokenReceiver.onERC1155Received.selector; } - function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) + function onERC1155BatchReceived( + address, + address, + uint256[] calldata, + uint256[] calldata, + bytes calldata + ) external virtual returns (bytes4) diff --git a/src/interfaces/IERC1155A.sol b/src/interfaces/IERC1155A.sol index 0c59a81..e9cbdff 100644 --- a/src/interfaces/IERC1155A.sol +++ b/src/interfaces/IERC1155A.sol @@ -1,7 +1,7 @@ /// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.21; -import {IERC1155} from "openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol"; +import { IERC1155 } from "openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol"; interface IERC1155A is IERC1155 { /*////////////////////////////////////////////////////////////// @@ -41,13 +41,21 @@ interface IERC1155A is IERC1155 { /// @notice Public function for increasing multiple id approval amount at once /// @dev extension of single id increase allowance - function increaseAllowanceForMany(address spender, uint256[] memory ids, uint256[] memory addedValues) + function increaseAllowanceForMany( + address spender, + uint256[] memory ids, + uint256[] memory addedValues + ) external returns (bool); /// @notice Public function for decreasing multiple id approval amount at once /// @dev extension of single id decrease allowance - function decreaseAllowanceForMany(address spender, uint256[] memory ids, uint256[] memory subtractedValues) + function decreaseAllowanceForMany( + address spender, + uint256[] memory ids, + uint256[] memory subtractedValues + ) external returns (bool); diff --git a/src/interfaces/ITransmuter.sol b/src/interfaces/ITransmuter.sol index ae4b41f..b6e8fdf 100644 --- a/src/interfaces/ITransmuter.sol +++ b/src/interfaces/ITransmuter.sol @@ -9,7 +9,12 @@ interface ITransmuter { /// @param name name of the ERC20 to create /// @param symbol symbol of the ERC20 to create /// @param decimals decimals of the ERC20 to create - function registerTransmuter(uint256 id, string memory name, string memory symbol, uint8 decimals) + function registerTransmuter( + uint256 id, + string memory name, + string memory symbol, + uint8 decimals + ) external returns (address); diff --git a/src/test/ERC1155.t.sol b/src/test/ERC1155.t.sol index be4664a..4c95f02 100644 --- a/src/test/ERC1155.t.sol +++ b/src/test/ERC1155.t.sol @@ -1,10 +1,10 @@ /// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.21; -import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol"; -import {DSInvariantTest} from "solmate/test/utils/DSInvariantTest.sol"; -import {ERC1155TokenReceiver} from "solmate/tokens/ERC1155.sol"; -import {MockERC1155A} from "./mocks/MockERC1155A.sol"; +import { DSTestPlus } from "solmate/test/utils/DSTestPlus.sol"; +import { DSInvariantTest } from "solmate/test/utils/DSInvariantTest.sol"; +import { ERC1155TokenReceiver } from "solmate/tokens/ERC1155.sol"; +import { MockERC1155A } from "./mocks/MockERC1155A.sol"; /** * @title ERC1155 Test Suite from Solmate re-adapted for ERC1155A @@ -20,7 +20,13 @@ contract ERC1155Recipient is ERC1155TokenReceiver { uint256 public amount; bytes public mintData; - function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _amount, bytes calldata _data) + function onERC1155Received( + address _operator, + address _from, + uint256 _id, + uint256 _amount, + bytes calldata _data + ) public override returns (bytes4) @@ -54,7 +60,11 @@ contract ERC1155Recipient is ERC1155TokenReceiver { uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data - ) external override returns (bytes4) { + ) + external + override + returns (bytes4) + { batchOperator = _operator; batchFrom = _from; _batchIds = _ids; @@ -66,7 +76,13 @@ contract ERC1155Recipient is ERC1155TokenReceiver { } contract RevertingERC1155Recipient is ERC1155TokenReceiver { - function onERC1155Received(address, address, uint256, uint256, bytes calldata) + function onERC1155Received( + address, + address, + uint256, + uint256, + bytes calldata + ) public pure override @@ -75,7 +91,13 @@ contract RevertingERC1155Recipient is ERC1155TokenReceiver { revert(string(abi.encodePacked(ERC1155TokenReceiver.onERC1155Received.selector))); } - function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) + function onERC1155BatchReceived( + address, + address, + uint256[] calldata, + uint256[] calldata, + bytes calldata + ) external pure override @@ -86,7 +108,13 @@ contract RevertingERC1155Recipient is ERC1155TokenReceiver { } contract WrongReturnDataERC1155Recipient is ERC1155TokenReceiver { - function onERC1155Received(address, address, uint256, uint256, bytes calldata) + function onERC1155Received( + address, + address, + uint256, + uint256, + bytes calldata + ) public pure override @@ -95,7 +123,13 @@ contract WrongReturnDataERC1155Recipient is ERC1155TokenReceiver { return 0xCAFEBEEF; } - function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) + function onERC1155BatchReceived( + address, + address, + uint256[] calldata, + uint256[] calldata, + bytes calldata + ) external pure override @@ -105,7 +139,7 @@ contract WrongReturnDataERC1155Recipient is ERC1155TokenReceiver { } } -contract NonERC1155Recipient {} +contract NonERC1155Recipient { } contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { MockERC1155A token; @@ -859,7 +893,12 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { assertBytesEq(to.mintData(), mintData); } - function testBatchMintToEOA(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory mintData) + function testBatchMintToEOA( + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory mintData + ) public { if (to == address(0)) to = address(0xBEEF); @@ -893,7 +932,11 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { } } - function testBatchMintToERC1155Recipient(uint256[] memory ids, uint256[] memory amounts, bytes memory mintData) + function testBatchMintToERC1155Recipient( + uint256[] memory ids, + uint256[] memory amounts, + bytes memory mintData + ) public { ERC1155Recipient to = new ERC1155Recipient(); @@ -953,7 +996,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory mintAmounts, uint256[] memory burnAmounts, bytes memory mintData - ) public { + ) + public + { if (to == address(0)) to = address(0xBEEF); if (uint256(uint160(to)) <= 18 || to.code.length > 0) return; @@ -1004,7 +1049,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 transferAmount, address to, bytes memory transferData - ) public { + ) + public + { if (to == address(0)) to = address(0xBEEF); if (uint256(uint160(to)) <= 18 || to.code.length > 0) return; @@ -1034,7 +1081,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { bytes memory mintData, uint256 transferAmount, bytes memory transferData - ) public { + ) + public + { ERC1155Recipient to = new ERC1155Recipient(); address from = address(0xABCD); @@ -1064,7 +1113,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 transferAmount, address to, bytes memory transferData - ) public { + ) + public + { if (to == address(0)) to = address(0xBEEF); if (uint256(uint160(to)) <= 18 || to.code.length > 0) return; @@ -1086,7 +1137,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory transferAmounts, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { if (to == address(0)) to = address(0xBEEF); if (uint256(uint160(to)) <= 18 || to.code.length > 0) return; @@ -1136,7 +1189,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory transferAmounts, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { address from = address(0xABCD); ERC1155Recipient to = new ERC1155Recipient(); @@ -1190,7 +1245,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory ids, uint256[] memory amounts, bytes memory mintData - ) public { + ) + public + { uint256 minLength = min3(tos.length, ids.length, amounts.length); address[] memory normalizedTos = new address[](minLength); @@ -1231,7 +1288,11 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { token.mint(address(new RevertingERC1155Recipient()), id, mintAmount, mintData); } - function testFailMintToWrongReturnDataERC155Recipient(uint256 id, uint256 mintAmount, bytes memory mintData) + function testFailMintToWrongReturnDataERC155Recipient( + uint256 id, + uint256 mintAmount, + bytes memory mintData + ) public { token.mint(address(new RevertingERC1155Recipient()), id, mintAmount, mintData); @@ -1243,7 +1304,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 mintAmount, uint256 burnAmount, bytes memory mintData - ) public { + ) + public + { burnAmount = bound(burnAmount, mintAmount + 1, type(uint256).max); token.mint(to, id, mintAmount, mintData); @@ -1257,7 +1320,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 transferAmount, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { address from = address(0xABCD); transferAmount = bound(transferAmount, mintAmount + 1, type(uint256).max); @@ -1277,7 +1342,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 transferAmount, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { transferAmount = bound(transferAmount, mintAmount + 1, type(uint256).max); token.mint(address(this), id, mintAmount, mintData); @@ -1290,7 +1357,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 transferAmount, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { transferAmount = bound(transferAmount, 0, mintAmount); token.mint(address(this), id, mintAmount, mintData); @@ -1303,7 +1372,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 transferAmount, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { transferAmount = bound(transferAmount, 0, mintAmount); token.mint(address(this), id, mintAmount, mintData); @@ -1316,7 +1387,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 transferAmount, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { transferAmount = bound(transferAmount, 0, mintAmount); token.mint(address(this), id, mintAmount, mintData); @@ -1331,7 +1404,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256 transferAmount, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { transferAmount = bound(transferAmount, 0, mintAmount); token.mint(address(this), id, mintAmount, mintData); @@ -1347,7 +1422,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory transferAmounts, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { address from = address(0xABCD); uint256 minLength = min3(ids.length, mintAmounts.length, transferAmounts.length); @@ -1387,7 +1464,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory transferAmounts, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { address from = address(0xABCD); uint256 minLength = min3(ids.length, mintAmounts.length, transferAmounts.length); @@ -1425,7 +1504,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory transferAmounts, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { address from = address(0xABCD); uint256 minLength = min3(ids.length, mintAmounts.length, transferAmounts.length); @@ -1465,7 +1546,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory transferAmounts, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { address from = address(0xABCD); uint256 minLength = min3(ids.length, mintAmounts.length, transferAmounts.length); @@ -1505,7 +1588,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory transferAmounts, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { address from = address(0xABCD); uint256 minLength = min3(ids.length, mintAmounts.length, transferAmounts.length); @@ -1546,7 +1631,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory transferAmounts, bytes memory mintData, bytes memory transferData - ) public { + ) + public + { address from = address(0xABCD); if (ids.length == transferAmounts.length) revert(); @@ -1585,7 +1672,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory ids, uint256[] memory amounts, bytes memory mintData - ) public { + ) + public + { NonERC1155Recipient to = new NonERC1155Recipient(); uint256 minLength = min2(ids.length, amounts.length); @@ -1613,7 +1702,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory ids, uint256[] memory amounts, bytes memory mintData - ) public { + ) + public + { RevertingERC1155Recipient to = new RevertingERC1155Recipient(); uint256 minLength = min2(ids.length, amounts.length); @@ -1641,7 +1732,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory ids, uint256[] memory amounts, bytes memory mintData - ) public { + ) + public + { WrongReturnDataERC1155Recipient to = new WrongReturnDataERC1155Recipient(); uint256 minLength = min2(ids.length, amounts.length); @@ -1670,7 +1763,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory ids, uint256[] memory amounts, bytes memory mintData - ) public { + ) + public + { if (ids.length == amounts.length) revert(); token.batchMint(address(to), ids, amounts, mintData); @@ -1682,7 +1777,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory mintAmounts, uint256[] memory burnAmounts, bytes memory mintData - ) public { + ) + public + { uint256 minLength = min3(ids.length, mintAmounts.length, burnAmounts.length); if (minLength == 0) revert(); @@ -1714,7 +1811,9 @@ contract ERC1155Test is DSTestPlus, ERC1155TokenReceiver { uint256[] memory mintAmounts, uint256[] memory burnAmounts, bytes memory mintData - ) public { + ) + public + { if (ids.length == burnAmounts.length) revert(); token.batchMint(to, ids, mintAmounts, mintData); diff --git a/src/test/ERC1155_A.t.sol b/src/test/ERC1155_A.t.sol index de45cba..4828a77 100644 --- a/src/test/ERC1155_A.t.sol +++ b/src/test/ERC1155_A.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.21; import "forge-std/Test.sol"; -import {MockERC1155A} from "./mocks/MockERC1155A.sol"; +import { MockERC1155A } from "./mocks/MockERC1155A.sol"; contract ERC1155ATest is Test { MockERC1155A public SuperShares; @@ -54,7 +54,8 @@ contract ERC1155ATest is Test { SuperShares.setApprovalForAll(bob, true); /// @dev Set also approval for one, but smaller than (allowed >= amount) check /// @dev We want transfer to execute using mass approval - /// @dev If we allow amount bigger than requested for transfer, safeTransferFrom will execute on single allowance + /// @dev If we allow amount bigger than requested for transfer, safeTransferFrom will execute on single + /// allowance SuperShares.setApprovalForOne(bob, 1, allowSingle); uint256 bobAllowance = SuperShares.allowance(alice, bob, 1); assertEq(bobAllowance, allowSingle); diff --git a/src/test/Transmuter.t.sol b/src/test/Transmuter.t.sol index 6c170af..e5b8673 100644 --- a/src/test/Transmuter.t.sol +++ b/src/test/Transmuter.t.sol @@ -2,10 +2,10 @@ pragma solidity 0.8.21; import "forge-std/Test.sol"; -import {MockTransmuter} from "./mocks/MockTransmuter.sol"; -import {MockERC1155A} from "./mocks/MockERC1155A.sol"; -import {ERC20} from "solmate/tokens/ERC20.sol"; -import {sERC20} from "../transmuter/sERC20.sol"; +import { MockTransmuter } from "./mocks/MockTransmuter.sol"; +import { MockERC1155A } from "./mocks/MockERC1155A.sol"; +import { ERC20 } from "solmate/tokens/ERC20.sol"; +import { sERC20 } from "../transmuter/sERC20.sol"; contract TransmuterTest is Test { uint256 public constant THOUSAND_E18 = 1000 ether; diff --git a/src/test/mocks/MockERC1155A.sol b/src/test/mocks/MockERC1155A.sol index 820eaac..36c07c9 100644 --- a/src/test/mocks/MockERC1155A.sol +++ b/src/test/mocks/MockERC1155A.sol @@ -1,8 +1,8 @@ /// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.21; -import {ERC1155A} from "../../ERC1155A.sol"; -import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol"; +import { ERC1155A } from "../../ERC1155A.sol"; +import { Strings } from "openzeppelin-contracts/contracts/utils/Strings.sol"; /// @notice For test purpouses we open mint()/burn() functions of ERC1155A contract MockERC1155A is ERC1155A { diff --git a/src/test/mocks/MockTransmuter.sol b/src/test/mocks/MockTransmuter.sol index 66ec03d..ff96beb 100644 --- a/src/test/mocks/MockTransmuter.sol +++ b/src/test/mocks/MockTransmuter.sol @@ -1,9 +1,9 @@ /// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.21; -import {IERC1155A} from "../../interfaces/IERC1155A.sol"; -import {Transmuter} from "../../transmuter/Transmuter.sol"; -import {sERC20} from "../../transmuter/sERC20.sol"; +import { IERC1155A } from "../../interfaces/IERC1155A.sol"; +import { Transmuter } from "../../transmuter/Transmuter.sol"; +import { sERC20 } from "../../transmuter/sERC20.sol"; /// @notice For test purpouses we open mint()/burn() functions of ERC1155s contract MockTransmuter is Transmuter { @@ -15,7 +15,12 @@ contract MockTransmuter is Transmuter { deployer = deployer_; } - function registerTransmuter(uint256 id, string memory name, string memory symbol, uint8 decimals) + function registerTransmuter( + uint256 id, + string memory name, + string memory symbol, + uint8 decimals + ) external override returns (address) diff --git a/src/transmuter/Transmuter.sol b/src/transmuter/Transmuter.sol index a130d2d..f79f9bb 100644 --- a/src/transmuter/Transmuter.sol +++ b/src/transmuter/Transmuter.sol @@ -1,9 +1,9 @@ /// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.21; -import {IERC1155A} from "../interfaces/IERC1155A.sol"; -import {sERC20} from "./sERC20.sol"; -import {ITransmuter} from "../interfaces/ITransmuter.sol"; +import { IERC1155A } from "../interfaces/IERC1155A.sol"; +import { sERC20 } from "./sERC20.sol"; +import { ITransmuter } from "../interfaces/ITransmuter.sol"; /// @title Transmuter /// @author Zeropoint Labs. @@ -24,7 +24,12 @@ abstract contract Transmuter is ITransmuter { } /// @inheritdoc ITransmuter - function registerTransmuter(uint256 id, string memory name, string memory symbol, uint8 decimals) + function registerTransmuter( + uint256 id, + string memory name, + string memory symbol, + uint8 decimals + ) external virtual override @@ -95,7 +100,13 @@ abstract contract Transmuter is ITransmuter { ERC1155 HOOKS //////////////////////////////////////////////////////////////*/ - function onERC1155Received(address operator, address from, uint256 id, uint256 value, bytes calldata data) + function onERC1155Received( + address operator, + address from, + uint256 id, + uint256 value, + bytes calldata data + ) external pure returns (bytes4) @@ -109,7 +120,11 @@ abstract contract Transmuter is ITransmuter { uint256[] calldata ids, uint256[] calldata values, bytes calldata data - ) external pure returns (bytes4) { + ) + external + pure + returns (bytes4) + { return this.onERC1155BatchReceived.selector; } } diff --git a/src/transmuter/sERC20.sol b/src/transmuter/sERC20.sol index cf5ff5c..2b50e20 100644 --- a/src/transmuter/sERC20.sol +++ b/src/transmuter/sERC20.sol @@ -1,7 +1,7 @@ /// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.21; -import {ERC20} from "solmate/tokens/ERC20.sol"; +import { ERC20 } from "solmate/tokens/ERC20.sol"; /// @title sERC20 /// @author Zeropoint Labs.