Skip to content

Added additional upgrade mechanisms for deployment #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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