Skip to content

Commit

Permalink
Critesjosh/developer audit (celo-org#231)
Browse files Browse the repository at this point in the history
* update version, add npm2yarn

* update pages

* update tab item

* update tabs

* update forno

* update text
  • Loading branch information
critesjosh authored Nov 11, 2021
1 parent a5bc9d2 commit 6aca44f
Show file tree
Hide file tree
Showing 10 changed files with 2,021 additions and 1,830 deletions.
22 changes: 12 additions & 10 deletions docs/developer-resources/contractkit/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ ___

To install, run the following:

```bash
npm install @celo/contractkit
// or
yarn add @celo/contractkit
```bash npm2yarn
npm install web3 @celo/contractkit
```

You will need Node.js v12.x.
Expand All @@ -27,9 +25,11 @@ You will need Node.js v12.x.
To start working with ContractKit you need a `kit` instance and a valid net to connect with. In this example will use `alfajores` (you can read more about it [here](../../getting-started/alfajores-testnet))

```ts
import { newKit } from "@celo/contractkit";
import Web3 from "web3";
import { newKitFromWeb3 } from "@celo/contractkit";

const kit = newKit("https://alfajores-forno.celo-testnet.org");
const web3 = new Web3("https://alfajores-forno.celo-testnet.org")
const kit = newKitFromWeb3(web3);
```

Go to the [page about Forno](/developer-guide/forno) for details about different connection types and network endpoints.
Expand All @@ -38,12 +38,14 @@ Go to the [page about Forno](/developer-guide/forno) for details about different

If you are hosting your own node (you can follow [this guide](/getting-started/mainnet/running-a-full-node-in-mainnet) to run one) you can connect our ContractKit to it.

```ts
import { newKit } from "@celo/contractkit";
```js
import Web3 from "web3";
import { newKitFromWeb3 } from "@celo/contractkit";

// define localUrl and port with the ones of your node
// define localUrl and port with the ones for your node

const kit = newKit(`${localUrl}:${port}`);
const web3 = new Web3(`${localUrl}:${port}`);
const kit = newKitFromWeb3(web3);
```

Same as `Web3` we support `WebSockets`, `RPC` and connecting via `IPC`.
Expand Down
43 changes: 36 additions & 7 deletions docs/developer-resources/forno/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,24 @@ ___

## What is Forno?

Forno is a cLabs hosted node service for interacting with the Celo network. This allows you to connect to the Celo Blockchain without having to run your own node.
Forno is a cLabs hosted node service for interacting with the Celo network. This allows you to connect to the Celo Blockchain without having to run your own node.

:::tip

Forno does not offer a terms of service and there are no guarantees about service uptime. For production applications, consider using [Figment Datahub](/learn/developer-tools#figment-datahub) or [Quicknode](/learn/developer-tools#quicknode).

:::

Forno has HTTP and websocket endpoints that you can use to query current Celo data or post transactions that you would like to broadcast to the network. The service runs full nodes in non-archive mode, so you can query the current state of the blockchain, but cannot access historic state.

Forno can be used as an `Http Provider` with [ContractKit](/developer-guide/contractkit).

```javascript
const Web3 = require("web3");
const ContractKit = require("@celo/contractkit");
const kit = ContractKit.newKit("https://alfajores-forno.celo-testnet.org");

const web3 = new Web3("https://forno.celo.org");
const kit = ContractKit.newKitFromWeb3(web3);
```

Forno is a public node, so to send transactions from a Forno connection you will have to sign transactions with a private key before sending them to Forno. The [Hello Celo](/developer-resources/walkthroughs/hellocelo.md) guide shows you how to connect to the Alfajores testnet with Forno and use it to sign and send transactions on the network.
Expand All @@ -28,14 +37,34 @@ Forno is a public node, so to send transactions from a Forno connection you will

Consult [this page](/getting-started/choosing-a-network.md) to determine which network is right for you.

### Celo Mainnet

```bash
https://forno.celo.org
```

Websocket support:

```bash
wss://forno.celo.org/ws
```
Alfajores = 'https://alfajores-forno.celo-testnet.org'
'wss://alfajores-forno.celo-testnet.org/ws' (for websocket support)

Baklava = 'https://baklava-forno.celo-testnet.org'
### Alfajores Testnet

Mainnet = 'https://forno.celo.org'
'wss://forno.celo.org/ws' (for websocket support)
```bash
https://alfajores-forno.celo-testnet.org
```

Websocket support:

```bash
wss://alfajores-forno.celo-testnet.org/ws
```

### Baklava Testnet

```
https://baklava-forno.celo-testnet.org
```

### Websocket connections & Event listeners
Expand Down
4 changes: 1 addition & 3 deletions docs/developer-resources/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ View the [Developer Code Examples page](/developer-resources/start.md) to get st
- A minimal wrapper to make [ethers.js](https://docs.ethers.io/v5/) compatible with the Celo network
- [use-contractkit](https://github.com/celo-tools/use-contractkit)
- A [Web3Modal](https://web3modal.com/)-like experience that injects ContractKit into your web-based application. Supports a variety of different wallets, including but not limited to Valora, Ledger, Metamask (Celo compatible fork) and any WalletConnect compatible wallets
- [Wallet Connect](walkthroughs/valora-wc-v1.md) is an open source protocol for connecting decentralised applications to mobile wallets with QR code scanning or deep linking.
- [Python SDK](https://github.com/blaize-tech/celo-sdk-py)
- [Java SDK](https://github.com/blaize-tech/celo-sdk-java)

### Infrastructure

Expand Down Expand Up @@ -62,6 +59,7 @@ Similarities between Celo and Ethereum means you can use many of the most popula

- [Metamask](https://metamask.io/) is one of the most popular EVM blockchain wallets. Learn more about how to use Metamask with Celo [here](../getting-started/wallets/using-metamask-with-celo/index.md).
- ERC20, NFT (ERC721) and other smart contract interface standards are supported, see [Celo for Ethereum Developers](developer-resources/celo-for-eth-devs.md)
- [Hardhat](https://hardhat.org/)
- [Truffle](https://www.trufflesuite.com/)
- [OpenZeppelin](https://openzeppelin.com/)
- [Remix](https://remix.ethereum.org/)
Expand Down
27 changes: 7 additions & 20 deletions docs/getting-started/using-the-wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,18 @@ How to set up and use the Alfajores Testnet Celo Wallet.

___

## Install

:::caution

You will need either an account or an invitation in order to get the Celo Wallet in order to verify your phone number.

:::

### Getting an Invitation Code

#### Get an SMS Invite Code

If you don’t have an account, please visit [celo.org/build/wallet](https://celo.org/build/wallet) and enter your phone number to be messaged an invitation code. Please note that the Celo Wallet is presently only available for Android, with iOS coming soon.

#### Restore from Backup

If you already have an account \(and the corresponding seed phrase\), you can download the Celo wallet from the [play store](https://play.google.com/store/apps/details?id=org.celo.mobile.alfajores) and follow in-app instructions to import your wallet using the seed phrase.

### Downloading the Celo Wallet

To download the app on the Play Store, go [here](https://play.google.com/apps/testing/org.celo.mobile.alfajores). Note that you will need an account or an invitation code to use the wallet.
You can install Android, iOS and Web versions of the Alfajores testnet wallet from [celo.org/build/wallet](https://celo.org/build/wallet).

### Running the Celo Wallet Locally

For more information on how to run the Celo Wallet locally, please refer to the [mobile wallet setup instructions](/celo-codebase/wallet/intro.md)

### Get More Funds!

If you need more funds, you can always visit [celo.org/build/faucet](https://celo.org/build/faucet) and enter your address to get more Celo Dollars. You can find your address in the settings page within the wallet
If you need more funds, you can always visit [celo.org/build/faucet](https://celo.org/build/faucet) and enter your address to get more Celo Dollars. You can find your address in the settings page within the wallet.

### Connect a DApp

You can connect your DApp to the wallet using [WalletConnect](/learn/developer-tools.md#walletconnect) or [DAppKit](/learn/developer-tools.md#dappkit).
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const CELO_PARAMS = {
iconUrls: ['future'],
};
```

</TabItem>
<TabItem value='alfajores'>

Expand All @@ -70,8 +69,8 @@ const ALFAJORES_PARAMS = {
```

</TabItem>

<TabItem value='baklava'>
</TabItem>

```javascript
const BAKLAVA_PARAMS = {
Expand All @@ -83,8 +82,9 @@ const BAKLAVA_PARAMS = {
iconUrls: ['future'],
};
```
</TabItem>

</Tabs>>
</Tabs>

## Adding Tokens \(e.g. cUSD, cEUR\)

Expand Down Expand Up @@ -131,7 +131,7 @@ The following are examples for cUSD and cEUR.
* Token Contract Address for cEUR: `0x10c892a6ec43a53e45d0b916b4b7d383b1b78c0f`

</TabItem>
<TabItem value='celo'>
<TabItem value='baklava'>

* Token Contract Address for cUSD: `0x62492A644A588FD904270BeD06ad52B9abfEA1aE`
* Token Contract Address for cEUR: `0xf9ecE301247aD2CE21894941830A2470f4E774ca`
Expand Down
30 changes: 23 additions & 7 deletions docs/learn/developer-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,19 @@ The [Command-Line Interface](../community/release-process/base-cli-contractkit-d

It’s a command-line interface around the ContractKit. It allows you to interact with the Celo Protocol and smart contracts using command-line tools rather than writing JavaScript. It provides modules for interacting with modules on the ContractKit and is an excellent code reference when defining your own modules. Some common features you may want to consider are helping users participate in elections or in on-chain governance, voting for validators, or helping users interact with multi-sig contracts.

## WalletConnect

[WalletConnect](https://walletconnect.com/) is a standard across EVM compatible blockchains to connect wallets to dapps. It allows developers to build connections between wallets and dapps on the same desktop or mobile device, or between desktop dapps and mobile wallets.

## DAppKit

[DAppKit](../developer-guide/dappkit) is a lightweight set of functions that allow mobile dApps to work with the Celo Wallet to sign transactions and access the user's account. This allows for a better user experience:dDApps can focus on a great native experience without having to worry about key management. It also provides a simpler development experience, as no state or connection management is necessary.
:::warning

While DAppKit is functional, it is no longer being actively maintained in favor of WalletConnect. If WalletConnect does not work for your use case, you can use deep links directly. You can read more about how Valora handles this [here](https://github.com/valora-inc/wallet/blob/main/packages/mobile/docs/deeplinks.md).

:::

[DAppKit](../developer-guide/dappkit) is a lightweight set of functions that allow mobile dApps to work with the Celo Wallet to sign transactions and access the user's account. This allows for a better user experience: DApps can focus on a great native experience without having to worry about key management. It also provides a simpler development experience, as no state or connection management is necessary.

**DAppKit supports the following functionality:**

Expand All @@ -54,7 +64,7 @@ DAppKit is currently built with React Native in mind, though the excellent[ Expo

# Celo Networks

## **Mainnet**
## Mainnet

The production Celo network, [Mainnet](../getting-started/mainnet) was previously known as the Release Candidate 1 network. Deployed by the Celo community starting 4/22/20, the network is currently working towards enabling the Celo stability mechanism. Much of the activity is being driven by the validator organizations that are featured on the leaderboard of[ The Great Celo Stake Off](https://forum.celo.org/t/the-great-celo-stake-off-the-details/136).

Expand Down Expand Up @@ -95,6 +105,10 @@ Forno can be used as an HTTP Provider with ContractKit.

[Figment datahub](https://figment.io/datahub/celo/) is a service similar to Forno. They have some additional features that allow you to track how people are using your application in terms of the type and number of requests coming through the endpoints. They have a free tier with the option to pay for the service to increase limits to support more popular projects.

## Quicknode

[Quicknode](https://www.quicknode.com/chains/celo) is an enterprise grade node service with a dashboard, metrics, security controls, customer support and no rate limits (pay-as-you-go).

# Celo Wallets

[Celo Wallets](../getting-started/wallets) are tools that create accounts, manage keys, and help users transact on the Celo network.
Expand All @@ -107,18 +121,20 @@ The Celo Native Wallets section shows some popular wallets that were built speci

# Smart Contracts

A smart contract is a self-executing contract with the terms of the agreement being directly written into lines of code. The code and the agreements contained therein exist across a distributed, decentralized blockchain network. The code controls the execution, and transactions are trackable and irreversible.
A smart contract is a deterministic program running on a blockchain. The terms of the agreement (the program) are written as lines of code. The code and the agreements contained therein exist across a distributed, decentralized blockchain network. The code controls the execution, and transactions are trackable and irreversible.

Celo includes both protocol contracts and application-specific contracts.

Celo includes both protocol contracts and application-specific contracts.
Smart contracts running on Celo are functionally (and often programatically) identitcal to [smart contracts running on Ethereum](https://ethereum.org/en/developers/docs/smart-contracts/#top).

## Protocol Contracts

Protocol contracts exist at the lowest layer and include functionality like the Celo election process and code that runs the Celo proof of stake system and on-chain governance.
Protocol contracts exist at the lowest layer and include functionality like the Celo election process and code that runs the Celo proof of stake system and on-chain governance.

## Application Contracts

Application contracts aren’t built by cLabs. These contracts are custom-built by developers to support application functionality.
Application contracts may or may not be built by cLabs. These contracts are custom-built by developers to support application functionality.

## Ethereum Contracts

[OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts) has a common token, governance, access control, utility contracts written in Solidity.
[OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts) has a common token, governance, access control, utility contracts written in [Solidity](https://docs.soliditylang.org/en/latest/).
7 changes: 1 addition & 6 deletions docs/learn/evm-compatible-tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See [Celo for Ethereum Developers](../developer-guide/celo-for-eth-devs) for an

## Solidity

Solidity is an object-oriented, high-level language for implementing smart contracts. It’s easy to learn if you’re familiar with C++, Python or Javascript. It’s the most popular language on Ethereum with strong support for both tooling and resources. You leverage existing work done on Ethereum open source projects for Celo applications.
[Solidity](https://docs.soliditylang.org/en/latest/) is an object-oriented, high-level language for implementing smart contracts. It’s easy to learn if you’re familiar with C++, Python or Javascript. It’s the most popular language on Ethereum with strong support for both tooling and resources. You leverage existing work done on Ethereum open source projects for Celo applications.

## Truffle

Expand All @@ -36,11 +36,6 @@ Learn more about deploying contracts to Celo with Hardhat [here](../developer-re

Learn more about deploying contracts to Celo with Remix [here](../developer-resources/deploy-remix).

**Requirements**

* [Celo Extension Wallet](https://chrome.google.com/webstore/detail/celoextensionwallet/kkilomkmpmkbdnfelcpgckmpcaemjcdh)
* Celo Remix plugin

### Metamask

[MetaMask](https://metamask.io/) is a crypto wallet that can be used in-browser and on mobile to interact with the Ethereum blockchain. Many dApps in the space integrate with MetaMask, and we're excited to bring its functionality to the Celo ecosystem.
Expand Down
5 changes: 4 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,10 @@ module.exports = {
return `https://github.com/celo-org/docs/edit/main/docs/${docPath}`
},
routeBasePath: "/",
remarkPlugins: [math],
remarkPlugins: [
math,
[require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}]
],
rehypePlugins: [katex],
},
theme: {
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
},
"dependencies": {
"@crowdin/cli": "^3.7.0",
"@docusaurus/core": "2.0.0-beta.6",
"@docusaurus/plugin-client-redirects": "^2.0.0-beta.6",
"@docusaurus/preset-classic": "2.0.0-beta.6",
"@docusaurus/theme-search-algolia": "^2.0.0-beta.6",
"@docusaurus/core": "^2.0.0-beta.9",
"@docusaurus/plugin-client-redirects": "^2.0.0-beta.9",
"@docusaurus/preset-classic": "^2.0.0-beta.9",
"@docusaurus/remark-plugin-npm2yarn": "^2.0.0-beta.9",
"@docusaurus/theme-search-algolia": "^2.0.0-beta.9",
"@mdx-js/react": "^1.6.21",
"clsx": "^1.1.1",
"docusaurus-plugin-fathom": "^1.1.0",
Expand All @@ -44,7 +45,7 @@
]
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.0.0-beta.0",
"@docusaurus/module-type-aliases": "^2.0.0-beta.9",
"@tsconfig/docusaurus": "^1.0.2",
"@types/react": "^17.0.11",
"@types/react-helmet": "^6.1.1",
Expand Down
Loading

0 comments on commit 6aca44f

Please sign in to comment.