Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: run linter #5

Merged
merged 6 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/contracts/BColor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@
pragma solidity 0.8.23;

abstract contract BColor {
function getColor()
external view virtual
returns (bytes32);
function getColor() external view virtual returns (bytes32);
}

contract BBronze is BColor {
function getColor()
external view override
returns (bytes32) {
return bytes32("BRONZE");
}
function getColor() external view override returns (bytes32) {
return bytes32('BRONZE');
}
}
34 changes: 17 additions & 17 deletions src/contracts/BConst.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@

pragma solidity 0.8.23;

import "./BColor.sol";
import './BColor.sol';

contract BConst is BBronze {
uint public constant BONE = 10**18;
uint256 public constant BONE = 10 ** 18;

uint public constant MIN_BOUND_TOKENS = 2;
uint public constant MAX_BOUND_TOKENS = 8;
uint256 public constant MIN_BOUND_TOKENS = 2;
uint256 public constant MAX_BOUND_TOKENS = 8;

uint public constant MIN_FEE = BONE / 10**6;
uint public constant MAX_FEE = BONE / 10;
uint public constant EXIT_FEE = 0;
uint256 public constant MIN_FEE = BONE / 10 ** 6;
uint256 public constant MAX_FEE = BONE / 10;
uint256 public constant EXIT_FEE = 0;

uint public constant MIN_WEIGHT = BONE;
uint public constant MAX_WEIGHT = BONE * 50;
uint public constant MAX_TOTAL_WEIGHT = BONE * 50;
uint public constant MIN_BALANCE = BONE / 10**12;
uint256 public constant MIN_WEIGHT = BONE;
uint256 public constant MAX_WEIGHT = BONE * 50;
uint256 public constant MAX_TOTAL_WEIGHT = BONE * 50;
uint256 public constant MIN_BALANCE = BONE / 10 ** 12;

uint public constant INIT_POOL_SUPPLY = BONE * 100;
uint256 public constant INIT_POOL_SUPPLY = BONE * 100;

uint public constant MIN_BPOW_BASE = 1 wei;
uint public constant MAX_BPOW_BASE = (2 * BONE) - 1 wei;
uint public constant BPOW_PRECISION = BONE / 10**10;
uint256 public constant MIN_BPOW_BASE = 1 wei;
uint256 public constant MAX_BPOW_BASE = (2 * BONE) - 1 wei;
uint256 public constant BPOW_PRECISION = BONE / 10 ** 10;

uint public constant MAX_IN_RATIO = BONE / 2;
uint public constant MAX_OUT_RATIO = (BONE / 3) + 1 wei;
uint256 public constant MAX_IN_RATIO = BONE / 2;
uint256 public constant MAX_OUT_RATIO = (BONE / 3) + 1 wei;
}
100 changes: 41 additions & 59 deletions src/contracts/BFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,65 +15,47 @@

// Builds new BPools, logging their addresses and providing `isBPool(address) -> (bool)`

import "./BPool.sol";
import './BPool.sol';

contract BFactory is BBronze {
event LOG_NEW_POOL(
address indexed caller,
address indexed pool
);

event LOG_BLABS(
address indexed caller,
address indexed blabs
);

mapping(address=>bool) private _isBPool;

function isBPool(address b)
external view returns (bool)
{
return _isBPool[b];
}

function newBPool()
external
returns (BPool)
{
BPool bpool = new BPool();
_isBPool[address(bpool)] = true;
emit LOG_NEW_POOL(msg.sender, address(bpool));
bpool.setController(msg.sender);
return bpool;
}

address private _blabs;

constructor() {
_blabs = msg.sender;
}

function getBLabs()
external view
returns (address)
{
return _blabs;
}

function setBLabs(address b)
external
{
require(msg.sender == _blabs, "ERR_NOT_BLABS");
emit LOG_BLABS(msg.sender, b);
_blabs = b;
}

function collect(BPool pool)
external
{
require(msg.sender == _blabs, "ERR_NOT_BLABS");
uint collected = IERC20(pool).balanceOf(address(this));
bool xfer = pool.transfer(_blabs, collected);
require(xfer, "ERR_ERC20_FAILED");
}
event LOG_NEW_POOL(address indexed caller, address indexed pool);

event LOG_BLABS(address indexed caller, address indexed blabs);

mapping(address => bool) private _isBPool;

function isBPool(address b) external view returns (bool) {
return _isBPool[b];
}

function newBPool() external returns (BPool) {
BPool bpool = new BPool();
_isBPool[address(bpool)] = true;
emit LOG_NEW_POOL(msg.sender, address(bpool));
bpool.setController(msg.sender);
return bpool;
}

address private _blabs;

constructor() {
_blabs = msg.sender;
}

function getBLabs() external view returns (address) {
return _blabs;
}

function setBLabs(address b) external {
require(msg.sender == _blabs, 'ERR_NOT_BLABS');

Check failure on line 50 in src/contracts/BFactory.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Use Custom Errors instead of require statements
emit LOG_BLABS(msg.sender, b);
_blabs = b;
}

function collect(BPool pool) external {
require(msg.sender == _blabs, 'ERR_NOT_BLABS');

Check failure on line 56 in src/contracts/BFactory.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Use Custom Errors instead of require statements
uint256 collected = IERC20(pool).balanceOf(address(this));
bool xfer = pool.transfer(_blabs, collected);
require(xfer, 'ERR_ERC20_FAILED');

Check failure on line 59 in src/contracts/BFactory.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Use Custom Errors instead of require statements
}
}
Loading
Loading