Skip to content

Commit

Permalink
test: basic test structure, bump solc version
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAustrian committed May 2, 2024
1 parent b17ab4a commit b4b8ed4
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
# 1. Build the contracts
# 2. Stage build output
# 2. Lint and stage style improvements
yarn build && npx lint-staged
# TODO: remember to re-enable linter
yarn build # && npx lint-staged
2 changes: 1 addition & 1 deletion echidna/BMathInternal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@



pragma solidity 0.5.12;
pragma solidity 0.6.2;
contract BColor {
function getColor()
internal view
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ multiline_func_header = 'params_first'
sort_imports = true

[profile.default]
solc_version = '0.5.12'
solc_version = '0.6.2'
libs = ["node_modules", "lib"]
optimizer_runs = 10_000

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@defi-wonderland/natspec-smells": "1.1.1",
"forge-std": "github:foundry-rs/forge-std#5475f85",
"ds-test": "github:dapphub/ds-test#e282159",
"forge-std": "github:foundry-rs/forge-std#066ff16",
"husky": ">=8",
"lint-staged": ">=10",
"solhint": "solhint-community/solhint-community#v4.0.0",
Expand Down
8 changes: 4 additions & 4 deletions src/contracts/BColor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

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

contract BBronze is BColor {
function getColor()
external view
external view override
returns (bytes32) {
return bytes32("BRONZE");
}
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/BConst.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

import "./BColor.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/contracts/BFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

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

Expand Down
2 changes: 1 addition & 1 deletion src/contracts/BMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

import "./BNum.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/contracts/BNum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

import "./BConst.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/contracts/BPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

import "./BToken.sol";
import "./BMath.sol";
Expand Down
14 changes: 7 additions & 7 deletions src/contracts/BToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

import "./BNum.sol";

Expand Down Expand Up @@ -88,19 +88,19 @@ contract BToken is BTokenBase, IERC20 {
return _decimals;
}

function allowance(address src, address dst) external view returns (uint) {
function allowance(address src, address dst) external view override returns (uint) {
return _allowance[src][dst];
}

function balanceOf(address whom) external view returns (uint) {
function balanceOf(address whom) external view override returns (uint) {
return _balance[whom];
}

function totalSupply() public view returns (uint) {
function totalSupply() public view override returns (uint) {
return _totalSupply;
}

function approve(address dst, uint amt) external returns (bool) {
function approve(address dst, uint amt) external override returns (bool) {
_allowance[msg.sender][dst] = amt;
emit Approval(msg.sender, dst, amt);
return true;
Expand All @@ -123,12 +123,12 @@ contract BToken is BTokenBase, IERC20 {
return true;
}

function transfer(address dst, uint amt) external returns (bool) {
function transfer(address dst, uint amt) external override returns (bool) {
_move(msg.sender, dst, amt);
return true;
}

function transferFrom(address src, address dst, uint amt) external returns (bool) {
function transferFrom(address src, address dst, uint amt) external override returns (bool) {
require(msg.sender == src || amt <= _allowance[src][msg.sender], "ERR_BTOKEN_BAD_CALLER");
_move(src, dst, amt);
if (msg.sender != src && _allowance[src][msg.sender] != uint256(-1)) {
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.12;
pragma solidity 0.6.2;

contract Migrations {
address public owner;
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/test/TMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

import "../BMath.sol";
import "../BNum.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/test/TToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.5.12;
pragma solidity 0.6.2;

// Test Token

Expand Down
2 changes: 1 addition & 1 deletion src/contracts/test/echidna/TBPoolJoinExitPool.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "../../BNum.sol";

pragma solidity 0.5.12;
pragma solidity 0.6.2;

// This test is similar to TBPoolJoin but with an exit fee
contract TBPoolJoinExit is BNum {
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/test/echidna/TBPoolJoinExitPoolNoFee.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "../../BNum.sol";

pragma solidity 0.5.12;
pragma solidity 0.6.2;

// This test is similar to TBPoolJoinExit but with no exit fee
contract TBPoolJoinExitNoFee is BNum {
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/test/echidna/TBPoolJoinPool.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "../../BNum.sol";

pragma solidity 0.5.12;
pragma solidity 0.6.2;

contract TBPoolJoinPool is BNum {

Expand Down
14 changes: 14 additions & 0 deletions test/unit/BFactory.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.6.2;

import {Test, Vm} from 'forge-std/Test.sol';

abstract contract Base is Test {
function setUp() public {}
}

contract BFactory_Unit_Constructor is Base {
function test_constructor() public {
assertTrue(true);
}
}

0 comments on commit b4b8ed4

Please sign in to comment.