Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
bd54f4e
ci: improvements and maintenance (#1510)
drptbl Sep 21, 2021
2a3cd7e
Fix fork tests by upgrading fork to London (#1515)
dbeal-eth Sep 22, 2021
96be7e1
SIP-135 Refactor Collateral contracts for L2 shorts (#1448)
barrasso Sep 22, 2021
c53070d
fix slither crashing in CI and local (#1519)
artdgn Sep 23, 2021
333b07b
Adding gnosis safe multisend functionality to owner (#1513)
Sep 24, 2021
bbbb0c3
SIP-135 Cleanup (#1522)
barrasso Sep 24, 2021
98e46fa
Prepping for the Sargas (2.50) release to OVM (#1526)
Sep 25, 2021
9e26043
Fixing settle for ethers (#1509)
Sep 27, 2021
91ac866
Reduce gas usage for opening loans (#1529)
barrasso Sep 28, 2021
aad6caf
Print deploy param object value (#1534)
barrasso Sep 28, 2021
5e48e5a
add slither code check github integration (#1523)
artdgn Sep 30, 2021
645a49c
Refactor exceedsDebtLimit check (#1539)
barrasso Sep 30, 2021
744265a
Removing unneeded kovan contracts (#1538)
Oct 1, 2021
07c85e5
ci: lavamoat integration (#1517)
drptbl Oct 3, 2021
f84eca5
CI: add codeql (#1544)
drptbl Oct 4, 2021
9a8384a
Adds block tag parameter to interact task (#1528) (#1536)
Oct 4, 2021
294f325
ci: slither github actions improvements (#1543)
drptbl Oct 4, 2021
963f266
Removing integrationProxy from Proxyable (#1521)
Oct 5, 2021
eb88a85
Fix prepare deploy (#1548)
barrasso Oct 6, 2021
28b6f95
Document debt cache (#1533)
liamzebedee Oct 7, 2021
b36a057
Updating packages for audits and temporarily disabling the audit chec…
jjgonecrypto Oct 7, 2021
fded644
ci: fail audit on critical severity (#1557)
drptbl Oct 12, 2021
0f9fcc0
ci: update docker containers to node@14.18 (#1558)
drptbl Oct 12, 2021
ce6d79d
Merge branch 'master' into develop
jjgonecrypto Oct 12, 2021
476c5a4
During deployment, ensure deprecated synths from Wezen have cache upd…
jjgonecrypto Oct 14, 2021
5f8c732
Update configure loans interactionDelay (#1568)
barrasso Oct 14, 2021
f1fcfcf
update deployer to support EIP-1559 (#1504)
dbeal-eth Oct 15, 2021
963d78d
SIP-187 fix partial synth updates and debt cache updates (#1551)
jacko125 Oct 19, 2021
1172632
remove gasPrice overrides from simulate-deploy (#1573)
dbeal-eth Oct 19, 2021
1f0c027
Merge branch 'master' into develop
jjgonecrypto Oct 20, 2021
795f1c7
SIP-182 Wrapper Factory (#1489)
dbeal-eth Oct 26, 2021
9d6ac2e
SIP-182 Audit feedback - allowance in constructor (#1584)
barrasso Oct 27, 2021
0743256
Merge branch 'master' into develop
jjgonecrypto Oct 28, 2021
94987e3
Fix param spam during deployment (#1587)
barrasso Oct 29, 2021
defb035
add expalantion about releases.json in readme (#1569)
artdgn Nov 2, 2021
1c126e1
ci: use node 16 (LTS) (#1588)
drptbl Nov 2, 2021
913d0b3
Removing inverse synths (#1592)
jjgonecrypto Nov 3, 2021
963c7a5
Ensuring SCCP-139 feeds are persisted to future ExchangeRates contrac…
jjgonecrypto Nov 3, 2021
76d43ce
Skip shorts integration tests when cannot open loans (#1597)
jjgonecrypto Nov 10, 2021
073cb12
Add default private key for local-ovm deploys (#1455)
liamzebedee Nov 15, 2021
f2172c3
SIP-120: TWAP Exchange Function (#1127)
sohkai Nov 15, 2021
509688a
Adding 6 more potential releases
jjgonecrypto Nov 15, 2021
472d20e
Merge branch 'master' into develop
jjgonecrypto Nov 17, 2021
dac3532
Fixing owner script to not submit multiple accept for dupe contracts
jjgonecrypto Nov 17, 2021
2bd3ceb
Upgrading to OVM 2.0 (or the destruction of useless code) (#1598)
jjgonecrypto Nov 18, 2021
682a2ef
Minor fixes for release history
jjgonecrypto Nov 18, 2021
9f38d1a
SIP-167 Introduces an L2 governance bridge (#1402)
eternauta1337 Nov 23, 2021
5c9b643
Removing mistake
jjgonecrypto Nov 23, 2021
fe6a61a
Merge branch 'master' into develop
jjgonecrypto Nov 23, 2021
6a5b7b2
Fixes from menkalinan (#1608)
jjgonecrypto Nov 24, 2021
ffc3d61
Update OVM bytecode (#1613)
barrasso Dec 1, 2021
69fb372
Move debt snapshot to beforeEach block (#1616)
barrasso Dec 1, 2021
1f6dd63
Fix duplicate fee reporting on WrapperFactory (#1617)
dbeal-eth Dec 3, 2021
e1cdc23
Merge branch 'master' into develop
jjgonecrypto Dec 3, 2021
437f62f
SIP-194 Fix Liquidations on L2 (#1621)
jjgonecrypto Dec 7, 2021
92fe9e7
Fix broken unit test (#1622)
jjgonecrypto Dec 8, 2021
af2813c
Ensuring job-compile size check matches build command (#1628)
jjgonecrypto Dec 9, 2021
b898b4e
Adding exchange gas usage output
jjgonecrypto Dec 13, 2021
f734d9a
Adding gas output to synth issue, burn and claim in int tests
jjgonecrypto Dec 13, 2021
b93863a
SIP-188: Add sETHBTC synth (#1618)
barrasso Dec 13, 2021
828c24e
SIP-195: L2 CollateralEth Loans (#1632)
barrasso Dec 15, 2021
4513b16
Merge branch 'master' into develop
jjgonecrypto Dec 15, 2021
4c981ba
Sip 196 remove internal oracle (#1636)
artdgn Dec 22, 2021
61eca39
add liquidation tests in integration (#1625)
dbeal-eth Dec 30, 2021
a88b2ee
use new `hardhat-interact` package instead of builtin (#1612)
dbeal-eth Jan 10, 2022
d34061c
fix liquidations fork test fail (#1646)
dbeal-eth Jan 11, 2022
54a9c52
SIP-193 Reduce size for SystemSettings (#1627)
leckylao Jan 13, 2022
2d56244
Update configuration of loan and system settings (#1637)
barrasso Jan 13, 2022
ab736f0
SIP-200: Fix FeePool Rewards Distribution (#1650)
barrasso Jan 14, 2022
5a5f6f6
migration script helper allows deployment and staging of migration sc…
dbeal-eth Jan 14, 2022
9adafe3
Merge branch 'master' into develop
jjgonecrypto Jan 19, 2022
ccda4a7
SIP-184 Dynamic Fees (#1649)
artdgn Jan 20, 2022
b3012b0
Deploy SNX/ETH and sUSD/DAI staking rewards on OVM (#1653)
jacko125 Jan 21, 2022
702dc30
remove old RewardEscrow from deployment.json for ovm environments (#1…
barrasso Jan 21, 2022
6b7655e
Update kovan-ovm/feeds.json for OCR (#1659)
barrasso Jan 21, 2022
84ab991
Update feeds.json for kovan ovm with new OCR proxies (#1664)
barrasso Jan 25, 2022
69bb32a
Optimism Forking with Hardhat (#1656)
dbeal-eth Jan 26, 2022
74e1b11
Remove legacy deployment config from kovan-ovm (#1665)
barrasso Jan 27, 2022
e6ce2b7
Upgrade Gnosis SDK (#1655)
noahlitvin Jan 27, 2022
9f38be7
SIPS 196, 193, 184 - audit fixes, full version (#1661)
artdgn Jan 27, 2022
e53c9c0
fix test lints (#1607)
dbeal-eth Jan 28, 2022
a265c9d
update migration script to also stage nominations (#1670)
dbeal-eth Feb 1, 2022
78c2622
Merge branch 'master' into develop
jjgonecrypto Feb 3, 2022
18af676
Removing redundant ExchangeRatesWithInversePricing
jjgonecrypto Feb 3, 2022
6038c76
Ensuring fork tests do compile (#1679)
jjgonecrypto Feb 3, 2022
f15cdbc
Sip 185 debt shares (#1601)
dbeal-eth Feb 4, 2022
3cb6efb
Fix the validate deployment CI run (#1680)
jjgonecrypto Feb 4, 2022
204b13b
Removing the redundant owner param from migrations (#1681)
jjgonecrypto Feb 4, 2022
9652047
Collecting Test Metadata in CI (#1683)
noahlitvin Feb 4, 2022
74acf14
SIP-209 Update feeRateForExchange function signature (#1686)
barrasso Feb 5, 2022
d5a336a
Merge branch 'master' into develop
jjgonecrypto Feb 7, 2022
24acb9c
Updating task-node to properly manage the provider
jjgonecrypto Feb 8, 2022
3b109b4
Basic npm audit fix (#1693)
jjgonecrypto Feb 9, 2022
5e25a0b
Merge branch 'master' into develop
jjgonecrypto Feb 9, 2022
86fed3d
Updating mainnet-ovm feeds to new chainlink OCR (#1645)
jjgonecrypto Feb 14, 2022
ce9a5c8
Add SOL mainnet ovm feed
barrasso Feb 14, 2022
bba9562
add moar releases (#1698)
barrasso Feb 14, 2022
4652976
Merge branch 'develop' into polaris-release-2.61
jjgonecrypto Feb 14, 2022
a327690
Updating lockfile
jjgonecrypto Feb 14, 2022
5480cd1
Adding SIP-199 to Polaris
jjgonecrypto Feb 14, 2022
852c1c9
Removing Polaris L1 from release
jjgonecrypto Feb 14, 2022
561ba35
Minor fixes from SIP-185 for cleaner deployment
jjgonecrypto Feb 14, 2022
df1c8ac
Adding SOL synth and asset
jjgonecrypto Feb 14, 2022
b5fe74f
Fixing owner to a) use skipAcceptance and b) confirm before submittin…
jjgonecrypto Feb 14, 2022
8661707
Ensuring SIP-199 sSOL added to shorting on L2
jjgonecrypto Feb 14, 2022
d69d69a
Polaris deployment to mainnet
jjgonecrypto Feb 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions contracts/Issuer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,19 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {
return getIssuanceRatio();
}

function _debtSharesToIssuedSynth(uint debtAmount, uint totalSystemValue, uint totalDebtShares) internal pure returns (uint) {
function _debtSharesToIssuedSynth(
uint debtAmount,
uint totalSystemValue,
uint totalDebtShares
) internal pure returns (uint) {
return debtAmount.multiplyDecimalRound(totalSystemValue).divideDecimalRound(totalDebtShares);
}

function _issuedSynthToDebtShares(uint sharesAmount, uint totalSystemValue, uint totalDebtShares) internal pure returns (uint) {
function _issuedSynthToDebtShares(
uint sharesAmount,
uint totalSystemValue,
uint totalDebtShares
) internal pure returns (uint) {
return sharesAmount.multiplyDecimalRound(totalDebtShares).divideDecimalRound(totalSystemValue);
}

Expand Down Expand Up @@ -214,7 +222,6 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {
bool anyRateIsInvalid
)
{

// What's the total value of the system excluding ETH backed synths in their requested currency?
(totalSystemValue, anyRateIsInvalid) = _totalIssuedSynths(currencyKey, true);

Expand Down Expand Up @@ -245,7 +252,10 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {
bool anyRateIsInvalid
)
{
(alreadyIssued, totalSystemDebt, anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(_issuer), sUSD);
(alreadyIssued, totalSystemDebt, anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(
synthetixDebtShare().balanceOf(_issuer),
sUSD
);
(uint issuable, bool isInvalid) = _maxIssuableSynths(_issuer);
maxIssuable = issuable;
anyRateIsInvalid = anyRateIsInvalid || isInvalid;
Expand Down Expand Up @@ -277,7 +287,8 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {
function _collateralisationRatio(address _issuer) internal view returns (uint, bool) {
uint totalOwnedSynthetix = _collateral(_issuer);

(uint debtBalance, , bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(_issuer), SNX);
(uint debtBalance, , bool anyRateIsInvalid) =
_debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(_issuer), SNX);

// it's more gas intensive to put this check here if they have 0 SNX, but it complies with the interface
if (totalOwnedSynthetix == 0) return (0, anyRateIsInvalid);
Expand Down Expand Up @@ -578,7 +589,8 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {
uint liquidationPenalty = liquidations().liquidationPenalty();

// What is their debt in sUSD?
(uint debtBalance, uint totalDebtIssued, bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(account), sUSD);
(uint debtBalance, uint totalDebtIssued, bool anyRateIsInvalid) =
_debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(account), sUSD);
(uint snxRate, bool snxRateInvalid) = exchangeRates().rateAndInvalid(SNX);
_requireRatesNotInvalid(anyRateIsInvalid || snxRateInvalid);

Expand Down Expand Up @@ -647,7 +659,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {
uint amount,
bool issueMax
) internal {
(uint maxIssuable, uint existingDebt, uint totalSystemDebt, bool anyRateIsInvalid) = _remainingIssuableSynths(from);
(uint maxIssuable, , uint totalSystemDebt, bool anyRateIsInvalid) = _remainingIssuableSynths(from);
_requireRatesNotInvalid(anyRateIsInvalid);

if (!issueMax) {
Expand Down Expand Up @@ -710,7 +722,8 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {
}
}

(uint existingDebt, uint totalSystemValue, bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(from), sUSD);
(uint existingDebt, uint totalSystemValue, bool anyRateIsInvalid) =
_debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(from), sUSD);
(uint maxIssuableSynthsForAccount, bool snxRateInvalid) = _maxIssuableSynths(from);
_requireRatesNotInvalid(anyRateIsInvalid || snxRateInvalid);
require(existingDebt > 0, "No debt to forgive");
Expand Down Expand Up @@ -748,8 +761,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {
// in which case, the first account to mint gets the debt. yw.
if (sds.totalSupply() == 0) {
sds.mintShare(from, amount);
}
else {
} else {
sds.mintShare(from, _issuedSynthToDebtShares(amount, totalDebtIssued, sds.totalSupply()));
}
}
Expand All @@ -766,8 +778,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer {

if (debtToRemove == existingDebt) {
sds.burnShare(from, currentDebtShare);
}
else {
} else {
uint balanceToRemove = _issuedSynthToDebtShares(debtToRemove, totalDebtIssued, sds.totalSupply());
sds.burnShare(from, balanceToRemove < currentDebtShare ? balanceToRemove : currentDebtShare);
}
Expand Down
Loading