Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
daopunk committed Jul 13, 2024
1 parent 4229080 commit bfcc410
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 69 deletions.
1 change: 0 additions & 1 deletion script/Common.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ abstract contract Common is Contracts, Params, Test {

function deployCollateralContracts(bytes32 _cType) public updateParams {
// deploy CollateralJoin and CollateralAuctionHouse
address _delegatee = delegatee[_cType];
if (_cType == ARB) {
console.log('Using arb ctype, so deploying delegatable cjoin.');
collateralJoin[_cType] = collateralJoinFactory.deployDelegatableCollateralJoin({
Expand Down
70 changes: 35 additions & 35 deletions src/libraries/OpenDollarV1Arbitrum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,54 @@ pragma solidity >=0.7.0;
import {IERC20Metadata} from '@openzeppelin/token/ERC20/extensions/IERC20Metadata.sol';

// --- Base Contracts ---
import {ISystemCoin} from '@contracts/tokens/SystemCoin.sol';
import {IProtocolToken} from '@contracts/tokens/ProtocolToken.sol';
import {ISAFEEngine} from '@contracts/SAFEEngine.sol';
import {ITaxCollector} from '@contracts/TaxCollector.sol';
import {IAccountingEngine} from '@contracts/AccountingEngine.sol';
import {ILiquidationEngine} from '@contracts/LiquidationEngine.sol';
import {ISurplusAuctionHouse} from '@contracts/SurplusAuctionHouse.sol';
import {IDebtAuctionHouse} from '@contracts/DebtAuctionHouse.sol';
import {ICollateralAuctionHouse} from '@contracts/CollateralAuctionHouse.sol';
import {IStabilityFeeTreasury} from '@contracts/StabilityFeeTreasury.sol';
import {IPIDController} from '@contracts/PIDController.sol';
import {IPIDRateSetter} from '@contracts/PIDRateSetter.sol';
import {ISystemCoin} from '@interfaces/tokens/ISystemCoin.sol';
import {IProtocolToken} from '@interfaces/tokens/IProtocolToken.sol';
import {ISAFEEngine} from '@interfaces/ISAFEEngine.sol';
import {ITaxCollector} from '@interfaces/ITaxCollector.sol';
import {IAccountingEngine} from '@interfaces/IAccountingEngine.sol';
import {ILiquidationEngine} from '@interfaces/ILiquidationEngine.sol';
import {ISurplusAuctionHouse} from '@interfaces/ISurplusAuctionHouse.sol';
import {IDebtAuctionHouse} from '@interfaces/IDebtAuctionHouse.sol';
import {ICollateralAuctionHouse} from '@interfaces/ICollateralAuctionHouse.sol';
import {IStabilityFeeTreasury} from '@interfaces/IStabilityFeeTreasury.sol';
import {IPIDController} from '@interfaces/IPIDController.sol';
import {IPIDRateSetter} from '@interfaces/IPIDRateSetter.sol';

// --- Settlement ---
import {IGlobalSettlement} from '@contracts/settlement/GlobalSettlement.sol';
import {IPostSettlementSurplusAuctionHouse} from '@contracts/settlement/PostSettlementSurplusAuctionHouse.sol';
import {ISettlementSurplusAuctioneer} from '@contracts/settlement/SettlementSurplusAuctioneer.sol';
import {IGlobalSettlement} from '@interfaces/settlement/IGlobalSettlement.sol';
import {IPostSettlementSurplusAuctionHouse} from '@interfaces/settlement/IPostSettlementSurplusAuctionHouse.sol';
import {ISettlementSurplusAuctioneer} from '@interfaces/settlement/ISettlementSurplusAuctioneer.sol';

// --- Oracles ---
import {IOracleRelayer} from '@contracts/OracleRelayer.sol';
import {IDelayedOracle} from '@contracts/oracles/DelayedOracle.sol';
import {IOracleRelayer} from '@interfaces/IOracleRelayer.sol';
import {IDelayedOracle} from '@interfaces/oracles/IDelayedOracle.sol';

// --- Token adapters ---
import {ICoinJoin} from '@contracts/utils/CoinJoin.sol';
import {ICollateralJoin} from '@contracts/utils/CollateralJoin.sol';
import {ICoinJoin} from '@interfaces/utils/ICoinJoin.sol';
import {ICollateralJoin} from '@interfaces/utils/ICollateralJoin.sol';

// --- Factories ---
import {ICollateralJoinFactory} from '@contracts/factories/CollateralJoinFactory.sol';
import {ICollateralAuctionHouseFactory} from '@contracts/factories/CollateralAuctionHouseFactory.sol';
import {IChainlinkRelayerFactory} from '@contracts/factories/ChainlinkRelayerFactory.sol';
import {IDenominatedOracleFactory} from '@contracts/factories/DenominatedOracleFactory.sol';
import {IDelayedOracleFactory} from '@contracts/factories/DelayedOracleFactory.sol';
import {ICollateralJoinFactory} from '@interfaces/factories/ICollateralJoinFactory.sol';
import {ICollateralAuctionHouseFactory} from '@interfaces/factories/ICollateralAuctionHouseFactory.sol';
import {IChainlinkRelayerFactory} from '@interfaces/factories/IChainlinkRelayerFactory.sol';
import {IDenominatedOracleFactory} from '@interfaces/factories/IDenominatedOracleFactory.sol';
import {IDelayedOracleFactory} from '@interfaces/factories/IDelayedOracleFactory.sol';

// --- Jobs ---
import {IAccountingJob} from '@contracts/jobs/AccountingJob.sol';
import {ILiquidationJob} from '@contracts/jobs/LiquidationJob.sol';
import {IOracleJob} from '@contracts/jobs/OracleJob.sol';
import {IAccountingJob} from '@interfaces/jobs/IAccountingJob.sol';
import {ILiquidationJob} from '@interfaces/jobs/ILiquidationJob.sol';
import {IOracleJob} from '@interfaces/jobs/IOracleJob.sol';

// --- Proxy Contracts ---
import {IBasicActions} from '@contracts/proxies/actions/BasicActions.sol';
import {IDebtBidActions} from '@contracts/proxies/actions/DebtBidActions.sol';
import {ISurplusBidActions} from '@contracts/proxies/actions/SurplusBidActions.sol';
import {ICollateralBidActions} from '@contracts/proxies/actions/CollateralBidActions.sol';
import {IBasicActions} from '@interfaces/proxies/actions/IBasicActions.sol';
import {IDebtBidActions} from '@interfaces/proxies/actions/IDebtBidActions.sol';
import {ISurplusBidActions} from '@interfaces/proxies/actions/ISurplusBidActions.sol';
import {ICollateralBidActions} from '@interfaces/proxies/actions/ICollateralBidActions.sol';
import {PostSettlementSurplusBidActions} from '@contracts/proxies/actions/PostSettlementSurplusBidActions.sol';
import {IGlobalSettlementActions} from '@contracts/proxies/actions/GlobalSettlementActions.sol';
import {IRewardedActions} from '@contracts/proxies/actions/RewardedActions.sol';
import {IODSafeManager} from '@contracts/proxies/ODSafeManager.sol';
import {IVault721} from '@contracts/proxies/Vault721.sol';
import {IGlobalSettlementActions} from '@interfaces/proxies/actions/IGlobalSettlementActions.sol';
import {IRewardedActions} from '@interfaces/proxies/actions/IRewardedActions.sol';
import {IODSafeManager} from '@interfaces/proxies/IODSafeManager.sol';
import {IVault721} from '@interfaces/proxies/IVault721.sol';
import {NFTRenderer} from '@contracts/proxies/NFTRenderer.sol';

// --- Governance Contracts ---
Expand Down
20 changes: 10 additions & 10 deletions test/e2e/Deploy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {IProtocolToken} from '@contracts/tokens/ProtocolToken.sol';

abstract contract CommonDeploymentTest is ODTest, Deploy {
// SAFEEngine
function test_SAFEEngine_Auth() public {
function test_SAFEEngine_Auth() public view {
assertEq(safeEngine.authorizedAccounts(address(oracleRelayer)), true);
assertEq(safeEngine.authorizedAccounts(address(taxCollector)), true);
assertEq(safeEngine.authorizedAccounts(address(debtAuctionHouse)), true);
Expand All @@ -34,12 +34,12 @@ abstract contract CommonDeploymentTest is ODTest, Deploy {
}

// OracleRelayer
function test_OracleRelayer_Auth() public {
function test_OracleRelayer_Auth() public view {
assertEq(oracleRelayer.authorizedAccounts(address(pidRateSetter)), true);
}

// AccountingEngine
function test_AccountingEngine_Auth() public {
function test_AccountingEngine_Auth() public view {
assertEq(accountingEngine.authorizedAccounts(address(liquidationEngine)), true);
}

Expand All @@ -48,17 +48,17 @@ abstract contract CommonDeploymentTest is ODTest, Deploy {
}

// SystemCoin
function test_SystemCoin_Auth() public {
function test_SystemCoin_Auth() public view {
assertEq(systemCoin.authorizedAccounts(address(coinJoin)), true);
}

// ProtocolToken
function test_ProtocolToken_Auth() public {
function test_ProtocolToken_Auth() public view {
assertEq(protocolToken.authorizedAccounts(address(debtAuctionHouse)), true);
}

// SurplusAuctionHouse
function test_SurplusAuctionHouse_Auth() public {
function test_SurplusAuctionHouse_Auth() public view {
assertEq(surplusAuctionHouse.authorizedAccounts(address(accountingEngine)), true);
}

Expand All @@ -67,7 +67,7 @@ abstract contract CommonDeploymentTest is ODTest, Deploy {
}

// DebtAuctionHouse
function test_DebtAuctionHouse_Auth() public {
function test_DebtAuctionHouse_Auth() public view {
assertEq(debtAuctionHouse.authorizedAccounts(address(accountingEngine)), true);
}

Expand All @@ -76,7 +76,7 @@ abstract contract CommonDeploymentTest is ODTest, Deploy {
}

// CollateralAuctionHouse
function test_CollateralAuctionHouse_Auth() public {
function test_CollateralAuctionHouse_Auth() public view {
for (uint256 _i; _i < collateralTypes.length; _i++) {
bytes32 _cType = collateralTypes[_i];
assertEq(collateralAuctionHouse[_cType].authorizedAccounts(address(liquidationEngine)), true);
Expand All @@ -92,7 +92,7 @@ abstract contract CommonDeploymentTest is ODTest, Deploy {
}
}

function test_Grant_Auth() public {
function test_Grant_Auth() public view {
uint256 _id;
assembly {
_id := chainid()
Expand All @@ -112,7 +112,7 @@ abstract contract CommonDeploymentTest is ODTest, Deploy {
}
}

function _test_Authorizations(address _target, bool _permission) internal {
function _test_Authorizations(address _target, bool _permission) internal view {
// base contracts
assertEq(safeEngine.authorizedAccounts(_target), _permission);
assertEq(oracleRelayer.authorizedAccounts(_target), _permission);
Expand Down
9 changes: 1 addition & 8 deletions test/e2e/E2ESafeManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,7 @@ contract E2ESafeManagerTest_TransferCollateral is E2ESafeManagerSetUp {
depositCollatAndGenDebt(_cType(), aliceSafeId, _scenario.lockedCollateral, 0, aliceProxy);
modifySAFECollateralization(aliceProxy, aliceSafeId, -int256(_scenario.lockedCollateral), 0);
vm.stopPrank();
bytes memory payload = abi.encodeWithSelector(
basicActions.transferCollateralWithCType.selector,
address(safeManager),
_cType(),
aliceSafeId,
bob,
_scenario.lockedCollateral
);

vm.prank(bob);
vm.expectRevert(IODSafeManager.SafeNotAllowed.selector);
safeManager.transferCollateral(_cType(), aliceSafeId, bob, _scenario.lockedCollateral);
Expand Down
7 changes: 1 addition & 6 deletions test/e2e/E2ETest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ abstract contract E2ETest is BaseUser, Base_CType, Common, IERC721Receiver {
taxCollector.taxSingle(_cType());
}

function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4) {
function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}

Expand Down
13 changes: 12 additions & 1 deletion test/lib/ODLib.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,29 @@ contract ODLib is Test {
IVault721 public vault721;

function setUp() public virtual {
vm.createSelectFork(vm.rpcUrl('mainnet'));

systemCoin = OpenDollarV1Arbitrum.SYSTEM_COIN;
protocolToken = OpenDollarV1Arbitrum.PROTOCOL_TOKEN;
safeEngine = OpenDollarV1Arbitrum.SAFE_ENGINE;
safeManager = OpenDollarV1Arbitrum.SAFE_MANANGER;
vault721 = OpenDollarV1Arbitrum.VAULT721;
}

function testODLib() public {
function testODLib() public view {
assertTrue(systemCoin == ISystemCoin(0x221A0f68770658C15B525d0F89F5da2baAB5f321));
assertTrue(protocolToken == IProtocolToken(MAINNET_PROTOCOL_TOKEN));
assertTrue(safeEngine == ISAFEEngine(0xEff45E8e2353893BD0558bD5892A42786E9142F1));
assertTrue(safeManager == IODSafeManager(0x8646CBd915eAAD1a4E2Ba5e2b67Acec4957d5f1a));
assertTrue(vault721 == IVault721(0x0005AFE00fF7E7FF83667bFe4F2996720BAf0B36));
}

function testTotalSupply() public view {
assertEq(systemCoin.totalSupply(), OpenDollarV1Arbitrum.SYSTEM_COIN.totalSupply());
}

function testSafeManager() public {
assertTrue(vault721.safeManager() == safeManager);
assertTrue(vault721.safeManager() == OpenDollarV1Arbitrum.VAULT721.safeManager());
}
}
8 changes: 4 additions & 4 deletions test/mocks/SafeSaviourForTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ contract SafeSaviourForForTest is ISAFESaviour {
constructor() {}

function saveSAFE(
address _liquidator,
bytes32 _cType,
address _safe
) external returns (bool _ok, uint256 _collateralAdded, uint256 _liquidatorReward) {
address,
bytes32,
address
) external pure returns (bool _ok, uint256 _collateralAdded, uint256 _liquidatorReward) {
_ok = true;
_collateralAdded = type(uint256).max;
_liquidatorReward = type(uint256).max;
Expand Down
6 changes: 3 additions & 3 deletions test/scopes/DirectUser.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ abstract contract DirectUser is BaseUser, Contracts, ScriptBase {
abi.encode(uint256(1))
);
safeEngine.modifySAFECollateralization({
_cType: ICollateralJoin(_collateralJoin).collateralType(),
_cType: _cType,
_safe: _user,
_collateralSource: _user,
_debtDestination: _user,
Expand Down Expand Up @@ -197,7 +197,7 @@ abstract contract DirectUser is BaseUser, Contracts, ScriptBase {
vm.stopPrank();
}

function _settleDebtAuction(address _user, uint256 _auctionId) internal override {
function _settleDebtAuction(address, uint256 _auctionId) internal override {
debtAuctionHouse.settleAuction(_auctionId);
}

Expand All @@ -223,7 +223,7 @@ abstract contract DirectUser is BaseUser, Contracts, ScriptBase {
vm.stopPrank();
}

function _settlePostSettlementSurplusAuction(address _user, uint256 _auctionId) internal override {
function _settlePostSettlementSurplusAuction(address, uint256 _auctionId) internal override {
postSettlementSurplusAuctionHouse.settleAuction(_auctionId);
}

Expand Down
2 changes: 1 addition & 1 deletion test/scopes/ProxyUser.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ abstract contract ProxyUser is BaseUser, Contracts, ScriptBase {
function _redeemCollateral(
address _user,
bytes32 _cType,
uint256 _coinsAmount
uint256
) internal override returns (uint256 _collateralAmount) {
ODProxy _proxy = _getProxy(_user);

Expand Down

0 comments on commit bfcc410

Please sign in to comment.