Skip to content

Commit

Permalink
Add EVM connectivity demo (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
dineshpinto authored Jun 13, 2024
2 parents 15456ea + 00d2478 commit 1e98622
Show file tree
Hide file tree
Showing 25 changed files with 1,007 additions and 26 deletions.
10 changes: 10 additions & 0 deletions docs/1-intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
sidebar_position: 1
slug: intro
title: Introduction
description: Introduction to Flare, the blockchain for data.
keywords:
[
flare-network,
blockchain,
data,
smart contracts,
flare-time-series-oracle,
flare-data-connector,
]
---

import ThemedImage from "@theme/ThemedImage";
Expand Down
3 changes: 3 additions & 0 deletions docs/2-network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
sidebar_position: 2
slug: network
title: Network
description: The configuration of Flare Network. Learn about the different networks, configuration, supported wallets, transaction format, smart contracts, consensus, and more.
keywords:
[flare-network, configuration, blockchain, data, smart-contracts, wallets]
---

import Tabs from "@theme/Tabs";
Expand Down
8 changes: 7 additions & 1 deletion docs/fdc/1-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ title: FDC

:::info
FDC is currently under development.
:::

For more information, see the three part State Connector guide:

- [Part 1: State Connector](/guides/how-to-state-connector)
- [Part 2: Attestation Types](/guides/attestation-types)
- [Part 3: EVM Connectivity](/guides/evm-connectivity)
:::
4 changes: 3 additions & 1 deletion docs/ftso/0-overview.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
slug: overview
title: FTSOv2
description: FTSOv2 is an enshrined oracle that provides decentralized data feeds to the Flare network.
keywords: [ftso, oracle, flare-time-series-oracle, flare-network]
---

import ThemedImage from "@theme/ThemedImage";
import useBaseUrl from "@docusaurus/useBaseUrl";

:::info
FTSOv2 is currently in alpha testing on Songbird Testnet Coston.
FTSOv2 is currently in alpha testing on Songbird Canary-Network and Songbird Testnet Coston.

Track the latest developments on [Github](https://github.com/flare-foundation/flare-smart-contracts-v2), or get involved in testing by joining the [Flare Discord](hhttps://discord.com/invite/flarenetwork).
:::
Expand Down
12 changes: 12 additions & 0 deletions docs/ftso/1-getting-started.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
---
slug: getting-started
title: Getting Started
description: Learn how to consume FTSOv2 feeds on Flare using an on-chain Solidity contract.
keywords:
[
ftso,
oracle,
flare-time-series-oracle,
flare-network,
smart-contracts,
solidity,
remix,
metamask,
]
---

import Remix from "@site/src/components/remix";
Expand Down
3 changes: 3 additions & 0 deletions docs/ftso/2-feeds.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
slug: feeds
title: Block-Latency Feeds
description: FTSOv2's block-latency feeds update incrementally with each new block on Flare, approximately every 1.8 seconds.
keywords:
[ftso, oracle, flare-time-series-oracle, flare-network, feeds, block-latency]
---

FTSOv2's block-latency feeds update incrementally with each new block on Flare, approximately every 1.8 seconds. These feeds have a single entrypoint function and primarily support cryptocurrency price feeds. Moreover, they come with the added advantage of being completely free to query and utilize in your decentralized application on Flare, with no gas costs involved.
Expand Down
22 changes: 16 additions & 6 deletions docs/ftso/4-solidity-reference.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
---
title: Solidity Reference
description: Solidity reference for FTSOv2 smart contracts.
keywords:
[
solidity,
reference,
ftso,
flare-time-series-oracle,
flare-network,
smart-contracts,
]
---

import Tabs from "@theme/Tabs";
Expand Down Expand Up @@ -31,18 +41,18 @@ import DocCardList from "@theme/DocCardList";

| Contract | Address | ABI |
|----------|---------|---------|
| FastUpdater | [`0x70e8870ef234EcD665F96Da4c669dc12c1e1c116`](https://songbird.flarescan.com/address/0x70e8870ef234EcD665F96Da4c669dc12c1e1c116) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x&format=raw) |
| FastUpdatesConfiguration | [`0x8D48a67e11CdB821C38c85FB92bcB3A1865aCEdF`](https://songbird.flarescan.com/address/0x8D48a67e11CdB821C38c85FB92bcB3A1865aCEdF) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x&format=raw) |
| FastUpdateIncentiveManager | [`0x596C70Ad6fFFdb9b6158F1Dfd0bc32cc72B82006`](https://songbird.flarescan.com/address/0x596C70Ad6fFFdb9b6158F1Dfd0bc32cc72B82006) | [ABI](hhttps://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x&format=raw) |
| FastUpdater | [`0x70e8870ef234EcD665F96Da4c669dc12c1e1c116`](https://songbird.flarescan.com/address/0x70e8870ef234EcD665F96Da4c669dc12c1e1c116) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x70e8870ef234EcD665F96Da4c669dc12c1e1c116&format=raw) |
| FastUpdatesConfiguration | [`0x8D48a67e11CdB821C38c85FB92bcB3A1865aCEdF`](https://songbird.flarescan.com/address/0x8D48a67e11CdB821C38c85FB92bcB3A1865aCEdF) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x8D48a67e11CdB821C38c85FB92bcB3A1865aCEdF&format=raw) |
| FastUpdateIncentiveManager | [`0x596C70Ad6fFFdb9b6158F1Dfd0bc32cc72B82006`](https://songbird.flarescan.com/address/0x596C70Ad6fFFdb9b6158F1Dfd0bc32cc72B82006) | [ABI](hhttps://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x596C70Ad6fFFdb9b6158F1Dfd0bc32cc72B82006&format=raw) |

</TabItem>
<TabItem value="coston" label="Songbird Testnet Coston">

| Contract | Address | ABI |
|----------|---------|---------|
| FastUpdater | [`0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9`](https://coston.testnet.flarescan.com/address/0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x&format=raw) |
| FastUpdatesConfiguration | [`0x9A53e14B58383642cdB2bb4D5C46989F05C6B5f9`](https://coston.testnet.flarescan.com/address/0x9A53e14B58383642cdB2bb4D5C46989F05C6B5f9) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x&format=raw) |
| FastUpdateIncentiveManager | [`0x8c45666369B174806E1AB78D989ddd79a3267F3b`](https://coston.testnet.flarescan.com/address/0x8c45666369B174806E1AB78D989ddd79a3267F3b) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x&format=raw) |
| FastUpdater | [`0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9`](https://coston.testnet.flarescan.com/address/0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9&format=raw) |
| FastUpdatesConfiguration | [`0x9A53e14B58383642cdB2bb4D5C46989F05C6B5f9`](https://coston.testnet.flarescan.com/address/0x9A53e14B58383642cdB2bb4D5C46989F05C6B5f9) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x9A53e14B58383642cdB2bb4D5C46989F05C6B5f9&format=raw) |
| FastUpdateIncentiveManager | [`0x8c45666369B174806E1AB78D989ddd79a3267F3b`](https://coston.testnet.flarescan.com/address/0x8c45666369B174806E1AB78D989ddd79a3267F3b) | [ABI](https://api.routescan.io/v2/network/mainnet/evm/19/etherscan/api?module=contract&action=getabi&address=0x8c45666369B174806E1AB78D989ddd79a3267F3b&format=raw) |

</TabItem>

Expand Down
10 changes: 10 additions & 0 deletions docs/ftso/guides/change-quote-feed.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ title: Change quote feed
tags: [quickstart, ftso, solidity]
slug: change-quote-feed
description: Change block-latency quote feeds using Solidity.
keywords:
[
ftso,
oracle,
flare-time-series-oracle,
flare-network,
smart-contracts,
solidity,
remix,
]
sidebar_position: 2
---

Expand Down
11 changes: 11 additions & 0 deletions docs/ftso/guides/make-volatility-incentive.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ title: Make a volatility incentive
tags: [quickstart, ftso, javascript, python]
slug: make-volatility-incentive
description: Make a volatility incentive offer using JS or Python.
keywords:
[
ftso,
oracle,
flare-time-series-oracle,
flare-network,
smart-contracts,
solidity,
javascript,
python,
]
sidebar_position: 3
---

Expand Down
11 changes: 11 additions & 0 deletions docs/ftso/guides/query-feed-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,16 @@ title: Query feed configuration
tags: [quickstart, ftso, python, rust, javascript, go]
slug: query-feed-configuration
description: Query the configuration of the block-latency feeds.
keywords:
[
ftso,
oracle,
flare-time-series-oracle,
flare-network,
smart-contracts,
solidity,
remix,
metamask,
]
sidebar_position: 4
---
11 changes: 11 additions & 0 deletions docs/ftso/guides/read-feeds-offchain.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ title: Read feeds offchain
tags: [quickstart, ftso, python, rust, javascript, go]
slug: read-feeds-offchain
description: Read block-latency feeds using JS, Python, Rust, or Go.
keywords:
[
javascript,
python,
rust,
go,
ftso,
oracle,
flare-time-series-oracle,
flare-network,
]
sidebar_position: 1
---

Expand Down
4 changes: 3 additions & 1 deletion docs/ftso/scaling/1-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ title: FTSOv2 Scaling
---

:::info
This portion of the documentation is currently under development.
Scaling is currently in alpha testing on Flare Testnet Coston2, Songbird Canary-Network and Songbird Testnet Coston.

Track the latest developments on [Github](https://github.com/flare-foundation/flare-smart-contracts-v2), or get involved in testing by joining the [Flare Discord](hhttps://discord.com/invite/flarenetwork).
:::
1 change: 0 additions & 1 deletion docs/ftso/scaling/4-solidity-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ import DocCardList from "@theme/DocCardList";
## Interfaces

<DocCardList />
```
4 changes: 3 additions & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ const config: Config = {
rehypePlugins: [rehypeKatex],
},
blog: {
sortPosts: "ascending",
path: "guides",
routeBasePath: "guides",
showReadingTime: true,
feedOptions: {
type: "all",
copyright: `Copyright © Flare Networks ${new Date().getFullYear()}.`,
},
blogDescription: "Guides",
blogTitle: "Guides",
blogDescription: "All guides for interacting with Flare.",
blogSidebarCount: "ALL",
blogSidebarTitle: "All guides",
onInlineTags: "throw",
Expand Down
8 changes: 5 additions & 3 deletions guides/2024-05-22-deploy-first-contract.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
slug: deploy-first-contract
title: Deploy your first smart contract
description: Learn how to deploy your first smart contract on Flare using MetaMask and Remix.
tags: [solidity, quickstart]
keywords: [solidity, smart-contract, metamask, remix, flare-network, blockchain]
---

import OpenMetamask from "/static/img/deploy-first-contract/0-open-metamask.png";
Expand Down Expand Up @@ -33,13 +35,13 @@ You can deploy your first smart contract and run it in your browser without prio

You will create and deploy a simple "Hello World" smart contract following these steps:

1. **Write:** Draft a smart contract outlining its logic, data storage, modification rules, access permissions, and interaction with other contracts.
1. **Write:** Draft a smart contract outlining its logic, updating a simple string state variable.

2. **Compile:** Convert your human-readable smart contract code into bytecode, comprehensible to the Flare blockchain.

3. **Deploy:** Send the compiled smart contract to the blockchain, where its code becomes immutable.

4. **Call functions:** Execute the functions defined in your contract, triggering changes in the blockchain's state.
4. **Call functions:** Execute the functions defined in your contract, triggering changes in the state of the blockchain.

## Steps

Expand Down Expand Up @@ -210,6 +212,6 @@ contract HelloWorld {
</details>

:::tip[What's next?]
Read FTSOv2's [Getting Started](../docs/ftso/getting-started) guide to learn how to connect your smart contracts to Flare's enshrined oracle and retrieve onchain data feeds.
Read FTSOv2's [Getting Started](../docs/ftso/getting-started) guide to learn how to connect your smart contracts to Flare's enshrined oracle and retrieve on-chain data feeds.

:::
2 changes: 2 additions & 0 deletions guides/2024-05-23-flare-dpos-mechanism.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
slug: flare-dpos-mechanism
title: Flare's DPoS mechanism
authors: [magurh]
description: Understand how Flare's Delegated Proof-of-Stake mechanism works and how it compares to other consensus mechanisms.
tags: [consensus, proof-of-stake]
keywords: [flare-network, consensus, proof-of-stake, delegated-proof-of-stake]
---

Flare leverages a Delegated Proof-of-Stake mechanism (DPoS), representing a substantial advancement in efficiency, security, and scalability over conventional Proof-of-Work (PoW) and Proof-of-Stake (PoS) blockchains. By employing this system, Flare fosters decentralization, enabling any token holder to participate in the block validation process. This inclusive approach ensures that network validators act in the network's best interests, further reinforcing its robustness and integrity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
slug: flare-for-javascript-developers
title: Flare for JavaScript Developers
authors: [dineshpinto]
description: Learn how to interact with Flare using JavaScript. In this guide, you will learn how to query a contract, compile a Solidity contract, and deploy your compiled contract on Flare.
tags: [javascript, quickstart, solidity]
keywords: [rust, quickstart, solidity, smart-contract, flare-network]
---

import Tabs from "@theme/Tabs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
slug: flare-for-python-developers
title: Flare for Python Developers
authors: [dineshpinto]
description: Learn how to interact with Flare using Python. This guide will help you query a contract on Flare, compile a Solidity contract, and deploy your compiled contract on Flare.
tags: [python, quickstart, solidity]
keywords: [rust, quickstart, solidity, smart-contract, flare-network]
---

import Tabs from "@theme/Tabs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
slug: flare-for-rust-developers
title: Flare for Rust Developers
authors: [dineshpinto]
description: Learn how to interact with Flare using Rust. In this guide, you will learn how to query a contract, compile a Solidity contract, and deploy your compiled contract on Flare.
tags: [rust, quickstart, solidity]
keywords: [rust, quickstart, solidity, smart-contract, flare-network]
---

import Tabs from "@theme/Tabs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ slug: flare-for-go-developers
title: Flare for Go Developers
authors: [dineshpinto]
tags: [go, quickstart, solidity]
description: Learn how to interact with Flare using Go, including querying a contract, compiling a contract, and deploying a contract.
keywords: [go, quickstart, solidity, smart-contract, flare-network]
---

import Tabs from "@theme/Tabs";
Expand Down
2 changes: 2 additions & 0 deletions guides/2024-06-11-how-to-state-connector.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
slug: how-to-state-connector
title: Part 1 - State Connector
authors: [lukaavbreht, filipkoprivec]
description: Learn how to bridge data across blockchains using the State Connector, understand the CCCR protocol, and attest to a Bitcoin transaction.
tags: [quickstart, bitcoin, fdc]
keywords: [quickstart, bitcoin, flare-data-connector, flare-network]
---

The State Connector bridges the gap between different blockchains, enabling the smooth exchange of information and synchronization of smart contracts and state changes. In this guide, you will learn how to:
Expand Down
9 changes: 5 additions & 4 deletions guides/2024-06-12-attestation-types.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
title: Part 2 - Attestation Types
slug: attestation-types
description: Learn about attestation types
description: Learn about Flare State Connector attestation types
authors: [lukaavbreht, filipkoprivec]
tags: [intermediate, fdc]
keywords: [quickstart, bitcoin, flare-data-connector, flare-network]
---

In [Part 1](/guides/how-to-state-connector) of this series, you learnt the basics of the State Connector protocol, and how to use it to prove a payment on an external chain. In this guide you will learn:
Expand All @@ -20,11 +21,11 @@ Out of the [full specification](https://github.com/flare-foundation/songbird-sta

- [BalanceDecreasingTransaction](https://github.com/flare-foundation/songbird-state-connector-protocol/blob/main/specs/attestations/active-types/BalanceDecreasingTransaction.md). Prove that a transaction decreased the balance of an address or that the address was the initiator of the transaction.

- [ConfirmedBLockHeightExists](https://github.com/flare-foundation/songbird-state-connector-protocol/blob/main/specs/attestations/active-types/ConfirmedBlockHeightExists.md). Prove that a block with a specified height is confirmed by a specified number of confirmations and provide additional details about the chain's block production rate.
- [ConfirmedBlockHeightExists](https://github.com/flare-foundation/songbird-state-connector-protocol/blob/main/specs/attestations/active-types/ConfirmedBlockHeightExists.md). Prove that a block with a specified height is confirmed by a specified number of confirmations and provide additional details about the chain's block production rate.

- [ReferencePaymentNonexistence](https://github.com/flare-foundation/songbird-state-connector-protocol/blob/main/specs/attestations/active-types/ReferencedPaymentNonexistence.md). Prove that a payment with the specified reference does not exist on the specified chain. This is useful for proving that someone did not honor a payment request.

The specification also includes `EVMTransaction`, which is more complex and powerful. This will be covered in Part 3 of this series.
The specification also includes `EVMTransaction`, which is more complex and powerful. This will be covered in [Part 3](/guides/evm-connectivity) of this series.

Each attestation type is designed to prove a specific aspect, whether it be about transactions, blocks, or offloading expensive computations off-chain to have the results available on-chain. The team has carefully studied the most important use cases and designed the attestation types to be safe, well-defined, and efficient.

Expand Down Expand Up @@ -1684,6 +1685,6 @@ This approach ensures that complex and resource-intensive computations can be pe

Congratulations — you made it this far! Now you see what the State Connector can do, how to use it, and some details you need to be careful about. As usual, check the repository for the full code and try to play around.

In [Part 3](/guides/evm-attestation), we will explore how information from EVM chains can be relayed and what we can do with it.
In [Part 3](/guides/evm-connectivity), we will explore how information from EVM chains can be relayed and what we can do with it.

A word of warning: while it might be tempting to save the whole proof structure in your smart contract (if you want to do some later operations), this is terribly inefficient from a gas standpoint, as you are writing a lot of data to memory and decoding nested structures is expensive. Additionally, since the structures are nested, even operating on them when in memory (or copying them from `calldata` to `memory`) generates large bytecode, which makes contract deployment more expensive or even impossible if you exceed the limit.
7 changes: 0 additions & 7 deletions guides/2024-06-13-evm-attestation.mdx

This file was deleted.

Loading

0 comments on commit 1e98622

Please sign in to comment.