Skip to content

Commit

Permalink
Merge pull request #105 from Havven/add-additional-upgrade-mechanisms
Browse files Browse the repository at this point in the history
Added additional upgrade mechanisms for deployment
  • Loading branch information
thekevinbrown authored Dec 7, 2018
2 parents 128a6af + 35f8cbb commit 22ca406
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions contracts/Synth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ contract Synth is ExternStateToken {
emitBurned(account, amount);
}

// Allow owner to set the total supply on import.
function setTotalSupply(uint amount)
external
optionalProxy_onlyOwner
{
totalSupply = amount;
}

// Allow synthetix to trigger a token fallback call from our synths so users get notified on
// exchange as well as transfer
function triggerTokenFallbackIfNeeded(address sender, address recipient, uint amount)
Expand Down
10 changes: 8 additions & 2 deletions contracts/SynthetixState.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ contract SynthetixState is State, LimitedSetup {
// Global debt pool tracking
uint[] public debtLedger;

// Import state
uint public importedXDRAmount;

// A quantity of synths greater than this ratio
// may not be issued against a given value of SNX.
uint public issuanceRatio = SafeDecimalMath.unit() / 5;
Expand Down Expand Up @@ -210,12 +213,15 @@ contract SynthetixState is State, LimitedSetup {
// What is the value of the requested debt in XDRs?
uint xdrValue = synthetix.effectiveValue("sUSD", amount, "XDR");

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

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

// Save that for the next import.
importedXDRAmount = newTotalDebtIssued;

// What is their percentage (as a high precision int) of the total debt?
uint debtPercentage = xdrValue.divideDecimalRoundPrecise(newTotalDebtIssued);

Expand Down

0 comments on commit 22ca406

Please sign in to comment.