Skip to content

Commit 22ca406

Browse files
Merge pull request #105 from Havven/add-additional-upgrade-mechanisms
Added additional upgrade mechanisms for deployment
2 parents 128a6af + 35f8cbb commit 22ca406

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

contracts/Synth.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ contract Synth is ExternStateToken {
289289
emitBurned(account, amount);
290290
}
291291

292+
// Allow owner to set the total supply on import.
293+
function setTotalSupply(uint amount)
294+
external
295+
optionalProxy_onlyOwner
296+
{
297+
totalSupply = amount;
298+
}
299+
292300
// Allow synthetix to trigger a token fallback call from our synths so users get notified on
293301
// exchange as well as transfer
294302
function triggerTokenFallbackIfNeeded(address sender, address recipient, uint amount)

contracts/SynthetixState.sol

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ contract SynthetixState is State, LimitedSetup {
7171
// Global debt pool tracking
7272
uint[] public debtLedger;
7373

74+
// Import state
75+
uint public importedXDRAmount;
76+
7477
// A quantity of synths greater than this ratio
7578
// may not be issued against a given value of SNX.
7679
uint public issuanceRatio = SafeDecimalMath.unit() / 5;
@@ -210,12 +213,15 @@ contract SynthetixState is State, LimitedSetup {
210213
// What is the value of the requested debt in XDRs?
211214
uint xdrValue = synthetix.effectiveValue("sUSD", amount, "XDR");
212215

213-
// What is the value of all issued synths of the system (priced in XDRs)?
214-
uint totalDebtIssued = synthetix.totalIssuedSynths("XDR");
216+
// What is the value that we've previously imported?
217+
uint totalDebtIssued = importedXDRAmount;
215218

216219
// What will the new total be including the new value?
217220
uint newTotalDebtIssued = xdrValue.add(totalDebtIssued);
218221

222+
// Save that for the next import.
223+
importedXDRAmount = newTotalDebtIssued;
224+
219225
// What is their percentage (as a high precision int) of the total debt?
220226
uint debtPercentage = xdrValue.divideDecimalRoundPrecise(newTotalDebtIssued);
221227

0 commit comments

Comments
 (0)