Skip to content
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

cREAL contract release #8831

Merged
merged 199 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
3bfcf79
Build whole phone-number-privacy in docker image (#8268)
emilhotkowski Jul 8, 2021
a4ca31b
env-tests github action (#8057)
kevjue Jul 9, 2021
6bf908f
Surface inflation rate and factor in network:parameters (#8274)
yorhodes Jul 9, 2021
ab6fd9e
Allow setting up a different Geth WS port. Private tx-nodes defualts …
jcortejoso Jul 12, 2021
eb73e04
add section for deploying ETH contract to Celo (#8280)
critesjosh Jul 12, 2021
0829d8e
add protocol differences (#8284)
critesjosh Jul 13, 2021
2455364
SDK 1.2.2-dev --> 1.2.3-dev (#8275)
medhakothari Jul 14, 2021
623106e
add info about Valora accounts (#8293)
critesjosh Jul 14, 2021
8713395
Update devchain docs (#8296)
nambrot Jul 14, 2021
b099f50
Proposal sanity check (#8200)
mrsmkl Jul 15, 2021
b411b44
New metric exclusions (#8139)
jcortejoso Jul 15, 2021
1a25e00
feat: expose indexer metrics (#8116)
obasilakis Jul 15, 2021
5ebada6
Fix metrics activation values (#8302)
Jul 15, 2021
ebb91ca
Patch certora governance spec (#8297)
yorhodes Jul 15, 2021
5870482
Granda Mento SDK support (#8137)
martinvol Jul 15, 2021
804e80e
Remove timestamp from ODIS (#8298)
alecps Jul 16, 2021
c43cac6
ODIS Quota take cEUR balance into account (#8205)
emilhotkowski Jul 16, 2021
a1ffea9
Invite Rewards Deployment (#7835)
codyborn Jul 16, 2021
cf126a1
various fixes from ODIS v1.1.8 deployment (#8309)
alecps Jul 17, 2021
aec8b65
Add missed variable to enable metrics (#8310)
Jul 19, 2021
8d0e75f
Do not include ws port in service if is 8545 (#8319)
jcortejoso Jul 19, 2021
6296ca4
Prometheus remote_write refactor and included rc1 grafanaCloud (#8320)
jcortejoso Jul 19, 2021
d8baeea
Update release process docs to reflect simpler tagging scheme (#8267)
yorhodes Jul 19, 2021
27e2213
Don't use mycelo for e2e tests by default. (#8291)
Jul 19, 2021
255044d
Implement contract upgrades compatibility in ContractKit (#8308)
yorhodes Jul 20, 2021
77a3922
Twilio Verify API (#8189)
codyborn Jul 21, 2021
16357cb
Pass APIs enabled from testnet to common packages (#8350)
jcortejoso Jul 26, 2021
0dfe234
Add blockscout mainnet staging env (#8348)
obasilakis Jul 26, 2021
8f2241e
Remove unneccesary getVersionNumber() function declaration in contrac…
Tjudice Jul 26, 2021
985d057
Move GrandaMento from liquidity dir to stability (#8300)
tkporter Jul 26, 2021
2b60d12
feat: expose blockscout prometheus metrics (#8358)
obasilakis Jul 28, 2021
b018811
Remove packages/contractkit (#8258)
Jul 28, 2021
4a0dbeb
Clarify requirement to use Node.js v12.x (#8359)
piersy Jul 28, 2021
84cbc11
Added D'CENT Wallet (#8367)
reachjason Jul 29, 2021
2475a96
GrandaMento comment fixes & clearer revert msgs - N01 and N02 (#8344)
tkporter Jul 29, 2021
8695daf
add tests for nixSecondsTimestampToDateString (moment removal prework…
aaronmgdr Jul 29, 2021
3d46b9a
Loadtest celotool client: Included threading and multiple light-clien…
jcortejoso Aug 2, 2021
96722d2
Custom values.yaml for each context in celo-fullnode chart (#8191)
jcortejoso Aug 2, 2021
d2a8ec5
Minor tweaks to "Stable Cryptocurrencies" (#8333)
albertclabs Aug 2, 2021
1c28074
GrandaMento - Add hardcoded max for veto period - L07 (#8368)
tkporter Aug 3, 2021
33a6436
GrandaMento - Lock in veto period in proposal - L01 (#8369)
tkporter Aug 3, 2021
7c7b3c5
removes moment.js by replacing with Intl.DateTimeFormat (#8451)
aaronmgdr Aug 3, 2021
ce0eab1
Updated Grafana ingress to k1.18+ (#8462)
jcortejoso Aug 4, 2021
655714f
Obasilakis/expose blockscout prometheus metrics (#8448)
obasilakis Aug 4, 2021
96c22ed
Revert fixes for audit 6/release 5 on master (#8471)
yorhodes Aug 4, 2021
3275f19
Updated tar dependency to 4.4.15 (#8466)
jcortejoso Aug 5, 2021
febed0a
Update metadata-crawler image in blockscout helm charts (#8467)
eelanagaraj Aug 5, 2021
f539ac1
Added test to odis common code (#8351)
emilhotkowski Aug 5, 2021
291614e
Set blockscout k8s deployments to include erlang node name (#8476)
rkachowski Aug 6, 2021
7c31d37
Update wallets.md to show Valora as maintainer of Valora (#8483)
cajubelt Aug 6, 2021
8146217
add accessors for target symbols and weights of reserve target alloca…
aaronmgdr Aug 9, 2021
7a6d0de
Add --txpool.nolocals to forno full nodes (#8499)
tkporter Aug 10, 2021
a8b8039
Re-instate prior timeout to retrieve latest block (#8505)
piersy Aug 11, 2021
a1531ff
fix CI (#8516)
shellygr Aug 12, 2021
137378b
Upgrade eksportisto (#8518)
bowd Aug 12, 2021
2580838
add metamask and wallet connect (#8523)
critesjosh Aug 16, 2021
b70f7e6
Enabled metrics, changed the pool size (#8524)
carterqw2 Aug 17, 2021
dd80b14
fixed typo in word "governance" (#8526)
cajubelt Aug 17, 2021
53a0020
Separate testnet from production decryption permissions (#8529)
codyborn Aug 18, 2021
ee98c9d
Granda Mento env test, small env test refactor and fixes (#8335)
tkporter Aug 18, 2021
d8b52c9
Update signer image to latest (#8533)
codyborn Aug 19, 2021
bb5ffa9
Merge release 5 to master (#8475)
yorhodes Aug 20, 2021
2e65715
ODIS matchmaking replay handling (#8357)
alecps Aug 23, 2021
9e165e0
doc: Update foundation voting policy (#8539)
YazzyYaz Aug 24, 2021
16eff28
Flake tracker error handling (#8541)
alecps Aug 24, 2021
c202e83
Fix governance encoding and decoding for unregistered contracts (#8537)
yorhodes Aug 25, 2021
b16a2d4
Bump wallet connect version (#8215)
Aug 25, 2021
1f3780d
GitBook: [master] 1,404 pages modified
Aug 27, 2021
927b5db
GitBook: [master] 3 pages modified
Aug 27, 2021
7b1c440
GitBook: [master] one page modified
Aug 30, 2021
9b11155
GitBook: [master] 2 pages modified
Sep 1, 2021
35d2c14
Revert "GitBook: [master] 1,404 pages modified" (#8575)
Sep 2, 2021
f95d73b
testnet loadtest small fixes (#8579)
jcortejoso Sep 3, 2021
c2fe919
Impemented a smoother scale down policy for blockscout api hpa (#8581)
carterqw2 Sep 3, 2021
563afcd
Granda Mento support in CLI (#8534)
martinvol Sep 3, 2021
7e67b54
Upgrade oracle version.
pedro-clabs Aug 30, 2021
aed6074
Tobikuhlmann/adjustment factor testing (#8571)
Sep 6, 2021
e9cc999
Incorporate js keystore (+ fallback nodes) into attestation service (…
eelanagaraj Sep 7, 2021
b35b8a3
Documentation update (#8554)
bcamacho Sep 7, 2021
8977f49
Combiner min instance count (#8593)
codyborn Sep 7, 2021
88da46d
Add MINIMUM_PRICE_SOURCES to Oracle's helm chart.
pedro-clabs Aug 9, 2021
669a075
Set the Oracles' minPriceSourceCount to 2.
pedro-clabs Aug 9, 2021
3162439
Using Metamask with Celo (#8592)
Sep 8, 2021
f6bd63a
Update to new testnet encryption key (#8566)
codyborn Sep 8, 2021
feba18d
Add annotation with information about deployment for grafana dashboar…
Sep 9, 2021
ef0a683
Truncate error in Attestation Service (#8536)
codyborn Sep 9, 2021
e77df8b
azure front door fallback (#8532)
emilhotkowski Sep 9, 2021
d33672f
CLI governance:propose support for dependencies on existing proposals…
tkporter Sep 9, 2021
c3ee5e8
Fix `kit.getNetworkConfig()` failure mode when some contracts are not…
yorhodes Sep 10, 2021
3b853bc
Simplify attestation service deployment in prep for release 1.4.0 (#8…
eelanagaraj Sep 11, 2021
a3e38d4
Add author in grafana annotation (#8616)
Sep 13, 2021
57ca33f
Added tests to Attestation Service (#8621)
emilhotkowski Sep 15, 2021
e1a2b66
Adjusted blockscout request parameters (#8627)
carterqw2 Sep 15, 2021
530ec95
Create Certora spec for Reserve spender (#8572)
m-chrzan Sep 15, 2021
b552c60
Emilhotkowski/fallback without circuit (#8632)
emilhotkowski Sep 15, 2021
aabcd2c
Add `grandamento:execute`, `grandamento:get-buy-amount`, small fixes,…
tkporter Sep 17, 2021
c05a0d6
Remove validator group confirmation for revoking votes (#8637)
dckesler Sep 17, 2021
732ff15
Forno rate limit using Kong (#8100)
jcortejoso Sep 23, 2021
ad7e100
Do not scale fullnodes when --helmdryrun (#8563)
jcortejoso Sep 23, 2021
b65c8cd
Critesjosh/deprecate docs package (#8700)
critesjosh Sep 29, 2021
2129829
adds checkSequentialDomain + tests, SequentialDelayDomain (#8701)
alecps Sep 30, 2021
6e6f873
Release/sdk/1.2.5 (#8667)
Sep 30, 2021
db6b56b
Emilhotkowski/added endpoints for rate limiting (#8654)
emilhotkowski Oct 1, 2021
8959f92
[Celostats] Environment point to master (#8730)
gastonponti Oct 4, 2021
9457c24
Bugfix/blockscout compilation (#8727)
rkachowski Oct 5, 2021
d605610
Redirect coin balances (#8753)
Oct 6, 2021
5ef64eb
Blockscout nginx redirects (#8754)
carterqw2 Oct 6, 2021
64ab69a
Fix WalletConnect V2 (#8691)
Oct 7, 2021
70e1f1c
GKE Prometheus metrics: set up GKE workload metrics (#8760)
lvpeschke Oct 11, 2021
0935a46
Bump cross-fetch dependency of contractkit (#8772)
yorhodes Oct 11, 2021
77f8902
Update Contractkit in ODIS (#8776)
codyborn Oct 12, 2021
6da7dbb
Add `celocli releasegold:admin-revoke` command (#8749)
yorhodes Oct 13, 2021
a0879aa
Infrastructure changes for Eksportisto 2.0 (#8580)
bowd Oct 14, 2021
c3eda62
Remove eksportisto 8 deployment config.
pedro-clabs Oct 14, 2021
d81e1bb
remove eksportisto deployment sensitive account configs
Oct 14, 2021
0633b3a
Rename legacy eksportisto helm charts folder.
pedro-clabs Oct 14, 2021
a6209e3
Fix eksportisto helm release existence test.
pedro-clabs Oct 15, 2021
eaf076f
Fix service account e-mail fetching.
pedro-clabs Oct 15, 2021
afcfd52
Fix service account existence check.
pedro-clabs Oct 15, 2021
7245947
Fix broken get-attestations test (#8790)
dckesler Oct 15, 2021
9cade72
Add network alias for global node flag (#8549)
yorhodes Oct 15, 2021
3ee3e8b
Add isFunded construct to ReleaseGold (#8751)
yorhodes Oct 16, 2021
fe77367
Adds new script for deploying/updating sdks (#8739)
dckesler Oct 16, 2021
f17c937
Fix sourcify verification full_match path (#8800)
Oct 18, 2021
77a53dd
Fix attestation bot (#8782)
codyborn Oct 18, 2021
6b489a9
Remove await for walletconnect connect, beta.19 (#8801)
dckesler Oct 19, 2021
f4dd249
Add library support for CIP-40 domain hashing (#8705)
Oct 19, 2021
266db70
Bump sdks to 1.3.1, fix some deploy-sdks script issues (#8798)
dckesler Oct 19, 2021
7e7569f
cBRL contract from contracts.v5 tag
luisgj Oct 19, 2021
2ba1722
Update Node version for ODIS (#8775)
codyborn Oct 20, 2021
a8ab10a
add support for the forno endpoint in the make-release wrapper (#8804)
luisgj Oct 20, 2021
7218313
Add EpochRewards wrapper for use in `celocli network:parameters` (#8651)
yorhodes Oct 20, 2021
89be1c0
Change default node version to 12 (#8825)
dckesler Oct 20, 2021
cf84a7d
Add erc20 genericTransfer to ReleaseGold (#8750)
yorhodes Oct 22, 2021
c098fd7
Increase forno maxpeers and refactor some promises to cap parallelism…
jcortejoso Oct 25, 2021
23a3529
Add Result type guards (#8835)
nambrot Oct 25, 2021
10abe03
Set vulnerable dependency to fixed version (#8846)
codyborn Oct 25, 2021
64a4a45
Added constitution parameters to cREAL
martinvol Oct 26, 2021
fd2a269
Allow for CIP8 that bypasses CIP3 (#8360)
m-chrzan Oct 26, 2021
9cdf5e0
Reduce blockscout autoscaling max. (#8822)
rkachowski Oct 27, 2021
bd1b248
Exclude phoenix metrics in grafana cloud (#8849)
jcortejoso Oct 27, 2021
24f434e
Ingest GKE and AKS logs in Grafana Cloud (#8827)
lvpeschke Oct 27, 2021
9c1f981
Changing cREAL parameters
martinvol Oct 27, 2021
5aa77e2
Update packages/protocol/releaseData/initializationData/creal_deploy.…
martinvol Oct 27, 2021
c7fa2b7
Fix import of fixidity library in EpochRewards.ts (#8857)
Oct 29, 2021
de7d9a9
Fix bug in signature parsing for EIP712TypedData (#8836)
eelanagaraj Oct 29, 2021
cf3c430
Add signature verification code for CIP-40 requests (#8859)
Oct 29, 2021
97fec1c
Merge remote-tracking branch 'origin/patch-3' into martinvol/migrations
martinvol Oct 30, 2021
a427632
Added migrations cREAL
martinvol Oct 30, 2021
c144640
Added integration tests and migrations config
martinvol Oct 30, 2021
b268346
Merge pull request #1 from martinvol/patch-2
luisgj Nov 1, 2021
466a52a
Merge pull request #2 from martinvol/patch-3
luisgj Nov 1, 2021
0573cb7
Emilhotkowski/domain versioning2 (#8833)
emilhotkowski Nov 2, 2021
95816c9
lint
martinvol Nov 2, 2021
2407c25
Merge branch 'rc/v6' into martinvol/migrations
martinvol Nov 2, 2021
ecae15a
Merge pull request #3 from martinvol/martinvol/migrations
martinvol Nov 2, 2021
2958943
Update packages/protocol/test/common/integration.ts
martinvol Nov 2, 2021
89fcede
Removed json
martinvol Nov 3, 2021
035dddc
retigger CI
martinvol Nov 3, 2021
b0f4a12
Changed base RELEASE_TAG
martinvol Nov 3, 2021
5ebade0
Added release5-report.json
martinvol Nov 3, 2021
45c8031
Migrate to typescript@4.4.3 (#8789)
dckesler Nov 3, 2021
a60635a
new line
martinvol Nov 3, 2021
452db85
Added CR6 script
martinvol Nov 3, 2021
d55316c
Don't rely on bignumber.js in @celo/base (#8923)
nambrot Nov 3, 2021
26b63eb
Add apps panel variables (#8936)
Nov 4, 2021
7d47b0b
Refactor TwilioSmsProvider into two separate modules (messaging, veri…
eelanagaraj Nov 5, 2021
fe18c37
return veriifcation as false for unauthenticated domains (#8937)
Nov 5, 2021
f4abaa6
Fixed typos
martinvol Nov 7, 2021
c2ddce5
contractkit now knows BRL exists
martinvol Nov 7, 2021
de0a002
Require that slashing reporters are accounts (#8854)
m-chrzan Nov 8, 2021
e948a50
Eksportisto deployment v3.
pedro-clabs Oct 14, 2021
e1e149c
Fixes typescript versioning issue (#8927)
dckesler Nov 11, 2021
6294c40
Update env vars for blockscout apps links (#8956)
Nov 12, 2021
a24e9ae
Update docker images and testnet package (#8959)
jcortejoso Nov 12, 2021
9fea725
Add eksportisto monitor deployment.
pedro-clabs Nov 9, 2021
e84319d
Provide security guidance for ODIS key (#8847)
codyborn Nov 16, 2021
cf48bd7
Fix ongoingDeliveryId bug (duplicates with Verify API) in attestation…
eelanagaraj Nov 17, 2021
2b92e27
Unify the indexing queues used by eksportisto.
pedro-clabs Nov 11, 2021
8a6ab5b
Increase eksportisto indexer replicas to 32.
pedro-clabs Nov 11, 2021
63f75e3
Added final json
martinvol Nov 17, 2021
caca247
update archive node service
Nov 18, 2021
d2ea6ae
Update verify-bytecode documentation comment (#8945)
m-chrzan Nov 19, 2021
154b340
Fixes ODIS matchmaking full-node error handling (#8968)
alecps Nov 19, 2021
f627810
Publish packages to 1.3.3 (#8926)
nambrot Nov 19, 2021
89c5347
exclude test files from being compiled into the lib folder. (#8990)
aaronmgdr Nov 19, 2021
ba7809b
Upgrade eksportisto.
pedro-clabs Nov 19, 2021
30fc15e
Added entry for cREAL on UsingRegistry, closes #8998
martinvol Nov 22, 2021
92441e3
Fixed cREAL migrations config, closes #8999
martinvol Nov 22, 2021
0afc15a
Added getteres to registry ##8998
martinvol Nov 22, 2021
8e0caec
Added pragma to StableTokenBRL, closes #9004
martinvol Nov 22, 2021
b62b565
Updated blockscout archive nodes endpoint (#9009)
carterqw2 Nov 23, 2021
1f7aa08
Adds full verification to combined ODIS signature in Combiner (#8992)
alecps Nov 24, 2021
f4a7a4b
Add recaptcha for blockscout. (#9014)
rkachowski Nov 25, 2021
ce41909
Allow quick e2e test reruns (#9028)
m-chrzan Dec 1, 2021
767b3bd
Moves walletconnect up to beta.20.2 (#9035)
dckesler Dec 2, 2021
754b286
Phone Utils Package (#8997)
aaronmgdr Dec 2, 2021
b8cd02c
Fix cip35 test (#8939)
trianglesphere Dec 2, 2021
50f3d4f
Merge branch 'master' into rc/v6
martinvol Dec 3, 2021
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
2 changes: 1 addition & 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.v4
RELEASE_TAG: core-contracts.v5

e2e-defaults: &e2e-defaults
<<: *defaults
Expand Down
18 changes: 18 additions & 0 deletions packages/protocol/contracts/stability/ExchangeBRL.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import "./Exchange.sol";

contract ExchangeBRL is Exchange {
/**
martinvol marked this conversation as resolved.
Show resolved Hide resolved
* @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.
*/
function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) {
return (1, 1, 0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, didn't realize/remember we were versioning these independently of the parent contract. Let's go with this for now since that's how EUR was implemented, but taking note of this, as it would make upgrading these contracts annoying (have to independently update each stable token's version number to a different thing).

}
}
20 changes: 20 additions & 0 deletions packages/protocol/contracts/stability/StableTokenBRL.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pragma solidity ^0.5.13;

import "./StableToken.sol";

contract StableTokenBRL is StableToken {
/**
* @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.
*/
function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) {
return (1, 1, 0, 0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pragma solidity ^0.5.13;

import "../../common/Proxy.sol";

/* solhint-disable no-empty-blocks */
contract ExchangeBRLProxy is Proxy {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pragma solidity ^0.5.13;

import "../../common/Proxy.sol";

/* solhint-disable no-empty-blocks */
contract StableTokenBRLProxy is Proxy {}
17 changes: 17 additions & 0 deletions packages/protocol/governanceConstitution.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ const DefaultConstitution = {
setSpread: 0.8,
setReserveFraction: 0.8,
},
ExchangeBRL: {
default: 0.8,
setRegistry: 0.9,
setUpdateFrequency: 0.8,
setMinimumReports: 0.8,
setStableToken: 0.8,
setSpread: 0.8,
setReserveFraction: 0.8,
},
FeeCurrencyWhitelist: {
default: 0.8,
addToken: 0.8,
Expand Down Expand Up @@ -171,6 +180,14 @@ const DefaultConstitution = {
transferWithComment: 0.6,
approve: 0.6,
},
StableTokenBRL: {
default: 0.8,
setRegistry: 0.9,
setInflationParameters: 0.9,
transfer: 0.6,
transferWithComment: 0.6,
approve: 0.6,
},
Validators: {
default: 0.7,
setRegistry: 0.9,
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/lib/registry-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum CeloContractName {
Escrow = 'Escrow',
Exchange = 'Exchange',
ExchangeEUR = 'ExchangeEUR',
ExchangeBRL = 'ExchangeBRL',
FeeCurrencyWhitelist = 'FeeCurrencyWhitelist',
Freezer = 'Freezer',
GasPriceMinimum = 'GasPriceMinimum',
Expand All @@ -34,6 +35,7 @@ export enum CeloContractName {
SortedOracles = 'SortedOracles',
StableToken = 'StableToken',
StableTokenEUR = 'StableTokenEUR',
StableTokenBRL = 'StableTokenBRL',
TransferWhitelist = 'TransferWhitelist',
Validators = 'Validators',
}
Expand Down
92 changes: 92 additions & 0 deletions packages/protocol/migrations/09_2_stableToken_BRL.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* tslint:disable:no-console */
import { ensureLeading0x, eqAddress, NULL_ADDRESS } from '@celo/base/lib/address'
import { CeloContractName } from '@celo/protocol/lib/registry-utils'
import {
deploymentForCoreContract,
getDeployedProxiedContract,
} from '@celo/protocol/lib/web3-utils'
import { config } from '@celo/protocol/migrationsConfig'
import { toFixed } from '@celo/utils/lib/fixidity'
import {
FeeCurrencyWhitelistInstance,
FreezerInstance,
ReserveInstance,
SortedOraclesInstance,
StableTokenBRLInstance,
} from 'types'
import Web3 from 'web3'

const truffle = require('@celo/protocol/truffle-config.js')

const initializeArgs = async (): Promise<any[]> => {
const rate = toFixed(config.stableTokenBRL.inflationRate)
return [
config.stableTokenBRL.tokenName,
config.stableTokenBRL.tokenSymbol,
config.stableTokenBRL.decimals,
config.registry.predeployedProxyAddress,
rate.toString(),
config.stableTokenBRL.inflationPeriod,
config.stableTokenBRL.initialBalances.addresses,
config.stableTokenBRL.initialBalances.values,
'ExchangeBRL',
]
}

// TODO make this general
module.exports = deploymentForCoreContract<StableTokenBRLInstance>(
web3,
artifacts,
CeloContractName.StableTokenBRL,
initializeArgs,
async (stableToken: StableTokenBRLInstance, _web3: Web3, networkName: string) => {
if (config.stableTokenBRL.frozen) {
const freezer: FreezerInstance = await getDeployedProxiedContract<FreezerInstance>(
'Freezer',
artifacts
)
await freezer.freeze(stableToken.address)
}
const sortedOracles: SortedOraclesInstance = await getDeployedProxiedContract<SortedOraclesInstance>(
'SortedOracles',
artifacts
)

for (const oracle of config.stableTokenBRL.oracles) {
console.info(`Adding ${oracle} as an Oracle for StableToken (BRL)`)
await sortedOracles.addOracle(stableToken.address, ensureLeading0x(oracle))
}

const goldPrice = config.stableTokenBRL.goldPrice
if (goldPrice) {
const fromAddress = truffle.networks[networkName].from
const isOracle = config.stableTokenBRL.oracles.some((o) => eqAddress(o, fromAddress))
if (!isOracle) {
console.warn(
`Gold price specified in migration but ${fromAddress} not explicitly authorized as oracle, authorizing...`
)
await sortedOracles.addOracle(stableToken.address, ensureLeading0x(fromAddress))
}
console.info('Reporting price of StableToken (BRL) to oracle')
await sortedOracles.report(
stableToken.address,
toFixed(goldPrice),
NULL_ADDRESS,
NULL_ADDRESS
)
const reserve: ReserveInstance = await getDeployedProxiedContract<ReserveInstance>(
'Reserve',
artifacts
)
console.info('Adding StableToken (BRL) to Reserve')
await reserve.addToken(stableToken.address)
}

console.info('Whitelisting StableToken (BRL) as a fee currency')
const feeCurrencyWhitelist: FeeCurrencyWhitelistInstance = await getDeployedProxiedContract<FeeCurrencyWhitelistInstance>(
'FeeCurrencyWhitelist',
artifacts
)
await feeCurrencyWhitelist.addToken(stableToken.address)
}
)
53 changes: 53 additions & 0 deletions packages/protocol/migrations/10_2_exchange_BRL.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* tslint:disable:no-console */

import { CeloContractName } from '@celo/protocol/lib/registry-utils'
import {
deploymentForCoreContract,
getDeployedProxiedContract,
} from '@celo/protocol/lib/web3-utils'
import { config } from '@celo/protocol/migrationsConfig'
import { toFixed } from '@celo/utils/lib/fixidity'
import {
ExchangeBRLInstance,
FreezerInstance,
ReserveInstance,
StableTokenBRLInstance,
} from 'types'

const initializeArgs = async (): Promise<any[]> => {
const stableTokenBRL: StableTokenBRLInstance = await getDeployedProxiedContract<StableTokenBRLInstance>(
'StableTokenBRL',
artifacts
)
return [
config.registry.predeployedProxyAddress,
stableTokenBRL.address,
toFixed(config.exchange.spread).toString(),
toFixed(config.exchange.reserveFraction).toString(),
config.exchange.updateFrequency,
config.exchange.minimumReports,
]
}

module.exports = deploymentForCoreContract<ExchangeBRLInstance>(
web3,
artifacts,
CeloContractName.ExchangeBRL,
initializeArgs,
async (exchange: ExchangeBRLInstance) => {
if (config.exchange.frozen) {
const freezer: FreezerInstance = await getDeployedProxiedContract<FreezerInstance>(
'Freezer',
artifacts
)
await freezer.freeze(exchange.address)
}

const reserve: ReserveInstance = await getDeployedProxiedContract<ReserveInstance>(
'Reserve',
artifacts
)
// cUSD doesn't need to be added as it currently harcoded in Reserve.sol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: it is currently

await reserve.addExchangeSpender(exchange.address)
}
)
14 changes: 14 additions & 0 deletions packages/protocol/migrationsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,20 @@ const DefaultConfig = {
oracles: [network.from],
frozen: false,
},
stableTokenBRL: {
decimals: 18,
goldPrice: 1.2,
tokenName: 'Celo Euro',
tokenSymbol: 'cEUR',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be cBRL

inflationRate: 1,
inflationPeriod: 1.5 * YEAR,
initialBalances: {
addresses: [network.from],
values: ['5000000000000000000000000'],
},
oracles: [network.from],
frozen: false,
},
transferWhitelist: {
addresses: [],
registryIds: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
martinvol marked this conversation as resolved.
Show resolved Hide resolved
"StableTokenBRL": ["Celo Brazilian Real", "cREAL", 18, "0x000000000000000000000000000000000000ce10", "1000000000000000000000000", "47304000", ["0xD533Ca259b330c7A88f74E000a3FaEa2d63B7972", "0x989e1a3B344A43911e02cCC609D469fbc15AB1F1"], ["2000000000000000000000000", "6000000000000000000000000"], "ExchangeBRL"],
martinvol marked this conversation as resolved.
Show resolved Hide resolved
martinvol marked this conversation as resolved.
Show resolved Hide resolved
"ExchangeBRL": ["0x000000000000000000000000000000000000ce10", "0x0000000000000000000000000000000000000000", "2500000000000000000000", "1300000000000000000000", "300", "5"]
}
105 changes: 105 additions & 0 deletions packages/protocol/releaseData/versionReports/release5-report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just merged in from a different branch? Should a report be added for the cREAL release or will that come later in the deployment process?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the deployment we can add that

"oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v4/contracts",
"newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v5/contracts",
"exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles/",
"report": {
"contracts": {
"GrandaMento": {
"changes": {
"storage": [],
"major": [
{
"contract": "GrandaMento",
"type": "NewContract"
}
],
"minor": [],
"patch": []
},
"versionDelta": {
"storage": "=",
"major": "+1",
"minor": "0",
"patch": "0"
}
},
"UsingRegistryV2": {
"changes": {
"storage": [],
"major": [
{
"contract": "UsingRegistryV2",
"type": "NewContract"
}
],
"minor": [],
"patch": []
},
"versionDelta": {
"storage": "=",
"major": "+1",
"minor": "0",
"patch": "0"
}
},
"StableToken": {
"changes": {
"storage": [],
"major": [],
"minor": [],
"patch": [
{
"contract": "StableToken",
"type": "DeployedBytecode"
}
]
},
"versionDelta": {
"storage": "=",
"major": "=",
"minor": "=",
"patch": "+1"
}
},
"StableTokenEUR": {
"changes": {
"storage": [],
"major": [],
"minor": [],
"patch": [
{
"contract": "StableTokenEUR",
"type": "DeployedBytecode"
}
]
},
"versionDelta": {
"storage": "=",
"major": "=",
"minor": "=",
"patch": "+1"
}
},
"Validators": {
"changes": {
"storage": [],
"major": [],
"minor": [],
"patch": [
{
"contract": "Validators",
"type": "DeployedBytecode"
}
]
},
"versionDelta": {
"storage": "=",
"major": "=",
"minor": "=",
"patch": "+1"
}
}
},
"libraries": {}
}
}
Loading