Skip to content

Commit

Permalink
Re-running npm format across the codebase (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
justin j. moses authored Apr 10, 2021
1 parent 13df268 commit b7f93c7
Show file tree
Hide file tree
Showing 148 changed files with 164 additions and 340 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
command: npx hardhat node
background: true
- cmd-wait-for-port:
port: 8545
port: 8545
- run: node publish deploy --network local --fresh-deploy --yes --use-ovm --ignore-safety-checks --ignore-custom-parameters --deployment-path ./publish/deployed/local-ovm
- run: npm run test:prod -- --no-compile --use-ovm --patch-fresh-deployment --deployment-path ./publish/deployed/local-ovm
job-prod-diff-tests-local:
Expand All @@ -109,7 +109,7 @@ jobs:
command: npx hardhat node
background: true
- cmd-wait-for-port:
port: 8545
port: 8545
- run: node publish deploy --network local --fresh-deploy --yes
- run: npm run test:prod -- --patch-fresh-deployment
job-prod-diff-tests:
Expand All @@ -129,7 +129,7 @@ jobs:
command: npx hardhat node --target-network mainnet
background: true
- cmd-wait-for-port:
port: 8545
port: 8545
- run: node publish prepare-deploy --network mainnet
- run: node publish deploy --ignore-safety-checks --add-new-synths --use-fork --yes --network mainnet
- run: npm run test:prod:gas -- --target-network mainnet --patch-fresh-deployment
Expand Down Expand Up @@ -159,9 +159,9 @@ jobs:
cd optimism-integration
./up.sh
- cmd-wait-for-port:
port: 8545
port: 8545
- cmd-wait-for-port:
port: 9545
port: 9545
- run:
name: Deploy OVM Synthetix instances
command: |
Expand All @@ -185,7 +185,7 @@ jobs:
command: npx hardhat node --target-network mainnet
background: true
- cmd-wait-for-port:
port: 8545
port: 8545
- run: npm run test:prod:gas -- --target-network mainnet
- run: npx codechecks codechecks.prod.yml
- store_artifacts:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ pragma solidity 0.5.16;
import 'synthetix/contracts/interfaces/IAddressResolver.sol';
import 'synthetix/contracts/interfaces/ISynthetix.sol';
contract MyContract {
// This should be instantiated with our ReadProxyAddressResolver
// it's a ReadProxy that won't change, so safe to code it here without a setter
Expand Down
1 change: 0 additions & 1 deletion contracts/AddressResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "./interfaces/IAddressResolver.sol";
import "./interfaces/IIssuer.sol";
import "./MixinResolver.sol";


// https://docs.synthetix.io/contracts/source/contracts/addressresolver
contract AddressResolver is Owned, IAddressResolver {
mapping(bytes32 => address) public repository;
Expand Down
1 change: 0 additions & 1 deletion contracts/AddressSetLib.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pragma solidity ^0.5.16;


// https://docs.synthetix.io/contracts/source/libraries/addresssetlib/
library AddressSetLib {
struct AddressSet {
Expand Down
6 changes: 2 additions & 4 deletions contracts/BaseDebtCache.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import "./interfaces/IEtherCollateralsUSD.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/ICollateralManager.sol";


// https://docs.synthetix.io/contracts/source/contracts/debtcache
contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
using SafeMath for uint;
Expand Down Expand Up @@ -150,9 +149,8 @@ contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {

bool isSUSD = key == sUSD;
if (isSUSD || key == sETH) {
IEtherCollateral etherCollateralContract = isSUSD
? IEtherCollateral(address(etherCollateralsUSD()))
: etherCollateral();
IEtherCollateral etherCollateralContract =
isSUSD ? IEtherCollateral(address(etherCollateralsUSD())) : etherCollateral();
uint etherCollateralSupply = etherCollateralContract.totalIssuedSynths();
supply = supply.sub(etherCollateralSupply);
}
Expand Down
1 change: 0 additions & 1 deletion contracts/BaseRewardEscrowV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import "./interfaces/IFeePool.sol";
import "./interfaces/ISynthetix.sol";
import "./interfaces/IIssuer.sol";


// https://docs.synthetix.io/contracts/RewardEscrow
contract BaseRewardEscrowV2 is Owned, IRewardEscrowV2, LimitedSetup(8 weeks), MixinResolver {
using SafeMath for uint;
Expand Down
12 changes: 4 additions & 8 deletions contracts/BaseSynthetix.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import "./interfaces/IIssuer.sol";
import "./interfaces/IRewardsDistribution.sol";
import "./interfaces/IVirtualSynth.sol";


contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix {
// ========== STATE VARIABLES ==========

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

if (initialDebtOwnership > 0) {
(uint transferable, bool anyRateIsInvalid) = issuer().transferableSynthetixAndAnyRateIsInvalid(
account,
tokenState.balanceOf(account)
);
(uint transferable, bool anyRateIsInvalid) =
issuer().transferableSynthetixAndAnyRateIsInvalid(account, tokenState.balanceOf(account));
require(value <= transferable, "Cannot transfer staked or escrowed SNX");
require(!anyRateIsInvalid, "A synth or SNX rate is invalid");
}
Expand Down Expand Up @@ -373,9 +370,8 @@ contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix {
uint256 toAmount,
address toAddress
);
bytes32 internal constant SYNTHEXCHANGE_SIG = keccak256(
"SynthExchange(address,bytes32,uint256,bytes32,uint256,address)"
);
bytes32 internal constant SYNTHEXCHANGE_SIG =
keccak256("SynthExchange(address,bytes32,uint256,bytes32,uint256,address)");

function emitSynthExchange(
address account,
Expand Down
1 change: 0 additions & 1 deletion contracts/BinaryOption.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "./SafeDecimalMath.sol";
// Internal references
import "./BinaryOptionMarket.sol";


// https://docs.synthetix.io/contracts/source/contracts/binaryoption
contract BinaryOption is IERC20, IBinaryOption {
/* ========== LIBRARIES ========== */
Expand Down
1 change: 0 additions & 1 deletion contracts/BinaryOptionMarket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import "./interfaces/IExchangeRates.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IFeePool.sol";


// https://docs.synthetix.io/contracts/source/contracts/binaryoptionmarket
contract BinaryOptionMarket is Owned, MixinResolver, IBinaryOptionMarket {
/* ========== LIBRARIES ========== */
Expand Down
18 changes: 9 additions & 9 deletions contracts/BinaryOptionMarketData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "./BinaryOption.sol";
import "./BinaryOptionMarket.sol";
import "./BinaryOptionMarketManager.sol";


// https://docs.synthetix.io/contracts/source/contracts/binaryoptionmarketdata
contract BinaryOptionMarketData {
struct OptionValues {
Expand Down Expand Up @@ -63,14 +62,15 @@ contract BinaryOptionMarketData {
(bytes32 key, uint strikePrice, uint finalPrice) = market.oracleDetails();
(uint poolFee, uint creatorFee, uint refundFee) = market.fees();

MarketParameters memory data = MarketParameters(
market.creator(),
BinaryOptionMarket.Options(long, short),
BinaryOptionMarket.Times(biddingEndDate, maturityDate, expiryDate),
BinaryOptionMarket.OracleDetails(key, strikePrice, finalPrice),
BinaryOptionMarketManager.Fees(poolFee, creatorFee, refundFee),
BinaryOptionMarketManager.CreatorLimits(0, 0)
);
MarketParameters memory data =
MarketParameters(
market.creator(),
BinaryOptionMarket.Options(long, short),
BinaryOptionMarket.Times(biddingEndDate, maturityDate, expiryDate),
BinaryOptionMarket.OracleDetails(key, strikePrice, finalPrice),
BinaryOptionMarketManager.Fees(poolFee, creatorFee, refundFee),
BinaryOptionMarketManager.CreatorLimits(0, 0)
);

// Stack too deep otherwise.
(uint capitalRequirement, uint skewLimit) = market.creatorLimits();
Expand Down
1 change: 0 additions & 1 deletion contracts/BinaryOptionMarketFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import "./MixinResolver.sol";
// Internal references
import "./BinaryOptionMarket.sol";


// https://docs.synthetix.io/contracts/source/contracts/binaryoptionmarketfactory
contract BinaryOptionMarketFactory is Owned, MixinResolver {
/* ========== STATE VARIABLES ========== */
Expand Down
28 changes: 13 additions & 15 deletions contracts/BinaryOptionMarketManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import "./interfaces/IExchangeRates.sol";
import "./interfaces/ISystemStatus.sol";
import "./interfaces/IERC20.sol";


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

BinaryOptionMarket market = _factory().createMarket(
msg.sender,
[creatorLimits.capitalRequirement, creatorLimits.skewLimit],
oracleKey,
strikePrice,
refundsEnabled,
[biddingEnd, maturity, expiry],
bids,
[fees.poolFee, fees.creatorFee, fees.refundFee]
);
BinaryOptionMarket market =
_factory().createMarket(
msg.sender,
[creatorLimits.capitalRequirement, creatorLimits.skewLimit],
oracleKey,
strikePrice,
refundsEnabled,
[biddingEnd, maturity, expiry],
bids,
[fees.poolFee, fees.creatorFee, fees.refundFee]
);
market.rebuildCache();
_activeMarkets.add(address(market));

Expand Down Expand Up @@ -325,10 +325,8 @@ contract BinaryOptionMarketManager is Owned, Pausable, MixinResolver, IBinaryOpt

if (!success) {
// handle legacy markets that used an old cache rebuilding logic
bytes memory payloadForLegacyCache = abi.encodeWithSignature(
"setResolverAndSyncCache(address)",
address(resolver)
);
bytes memory payloadForLegacyCache =
abi.encodeWithSignature("setResolverAndSyncCache(address)", address(resolver));

// solhint-disable avoid-low-level-calls
(bool legacySuccess, ) = market.call(payloadForLegacyCache);
Expand Down
1 change: 0 additions & 1 deletion contracts/Bytes32SetLib.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pragma solidity ^0.5.16;


// https://docs.synthetix.io/contracts/source/libraries/bytes32setlib/
library Bytes32SetLib {
struct Bytes32Set {
Expand Down
36 changes: 18 additions & 18 deletions contracts/Collateral.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import "./interfaces/IExchangeRates.sol";
import "./interfaces/IExchanger.sol";
import "./interfaces/IShortingRewards.sol";


contract Collateral is ICollateralLoan, Owned, MixinSystemSettings {
/* ========== LIBRARIES ========== */
using SafeMath for uint;
Expand Down Expand Up @@ -324,17 +323,18 @@ contract Collateral is ICollateralLoan, Owned, MixinSystemSettings {
id = _manager().getNewLoanId();

// 10. Create the loan struct.
Loan memory loan = Loan({
id: id,
account: msg.sender,
collateral: collateral,
currency: currency,
amount: amount,
short: short,
accruedInterest: 0,
interestIndex: 0,
lastInteraction: block.timestamp
});
Loan memory loan =
Loan({
id: id,
account: msg.sender,
collateral: collateral,
currency: currency,
amount: amount,
short: short,
accruedInterest: 0,
interestIndex: 0,
lastInteraction: block.timestamp
});

// 11. Accrue interest on the loan.
loan = accrueInterest(loan);
Expand Down Expand Up @@ -684,14 +684,14 @@ contract Collateral is ICollateralLoan, Owned, MixinSystemSettings {
loanAfter = loan;

// 1. Get the rates we need.
(uint entryRate, uint lastRate, uint lastUpdated, uint newIndex) = loan.short
? _manager().getShortRatesAndTime(loan.currency, loan.interestIndex)
: _manager().getRatesAndTime(loan.interestIndex);
(uint entryRate, uint lastRate, uint lastUpdated, uint newIndex) =
loan.short
? _manager().getShortRatesAndTime(loan.currency, loan.interestIndex)
: _manager().getRatesAndTime(loan.interestIndex);

// 2. Get the instantaneous rate.
(uint rate, bool invalid) = loan.short
? _manager().getShortRate(synthsByKey[loan.currency])
: _manager().getBorrowRate();
(uint rate, bool invalid) =
loan.short ? _manager().getShortRate(synthsByKey[loan.currency]) : _manager().getBorrowRate();

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

Expand Down
1 change: 0 additions & 1 deletion contracts/CollateralErc20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "./interfaces/ICollateralErc20.sol";
import "./CollateralState.sol";
import "./interfaces/IERC20.sol";


// This contract handles the specific ERC20 implementation details of managing a loan.
contract CollateralErc20 is ICollateralErc20, Collateral {
// The underlying asset for this ERC20 collateral
Expand Down
1 change: 0 additions & 1 deletion contracts/CollateralEth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "./interfaces/ICollateralEth.sol";
// Internal references
import "./CollateralState.sol";


// This contract handles the payable aspects of eth loans.
contract CollateralEth is Collateral, ICollateralEth, ReentrancyGuard {
mapping(address => uint) public pendingWithdrawals;
Expand Down
1 change: 0 additions & 1 deletion contracts/CollateralManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import "./interfaces/IExchangeRates.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/ISynth.sol";


contract CollateralManager is ICollateralManager, Owned, Pausable, MixinResolver {
/* ========== LIBRARIES ========== */
using SafeMath for uint;
Expand Down
1 change: 0 additions & 1 deletion contracts/CollateralManagerState.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "./State.sol";
// Libraries
import "./SafeDecimalMath.sol";


contract CollateralManagerState is Owned, State {
using SafeMath for uint;
using SafeDecimalMath for uint;
Expand Down
1 change: 0 additions & 1 deletion contracts/CollateralShort.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "./Collateral.sol";
// Internal references
import "./CollateralState.sol";


contract CollateralShort is Collateral {
constructor(
CollateralState _state,
Expand Down
1 change: 0 additions & 1 deletion contracts/CollateralState.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "./interfaces/ICollateralLoan.sol";
// Libraries
import "./SafeDecimalMath.sol";


contract CollateralState is Owned, State, ICollateralLoan {
using SafeMath for uint;
using SafeDecimalMath for uint;
Expand Down
7 changes: 2 additions & 5 deletions contracts/ContractStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity ^0.5.16;
// Internal References
import "./interfaces/IAddressResolver.sol";


// https://docs.synthetix.io/contracts/source/contracts/contractstorage
contract ContractStorage {
IAddressResolver public resolverProxy;
Expand Down Expand Up @@ -50,10 +49,8 @@ contract ContractStorage {
/* ========== MODIFIERS ========== */

modifier onlyContract(bytes32 contractName) {
address callingContract = resolverProxy.requireAndGetAddress(
contractName,
"Cannot find contract in Address Resolver"
);
address callingContract =
resolverProxy.requireAndGetAddress(contractName, "Cannot find contract in Address Resolver");
require(callingContract == msg.sender, "Can only be invoked by the configured contract");
_;
}
Expand Down
1 change: 0 additions & 1 deletion contracts/DappMaintenance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ pragma solidity ^0.5.16;

import "./Owned.sol";


// https://docs.synthetix.io/contracts/source/contracts/dappmaintenance

/**
Expand Down
1 change: 0 additions & 1 deletion contracts/DebtCache.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity ^0.5.16;
// Inheritance
import "./BaseDebtCache.sol";


// https://docs.synthetix.io/contracts/source/contracts/debtcache
contract DebtCache is BaseDebtCache {
constructor(address _owner, address _resolver) public BaseDebtCache(_owner, _resolver) {}
Expand Down
1 change: 0 additions & 1 deletion contracts/DelegateApprovals.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import "./interfaces/IDelegateApprovals.sol";
// Internal references
import "./EternalStorage.sol";


// https://docs.synthetix.io/contracts/source/contracts/delegateapprovals
contract DelegateApprovals is Owned, IDelegateApprovals {
bytes32 public constant BURN_FOR_ADDRESS = "BurnForAddress";
Expand Down
Loading

0 comments on commit b7f93c7

Please sign in to comment.