Skip to content

Commit

Permalink
Cleanup trailing whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDaub committed Jul 9, 2022
1 parent c340b8d commit 1dcd2ca
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 39 deletions.
17 changes: 8 additions & 9 deletions assets/eip-4907/contracts/ERC4907.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./IERC4907.sol";

contract ERC4907 is ERC721, IERC4907 {
struct UserInfo
struct UserInfo
{
address user; // address of user role
uint64 expires; // unix timestamp, user expires
Expand All @@ -15,11 +15,11 @@ contract ERC4907 is ERC721, IERC4907 {

constructor(string memory name_, string memory symbol_)
ERC721(name_,symbol_)
{
{
}

/// @notice set the user and expires of a NFT
/// @dev The zero address indicates there is no user
/// @dev The zero address indicates there is no user
/// Throws if `tokenId` is not valid NFT
/// @param user The new user of the NFT
/// @param expires UNIX timestamp, The new user could use the NFT before expires
Expand All @@ -37,15 +37,15 @@ contract ERC4907 is ERC721, IERC4907 {
/// @return The user address for this NFT
function userOf(uint256 tokenId)public view virtual returns(address){
if( uint256(_users[tokenId].expires) >= block.timestamp){
return _users[tokenId].user;
return _users[tokenId].user;
}
else{
return address(0);
}
}

/// @notice Get the user expires of an NFT
/// @dev The zero value indicates that there is no user
/// @dev The zero value indicates that there is no user
/// @param tokenId The NFT to get the user expires for
/// @return The user expires for this NFT
function userExpires(uint256 tokenId) public view virtual returns(uint256){
Expand All @@ -69,5 +69,4 @@ contract ERC4907 is ERC721, IERC4907 {
emit UpdateUser(tokenId, address(0), 0);
}
}
}

}
6 changes: 3 additions & 3 deletions assets/eip-4907/contracts/ERC4907Demo.sol
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.0;

import "./ERC4907.sol";

contract ERC4907Demo is ERC4907 {

constructor(string memory name_, string memory symbol_)
ERC4907(name_,symbol_)
{
{
}

function mint(uint256 tokenId, address to) public {
_mint(to, tokenId);
}

}
}

4 changes: 2 additions & 2 deletions assets/eip-4907/contracts/IERC4907.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface IERC4907 {
event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires);

/// @notice set the user and expires of a NFT
/// @dev The zero address indicates there is no user
/// @dev The zero address indicates there is no user
/// Throws if `tokenId` is not valid NFT
/// @param user The new user of the NFT
/// @param expires UNIX timestamp, The new user could use the NFT before expires
Expand All @@ -22,7 +22,7 @@ interface IERC4907 {
function userOf(uint256 tokenId) external view returns(address);

/// @notice Get the user expires of an NFT
/// @dev The zero value indicates that there is no user
/// @dev The zero value indicates that there is no user
/// @param tokenId The NFT to get the user expires for
/// @return The user expires for this NFT
function userExpires(uint256 tokenId) external view returns(uint256);
Expand Down
3 changes: 1 addition & 2 deletions assets/eip-4907/migrations/1_initial_migration.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const ERC4907Demo = artifacts.require("ERC4907Demo");

module.exports = function (deployer) {
deployer.deploy(ERC4907Demo,'ERC4907Demo','ERC4907Demo');
deployer.deploy(ERC4907Demo, "ERC4907Demo", "ERC4907Demo");
};

47 changes: 24 additions & 23 deletions assets/eip-4907/truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,31 @@ module.exports = {
// Configure your compilers
compilers: {
solc: {
version: "0.8.10", // Fetch exact version from solc-bin (default: truffle's version)
version: "0.8.10", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
settings: { // See the solidity docs for advice about optimization and evmVersion
optimizer: {
enabled: false,
runs: 200
}
// ,
// evmVersion: "byzantium"
// }
}
},
settings: {
// See the solidity docs for advice about optimization and evmVersion
optimizer: {
enabled: false,
runs: 200,
},
// ,
// evmVersion: "byzantium"
// }
},
},

// Truffle DB is currently disabled by default; to enable it, change enabled:
// false to enabled: true. The default storage location can also be
// overridden by specifying the adapter settings, as shown in the commented code below.
//
// NOTE: It is not possible to migrate your contracts to truffle DB and you should
// make a backup of your artifacts to a safe location before enabling this feature.
//
// After you backed up your artifacts you can utilize db by running migrate as follows:
// $ truffle migrate --reset --compile-all
//
// db: {
// Truffle DB is currently disabled by default; to enable it, change enabled:
// false to enabled: true. The default storage location can also be
// overridden by specifying the adapter settings, as shown in the commented code below.
//
// NOTE: It is not possible to migrate your contracts to truffle DB and you should
// make a backup of your artifacts to a safe location before enabling this feature.
//
// After you backed up your artifacts you can utilize db by running migrate as follows:
// $ truffle migrate --reset --compile-all
//
// db: {
// enabled: false,
// host: "127.0.0.1",
// adapter: {
Expand All @@ -113,5 +114,5 @@ module.exports = {
// directory: ".db"
// }
// }
}
},
};

0 comments on commit 1dcd2ca

Please sign in to comment.