Compare commits

..

No commits in common. "31aa432ed7d46c0c6cec1c7d0354176955172c7c" and "f3e292bec26a2962275c755dcac267a66695031d" have entirely different histories.

3 changed files with 2 additions and 34 deletions

View File

@ -6,14 +6,13 @@ import "./IMastersFedi.sol";
import "./Address.sol"; import "./Address.sol";
import "./IERC1155Metadata.sol"; import "./IERC1155Metadata.sol";
import "./ERC1155Metadata.sol"; import "./ERC1155Metadata.sol";
import "./IERC223ReceivingContract.sol";
import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Base64.sol"; import "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol";
contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, ERC2981, IERC223ReceivingContract, Ownable, Pausable { contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, ERC2981, Ownable, Pausable {
using Address for address; using Address for address;
mapping (uint256 => address) public contracts; mapping (uint256 => address) public contracts;
@ -140,24 +139,6 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
destroyable = false; destroyable = false;
} }
/**
@dev called by token 1 contract after transfer, this is the only method to wrap 1.
*/
function tokenFallback(address _from, uint256 _value, bytes memory) override external {
require(_from == owner(), "Only owner can wrap token 1");
require(msg.sender == contracts[1] , "Can only transfer from token 1 owner");
IMastersFedi curio = IMastersFedi(contracts[1]);
require (curio.balanceOf(address(this)) <= 450, "Sanity transfer exceeded");
// no balance check is done because an overflow would fail the sanity check anyway
balances[1][_from] += _value;
// mint
emit TransferSingle(msg.sender, address(0), _from, 1, _value);
// safe transfer acceptance check not necessary because locked to a known contract
}
/** /**
@notice Converts old-style NFT to new-style @notice Converts old-style NFT to new-style
@dev For an NFT ID, queries and transfers tokens from the appropriate @dev For an NFT ID, queries and transfers tokens from the appropriate
@ -169,7 +150,6 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
function wrap(uint256 _id, uint256 _quantity) external whenNotPaused { function wrap(uint256 _id, uint256 _quantity) external whenNotPaused {
address tokenContract = contracts[_id]; address tokenContract = contracts[_id];
require(tokenContract != address(0), "invalid id"); require(tokenContract != address(0), "invalid id");
require(_id != 1, "cannot wrap token 1 this way");
IMastersFedi curio = IMastersFedi(tokenContract); IMastersFedi curio = IMastersFedi(tokenContract);
// these are here for convenience because curio contract doesn't throw meaningful exceptions // these are here for convenience because curio contract doesn't throw meaningful exceptions
@ -206,7 +186,6 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
address tokenContract = contracts[_id]; address tokenContract = contracts[_id];
require(tokenContract != address(0), "invalid id"); require(tokenContract != address(0), "invalid id");
require(_id != 1, "cannot wrap token 1 this way");
IMastersFedi curio = IMastersFedi(tokenContract); IMastersFedi curio = IMastersFedi(tokenContract);
require(curio.balanceOf(msg.sender) >= _quantity, "insufficient curio balance"); require(curio.balanceOf(msg.sender) >= _quantity, "insufficient curio balance");
@ -235,7 +214,6 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
function unwrap(uint256 _id, uint256 _quantity) external whenNotPaused { function unwrap(uint256 _id, uint256 _quantity) external whenNotPaused {
address tokenContract = contracts[_id]; address tokenContract = contracts[_id];
require(tokenContract != address(0), "invalid id"); require(tokenContract != address(0), "invalid id");
require(_id != 1, "token 1 cannot be unwrapped");
IMastersFedi curio = IMastersFedi(tokenContract); IMastersFedi curio = IMastersFedi(tokenContract);
require(balances[_id][msg.sender] >= _quantity, "insufficient balance"); require(balances[_id][msg.sender] >= _quantity, "insufficient balance");
@ -263,7 +241,6 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
address tokenContract = contracts[_id]; address tokenContract = contracts[_id];
require(tokenContract != address(0), "invalid id"); require(tokenContract != address(0), "invalid id");
require(_id != 1, "token 1 cannot be unwrapped");
IMastersFedi curio = IMastersFedi(tokenContract); IMastersFedi curio = IMastersFedi(tokenContract);
require(balances[_id][msg.sender] >= _quantity, "insufficient balance"); require(balances[_id][msg.sender] >= _quantity, "insufficient balance");

View File

@ -1,6 +0,0 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.17;
interface IERC223ReceivingContract {
function tokenFallback(address _from, uint256 _value, bytes memory _data) external;
}

View File

@ -80,10 +80,7 @@ module.exports = {
// settings: { // See the solidity docs for advice about optimization and evmVersion // settings: { // See the solidity docs for advice about optimization and evmVersion
optimizer: { optimizer: {
enabled: true, enabled: true,
runs: 1 runs: 200
},
debug: {
revertStrings: "strip"
} }
} }
} }