Skip to content

Commit

Permalink
chore: run linter (#5)
Browse files Browse the repository at this point in the history
* chore: delete echidna, manticore and audit files

* chore: re-enable linter

* chore: rollback pre-commit

* chore: add extra space to avoid changing the file

* fix: bmath.sol comments
  • Loading branch information
0xAustrian authored May 3, 2024
1 parent 09d7639 commit 4cc0e63
Show file tree
Hide file tree
Showing 9 changed files with 985 additions and 1,257 deletions.
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 @@ pragma solidity 0.8.23;

// 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

0 comments on commit 4cc0e63

Please sign in to comment.