Skip to content

Commit

Permalink
Merge pull request #19 from superform-xyz/downsize-solc
Browse files Browse the repository at this point in the history
chore: change version
  • Loading branch information
0xTimepunk authored Sep 21, 2023
2 parents 2974a1c + df2ef53 commit fa7acc1
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 255 deletions.
3 changes: 1 addition & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[profile.default]
libs = ['lib']
solc_version = "0.8.21" # Override for the solc version (setting this ignores `auto_detect_solc`)
evm_version = "paris" # to prevent usage of PUSH0, which is not supported on all chains
solc_version = "0.8.19"

optimizer = true
optimizer_runs = 200
Expand Down
64 changes: 12 additions & 52 deletions src/ERC1155A.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.21;
pragma solidity ^0.8.19;

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
Expand Down Expand Up @@ -43,13 +43,7 @@ abstract contract ERC1155A is IERC1155A {
/// (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
Expand Down Expand Up @@ -98,10 +92,7 @@ abstract contract ERC1155A is IERC1155A {
uint256 id,
uint256 amount,
bytes calldata data
)
internal
virtual
{
) internal virtual {
balanceOf[from][id] -= amount;
balanceOf[to][id] += amount;

Expand Down Expand Up @@ -135,11 +126,7 @@ 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;

Expand Down Expand Up @@ -185,10 +172,7 @@ 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
Expand Down Expand Up @@ -261,11 +245,7 @@ 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)
Expand All @@ -285,11 +265,7 @@ 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)
Expand All @@ -311,12 +287,7 @@ 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)
Expand Down Expand Up @@ -399,12 +370,7 @@ 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
{
Expand Down Expand Up @@ -492,13 +458,7 @@ 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)
Expand Down
16 changes: 4 additions & 12 deletions src/interfaces/IERC1155A.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.21;
pragma solidity ^0.8.19;

import { IERC1155 } from "openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol";
import {IERC1155} from "openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol";

interface IERC1155A is IERC1155 {
/*//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -41,21 +41,13 @@ 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);

Expand Down
9 changes: 2 additions & 7 deletions src/interfaces/ITransmuter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.21;
pragma solidity ^0.8.19;

interface ITransmuter {
/// @notice id given here needs to be the same as id on Source!
Expand All @@ -9,12 +9,7 @@ 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);

Expand Down
Loading

0 comments on commit fa7acc1

Please sign in to comment.