Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nialexsan/remove cadence #438

Merged
merged 14 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,3 @@ docs/references/core-contracts/flow-nft/*
!docs/references/core-contracts/flow-nft/index.md

docs/.obsidian

# Remove after cadence is updated to a stable version
# https://github.com/onflow/docs/issues/105
versioned_docs/version-stable/architecture
versioned_docs/version-stable/building-on-flow
versioned_docs/version-stable/build
versioned_docs/version-stable/overview
versioned_docs/version-stable/community-resources
versioned_docs/version-stable/concepts
versioned_docs/version-stable/references
versioned_docs/version-stable/tools
versioned_docs/version-stable/guides
versioned_docs/version-stable/node-ops
versioned_docs/version-stable/tutorials
versioned_docs/version-stable/getting-started
3 changes: 0 additions & 3 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
/docs/cadence @onflow/cadence
/versioned_docs/*/cadence @onflow/cadence

Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ signed transaction.
</Callout>

Very simply, account linking is a [feature in Cadence](https://github.com/onflow/flips/pull/53) that let's an
[AuthAccount](../../../cadence/language/accounts#authaccount) create a
[Capability](../../../cadence/language/capabilities.md) on itself. You can do so in the following
[AuthAccount](https://cadence-lang.org/docs/language/accounts#authaccount) create a
[Capability](https://cadence-lang.org/docs/language/capabilities) on itself. You can do so in the following
transaction:

```cadence link_account.cdc
Expand Down Expand Up @@ -210,7 +210,7 @@ delegated access.

We can achieve issuance from the child account and claim from the parent account pattern in either:

1. We can leverage [Cadence’s `AuthAccount.Inbox`](../../../cadence/language/accounts#account-inbox) to publish the
1. We can leverage [Cadence’s `AuthAccount.Inbox`](https://cadence-lang.org/docs/language/accounts#account-inbox) to publish the
Capability from the child account & have the parent claim the Capability in a separate transaction.
1. Multi-party signed transaction, signed by both the the accounts on either side of the link

Expand Down
2 changes: 1 addition & 1 deletion docs/build/advanced-concepts/account-linking/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Accounts on flow can be accessed in Cadence through two types, `PublicAccount` a

Accessing the auth account allows for account modification, so it's essential to safeguard this access by mandating that transactions are signed by the account being accessed. A transaction can list multiple auth accounts it wants to access as part of the `pre` section of the transaction. Read more about transaction signing in the transaction documentation.

Since access to the `AuthAccount` object enables state change, the idea of account ownership actually translates to the ability to access the auth account. Traditionally, you might consider this the same as having key access on an account, but we'll see in just a minute how programmatic, ownership-level access is unlocked with [Capabilities on Flow](../../../cadence/language/capabilities.md).
Since access to the `AuthAccount` object enables state change, the idea of account ownership actually translates to the ability to access the auth account. Traditionally, you might consider this the same as having key access on an account, but we'll see in just a minute how programmatic, ownership-level access is unlocked with [Capabilities on Flow](https://cadence-lang.org/docs/language/capabilities).

## AuthAccount Capabilities

Expand Down
6 changes: 3 additions & 3 deletions docs/build/basics/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This minimum storage fee is provided by the account creator and covers the cost

**Contracts**

An account can optionally store multiple [Cadence contracts](../../cadence/language/contracts.mdx). The code is stored as a human-readable UTF-8 encoded string which makes it easy for anyone to inspect the contents.
An account can optionally store multiple [Cadence contracts](https://cadence-lang.org/docs/language/contracts). The code is stored as a human-readable UTF-8 encoded string which makes it easy for anyone to inspect the contents.

**Storage**

Expand Down Expand Up @@ -80,7 +80,7 @@ There are two curves commonly used with the ECDSA algorithm, secp256r1 ([OID 1.2
| ECDSA | P-256 | ECDSA_P256 | 2 |
| ECDSA | secp256k1 | ECDSA_secp256k1 | 3 |

*Please note that the codes listed here are for the signature algorithms as used by the node API, and they are different from the ones [defined in Cadence](../../cadence/language/crypto.mdx#signing-algorithms)*
*Please note that the codes listed here are for the signature algorithms as used by the node API, and they are different from the ones [defined in Cadence](https://cadence-lang.org/docs/language/crypto#signing-algorithms)*

| Algorithm | Output Size | ID | Code |
| --------- | ----------- | -------- | ---- |
Expand Down Expand Up @@ -128,7 +128,7 @@ We are supporting ECDSA with the curves `P-256` and `secp256k1`. For these curve

## Account Creation

Accounts are created on the Flow blockchain by calling a special [create account Cadence function](../../cadence/language/accounts#account-creation). Once an account is created we can associate a new key with that account. Of course, all that can be done within a single transaction. Keep in mind that there is an account creation fee that needs to be paid. Account creation fees are relatively low, and we expect that wallet providers and exchanges will cover the cost when a user converts fiat to crypto for the first time.
Accounts are created on the Flow blockchain by calling a special [create account Cadence function](https://cadence-lang.org/docs/language/accounts#account-creation). Once an account is created we can associate a new key with that account. Of course, all that can be done within a single transaction. Keep in mind that there is an account creation fee that needs to be paid. Account creation fees are relatively low, and we expect that wallet providers and exchanges will cover the cost when a user converts fiat to crypto for the first time.

For development purposes, [you can use Flow CLI to easily create emulator, testnet and mainnet accounts.](../../tools/flow-cli/accounts/create-accounts.md) The account creation fee is paid by a funding wallet so you don’t need a pre-existing account to create it.

Expand Down
2 changes: 1 addition & 1 deletion docs/build/basics/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The Block header contains the following fields:
- **ID** represents the block's unique identifier, which is derived from the hashing block header including the payload hash. The algorithm used on Flow to hash the content and get an identifier is SHA3 256. This ID is a commitment to all the values in the block staying the same.
- **Parent ID** is a link to the previous block ID in the list making up the blockchain.
- **Height** is the block sequence number, where block 0 was the first block produced, and each next block increments the value by 1.
- **Timestamp** is the timestamp at which this block was proposed by the consensus node. Depending on your use case this time might not be accurate enough, [read more about measuring time on the Flow blockchain](../../cadence/measuring-time.mdx#time-on-the-flow-blockchain).
- **Timestamp** is the timestamp at which this block was proposed by the consensus node. Depending on your use case this time might not be accurate enough, [read more about measuring time on the Flow blockchain](https://cadence-lang.org/docs/measuring-time#time-on-the-flow-blockchain).
- **Payload Hash** represents the payload hash that is included when producing the ID of the block. Payload hash is calculated by taking Merkle root hashes of collection guarantees, seals, execution receipts, and execution results and hashing them together. More on each of the values in the block payload section.

### Block Payload
Expand Down
4 changes: 2 additions & 2 deletions docs/build/basics/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 6

Flow events are special values that are emitted on the network during the execution of a Cadence program and can be observed by off-chain observers.

Events are defined as Cadence code and you should [read Cadence documentation](../../cadence/language/events.md) to understand how to define them.
Events are defined as Cadence code and you should [read Cadence documentation](https://cadence-lang.org/docs/language/events) to understand how to define them.

Since transactions don’t have return values you can leverage events to broadcast certain changes the transaction caused. Clients listening on Flow networks (apps) can listen to these events being emitted and react.

Expand Down Expand Up @@ -39,7 +39,7 @@ A list of events that are emitted by the Flow network is:
| flow.InboxValueUnpublished | Event that is emitted when a Capability is unpublished from an account. |
| flow.InboxValueClaimed1 | Event that is emitted when a Capability is claimed by an account. |

For more details [on the core events, you can read Cadence reference documentation](../../cadence/language/core-events.md).
For more details [on the core events, you can read Cadence reference documentation](https://cadence-lang.org/docs/language/core-events).

## User-defined events

Expand Down
2 changes: 1 addition & 1 deletion docs/build/basics/fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ pub fun add(_ a: Int, _ b: Int): Int {

**Avoid excessive load and save operations**

Avoid costly loading and storage operations and [borrow references](../../cadence/design-patterns.md#avoid-excessive-load-and-save-storage-operations-prefer-in-place-mutations) where possible, for example:
Avoid costly loading and storage operations and [borrow references](https://cadence-lang.org/docs/design-patterns#avoid-excessive-load-and-save-storage-operations-prefer-in-place-mutations) where possible, for example:

```cadence
transaction {
Expand Down
6 changes: 3 additions & 3 deletions docs/build/basics/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ In order for a transaction to be valid and executed it must contain signatures f

The script section contains instructions for transaction execution. This is a Cadence program in source code form (human-readable), and encoded as UTF-8. The transaction program must contain a `transaction` declaration.

A transaction includes multiple optional phases `prepare`, `pre`, `execute`, and `post` phase. You can read more about it in the [Cadence reference document on transactions](../../cadence/language/transactions.md). Each phase has a purpose, the two most important phases are `prepare` and `execute`.
A transaction includes multiple optional phases `prepare`, `pre`, `execute`, and `post` phase. You can read more about it in the [Cadence reference document on transactions](https://cadence-lang.org/docs/language/transactions). Each phase has a purpose, the two most important phases are `prepare` and `execute`.

In the `prepare` phase, we have access to `AuthAccount` objects, which gives us the power to interact with those accounts. The accounts are called authorizers of transactions, so each account we want to interact with in the `prepare` phase must sign the transaction as an authorizer.
The `execute` phase does exactly what it says, it executes the main logic of the transaction. This phase is optional, but it is a best practice to add your main transaction logic in the section, so it is explicit.

Again make sure to read Cadence [documentation on transactions](../../cadence/language/transactions.md)
Again make sure to read Cadence [documentation on transactions](https://cadence-lang.org/docs/language/transactions)

This is an example of a transaction script:

Expand All @@ -40,7 +40,7 @@ transaction(greeting: String) {

**Arguments**

Transactions may declare parameters it needs during execution, these must be provided as input arguments when sending a transaction. You can think of them as function arguments. Currently, we provide [arguments in the JSON-Cadence Data Interchange Format](../../cadence/json-cadence-spec.md#docusaurus_skipToContent_fallback). Which is a human-readable JSON format. The sample script from above accepts a single `String` argument.
Transactions may declare parameters it needs during execution, these must be provided as input arguments when sending a transaction. You can think of them as function arguments. Currently, we provide [arguments in the JSON-Cadence Data Interchange Format](https://cadence-lang.org/docs/json-cadence-spec#docusaurus_skipToContent_fallback). Which is a human-readable JSON format. The sample script from above accepts a single `String` argument.

**Reference Block**

Expand Down
18 changes: 9 additions & 9 deletions docs/build/building-vs-other-chains.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Check out the [Accounts](./basics/accounts.md) concept document to learn more ab

On Flow, smart contracts are written in Cadence. Cadence syntax is user-friendly and inspired by modern languages like Swift. Notable features of Cadence that make it unique and the key power of the Flow blockchain are:

- **Resource-oriented**: Cadence introduces a new type called Resources. Resources enable onchain representation of digital assets natively and securely. Resources can only exist in one location at a time and are strictly controlled by the execution environment to avoid common mishandling mistakes. Each resource has a unique `uuid` associated with it on the blockchain. Examples of usage are fungible tokens, NFTs, or any custom data structure representing a real-world asset. Check out [Resources](../cadence/language/resources.mdx) to learn more.
- **Capability-based**: Cadence offers a [Capability-based Security](https://en.wikipedia.org/wiki/Capability-based_security) model. This also enables the use of Resources as structures to build access control. Capabilities can provide fine-grained access to the underlying objects for better security. For example, when users list an NFT on a Flow marketplace, they create a new Capability to the stored NFT in their account so the buyer can withdraw the asset when they provide the tokens. Check out [Capability-based Access Control](../cadence/language/capabilities.md) to learn more about Capabilities on Cadence.
- **Resource-oriented**: Cadence introduces a new type called Resources. Resources enable onchain representation of digital assets natively and securely. Resources can only exist in one location at a time and are strictly controlled by the execution environment to avoid common mishandling mistakes. Each resource has a unique `uuid` associated with it on the blockchain. Examples of usage are fungible tokens, NFTs, or any custom data structure representing a real-world asset. Check out [Resources](https://cadence-lang.org/docs/language/resources) to learn more.
- **Capability-based**: Cadence offers a [Capability-based Security](https://en.wikipedia.org/wiki/Capability-based_security) model. This also enables the use of Resources as structures to build access control. Capabilities can provide fine-grained access to the underlying objects for better security. For example, when users list an NFT on a Flow marketplace, they create a new Capability to the stored NFT in their account so the buyer can withdraw the asset when they provide the tokens. Check out [Capability-based Access Control](https://cadence-lang.org/docs/language/capabilities) to learn more about Capabilities on Cadence.

<Callout type="info">

Expand All @@ -52,16 +52,16 @@ Check out the [Cadence website](https://cadencelang.dev/) to learn more about Ca

If you’re already familiar with smart contracts, here are some resources that can help you get started with Cadence:

- [The Cadence tutorial](../cadence/tutorial/01-first-steps.md)
- [Guide for Solidity Developers](../cadence/solidity-to-cadence.md)
- [The Cadence tutorial](https://cadence-lang.org/docs/tutorial/first-steps)
- [Guide for Solidity Developers](https://cadence-lang.org/docs/solidity-to-cadence)
- ERC-20 equivalent on Flow is the Flow Fungible Token Standard
- [Repository](https://github.com/onflow/flow-ft)
- [Tutorial](../cadence/tutorial/06-fungible-tokens.md)
- [Tutorial](https://cadence-lang.org/docs/tutorial/fungible-tokens)
- ERC-721 equivalent on Flow is the Flow Non-Fungible Token Standard
- [Repository](https://github.com/onflow/flow-nft)
- [Tutorial](../cadence/tutorial/05-non-fungible-tokens-1.md)
- [Tutorial](https://cadence-lang.org/docs/tutorial/non-fungible-tokens-1)
- Asset marketplaces with Cadence
- [Tutorial](../cadence/tutorial/07-marketplace-setup.md)
- [Tutorial](https://cadence-lang.org/docs/tutorial/marketplace-setup)
- [NFT Storefront](https://github.com/onflow/nft-storefront/) is an example marketplace standard

### Transactions and Scripts
Expand Down Expand Up @@ -147,7 +147,7 @@ pub fun main(address: Address, collectionPublicPath: PublicPath): [UInt64] {
}
```

Check out [Transactions](./basics/transactions.md) and [Scripts](./basics/scripts.md) to learn more about the concepts. You can also read the Cadence language reference on [Transactions](../cadence/language/transactions.md) to dive deeper.
Check out [Transactions](./basics/transactions.md) and [Scripts](./basics/scripts.md) to learn more about the concepts. You can also read the Cadence language reference on [Transactions](https://cadence-lang.org/docs/language/transactions) to dive deeper.

## Flow Nodes

Expand Down Expand Up @@ -188,6 +188,6 @@ If you’re already familiar with blockchain development, here's a comparison be
- [Flow Playground](https://play.flow.com/) provides basic experimentation on the web
- [Cadence VSCode Extension](https://marketplace.visualstudio.com/items?itemName=onflow.cadence) is strongly suggested to install for local development
- [Testing Smart Contracts](https://ethereum.org/en/developers/docs/smart-contracts/testing/)
- [Cadence testing framework](../cadence/testing-framework.mdx) enables native tests in Cadence.
- [Cadence testing framework](https://cadence-lang.org/docs/testing-framework) enables native tests in Cadence.
- [overflow](https://github.com/bjartek/overflow) for testing in Go.
- [js-testing](https://github.com/onflow/flow-js-testing) for testing in JS.
4 changes: 2 additions & 2 deletions docs/build/cadence.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Developers using custom-made approaches such as the 'data separation' approach t
may run into problems with the complexity of data structures,
while developers using ‘delegatecall-based proxies` may run into problems with the consistency of memory layouts.
Either way, these challenges compromise approachability and overall extensibility.
Cadence has [contract upgradability built in by default](../cadence/language/contract-updatability.md),
Cadence has [contract upgradability built in by default](https://cadence-lang.org/docs/language/contract-updatability),
and contracts can be made immutable by removing all keys from an account.

Cadence improves the clarity and extensibility of programs by utilizing interfaces to allow extensibility, code reuse, and interoperability between contracts.
Expand Down Expand Up @@ -187,7 +187,7 @@ but using an interpreter for the first version allows us to refine the language
---

Now that you've learned about the goals and design of Cadence and Flow, you're ready to get started with the Flow emulator and tools!
Go to the [Getting Started](../cadence/tutorial/01-first-steps.md) page to work through language fundamentals and tutorials.
Go to the [Getting Started](https://cadence-lang.org/docs/tutorial/first-steps) page to work through language fundamentals and tutorials.

## Why Cadence?

Expand Down
2 changes: 1 addition & 1 deletion docs/build/flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The [development guide](../tutorials/intro.md) covers the Flow core concepts, in

## Core Contracts

The Flow blockchain implements core functionality using its own smart contract language, [Cadence](../cadence/language/). The core functionality is split into a set of contracts, so-called [core contracts](../references/core-contracts/index.md):
The Flow blockchain implements core functionality using its own smart contract language, [Cadence](https://cadence-lang.org/docs/language/). The core functionality is split into a set of contracts, so-called [core contracts](../references/core-contracts/index.md):

- **Fungible Token:** The FungibleToken contract implements the Fungible Token Standard. It is the second contract ever deployed on Flow.
- **Flow Token:** The FlowToken contract defines the FLOW network token.
Expand Down
Loading