Skip to content

Commit b7f93c7

Browse files
author
justin j. moses
authored
Re-running npm format across the codebase (Synthetixio#1194)
1 parent 13df268 commit b7f93c7

File tree

148 files changed

+164
-340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+164
-340
lines changed

.circleci/config.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
command: npx hardhat node
9191
background: true
9292
- cmd-wait-for-port:
93-
port: 8545
93+
port: 8545
9494
- run: node publish deploy --network local --fresh-deploy --yes --use-ovm --ignore-safety-checks --ignore-custom-parameters --deployment-path ./publish/deployed/local-ovm
9595
- run: npm run test:prod -- --no-compile --use-ovm --patch-fresh-deployment --deployment-path ./publish/deployed/local-ovm
9696
job-prod-diff-tests-local:
@@ -109,7 +109,7 @@ jobs:
109109
command: npx hardhat node
110110
background: true
111111
- cmd-wait-for-port:
112-
port: 8545
112+
port: 8545
113113
- run: node publish deploy --network local --fresh-deploy --yes
114114
- run: npm run test:prod -- --patch-fresh-deployment
115115
job-prod-diff-tests:
@@ -129,7 +129,7 @@ jobs:
129129
command: npx hardhat node --target-network mainnet
130130
background: true
131131
- cmd-wait-for-port:
132-
port: 8545
132+
port: 8545
133133
- run: node publish prepare-deploy --network mainnet
134134
- run: node publish deploy --ignore-safety-checks --add-new-synths --use-fork --yes --network mainnet
135135
- run: npm run test:prod:gas -- --target-network mainnet --patch-fresh-deployment
@@ -159,9 +159,9 @@ jobs:
159159
cd optimism-integration
160160
./up.sh
161161
- cmd-wait-for-port:
162-
port: 8545
162+
port: 8545
163163
- cmd-wait-for-port:
164-
port: 9545
164+
port: 9545
165165
- run:
166166
name: Deploy OVM Synthetix instances
167167
command: |
@@ -185,7 +185,7 @@ jobs:
185185
command: npx hardhat node --target-network mainnet
186186
background: true
187187
- cmd-wait-for-port:
188-
port: 8545
188+
port: 8545
189189
- run: npm run test:prod:gas -- --target-network mainnet
190190
- run: npx codechecks codechecks.prod.yml
191191
- store_artifacts:

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pragma solidity 0.5.16;
8181
import 'synthetix/contracts/interfaces/IAddressResolver.sol';
8282
import 'synthetix/contracts/interfaces/ISynthetix.sol';
8383
84-
8584
contract MyContract {
8685
// This should be instantiated with our ReadProxyAddressResolver
8786
// it's a ReadProxy that won't change, so safe to code it here without a setter

contracts/AddressResolver.sol

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import "./interfaces/IAddressResolver.sol";
88
import "./interfaces/IIssuer.sol";
99
import "./MixinResolver.sol";
1010

11-
1211
// https://docs.synthetix.io/contracts/source/contracts/addressresolver
1312
contract AddressResolver is Owned, IAddressResolver {
1413
mapping(bytes32 => address) public repository;

contracts/AddressSetLib.sol

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
pragma solidity ^0.5.16;
22

3-
43
// https://docs.synthetix.io/contracts/source/libraries/addresssetlib/
54
library AddressSetLib {
65
struct AddressSet {

contracts/BaseDebtCache.sol

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import "./interfaces/IEtherCollateralsUSD.sol";
1919
import "./interfaces/IERC20.sol";
2020
import "./interfaces/ICollateralManager.sol";
2121

22-
2322
// https://docs.synthetix.io/contracts/source/contracts/debtcache
2423
contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
2524
using SafeMath for uint;
@@ -150,9 +149,8 @@ contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
150149

151150
bool isSUSD = key == sUSD;
152151
if (isSUSD || key == sETH) {
153-
IEtherCollateral etherCollateralContract = isSUSD
154-
? IEtherCollateral(address(etherCollateralsUSD()))
155-
: etherCollateral();
152+
IEtherCollateral etherCollateralContract =
153+
isSUSD ? IEtherCollateral(address(etherCollateralsUSD())) : etherCollateral();
156154
uint etherCollateralSupply = etherCollateralContract.totalIssuedSynths();
157155
supply = supply.sub(etherCollateralSupply);
158156
}

contracts/BaseRewardEscrowV2.sol

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import "./interfaces/IFeePool.sol";
1616
import "./interfaces/ISynthetix.sol";
1717
import "./interfaces/IIssuer.sol";
1818

19-
2019
// https://docs.synthetix.io/contracts/RewardEscrow
2120
contract BaseRewardEscrowV2 is Owned, IRewardEscrowV2, LimitedSetup(8 weeks), MixinResolver {
2221
using SafeMath for uint;

contracts/BaseSynthetix.sol

+4-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import "./interfaces/IIssuer.sol";
1616
import "./interfaces/IRewardsDistribution.sol";
1717
import "./interfaces/IVirtualSynth.sol";
1818

19-
2019
contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix {
2120
// ========== STATE VARIABLES ==========
2221

@@ -151,10 +150,8 @@ contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix {
151150
(uint initialDebtOwnership, ) = synthetixState().issuanceData(account);
152151

153152
if (initialDebtOwnership > 0) {
154-
(uint transferable, bool anyRateIsInvalid) = issuer().transferableSynthetixAndAnyRateIsInvalid(
155-
account,
156-
tokenState.balanceOf(account)
157-
);
153+
(uint transferable, bool anyRateIsInvalid) =
154+
issuer().transferableSynthetixAndAnyRateIsInvalid(account, tokenState.balanceOf(account));
158155
require(value <= transferable, "Cannot transfer staked or escrowed SNX");
159156
require(!anyRateIsInvalid, "A synth or SNX rate is invalid");
160157
}
@@ -373,9 +370,8 @@ contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix {
373370
uint256 toAmount,
374371
address toAddress
375372
);
376-
bytes32 internal constant SYNTHEXCHANGE_SIG = keccak256(
377-
"SynthExchange(address,bytes32,uint256,bytes32,uint256,address)"
378-
);
373+
bytes32 internal constant SYNTHEXCHANGE_SIG =
374+
keccak256("SynthExchange(address,bytes32,uint256,bytes32,uint256,address)");
379375

380376
function emitSynthExchange(
381377
address account,

contracts/BinaryOption.sol

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import "./SafeDecimalMath.sol";
1010
// Internal references
1111
import "./BinaryOptionMarket.sol";
1212

13-
1413
// https://docs.synthetix.io/contracts/source/contracts/binaryoption
1514
contract BinaryOption is IERC20, IBinaryOption {
1615
/* ========== LIBRARIES ========== */

contracts/BinaryOptionMarket.sol

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import "./interfaces/IExchangeRates.sol";
1515
import "./interfaces/IERC20.sol";
1616
import "./interfaces/IFeePool.sol";
1717

18-
1918
// https://docs.synthetix.io/contracts/source/contracts/binaryoptionmarket
2019
contract BinaryOptionMarket is Owned, MixinResolver, IBinaryOptionMarket {
2120
/* ========== LIBRARIES ========== */

contracts/BinaryOptionMarketData.sol

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import "./BinaryOption.sol";
66
import "./BinaryOptionMarket.sol";
77
import "./BinaryOptionMarketManager.sol";
88

9-
109
// https://docs.synthetix.io/contracts/source/contracts/binaryoptionmarketdata
1110
contract BinaryOptionMarketData {
1211
struct OptionValues {
@@ -63,14 +62,15 @@ contract BinaryOptionMarketData {
6362
(bytes32 key, uint strikePrice, uint finalPrice) = market.oracleDetails();
6463
(uint poolFee, uint creatorFee, uint refundFee) = market.fees();
6564

66-
MarketParameters memory data = MarketParameters(
67-
market.creator(),
68-
BinaryOptionMarket.Options(long, short),
69-
BinaryOptionMarket.Times(biddingEndDate, maturityDate, expiryDate),
70-
BinaryOptionMarket.OracleDetails(key, strikePrice, finalPrice),
71-
BinaryOptionMarketManager.Fees(poolFee, creatorFee, refundFee),
72-
BinaryOptionMarketManager.CreatorLimits(0, 0)
73-
);
65+
MarketParameters memory data =
66+
MarketParameters(
67+
market.creator(),
68+
BinaryOptionMarket.Options(long, short),
69+
BinaryOptionMarket.Times(biddingEndDate, maturityDate, expiryDate),
70+
BinaryOptionMarket.OracleDetails(key, strikePrice, finalPrice),
71+
BinaryOptionMarketManager.Fees(poolFee, creatorFee, refundFee),
72+
BinaryOptionMarketManager.CreatorLimits(0, 0)
73+
);
7474

7575
// Stack too deep otherwise.
7676
(uint capitalRequirement, uint skewLimit) = market.creatorLimits();

contracts/BinaryOptionMarketFactory.sol

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import "./MixinResolver.sol";
77
// Internal references
88
import "./BinaryOptionMarket.sol";
99

10-
1110
// https://docs.synthetix.io/contracts/source/contracts/binaryoptionmarketfactory
1211
contract BinaryOptionMarketFactory is Owned, MixinResolver {
1312
/* ========== STATE VARIABLES ========== */

contracts/BinaryOptionMarketManager.sol

+13-15
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import "./interfaces/IExchangeRates.sol";
1818
import "./interfaces/ISystemStatus.sol";
1919
import "./interfaces/IERC20.sol";
2020

21-
2221
// https://docs.synthetix.io/contracts/source/contracts/binaryoptionmarketmanager
2322
contract BinaryOptionMarketManager is Owned, Pausable, MixinResolver, IBinaryOptionMarketManager {
2423
/* ========== LIBRARIES ========== */
@@ -262,16 +261,17 @@ contract BinaryOptionMarketManager is Owned, Pausable, MixinResolver, IBinaryOpt
262261
// Fees being in range are checked in the setters.
263262
// The market itself validates the capital and skew requirements.
264263

265-
BinaryOptionMarket market = _factory().createMarket(
266-
msg.sender,
267-
[creatorLimits.capitalRequirement, creatorLimits.skewLimit],
268-
oracleKey,
269-
strikePrice,
270-
refundsEnabled,
271-
[biddingEnd, maturity, expiry],
272-
bids,
273-
[fees.poolFee, fees.creatorFee, fees.refundFee]
274-
);
264+
BinaryOptionMarket market =
265+
_factory().createMarket(
266+
msg.sender,
267+
[creatorLimits.capitalRequirement, creatorLimits.skewLimit],
268+
oracleKey,
269+
strikePrice,
270+
refundsEnabled,
271+
[biddingEnd, maturity, expiry],
272+
bids,
273+
[fees.poolFee, fees.creatorFee, fees.refundFee]
274+
);
275275
market.rebuildCache();
276276
_activeMarkets.add(address(market));
277277

@@ -325,10 +325,8 @@ contract BinaryOptionMarketManager is Owned, Pausable, MixinResolver, IBinaryOpt
325325

326326
if (!success) {
327327
// handle legacy markets that used an old cache rebuilding logic
328-
bytes memory payloadForLegacyCache = abi.encodeWithSignature(
329-
"setResolverAndSyncCache(address)",
330-
address(resolver)
331-
);
328+
bytes memory payloadForLegacyCache =
329+
abi.encodeWithSignature("setResolverAndSyncCache(address)", address(resolver));
332330

333331
// solhint-disable avoid-low-level-calls
334332
(bool legacySuccess, ) = market.call(payloadForLegacyCache);

contracts/Bytes32SetLib.sol

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
pragma solidity ^0.5.16;
22

3-
43
// https://docs.synthetix.io/contracts/source/libraries/bytes32setlib/
54
library Bytes32SetLib {
65
struct Bytes32Set {

contracts/Collateral.sol

+18-18
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import "./interfaces/IExchangeRates.sol";
2121
import "./interfaces/IExchanger.sol";
2222
import "./interfaces/IShortingRewards.sol";
2323

24-
2524
contract Collateral is ICollateralLoan, Owned, MixinSystemSettings {
2625
/* ========== LIBRARIES ========== */
2726
using SafeMath for uint;
@@ -324,17 +323,18 @@ contract Collateral is ICollateralLoan, Owned, MixinSystemSettings {
324323
id = _manager().getNewLoanId();
325324

326325
// 10. Create the loan struct.
327-
Loan memory loan = Loan({
328-
id: id,
329-
account: msg.sender,
330-
collateral: collateral,
331-
currency: currency,
332-
amount: amount,
333-
short: short,
334-
accruedInterest: 0,
335-
interestIndex: 0,
336-
lastInteraction: block.timestamp
337-
});
326+
Loan memory loan =
327+
Loan({
328+
id: id,
329+
account: msg.sender,
330+
collateral: collateral,
331+
currency: currency,
332+
amount: amount,
333+
short: short,
334+
accruedInterest: 0,
335+
interestIndex: 0,
336+
lastInteraction: block.timestamp
337+
});
338338

339339
// 11. Accrue interest on the loan.
340340
loan = accrueInterest(loan);
@@ -684,14 +684,14 @@ contract Collateral is ICollateralLoan, Owned, MixinSystemSettings {
684684
loanAfter = loan;
685685

686686
// 1. Get the rates we need.
687-
(uint entryRate, uint lastRate, uint lastUpdated, uint newIndex) = loan.short
688-
? _manager().getShortRatesAndTime(loan.currency, loan.interestIndex)
689-
: _manager().getRatesAndTime(loan.interestIndex);
687+
(uint entryRate, uint lastRate, uint lastUpdated, uint newIndex) =
688+
loan.short
689+
? _manager().getShortRatesAndTime(loan.currency, loan.interestIndex)
690+
: _manager().getRatesAndTime(loan.interestIndex);
690691

691692
// 2. Get the instantaneous rate.
692-
(uint rate, bool invalid) = loan.short
693-
? _manager().getShortRate(synthsByKey[loan.currency])
694-
: _manager().getBorrowRate();
693+
(uint rate, bool invalid) =
694+
loan.short ? _manager().getShortRate(synthsByKey[loan.currency]) : _manager().getBorrowRate();
695695

696696
require(!invalid, "Rates are invalid");
697697

contracts/CollateralErc20.sol

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import "./interfaces/ICollateralErc20.sol";
1010
import "./CollateralState.sol";
1111
import "./interfaces/IERC20.sol";
1212

13-
1413
// This contract handles the specific ERC20 implementation details of managing a loan.
1514
contract CollateralErc20 is ICollateralErc20, Collateral {
1615
// The underlying asset for this ERC20 collateral

contracts/CollateralEth.sol

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import "./interfaces/ICollateralEth.sol";
1010
// Internal references
1111
import "./CollateralState.sol";
1212

13-
1413
// This contract handles the payable aspects of eth loans.
1514
contract CollateralEth is Collateral, ICollateralEth, ReentrancyGuard {
1615
mapping(address => uint) public pendingWithdrawals;

contracts/CollateralManager.sol

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import "./interfaces/IExchangeRates.sol";
1818
import "./interfaces/IERC20.sol";
1919
import "./interfaces/ISynth.sol";
2020

21-
2221
contract CollateralManager is ICollateralManager, Owned, Pausable, MixinResolver {
2322
/* ========== LIBRARIES ========== */
2423
using SafeMath for uint;

contracts/CollateralManagerState.sol

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import "./State.sol";
99
// Libraries
1010
import "./SafeDecimalMath.sol";
1111

12-
1312
contract CollateralManagerState is Owned, State {
1413
using SafeMath for uint;
1514
using SafeDecimalMath for uint;

contracts/CollateralShort.sol

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import "./Collateral.sol";
88
// Internal references
99
import "./CollateralState.sol";
1010

11-
1211
contract CollateralShort is Collateral {
1312
constructor(
1413
CollateralState _state,

contracts/CollateralState.sol

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import "./interfaces/ICollateralLoan.sol";
1010
// Libraries
1111
import "./SafeDecimalMath.sol";
1212

13-
1413
contract CollateralState is Owned, State, ICollateralLoan {
1514
using SafeMath for uint;
1615
using SafeDecimalMath for uint;

contracts/ContractStorage.sol

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pragma solidity ^0.5.16;
33
// Internal References
44
import "./interfaces/IAddressResolver.sol";
55

6-
76
// https://docs.synthetix.io/contracts/source/contracts/contractstorage
87
contract ContractStorage {
98
IAddressResolver public resolverProxy;
@@ -50,10 +49,8 @@ contract ContractStorage {
5049
/* ========== MODIFIERS ========== */
5150

5251
modifier onlyContract(bytes32 contractName) {
53-
address callingContract = resolverProxy.requireAndGetAddress(
54-
contractName,
55-
"Cannot find contract in Address Resolver"
56-
);
52+
address callingContract =
53+
resolverProxy.requireAndGetAddress(contractName, "Cannot find contract in Address Resolver");
5754
require(callingContract == msg.sender, "Can only be invoked by the configured contract");
5855
_;
5956
}

contracts/DappMaintenance.sol

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ pragma solidity ^0.5.16;
22

33
import "./Owned.sol";
44

5-
65
// https://docs.synthetix.io/contracts/source/contracts/dappmaintenance
76

87
/**

contracts/DebtCache.sol

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pragma solidity ^0.5.16;
33
// Inheritance
44
import "./BaseDebtCache.sol";
55

6-
76
// https://docs.synthetix.io/contracts/source/contracts/debtcache
87
contract DebtCache is BaseDebtCache {
98
constructor(address _owner, address _resolver) public BaseDebtCache(_owner, _resolver) {}

contracts/DelegateApprovals.sol

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import "./interfaces/IDelegateApprovals.sol";
77
// Internal references
88
import "./EternalStorage.sol";
99

10-
1110
// https://docs.synthetix.io/contracts/source/contracts/delegateapprovals
1211
contract DelegateApprovals is Owned, IDelegateApprovals {
1312
bytes32 public constant BURN_FOR_ADDRESS = "BurnForAddress";

0 commit comments

Comments
 (0)