Skip to content
Open
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
2 changes: 1 addition & 1 deletion docs/learn/tutorials/cross-calls/cross-calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ pub fn get_addresses(&self) -> Vec<AccountId> {
}
```

Same in `MainContract`. We will have `get_addesses_call`, `flip_delegate`, `get_delegate` and `get_addresses_delegate`.
Same in `MainContract`. We will have `get_addresses_call`, `flip_delegate`, `get_delegate` and `get_addresses_delegate`.

Filename:
main_contract/
Expand Down
2 changes: 1 addition & 1 deletion docs/learn/tutorials/dex/factory/create-pair.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ If you are starting the tutorial from here, please check out this [branch](https

We will implement the [createPair](https://github.com/Uniswap/v2-core/blob/ee547b17853e71ed4e0101ccfd52e70d5acded58/contracts/UniswapV2Factory.sol#L23) function of the Factory contract.
In the *./logics/traits/factory.rs* file, add the **create_pair** function to the Factory trait, as well as the internal child function **_instantiate_pair** that will need to be implemented in the contract crate.
The reason why we need an internal **_instantiate_pair** function here is because the instantiate builder is not part of the `#[openbrush::wrapper]`, so we will need to use the one from ink! by importing the Pair contract as an `ink-as-dependancy`.
The reason why we need an internal **_instantiate_pair** function here is because the instantiate builder is not part of the `#[openbrush::wrapper]`, so we will need to use the one from ink! by importing the Pair contract as an `ink-as-dependency`.
The **create_pair** message function returns the address of the instantiated Pair contract.
The function that emits a create_pair event will also have to be implemented in the contract:
```rust
Expand Down
2 changes: 1 addition & 1 deletion docs/learn/tutorials/dex/pair/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub trait Pair {
}
```

Openbrush provides `#[openbrush::trait_definition]` that will make sure your trait (and its default implementation) will be generated in the contract. Also, you can create a wrapper around this trait so it can be used for cross-contract calls (so no need to import the contract as ink-as-dependancy). Import what is needed from Openbrush:
Openbrush provides `#[openbrush::trait_definition]` that will make sure your trait (and its default implementation) will be generated in the contract. Also, you can create a wrapper around this trait so it can be used for cross-contract calls (so no need to import the contract as ink-as-dependency). Import what is needed from Openbrush:

```rust
use openbrush::traits::{
Expand Down
2 changes: 1 addition & 1 deletion docs/learn/tutorials/dex/structure/file-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Therefore, the only solution, in ink!, is to implement an omnibus contract with

In order to organise the business logic into different files, OpenBrush uses [specialization](https://github.com/rust-lang/rfcs/pull/1210) that permits multiple `impl` blocks to be applied to the same type.
With OpenBrush, you can define as many Trait and generic implementations as are needed, which allows you to split up your code to more easily implement it into your contract. Of course, specialization also allows you to override a default implementation (if the method or impl is specialized with the [`default`](https://github.com/rust-lang/rfcs/blob/master/text/1210-impl-specialization.md#the-default-keyword) keyword).
So you define a Trait and a generic implementation in a crate and within the contract you implement this Trait. If this impl block is empty `{}` specialization will implement the most specific implementation, which is the one you defined in the file. Every generic implementation in Openbrush (PSP22, PSP34, ..) uses the `default` keyword that makes these functions *overrideable*.
So you define a Trait and a generic implementation in a crate and within the contract you implement this Trait. If this impl block is empty `{}` specialization will implement the most specific implementation, which is the one you defined in the file. Every generic implementation in Openbrush (PSP22, PSP34, ..) uses the `default` keyword that makes these functions *overridable*.

Define your Trait in a file:

Expand Down