Skip to content

Commit

Permalink
chore: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
fp-crypto committed Apr 23, 2024
1 parent 29c54b1 commit bcab073
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 78 deletions.
73 changes: 30 additions & 43 deletions src/Bases/Auctioneer/BaseAuctioneer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
// Set variables
wantInfo = TokenInfo({
tokenAddress: _want,
scaler: uint96(WAD / 10**decimals)
scaler: uint96(WAD / 10 ** decimals)
});

auctionLength = _auctionLength;
Expand Down Expand Up @@ -152,7 +152,9 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
* @return _kicked The timestamp of the last kick.
* @return _available The current available amount for the auction.
*/
function auctionInfo(bytes32 _auctionId)
function auctionInfo(
bytes32 _auctionId
)
public
view
virtual
Expand Down Expand Up @@ -181,12 +183,9 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
* @param _auctionId The unique identifier of the auction.
* @return uint256 The amount that can be kicked into the auction.
*/
function kickable(bytes32 _auctionId)
public
view
virtual
returns (uint256)
{
function kickable(
bytes32 _auctionId
) public view virtual returns (uint256) {
// If not enough time has passed then `kickable` is 0.
if (
auctions[_auctionId].kicked + uint256(auctionCooldown) >
Expand All @@ -204,12 +203,10 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
* @param _amountToTake The amount of `from` to take in the auction.
* @return . The amount of `want` needed to fulfill the take amount.
*/
function getAmountNeeded(bytes32 _auctionId, uint256 _amountToTake)
external
view
virtual
returns (uint256)
{
function getAmountNeeded(
bytes32 _auctionId,
uint256 _amountToTake
) external view virtual returns (uint256) {
return
_getAmountNeeded(
auctions[_auctionId],
Expand Down Expand Up @@ -272,12 +269,10 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
* @param _timestamp The specific timestamp for calculating the price.
* @return . The price of the auction.
*/
function price(bytes32 _auctionId, uint256 _timestamp)
public
view
virtual
returns (uint256)
{
function price(
bytes32 _auctionId,
uint256 _timestamp
) public view virtual returns (uint256) {
// Get unscaled price and scale it down.
return
_price(
Expand Down Expand Up @@ -328,12 +323,9 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
* @param _from The address of the token to be auctioned.
* @return _auctionId The unique identifier of the enabled auction.
*/
function enableAuction(address _from)
public
virtual
onlyManagement
returns (bytes32 _auctionId)
{
function enableAuction(
address _from
) public virtual onlyManagement returns (bytes32 _auctionId) {
address _want = want();
require(_from != address(0) && _from != _want, "ZERO ADDRESS");
// Cannot have more than 18 decimals.
Expand All @@ -351,7 +343,7 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
// Store all needed info.
auctions[_auctionId].fromInfo = TokenInfo({
tokenAddress: _from,
scaler: uint96(WAD / 10**decimals)
scaler: uint96(WAD / 10 ** decimals)
});

// Add to the array.
Expand All @@ -375,11 +367,10 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
* @param _from The address of the token being sold.
* @param _index The index the auctionId is at in the array.
*/
function disableAuction(address _from, uint256 _index)
public
virtual
onlyEmergencyAuthorized
{
function disableAuction(
address _from,
uint256 _index
) public virtual onlyEmergencyAuthorized {
bytes32 _auctionId = getAuctionId(_from);

// Make sure the auction was enabled.
Expand Down Expand Up @@ -427,12 +418,9 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
* @param _auctionId The unique identifier of the auction.
* @return available The available amount for bidding on in the auction.
*/
function kick(bytes32 _auctionId)
external
virtual
nonReentrant
returns (uint256 available)
{
function kick(
bytes32 _auctionId
) external virtual nonReentrant returns (uint256 available) {
address _fromToken = auctions[_auctionId].fromInfo.tokenAddress;
require(_fromToken != address(0), "not enabled");
require(
Expand Down Expand Up @@ -470,11 +458,10 @@ abstract contract BaseAuctioneer is BaseHealthCheck, ReentrancyGuard {
* @param _maxAmount The maximum amount of fromToken to take in the auction.
* @return . The amount of fromToken taken in the auction.
*/
function take(bytes32 _auctionId, uint256 _maxAmount)
external
virtual
returns (uint256)
{
function take(
bytes32 _auctionId,
uint256 _maxAmount
) external virtual returns (uint256) {
return _take(_auctionId, _maxAmount, msg.sender, new bytes(0));
}

Expand Down
31 changes: 18 additions & 13 deletions src/Bases/Auctioneer/IBaseAuctioneer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ interface IBaseAuctioneer is IBaseHealthCheck {

function cooldownLength() external view returns (uint32);

function auctions(bytes32)
function auctions(
bytes32
)
external
view
returns (
Expand All @@ -31,7 +33,9 @@ interface IBaseAuctioneer is IBaseHealthCheck {

function getAuctionId(address _from) external view returns (bytes32);

function auctionInfo(bytes32 _auctionId)
function auctionInfo(
bytes32 _auctionId
)
external
view
returns (
Expand All @@ -43,10 +47,10 @@ interface IBaseAuctioneer is IBaseHealthCheck {

function kickable(bytes32 _auctionId) external view returns (uint256);

function getAmountNeeded(bytes32 _auctionId, uint256 _amountToTake)
external
view
returns (uint256);
function getAmountNeeded(
bytes32 _auctionId,
uint256 _amountToTake
) external view returns (uint256);

function getAmountNeeded(
bytes32 _auctionId,
Expand All @@ -56,10 +60,10 @@ interface IBaseAuctioneer is IBaseHealthCheck {

function price(bytes32 _auctionId) external view returns (uint256);

function price(bytes32 _auctionId, uint256 _timestamp)
external
view
returns (uint256);
function price(
bytes32 _auctionId,
uint256 _timestamp
) external view returns (uint256);

function enableAuction(address _from) external returns (bytes32);

Expand All @@ -71,9 +75,10 @@ interface IBaseAuctioneer is IBaseHealthCheck {

function take(bytes32 _auctionId) external returns (uint256);

function take(bytes32 _auctionId, uint256 _maxAmount)
external
returns (uint256);
function take(
bytes32 _auctionId,
uint256 _maxAmount
) external returns (uint256);

function take(
bytes32 _auctionId,
Expand Down
16 changes: 8 additions & 8 deletions src/test/BaseAuctioneer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ contract BaseAuctioneerTest is Setup {

address from = tokenAddrs["WBTC"];

fromScaler = WAD / 10**ERC20(from).decimals();
wantScaler = WAD / 10**ERC20(asset).decimals();
fromScaler = WAD / 10 ** ERC20(from).decimals();
wantScaler = WAD / 10 ** ERC20(asset).decimals();

bytes32 id = auctioneer.enableAuction(from);

Expand Down Expand Up @@ -248,8 +248,8 @@ contract BaseAuctioneerTest is Setup {

address from = tokenAddrs["WBTC"];

fromScaler = WAD / 10**ERC20(from).decimals();
wantScaler = WAD / 10**ERC20(asset).decimals();
fromScaler = WAD / 10 ** ERC20(from).decimals();
wantScaler = WAD / 10 ** ERC20(asset).decimals();

bytes32 id = auctioneer.enableAuction(from);

Expand Down Expand Up @@ -301,8 +301,8 @@ contract BaseAuctioneerTest is Setup {

address from = tokenAddrs["WBTC"];

fromScaler = WAD / 10**ERC20(from).decimals();
wantScaler = WAD / 10**ERC20(asset).decimals();
fromScaler = WAD / 10 ** ERC20(from).decimals();
wantScaler = WAD / 10 ** ERC20(asset).decimals();

bytes32 id = auctioneer.enableAuction(from);

Expand Down Expand Up @@ -394,8 +394,8 @@ contract BaseAuctioneerTest is Setup {

address from = tokenAddrs["WBTC"];

fromScaler = WAD / 10**ERC20(from).decimals();
wantScaler = WAD / 10**ERC20(asset).decimals();
fromScaler = WAD / 10 ** ERC20(from).decimals();
wantScaler = WAD / 10 ** ERC20(asset).decimals();

bytes32 id = auctioneer.enableAuction(from);

Expand Down
23 changes: 9 additions & 14 deletions src/test/mocks/MockAuctioneer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ contract MockAuctioneer is BaseAuctioneer {

uint256 public letKick;

constructor(address _asset)
BaseAuctioneer(_asset, "Mock Auctioneer", _asset, 1 days, 5 days, 1e7)
{}
constructor(
address _asset
) BaseAuctioneer(_asset, "Mock Auctioneer", _asset, 1 days, 5 days, 1e7) {}

function _deployFunds(uint256) internal override {}

Expand All @@ -32,21 +32,16 @@ contract MockAuctioneer is BaseAuctioneer {
_totalAssets = asset.balanceOf(address(this));
}

function _kickable(address _token)
internal
view
override
returns (uint256)
{
function _kickable(
address _token
) internal view override returns (uint256) {
if (useDefault) return super._kickable(_token);
return letKick;
}

function _auctionKicked(address _token)
internal
override
returns (uint256)
{
function _auctionKicked(
address _token
) internal override returns (uint256) {
if (useDefault) return super._auctionKicked(_token);
return letKick;
}
Expand Down

0 comments on commit bcab073

Please sign in to comment.