diff --git a/.forge-snapshots/newBFactory.snap b/.forge-snapshots/newBFactory.snap index c54b6046..95e984ca 100644 --- a/.forge-snapshots/newBFactory.snap +++ b/.forge-snapshots/newBFactory.snap @@ -1 +1 @@ -4130633 \ No newline at end of file +4130621 \ No newline at end of file diff --git a/script/DeployBCoWFactory.s.sol b/script/DeployBCoWFactory.s.sol index a2abfbdd..57905392 100644 --- a/script/DeployBCoWFactory.s.sol +++ b/script/DeployBCoWFactory.s.sol @@ -11,7 +11,7 @@ contract DeployBCoWFactory is Script, Params { vm.startBroadcast(); BCoWFactory bCoWFactory = new BCoWFactory(params.settlement, params.appData); - bCoWFactory.setBLabs(params.bLabs); + bCoWFactory.setBDao(params.bDao); vm.stopBroadcast(); } } diff --git a/script/DeployBFactory.s.sol b/script/DeployBFactory.s.sol index 5d0c33bc..1d7a0157 100644 --- a/script/DeployBFactory.s.sol +++ b/script/DeployBFactory.s.sol @@ -11,7 +11,7 @@ contract DeployBFactory is Script, Params { vm.startBroadcast(); BFactory bFactory = new BFactory(); - bFactory.setBLabs(params.bLabs); + bFactory.setBDao(params.bDao); vm.stopBroadcast(); } } diff --git a/script/Params.s.sol b/script/Params.s.sol index b2f0eeab..9df9a8f0 100644 --- a/script/Params.s.sol +++ b/script/Params.s.sol @@ -3,11 +3,11 @@ pragma solidity 0.8.25; contract Params { struct BFactoryDeploymentParams { - address bLabs; + address bDao; } struct BCoWFactoryDeploymentParams { - address bLabs; + address bDao; address settlement; bytes32 appData; } diff --git a/src/contracts/BFactory.sol b/src/contracts/BFactory.sol index 60619bb6..19450439 100644 --- a/src/contracts/BFactory.sol +++ b/src/contracts/BFactory.sol @@ -13,11 +13,11 @@ import {IBPool} from 'interfaces/IBPool.sol'; contract BFactory is IBFactory { /// @dev Mapping indicating whether the address is a BPool. mapping(address => bool) internal _isBPool; - /// @dev bLabs address. - address internal _bLabs; + /// @dev bDao address. + address internal _bDao; constructor() { - _bLabs = msg.sender; + _bDao = msg.sender; } /// @inheritdoc IBFactory @@ -29,25 +29,25 @@ contract BFactory is IBFactory { } /// @inheritdoc IBFactory - function setBLabs(address bLabs) external { - if (bLabs == address(0)) { + function setBDao(address bDao) external { + if (bDao == address(0)) { revert BFactory_AddressZero(); } - if (msg.sender != _bLabs) { - revert BFactory_NotBLabs(); + if (msg.sender != _bDao) { + revert BFactory_NotBDao(); } - emit LOG_BLABS(msg.sender, bLabs); - _bLabs = bLabs; + emit LOG_BDAO(msg.sender, bDao); + _bDao = bDao; } /// @inheritdoc IBFactory function collect(IBPool bPool) external { - if (msg.sender != _bLabs) { - revert BFactory_NotBLabs(); + if (msg.sender != _bDao) { + revert BFactory_NotBDao(); } uint256 collected = bPool.balanceOf(address(this)); - SafeERC20.safeTransfer(bPool, _bLabs, collected); + SafeERC20.safeTransfer(bPool, _bDao, collected); } /// @inheritdoc IBFactory @@ -56,8 +56,8 @@ contract BFactory is IBFactory { } /// @inheritdoc IBFactory - function getBLabs() external view returns (address) { - return _bLabs; + function getBDao() external view returns (address) { + return _bDao; } /** diff --git a/src/interfaces/IBFactory.sol b/src/interfaces/IBFactory.sol index edaff060..672ba7ca 100644 --- a/src/interfaces/IBFactory.sol +++ b/src/interfaces/IBFactory.sol @@ -12,11 +12,11 @@ interface IBFactory { event LOG_NEW_POOL(address indexed caller, address indexed bPool); /** - * @notice Emitted when setting the BLabs address - * @param caller The caller of the set BLabs function - * @param bLabs The address of the new BLabs + * @notice Emitted when setting the BDao address + * @param caller The caller of the set BDao function + * @param bDao The address of the new BDao */ - event LOG_BLABS(address indexed caller, address indexed bLabs); + event LOG_BDAO(address indexed caller, address indexed bDao); /** * @notice Thrown when setting a variable to address zero @@ -24,9 +24,9 @@ interface IBFactory { error BFactory_AddressZero(); /** - * @notice Thrown when caller is not BLabs address + * @notice Thrown when caller is not BDao address */ - error BFactory_NotBLabs(); + error BFactory_NotBDao(); /** * @notice Creates a new BPool, assigning the caller as the pool controller @@ -35,13 +35,13 @@ interface IBFactory { function newBPool() external returns (IBPool bPool); /** - * @notice Sets the BLabs address in the factory - * @param bLabs The new BLabs address + * @notice Sets the BDao address in the factory + * @param bDao The new BDao address */ - function setBLabs(address bLabs) external; + function setBDao(address bDao) external; /** - * @notice Collects the fees of a pool and transfers it to BLabs address + * @notice Collects the fees of a pool and transfers it to BDao address * @param bPool The address of the pool to collect fees from */ function collect(IBPool bPool) external; @@ -54,8 +54,8 @@ interface IBFactory { function isBPool(address bPool) external view returns (bool isBPool); /** - * @notice Gets the BLabs address - * @return bLabs The address of the BLabs + * @notice Gets the BDao address + * @return bDao The address of the BDao */ - function getBLabs() external view returns (address bLabs); + function getBDao() external view returns (address bDao); } diff --git a/test/smock/MockBFactory.sol b/test/smock/MockBFactory.sol index 7689e20e..ab754fa5 100644 --- a/test/smock/MockBFactory.sol +++ b/test/smock/MockBFactory.sol @@ -13,12 +13,12 @@ contract MockBFactory is BFactory, Test { return _isBPool[_key0]; } - function set__bLabs(address __bLabs) public { - _bLabs = __bLabs; + function set__bDao(address __bDao) public { + _bDao = __bDao; } - function call__bLabs() public view returns (address) { - return _bLabs; + function call__bDao() public view returns (address) { + return _bDao; } constructor() BFactory() {} @@ -27,8 +27,8 @@ contract MockBFactory is BFactory, Test { vm.mockCall(address(this), abi.encodeWithSignature('newBPool()'), abi.encode(bPool)); } - function mock_call_setBLabs(address bLabs) public { - vm.mockCall(address(this), abi.encodeWithSignature('setBLabs(address)', bLabs), abi.encode()); + function mock_call_setBDao(address bDao) public { + vm.mockCall(address(this), abi.encodeWithSignature('setBDao(address)', bDao), abi.encode()); } function mock_call_collect(IBPool bPool) public { @@ -39,8 +39,8 @@ contract MockBFactory is BFactory, Test { vm.mockCall(address(this), abi.encodeWithSignature('isBPool(address)', bPool), abi.encode(_returnParam0)); } - function mock_call_getBLabs(address _returnParam0) public { - vm.mockCall(address(this), abi.encodeWithSignature('getBLabs()'), abi.encode(_returnParam0)); + function mock_call_getBDao(address _returnParam0) public { + vm.mockCall(address(this), abi.encodeWithSignature('getBDao()'), abi.encode(_returnParam0)); } function mock_call__newBPool(IBPool bPool) public { diff --git a/test/unit/BCoWFactory.t.sol b/test/unit/BCoWFactory.t.sol index 1ff8070a..9c2bfca2 100644 --- a/test/unit/BCoWFactory.t.sol +++ b/test/unit/BCoWFactory.t.sol @@ -24,15 +24,15 @@ contract BCoWFactoryTest is Test { ); } - function test_ConstructorWhenCalled(address _blabs, address _newSettler, bytes32 _appData) external { - vm.prank(_blabs); + function test_ConstructorWhenCalled(address _bDao, address _newSettler, bytes32 _appData) external { + vm.prank(_bDao); MockBCoWFactory _newFactory = new MockBCoWFactory(_newSettler, _appData); // it should set solution settler assertEq(_newFactory.SOLUTION_SETTLER(), _newSettler); // it should set app data assertEq(_newFactory.APP_DATA(), _appData); - // it should set blabs - assertEq(_newFactory.getBLabs(), _blabs); + // it should set BDao + assertEq(_newFactory.getBDao(), _bDao); } function test__newBPoolWhenCalled() external { diff --git a/test/unit/BCoWFactory.tree b/test/unit/BCoWFactory.tree index 37160019..daa4549a 100644 --- a/test/unit/BCoWFactory.tree +++ b/test/unit/BCoWFactory.tree @@ -2,7 +2,7 @@ BCoWFactoryTest::constructor └── when called ├── it should set solution settler ├── it should set app data - └── it should set blabs + └── it should set BDao BCoWFactoryTest::_newBPool └── when called diff --git a/test/unit/BFactory.t.sol b/test/unit/BFactory.t.sol index b1426432..24e0ed78 100644 --- a/test/unit/BFactory.t.sol +++ b/test/unit/BFactory.t.sol @@ -21,11 +21,11 @@ contract BFactoryTest is Test { factory = new MockBFactory(); } - function test_ConstructorWhenCalled(address _blabs) external { - vm.prank(_blabs); + function test_ConstructorWhenCalled(address _bDao) external { + vm.prank(_bDao); MockBFactory newFactory = new MockBFactory(); - // it should set BLabs - assertEq(newFactory.getBLabs(), _blabs); + // it should set BDao + assertEq(newFactory.getBDao(), _bDao); } function test_NewBPoolWhenCalled(address _deployer, address _newBPool) external { @@ -60,55 +60,52 @@ contract BFactoryTest is Test { assertEq(_newBPool.code, _expectedCode); } - function test_SetBLabsRevertWhen_TheSenderIsNotTheCurrentBLabs(address _caller) external { + function test_SetBDaoRevertWhen_TheSenderIsNotTheCurrentBDao(address _caller) external { vm.assume(_caller != factoryDeployer); // it should revert - vm.expectRevert(IBFactory.BFactory_NotBLabs.selector); + vm.expectRevert(IBFactory.BFactory_NotBDao.selector); vm.prank(_caller); - factory.setBLabs(makeAddr('newBLabs')); + factory.setBDao(makeAddr('newBDao')); } - modifier whenTheSenderIsTheCurrentBLabs() { + modifier whenTheSenderIsTheCurrentBDao() { vm.startPrank(factoryDeployer); _; } - function test_SetBLabsRevertWhen_TheAddressIsZero() external whenTheSenderIsTheCurrentBLabs { + function test_SetBDaoRevertWhen_TheAddressIsZero() external whenTheSenderIsTheCurrentBDao { // it should revert vm.expectRevert(IBFactory.BFactory_AddressZero.selector); - factory.setBLabs(address(0)); + factory.setBDao(address(0)); } - function test_SetBLabsWhenTheAddressIsNotZero(address _newBLabs) external whenTheSenderIsTheCurrentBLabs { - vm.assume(_newBLabs != address(0)); + function test_SetBDaoWhenTheAddressIsNotZero(address _newBDao) external whenTheSenderIsTheCurrentBDao { + vm.assume(_newBDao != address(0)); - // it should emit a BLabsSet event + // it should emit a BDaoSet event vm.expectEmit(address(factory)); - emit IBFactory.LOG_BLABS(factoryDeployer, _newBLabs); + emit IBFactory.LOG_BDAO(factoryDeployer, _newBDao); - factory.setBLabs(_newBLabs); + factory.setBDao(_newBDao); - // it should set the new bLabs address - assertEq(factory.getBLabs(), _newBLabs); + // it should set the new bDao address + assertEq(factory.getBDao(), _newBDao); } - function test_CollectRevertWhen_TheSenderIsNotTheCurrentBLabs(address _caller) external { + function test_CollectRevertWhen_TheSenderIsNotTheCurrentBDao(address _caller) external { vm.assume(_caller != factoryDeployer); // it should revert - vm.expectRevert(IBFactory.BFactory_NotBLabs.selector); + vm.expectRevert(IBFactory.BFactory_NotBDao.selector); vm.prank(_caller); factory.collect(IBPool(makeAddr('pool'))); } - function test_CollectWhenTheSenderIsTheCurrentBLabs(uint256 _factoryBTBalance) - external - whenTheSenderIsTheCurrentBLabs - { + function test_CollectWhenTheSenderIsTheCurrentBDao(uint256 _factoryBTBalance) external whenTheSenderIsTheCurrentBDao { address _mockPool = makeAddr('pool'); vm.mockCall(_mockPool, abi.encodeCall(IERC20.balanceOf, address(factory)), abi.encode(_factoryBTBalance)); vm.mockCall(_mockPool, abi.encodeCall(IERC20.transfer, (factoryDeployer, _factoryBTBalance)), abi.encode(true)); @@ -116,7 +113,7 @@ contract BFactoryTest is Test { // it should get the pool's btoken balance of the factory vm.expectCall(_mockPool, abi.encodeCall(IERC20.balanceOf, address(factory))); - // it should transfer the btoken balance of the factory to BLabs + // it should transfer the btoken balance of the factory to BDao vm.expectCall(_mockPool, abi.encodeCall(IERC20.transfer, (factoryDeployer, _factoryBTBalance))); factory.collect(IBPool(_mockPool)); @@ -124,7 +121,7 @@ contract BFactoryTest is Test { function test_CollectRevertWhen_TheBtokenTransferFails(uint256 _factoryBTBalance) external - whenTheSenderIsTheCurrentBLabs + whenTheSenderIsTheCurrentBDao { address _mockPool = makeAddr('pool'); vm.mockCall(_mockPool, abi.encodeCall(IERC20.balanceOf, address(factory)), abi.encode(_factoryBTBalance)); diff --git a/test/unit/BFactory.tree b/test/unit/BFactory.tree index bd2dce21..02f1fd16 100644 --- a/test/unit/BFactory.tree +++ b/test/unit/BFactory.tree @@ -1,6 +1,6 @@ BFactoryTest::constructor └── when called - └── it should set the deployer as BLabs + └── it should set the deployer as BDao BFactoryTest::newBPool └── when called @@ -14,22 +14,22 @@ BFactoryTest::_newBPool └── when called └── it should deploy a new BPool -BFactoryTest::setBLabs -├── when the sender is not the current BLabs +BFactoryTest::setBDao +├── when the sender is not the current BDao │ └── it should revert -└── when the sender is the current BLabs +└── when the sender is the current BDao ├── when the address is zero │ └── it should revert └── when the address is not zero - ├── it should set the new BLabs address - └── it should emit a BLabsSet event + ├── it should set the new BDao address + └── it should emit a BDaoSet event BFactoryTest::collect -├── when the sender is not the current BLabs +├── when the sender is not the current BDao │ └── it should revert -└── when the sender is the current BLabs +└── when the sender is the current BDao ├── it should get the pool's btoken balance of the factory - ├── it should transfer the btoken balance of the factory to BLabs + ├── it should transfer the btoken balance of the factory to BDao └── when the btoken transfer fails └── it should revert