@@ -5,7 +5,7 @@ import "@openzeppelin/contracts/utils/Strings.sol";
55
66/// @notice Modern, minimalist, and gas efficient ERC-721 implementation.
77/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
8- contract ERC721 {
8+ contract CatapultNFT {
99 using Strings for uint256 ;
1010 /*//////////////////////////////////////////////////////////////
1111 EVENTS
@@ -29,9 +29,9 @@ contract ERC721 {
2929
3030 uint256 public tokenId;
3131
32- // function tokenURI(uint256 id) public view virtual returns (string memory){
33- // return tokenURI(id);
34- // };
32+ // function tokenURI(uint256 id) public view virtual returns (string memory){
33+ // return tokenURI(id);
34+ // };
3535
3636 /*//////////////////////////////////////////////////////////////
3737 ERC721 BALANCE/OWNER STORAGE
@@ -88,18 +88,13 @@ contract ERC721 {
8888 emit ApprovalForAll (msg .sender , operator, approved);
8989 }
9090
91- function transferFrom(
92- address from,
93- address to,
94- uint256 id
95- ) public virtual {
91+ function transferFrom (address from , address to , uint256 id ) public virtual {
9692 require (from == _ownerOf[id], "WRONG_FROM " );
9793
9894 require (to != address (0 ), "INVALID_RECIPIENT " );
9995
10096 require (
101- msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id],
102- "NOT_AUTHORIZED"
97+ msg .sender == from || isApprovedForAll[from][msg .sender ] || msg .sender == getApproved[id], "NOT_AUTHORIZED "
10398 );
10499
105100 // Underflow of the sender's balance is impossible because we check for
@@ -117,38 +112,29 @@ contract ERC721 {
117112 emit Transfer (from, to, id);
118113 }
119114
120- function safeTransferFrom(
121- address from,
122- address to,
123- uint256 id
124- ) public virtual {
115+ function safeTransferFrom (address from , address to , uint256 id ) public virtual {
125116 transferFrom (from, to, id);
126117
127118 require (
128- to.code.length == 0 ||
129- ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") ==
130- ERC721TokenReceiver.onERC721Received.selector,
119+ to.code.length == 0
120+ || ERC721TokenReceiver (to).onERC721Received (msg .sender , from, id, "" )
121+ == ERC721TokenReceiver .onERC721Received.selector ,
131122 "UNSAFE_RECIPIENT "
132123 );
133124 }
134125
135- function safeTransferFrom(
136- address from,
137- address to,
138- uint256 id,
139- bytes calldata data
140- ) public virtual {
126+ function safeTransferFrom (address from , address to , uint256 id , bytes calldata data ) public virtual {
141127 transferFrom (from, to, id);
142128
143129 require (
144- to.code.length == 0 ||
145- ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) ==
146- ERC721TokenReceiver.onERC721Received.selector,
130+ to.code.length == 0
131+ || ERC721TokenReceiver (to).onERC721Received (msg .sender , from, id, data)
132+ == ERC721TokenReceiver .onERC721Received.selector ,
147133 "UNSAFE_RECIPIENT "
148134 );
149135 }
150136
151- function tokenURI(uint256 id) public view virtual returns (string memory) {
137+ function tokenURI (uint256 id ) public view virtual returns (string memory ) {
152138 return string (abi.encodePacked (baseURI, "/ " , Strings.toString (id), ".json " ));
153139 }
154140
@@ -157,10 +143,9 @@ contract ERC721 {
157143 //////////////////////////////////////////////////////////////*/
158144
159145 function supportsInterface (bytes4 interfaceId ) public view virtual returns (bool ) {
160- return
161- interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
162- interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721
163- interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata
146+ return interfaceId == 0x01ffc9a7 // ERC165 Interface ID for ERC165
147+ || interfaceId == 0x80ac58cd // ERC165 Interface ID for ERC721
148+ || interfaceId == 0x5b5e139f ; // ERC165 Interface ID for ERC721Metadata
164149 }
165150
166151 /*//////////////////////////////////////////////////////////////
@@ -209,24 +194,20 @@ contract ERC721 {
209194 _mint (to, id);
210195
211196 require (
212- to.code.length == 0 ||
213- ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") ==
214- ERC721TokenReceiver.onERC721Received.selector,
197+ to.code.length == 0
198+ || ERC721TokenReceiver (to).onERC721Received (msg .sender , address (0 ), id, "" )
199+ == ERC721TokenReceiver .onERC721Received.selector ,
215200 "UNSAFE_RECIPIENT "
216201 );
217202 }
218203
219- function _safeMint(
220- address to,
221- uint256 id,
222- bytes memory data
223- ) internal virtual {
204+ function _safeMint (address to , uint256 id , bytes memory data ) internal virtual {
224205 _mint (to, id);
225206
226207 require (
227- to.code.length == 0 ||
228- ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) ==
229- ERC721TokenReceiver.onERC721Received.selector,
208+ to.code.length == 0
209+ || ERC721TokenReceiver (to).onERC721Received (msg .sender , address (0 ), id, data)
210+ == ERC721TokenReceiver .onERC721Received.selector ,
230211 "UNSAFE_RECIPIENT "
231212 );
232213 }
@@ -235,12 +216,7 @@ contract ERC721 {
235216/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
236217/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
237218abstract contract ERC721TokenReceiver {
238- function onERC721Received(
239- address,
240- address,
241- uint256,
242- bytes calldata
243- ) external virtual returns (bytes4) {
219+ function onERC721Received (address , address , uint256 , bytes calldata ) external virtual returns (bytes4 ) {
244220 return ERC721TokenReceiver .onERC721Received.selector ;
245221 }
246222}
0 commit comments