Solidity Developer Take-Home Challenge
Your task is to create and test an Ethereum smart contract that represents a simple auction for an NFT (Non-fungible token). The smart contract should include the following features:
The contract owner should be able to initiate an auction by setting the NFT up for auction, setting a minimum bid amount, and specifying the auction end time.
Any Ethereum address should be able to place a bid on the NFT, provided that the bid is greater than the current highest bid and the auction has not yet ended.
After the auction end time has passed, the contract owner should be able to close the auction. The NFT should then be transferred to the highest bidder, and the funds sent to the contract owner.
Write the contract in Solidity, using Solidity version 0.8.4 or above.
Write unit tests for your contract using a framework like Truffle or Hardhat. The tests should cover all the major functionalities of the contract.
Provide a detailed guide on how to deploy the smart contract on both a local Ethereum blockchain (such as Ganache) and a test network like Rinkeby or Ropsten.
To get started with this project, you'll need to follow these steps:
Clone this repository to your local machine:
git clone https://github.com/xhulz/NFTAuction.git
Navigate to the project directory:
cd NFTAuction
Rename the .env.example to .env.
mv .env.example .env
Install the required dependencies:
npm install
Compile the project:
npm run compile
To run the tests for this project, you can use the following command:
npm run test
To deploy locally, you can use the following command:
npm run deploy:local
To deploy on the Sepolia network, you should follow the steps below:
- Change the .env file with data for the keys below:
INFURA_API_KEY = your_infura_key
SEPOLIA_PRIVATE_KEY = your_private_key
- Run the command for deployment:
npm run deploy:sepolia
To verify on the Sepolia network, you should follow the steps below:
- Change the .env file and add your new contract address
CONTRACT = your_contract
- Run the command for verification:
npm run verify:sepolia
Solhint is a static analysis tool designed specifically for Solidity contracts. It allows you to identify and address potential issues and bad practices in your Solidity code, helping to enhance the quality and security of your codebase. Solhint operates based on configurable linting rules, which are applied to your code to ensure it complies with development best practices.
npm run lint
Slither is a static analysis tool for Solidity smart contracts. It helps you identify potential vulnerabilities, security flaws, and issues in your Ethereum smart contracts by analyzing the source code. Running Slither on your project can provide valuable insights into potential vulnerabilities and help you write more secure smart contracts.
npm run slither
This project is licensed under the [License Name](License URL) - see the LICENSE.md file for more details.
- xhulz - [email protected]