diff --git a/packages/attestation-service/README.md b/packages/attestation-service/README.md index 789b462e833..d7a248144d9 100644 --- a/packages/attestation-service/README.md +++ b/packages/attestation-service/README.md @@ -46,3 +46,33 @@ yarn run db:migrate:dev You will also have to set the environment variables in `.env.development` Then start the service with `yarn run dev` (you'll have to add the appropriate credentials for the text providers) + +### Error Responses + +Here is a list of the error codes and messages returned by the Attestation Service and what they mean. In addition to the error codes listed below, the service also returns `500` for `Unknown Error`. + +#### 422, Unprocessable Entity + +- `Mismatching issuer, I am ${address}` - The attestation request references an issuer address that does not match that of the AS that actually received the request. +- `NO_INCOMPLETE_ATTESTATION_FOUND_ERROR / 'No incomplete attestation found'` - The Attestations contract has no record that this AS was randomly assigned as an issuer for the given account/identifier pair. +- `ATTESTATION_ERROR / 'Valid attestation could not be provided'` - A call to validateAttestationCode in the Attestations contract has failed. This method checks that (1) there is a non-expired incomplete attestation assigned to the issuer whose signature constitutes the given attestation code. +- `'Invalid securityCodePrefix'` - A security code prefix with an incorrect length was provided in the attestation request. +- `'Invalid smsRetrieverAppSig'` - The provided smsRetrieverAppSig does not match the regex `'^[\\w+]{5,12}$'` +- `'Attestation can no longer be re-requested'` - The user is re-requesting an attestation that the AS thinks was completed too long ago for it to accept the re-request. +- `'Delivery attempts exceeded'` - The AS has attempted to deliver this attestation to the user too many times and will not try again. +- `ErrorMessages.NO_PROVIDER_SETUP / 'No provider was setup for this phone number'` - The AS has not setup an SMS provider +- `ErrorMessages.INVALID_SIGNATURE / 'Invalid signature provided'` - The signature provided in a `AttestationServiceTestRequest` was not generated by either the AS's account address or attestation signer address. + +#### 404, Not Found + +- `'Attestation not found'` - The attestation the user is attempting to complete could not be found in the AS's database. + +#### 403, Forbidden + +- `'Security code attempts exceeded'` - The user has attempted to complete the attestation with an incorrect security code too many times. The attestation can no longer be completed. +- `'Invalid security code'` - The user has attempted to complete the attestation with an incorrect security code. + +#### 401, Unauthorized + +- `'Missing authentication'` - the authentication header is missing from the request +- `'Invalid signature'` - The authentication header failed signature verification. It should be signed by either the account's DEK or wallet key. diff --git a/packages/docs/celo-codebase/protocol/plumo.md b/packages/docs/celo-codebase/protocol/plumo.md index 771db10b4b7..b98a555e564 100644 --- a/packages/docs/celo-codebase/protocol/plumo.md +++ b/packages/docs/celo-codebase/protocol/plumo.md @@ -65,11 +65,13 @@ You can run the contributor software locally or on cloud VMs, but desktop machin With these kind of machines, participiation in the setup should take around 30 hours, potentially a bit more or much less, depending on your specific hardware and internet connection. -## Running the Setup - Phase 1 +## Running the Setup + +### Phase 1 The instructions below are for the first phase of the Plumo setup, Powers of Tau. -### Generate your address +#### Generate your address The first step to participating is generating your Celo address in a secure location. @@ -90,7 +92,7 @@ The first step to participating is generating your Celo address in a secure loca * Send the address generated to plumo@celo.org. * Keep the resulting `plumo.keys` file. Ideally, it will be stored in a location that's easy to destroy afterwards, such as a USB thumbdrive. -### Run the Contributor software +#### Run the Contributor software Next you'll obtain the `contribute` binary and begin contributing to the Plumo setup. @@ -118,6 +120,59 @@ cLabs is running the coordinator server, which has a list of approved participan Once this is running, you can leave the machine running -- no direct action is needed. This will run for about ~36 hours, after which the software will terminate running and you will have finished contributing to the Plumo setup! +### Phase 2 + +The instructions below are for the second phase of the Plumo setup, the Plumo circuit. + +#### Generate your address + +The first step to participating is generating your Celo address in a secure location. + +* Obtain the `generate` binary: + * Option one - compile the `generate` binary: + * Install Rust 1.52 using `rustup install 1.52.1`. If you don't have `rustup` installed, follow the instructions in https://rustup.rs/. If you're using an Apple M1 machine, install the beta version of Rust using `rustup install beta`. + * `git clone https://github.com/celo-org/snark-setup-operator` + * `cd snark-setup-operator` + * `git checkout 33717c3b0869c605e6c3627446e916f268712e00` + * `cargo build --release --bin generate` + * Now you can use `./target/release/generate` + * Option two - if you prefer using a precompiled binary, download the `generate` binary corresponding to your OS from [here](https://github.com/celo-org/snark-setup-operator/releases/tag/v1.2.2). +* Use `b2sum` to check the hash of the binary against the hash in the download page by running `b2sum FILE`, where `FILE` is the `contribute` binary name for your OS. If you don't have `b2sum` installed, you can download it from `https://github.com/dchest/b2sum`, for example. +* Run it in a command line - navigate in the command line to the relevant folder - and follow the instructions. + * When asked to `Enter some entropy for your Plumo seed:`, you can use any source of entropy. + * Make sure to save your passphrase - you will need it later. + * If you are using a USB thumbdrive, you can use the flag `--keys-file KEYS_FILE`, passing in the respective file path to save the key on the drive itself. +* Send the address generated to plumo@celo.org. +* Keep the resulting `plumo.keys` file. Ideally, it will be stored in a location that's easy to destroy afterwards, such as a USB thumbdrive. + +#### Run the Contributor software + +Next you'll obtain the `contribute` binary and begin contributing to the Plumo setup. + +cLabs is running the coordinator server, which has a list of approved participant addresses. Additionally, cLabs is running a few verifiers that verify contributions on-demand, allowing the setup to make progress. + +* After receiving confirmation from cLabs, obtain the `contribute` binary: + * Option one - compile the `contribute` binary: + * Install Rust 1.52 using `rustup install 1.52.1`. If you don't have `rustup` installed, follow the instructions in https://rustup.rs/. If you're using an Apple M1 machine, install the beta version of Rust using `rustup install beta`. + * `git clone https://github.com/celo-org/snark-setup-operator` + * `cd snark-setup-operator` + * `git checkout 33717c3b0869c605e6c3627446e916f268712e00` + * `cargo build --release --bin contribute` + * Now you can use `./target/release/contribute` + * Option two - if you prefer using a precompiled binary, download the `contribute` binary corresponding to your OS from [here](https://github.com/celo-org/snark-setup-operator/releases/tag/v1.2.2). +* Use `b2sum` to check the hash of the binary against the hash in the download page by running `b2sum FILE`, where `FILE` is the `contribute` binary name for your OS. If you don't have `b2sum` installed, you can download it from `https://github.com/dchest/b2sum`, for example. +* Run it as follows, assuming your keys reside in KEYS_FILE: + * Windows users: `./contribute-windows.exe --keys-file KEYS_FILE` + * macOS users: `./contribute-macos --keys-file KEYS_FILE` + * Linux users: `./contribute-linux --keys-file KEYS_FILE` + + For example, assuming you're using Linux and your keys reside in `/mnt/plumo/plumo.keys`, you'd run: `./contribute-linux --keys-file /mnt/plumo/plumo.keys`. +* You will be asked for your passphrase - enter the same one from earlier. + * Follow the same process from earlier when prompted for additional entropy. +* Wait until you see 0/256 on the progress bar. This means that your contribution has started, and you are succesfully running the contributor binary. + +Once this is running, you can leave the machine running -- no direct action is needed. This will run for about ~36 hours, after which the software will terminate running and you will have finished contributing to the Plumo setup! + ### Publish your attestation The `contribute` binary produces a `plumo.attestation` file that contains a signature with your address. After your participation finishes (and not before!), please post it (here)[https://github.com/celo-org/plumo-ceremony-attestations] by creating a new issue! If you use precompiled binaries, be sure to mention you've verified the binary hashes posted on the releases page match the downloaded files. diff --git a/packages/docs/developer-resources/celo-dapp-gallery.md b/packages/docs/developer-resources/celo-dapp-gallery.md index 1e588b3c505..6a0ab28a7ff 100644 --- a/packages/docs/developer-resources/celo-dapp-gallery.md +++ b/packages/docs/developer-resources/celo-dapp-gallery.md @@ -116,6 +116,10 @@ Savings Circles let you pool funds with your friends to save for large purchases [Symmetric](https://symmetric.finance/) is a fork of Balancer for Celo. Symmetric is [open source on GitHub](https://github.com/centfinance), has a tokenomics model that includes a risk fund protecting traders, is to be DAO controlled and has a roadmap of new features. +### Tradegen + +[Tradegen](https://www.tradegen.io/) is a decentralized social trading platform that aims to make algo trading more inclusive and transparent. The platform consists of trading strategies, user-managed pools, and a marketplace for custom indicators/comparators to use in on-chain trading bots. Tradegen is [open source on GitHub](https://github.com/Tradegen/tradegen). + ## Umoja UMOJA is an open banking platform that enables NGOs and FSPs to provide flexible micro-financing to anyone with a phone. Umoja is [open source on GitHub](https://github.com/Emerging-Impact) and consists of a suite of APIs and products to make digital money accounts more accessible (and more easily to develop for other financial applications). diff --git a/packages/docs/getting-started/wallets.md b/packages/docs/getting-started/wallets.md index 5838437af5b..7f72a6808f0 100644 --- a/packages/docs/getting-started/wallets.md +++ b/packages/docs/getting-started/wallets.md @@ -46,6 +46,14 @@ Celo Extension Wallet is a fork of Metamask for the Celo Network. It's a browser - Maintainers: [DSRV Labs](https://www.dsrvlabs.com/en/) - Ledger support: Yes +### Steakwallet + +Steakwallet is a non-custodial, multi chain staking wallet. It aims to be the hub for mobile DeFi, supporting Celo from the very start. + +- [steakwallet.fi](https://steakwallet.fi) +- Platforms: Android, iOS +- Maintainers: [Steakwallet LLC](https://steakwallet.fi) + ## Celo Compatible Wallets There are currently a few other compatible wallets. When the upcoming [Donut hard-fork](https://github.com/celo-org/celo-proposals/issues/94) is live, Celo transactions will become compatible with Ethereum transactions. This will allow some Ethereum wallets to work with Celo. More updates on this coming soon. diff --git a/packages/docs/overview.md b/packages/docs/overview.md index a95354b467f..fe71f116dd2 100644 --- a/packages/docs/overview.md +++ b/packages/docs/overview.md @@ -108,11 +108,11 @@ Since light clients need not trust full nodes, as they can verify their work, th ### Stable Cryptocurrencies -Celo enables a family of stable-value ERC-20 tokens whose values can track the value of any asset, including fiat currencies, commodities, and even natural resources. The first stablecoin that will be supported is the Celo Dollar, which tracks the value of the U.S. Dollar. CELO serves as the collateral for Celo Dollar, which is redeemable for 1 US Dollar worth of CELO, ensuring that transactions can occur quickly, cheaply and reliably on-chain. +Celo enables a family of stable-value tokens whose values can track the value of any asset, including fiat currencies, commodities, and even natural resources. Stablecoins supported include the Celo Dollar (cUSD) and the Celo Euro (cEUR), which track the value of the U.S. Dollar and Euro respectively. CELO and a basket of other assets including BTC and ETH serves as the collateral for these stablecoins. These stablecoins are redeemable for CELO, ensuring that transactions can occur quickly, cheaply and reliably on-chain. -Celo's stability mechanism allows users to create a new Celo Dollar by sending 1 US Dollar worth of CELO to the reserve, or burn a Celo Dollar by redeeming it for 1 US Dollar worth of CELO. +Celo's stability mechanism allows users to create a new cUSD and cEUR by sending CELO to the reserve, or burn cUSD and cEUR by redeeming it for their equivalent value in CELO. -This mechanism relies on a series of Oracles, or information feeds from exchanges external to the network, to report the CELO to US Dollar market rate. To minimize the risk of a run on CELO collateral when these reported values are inaccurate or out-of-date, Celo uses an on-chain constant-product-market-maker model, inspired by the [Uniswap](https://uniswap.io/) system. This mechanism adjusts the redemption price of CELO until either arbitrage occurs (so that the on-chain price dynamically adjusts until the offered rate meets the external rate) or Oracles reset the on-chain price. +This mechanism relies on a series of Oracles, or information feeds from exchanges external to the network, to report the CELO to US Dollar or Euro market rate. To minimize the risk of a run on CELO collateral when these reported values are inaccurate or out-of-date, Celo uses an on-chain constant-product-market-maker model, inspired by the [Uniswap](https://uniswap.io/) system. This mechanism adjusts the redemption price of CELO until either arbitrage occurs (so that the on-chain price dynamically adjusts until the offered rate meets the external rate) or Oracles reset the on-chain price. The Celo protocol ensures that there is sufficient CELO collateral to redeem the amount of CELO in circulation through several sources. These include a [stability fee](celo-codebase/protocol/stability/stability-fees.md) levied on Celo Dollar balances, a transfer from [epoch rewards](celo-codebase/protocol/proof-of-stake/community-fund.md#bolstering-the-reserve), plus the proceeds from the spread when interacting with the on-chain market-maker mechanism. diff --git a/packages/helm-charts/blockscout/templates/blockscout-web.ingress.yaml b/packages/helm-charts/blockscout/templates/blockscout-web.ingress.yaml index d8031c118e0..449cb36090c 100644 --- a/packages/helm-charts/blockscout/templates/blockscout-web.ingress.yaml +++ b/packages/helm-charts/blockscout/templates/blockscout-web.ingress.yaml @@ -21,6 +21,9 @@ metadata: location ~ /wobserver/.* { deny all; } + location ~ /address/(.*)/token_transfers { + return 301 /address/$1/token-transfers; + } spec: tls: - hosts: diff --git a/packages/protocol/scripts/bash/deploy_release_contracts.sh b/packages/protocol/scripts/bash/deploy_release_contracts.sh index f133865502d..2bbb7fa2b4f 100755 --- a/packages/protocol/scripts/bash/deploy_release_contracts.sh +++ b/packages/protocol/scripts/bash/deploy_release_contracts.sh @@ -43,7 +43,7 @@ done [ -z "$DEPLOYED_GRANTS" ] && echo 'No deployed grants file provided via -d flag: defaulting to `scripts/truffle/deployedGrants.json`' && DEPLOYED_GRANTS="scripts/truffle/deployedGrants.json" [ -z "$OUTPUT_FILE" ] && echo "Need to set output file via the -o flag" && exit 1; -CONTRACT_ARTIFACTS_DIR="$PWD/build/$NETWORK" +CONTRACT_ARTIFACTS_DIR="$PWD/build" if [[ ! -d "$CONTRACT_ARTIFACTS_DIR" ]]; then echo "Error: no contract artifacts found in $CONTRACT_ARTIFACTS_DIR. Use download-artifacts to obtain them, or build them locally." >&2 diff --git a/packages/sdk/connect/src/connection.ts b/packages/sdk/connect/src/connection.ts index 74127c4e6ed..e4a117cbaf3 100644 --- a/packages/sdk/connect/src/connection.ts +++ b/packages/sdk/connect/src/connection.ts @@ -8,6 +8,7 @@ import { assertIsCeloProvider, CeloProvider } from './celo-provider' import { Address, Block, + BlockHeader, BlockNumber, CeloTx, CeloTxObject, @@ -25,6 +26,7 @@ import { inputSignFormatter, outputBigNumberFormatter, outputBlockFormatter, + outputBlockHeaderFormatter, outputCeloTxFormatter, outputCeloTxReceiptFormatter, } from './utils/formatter' @@ -407,18 +409,18 @@ export class Connection { return hexToNumber(response.result)! } + private isBlockNumberHash = (blockNumber: BlockNumber) => + blockNumber instanceof String && blockNumber.indexOf('0x') === 0 + getBlock = async ( blockHashOrBlockNumber: BlockNumber, fullTxObjects: boolean = true ): Promise => { - // Reference: https://eth.wiki/json-rpc/API#eth_getBlockByNumber - let fnCall = 'eth_getBlockByNumber' - if (blockHashOrBlockNumber instanceof String && blockHashOrBlockNumber.indexOf('0x') === 0) { - // Reference: https://eth.wiki/json-rpc/API#eth_getBlockByHash - fnCall = 'eth_getBlockByHash' - } + const endpoint = this.isBlockNumberHash(blockHashOrBlockNumber) + ? 'eth_getBlockByHash' // Reference: https://eth.wiki/json-rpc/API#eth_getBlockByHash + : 'eth_getBlockByNumber' // Reference: https://eth.wiki/json-rpc/API#eth_getBlockByNumber - const response = await this.rpcCaller.call(fnCall, [ + const response = await this.rpcCaller.call(endpoint, [ inputBlockNumberFormatter(blockHashOrBlockNumber), fullTxObjects, ]) @@ -426,6 +428,18 @@ export class Connection { return outputBlockFormatter(response.result) } + getBlockHeader = async (blockHashOrBlockNumber: BlockNumber): Promise => { + const endpoint = this.isBlockNumberHash(blockHashOrBlockNumber) + ? 'eth_getHeaderByHash' + : 'eth_getHeaderByNumber' + + const response = await this.rpcCaller.call(endpoint, [ + inputBlockNumberFormatter(blockHashOrBlockNumber), + ]) + + return outputBlockHeaderFormatter(response.result) + } + getBalance = async (address: Address, defaultBlock?: BlockNumber): Promise => { // Reference: https://eth.wiki/json-rpc/API#eth_getBalance const response = await this.rpcCaller.call('eth_getBalance', [ diff --git a/packages/sdk/connect/src/utils/formatter.ts b/packages/sdk/connect/src/utils/formatter.ts index 0302972c87e..9924d5c0ee3 100644 --- a/packages/sdk/connect/src/utils/formatter.ts +++ b/packages/sdk/connect/src/utils/formatter.ts @@ -3,7 +3,15 @@ import { isValidAddress, toChecksumAddress } from '@celo/utils/lib/address' import { sha3 } from '@celo/utils/lib/solidity' import BigNumber from 'bignumber.js' import { encode } from 'utf8' -import { Block, BlockNumber, CeloTx, CeloTxPending, CeloTxReceipt, Log } from '../types' +import { + Block, + BlockHeader, + BlockNumber, + CeloTx, + CeloTxPending, + CeloTxReceipt, + Log, +} from '../types' /** * Formats the input of a transaction and converts all values to HEX @@ -124,15 +132,23 @@ export function inputBlockNumberFormatter(blockNumber: BlockNumber) { : numberToHex(blockNumber.toString())! } -export function outputBlockFormatter(block: any): Block { +export function outputBlockHeaderFormatter(blockHeader: any): BlockHeader { // transform to number - block.gasLimit = hexToNumber(block.gasLimit) - block.gasUsed = hexToNumber(block.gasUsed) - block.size = hexToNumber(block.size) - block.timestamp = hexToNumber(block.timestamp) - if (block.number !== null) { - block.number = hexToNumber(block.number) + blockHeader.gasLimit = hexToNumber(blockHeader.gasLimit) + blockHeader.gasUsed = hexToNumber(blockHeader.gasUsed) + blockHeader.size = hexToNumber(blockHeader.size) + blockHeader.timestamp = hexToNumber(blockHeader.timestamp) + if (blockHeader.number !== null) { + blockHeader.number = hexToNumber(blockHeader.number) + } + if (blockHeader.miner) { + blockHeader.miner = toChecksumAddress(blockHeader.miner) } + return blockHeader as BlockHeader +} + +export function outputBlockFormatter(block: any): Block { + block = outputBlockHeaderFormatter(block) if (block.difficulty) { block.difficulty = outputBigNumberFormatter(block.difficulty) @@ -149,10 +165,6 @@ export function outputBlockFormatter(block: any): Block { }) } - if (block.miner) { - block.miner = toChecksumAddress(block.miner) - } - return block as Block } diff --git a/packages/sdk/contractkit/src/base.ts b/packages/sdk/contractkit/src/base.ts index 0b2b4da000d..ed079912dae 100644 --- a/packages/sdk/contractkit/src/base.ts +++ b/packages/sdk/contractkit/src/base.ts @@ -45,6 +45,7 @@ const AuxiliaryContracts = [ CeloContract.MultiSig, CeloContract.MetaTransactionWalletDeployer, CeloContract.MetaTransactionWallet, + CeloContract.ERC20, ] export const RegisteredContracts = AllContracts.filter((v) => !AuxiliaryContracts.includes(v))