diff --git a/src/Auction.sol b/src/Auction.sol index 9ecb41c..73d5c11 100644 --- a/src/Auction.sol +++ b/src/Auction.sol @@ -5,7 +5,6 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; - contract Auction is Ownable, Initializable { event Start(); event Bid(address indexed sender, uint256 amount); @@ -14,7 +13,9 @@ contract Auction is Ownable, Initializable { event BidBufferUpdated(uint256 newBidIncrement); event BiddingLocked(); event BiddingUnlocked(); - event FundsWithdrawn(address indexed owner, uint256 usdcAmount, uint256 kwentaAmount); + event FundsWithdrawn( + address indexed owner, uint256 usdcAmount, uint256 kwentaAmount + ); error AuctionAlreadyStarted(); error AuctionNotStarted(); @@ -40,7 +41,13 @@ contract Auction is Ownable, Initializable { uint256 public highestBid; mapping(address => uint256) public bids; - constructor(address initialOwner, address _usdc, address _kwenta, uint256 _startingBid, uint256 _bidBuffer) Ownable(initialOwner) { + constructor( + address initialOwner, + address _usdc, + address _kwenta, + uint256 _startingBid, + uint256 _bidBuffer + ) Ownable(initialOwner) { usdc = IERC20(_usdc); kwenta = IERC20(_kwenta); @@ -49,10 +56,10 @@ contract Auction is Ownable, Initializable { } function initialize( - address initialOwner, - address _usdc, - address _kwenta, - uint256 _startingBid, + address initialOwner, + address _usdc, + address _kwenta, + uint256 _startingBid, uint256 _bidBuffer ) public initializer { _transferOwnership(initialOwner); @@ -64,7 +71,7 @@ contract Auction is Ownable, Initializable { bidBuffer = _bidBuffer; } - function start(uint256 _auctionAmount) external onlyOwner{ + function start(uint256 _auctionAmount) external onlyOwner { if (started) revert AuctionAlreadyStarted(); usdc.transferFrom(msg.sender, address(this), _auctionAmount); @@ -79,7 +86,9 @@ contract Auction is Ownable, Initializable { function bid(uint256 amount) external Lock { if (!started) revert AuctionNotStarted(); if (block.timestamp >= endAt) revert AuctionAlreadyEnded(); - if (amount <= highestBid + bidBuffer) revert BidTooLow(highestBid + bidBuffer); + if (amount <= highestBid + bidBuffer) { + revert BidTooLow(highestBid + bidBuffer); + } kwenta.transferFrom(msg.sender, address(this), amount); diff --git a/src/AuctionFactory.sol b/src/AuctionFactory.sol index f603b70..1a1b246 100644 --- a/src/AuctionFactory.sol +++ b/src/AuctionFactory.sol @@ -1,15 +1,19 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.25; -import { Auction } from './Auction.sol'; +import {Auction} from "./Auction.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; - contract AuctionFactory { address public auctionImplementation; address[] public auctions; - event AuctionCreated(address auctionContract, address owner, uint numAuctions, address[] allAuctions); + event AuctionCreated( + address auctionContract, + address owner, + uint256 numAuctions, + address[] allAuctions + ); constructor(address _auctionImplementation) { auctionImplementation = _auctionImplementation; @@ -23,11 +27,16 @@ contract AuctionFactory { uint256 _bidBuffer ) external { address clone = Clones.clone(auctionImplementation); - Auction(clone).initialize(_pDAO, _usdc, _kwenta, _startingBid, _bidBuffer); - Auction newAuction = new Auction(_pDAO, _usdc, _kwenta, _startingBid, _bidBuffer); + Auction(clone).initialize( + _pDAO, _usdc, _kwenta, _startingBid, _bidBuffer + ); + Auction newAuction = + new Auction(_pDAO, _usdc, _kwenta, _startingBid, _bidBuffer); auctions.push(address(newAuction)); - emit AuctionCreated(address(newAuction), msg.sender, auctions.length, auctions); + emit AuctionCreated( + address(newAuction), msg.sender, auctions.length, auctions + ); } function getAllAuctions() external view returns (address[] memory) {