From 1c1f5b41739585957828607a9bbe1b48ca07d4b2 Mon Sep 17 00:00:00 2001 From: sashaaldrick Date: Fri, 14 Jul 2023 14:10:59 +0100 Subject: [PATCH 1/2] rewrite URLs to drop /developer/docs --- .env.example | 2 +- README.md | 2 +- .../formal-verification/coq/index.md | 6 +- .../formal-verification-on-tezos/index.md | 14 ++--- .../formal-verification/introduction/index.md | 14 ++--- .../modelling-theorem/index.md | 20 +++---- .../advanced-topics/smart-rollups/index.md | 2 +- .../adding-removing-liquidity.md | 4 +- .../build-your-first-app/swapping-tokens.md | 2 +- src/pages/app-development/indexers/dipdup.md | 56 +++++++++---------- src/pages/app-development/indexers/index.md | 56 +++++++++---------- src/pages/baking/bakers-list/index.md | 8 +-- src/pages/baking/baking-explained/index.md | 6 +- src/pages/baking/delegating/index.md | 2 +- src/pages/defi/cross-chain-swaps/index.md | 8 +-- src/pages/defi/ctez/index.md | 14 ++--- src/pages/defi/dex/index.md | 8 +-- src/pages/defi/lending/index.md | 4 +- src/pages/defi/stablecoins/index.md | 6 +- src/pages/defi/synthetics/index.md | 4 +- src/pages/defi/wrapped-assets/index.md | 6 +- .../nft/build-an-nft-marketplace/index.md | 6 +- .../nft/build-an-nft-marketplace/part-2.md | 4 +- .../nft/build-an-nft-marketplace/part-3.md | 8 +-- .../nft/build-an-nft-marketplace/part-4.md | 8 +-- src/pages/nft/create-an-nft/nft-pinata.md | 40 ++++++------- .../smart-contracts/avoiding-flaws/index.md | 4 +- .../simplified-contracts/index.md | 2 +- .../smart-contract-languages/index.md | 8 +-- .../smart-contract-languages/smartpy.md | 10 ++-- .../smart-contracts-concepts/index.md | 20 +++---- .../smart-contracts/token-standards/index.md | 12 ++-- .../block-explorers/tzstats-main-features.md | 16 +++--- .../block-explorers/tzstats-smart-contract.md | 12 ++-- .../monitor-a-node/index.md | 12 ++-- .../ligo/index.md | 2 +- .../smartpy/index.md | 6 +- .../governance/governance-overview.md | 2 +- .../skeleton_template.md | 2 +- .../build-an-nft-marketplace/index.md | 8 +-- .../build-an-nft-marketplace/part-2.md | 6 +- .../build-an-nft-marketplace/part-3.md | 10 ++-- .../build-an-nft-marketplace/part-4.md | 8 +-- .../adding-removing-liquidity.md | 4 +- .../build-your-first-app/swapping-tokens.md | 2 +- .../ligo/index.md | 4 +- .../smartpy/index.md | 8 +-- src/styles/fonts.css | 6 +- 48 files changed, 237 insertions(+), 237 deletions(-) diff --git a/.env.example b/.env.example index 0de405140..6abcceb6e 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -NEXT_PUBLIC_BASE_PATH=/developers/docs +NEXT_PUBLIC_BASE_PATH=/ NEXT_PUBLIC_DOCSEARCH_APP_ID=R2IYF7ETH7 NEXT_PUBLIC_DOCSEARCH_API_KEY=599cec31baffa4868cae4e79f180729b NEXT_PUBLIC_DOCSEARCH_INDEX_NAME=docsearch diff --git a/README.md b/README.md index 91bab2c33..95380447e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Tezos Documentation Portal (Beta) -This is the source code for the Tezos Documentation Portal: https://tezos.com/developers/docs +This is the source code for the Tezos Documentation Portal: https://docs.tezos.com ## Contributing diff --git a/src/pages/advanced-topics/formal-verification/coq/index.md b/src/pages/advanced-topics/formal-verification/coq/index.md index 8c951fe3f..36bf1d13a 100644 --- a/src/pages/advanced-topics/formal-verification/coq/index.md +++ b/src/pages/advanced-topics/formal-verification/coq/index.md @@ -75,10 +75,10 @@ For a more technical understanding of the operation of Mi-Cho-Coq, this tutorial We can execute the proof of 'Example test_orb2" (Example keyword below) using the Coq proof assistant. -{% figure src="/developers/docs/images/coq/proof_1.jpeg" alt="coq-proof-execution-1" caption="Proof of execution with the Coq software, proving that `false or false => false`. 1/3" %} {% /figure %} +{% figure src="/images/coq/proof_1.jpeg" alt="coq-proof-execution-1" caption="Proof of execution with the Coq software, proving that `false or false => false`. 1/3" %} {% /figure %} -{% figure src="/developers/docs/images/coq/proof_2.jpeg" alt="coq-proof-execution-2" caption="Proof of execution with the Coq software, simplification step using the definition of `orb`. 2/3" %} {% /figure %} +{% figure src="/images/coq/proof_2.jpeg" alt="coq-proof-execution-2" caption="Proof of execution with the Coq software, simplification step using the definition of `orb`. 2/3" %} {% /figure %} -{% figure src="/developers/docs/images/coq/proof_3.jpeg" alt="coq-proof-execution-3" caption="Proof of execution with the Coq software, reflexivity step compares both terms to end the proof. 3/3" %} {% /figure %} +{% figure src="/images/coq/proof_3.jpeg" alt="coq-proof-execution-3" caption="Proof of execution with the Coq software, reflexivity step compares both terms to end the proof. 3/3" %} {% /figure %} End of proof. diff --git a/src/pages/advanced-topics/formal-verification/formal-verification-on-tezos/index.md b/src/pages/advanced-topics/formal-verification/formal-verification-on-tezos/index.md index 9f7a06e21..ded1d6140 100644 --- a/src/pages/advanced-topics/formal-verification/formal-verification-on-tezos/index.md +++ b/src/pages/advanced-topics/formal-verification/formal-verification-on-tezos/index.md @@ -7,7 +7,7 @@ lastUpdated: 30th June 2023 Smart contracts, though most are relatively simple, are prone to bugs like any program. However, within the context of a blockchain, it can be hard for a developer to predict and test for all the interactions and externalities possible. As a consequence, this can lead to critical bugs which can and has led to the loss of funds. -One of the great benefits of Tezos is the ability to formally verify smart contracts. Tezos makes this formal verification possible for smart contracts with the design of Michelson and with tools such as [Coq](/developers/docs/advanced-topics/formal-verification/coq/) and the [Mi-Cho-Coq library](/developers/docs/advanced-topics/formal-verification/michocoq). +One of the great benefits of Tezos is the ability to formally verify smart contracts. Tezos makes this formal verification possible for smart contracts with the design of Michelson and with tools such as [Coq](/advanced-topics/formal-verification/coq/) and the [Mi-Cho-Coq library](/advanced-topics/formal-verification/michocoq). ## Trust & Formal Verification @@ -26,7 +26,7 @@ The formal verification process on Tezos for smart contracts consists of: ### How does Tezos make Formal Verification possible? -The [Michelson](/developers/docs/smart-contracts/smart-contract-languages/michelson/) language has been designed to take formal verification into account: +The [Michelson](/smart-contracts/smart-contract-languages/michelson/) language has been designed to take formal verification into account: - introducing a typing system on a stack-based language - preventing JUMP instructions which would make the formal verification more complex @@ -45,24 +45,24 @@ Generally speaking, smart contracts also have specific characteristics making th There are many proof assistants available to translate a smart contract into a formal definition, formalize its specifications and ensure its compliance with these specifications: -- [Coq](/developers/docs/advanced-topics/formal-verification/coq/) is a proof assistant designed to develop mathematical proofs, and especially to write formal specifications, programs, and proofs that programs comply to their specifications. +- [Coq](/advanced-topics/formal-verification/coq/) is a proof assistant designed to develop mathematical proofs, and especially to write formal specifications, programs, and proofs that programs comply to their specifications. - The specification of a program represents **what** a program is meant to do. _Coq_ provides a language [Gallina](https://en.wikipedia.org/wiki/Coq#Overview) for modelling logical objects such as theorems, axioms and assumptions. The proof is a sequence of logical deductions (based on axioms, assumptions and the inference rule) that verify the **compliance of a program to its specification**. -- [Mi-Cho-Coq](/developers/docs/advanced-topics/formal-verification/michocoq), a library which bridges between Tezos smart contracts and formal proofs in the [Coq](/developers/docs/advanced-topics/formal-verification/coq/) proof assistant. +- [Mi-Cho-Coq](/advanced-topics/formal-verification/michocoq), a library which bridges between Tezos smart contracts and formal proofs in the [Coq](/advanced-topics/formal-verification/coq/) proof assistant. - [K-Michelson](https://runtimeverification.github.io/michelson-semantics/) is based on K-framework which is a generic tool for specifications and proof languages. ### Mi-Cho-Coq {% callout type="note" title="Further Reading" %} -If you want a deeper introduction to using Mi-Cho-Coq, please see our page on [Mi-Cho-Coq](/developers/docs/advanced-topics/formal-verification/michocoq). The official repository can be found [here](https://gitlab.com/nomadic-labs/mi-cho-coq). +If you want a deeper introduction to using Mi-Cho-Coq, please see our page on [Mi-Cho-Coq](/advanced-topics/formal-verification/michocoq). The official repository can be found [here](https://gitlab.com/nomadic-labs/mi-cho-coq). {% /callout %} Coq, combined with Mi-Cho-Coq library, provides a manual low-level approach to manually write a proof. This approach performs verification at the smart contract level (i.e. the Michelson script). It also provides a way to perform formal verification on smart contracts written in high-level languages (LIGO, SmartPy) since ultimately they are compiled to Michelson. -The Mi-Cho-Coq library represents the bridge between Tezos smart contracts and formal proofs in Coq. It is a formalization of the Michelson language using the Coq interactive theorem prover. In practice, the Mi-Cho-Coq library is used to produce a formal definition of a Michelson script (known as the the [modelling theorem](/developers/docs/advanced-topics/formal-verification/modelling-theorem/#modelling-a-smart-contract-as-a-theorem)). Each Michelson instruction has its equivalent in the Mi-Cho-Coq library. +The Mi-Cho-Coq library represents the bridge between Tezos smart contracts and formal proofs in Coq. It is a formalization of the Michelson language using the Coq interactive theorem prover. In practice, the Mi-Cho-Coq library is used to produce a formal definition of a Michelson script (known as the the [modelling theorem](/advanced-topics/formal-verification/modelling-theorem/#modelling-a-smart-contract-as-a-theorem)). Each Michelson instruction has its equivalent in the Mi-Cho-Coq library. -Specifically, the Mi-Cho-Coq library provides a formal definition (in *Gallina*) of the **type system** (Michelson types), the **syntax** (instructions of the Michelson), the **semantics** (evaluator) and the lexing and parsing (for type-checking) (see [Mi-Cho-Coq](/developers/docs/advanced-topics/formal-verification/michocoq)). +Specifically, the Mi-Cho-Coq library provides a formal definition (in *Gallina*) of the **type system** (Michelson types), the **syntax** (instructions of the Michelson), the **semantics** (evaluator) and the lexing and parsing (for type-checking) (see [Mi-Cho-Coq](/advanced-topics/formal-verification/michocoq)). There are several considerations to take into account when thinking about using Mi-Cho-Coq: - data serialization/deserialization is not supported yet diff --git a/src/pages/advanced-topics/formal-verification/introduction/index.md b/src/pages/advanced-topics/formal-verification/introduction/index.md index 9f01067a9..5ec17faa4 100644 --- a/src/pages/advanced-topics/formal-verification/introduction/index.md +++ b/src/pages/advanced-topics/formal-verification/introduction/index.md @@ -6,27 +6,27 @@ authors: Frank Hillard lastUpdated: 30th June 2023 --- -One of the great benefits of Tezos is the ability to formally verify smart contracts. Tezos makes this formal verification possible for smart contracts with the design of Michelson and with tools such as [Coq](/developers/docs/advanced-topics/formal-verification/coq/) and the [Mi-Cho-Coq library](/developers/docs/advanced-topics/formal-verification/michocoq). +One of the great benefits of Tezos is the ability to formally verify smart contracts. Tezos makes this formal verification possible for smart contracts with the design of Michelson and with tools such as [Coq](/advanced-topics/formal-verification/coq/) and the [Mi-Cho-Coq library](/advanced-topics/formal-verification/michocoq). This entire section walks through formal verification and how it relates to Tezos: -- [Formal Verification on Tezos](/developers/docs/advanced-topics/formal-verification/formal-verification-on-tezos/) discusses how smart contracts on Tezos can be formally verified, its benefits, and what tooling makes this possible. +- [Formal Verification on Tezos](/advanced-topics/formal-verification/formal-verification-on-tezos/) discusses how smart contracts on Tezos can be formally verified, its benefits, and what tooling makes this possible. -- [Modelling for Smart Contracts](/developers/docs/advanced-topics/formal-verification/modelling-theorem/) goes through an example smart contract, its formal specification and its proof. +- [Modelling for Smart Contracts](/advanced-topics/formal-verification/modelling-theorem/) goes through an example smart contract, its formal specification and its proof. -- [Coq](/developers/docs/advanced-topics/formal-verification/coq/) gives a brief introduction to syntax and proof creating on Tezos using Mi-Cho-Coq. +- [Coq](/advanced-topics/formal-verification/coq/) gives a brief introduction to syntax and proof creating on Tezos using Mi-Cho-Coq. -- [Mi-Cho-Coq](/developers/docs/advanced-topics/formal-verification/michocoq/) discusses what Mi-Cho-Coq is and how it bridges between Tezos smart contracts and formal proofs in Coq. +- [Mi-Cho-Coq](/advanced-topics/formal-verification/michocoq/) discusses what Mi-Cho-Coq is and how it bridges between Tezos smart contracts and formal proofs in Coq. ## Visual Overview The image below helps visualise the process for performing formal verification for Tezos smart contracts: -![](/developers/docs/images/introduction/FormalVerification_overview_intro.svg) +![](images/introduction/FormalVerification_overview_intro.svg) {% callout type="note" title="Further Reading" %} -For mathematicians and very curious developers, an extra [theoretical](/developers/docs/advanced-topics/formal-verification/gadt-coq) section will introduce some basic concepts of **Type theory** such as *GADT* which allows inductive types on the Calculus of Inductive Construction (CiC). The proof assistant Coq, which is based on the CiC, can be used for proving theorems. +For mathematicians and very curious developers, an extra [theoretical](/advanced-topics/formal-verification/gadt-coq) section will introduce some basic concepts of **Type theory** such as *GADT* which allows inductive types on the Calculus of Inductive Construction (CiC). The proof assistant Coq, which is based on the CiC, can be used for proving theorems. {% /callout %} diff --git a/src/pages/advanced-topics/formal-verification/modelling-theorem/index.md b/src/pages/advanced-topics/formal-verification/modelling-theorem/index.md index 359f4083c..ffd4aaa7e 100644 --- a/src/pages/advanced-topics/formal-verification/modelling-theorem/index.md +++ b/src/pages/advanced-topics/formal-verification/modelling-theorem/index.md @@ -5,10 +5,10 @@ authors: Frank Hillard (Cardashift) lastUpdated: 30th June 2023 --- -This section describes how to bridge Tezos and the [Michelson](/developers/docs/smart-contracts/smart-contract-languages/michelson/) language with the formal world of [Coq](/developers/docs/advanced-topics/formal-verification/coq/). To achieve this, we are going to model a theorem representing a smart contract and the goal of the smart contract. +This section describes how to bridge Tezos and the [Michelson](/smart-contracts/smart-contract-languages/michelson/) language with the formal world of [Coq](/advanced-topics/formal-verification/coq/). To achieve this, we are going to model a theorem representing a smart contract and the goal of the smart contract. ## Overview -The Tezos blockchain can run smart contracts using the Michelson language. Michelson is a low-level stack-based Turing-complete language that is formally proven. The proof of Michelson language is compiled in a library called [Mi-Cho-Coq](/developers/docs/advanced-topics/formal-verification/michocoq/). +The Tezos blockchain can run smart contracts using the Michelson language. Michelson is a low-level stack-based Turing-complete language that is formally proven. The proof of Michelson language is compiled in a library called [Mi-Cho-Coq](/advanced-topics/formal-verification/michocoq/). The Coq proof assistant is built upon the paradigm of **calculus of constructions**. The [Gallina](https://en.wikipedia.org/wiki/Coq#Overview) language provides a syntax (terms) for describing formal objects (a theorem) and also provides a set of instructions (vernacular syntax, know as tactics) for writing the proof of the theorem. @@ -16,7 +16,7 @@ The formal verification of a Michelson smart contract is done by providing the p The proof consists in a sequence of tactics which the Coq engine will interpret. These instructions manipulate formal expressions (following laws of logic and the Mi-Cho-Coq definitions) to formally assert the truth of a given theorem (based on the given assumptions). -![](/developers/docs/images/modelling-theorem/overview_process.svg) +![](/images/modelling-theorem/overview_process.svg) Notice that Gallina provides: @@ -33,18 +33,18 @@ The modelling theorem is based on: Formal verification of a Tezos smart contract consists in verifying formally that **the execution of the Michelson script satisfies specific post-conditions**. -![](/developers/docs/images/modelling-theorem/overview_theorem.svg) +![](/images/modelling-theorem/overview_theorem.svg) The schema above describes an equivalence between the execution of instructions and post-conditions (A, B, C, D). Post-conditions are rules that must be verified, but these post-conditions do not describe the whole behaviour of the smart contract, only specific traits representing the intent of the smart contract. In the following sections, we will detail how the execution of a Michelson script can be formally written and how to define the post-conditions. We will then study the formal proof as a sequence of Coq tactics (i.e. the vernacular part of the Gallina language). ### Smart Contract Invocation -Tezos smart contracts can be written in multiple high-level [languages](/developers/docs/smart-contracts/smart-contract-languages/) but these are all ultimately compiled in Michelson. +Tezos smart contracts can be written in multiple high-level [languages](/smart-contracts/smart-contract-languages/) but these are all ultimately compiled in Michelson. A smart contract invocation requires the smart contract itself (through its address), the entrypoint that is being called (and its related arguments) and the storage state. If all these elements are provided, the execution of the smart contract code is triggered, which results in side-effects on storage and optionally on the Tezos network itself: -![](/developers/docs/images/modelling-theorem/smartcontract_invocation.svg) +![](/images/modelling-theorem/smartcontract_invocation.svg) The entrypoint information is used to identify which portion of the code will be executed. The entrypoint arguments and the storage are used as the context of execution (i.e, the execution stack is initialized with arguments and a storage). The execution of the code produces a new storage state and operations. The operations produced by this invocation are also some new invocations of other smart contracts. @@ -168,7 +168,7 @@ End ST. ### Annotated Script -The smart contract is a Michelson script but this script cannot be taken as input by the Coq engine as is. [Mi-Cho-Coq](/developers/docs/advanced-topics/formal-verification/michocoq/) (the Coq specification of the Michelson language) provides the correspondence between a Michelson instruction and an equivalent logical proposition. There is no automated process that translates Michelson code into a formal definition based on Mi-Cho-Coq definitions. Therefore, this must be done manually. +The smart contract is a Michelson script but this script cannot be taken as input by the Coq engine as is. [Mi-Cho-Coq](/advanced-topics/formal-verification/michocoq/) (the Coq specification of the Michelson language) provides the correspondence between a Michelson instruction and an equivalent logical proposition. There is no automated process that translates Michelson code into a formal definition based on Mi-Cho-Coq definitions. Therefore, this must be done manually. The example voting smart contract can be formalized in a formal definition in Coq (_Terms_ part of the _Gallina_ language): @@ -212,7 +212,7 @@ Now, these rules can be translated into formal propositions. These propositions The post conditions of the example contract can be visualised: -![](/developers/docs/images/modelling-theorem/postconditions_rules.svg) +![](/images/modelling-theorem/postconditions_rules.svg) The rule "Keys of the old storage exists in the new storage" can be written in Coq (Gallina - Terms) with the following: @@ -318,7 +318,7 @@ eval env CODE fuel (arguments, storage) = return (newStorage) <=> post-condition Here is a schema describing graphically the theorem formalization: -![](/developers/docs/images/modelling-theorem/theorem_graphical.svg) +![](/images/modelling-theorem/theorem_graphical.svg) Now that we have defined the post-conditions to verify, we can define the theorem in Gallina (Terms) syntax: @@ -338,7 +338,7 @@ The `vote` object represents our smart contract (in a formal representation). No We can represent this equivalence between the execution of the code and the verification of post-conditions by the following diagram: -![](/developers/docs/images/modelling-theorem/theorem_graphical_detail.svg) +![](/images/modelling-theorem/theorem_graphical_detail.svg) Notice that the `vote_spec` definition is used as post condition and requires 4 arguments (`storage`, `param`, `new_storage`, `returned_operations`). diff --git a/src/pages/advanced-topics/smart-rollups/index.md b/src/pages/advanced-topics/smart-rollups/index.md index 1aa938ec5..0d1e3acbc 100644 --- a/src/pages/advanced-topics/smart-rollups/index.md +++ b/src/pages/advanced-topics/smart-rollups/index.md @@ -9,7 +9,7 @@ Rollups play a crucial part in providing next-generation scaling on Tezos. This ## Prerequisites -This page covers an advanced topic at the bleeding edge of Tezos core development. If you are interested in more fundamental reading, a great place to start is [Tezos Protocol and Shell](/developers/docs/tezos-basics/tezos-protocol-and-shell/) and [Smart Contracts](/developers/docs/smart-contracts/smart-contract-languages/). +This page covers an advanced topic at the bleeding edge of Tezos core development. If you are interested in more fundamental reading, a great place to start is [Tezos Protocol and Shell](/tezos-basics/tezos-protocol-and-shell/) and [Smart Contracts](/smart-contracts/smart-contract-languages/). ## What is a rollup? diff --git a/src/pages/app-development/build-your-first-app/adding-removing-liquidity.md b/src/pages/app-development/build-your-first-app/adding-removing-liquidity.md index ba70eb4e1..32c743f0f 100644 --- a/src/pages/app-development/build-your-first-app/adding-removing-liquidity.md +++ b/src/pages/app-development/build-your-first-app/adding-removing-liquidity.md @@ -15,7 +15,7 @@ First, let's understand what we are doing here: the LB DEX gives you the ability The interface here is going to look a lot like the interface for swapping, with some key differences: -![AddLiquidity UI](/developers/docs/images/build-your-first-app/add-liquidity-ui.png "Add liquidity UI") +![AddLiquidity UI](/images/build-your-first-app/add-liquidity-ui.png "Add liquidity UI") Like before, we have 2 input fields, but this time, there is no middle button to switch between the 2 tokens and both inputs are editable. @@ -356,7 +356,7 @@ And that's it! Your users now have the ability to add liquidity to the Liquidity Removing liquidity from the Liquidity Baking contract is arguably the easiest of all the tasks accomplished by our interface. The interface only needs one input to receive the amount of SIRS that the user wants to unwrap to get XTZ and tzBTC. -![RemoveLiquidity UI](/developers/docs/images/build-your-first-app/remove-liquidity-ui.png "Remove liquidity UI") +![RemoveLiquidity UI](/images/build-your-first-app/remove-liquidity-ui.png "Remove liquidity UI") The dapp will then calculate the corresponding amount of XTZ and tzBTC expected to be received for the amount of SIRS in the input field. diff --git a/src/pages/app-development/build-your-first-app/swapping-tokens.md b/src/pages/app-development/build-your-first-app/swapping-tokens.md index 04a2bec4c..099ca1c29 100644 --- a/src/pages/app-development/build-your-first-app/swapping-tokens.md +++ b/src/pages/app-development/build-your-first-app/swapping-tokens.md @@ -15,7 +15,7 @@ I say "the most complex" because the interface you are about to build includes a Here is a screenshot of the UI you are aiming for: -![Swap UI](/developers/docs/images/build-your-first-dapp/swap-ui.png "Swap UI") +![Swap UI](/images/build-your-first-dapp/swap-ui.png "Swap UI") There are 2 text inputs, the one on the left is editable and will let the user input the amount of XTZ or tzBTC they want to exchange and the one on the right will be disabled and will display the corresponding amount they'll get in the other token. The button in the middle with the 2 arrows will allow the user to switch the input between XTZ and tzBTC. diff --git a/src/pages/app-development/indexers/dipdup.md b/src/pages/app-development/indexers/dipdup.md index 33d8a97d8..af3668644 100644 --- a/src/pages/app-development/indexers/dipdup.md +++ b/src/pages/app-development/indexers/dipdup.md @@ -31,7 +31,7 @@ python -c "$(curl -sSL https://dipdup.io/install.py)" If you have macOS 12 or higher, replace `python` with `python3`. -[![1](/developers/docs/images/indexers/dipdup1.png)](https://indexers.tezos.org.ua/static/733a2c452ea5390046a06f83f0dcc6f0/5ca22/1.png) +[![1](/images/indexers/dipdup1.png)](https://indexers.tezos.org.ua/static/733a2c452ea5390046a06f83f0dcc6f0/5ca22/1.png) ### [](https://indexers.tezos.org.ua/dipdup-dappetizer#creating-a-project-in-dipdup)Creating a project in DipDup @@ -39,11 +39,11 @@ Now let's start configuring DipDup. First, let's create a folder in which we wil For example, let's index the contract of the tzBTC token since it is simple, and the creation of the indexer will not take much time. To do this, when choosing a configuration template, we will take the tzBTC option. -[![2](/developers/docs/images/indexers/dipdup2.png)](https://indexers.tezos.org.ua/static/a4ddf29abc78418f42b0aadbe536d42b/9bae8/2.png) +[![2](/images/indexers/dipdup2.png)](https://indexers.tezos.org.ua/static/a4ddf29abc78418f42b0aadbe536d42b/9bae8/2.png) Next, you need to fill in information about the project: name, version, owner, select a database, and all that. In the end, DipDup will independently generate the structure and necessary files for the project. -[![3](/developers/docs/images/indexers/dipdup3.png)](https://indexers.tezos.org.ua/static/ce921a279cebd9fecacd4e86b0391c7f/91425/3.png) +[![3](/images/indexers/dipdup3.png)](https://indexers.tezos.org.ua/static/ce921a279cebd9fecacd4e86b0391c7f/91425/3.png) ### [](https://indexers.tezos.org.ua/dipdup-dappetizer#indexer-configuration)Indexer configuration @@ -60,7 +60,7 @@ The most important thing here is templates. In these modules, we specify the ent In this example, we will be checking tzBTC holders' balances. They change when the transfer and mint entry points are called, so we specify two handlers by entry point names — on\_mint and on\_transfer. -[![4](/developers/docs/images/indexers/dipdup4.png)](https://indexers.tezos.org.ua/static/94fa88718212cf7f75282cce5fe2e141/4c530/4.png) +[![4](/images/indexers/dipdup4.png)](https://indexers.tezos.org.ua/static/94fa88718212cf7f75282cce5fe2e141/4c530/4.png) Check [DipDup Config Documentation](https://docs.dipdup.io/getting-started/creating-config) to learn more about all available options. @@ -71,7 +71,7 @@ Next, you need to create indexes, schemas, models, and handlers. To do this, go dipdup init ``` -[![5](/developers/docs/images/indexers/dipdup5.png)](https://indexers.tezos.org.ua/static/7c0f6b39910885a54a171086ff53ead6/5ca22/5.png) +[![5](/images/indexers/dipdup5.png)](https://indexers.tezos.org.ua/static/7c0f6b39910885a54a171086ff53ead6/5ca22/5.png) DipDup will create several files — models and handlers — that describe working with the database and indexing on-chain data, and we need to modify them to set up the indexing process. @@ -82,7 +82,7 @@ The first file is models.py. It stores data models, roughly speaking, descriptio * the number of transactions * last activity time -[![6](/developers/docs/images/indexers/dipdup6.png)](https://indexers.tezos.org.ua/static/96c7b5f909c56975fdb566de6566e5b0/5ca22/6.png) +[![6](/images/indexers/dipdup6.png)](https://indexers.tezos.org.ua/static/96c7b5f909c56975fdb566de6566e5b0/5ca22/6.png) The handlers are instructions on how the DipDup will process on-chain data when a tzBTC contract entry point call occurs. The handlers folder stores handlers for storage and calls to the tzBTC contract entry points. @@ -96,21 +96,21 @@ In it, we declared the on\_balance\_update function, to which we will pass three The function will first check if there is such a holder address in the database and then either create a new row and write the new holder or update the old record. -[![7](/developers/docs/images/indexers/dipdup7.png)](https://indexers.tezos.org.ua/static/5940c23853d35d2d52025ba3228538bb/5ca22/7.png) +[![7](/images/indexers/dipdup7.png)](https://indexers.tezos.org.ua/static/5940c23853d35d2d52025ba3228538bb/5ca22/7.png) The second handler, on\_mint, will be called when the mint entry point of the tzBTC contract is called. It will read the mint entry point call parameters and then call the on\_balance\_update function to update the records in the database. -[![8](/developers/docs/images/indexers/dipdup8.png)](https://indexers.tezos.org.ua/static/1112282e7bde378195b94423911160ee/cce16/8.png) +[![8](/images/indexers/dipdup8.png)](https://indexers.tezos.org.ua/static/1112282e7bde378195b94423911160ee/cce16/8.png) IMPORTANT: in the “amount” variable, we save the "mint.parameter.value" value, which we take from the mint entry point’s call parameters. -[![9](/developers/docs/images/indexers/dipdup9.png)](https://indexers.tezos.org.ua/static/7f6845fabfc7073a10e28eaad8343dfa/8643c/9.png) +[![9](/images/indexers/dipdup9.png)](https://indexers.tezos.org.ua/static/7f6845fabfc7073a10e28eaad8343dfa/8643c/9.png) Similarly, we take the address of the recipient of fresh tokens: "address = mint.parameter.to"; The third handler – on\_transfer – deals with transactions, that is, operations with the transfer entry point. It is more complex. First, you need to compare the sender and recipient addresses. If they match, the holders' balances have not changed, and the database should not be updated. Secondly, the transfer of tokens means a change in the balances of the sender and recipient. Therefore, the on\_balance\_update function must be called twice for each address while subtracting the transaction amount from the sender's balance and adding it to the recipient's balance. -[![10](/developers/docs/images/indexers/dipdup10.png)](https://indexers.tezos.org.ua/static/6229151572035395d3becb0cd770c489/5ca22/10.png) +[![10](/images/indexers/dipdup10.png)](https://indexers.tezos.org.ua/static/6229151572035395d3becb0cd770c489/5ca22/10.png) As in the on_mint handler, we get on-chain data from the call parameters of the transfer entry point: sender address from_, recipient address to, and transfer amount value. @@ -123,7 +123,7 @@ dipdup run DipDup will start downloading the required data from the TzKT public API. Upon completion, it will begin processing new blocks. -[![11](/developers/docs/images/indexers/dipdup11.png)](https://indexers.tezos.org.ua/static/bd30fc184f1b8dc3183fee5f7b52c3b3/5ca22/11.png) +[![11](/images/indexers/dipdup11.png)](https://indexers.tezos.org.ua/static/bd30fc184f1b8dc3183fee5f7b52c3b3/5ca22/11.png) ### [](https://indexers.tezos.org.ua/dipdup-dappetizer#connecting-a-database-to-a-project)Connecting a database to a project @@ -133,15 +133,15 @@ Let's create a tzbtc\_dipdup.php file in the tzbtc\_dipdup folder and then conne In the $db\_dir variable, we specify the path to the database on the hard disk, and in $db\_handle - the new PDO($db\_dir) database connection method. -[![12](/developers/docs/images/indexers/dipdup12.png)](https://indexers.tezos.org.ua/static/2a16c6dd88a5963c6d228c28915506bc/a7a60/12.png) +[![12](/images/indexers/dipdup12.png)](https://indexers.tezos.org.ua/static/2a16c6dd88a5963c6d228c28915506bc/a7a60/12.png) Then we will write a SQL query in which we select all addresses and balances of tzBTC holders with a non-zero balance and sorting in ascending order. To know exactly what tables you have in the database and how to reach them in SQL query, you can install [SQLite Browser](https://sqlitebrowser.org/) with GUI and check what's inside. -[![13](/developers/docs/images/indexers/dipdup13.png)](https://indexers.tezos.org.ua/static/8128e903d77665f4df43171d078c3953/5ca22/13.png) +[![13](/images/indexers/dipdup13.png)](https://indexers.tezos.org.ua/static/8128e903d77665f4df43171d078c3953/5ca22/13.png) We use the iteration function forEach to sequentially get user addresses and balances from $row and then show them on the page. -[![14](/developers/docs/images/indexers/dipdup14.png)](https://indexers.tezos.org.ua/static/5a2d6682a268ce9bb9c9172a0a7c6725/d4913/14.png) +[![14](/images/indexers/dipdup14.png)](https://indexers.tezos.org.ua/static/5a2d6682a268ce9bb9c9172a0a7c6725/d4913/14.png) Then we close the connection to the database with the $db\_handle = null command. @@ -151,11 +151,11 @@ In the terminal, go to the folder with tzbtc\_dipdup.php and start the PHP serve php -S localhost:8000 ``` -[![15](/developers/docs/images/indexers/dipdup15.png)](https://indexers.tezos.org.ua/static/b6a8333f49c6dc19a1bd91e22bb1457f/abe8a/15.png) +[![15](/images/indexers/dipdup15.png)](https://indexers.tezos.org.ua/static/b6a8333f49c6dc19a1bd91e22bb1457f/abe8a/15.png) In the browser, open the page at [http://localhost:8000/tzbtc\_dipdup.php](http://localhost:8000/tzbtc_dipdup.php) -[![16](/developers/docs/images/indexers/dipdup16.png)](https://indexers.tezos.org.ua/static/4f88b13e8135e3a6897fd3c5bcdd4104/3f970/16.png) +[![16](/images/indexers/dipdup16.png)](https://indexers.tezos.org.ua/static/4f88b13e8135e3a6897fd3c5bcdd4104/3f970/16.png) Since we already divided the balance by 10^8 when writing transaction handlers and minting tzBTC, they are displayed in the database with the correct number of decimal places. @@ -176,7 +176,7 @@ Check if the installation was successful with the version check command: npx dappetizer --version ``` -[![17](/developers/docs/images/indexers/dipdup17.png)](https://indexers.tezos.org.ua/static/228af948a104a02c0587fb9cfb252081/1855e/17.png) +[![17](/images/indexers/dipdup17.png)](https://indexers.tezos.org.ua/static/228af948a104a02c0587fb9cfb252081/1855e/17.png) Now initialize a new project with the tzBTC name and contract address: @@ -184,7 +184,7 @@ Now initialize a new project with the tzBTC name and contract address: npx dappetizer init --contractName=tzBTC KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn ``` -[![18](/developers/docs/images/indexers/dipdup18.png)](https://indexers.tezos.org.ua/static/513ca79035e04adb259631c74649b680/5ca22/18.png) +[![18](/images/indexers/dipdup18.png)](https://indexers.tezos.org.ua/static/513ca79035e04adb259631c74649b680/5ca22/18.png) The Dappetizer will create the necessary files in the project folder. Among them are four main ones you will need to work with: @@ -195,15 +195,15 @@ The Dappetizer will create the necessary files in the project folder. Among them dappetizer.config.ts contains parameters for connecting to the database. Dappetizer uses SQLite by default, but PostgreSQL is fine, too. -[![19](/developers/docs/images/indexers/dipdup19.png)](https://indexers.tezos.org.ua/static/19952b3ff1adf15374abec328edd6b78/0f849/19.png) +[![19](/images/indexers/dipdup19.png)](https://indexers.tezos.org.ua/static/19952b3ff1adf15374abec328edd6b78/0f849/19.png) You need to create entities.ts and specify the class (table) and database columns. We will record transactions with the tzBTC token, creating a transaction class with columns id (internal id in the database), sender, receiver, and amount. -[![20](/developers/docs/images/indexers/dipdup20.png)](https://indexers.tezos.org.ua/static/879869b9b7c64aea21f136dc236c71cb/5dd2a/20.png) +[![20](/images/indexers/dipdup20.png)](https://indexers.tezos.org.ua/static/879869b9b7c64aea21f136dc236c71cb/5dd2a/20.png) The src folder contains tz-btc-indexer.ts, in which Dappetizer will generate functions for indexing all entry points of the specified contract. In the code of the corresponding entrypoint, you need to describe the indexing logic: which entry point call parameter to write to the database. -[![21](/developers/docs/images/indexers/dipdup21.png)](https://indexers.tezos.org.ua/static/4458d88f72d3cc315e464ea698b84da4/5ca22/21.png) +[![21](/images/indexers/dipdup21.png)](https://indexers.tezos.org.ua/static/4458d88f72d3cc315e464ea698b84da4/5ca22/21.png) In tzBTC, the entry point for sending tokens is called transfer. Accordingly, we will find the code for this entry point and add logic to it: @@ -211,11 +211,11 @@ In tzBTC, the entry point for sending tokens is called transfer. Accordingly, we * in the indexTransfer function, we describe the indexing logic: create a tzBTCtransfer constant, in which we write the sender and recipient addresses, as well as the transaction volume, * at the end of the indexTransfer function, we will call the insert function to write the contents of tzBTCtransfer to the database. -[![22](/developers/docs/images/indexers/dipdup22.png)](https://indexers.tezos.org.ua/static/92bd0f1229f79e6bbf945c17cf6d14d7/5ca22/22.png) +[![22](/images/indexers/dipdup22.png)](https://indexers.tezos.org.ua/static/92bd0f1229f79e6bbf945c17cf6d14d7/5ca22/22.png) Now we need to add the Transaction model to the index.ts module. To do this, we import Transaction from the entities.ts file and add Transaction to the dbEntities array. -[![23](/developers/docs/images/indexers/dipdup23.png)](https://indexers.tezos.org.ua/static/d63ac8bfb337449b014639d25817d083/5ca22/23.png) +[![23](/images/indexers/dipdup23.png)](https://indexers.tezos.org.ua/static/d63ac8bfb337449b014639d25817d083/5ca22/23.png) ### [](https://indexers.tezos.org.ua/dipdup-dappetizer#starting-the-indexer)Starting the indexer @@ -232,7 +232,7 @@ npx dappetizer start Dappetizer will begin indexing the blocks and writing data to the database. -[![24](/developers/docs/images/indexers/dipdup24.png)](https://indexers.tezos.org.ua/static/1183e87c13a4569fc11aeca211dba725/5ca22/24.png) +[![24](/images/indexers/dipdup24.png)](https://indexers.tezos.org.ua/static/1183e87c13a4569fc11aeca211dba725/5ca22/24.png) ### [](https://indexers.tezos.org.ua/dipdup-dappetizer#connecting-the-database-to-the-project)Connecting the database to the project @@ -240,11 +240,11 @@ Let's make a page similar to the DipDup project. Let's create a tzbtc\_dappetize In our example, we use SQL query to select sender, receiver, and amount fields from the "transaction" table and then sort them by internal id, so the most recent ones (with a higher id value) will be displayed first. -[![25](/developers/docs/images/indexers/dipdup25.png)](https://indexers.tezos.org.ua/static/6e12e4741cc38df7849681462501071f/46eb0/25.png) +[![25](/images/indexers/dipdup25.png)](https://indexers.tezos.org.ua/static/6e12e4741cc38df7849681462501071f/46eb0/25.png) Let's start the PHP server in the Dappetizer folder and open the page in the browser: -[![26](/developers/docs/images/indexers/dipdup26.png)](https://indexers.tezos.org.ua/static/dd2993d74350f2f3cfc65f1fb276145d/5ca22/26.png) +[![26](/images/indexers/dipdup26.png)](https://indexers.tezos.org.ua/static/dd2993d74350f2f3cfc65f1fb276145d/5ca22/26.png) ### [](https://indexers.tezos.org.ua/dipdup-dappetizer#homework)Homework @@ -258,11 +258,11 @@ In the DipDup example, we considered the volume (turnover) by adding the volume Open the tzbtc\_dappetizer file and create a $sql\_sum SQL query with SELECT SUM(amount) FROM “transaction”: -[![27](/developers/docs/images/indexers/dipdup27.png)](https://indexers.tezos.org.ua/static/ff992168c8b74794cd92405809640c37/c7591/27.png) +[![27](/images/indexers/dipdup27.png)](https://indexers.tezos.org.ua/static/ff992168c8b74794cd92405809640c37/c7591/27.png) Then add a query($sql\_sum) function to query the database and output the value to the page. -[![28](/developers/docs/images/indexers/dipdup28.png)](https://indexers.tezos.org.ua/static/e6fcc58f872ad695eb84cadb7d5509e5/5ca22/28.png) +[![28](/images/indexers/dipdup28.png)](https://indexers.tezos.org.ua/static/e6fcc58f872ad695eb84cadb7d5509e5/5ca22/28.png) {% callout type="note" %} diff --git a/src/pages/app-development/indexers/index.md b/src/pages/app-development/indexers/index.md index c03d53679..417efe2cc 100644 --- a/src/pages/app-development/indexers/index.md +++ b/src/pages/app-development/indexers/index.md @@ -114,11 +114,11 @@ To get the details of a specific operation, we need to know its location in the Indexers simplify the task of getting the data you need from the blockchain. They request whole blocks from public nodes and write them to their databases. Then indexers create indexes—-additional data structures optimized for fast data retrieval that store either the data or a link to the corresponding place in the central database. When searching for any data, the indexer looks for it in the corresponding index, not in the central database. For even faster searching, some indexers don't store all data in one table but create separate tables for any valuable data. -![](/developers/docs/images/usdt_que_pasa.png) +![](/images/usdt_que_pasa.png) Here is a USDT contract indexed with Que Pasa. It made tables for every entry point and big_map in the contract and an index for every table. It is an efficient way to fetch data. For example, the execution of a query to find a balance of a random USDT holder took only 0.064 milliseconds. -![](/developers/docs/images/que_pasa_sql.png) +![](/images/que_pasa_sql.png) The exact list of tables, indexes schemas, and command syntax depends on the indexer and database it uses. While using TzKT, a query for a USDT balance will look like this: @@ -175,7 +175,7 @@ Many applications that work with on-chain data use an indexer. The simplest example of working with an indexer is a blockchain wallet. For example, to display a user's token balances, Temple Wallet queries this data from the TzKT indexer and gets tokens' tickers and logos from the contract metadata. -![temple query](/developers/docs/images/temple_query.png) +![temple query](/images/temple_query.png) Try it yourself: [Go here](https://api.tzkt.io/v1/tokens/balances?account=tz1UEQzJbuaGJgwvkekk6HwGwaKvjZ7rr9v4) and replace tz1...9v4 with your wallet address to see which tokens you have. This is the same query to TzKT API that Temple uses: '/tokens/balances' in constants getTokenBalances and getNFTBalances. @@ -245,15 +245,15 @@ We will make a simple page where users can enter their addresses and check the b First, let's create an empty HTML file in VS Code (you may use another editor, of course) and add the essential elements: doctype, head, title, and body. -![check balance 1](/developers/docs/images/check_balance_html_1.png) +![check balance 1](/images/check_balance_html_1.png) We will use AJAX and the jQuery library to request data via the API and process it. Incorporating a library is simple: just provide a link to it in the script element. -![check balance 2](/developers/docs/images/check_balance_html_2.png) +![check balance 2](/images/check_balance_html_2.png) Let's get the balance of our address via AJAX. -![check balance ajax](/developers/docs/images/check_balance_ajax.png) +![check balance ajax](/images/check_balance_ajax.png) First, we added the $(document).ready() command. It ensures the page is loaded before the scripts are processed. @@ -267,13 +267,13 @@ In the end, we will add a h2 element, in which we will display the balance. To d Let's open the page and check the result. -![](/developers/docs/images/check_balance_result.png) +![](/images/check_balance_result.png) ### Adding a button and field to check specific address balance AJAX now sends an API request as soon as the page loads. Let's add a button, pressing which will launch the request. -![](/developers/docs/images/check_balance_button.png) +![](/images/check_balance_button.png) To do this, wrap the h2 in a div element and make it hidden with the style="display:none" parameter. @@ -281,7 +281,7 @@ Let's create a button and add a call to the check function to it, in which we wi Now we need to add a field for entering the user's address and tweak the check() function to insert it into the API request. -![](/developers/docs/images/check_balance_input.png) +![](/images/check_balance_input.png) To do this, we did the following: @@ -292,13 +292,13 @@ To do this, we did the following: Now you can enter any address and, by pressing the button, get its balance in tez. -![](/developers/docs/images/check_balance_input_result.png) +![](/images/check_balance_input_result.png) Experiment: take [the code of this page](https://gist.github.com/pavelTU/e48c71d09ff5dcfb5343699d485760d9), paste it into an empty HTML file, and open it in a browser. This is a simple example: the TzKT API returns the user's balance as JSON with only one number. The answer does not even need to be further processed: everything works as it is. -![](/developers/docs/images/tzkt_api_balance.png) +![](/images/tzkt_api_balance.png) When solving real-life cases, however, you will have to work with JSON arrays and carefully read API responses to select the necessary data. The next chapter explores this matter further. @@ -318,7 +318,7 @@ It remains to find out the current value of assets in Sirius DEX and the value o We are starting a new page. First, let's try to get something simple, like the Sirius DEX internal contract id in the TzKT database. -![](/developers/docs/images/sirius_contract_id_html.png) +![](/images/sirius_contract_id_html.png) Let's copy the code of the first example and remove the button and the field for entering the address from it. Let's replace the API request URL with https://api.tzkt.io/v1/contracts/KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5 to get information about the contract from the indexer. @@ -326,37 +326,37 @@ Now it’s time to change the function for data processing. To get specific valu Ultimately, we assign an internal ID, "contractId", to the corresponding HTML element and display it on the page in the h2 element. -![](/developers/docs/images/sirius_contract_id_result.png) +![](/images/sirius_contract_id_result.png) We made sure everything worked, so now we can get the data we need: tez and tzBTC balances. First, we should examine TzKT's response to our API request. It has a balance field in tez, so we can get it without changing the request. -![](/developers/docs/images/tzkt_sirius_contract.png) +![](/images/tzkt_sirius_contract.png) Now, assign the value from the received array to the balanceInTez variable by the balance key. -![](/developers/docs/images/sirius_balance_html.png) +![](/images/sirius_balance_html.png) -![](/developers/docs/images/sirius_balance_result.png) +![](/images/sirius_balance_result.png) Now we need to get the amount of tzBTC. Let's examine the storage of the liquidity backing contract on TzKT: it shows the amount of tzBTC under the tokenPool key. You can access it by requesting the contents of the storage. -![](/developers/docs/images/tzkt_sirius_storage.png) +![](/images/tzkt_sirius_storage.png) Now we should create another AJAX request. In the URL, we specify the API request for the storage content and assign the value of the corresponding entry, tokenPool, to the balanceInTZBTC variable. -![](/developers/docs/images/sirius_balance_tzbtc_html.png) +![](/images/sirius_balance_tzbtc_html.png) On the page, we will display the balance in tzBTC. -![](/developers/docs/images/sirius_balance_tzbtc_result.png) +![](/images/sirius_balance_tzbtc_result.png) Now it’s time to calculate the subsidies for the year. The average year has 31,556,926 seconds. We divide this value by the block creation time and multiply it by the subsidy amount. We can get the block creation time and subsidy amount from TzKT at https://api.tzkt.io/v1/protocols/current. They will be referred to as timeBetweenBlocks and lbSubsidy in the response. -![](/developers/docs/images/tzkt_protocols.png) +![](/images/tzkt_protocols.png) So, we need to get data from two API requests in one function and use it for calculations. But as the variables are local and can't be used in other functions, we need to use nested functions: @@ -369,11 +369,11 @@ So, we need to get data from two API requests in one function and use it for cal First, let's add a call to the checkTimeAndSubsidy function to get the Sirius DEX balance in tez. -![](/developers/docs/images/call_time_and_subsidy.png) +![](/images/call_time_and_subsidy.png) Below, we will declare the same function and add an AJAX call to request protocol data from TzKT. -![](/developers/docs/images/time_and_subsidy_function_1.png) +![](/images/time_and_subsidy_function_1.png) We should assign three new variables: @@ -383,7 +383,7 @@ We should assign three new variables: We now have all the data to calculate the annual subsidy and APY liquidity backing. -![](/developers/docs/images/time_and_subsidy_function_2.png) +![](/images/time_and_subsidy_function_2.png) Now we can calculate the necessary values by creating the variables yearlySubsidy and APY. @@ -391,7 +391,7 @@ To calculate APY, it is not necessary to obtain asset prices. At any given momen It’s now possible to give the annual amount of subsidies and APY internal ID values and add them to the page. -![](/developers/docs/images/time_and_subsidy_result.png) +![](/images/time_and_subsidy_result.png) [Example code on Github](https://gist.github.com/pavelTU/5a56c940952f01e838a3ca98215eab15). @@ -409,21 +409,21 @@ Try to calculate the value of tez in the Sirius DEX liquidity pool. First, check [the tez/kUSD contract](https://tzkt.io/KT1K4EwTpbvYN9agJdjpyJm4ZZdhpUNKB3F6/storage/) on an exchange on TzKT. Then examine the storage and find the necessary keys: tez_pool is the amount of tez, and token_pool stands for the amount of kUSD. -![](/developers/docs/images/tez_kusd_contract.png) +![](/images/tez_kusd_contract.png) And we need to remember that the token's amount in the contract's storage is a natural number. And to display the actual amount of tokens, we need to divide that number by the corresponding number of decimals written in the contract's metadata. For example, kUSD has 18 decimals, and when we get raw token amount data, we need to divide it by 10^18 to get a human-readable amount. -![](/developers/docs/images/kolibri_usd.png) +![](/images/kolibri_usd.png) Since we need to know the number of tez in the pool to calculate the cost of all tez, we need to use nested functions. After receiving the balanceInTez variable, we call the checkValueOfTez function with the balanceInTez argument. In this function, we use AJAX to get data from the tez/kUSD pool (remember to divide the number of tokens depending on the required decimals). Next, we calculate the price of one tez and the cost of all tez in the pool. In the end, we will add the readableValue variable: using the toLocaleString () method, we will add comma separators to the number. -![](/developers/docs/images/homework_value_of_tez.png) +![](/images/homework_value_of_tez.png) As a result, we get the cost of all tez in the Sirius DEX pool, which we get completely from on-chain data. -![](/developers/docs/images/homework_value_of_tez_result.png) +![](/images/homework_value_of_tez_result.png) {% callout type="note" %} diff --git a/src/pages/baking/bakers-list/index.md b/src/pages/baking/bakers-list/index.md index 00e890ec5..31f573483 100644 --- a/src/pages/baking/bakers-list/index.md +++ b/src/pages/baking/bakers-list/index.md @@ -13,13 +13,13 @@ Most Tezos blockchain explorers have a list of bakers ordered according to diffe [Baking Bad](https://tzkt.io/bakers/), [TzStats](https://tzstats.com/bakers) or [Tezos Nodes](https://tezos-nodes.com/) allow you to browse through bakers. -![baking-bad-bakers](/developers/docs/images/bakers-list/baking_bad_bakers.png) +![baking-bad-bakers](/images/bakers-list/baking_bad_bakers.png) FIGURE 1: Baking Bad Bakers -![tzstats-bakers](/developers/docs/images/bakers-list/tzstats_bakers.png) +![tzstats-bakers](/images/bakers-list/tzstats_bakers.png) FIGURE 2: TzStats Bakers -![tezos-nodes-bakers](/developers/docs/images/bakers-list/tezos_node_bakers.png) +![tezos-nodes-bakers](/images/bakers-list/tezos_node_bakers.png) FIGURE 3: Tezos Nodes Bakers @@ -37,7 +37,7 @@ A private baker doesn’t offer everyone to delegate their stakes. Technically s These days, it is the centralized exchanges like Coinbase, Binance or Kraken, that hold the biggest stakes. They offer their users an opportunity to stake Tez from their exchange accounts and get profits. -![tzstats-bakers-top20](/developers/docs/images/bakers-list/tzstats_bakers_top20.png) +![tzstats-bakers-top20](/images/bakers-list/tzstats_bakers_top20.png) ### Corporate bakers diff --git a/src/pages/baking/baking-explained/index.md b/src/pages/baking/baking-explained/index.md index f06d84406..6ebba6a00 100644 --- a/src/pages/baking/baking-explained/index.md +++ b/src/pages/baking/baking-explained/index.md @@ -7,7 +7,7 @@ lastUpdated: 6th July 2023 In this section we discuss how baking works. The different actors of the mechanism and the technological solutions will be presented. -![baking-explained](/developers/docs/images/baking-explained/baking_explained.svg) +![baking-explained](/images/baking-explained/baking_explained.svg) FIGURE 1: How Baking Works? @@ -105,7 +105,7 @@ The random seed for cycle `n` is a 256-bit number generated at the very end of c > In cryptography, **a nonce** (number used once) is an arbitrary number intended to be used only once. > **A commitment** is the hash of a nonce. -![commit-reveal](/developers/docs/images/baking-explained/commit_reveal.svg) +![commit-reveal](/images/baking-explained/commit_reveal.svg) FIGURE 2: Commit & Reveal One out of every `BLOCKS_PER_COMMITMENT` (= 32 blocks) can contain a commitment. There are therefore, at most `BLOCKS_PER_CYCLE / BLOCKS_PER_COMMITMENT` (= 128 commitments) per cycle. The commitment is generated by the baker who produces the block and is included in the block header. @@ -174,7 +174,7 @@ For example: Ledger Nano S together with Kiln meets these two conditions. - The accusers monitor the process and punish the cheaters. -![summary-diagram](/developers/docs/images/baking-explained/summary_diagram.png) +![summary-diagram](/images/baking-explained/summary_diagram.png) FIGURE 3: Overview diff --git a/src/pages/baking/delegating/index.md b/src/pages/baking/delegating/index.md index 36f6ef59d..80294c1e8 100644 --- a/src/pages/baking/delegating/index.md +++ b/src/pages/baking/delegating/index.md @@ -69,7 +69,7 @@ The main steps are as follows: 5. Choose the amount to delegate 6. Start earning interests -![](/developers/docs/images/delegating/delegate.gif) +![](/images/delegating/delegate.gif) FIGURE 1: Delegating your Tez on *Atomex*. That's it. The only thing you should worry about is choosing an excellent and reliable Tezos baker or delegation service. diff --git a/src/pages/defi/cross-chain-swaps/index.md b/src/pages/defi/cross-chain-swaps/index.md index 2554b0d89..3e07f1300 100644 --- a/src/pages/defi/cross-chain-swaps/index.md +++ b/src/pages/defi/cross-chain-swaps/index.md @@ -15,7 +15,7 @@ Let's consider the following scenario: Alice has 100 XTZ and wants to exchange t One way is to use a centralized exchange like Binance. This means that you must trust them to store your tokens and process the transaction correctly and securely. But this way relies on a single point of failure that could, potentially, fail at any time. [Binance was hacked in 2019, and 7,000 bitcoins were stolen.](https://www.binance.com/en/blog/336904059293999104/Security-Incident-Recap) Moreover, exchanges usually take a fee for the service they offer. Does a better solution exist? Could we use a DEX instead? {% figure - src="/developers/docs/images/cross-chain-swaps/swap-cex.svg" + src="/images/cross-chain-swaps/swap-cex.svg" alt="swap-cex" caption="FIGURE 1: Illustration of non-atomic swap on a centralized exchange" %} {% /figure %} @@ -25,7 +25,7 @@ One way is to use a centralized exchange like Binance. This means that you must Using a DEX is a great solution for making trustless token swaps. However, they only work within the same blockchain network. For example, _Plenty_ and _Quipuswap_ only work on Tezos and only with FA1.2 or FA2 tokens. So that wouldn't work if you want to exchange XTZ against BTC! One way would be to use wrapped assets like in [this chapter](defi/wrapped-assets) and exchange wrapped XTZ (wXTZ) against wrapped BTC (tzBTC) on a Tezos DEX. However, this increases the difficulty of the process, as you must wrap and unwrap the tokens, which requires a third party for BTC. Additionally, you have to trust that the smart contract that allows you to unwrap your tzBTC for actual BTC is secured. So, does a fully trustless solution exist? {% figure - src="/developers/docs/images/cross-chain-swaps/swap-dex.svg" + src="/images/cross-chain-swaps/swap-dex.svg" alt="swap-dex" caption="FIGURE 2: Illustration of non-atomic swap on a decentralized exchange" %} {% /figure %} @@ -47,7 +47,7 @@ A _cross-chain swap_ (also referred to as an _Atomic Swap_) refers to the exchan The term **atomic** relates to the fact that these transactions either happen entirely or not at all. If any of the parties give up or fails to do what they are supposed to, the contract is cancelled, and the funds are automatically returned to their owners. {% figure - src="/developers/docs/images/cross-chain-swaps/atomic-swap.svg" + src="/images/cross-chain-swaps/atomic-swap.svg" alt="atomic-swap" caption="FIGURE 3: Illustration of an atomic swap" %} {% /figure %} @@ -55,7 +55,7 @@ The term **atomic** relates to the fact that these transactions either happen en Alice's HTLC will time out and refund the funds to Alice automatically if Bob never sends the funds. {% figure - src="/developers/docs/images/cross-chain-swaps/atomic-swap-fail.svg" + src="/images/cross-chain-swaps/atomic-swap-fail.svg" alt="atomic-swap-fail" caption="FIGURE 4: Illustration of a failed atomic swap (Bob did not send the funds)" %} {% /figure %} diff --git a/src/pages/defi/ctez/index.md b/src/pages/defi/ctez/index.md index 6e9b36927..63d68576d 100644 --- a/src/pages/defi/ctez/index.md +++ b/src/pages/defi/ctez/index.md @@ -34,7 +34,7 @@ The target price, i.e. the value of the ctez in XTZ, is required to calculate th In total, every swap on the ctez/XTZ AMM creates a chain of events that leads to ctez supply adjustment. -![](/developers/docs/images/ctez-diagram.png) +![](/images/ctez-diagram.png) Suppose Alice has deposited 100 XTZ in the oven and released 90 ctez at the target price of 1.0. The security percentage is 90%. If the target price rises to 1.05, the collateral percentage is 94.5% and the oven will be subject to liquidation. Bob will deposit the ctez into it and withdraw the XTZ. @@ -50,28 +50,28 @@ To summarize, ctez cannot (and should not) maintain the pegging to XTZ. Its valu Go to [ctez.app](https://ctez.app/) and observe the drift value. -![](/developers/docs/images/ctez6.png) +![](/images/ctez6.png) If the drift value is lower than the yield from delegating, you can try to create an oven and benefit from mint-sell-mint. To do this, click on the Create Oven button in the menu on the left. If it is above 6 percent, it is advantageous to accumulate ctez. Its price will go up: oven owners will have to buy back and redeem ctez to avoid liquidation. -![](/developers/docs/images/ctez1.png) +![](/images/ctez1.png) Enter the address of the baker to whom the oven delegates XTZ, and specify how many XTZ you want to put into the oven. Click Whitelist if you want only the specified addresses to be able to contribute additional XTZ to your oven. Then click Create Oven and confirm the transaction in your wallet. -![](/developers/docs/images/ctez2.png) +![](/images/ctez2.png) Wait a minute until the transaction is included in the block and click on My Ovens on the left-hand side of the menu. -![](/developers/docs/images/ctez3.png) +![](/images/ctez3.png) Click on the oven you mean to open. It will pop open its data, such as the collateralization level, the amount of deposited XTZ, and the amount of issued ctez. -![](/developers/docs/images/ctez4.png) +![](/images/ctez4.png) Press Mint to issue ctez. Enter the amount and confirm the transaction in the wallet. After a few minutes, check your wallet: ctez should appear there. -![](/developers/docs/images/ctez5.png) +![](/images/ctez5.png) If they didn’t, add the tokens manually to the ctez contract address: ([KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4](https://tzkt.io/KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4/operations/)). diff --git a/src/pages/defi/dex/index.md b/src/pages/defi/dex/index.md index f928d7caa..5af8b9af1 100644 --- a/src/pages/defi/dex/index.md +++ b/src/pages/defi/dex/index.md @@ -19,7 +19,7 @@ For instance: _Alice has a sell order at \$5.0_, and _Bob has a buy order at \$4 We call the mid-market price the average point between buyers and sellers, here it's at \$4.8 (see Fig. 1). For a trade to happen, Alice has to lower her offer to \$4.6, or Bob has to increase his demand to \$5.0. Another solution would be to wait for another trader to bid or sell at these prices. As exchanges normally have thousands of orders in and out the mid-market price move constantly. -![centralized-exchange](/developers/docs/images/dex/centralized-exchange.svg) +![centralized-exchange](/images/dex/centralized-exchange.svg) FIGURE 1: Illustration of an Order Book. Here buyers and sellers are meeting at the \$4.80 price point. @@ -79,7 +79,7 @@ For instance, for a pool with 20 _XTZ_ and 100 _USDtz_, the marginal price of _X The difference between the effective swap price and the marginal price is referred to as _slippage_, i.e., the tendency of prices to move against a trader's actions as the trader absorbs liquidity — the larger the trade relative to the pool size, the greater the possible slippage. -![swap](/developers/docs/images/dex/swap.svg) +![swap](/images/dex/swap.svg) *FIGURE 2: Illustration of a token swap. The trader first sends his input tokens, then the pool computes the effective swap price by maintaining a constant product and finally sends the output of tokens.* From this, you can deduce two things: @@ -93,7 +93,7 @@ Like centralized exchanges, liquidity providers (LP) play an essential role by p This is why liquidity pools are also known as _Automated Market Makers_ (AMM), their price is automatically set based on the number of tokens currently available in the pool (and not by some arbitrary order book that represents potential orders and not the actual liquidity). -![pool-size](/developers/docs/images/dex/pool-size.svg) +![pool-size](/images/dex/pool-size.svg) FIGURE 3: Marginal price vs. effective swap price of two pools of different sizes. @@ -107,7 +107,7 @@ Arbitrage happens when the price offered by the pool diverges from the price sho When liquidity is supplied to a pool, the liquidity provider (or _LP_ for short) receives unique tokens called LP tokens in proportion to how much liquidity they provided to the pool. When a swap occurs in the pool, a 0.3% fee is proportionally distributed amongst all the LP token holders. If a liquidity provider wants to get his underlying liquidity back and any accrued fees, he must burn his LP tokens. -![liquidity](/developers/docs/images/dex/liquidity.svg) +![liquidity](/images/dex/liquidity.svg) FIGURE 4: How liquidity providers are rewarded diff --git a/src/pages/defi/lending/index.md b/src/pages/defi/lending/index.md index 63ccad368..f9a7e8f77 100644 --- a/src/pages/defi/lending/index.md +++ b/src/pages/defi/lending/index.md @@ -85,7 +85,7 @@ The gas cost bounds the number of steps in a single transaction. So although you Remember that a flash loan has to be borrowed and repaid within the same transaction, so there is no risk that borrowers will not repay their borrowed amount. {% figure - src="/developers/docs/images/lending/flash-loan.svg" + src="/images/lending/flash-loan.svg" alt="Flash loan" caption="FIGURE 1: Operation flow of a flash loan in the case of a successful repayment (green arrows) or failed repayment (red arrows)" %} {% /figure %} @@ -109,7 +109,7 @@ Flash loans are particularly interesting for arbitrageurs to increase profits. T All these steps are included in one transaction. They either all succeed, or they will all fail. {% figure - src="/developers/docs/images/lending/arbitrage.svg" + src="/images/lending/arbitrage.svg" alt="Arbitrage" caption="FIGURE 2: A typical arbitrage operation involving a flash loan." %} {% /figure %} diff --git a/src/pages/defi/stablecoins/index.md b/src/pages/defi/stablecoins/index.md index b9f3707e4..c2636b7de 100644 --- a/src/pages/defi/stablecoins/index.md +++ b/src/pages/defi/stablecoins/index.md @@ -8,7 +8,7 @@ lastUpdated: 27th June 2023 A stablecoin is a cryptocurrency whose price is fixed to another asset. Most stablecoins are pegged (fixed) to fiat currencies (currencies issued by the central bank of a sovereign state) like the US Dollar. -![stablecoin](/developers/docs/images/stablecoins/stablecoin.svg) +![stablecoin](/images/stablecoins/stablecoin.svg) FIGURE 1: Illustration of a stablecoin volatility compared to his pegged asset (e.g. USD) Stablecoins have gained traction as they attempt to offer the best of both worlds: the instant processing, security, and privacy of cryptocurrencies, and the volatile free stable valuations of fiat currencies. @@ -31,7 +31,7 @@ If Alice wants 100 stable-USD, she needs to send 100 USD to the entity's bank ac As shown above, these entities must keep as much USD in their bank account as they have minted stable-USD. A malicious company could spend or invest the USD from their bank account and therefor not be able to pay back users in case of a massive exchange of stable-USD to USD. (Note that this problem is similar to the practice of _fractional reserve banking_). -![stablecoin-kyc](/developers/docs/images/stablecoins/stablecoin-kyc.svg) +![stablecoin-kyc](/images/stablecoins/stablecoin-kyc.svg) FIGURE 2: Exchanging stable coins against fiat currencies (or the other way around) is secured by a KYC. Exchanging stable coins between users do not require a KYC (i.e. as long as it stays inside the world of crypto) ### Crypto-Collateralized Stablecoins @@ -73,7 +73,7 @@ The issue here is that buyers need to be confident that the bonds will payout. B This happened with [the crash of the UST](https://blog.chainalysis.com/reports/how-terrausd-collapsed/#:~:text=Summary,of%20both%20LUNA%20and%20UST.) in May 2022, an algorithm stablecoin. -![stablecoin-type](/developers/docs/images/stablecoins/stablecoin-types.svg) +![stablecoin-type](/images/stablecoins/stablecoin-types.svg) FIGURE 3: Recapitulation of the 3 types of stablecoins. ## Stablecoins on Tezos diff --git a/src/pages/defi/synthetics/index.md b/src/pages/defi/synthetics/index.md index 4c05b9935..a649439a9 100644 --- a/src/pages/defi/synthetics/index.md +++ b/src/pages/defi/synthetics/index.md @@ -17,7 +17,7 @@ Conversely, if the value of BTC goes down 20% in the set period of the bet, Alic As you don't actually purchase the asset, synthetics are particularly interesting for assets that have very low liquidity, are hard to transact, or are simply not available to trade. -![synthetic](/developers/docs/images/synthetics/synthetic.svg) +![synthetic](/images/synthetics/synthetic.svg) ## Synthetics & Blockchain @@ -33,7 +33,7 @@ _Synthetics_ are not to be confused with _Wrapped Assets_. A wrapped asset repre As with any trading, synthetics are risky in their nature. You can lose your investment if the assets you bet on go the opposite way of your bet. -Note that to settle the bet, synthetics contracts use [oracles](/developers/docs/smart-contracts/oracles/) to fetch the underlying asset's price. Please note that there have been countless oracle incidents where the asset price in the smart contract loses its peg to the actual asset. +Note that to settle the bet, synthetics contracts use [oracles](/smart-contracts/oracles/) to fetch the underlying asset's price. Please note that there have been countless oracle incidents where the asset price in the smart contract loses its peg to the actual asset. ## Synthetics on Tezos diff --git a/src/pages/defi/wrapped-assets/index.md b/src/pages/defi/wrapped-assets/index.md index 5d88870ba..dd9f39e00 100644 --- a/src/pages/defi/wrapped-assets/index.md +++ b/src/pages/defi/wrapped-assets/index.md @@ -21,17 +21,17 @@ Now here is the issue: XTZ doesn't conform to its own FA standards. Indeed, XTZ is the proto-token of the Tezos Blockchain, i.e., it was built before the FA standards existed. This makes XTZ not compliant with the FA standards used by most Dapps, e.g., DEXs, NFT marketplaces, etc. -{% figure src="/developers/docs/images/non-compliant.svg" alt="" caption="FIGURE: XTZ can't interact with FA tokens" %} {% /figure %} +{% figure src="/images/non-compliant.svg" alt="" caption="FIGURE: XTZ can't interact with FA tokens" %} {% /figure %} One solution consists in _wrapping_ XTZ into an FA-compliant token called _wXTZ_. Wrapping XTZ allows you to trade them directly with alt tokens. You need wXTZ to trade XTZ for other FA tokens on decentralized platforms like _Dexter_ and _Quipuswap_. Because decentralized platforms running on Tezos use smart contracts to facilitate trades, directly between users, every user needs to have the same standardized format for the tokens they trade. This ensures tokens don't get lost. -{% figure src="/developers/docs/images/wrap.svg" alt="" caption="FIGURE: Wrapping XTZ and unwrapping wXTZ" %} {% /figure %} +{% figure src="/images/wrap.svg" alt="" caption="FIGURE: Wrapping XTZ and unwrapping wXTZ" %} {% /figure %} When you "wrap" XTZ, you aren't really wrapping so much as trading XTZ for an equal token called wXTZ via a smart contract. If you want to get plain XTZ back you need to "unwrap" it, i.e., trade it back for XTZ. In practice, during the wrapping step, your XTZ are stored in a smart contract, and an equal amount of wXTZ is minted by the contract and transferred to you. When unwrapping, your wXTZ are burned (a.k.a. destroyed), and the equivalent in XTZ is released and sent back to you. -{% figure src="/developers/docs/images/compliant.svg" alt="" caption="FIGURE: wXTZ can interact with other FA tokens" %} {% /figure %} +{% figure src="/images/compliant.svg" alt="" caption="FIGURE: wXTZ can interact with other FA tokens" %} {% /figure %} ## Properties of wXTZ diff --git a/src/pages/nft/build-an-nft-marketplace/index.md b/src/pages/nft/build-an-nft-marketplace/index.md index 836647ce8..787a69513 100644 --- a/src/pages/nft/build-an-nft-marketplace/index.md +++ b/src/pages/nft/build-an-nft-marketplace/index.md @@ -735,7 +735,7 @@ const mint = async (newTokenDefinition: TZIP21TokenMetadata) => { }; ``` -![mint form](/developers/docs/images/mintForm.png) +![mint form](/images/mintForm.png) Explanations: @@ -907,7 +907,7 @@ const handleStepChange = (step: number) => { 4. Click on the Mint button -![minting](/developers/docs/images/minting.png) +![minting](/images/minting.png) Your picture will be pushed to IPFS and displayed. @@ -915,7 +915,7 @@ Then, Temple Wallet _(or whatever other wallet you choose)_ will ask you to sign Now you can see all NFTs -![wine collection](/developers/docs/images/winecollection.png) +![wine collection](/images/winecollection.png) ## Conclusion diff --git a/src/pages/nft/build-an-nft-marketplace/part-2.md b/src/pages/nft/build-an-nft-marketplace/part-2.md index 87df334fb..a41055368 100644 --- a/src/pages/nft/build-an-nft-marketplace/part-2.md +++ b/src/pages/nft/build-an-nft-marketplace/part-2.md @@ -811,7 +811,7 @@ Your picture will be pushed to IPFS and displayed, then your wallet ask you to s 6. Click on the submenu entry -![sell.png](/developers/docs/images/sell.png) +![sell.png](/images/sell.png) You are the owner of this bottle so you can create an offer to sell it. @@ -1056,7 +1056,7 @@ export default function WineCataloguePage() { Now you can see on `Trading` menu the `Wine catalogue` submenu, click on it. -![buy.png](/developers/docs/images/buy.png) +![buy.png](/images/buy.png) As you are connected with the default administrator you can see your own unique offer on the market diff --git a/src/pages/nft/build-an-nft-marketplace/part-3.md b/src/pages/nft/build-an-nft-marketplace/part-3.md index 277321b0c..f9c86ad48 100644 --- a/src/pages/nft/build-an-nft-marketplace/part-3.md +++ b/src/pages/nft/build-an-nft-marketplace/part-3.md @@ -1316,14 +1316,14 @@ export default function WineCataloguePage() { 3. Click on `Upload an image` and select a bottle picture on your computer 4. Click on the Mint button -![minting.png](/developers/docs/images/minting_part3.png) +![minting.png](/images/minting_part3.png) Your picture will be pushed to IPFS and displayed, then your wallet will ask you to sign the `mint` operation. - Confirm operation - Wait less than 1 minute to get the confirmation notification, the page will be automatically refreshed. -![minted.png](/developers/docs/images/minted.png) +![minted.png](/images/minted.png) Now you can see the `Trading` menu and the `Bottle offers` sub menu @@ -1336,7 +1336,7 @@ You are the owner of this bottle so you can make an offer on it - Click on the `SELL` button - Wait a bit for the confirmation, then once automatically refreshed you have an offer attached to your NFT -![offer.png](/developers/docs/images/offer.png) +![offer.png](/images/offer.png) For buying, @@ -1347,7 +1347,7 @@ For buying, - Click on `bottle offers` sub menu - You are now the owner of some bottles, you can resell a part of it at your own price, etc ... -![buy.png](/developers/docs/images/buy_part3.png) +![buy.png](/images/buy_part3.png) ## Conclusion diff --git a/src/pages/nft/build-an-nft-marketplace/part-4.md b/src/pages/nft/build-an-nft-marketplace/part-4.md index d29302207..30a803020 100644 --- a/src/pages/nft/build-an-nft-marketplace/part-4.md +++ b/src/pages/nft/build-an-nft-marketplace/part-4.md @@ -1452,14 +1452,14 @@ export default function WineCataloguePage() { 3. Click on `Upload an image` and select a bottle picture on your computer 4. Click on the Mint button -![minting_part4.png](/developers/docs/images/minting_part4.png) +![minting_part4.png](/images/minting_part4.png) Your picture will be pushed to IPFS and will be displayed, then your wallet will ask you to sign the `mint` operation. - Confirm operation - Wait less than 1 minute to get the confirmation notification, the page will be automatically refreshed -![minted_part4.png](/developers/docs/images/minted_part4.png) +![minted_part4.png](/images/minted_part4.png) Now you can see the `Trading` menu and the `Bottle offers` sub-menu @@ -1472,7 +1472,7 @@ You are the owner of this bottle so you can create an offer on it - Click on `SELL` button - Wait a bit for the confirmation, then once automatically refreshed you have an offer attached to your NFT! -![sell_part4.png](/developers/docs/images/sell_part4.png) +![sell_part4.png](/images/sell_part4.png) For buying, @@ -1483,7 +1483,7 @@ For buying, - Click on the `bottle offers` submenu - You are now the owner of some bottles, you can resell a part of it at your own price, etc ... -![buy_part4.png](/developers/docs/images/buy_part4.png) +![buy_part4.png](/images/buy_part4.png) To add more collections, go to the Mint page and repeat the process. diff --git a/src/pages/nft/create-an-nft/nft-pinata.md b/src/pages/nft/create-an-nft/nft-pinata.md index 309fd9d22..7ed0db410 100644 --- a/src/pages/nft/create-an-nft/nft-pinata.md +++ b/src/pages/nft/create-an-nft/nft-pinata.md @@ -75,21 +75,21 @@ The backend of the app is a simple Express app written in TypeScript. The app on First step, sign up to create an account and follow the instructions: -![](/developers/docs/images/nft-pinata/image36.png) +![](/images/nft-pinata/image36.png) When you are all set up, click on “API Keys” in the left panel: -![](/developers/docs/images/nft-pinata/image22.png) +![](/images/nft-pinata/image22.png) To finish, click on “_+ New Key_” to get your keys: -![](/developers/docs/images/nft-pinata/image9.png) +![](/images/nft-pinata/image9.png) You will get an API key and a secret key, copy-paste them somewhere safe to use them later as they won’t be visible anymore after that. The app uses 5 packages: -![](/developers/docs/images/nft-pinata/image34.png) +![](/images/nft-pinata/image34.png) * **express** allows us to set up a server app quickly * **@pinata/sdk** gives us convenient functions to interact with our Pinata account @@ -99,17 +99,17 @@ The app uses 5 packages: Next, we have to do some setup before writing the “mint” endpoint. Because I used [Heroku](https://id.heroku.com/login) to host the app, there is also some Heroku-specific setting up to do to start the server: -![](/developers/docs/images/nft-pinata/image28.png) +![](/images/nft-pinata/image28.png) Heroku doesn’t like it too much when you try to tell it which port to use 😅 So for the production version, you must let Heroku decide on which port your app is going to listen to. Setting up the Pinata SDK will also depend on the `process.env.NODE_ENV` variable. You can choose to have your API keys in a separate file, both in the development and production environment, but Heroku lets you define environment variables that are automatically injected in your build and stored securely, so this is generally the solution you would prefer, i.e having a separate file with your keys for development and having your keys in environment variables for production. Whichever solution you choose, the Pinata SDK can be easily instantiated by passing the API key and the secret key as parameters: -![](/developers/docs/images/nft-pinata/image20.png) +![](/images/nft-pinata/image20.png) Let’s finish setting up the server app: -![](/developers/docs/images/nft-pinata/image29.png) +![](/images/nft-pinata/image29.png) In the `corsOptions` variable, we indicate the URLs that are allowed to communicate with the server. During development, you should allow `localhost` with the port you are using, then you can use the URL of your app. @@ -122,23 +122,23 @@ Now, we can set up the different middlewares: Now, everything is set up, let’s write the `mint` endpoint! -![](/developers/docs/images/nft-pinata/image32.png) +![](/images/nft-pinata/image32.png) This is going to be a `POST` endpoint \(because of the picture we need to receive\) that’s going to be called when a request comes to the `/mint` route. We use the `single` method of the `upload` middleware from `multer` with the `“image”` parameter, which tells `multer` that we are expecting to receive one image on this endpoint. We then store the request in a new variable cast to the `any` type because TypeScript will raise an error later as it is unaware that the request has been modified by `multer`. The request comes with the file sent by the user: -![](/developers/docs/images/nft-pinata/image14.png) +![](/images/nft-pinata/image14.png) We check first if a file was provided with `if(!multerReq.file)`, if there is none, the request fails with a 500 error code and a message. If a file was provided, we store the filename available at `multerReq.file.filename`. After checking if the request came along with a file, we’re going to verify that our connection to the Pinata service works properly: -![](/developers/docs/images/nft-pinata/image21.png) +![](/images/nft-pinata/image21.png) The instance of the Pinata SDK provides a method called `testAuthentication` that verifies that you are properly authenticated. With that done, we can go ahead and pin the user’s picture in Pinata: -![](/developers/docs/images/nft-pinata/image24.png) +![](/images/nft-pinata/image24.png) > Note: we have to pin the picture first before pinning the metadata to the IPFS because the metadata must include the hash of the picture. @@ -150,7 +150,7 @@ Next, we can pin the picture to the IPFS. We use the `pinFileToIPFS` method of t Now, we can create the metadata for the NFT and pin it to the IPFS: -![](/developers/docs/images/nft-pinata/image41.png) +![](/images/nft-pinata/image41.png) First, we are going to remove the user’s image from the server. Whether you are using a service on a free tier with a limited storage or you have your own server, you don’t want to keep the images the users sent on your server. To remove it, you can use the `unlinkSync` method of the `fs` package and pass to it the path to the file. @@ -193,21 +193,21 @@ As explained earlier, the NFTs are just token ids stored in the contract. In ord Let’s start by installing [Taquito](https://tezostaquito.io/) and creating a new instance of the Tezos toolkit: -![](/developers/docs/images/nft-pinata/image8.png) +![](/images/nft-pinata/image8.png) Now, we can fetch the storage of the contract: -![](/developers/docs/images/nft-pinata/image10.png) +![](/images/nft-pinata/image10.png) `await Tezos.wallet.at(contractAddress)` creates an instance of the contract with different useful methods to interact with the contract or get details about, like the storage, that you can get using `await contract.storage()`. After that, we have access to the whole storage. Now, we can look for the token ids owned by the user by searching the `reverse_ledger` bigmap with the `get` function: -![](/developers/docs/images/nft-pinata/image19.png) +![](/images/nft-pinata/image19.png) `getTokenIds` is an array containing all the ids owned by the `address`. We can simply loop through the array to get each id and look for the id in the `ledger` bigmap: -![](/developers/docs/images/nft-pinata/image37.png) +![](/images/nft-pinata/image37.png) The id is returned by Taquito as a `BigNumber`, so you have to call `.toNumber()` first before being able to use it. Once we have the id, we can look for its metadata in the `token_metadata` bigmap. The value returned is a Michelson map and the metadata path is going to be stored at the empty key. Because the path is stored as bytes, we use `bytes2Char()` provided by the `@taquito/utils` package to convert the returned `bytes` into a `string`. To finish, we return an object with 2 properties: the token id and the IPFS hash of the metadata. @@ -217,23 +217,23 @@ _2- Sending the picture and metadata to the backend_ First, we set up the HTML tags we need to get the picture, the name of the picture, and its description: -![](/developers/docs/images/nft-pinata/image23.png) +![](/images/nft-pinata/image23.png) The `bind` attribute in Svelte makes it very easy to store the input in a variable that we can use later when we want to pin the NFT to the IPFS. A click on the `upload` button will trigger the upload of the picture, its title, and description to the server. Now, let’s see how uploading the user data works! -![](/developers/docs/images/nft-pinata/image26.png) +![](/images/nft-pinata/image26.png) We define 2 boolean variables called `pinningMetadata` and `mintingToken` that we will update according to the result of the different steps of the upload to give some visual feedback to the users in the UI. Because we are not using a traditional form, we must build the form data manually. After instantiating a new `FormData`, we use the `append` method to add the different details of the form, the picture, the title, the description, and the creator of the NFT. Once the form is ready, we can use the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to make a POST request to the `/mint` endpoint of our server app. The request should include the required headers and the form in the `body`. The response from the server will include the hash for the picture and the hash for the metadata: -![](/developers/docs/images/nft-pinata/image33.png) +![](/images/nft-pinata/image33.png) When the `response` comes, we can convert it to a usable JS object with the `json` method. We check that the `status` property is `200` and that the `metadataHash` and `imageHash` properties exist. If that’s the case, we can switch the UI from “pinning” to “minting” and send the transaction to the blockchain to save the NFT metadata: -![](/developers/docs/images/nft-pinata/image15.png) +![](/images/nft-pinata/image15.png) This is a regular contract call. You create an instance of the contract by calling `Tezos.wallet.at(contractAddress)`, then you call the `mint` entrypoint in the `contract.methods` property. Because the entrypoint expects bytes, we have to convert the IPFS hash into bytes without forgetting to prefix `ipfs://` to make it valid. We pass the `userAddress` at the same time to identify the owner of the NFT in the contract. After the NFT is minted and the minting is confirmed, we save the data of the NFT into `newNft` to have it displayed in the interface, we reset the files, title, and description variables to give the opportunity to the user to mint another NFT and we refresh the list of NFTs owned by the user by querying them \(this is not absolutely necessary but getting up-to-date data from the contract never hurts\). diff --git a/src/pages/smart-contracts/avoiding-flaws/index.md b/src/pages/smart-contracts/avoiding-flaws/index.md index 13b177571..70f848f71 100644 --- a/src/pages/smart-contracts/avoiding-flaws/index.md +++ b/src/pages/smart-contracts/avoiding-flaws/index.md @@ -607,7 +607,7 @@ Generating a random value during a contract call, for example for selecting the - **The value of a new contract's address**. A contract may deploy a new contract and obtain its address. Unfortunately, a contract address is far from being as random as it looks. It is simply computed based on the operation group hash and an origination index (starting from 0 which is increased for every origination operation in the group). It can therefore be easily manipulated by the creator of the operation which is no better than trusting them. -- **The exchange rate between currencies**. One may consider using an off-chain [oracle](/developers/docs/smart-contracts/oracles/) to obtain the exchange rate between two common currencies, such USD and Euro, and use this to get a few bits of entropy for randomness. This can be considered difficult to predict and therefore "random". There are however a number of issues with this approach: +- **The exchange rate between currencies**. One may consider using an off-chain [oracle](/smart-contracts/oracles/) to obtain the exchange rate between two common currencies, such USD and Euro, and use this to get a few bits of entropy for randomness. This can be considered difficult to predict and therefore "random". There are however a number of issues with this approach: - We can only get a few bits of entropy (randomness), which is usually insufficient. - One of the entities behind the off-chain oracle could influence the exact value. The exact way to do this depends on the specifics of the oracle, but it's likely that there is a way to do so. - A baker could also censor some of the transactions involved in the off-chain oracle, and by doing so, influence the exact value as well. @@ -923,7 +923,7 @@ Good oracles always attach a timestamp to the information they provide. If for s ### Using on-chain oracles that can be manipulated -On-chain oracles don't provide data from off-chain sources. Instead, they provide access to data collected from other smart contracts. For example, an on-chain oracle could collect and provide data about the exchange rate between two tokens from one or more [DEXes](/developers/docs/defi/dex/) running on the same blockchain. Doing this in a safe manner is not straightforward. +On-chain oracles don't provide data from off-chain sources. Instead, they provide access to data collected from other smart contracts. For example, an on-chain oracle could collect and provide data about the exchange rate between two tokens from one or more [DEXes](/defi/dex/) running on the same blockchain. Doing this in a safe manner is not straightforward. An attacking contract could perform the following steps: - use a flash-loan to borrow a lot of tez diff --git a/src/pages/smart-contracts/simplified-contracts/index.md b/src/pages/smart-contracts/simplified-contracts/index.md index 4ec30f8fe..592ebf1f5 100644 --- a/src/pages/smart-contracts/simplified-contracts/index.md +++ b/src/pages/smart-contracts/simplified-contracts/index.md @@ -13,7 +13,7 @@ The contracts on this page are simplified contracts, provided for educational pu ## Prerequisites -If you haven't already, please go ahead and read [Smart Contract Concepts](/developers/docs/smart-contracts/smart-contracts-concepts/). It also might be worth having a read through the [Smart Contract Languages](/developers/docs/smart-contracts/smart-contract-languages/) section to get an understanding of the options available to you - this way you can start thinking about how the implementations below might look in another of the supported smart contract languages on *Tezos*. +If you haven't already, please go ahead and read [Smart Contract Concepts](/smart-contracts/smart-contracts-concepts/). It also might be worth having a read through the [Smart Contract Languages](/smart-contracts/smart-contract-languages/) section to get an understanding of the options available to you - this way you can start thinking about how the implementations below might look in another of the supported smart contract languages on *Tezos*. ## Common Contracts diff --git a/src/pages/smart-contracts/smart-contract-languages/index.md b/src/pages/smart-contracts/smart-contract-languages/index.md index f63e95907..2ee387fc0 100644 --- a/src/pages/smart-contracts/smart-contract-languages/index.md +++ b/src/pages/smart-contracts/smart-contract-languages/index.md @@ -76,7 +76,7 @@ The origination of a Tezos smart contract must define: * **Storage Type** * **Set of instructions** in the low-level *Michelson* language -![smart contract content](/developers/docs/images/tezos_smart_contract_content.svg) +![smart contract content](/images/tezos_smart_contract_content.svg) *FIGURE 1: Content of a Tezos smart contract* The CLI command "`octez-client originate`" can be used to deploy a Tezos smart contract. Arguments are the following: @@ -104,7 +104,7 @@ During the origination, the process must specify the storage **initial state** ( ### Call of a Tezos smart contract A smart contract can be called by a classic account whose address starts with "**tz**" or by a smart contract account whose address begins with "**KT1**". The operation or transaction specifies *arguments*, that are ordered types. In the below example, we increase or decrease a value in the storage: -![invoke smart contract without entrypoint](/developers/docs/images/invoke_smart_contract_wo_entrypoint.svg) +![invoke smart contract without entrypoint](/images/invoke_smart_contract_wo_entrypoint.svg) *FIGURE 2: Call of a smart contract triggering its code and modifying its storage's state* One can use the Command Line Interface (CLI) provided by Tezos to interact with a node and make calls. The `octez-client` application allows anyone to deploy and call Tezos smart contracts. @@ -116,7 +116,7 @@ Michelson is a low-level stack-based language. Therefore its adoption is quite l Depending on the high-level language used, a smart contract deployment also defines its *entrypoints* using the complex **Parameter Type**. These are special functions used to dispatch invocations of the smart contract. Each entrypoint is in charge of triggering an instruction. Below is the same example as before, abstracting the complex Parameter Type: -![invoke smart contract](/developers/docs/images/invoke_smart_contract.svg) +![invoke smart contract](/images/invoke_smart_contract.svg) *FIGURE 3: Call of a smart contract triggering its entrypoints, code, and modifying its storage's state* Each type and position of a parameter in the list (or pair) allows you to define an entrypoint (a function). For instance, in our example, there are two parameters, hence two types. Both types are integers (to increase or decrease a value). Because the type is the same, its position (left, right, or index number) determines which entrypoint is correct. @@ -126,5 +126,5 @@ It could be: Below is another illustration of this process: -![tezos smart contract deploy invoke](/developers/docs/images/tezos_smart_contract_deploy_invoke.svg) +![tezos smart contract deploy invoke](/images/tezos_smart_contract_deploy_invoke.svg) *FIGURE 4: Deployment and call of a Tezos smart contract with high-level languages* diff --git a/src/pages/smart-contracts/smart-contract-languages/smartpy.md b/src/pages/smart-contracts/smart-contract-languages/smartpy.md index 1813613b4..cdfa02577 100644 --- a/src/pages/smart-contracts/smart-contract-languages/smartpy.md +++ b/src/pages/smart-contracts/smart-contract-languages/smartpy.md @@ -73,7 +73,7 @@ The organizer is in charge of defining a jackpot and selling tickets that will e Fig.3 represents our smart contract. -![](/developers/docs/images/smart-contracts/raffle_schema.svg) +![](/images/smart-contracts/raffle_schema.svg) FIGURE 3: Raffle contract Three entrypoints allow interaction with the contract: @@ -90,7 +90,7 @@ This section illustrates the coding of the smart contract in the [online editor] #### Create your contract To start, create a new contract in the online editor and name it _Raffle Contract_. -![](/developers/docs/images/smart-contracts/online_editor_create_contract.png) +![](/images/smart-contracts/online_editor_create_contract.png) FIGURE 4: Online Editor Create Contract #### Template @@ -390,7 +390,7 @@ The result is displayed in an HTML document in the output panel of the online ed Let's run our code: -![](/developers/docs/images/smart-contracts/online_editor_summary_contract.png) +![](/images/smart-contracts/online_editor_summary_contract.png) FIGURE 4: Online Editor Contract Summary You can see a summary of our smart contract with the following information: @@ -401,7 +401,7 @@ You can see a summary of our smart contract with the following information: By clicking on the _Types_ tab, we have access to the types of the storage elements and the parameters of the entrypoints. -![](/developers/docs/images/smart-contracts/online_editor_Types.png) +![](/images/smart-contracts/online_editor_Types.png) FIGURE 5: Online Editor Types > As with Python, most of the time, it is not necessary to specify the type of an object in _SmartPy_. @@ -505,7 +505,7 @@ code By scrolling down a little, we have access to the results of the test scenario, and within each step a summary of the contract. -![](/developers/docs/images/smart-contracts/online_editor_scenario_output.png) +![](/images/smart-contracts/online_editor_scenario_output.png) FIGURE 4: Online Editor Scenario Output ### buy_ticket entrypoint diff --git a/src/pages/smart-contracts/smart-contracts-concepts/index.md b/src/pages/smart-contracts/smart-contracts-concepts/index.md index 382004294..e693edf93 100644 --- a/src/pages/smart-contracts/smart-contracts-concepts/index.md +++ b/src/pages/smart-contracts/smart-contracts-concepts/index.md @@ -9,7 +9,7 @@ lastUpdated: 30th June 2023 The goal of this page is to give you an overview of all the features available for Tezos Smart Contracts, independently of any specific language. We will cover the differences between smart contracts and standard programs, including what they do and don't support. By the end of this page, you should have a general understanding of what smart contracts are and how they can be used. -If you'd like to learn more about each individual smart contract language, you can read the [Smart Contract Languages](/developers/docs/smart-contracts/smart-contract-languages/) section or if you are eager to get started you can [deploy your first smart contract](/developers/docs/tezos-basics/deploy-your-first-smart-contract/). +If you'd like to learn more about each individual smart contract language, you can read the [Smart Contract Languages](/smart-contracts/smart-contract-languages/) section or if you are eager to get started you can [deploy your first smart contract](/tezos-basics/deploy-your-first-smart-contract/). ## Smart Contract Features: @@ -46,10 +46,10 @@ Almost all of the features listed are available in each of the smart contract pr For details about the specific syntax of each language, feel free to check the corresponding reference documentations: -- [Michelson](/developers/docs/smart-contracts/smart-contract-languages/michelson/), the low-level stack-based language that all other languages compile to. -- [Archetype](/developers/docs/smart-contracts/smart-contract-languages/archetype/), a high-level language specifically designed to write consise and elegant Tezos smart contracts. -- [SmartPy](/developers/docs/smart-contracts/smart-contract-languages/smartpy/), a python-based framework that uses meta-programming to build smart contracts. -- [LIGO](/developers/docs/smart-contracts/smart-contract-languages/ligo/), with two different flavours, [JsLIGO](/developers/docs/smart-contracts/smart-contract-languages/ligo/#js-ligo) and [CameLIGO](/developers/docs/smart-contracts/smart-contract-languages/ligo/#came-ligo). +- [Michelson](/smart-contracts/smart-contract-languages/michelson/), the low-level stack-based language that all other languages compile to. +- [Archetype](/smart-contracts/smart-contract-languages/archetype/), a high-level language specifically designed to write consise and elegant Tezos smart contracts. +- [SmartPy](/smart-contracts/smart-contract-languages/smartpy/), a python-based framework that uses meta-programming to build smart contracts. +- [LIGO](/smart-contracts/smart-contract-languages/ligo/), with two different flavours, [JsLIGO](/smart-contracts/smart-contract-languages/ligo/#js-ligo) and [CameLIGO](/smart-contracts/smart-contract-languages/ligo/#came-ligo). {% callout type="note" title="VisualTez" %} [VisualTez](https://visualtez.com/editor) allows you to visualise the fundamental logic of a smart contract without relying on any specific syntax. You can use VisualTez to help you get a visual understanding of the topics covered on this page. @@ -227,7 +227,7 @@ The only effects of calling a contract are that it may update the value of this Here is one of the simplest possible smart contracts. It stores an `int`, and its code does only one thing: replace the storage with the new value, passed as a parameter. -Check some [examples of contracts](/developers/docs/smart-contracts/simplified-contracts/) to get a good idea of how storage can be used. +Check some [examples of contracts](/smart-contracts/simplified-contracts/) to get a good idea of how storage can be used. ### Links @@ -266,7 +266,7 @@ Here is a very basic example of contract with two entrypoints: * `reset` takes no parameter, and replaces the storage with 0. {% /table %} -Check some [examples of contracts](/developers/docs/smart-contracts/simplified-contracts/) to get a good idea of how entrypoints are used. +Check some [examples of contracts](/smart-contracts/simplified-contracts/) to get a good idea of how entrypoints are used. ### Links @@ -474,7 +474,7 @@ Testing a contract thoroughly is not easy and requires experience, here are some - Create many small tests, each checking something very specific, rather than a long test that tries to do many things at once - Test around the limits. If a value should be strictly above 10, include a call with the value 10 that should fail, and a call with the value 11 that should succeed. - Test the extremes -- See [Avoiding flaws](/developers/docs/smart-contracts/avoiding-flaws/), and make sure to follow the best practices listed there +- See [Avoiding flaws](/smart-contracts/avoiding-flaws/), and make sure to follow the best practices listed there ### Links @@ -981,7 +981,7 @@ The code of a `lambda` takes some parameters and returns a value, but doesn't ha - Archetype: [apply_lambda](https://archetype-lang.org/docs/reference/expressions/builtins#apply_lambda%28f%20:%20lambda%3CA%20*%20T,%20R%3E,%20x%20:%20A%29) - SmartPy: [Lambdas](https://smartpy.io/manual/syntax/lambdas) - LIGO: [Anonymous functions](https://ligolang.org/docs/language-basics/functions#anonymous-functions-aka-lambdas) -- [Simplified DAO contract](/developers/docs/smart-contracts/simplified-contracts/#dao-decentralized-autonomous-organisation) +- [Simplified DAO contract](/smart-contracts/simplified-contracts/#dao-decentralized-autonomous-organisation) ## Annotations @@ -1184,7 +1184,7 @@ The particularity is that the amount of time it takes to crack it is bounded. We Let's say for example that you encrypt the data in a time lock, so that you know it will take between 10 minutes and 10 hours to decrypt, depending on what type of hardware is being used. You could have a commit phase that is opened during less than 10 minutes. This makes sure that no one can decrypt anyone's commitment while the commit phase is still open. Once the reveal phase starts, you could give a few minutes for everyone to reveal their data. If a participant doesn't reveal, you set a financial reward for anyone else who manages to crack the encryption and reveal the data. Eventually, the data will be revealed, and so there is no positive incentive for the participant not to reveal: they would lose their deposit when someone else reveals for them. This acts as a deterrent, and in practice it becomes very unlikely that someone doesn't reveal and forces someone to use some computing resources to do it for them. Overall, timelocks make commit and reveal schemes effective in many additional use cases. -Some use cases involve collectively generating a random value, or preventing [BPEV attacks](/developers/docs/smart-contracts/avoiding-flaws/#6-not-protecting-against-bots-bpev-attacks). +Some use cases involve collectively generating a random value, or preventing [BPEV attacks](/smart-contracts/avoiding-flaws/#6-not-protecting-against-bots-bpev-attacks). ### Links: diff --git a/src/pages/smart-contracts/token-standards/index.md b/src/pages/smart-contracts/token-standards/index.md index 7ab4dd994..02e4dced5 100644 --- a/src/pages/smart-contracts/token-standards/index.md +++ b/src/pages/smart-contracts/token-standards/index.md @@ -13,7 +13,7 @@ A token standard is an interface, and a set of rules, that a smart contract must Multiple implementations of a standard can co-exist, but they must all respect the interface and rules of the standard. Standards ensure that smart contracts remain compatible, so for instance, when a new project issues a token, it remains compatible with the existing decentralized exchanges, wallets, etc. -{% figure src="/developers/docs/images/token-standards/standards.svg" alt="token-standard-implementation" caption="FIGURE 1: Illustration of 2 implementations of the same token standard" %} {% /figure %} +{% figure src="/images/token-standards/standards.svg" alt="token-standard-implementation" caption="FIGURE 1: Illustration of 2 implementations of the same token standard" %} {% /figure %} ## Fungible & Non-Fungible Tokens @@ -36,10 +36,10 @@ The FA1.2 specification is described in detail in the [TZIP-7 proposal](https:// The FA2 standard (standing for _Financial Application 2_) refers to the unified token standard on Tezos. It supports a wide range of token types: -- fungible (equivalent to [ERC-20](https://ethereum.org/en/developers/docs/standards/tokens/) on Ethereum), -- non-fungible (equivalent to [ERC-721](https://ethereum.org/en/developers/docs/standards/tokens/) on Ethereum), -- non-transferable (equivalent to [ERC-1238](https://ethereum.org/en/developers/docs/standards/tokens/) on Ethereum), -- as well as multi-asset contracts (equivalent to [ERC-1155](https://ethereum.org/en/developers/docs/standards/tokens/) on Ethereum). +- fungible (equivalent to [ERC-20](https://ethereum.org/en/standards/tokens/) on Ethereum), +- non-fungible (equivalent to [ERC-721](https://ethereum.org/en/standards/tokens/) on Ethereum), +- non-transferable (equivalent to [ERC-1238](https://ethereum.org/en/standards/tokens/) on Ethereum), +- as well as multi-asset contracts (equivalent to [ERC-1155](https://ethereum.org/en/standards/tokens/) on Ethereum). As you can see, FA2 is a very powerful standard that allows many forms of tokens. It aims to provide significant expressivity to contract developers, allowing them to create new types of tokens while maintaining a common interface standard for wallet integrators and external developers. A variety of transfer permission policies can also be defined, such as how most tokens can be transferred, who can perform a transfer, and who can receive tokens. A token contract can be designed to support a single token type or multiple token types to optimize batch transfers and atomic swaps. A particular FA2 implementation may include hybrid implementations where multiple token kinds (fungible, non-fungible, non-transferable etc) can coexist (e.g. in a fractionalized NFT contract). @@ -48,7 +48,7 @@ Note that FA2 is the successor to [FA1.2](/defi/token-standards#fa12) that only To learn more on how to implement FA2 tokens, please refer to the corresponding Tezos Improvments Proposal, the TZIP-12[[3]](/defi/token-standards#references). -{% figure src="/developers/docs/images/token-standards/tokens.svg" alt="fa2-token-standard" caption="FIGURE 2: Illustration of the multi-purpose aspect of the FA2 token standard." %} {% /figure %} +{% figure src="/images/token-standards/tokens.svg" alt="fa2-token-standard" caption="FIGURE 2: Illustration of the multi-purpose aspect of the FA2 token standard." %} {% /figure %} To learn more on how to implement FA2 tokens, please refer to the corresponding Tezos Improvements Proposal, the [TZIP-12](https://tzip.tezosagora.org/proposal/tzip-12/). diff --git a/src/pages/tezos-basics/block-explorers/tzstats-main-features.md b/src/pages/tezos-basics/block-explorers/tzstats-main-features.md index 639655e10..675849750 100644 --- a/src/pages/tezos-basics/block-explorers/tzstats-main-features.md +++ b/src/pages/tezos-basics/block-explorers/tzstats-main-features.md @@ -21,56 +21,56 @@ TzStats has a complete guide available [here](https://tzstats.com/docs/guide). - [Main Dashboard](https://tzstats.com/): This page provides a quick view of all the main activity on the Tezos network, e.g. staking activity, gas price, tez supply, transaction volume, etc. {% figure - src="/developers/docs/images/tzstats-main-features/tzStats_first_page.png" + src="/images/tzstats-main-features/tzStats_first_page.png" alt="tzstats-main-dashboard" caption="TzStats Main Dashboard" %} {% /figure %} - [Cycle](https://tzstats.com/cycle/head): This page provides general information about a specific cycle number. A cycle is a way of measuring time. Every cycle is equal to 4096 blocks. {% figure - src="/developers/docs/images/tzstats-main-features/tzStats_cycle.png" + src="/images/tzstats-main-features/tzStats_cycle.png" alt="tzstats-cycle-page" caption="TzStats Cycle Page" %} {% /figure %} - [Block](https://tzstats.com/1496426): This page provides general information about a specific block number along with its technical details such as gas used, block health (Endorsed Slots, Missed Priorities and Missed Endorsements), etc. {% figure - src="/developers/docs/images/tzstats-main-features/tzStats_block.png" + src="/images/tzstats-main-features/tzStats_block.png" alt="tzstats-block-page" caption="TzStats Block Page" %} {% /figure %} - [Network Activity](https://tzstats.com/activity): This page provides a world map with the location of where new blocks are being baked. There is also the list of _whale operations_ (i.e. a list of high-value transfers >= $100,000). {% figure - src="/developers/docs/images/tzstats-main-features/tzStats_activity.png" + src="/images/tzstats-main-features/tzStats_activity.png" alt="tzstats-activity-page" caption="TzStats Activity Page" %} {% /figure %} - [Bakers](https://tzstats.com/bakers): This page provides the total number of Tezos bakers. Several lists are also available to gain an overview of the Tezos baker landscape. You can choose between several tabs, namely, Public, Private, Closing, and Leaderboard. {% figure - src="/developers/docs/images/tzstats-main-features/tzStats_bakers.png" + src="/images/tzstats-main-features/tzStats_bakers.png" alt="tzstats-bakers-page" caption="TzStats Bakers Page" %} {% /figure %} - [Protocols](https://tzstats.com/protocols): This page shows the past and current protocol used by Tezos and the overall age of the Tezos blockchain. Refer to the chapter on the [history of amendments](/tezos-basics/history-of-amendments) to understand each protocol. {% figure - src="/developers/docs/images/tzstats-main-features/tzStats_protocols.png" + src="/images/tzstats-main-features/tzStats_protocols.png" alt="tzstats-protocols-page" caption="TzStats Protocols Page" %} {% /figure %} - [Voting](https://tzstats.com/election/head): This page shows the past and current elections and indicates when it ends. Refer to chapter on the [governance on chain](/tezos-basics/governance-on-chain) to understand the voting process. {% figure - src="/developers/docs/images/tzstats-main-features/tzStats_voting.png" + src="/images/tzstats-main-features/tzStats_voting.png" alt="tzstats-voting-page" caption="TzStats Voting Page" %} {% /figure %} - [Markets](https://tzstats.com/markets): This page provides an overview of the current market activity, e.g. list of exchanges, 1 day's volume, overall market capitalization, etc. {% figure - src="/developers/docs/images/tzstats-main-features/tzStats_markets.png" + src="/images/tzstats-main-features/tzStats_markets.png" alt="tzstats-markets-page" caption="TzStats Markets Page" %} {% /figure %} diff --git a/src/pages/tezos-basics/block-explorers/tzstats-smart-contract.md b/src/pages/tezos-basics/block-explorers/tzstats-smart-contract.md index 063b28979..0b9e71d0b 100644 --- a/src/pages/tezos-basics/block-explorers/tzstats-smart-contract.md +++ b/src/pages/tezos-basics/block-explorers/tzstats-smart-contract.md @@ -18,11 +18,11 @@ Remember, the following TzStats website links are the following: Copy/paste your address in the search bar: -![](/developers/docs/images/tzstats-smart-contract/tzStats_search_bar.png) +![](/images/tzstats-smart-contract/tzStats_search_bar.png) TzStats then shows a page with information related to your smart contract, e.g. the balance of the contract, the amounts sent and received, the originator's address, etc. -![](/developers/docs/images/tzstats-smart-contract/tzStats_smart_contract_general_information.png) +![](/images/tzstats-smart-contract/tzStats_smart_contract_general_information.png) Below the general information, you have a list of tabs allowing you to see: @@ -55,25 +55,25 @@ You can see: Here you have a list of all your entrypoints and their parameters. Furthermore, you can see how many calls each entrypoint has received. -![](/developers/docs/images/tzstats-smart-contract/tzStats_smart_contract_entrypoints.png) +![](/images/tzstats-smart-contract/tzStats_smart_contract_entrypoints.png) ### Contract Code Here you have the Michelson code of your smart contract. -![](/developers/docs/images/tzstats-smart-contract/tzStats_smart_contract_code.png) +![](/images/tzstats-smart-contract/tzStats_smart_contract_code.png) ### Storage Here you have access to the content of your storage with the type of each variable and its current value. Notice that the content excludes big_maps as they are specific tabs for them. -![](/developers/docs/images/tzstats-smart-contract/tzStats_smart_contract_storage.png) +![](/images/tzstats-smart-contract/tzStats_smart_contract_storage.png) ### Big_map Here you have the content of your big_map. -![](/developers/docs/images/tzstats-smart-contract/tzStats_smart_contract_bigmap.png) +![](/images/tzstats-smart-contract/tzStats_smart_contract_bigmap.png) ## API Calls diff --git a/src/pages/tezos-basics/get-started-with-octez/monitor-a-node/index.md b/src/pages/tezos-basics/get-started-with-octez/monitor-a-node/index.md index 715db5e6f..083546ff0 100644 --- a/src/pages/tezos-basics/get-started-with-octez/monitor-a-node/index.md +++ b/src/pages/tezos-basics/get-started-with-octez/monitor-a-node/index.md @@ -202,7 +202,7 @@ This is an example of a Demo Dashboard with the following metrics: - `octez_p2p_peers_running` - `octez_store_last_written_block_size` -![Example of a light monitoring dashboard](/developers/docs/images/monitor-a-node/netdata_dashboard.png) +![Example of a light monitoring dashboard](/images/monitor-a-node/netdata_dashboard.png) ### Monitoring several nodes @@ -304,7 +304,7 @@ To calculate the space needed to store your metrics you will need: For 2000 metrics, collected every second and retained for a month, Tier 0 needs: 1 byte x 2,000 metrics x 3,600 secs per hour x 24 hours per day x 30 days per month = 5,184MB. -![Number of metrics location in the dashboard](/developers/docs/images/monitor-a-node/number-of-metrics.jpeg) +![Number of metrics location in the dashboard](/images/monitor-a-node/number-of-metrics.jpeg) #### Modify netdata.conf file @@ -344,11 +344,11 @@ Now you just have to change the value of "dbengine multihost disk space" in [db] Here is the global picture of a monitoring system, connecting all these tools together: -![](/developers/docs/images/monitor-a-node/all-in-all.png) +![](/images/monitor-a-node/all-in-all.png) A Grafazos dashboard looks like this: -![](/developers/docs/images/monitor-a-node/octez-metrics-dashboard.gif) +![](/images/monitor-a-node/octez-metrics-dashboard.gif) Table 1: Grafana dashboard of a Tezos node @@ -433,7 +433,7 @@ Some metrics are self-explanatory, such as *P2P total connections*, which shows Another useful metric is the *Block validation time*, which measures the time between when a request is registered in the worker till the worker pops the request and marks it complete. This should generally be under 1 second. If it's persistently longer, that could indicate trouble too. -![](/developers/docs/images/monitor-a-node/metrics-block-validation-time.png) +![](/images/monitor-a-node/metrics-block-validation-time.png) Graph 2: Block validation time @@ -442,7 +442,7 @@ The *P2P connections* graph will show you immediately if your node is having tro A healthy node should typically have a few dozen peer connections (depending on how it was configured). -![](/developers/docs/images/monitor-a-node/metrics-p2p-connections.png) +![](/images/monitor-a-node/metrics-p2p-connections.png) Graph 3: P2P connections diff --git a/src/pages/tezos-basics/originate-your-first-smart-contract/ligo/index.md b/src/pages/tezos-basics/originate-your-first-smart-contract/ligo/index.md index 2dd6fcba0..948a340ff 100644 --- a/src/pages/tezos-basics/originate-your-first-smart-contract/ligo/index.md +++ b/src/pages/tezos-basics/originate-your-first-smart-contract/ligo/index.md @@ -178,7 +178,7 @@ Tezos provides a [faucet](https://faucet.ghostnet.teztnets.xyz) to allow you to Let's go ahead and fund our wallet through the [Ghostnet Faucet](https://faucet.ghostnet.teztnets.xyz). Paste the hash you copied earlier into the input field for "Or fund any address" and select the amount you'd like to add to your wallet. -![Fund your wallet using the Ghostnet Faucet](/developers/docs/images/wallet-funding.png) +![Fund your wallet using the Ghostnet Faucet](/images/wallet-funding.png) Wait a minute or two and you can then run the following command to check that your wallet has funds in it: diff --git a/src/pages/tezos-basics/originate-your-first-smart-contract/smartpy/index.md b/src/pages/tezos-basics/originate-your-first-smart-contract/smartpy/index.md index 742feff67..086ce5e7e 100644 --- a/src/pages/tezos-basics/originate-your-first-smart-contract/smartpy/index.md +++ b/src/pages/tezos-basics/originate-your-first-smart-contract/smartpy/index.md @@ -11,7 +11,7 @@ lastUpdated: 30th June 2023 | Dependency | Installation instructions | | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | SmartPy | Follow the _Installation_ steps in this [guide](https://smartpy.dev/docs/manual/introduction/installation). SmartPy requires Docker to run. For MacOS and Linux, it is recommended to install [Docker Desktop](https://www.docker.com/products/docker-desktop/). | -| _octez-client_ CLI | Follow the _How to install the octez-client_ steps [here](/developers/docs/tezos-basics/get-started-with-octez/). | +| _octez-client_ CLI | Follow the _How to install the octez-client_ steps [here](/tezos-basics/get-started-with-octez/). | {% callout type="warning" title="Note" %} Make sure you have **installed** the above CLI tools before getting started. @@ -197,7 +197,7 @@ Tezos provides a [faucet](https://faucet.ghostnet.teztnets.xyz) to allow you to Let's go ahead and fund our wallet through the [Ghostnet Faucet](https://faucet.ghostnet.teztnets.xyz). Paste the hash you copied earlier into the input field for "Or fund any address" and select the amount you'd like to add to your wallet. -![Fund your wallet using the Ghostnet Faucet](/developers/docs/images/wallet-funding.png) +![Fund your wallet using the Ghostnet Faucet](/images/wallet-funding.png) Wait a minute or two and you can then run the following command to check that your wallet has funds in it: @@ -305,7 +305,7 @@ Then paste the contract address (starting with KT1) `KT1Nnk.................UFsJ Then navigate to the `Storage` tab to see your initial value of `Hello`. -![Confirmation that all worked correctly](/developers/docs/images/storage_success.png) +![Confirmation that all worked correctly](/images/storage_success.png) ## Calling the entrypoints diff --git a/src/pages/tezos-blockchain-overview/governance/governance-overview.md b/src/pages/tezos-blockchain-overview/governance/governance-overview.md index f7a165dfe..bd6198173 100644 --- a/src/pages/tezos-blockchain-overview/governance/governance-overview.md +++ b/src/pages/tezos-blockchain-overview/governance/governance-overview.md @@ -95,7 +95,7 @@ In other words, the quorum tries to match the exponential moving average of the #### Flowchart of the Tezos Amendment Process -![tezos_amendment_process](/developers/docs/images/governance-on-chain/tezos_amendment_process.png) +![tezos_amendment_process](/images/governance-on-chain/tezos_amendment_process.png) ## Tezos Client Commands diff --git a/src/pages/tezos-blockchain-overview/skeleton_template.md b/src/pages/tezos-blockchain-overview/skeleton_template.md index 774d5b7c9..e1dd0341e 100644 --- a/src/pages/tezos-blockchain-overview/skeleton_template.md +++ b/src/pages/tezos-blockchain-overview/skeleton_template.md @@ -27,7 +27,7 @@ Any Prerequisites go right after intro * Follow the _Installation_ steps in this [guide](https://smartpy.dev/docs/manual/introduction/installation). SmartPy requires Docker to run. For MacOS and Linux, it is recommended to install [Docker Desktop](https://www.docker.com/products/docker-desktop/). --- * _octez-client_ CLI -* Follow the _How to install the octez-client_ steps [here](/developers/docs/tezos-basics/get-started-with-octez/ +* Follow the _How to install the octez-client_ steps [here](/tezos-basics/get-started-with-octez/ {% /table %} diff --git a/src/pages/tutorials/build-an-nft-marketplace/index.md b/src/pages/tutorials/build-an-nft-marketplace/index.md index 8111de224..be87dde48 100644 --- a/src/pages/tutorials/build-an-nft-marketplace/index.md +++ b/src/pages/tutorials/build-an-nft-marketplace/index.md @@ -735,7 +735,7 @@ const mint = async (newTokenDefinition: TZIP21TokenMetadata) => { }; ``` -![mint form](/developers/docs/images/mintForm.png) +![mint form](/images/mintForm.png) Explanations: @@ -907,7 +907,7 @@ const handleStepChange = (step: number) => { 4. Click on the Mint button -![minting](/developers/docs/images/minting.png) +![minting](/images/minting.png) Your picture will be pushed to IPFS and displayed. @@ -915,10 +915,10 @@ Then, Temple Wallet _(or whatever other wallet you choose)_ will ask you to sign Now you can see all NFTs -![wine collection](/developers/docs/images/winecollection.png) +![wine collection](/images/winecollection.png) ## Conclusion You are able to create an NFT collection marketplace from the `ligo/fa` library. -To continue, let's go to [Part 2](/developers/docs/tutorials/build-an-nft-marketplace/part-2). +To continue, let's go to [Part 2](/tutorials/build-an-nft-marketplace/part-2). diff --git a/src/pages/tutorials/build-an-nft-marketplace/part-2.md b/src/pages/tutorials/build-an-nft-marketplace/part-2.md index ea2684d79..8bddca9a4 100644 --- a/src/pages/tutorials/build-an-nft-marketplace/part-2.md +++ b/src/pages/tutorials/build-an-nft-marketplace/part-2.md @@ -811,7 +811,7 @@ Your picture will be pushed to IPFS and displayed, then your wallet ask you to s 6. Click on the submenu entry -![sell.png](/developers/docs/images/sell.png) +![sell.png](/images/sell.png) You are the owner of this bottle so you can create an offer to sell it. @@ -1056,7 +1056,7 @@ export default function WineCataloguePage() { Now you can see on `Trading` menu the `Wine catalogue` submenu, click on it. -![buy.png](/developers/docs/images/buy.png) +![buy.png](/images/buy.png) As you are connected with the default administrator you can see your own unique offer on the market @@ -1073,4 +1073,4 @@ You created an NFT collection marketplace from the Ligo library, now you can buy In the next lesson, you will see another kind of NFT called `single asset`. Instead of creating *X* token types, you will be allowed to create only 1 token_id 0, on the other side, you can mint a quantity *n* of this token. -To continue, let's go to [Part 3](/developers/docs/tutorials/build-an-nft-marketplace/part-3). +To continue, let's go to [Part 3](/tutorials/build-an-nft-marketplace/part-3). diff --git a/src/pages/tutorials/build-an-nft-marketplace/part-3.md b/src/pages/tutorials/build-an-nft-marketplace/part-3.md index 08cc43150..d1840e873 100644 --- a/src/pages/tutorials/build-an-nft-marketplace/part-3.md +++ b/src/pages/tutorials/build-an-nft-marketplace/part-3.md @@ -1316,14 +1316,14 @@ export default function WineCataloguePage() { 3. Click on `Upload an image` and select a bottle picture on your computer 4. Click on the Mint button -![minting.png](/developers/docs/images/minting_part3.png) +![minting.png](/images/minting_part3.png) Your picture will be pushed to IPFS and displayed, then your wallet will ask you to sign the `mint` operation. - Confirm operation - Wait less than 1 minute to get the confirmation notification, the page will be automatically refreshed. -![minted.png](/developers/docs/images/minted.png) +![minted.png](/images/minted.png) Now you can see the `Trading` menu and the `Bottle offers` sub menu @@ -1336,7 +1336,7 @@ You are the owner of this bottle so you can make an offer on it - Click on the `SELL` button - Wait a bit for the confirmation, then once automatically refreshed you have an offer attached to your NFT -![offer.png](/developers/docs/images/offer.png) +![offer.png](/images/offer.png) For buying, @@ -1347,7 +1347,7 @@ For buying, - Click on `bottle offers` sub menu - You are now the owner of some bottles, you can resell a part of it at your own price, etc ... -![buy.png](/developers/docs/images/buy_part3.png) +![buy.png](/images/buy_part3.png) ## Conclusion @@ -1355,4 +1355,4 @@ You are now able to play with a unique NFT collection from the Ligo library. In the next lesson, you will use the last template `multi-asset` that will allow multiple NFT collections on the same contract -To continue, let's go to [Part 4](/developers/docs/tutorials/build-an-nft-marketplace/part-4) +To continue, let's go to [Part 4](/tutorials/build-an-nft-marketplace/part-4) diff --git a/src/pages/tutorials/build-an-nft-marketplace/part-4.md b/src/pages/tutorials/build-an-nft-marketplace/part-4.md index efa30d3b5..bf254f935 100644 --- a/src/pages/tutorials/build-an-nft-marketplace/part-4.md +++ b/src/pages/tutorials/build-an-nft-marketplace/part-4.md @@ -1452,14 +1452,14 @@ export default function WineCataloguePage() { 3. Click on `Upload an image` and select a bottle picture on your computer 4. Click on the Mint button -![minting_part4.png](/developers/docs/images/minting_part4.png) +![minting_part4.png](/images/minting_part4.png) Your picture will be pushed to IPFS and will be displayed, then your wallet will ask you to sign the `mint` operation. - Confirm operation - Wait less than 1 minute to get the confirmation notification, the page will be automatically refreshed -![minted_part4.png](/developers/docs/images/minted_part4.png) +![minted_part4.png](/images/minted_part4.png) Now you can see the `Trading` menu and the `Bottle offers` sub-menu @@ -1472,7 +1472,7 @@ You are the owner of this bottle so you can create an offer on it - Click on `SELL` button - Wait a bit for the confirmation, then once automatically refreshed you have an offer attached to your NFT! -![sell_part4.png](/developers/docs/images/sell_part4.png) +![sell_part4.png](/images/sell_part4.png) For buying, @@ -1483,7 +1483,7 @@ For buying, - Click on the `bottle offers` submenu - You are now the owner of some bottles, you can resell a part of it at your own price, etc ... -![buy_part4.png](/developers/docs/images/buy_part4.png) +![buy_part4.png](/images/buy_part4.png) To add more collections, go to the Mint page and repeat the process. diff --git a/src/pages/tutorials/build-your-first-app/adding-removing-liquidity.md b/src/pages/tutorials/build-your-first-app/adding-removing-liquidity.md index 28068e109..8527b3e62 100644 --- a/src/pages/tutorials/build-your-first-app/adding-removing-liquidity.md +++ b/src/pages/tutorials/build-your-first-app/adding-removing-liquidity.md @@ -15,7 +15,7 @@ First, let's understand what we are doing here: the LB DEX gives you the ability The interface here is going to look a lot like the interface for swapping, with some key differences: -![AddLiquidity UI](/developers/docs/images/build-your-first-app/add-liquidity-ui.png "Add liquidity UI") +![AddLiquidity UI](/images/build-your-first-app/add-liquidity-ui.png "Add liquidity UI") Like before, we have 2 input fields, but this time, there is no middle button to switch between the 2 tokens and both inputs are editable. @@ -356,7 +356,7 @@ And that's it! Your users now have the ability to add liquidity to the Liquidity Removing liquidity from the Liquidity Baking contract is arguably the easiest of all the tasks accomplished by our interface. The interface only needs one input to receive the amount of SIRS that the user wants to unwrap to get XTZ and tzBTC. -![RemoveLiquidity UI](/developers/docs/images/build-your-first-app/remove-liquidity-ui.png "Remove liquidity UI") +![RemoveLiquidity UI](/images/build-your-first-app/remove-liquidity-ui.png "Remove liquidity UI") The app will then calculate the corresponding amount of XTZ and tzBTC expected to be received for the amount of SIRS in the input field. diff --git a/src/pages/tutorials/build-your-first-app/swapping-tokens.md b/src/pages/tutorials/build-your-first-app/swapping-tokens.md index 9493bebd6..a2070f7ef 100644 --- a/src/pages/tutorials/build-your-first-app/swapping-tokens.md +++ b/src/pages/tutorials/build-your-first-app/swapping-tokens.md @@ -15,7 +15,7 @@ I say "the most complex" because the interface you are about to build includes a Here is a screenshot of the UI you are aiming for: -![Swap UI](/developers/docs/images/build-your-first-app/swap-ui.png "Swap UI") +![Swap UI](/images/build-your-first-app/swap-ui.png "Swap UI") There are 2 text inputs, the one on the left is editable and will let the user input the amount of XTZ or tzBTC they want to exchange and the one on the right will be disabled and will display the corresponding amount they'll get in the other token. The button in the middle with the 2 arrows will allow the user to switch the input between XTZ and tzBTC. diff --git a/src/pages/tutorials/originate-your-first-smart-contract/ligo/index.md b/src/pages/tutorials/originate-your-first-smart-contract/ligo/index.md index fc368ba60..4c5488532 100644 --- a/src/pages/tutorials/originate-your-first-smart-contract/ligo/index.md +++ b/src/pages/tutorials/originate-your-first-smart-contract/ligo/index.md @@ -8,7 +8,7 @@ lastUpdated: 7th July 2023 --- {% callout type="note" title="Want to use SmartPy?" %} -Click [here](/developers/docs/tutorials/originate-your-first-smart-contract/smartpy) to find out how to originate your first smart contract using SmartPy. +Click [here](/tutorials/originate-your-first-smart-contract/smartpy) to find out how to originate your first smart contract using SmartPy. {% /callout %} ## Prerequisites @@ -184,7 +184,7 @@ Tezos provides a [faucet](https://faucet.ghostnet.teztnets.xyz) to allow you to Let's go ahead and fund our wallet through the [Ghostnet Faucet](https://faucet.ghostnet.teztnets.xyz). Paste the hash you copied earlier into the input field for "Or fund any address" and select the amount you'd like to add to your wallet. -![Fund your wallet using the Ghostnet Faucet](/developers/docs/images/wallet-funding.png) +![Fund your wallet using the Ghostnet Faucet](/images/wallet-funding.png) Wait a minute or two and you can then run the following command to check that your wallet has funds in it: diff --git a/src/pages/tutorials/originate-your-first-smart-contract/smartpy/index.md b/src/pages/tutorials/originate-your-first-smart-contract/smartpy/index.md index bfa85a61c..37bbb615d 100644 --- a/src/pages/tutorials/originate-your-first-smart-contract/smartpy/index.md +++ b/src/pages/tutorials/originate-your-first-smart-contract/smartpy/index.md @@ -7,7 +7,7 @@ lastUpdated: 7th July 2023 --- {% callout type="note" title="Want to use LIGO?" %} -Click [here](/developers/docs/tutorials/originate-your-first-smart-contract/ligo) to find out how to originate your first smart contract using LIGO. +Click [here](/tutorials/originate-your-first-smart-contract/ligo) to find out how to originate your first smart contract using LIGO. {% /callout %} ## Prerequisites @@ -15,7 +15,7 @@ Click [here](/developers/docs/tutorials/originate-your-first-smart-contract/ligo | Dependency | Installation instructions | | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | SmartPy | Follow the _Installation_ steps in this [guide](https://smartpy.dev/docs/manual/introduction/installation). SmartPy requires Docker to run. For MacOS and Linux, it is recommended to install [Docker Desktop](https://www.docker.com/products/docker-desktop/). | -| _octez-client_ CLI | Follow the _How to install the octez-client_ steps [here](/developers/docs/tezos-basics/get-started-with-octez/). | +| _octez-client_ CLI | Follow the _How to install the octez-client_ steps [here](/tezos-basics/get-started-with-octez/). | {% callout type="warning" title="Note" %} Make sure you have **installed** the above CLI tools before getting started. @@ -201,7 +201,7 @@ Tezos provides a [faucet](https://faucet.ghostnet.teztnets.xyz) to allow you to Let's go ahead and fund our wallet through the [Ghostnet Faucet](https://faucet.ghostnet.teztnets.xyz). Paste the hash you copied earlier into the input field for "Or fund any address" and select the amount you'd like to add to your wallet. -![Fund your wallet using the Ghostnet Faucet](/developers/docs/images/wallet-funding.png) +![Fund your wallet using the Ghostnet Faucet](/images/wallet-funding.png) Wait a minute or two and you can then run the following command to check that your wallet has funds in it: @@ -309,7 +309,7 @@ Then paste the contract address (starting with KT1) `KT1Nnk.................UFsJ Then navigate to the `Storage` tab to see your initial value of `Hello`. -![Confirmation that all worked correctly](/developers/docs/images/storage_success.png) +![Confirmation that all worked correctly](/images/storage_success.png) ## Calling the entrypoints diff --git a/src/styles/fonts.css b/src/styles/fonts.css index 1c591771b..9bf82fbc6 100644 --- a/src/styles/fonts.css +++ b/src/styles/fonts.css @@ -3,7 +3,7 @@ font-style: normal; font-weight: 100 900; font-display: swap; - src: url('/developers/docs/fonts/GT-Eesti-Display-Regular.woff') format('woff'); + src: url('/fonts/GT-Eesti-Display-Regular.woff') format('woff'); } @font-face { font-family: 'Inter'; @@ -11,7 +11,7 @@ font-display: block; font-style: normal; font-named-instance: 'Regular'; - src: url('/developers/docs/fonts/Inter-roman.var.woff2') format('woff2'); + src: url('/fonts/Inter-roman.var.woff2') format('woff2'); } @font-face { font-family: 'Inter'; @@ -19,7 +19,7 @@ font-display: block; font-style: italic; font-named-instance: 'Italic'; - src: url('/developers/docs/fonts/Inter-italic.var.woff2') format('woff2'); + src: url('/fonts/Inter-italic.var.woff2') format('woff2'); } .text-gradient { From d8b76ed08a8b6d5d9a52a7b69fab2216ffb202a9 Mon Sep 17 00:00:00 2001 From: John Joubert Date: Fri, 14 Jul 2023 15:31:08 +0100 Subject: [PATCH 2/2] Update .env.example --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 6abcceb6e..fad15db8a 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -NEXT_PUBLIC_BASE_PATH=/ +NEXT_PUBLIC_BASE_PATH='' NEXT_PUBLIC_DOCSEARCH_APP_ID=R2IYF7ETH7 NEXT_PUBLIC_DOCSEARCH_API_KEY=599cec31baffa4868cae4e79f180729b NEXT_PUBLIC_DOCSEARCH_INDEX_NAME=docsearch