Skip to content

Commit

Permalink
RC7 -> RC8 (#9865)
Browse files Browse the repository at this point in the history
* Squashed commit of the following:

commit 7f44cef
Author: Martin Volpe <martin.volpe@gmail.com>
Date:   Fri May 13 15:10:45 2022 +0200

    Fixed release versions

commit 24968ec
Author: Martin Volpe <martin.volpe@gmail.com>
Date:   Fri May 13 15:09:06 2022 +0200

    Added newline at the end

commit 1e70975
Author: Marcin Chrzanowski <martin@clabs.co>
Date:   Tue Feb 22 10:18:55 2022 -0500

    Add version report

commit 8457f40
Author: Marcin Chrzanowski <martin@clabs.co>
Date:   Tue Feb 15 11:06:21 2022 -0500

    Add empty initialization data for release 6

commit a924915
Author: Martín Volpe <volpe@clabs.co>
Date:   Mon May 9 22:24:24 2022 +0200

    Fix Oracle check (#9527)

commit 292c443
Author: Nina Barbakadze <barbakadzeninaa@gmail.com>
Date:   Wed May 4 14:36:53 2022 +0200

    Consistent code across GrandaMento and Exchange in setSpread (#9459)

commit 3cfceab
Author: Nina Barbakadze <barbakadzeninaa@gmail.com>
Date:   Thu Apr 28 15:45:35 2022 +0200

    Restored a missing test (#9460)

    Authored-by: Nina Barbakadze <ninabarbakadze@macbook-pro-4.localdomain>

commit 0b51c65
Author: Martin <martin@clabs.co>
Date:   Fri Mar 11 11:09:29 2022 +0100

    Remove oracle check (#9367)

    ### Description

    A check in the Reserve's `addToken` function appeared to be a blocker for getting quicker, single-proposal stable token deployments. The check may have been important in the past, back when the Reserve was responsible for minting/burning stable tokens, and the `isToken` mapping set in the `addToken` function was used for permissioning these behaviors. However, looking at both the monorepo contracts and celo-blockchain, the `isToken` mapping and `_tokens` list of tokens are not used anywhere, thus the check is safe to remove. See [here](#9195 (comment)) for more details.

    ### Tested

    Tests still pass.

    ### Related issues

    - Fixes #9197

commit a84a845
Author: Eela Nagaraj <7308464+eelanagaraj@users.noreply.github.com>
Date:   Thu Mar 10 16:10:37 2022 +0000

    Update default config file (#9372)

    ### Description

    Tiny PR that goes with [this docs PR](https://github.com/celo-org/docs/compare/eelanagaraj/link-10dlc-guidance?expand=1) update AS docs related to 10 DLC compliance.

commit 3e9f8e4
Author: Gaston Ponti <pontigaston@gmail.com>
Date:   Wed Mar 9 13:37:04 2022 -0300

    TxLookupLimit default to infinite (#9380)

    ### Description

    TxLookupLimit default to infinite (as it was before)

    ### Backwards compatibility

    Yes

commit 1cc59c7
Author: Martin <martin@clabs.co>
Date:   Wed Mar 9 09:41:21 2022 +0100

    Test LinkedList.remove (#9377)

commit 0edc59d
Author: Edwin O <okonkwo.ikechukwu01@gmail.com>
Date:   Fri Mar 4 14:28:13 2022 +0100

    Get pending withdrawal (#9369)

    ### Description

    LockedGold.sol currently provides a way to retrieve all pendingWithdrawals associated to a given account.

    To be able to extract a pendingWithdrawal at specific index, one would need to first do getPendingWithdrawals and then loop through the result to find the record 0(n) and has a DOS vector as found by @tkporter

    ### Tested

    - [x] unit test

    ### Related issues
     https://app.zenhub.com/workspaces/yield-61b75a715d3ecb001007ab9d/issues/celo-org/yield/16

    ### Backwards compatibility

    _Brief explanation of why these changes are/are not backwards compatible._
    This change is backward compatible because it is completely transparent and does not modify existing function signatures etc

commit 84194c7
Author: Eela Nagaraj <7308464+eelanagaraj@users.noreply.github.com>
Date:   Wed Mar 2 16:58:22 2022 +0100

    Update geth version and AS image tag (#9363)

commit a4af8e4
Author: Victor "Nate" Graf <victor@clabs.co>
Date:   Wed Mar 2 00:26:36 2022 -0800

    Update Baklava nodes to celo-blockchain 1.5.4 (#9355)

    ### Description

    Update the version of cLabs `celo-blockchain` nodes in the Baklava testnet to 1.5.4

commit 40f67a3
Author: pedro-clabs <77401336+pedro-clabs@users.noreply.github.com>
Date:   Tue Mar 1 17:07:29 2022 +0000

    Add mainnet CELOBRL oracles. (#9105)

    ### Tested

    Deployed to mainnet.

commit 22faf4e
Author: Emil Hotkowski <emil.hotkowski@gmail.com>
Date:   Mon Feb 28 17:35:46 2022 +0100

    Attestation service pepper verification (#8692)

    ### Description

    I added new, optional verification of odis pepper.

    ### Tested

    I added tests.

    ### Backwards compatibility

    The new field is for now optional, and only when provided we do the verification.

commit cf87ed1
Author: Cody Born <codyborn@outlook.com>
Date:   Mon Feb 28 05:08:12 2022 -0800

    Fix env var name for API key (#9340)

    ### Description

    ODIS Forno API Key env var was specified incorrectly.

    ### Tested

    Tested in Alfajores.

commit 81f84eb
Author: Martín Volpe <martin.volpe@gmail.com>
Date:   Fri Feb 25 16:13:08 2022 -0300

    Update oracles full nodes to version 1.5.3 (#9339)

commit 8d3f3f0
Author: Cody Born <codyborn@outlook.com>
Date:   Tue Feb 22 04:14:41 2022 -0800

    Use Forno API key in Signer (#9334)

    * Update combiner to leverage new CK client

    * Config var name must be all lowercase

    * update yarn.lock

    * Add Forno API key to Signer requests

    * Update operator docs

    * Update signer deployment tool

    * Add ODIS Signer API keys

commit 19e2f13
Author: Alec Schaefer <alec@cLabs.co>
Date:   Fri Feb 18 11:54:55 2022 -0500

    ODIS monitor fix (#9303)

    ### Description

    Fixes ODIS monitor function

    Disables domain endpoints

    Adds version number check to signer (and combiner, but the combiner status endpoint has apparently never worked)

    Updates package version numbers for deployment

    ### Other changes

    Version changes to facilitate release of ODIS combiner, signer, and monitor

    ### Tested

    NA

    ### Related issues

    NA

    ### Backwards compatibility

    Yes

    ### Documentation

    NA

commit ff9d776
Author: Valentin Rodygin <valentin@clabs.co>
Date:   Fri Feb 18 11:27:13 2022 +0100

    Config params for the stats page in Blockscout (#9329)

    ### Description

    Added env variables that control the Stats page in Blockscout.

    ### Other changes

    No.

    ### Tested

    Tested on Alfajores.

    ### Backwards compatibility

    Yes.

commit 13906c5
Author: Victor "Nate" Graf <victor@clabs.co>
Date:   Thu Feb 17 15:49:49 2022 -0800

    Create @celo/encrypted-backup backup for ODIS hardened password encrypted backups (#8896)

    * create encrypted-backup package

    * basic backup and open functions working without any key hardening

    * basic backup and open functions working without any key hardening

    * use io-ts to create serialization and deserialization functions

    * extract the encryption and decryption logic from the main functions

    * add io-ts schema definitions for Domain types

    * add domain field to backup type and schema

    * mix in the domain hash to the key as a simple proxy for ODIS

    * add a stub to hold the place of circuit breaker functions

    * update the dependency graph

    * swap order of circuit breaker and odis stubs

    * [broken] move domains source from @celo/identity to @celo/phone-number-privacy

    * [broken] remove @celo/identity dependency from @celo/phone-number-privacy-common

    * finish removing @celo/identity and a dependency of @celo/phone-number-privacy-common

    * remove duplication and inconsistencies betweem @celo/identity and @celo/phone-number-privacy-common

    * fix linter errors

    * clean up domain state and response types

    * [checkpoint] partially implemented key hardening through ODIS

    * refactor phone-number-privacy a little

    * initial implementaion of odis key hardening logic

    * wire in odis key hardening

    * fix issues occuring during package initialization

    * tests now working against a mock implementation of ODIS

    * add (untested) circuit breaker client implementation

    * add comments and pipe in circuit breaker config values

    * fix issues founds in manual testing

    * add a mock and tests for circuit breaker client

    * add a NO_GANACHE env variable to disable starting ganache for testing

    * round out tests for the circuit breaker client

    * refactor the mock circuit breaker to be ready to export

    * use the circuit breaker for key hardening

    * bump package versions

    * add more information to error handling and debug messages

    * add doc strings to create and open backup functions

    * add wrapper function createPinEncryptedBackup with documentation

    * refactor mock odis

    * handle 429 status from ODIS and add some error condition tests to backup lib

    * seperate handling of fetch errors and add more error case tests

    * add tests for error cases in openBackup

    * remove DO NOT MERGE note

    * update dependency graph

    * add more information to comments

    * add links to the new documentation

    * fix build error in signer

    * change request type definitions and checkSequentialDelay function

    * fix linter errors

    * fix linter errors

    * but like really, fix linter errors

    * ok I was only joking before about fixing the linter errors. this time for sure.

    * add support for computational key hardening [lacks schema or tests]

    * extract odis mock to new file

    * add computational hardening to test config

    * add failure case tests for mutated backups

    * add computational hardening to schema

    * Update packages/sdk/identity/src/odis/circuit-breaker.ts

    Co-authored-by: Alec Schaefer <alec@cLabs.co>

    * consolidate imports

    * address review comments

    * add odis verification error type

    * add safety gate to prevent use of OPRF function for key hardening in prod

    * bump dep versions in phone-number-privacy-common

    * remove new code for encrypted backup

    * Revert "remove new code for encrypted backup"

    This reverts commit e6b4c62.

    * populate index.ts file

    * fix import

    * fix import again

    * update dep graphy

    * fix lint errors

    * fix lint error

    * update dependency graph

    * remove outdated DO NOT MERGE

    * add phone-number-privacy-common to package list and sort the list

    * add @types/express as dev dependency

    * update circuit breaker keys to production values

    * fix typos and add DO NOT MERGE comments for changes to be made

    * bump development version of phone-number-privacy-common package

    * address most of the DO NOT MERGE comments

    * add createPasswordEncryptedBackup function

    * add safety measure to prevent accidental usage of the createBackup API with an empty hardening config

    * fix usages of renamed Endpoint enum

    * fix enum types

    * remove accidentally added walletconnect package

    * fix lint error

    * fix another lint error

    * fix dangling reference to CustomSigner

    * remove dangling refernce to signWithRawKey

    Co-authored-by: Alec Schaefer <alec@cLabs.co>

commit 0ac97fd
Author: Alec Schaefer <alec@cLabs.co>
Date:   Tue Feb 8 20:58:52 2022 -0500

    Bump sdk versions to 1.5.3-dev (#9300)

commit a85bcfe
Author: Alec Schaefer <alec@cLabs.co>
Date:   Tue Feb 8 02:27:11 2022 -0500

    add elliptic library to import-blacklist (#9302)

    ### Description

    Adds elliptic library to ts import blacklist for entire monorepo. This is to prevent vulnerabilities such as the one patched here a3ede34

    ### Other changes

    None

    ### Tested

    NA

    ### Related issues

    NA

    ### Backwards compatibility

    Yes

    ### Documentation

    None

commit c6852a0
Author: Alec Schaefer <alec@cLabs.co>
Date:   Fri Feb 4 22:26:02 2022 -0500

    fix elliptic signing (#9271)

    ### Other changes

    Removes elliptic as a dependency from ODIS signer and combiner

    Updates get-contact-matches to rely on the common package's implementation of verifyDEKSignature

    [adds flake tracker to @celo/keystore and increases jest.timeout](2112edc)

    ### Tested

    Test cases added to phone-number-privacy/common package ensuring that authenticateUser accepts both the new and the old signing schemes (backwards compatibility)

    Test cases added to @celo/identity ensuring that signWithRawKey signs the full message digest rather than the plain text message.

    ### Related issues

    - Fixes #9237

    ### Backwards compatibility

    The verifyDEKSignature function used by authenticateUser() will now accept requests with both the old (incorrect) and the new (correct) authorization signatures. Once clients have upgraded to use this change in the @celo/identity package, the verifyDEKSignature function will be updated again to only accept the new authorization signatures.

    To monitor frequency of requests with incorrect signatures, we have added a new WarningMessage so that we can easily create a log based metric. We will not remove support for the old signing method until ODIS is no longer receiving requests that use it.

    ### Documentation

    None

commit b64e403
Author: Enrique Ruiz <enrique@keyko.io>
Date:   Tue Feb 1 14:47:31 2022 +0100

    Publish contracts to sourcify after migration (#9220)

    * Publish contracts to sourcify after migration

    * Add useLiteralContent flag

    * Addressing some comments

    * Fix to work with a report.json file getting network and paths as parameter

    * Fix comments

    * Fix tests and add note

commit 51d6b0a
Author: Nina Barbakadze <barbakadzeninaa@gmail.com>
Date:   Tue Feb 1 12:09:44 2022 +0100

    Added a spread bound check in the setSpread function  (#9252)

    ### Description

    _A few sentences describing the overall effects and goals of the pull request's commits.
    What is the current behavior, and what is the updated/expected behavior with this PR?_
    I've created a bound check for the spread to make sure that its value never exceeds 1.
    ### Other changes

    _Describe any minor or "drive-by" changes here._

    ### Tested

    _An explanation of how the changes were tested or an explanation as to why they don't need to be._
    I've added a condition in the test suite which checks, that the value of spread shouldn't exceed 1.
    ### Related issues

    - Fixes #[issue number here]

    ### Backwards compatibility

    _Brief explanation of why these changes are/are not backwards compatible._

    ### Documentation

    _The set of community facing docs that have been added/modified because of this change_

commit f46bc14
Author: Cody Born <codyborn@outlook.com>
Date:   Mon Jan 31 15:00:18 2022 -0800

    Bump to v1.5.2 (#9153)

    * Bump to v1.5.1

    * Update yarn.lock

    * Update yarn.lock

    * Improve git security

    * Update umpirsky references

    * Updating ganache-core version

    * Update yarn.lock

    * Fix mergify deprecation

    * Fix mergify deprecation

    * Add condition to default merge queue

    * Cast AuthSigner into explicit types

    * Keep inter-repo dependencies in-sync

    * update out of sync packages

    * Testing changes to tsconfig

    * Testing moduleResolution

    * Revert tsconfig changes

    * Remove circular dependency

    * Add back other build steps

commit 2d2d52d
Author: Nicolas Brugneaux <nicolas.brugneaux@clabs.co>
Date:   Fri Jan 28 17:40:40 2022 +0100

    chore: remove wallet-walletconnect (#9187)

    Co-authored-by: Daniel Kesler <danielckesler@gmail.com>

commit 0118ecf
Author: Bogdan Dumitru <304771+bowd@users.noreply.github.com>
Date:   Thu Jan 27 13:29:35 2022 +0100

    CELOEUR Oracle Staging deployment (#7299)

    * Add .env.staging config

    * lint

    Co-authored-by: Martín Volpe <volpe@clabs.co>
    Co-authored-by: Martin Volpe <martin.volpe@gmail.com>

commit 8685981
Author: Javier Cortejoso <javier.cortejoso@gmail.com>
Date:   Wed Jan 19 17:47:09 2022 +0100

    Update deployment for celo-blockchain 1.5.x (#9021)

    * Updated new geth cmd options for pprof
    * Added new format for geth http/rcp/ws flags
    * Add option to increase rpc request timeouts in geth
    * Updated alfajores to 1.5.0
    * Updated baklava to 1.5.0

commit 29e2ca9
Author: eelanagaraj <7308464+eelanagaraj@users.noreply.github.com>
Date:   Mon Jan 17 14:14:59 2022 +0100

    Re-bump Attestation Service to 1.6.0-dev

commit 3cd772b
Author: eelanagaraj <7308464+eelanagaraj@users.noreply.github.com>
Date:   Mon Jan 17 13:15:41 2022 +0100

    Fix newKit bug websocket providers in prep for AS v1.5.0

commit f1f02bf
Author: eelanagaraj <7308464+eelanagaraj@users.noreply.github.com>
Date:   Thu Jan 13 19:07:50 2022 +0100

    Bump Attestation Service version to 1.6.0-dev

commit 38c753f
Author: eelanagaraj <7308464+eelanagaraj@users.noreply.github.com>
Date:   Thu Jan 13 13:52:35 2022 +0100

    Release attestation service v1.5.0

commit d752156
Author: Martin Volpe <martin.volpe@gmail.com>
Date:   Fri May 13 15:10:45 2022 +0200

    Fixed release versions

commit 2c27699
Author: Martin Volpe <martin.volpe@gmail.com>
Date:   Fri May 13 15:09:06 2022 +0200

    Added newline at the end

commit 50aa1df
Author: Marcin Chrzanowski <martin@clabs.co>
Date:   Tue Feb 22 10:18:55 2022 -0500

    Add version report

commit 1821332
Author: Marcin Chrzanowski <martin@clabs.co>
Date:   Tue Feb 15 11:06:21 2022 -0500

    Add empty initialization data for release 6

commit 373dd35
Author: Yorke Rhodes <yorhodes@cLabs.co>
Date:   Tue Nov 30 13:53:06 2021 -0800

    Use OZ safeTransfer in genericTransfer (#9025)

    * Use OZ safeTransfer in genericTransfer

    * Add unit test for safeTransfer revert

commit 680c84b
Author: Yorke Rhodes <yorhodes@cLabs.co>
Date:   Tue Nov 30 13:52:35 2021 -0800

    Use SafeMath in getOffchainStorageRoots (#9026)

commit 662eacd
Author: Yorke Rhodes <yorhodes@cLabs.co>
Date:   Tue Nov 30 13:44:55 2021 -0800

    Add revert message to removeStorageRoot (#9010)

    * Add revert message to removeStorageRoot

    * Update unit test

commit b5d80c7
Author: Martín Volpe <martin.volpe@gmail.com>
Date:   Thu Apr 28 14:26:00 2022 +0200

    Added version report CR7 (#9504)

commit 9acf3d0
Author: Martin <martin@clabs.co>
Date:   Fri Mar 11 10:49:50 2022 +0100

    Add version report for relase 6 (#9386)

    * Add version report for relase 6

    * Generate report against v5

commit 160eed1
Author: Martin <martin@clabs.co>
Date:   Thu Mar 10 22:57:03 2022 +0100

    Fix test (#9385)

commit 7e9e31a
Author: Edwin O <okonkwo.ikechukwu01@gmail.com>
Date:   Thu Mar 10 19:05:40 2022 +0100

    Fix typographical errors to improve readablity. (#9250)

    Co-authored-by: Martín Volpe <volpe@clabs.co>
    Co-authored-by: Martin <martin@clabs.co>

commit ae09bf6
Author: Martin <martin@clabs.co>
Date:   Thu Mar 10 18:46:31 2022 +0100

    Increment Validators and Accounts versions (#9256)

    * Update prior release tag for CI version checking

    * Fetch the necessary branch

    * Use node 12 on prior release

    * Increment version numbers

    * Bump ExchangeBRL version

    * Add empty initalization data

commit 7849aa8
Author: Martin <martin@clabs.co>
Date:   Tue Mar 8 14:43:23 2022 +0100

    Disallow a 0x0 address beneficiary (#9283)

    * Disallow address 0x0 beneficiaries

    * Add function to remove payment delegation

    * Add documentation

    * Require deletion of payment delegation is done by account

    * Specify deletePaymentDelegation as non privileged

commit 7828bd6
Author: Martin <martin@clabs.co>
Date:   Tue Mar 8 12:26:45 2022 +0100

    Fix indentation (#9285)

commit ca4afce
Author: Nina Barbakadze <barbakadzeninaa@gmail.com>
Date:   Mon Mar 7 15:03:15 2022 +0100

    replaced unnecessary calculations with SECONDS_IN_A_WEEK constant (#9269)

    Co-authored-by: Nina Barbakadze <ninabarbakadze@ninas-mbp.localdomain>
    Co-authored-by: Martín Volpe <volpe@clabs.co>

commit 4625c3f
Author: Nina Barbakadze <barbakadzeninaa@gmail.com>
Date:   Tue Feb 22 21:21:23 2022 +0100

    Resolve inadequate NatSpec (#9270)

* Delete .mergify.yml

* Fixed wrong merge

* Rolled back wallet connect

* lint

* fix lint

* Force CircleCI to fetch all tags

* Brought report from master
  • Loading branch information
martinvol authored Sep 16, 2022
1 parent 1452ccc commit d90181f
Show file tree
Hide file tree
Showing 22 changed files with 370 additions and 95 deletions.
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defaults: &defaults
contract-defaults: &contract-defaults
<<: *defaults
environment:
RELEASE_TAG: core-contracts.v6
RELEASE_TAG: core-contracts.v7

e2e-defaults: &e2e-defaults
<<: *defaults
Expand Down Expand Up @@ -151,6 +151,7 @@ jobs:
# Verify that following commands work, they are later called in the incremental testing script
# There output does not matter here, the fact that they finish successfully does.
git rev-parse --abbrev-ref HEAD
git fetch --all --tags
- attach_workspace:
at: ~/app
Expand Down Expand Up @@ -809,6 +810,9 @@ jobs:
name: Check if the test should run
command: |
./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol
# Disabling certora until the license is figured out
circleci step halt
exit 0
- run:
name: Certora dependencies
command: |
Expand Down
8 changes: 0 additions & 8 deletions packages/faucet/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions packages/faucet/tslint.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/phone-number-privacy/combiner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
"engines": {
"node": "12"
}
}
}
2 changes: 1 addition & 1 deletion packages/phone-number-privacy/monitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
"engines": {
"node": "12"
}
}
}
2 changes: 1 addition & 1 deletion packages/phone-number-privacy/signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
"engines": {
"node": ">=10"
}
}
}
17 changes: 15 additions & 2 deletions packages/protocol/contracts/common/Accounts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -318,22 +318,35 @@ contract Accounts is

/**
* @notice Sets validator payment delegation settings.
* @param beneficiary The address that should receive a portion of vaidator
* @param beneficiary The address that should receive a portion of validator
* payments.
* @param fraction The fraction of the validator's payment that should be
* diverted to `beneficiary` every epoch, given as FixidyLib value. Must not
* diverted to `beneficiary` every epoch, given as FixidityLib value. Must not
* be greater than 1.
* @dev Use `deletePaymentDelegation` to unset the payment delegation.
*/
function setPaymentDelegation(address beneficiary, uint256 fraction) public {
require(isAccount(msg.sender), "Not an account");
require(beneficiary != address(0), "Beneficiary cannot be address 0x0");
FixidityLib.Fraction memory f = FixidityLib.wrap(fraction);
require(f.lte(FixidityLib.fixed1()), "Fraction must not be greater than 1");
paymentDelegations[msg.sender] = PaymentDelegation(beneficiary, f);
emit PaymentDelegationSet(beneficiary, fraction);
}

/**
* @notice Removes a validator's payment delegation by setting benficiary and
* fraction to 0.
*/
function deletePaymentDelegation() public {
require(isAccount(msg.sender), "Not an account");
paymentDelegations[msg.sender] = PaymentDelegation(address(0x0), FixidityLib.wrap(0));
emit PaymentDelegationSet(address(0x0), 0);
}

/**
* @notice Gets validator payment delegation settings.
* @param account Account of the validator.
* @return Beneficiary address and fraction of payment delegated.
*/
function getPaymentDelegation(address account) external view returns (address, uint256) {
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/stability/Exchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ contract Exchange is
/**
* @notice Used in place of the constructor to allow the contract to be upgradable via proxy.
* @param registryAddress The address of the registry core smart contract.
* @param stableTokenIdentifier String identifier of stabletoken in registry
* @param _spread Spread charged on exchanges
* @param _reserveFraction Fraction to commit to the gold bucket
* @param _updateFrequency The time period that needs to elapse between bucket
* updates
* @param _minimumReports The minimum number of fresh reports that need to be
* present in the oracle to update buckets
* commit to the gold bucket
* @param stableTokenIdentifier String identifier of stabletoken in registry
*/
function initialize(
address registryAddress,
Expand Down Expand Up @@ -298,7 +298,7 @@ contract Exchange is
spread = FixidityLib.wrap(newSpread);
require(
FixidityLib.lte(spread, FixidityLib.fixed1()),
"the value of spread must be less than or equal to 1"
"Spread must be less than or equal to 1"
);
emit SpreadSet(newSpread);
}
Expand Down
14 changes: 7 additions & 7 deletions packages/protocol/contracts/stability/ExchangeBRL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import "./Exchange.sol";

contract ExchangeBRL is Exchange {
/**
* @notice Sets initialized == true on implementation contracts
* @param test Set to true to skip implementation initialization
*/
* @notice Sets initialized == true on implementation contracts
* @param test Set to true to skip implementation initialization
*/
constructor(bool test) public Exchange(test) {}

/**
* @notice Returns the storage, major, minor, and patch version of the contract.
* @dev This function is overloaded to maintain a distinct version from Exchange.sol.
* @return The storage, major, minor, and patch version of the contract.
*/
* @notice Returns the storage, major, minor, and patch version of the contract.
* @dev This function is overloaded to maintain a distinct version from Exchange.sol.
* @return The storage, major, minor, and patch version of the contract.
*/
function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) {
return (1, 2, 0, 0);
}
Expand Down
7 changes: 5 additions & 2 deletions packages/protocol/contracts/stability/GrandaMento.sol
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ contract GrandaMento is
* @return The storage, major, minor, and patch version of the contract.
*/
function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) {
return (1, 1, 0, 0);
return (1, 1, 0, 1);
}

/**
Expand Down Expand Up @@ -582,8 +582,11 @@ contract GrandaMento is
* @param newSpread The new value for the spread to be wrapped. Must be <= fixed 1.
*/
function setSpread(uint256 newSpread) public onlyOwner {
require(newSpread <= FixidityLib.fixed1().unwrap(), "Spread must be smaller than 1");
spread = FixidityLib.wrap(newSpread);
require(
FixidityLib.lte(spread, FixidityLib.fixed1()),
"Spread must be less than or equal to 1"
);
emit SpreadSet(newSpread);
}

Expand Down
10 changes: 7 additions & 3 deletions packages/protocol/contracts/stability/Reserve.sol
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,13 @@ contract Reserve is
uint256 stableAmount;
uint256 goldAmount;
(stableAmount, goldAmount) = sortedOracles.medianRate(_tokens[i]);
uint256 stableTokenSupply = IERC20(_tokens[i]).totalSupply();
uint256 aStableTokenValueInGold = stableTokenSupply.mul(goldAmount).div(stableAmount);
stableTokensValueInGold = stableTokensValueInGold.add(aStableTokenValueInGold);

if (goldAmount != 0) {
// tokens with no oracle reports don't count towards collateralization ratio
uint256 stableTokenSupply = IERC20(_tokens[i]).totalSupply();
uint256 aStableTokenValueInGold = stableTokenSupply.mul(goldAmount).div(stableAmount);
stableTokensValueInGold = stableTokensValueInGold.add(aStableTokenValueInGold);
}
}
return
FixidityLib
Expand Down
14 changes: 7 additions & 7 deletions packages/protocol/contracts/stability/StableTokenBRL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import "./StableToken.sol";

contract StableTokenBRL is StableToken {
/**
* @notice Sets initialized == true on implementation contracts.
* @param test Set to true to skip implementation initialization.
*/
* @notice Sets initialized == true on implementation contracts.
* @param test Set to true to skip implementation initialization.
*/
constructor(bool test) public StableToken(test) {}

/**
* @notice Returns the storage, major, minor, and patch version of the contract.
* @dev This function is overloaded to maintain a distinct version from StableToken.sol.
* @return The storage, major, minor, and patch version of the contract.
*/
* @notice Returns the storage, major, minor, and patch version of the contract.
* @dev This function is overloaded to maintain a distinct version from StableToken.sol.
* @return The storage, major, minor, and patch version of the contract.
*/
function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) {
return (1, 1, 0, 0);
}
Expand Down
Loading

0 comments on commit d90181f

Please sign in to comment.