Skip to content
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
6 changes: 3 additions & 3 deletions docusaurus/docs/backends/03-casper.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ graph TD;
[deploy]: https://docs.rs/casper-execution-engine/latest/casper_execution_engine/core/engine_state/deploy_item/struct.DeployItem.html
[Casper Event Standard]: https://github.com/make-software/casper-event-standard
[Casper's 'Writing On-Chain Code']: https://docs.casper.network/writing-contracts/
[proxy_caller.wasm]: https://github.com/odradev/odra/blob/release/2.6.0/odra-casper/test-vm/resources/proxy_caller.wasm
[proxy_caller.wasm]: https://github.com/odradev/odra/blob/release/2.8.0/odra-casper/test-vm/resources/proxy_caller.wasm
[CasperPackageHash]: https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html
[RuntimeArgs]: https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html
[Bytes]: https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html
[ERC721]: https://github.com/odradev/odra/blob/release/2.6.0/modules/src/erc721_token.rs
[ERC1155]: https://github.com/odradev/odra/blob/release/2.6.0/modules/src/erc1155_token.rs
[ERC721]: https://github.com/odradev/odra/blob/release/2.8.0/modules/src/erc721_token.rs
[ERC1155]: https://github.com/odradev/odra/blob/release/2.8.0/modules/src/erc1155_token.rs
[Tutorial section]: ../tutorials/using-proxy-caller
4 changes: 2 additions & 2 deletions docusaurus/docs/backends/04-livenet.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,5 @@ ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=

To sum up - this command will firstly load the `integration.env` file and then load the missing values from `.env` file.

[.env.sample]: https://github.com/odradev/odra/blob/release/2.6.0/examples/.env.sample
[erc20_on_livenet.rs]: https://github.com/odradev/odra/blob/release/2.6.0/examples/bin/erc20_on_livenet.rs
[.env.sample]: https://github.com/odradev/odra/blob/release/2.8.0/examples/.env.sample
[erc20_on_livenet.rs]: https://github.com/odradev/odra/blob/release/2.8.0/examples/bin/erc20_on_livenet.rs
6 changes: 3 additions & 3 deletions docusaurus/docs/basics/02-directory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ version = "0.1.0"
edition = "2021"

[dependencies]
odra = "2.6.0"
odra = "2.8.0"

[dev-dependencies]
odra-test = "2.6.0"
odra-test = "2.8.0"

[build-dependencies]
odra-build = "2.6.0"
odra-build = "2.8.0"

[[bin]]
name = "sample_build_contract"
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/basics/04-flipper-internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@ The contract will be deployed on the VM you chose while running `cargo odra test
## What's next
Now let's take a look at the different types of storage that Odra provides and how to use them.

[`Deployer::deploy`]: https://docs.rs/odra/2.6.0/odra/host/trait.Deployer.html#tymethod.deploy
[`InitArgs`]: https://docs.rs/odra/2.6.0/odra/host/trait.InitArgs.html
[`Deployer::deploy`]: https://docs.rs/odra/2.8.0/odra/host/trait.Deployer.html#tymethod.deploy
[`InitArgs`]: https://docs.rs/odra/2.8.0/odra/host/trait.InitArgs.html
4 changes: 2 additions & 2 deletions docusaurus/docs/basics/06-communicating-with-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ You will learn more functions that Odra exposes from host and types it uses in f
In the next article, we'll dive into testing your contracts with Odra, so you can check that the code
we presented in fact works!

[`Module::env()`]: https://docs.rs/odra/2.6.0/odra/module/trait.Module.html#tymehtod.env
[`ContractEnv`]: https://docs.rs/odra/2.6.0/odra/struct.ContractEnv.html
[`Module::env()`]: https://docs.rs/odra/2.8.0/odra/module/trait.Module.html#tymehtod.env
[`ContractEnv`]: https://docs.rs/odra/2.8.0/odra/struct.ContractEnv.html
[`Backend section`]: ../backends/01-what-is-a-backend.md#contract-env
8 changes: 4 additions & 4 deletions docusaurus/docs/basics/07-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Full list of functions can be found in the [`HostEnv`] documentation.
## What's next
We take a look at how Odra handles errors!

[`HostRef`]: https://docs.rs/odra/2.6.0/odra/host/trait.HostRef.html
[`InitArgs`]: https://docs.rs/odra/2.6.0/odra/host/trait.InitArgs.html
[`HostEnv`]: https://docs.rs/odra/2.6.0/odra/host/struct.HostEnv.html
[`Deployer`]: https://docs.rs/odra/2.6.0/odra/host/trait.Deployer.html
[`HostRef`]: https://docs.rs/odra/2.8.0/odra/host/trait.HostRef.html
[`InitArgs`]: https://docs.rs/odra/2.8.0/odra/host/trait.InitArgs.html
[`HostEnv`]: https://docs.rs/odra/2.8.0/odra/host/struct.HostEnv.html
[`Deployer`]: https://docs.rs/odra/2.8.0/odra/host/trait.Deployer.html
4 changes: 2 additions & 2 deletions docusaurus/docs/basics/08-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@ we need to convert our custom error to `OdraError` using `Into::into()`.
## What's next
We will learn how to emit and test events using Odra.

[`OdraResult`]: https://docs.rs/odra/2.6.0/odra/type.OdraResult.html
[`OdraError`]: https://docs.rs/odra/2.6.0/odra/enum.OdraError.html
[`OdraResult`]: https://docs.rs/odra/2.8.0/odra/type.OdraResult.html
[`OdraError`]: https://docs.rs/odra/2.8.0/odra/enum.OdraError.html
[`schema`]: ./casper-contract-schema
2 changes: 1 addition & 1 deletion docusaurus/docs/basics/09-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ To explore more event testing functions, check the [`HostEnv`] documentation.
## What's next
Read the next article to learn how to call other contracts from the contract context.

[`HostEnv`]: https://docs.rs/odra/2.6.0/odra/host/struct.HostEnv.html
[`HostEnv`]: https://docs.rs/odra/2.8.0/odra/host/struct.HostEnv.html
[`schema`]: ./casper-contract-schema
2 changes: 1 addition & 1 deletion docusaurus/docs/basics/11-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ mod tests {
## What's next
We will see how to handle native token transfers.

[OwnedToken example]: https://github.com/odradev/odra/blob/release/2.6.0/examples/src/contracts/owned_token.rs
[OwnedToken example]: https://github.com/odradev/odra/blob/release/2.8.0/examples/src/contracts/owned_token.rs
[Storage Layout]: ../advanced/04-storage-layout.md
58 changes: 33 additions & 25 deletions docusaurus/docs/examples/using-odra-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ version = "0.1.0"
edition = "2021"

[dependencies]
odra = "2.6.0"
odra = "2.8.0"

[dev-dependencies]
odra-test = "2.6.0"
odra-test = "2.8.0"

[build-dependencies]
odra-build = "2.6.0"
odra-build = "2.8.0"

[[bin]]
name = "my_project_build_contract"
Expand All @@ -45,67 +45,67 @@ To use `odra-modules`, edit your `dependency` and `features` sections.

```toml title=Cargo.toml
[dependencies]
odra = "2.6.0"
odra-modules = "2.6.0"
odra = "2.8.0"
odra-modules = "2.8.0"
```

Now, the only thing left is to add a module to your contract.

Let's write an example of `MyToken` based on `Erc20` module.
Let's write an example of `MyToken` based on the `Cep18` module.

```rust
use odra::prelude::*;
use odra::casper_types::U256;
use odra_modules::erc20::Erc20;
use odra_modules::cep18_token::Cep18;

#[odra::module]
pub struct MyToken {
erc20: SubModule<Erc20>
token: SubModule<Cep18>
}

#[odra::module]
impl OwnedToken {
impl MyToken {
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let name = String::from("MyToken");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
self.token.init(symbol, name, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
self.token.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
self.token.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
self.token.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
self.token.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
pub fn balance_of(&self, address: &Address) -> U256 {
self.token.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.token.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.token.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
self.token.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
pub fn approve(&mut self, spender: &Address, amount: &U256) {
self.token.approve(spender, amount);
}
}
```
Expand All @@ -128,6 +128,14 @@ Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and t

Casper Ecosystem Proposal 95 (CEP-95) is a Casper NFT Standard. It aims to replace CEP-47 and CEP-78, which have flaws that complicate their support in the ecosystem. This standard is aligned with Ethereum's ERC-721, but makes adjustments relevant for the Casper Ecosystem. Similarly to ERC-721, this standard can be used to represent a various range of tokenized assets Read more about the CEP-95 [here](https://github.com/casper-network/ceps/blob/master/text/0095-nft-standard.md).

#### CEP-2612

The `CEP2612` module is an adaptation of [ERC-2612](https://eips.ethereum.org/EIPS/eip-2612) for the Casper Network. It extends a CEP-18 token with a `permit` entry point that lets a token holder grant an allowance via an off-chain EIP-712 signature instead of an on-chain `approve` transaction, making the approval gas-less from the holder's perspective.

#### CEP-3009

The `CEP3009` module is an adaptation of [ERC-3009](https://eips.ethereum.org/EIPS/eip-3009) ("Transfer With Authorization") for the Casper Network. It lets a CEP-18 token holder authorize a transfer of their tokens via an off-chain EIP-712 signature, which a third party (a relayer, or the recipient themselves) submits on-chain using `transfer_with_authorization` or `receive_with_authorization`. An unused authorization can be revoked with `cancel_authorization`.

#### Erc20

The `Erc20` module implements the [ERC20](https://eips.ethereum.org/EIPS/eip-20) standard.
Expand Down
12 changes: 6 additions & 6 deletions docusaurus/docs/tutorials/deploying-on-casper.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "2.6.0", features = [], default-features = false }
odra-modules = { version = "2.6.0", features = [], default-features = false }
odra-casper-livenet-env = { version = "2.6.0", optional = true }
odra = { version = "2.8.0", features = [], default-features = false }
odra-modules = { version = "2.8.0", features = [], default-features = false }
odra-casper-livenet-env = { version = "2.8.0", optional = true }

[dev-dependencies]
odra-test = { version = "2.6.0", features = [], default-features = false }
odra-test = { version = "2.8.0", features = [], default-features = false }

[build-dependencies]
odra-build = { version = "2.6.0", features = [], default-features = false }
odra-build = { version = "2.8.0", features = [], default-features = false }

[features]
default = []
Expand Down Expand Up @@ -326,4 +326,4 @@ provides. Feel free to explore them on [casperecosystem.io].
[cspr.live]: https://cspr.live/
[Casper Testnet Faucet]: https://testnet.cspr.live/tools/faucet
[casperecosystem.io]: https://casperecosystem.io/
[`InstallConfig`]: https://docs.rs/odra/2.6.0/odra/host/struct.InstallConfig.html
[`InstallConfig`]: https://docs.rs/odra/2.8.0/odra/host/struct.InstallConfig.html
4 changes: 2 additions & 2 deletions docusaurus/docs/tutorials/odra-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,5 +495,5 @@ This is useful for verifying which account will sign transactions before deployi
The Odra CLI library provides a powerful and convenient way to create command-line tools for your Odra contracts. It simplifies the process of deploying, interacting with, and testing your contracts, allowing you to focus on the business logic of your application. By following the examples in this tutorial, you can create your own CLI tools and streamline your development workflow.
```

[`InstallConfig`]: https://docs.rs/odra/2.6.0/odra/host/struct.InstallConfig.html
[`DeployerExt`]: https://docs.rs/odra-cli/2.6.0/odra_cli/trait.DeployerExt.html
[`InstallConfig`]: https://docs.rs/odra/2.8.0/odra/host/struct.InstallConfig.html
[`DeployerExt`]: https://docs.rs/odra-cli/2.8.0/odra_cli/trait.DeployerExt.html
4 changes: 2 additions & 2 deletions docusaurus/docs/tutorials/upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ It works! Now our contracts has three versions deployed:

In this tutorial, we learned how to upgrade a smart contract on the blockchain using the Odra framework. We deployed a simple counter contract, made it upgradable, and then upgraded it twice: first to `CounterV2`, and then back to `CounterV1`. We also explored the testnet to verify our contract deployments.

[upgrade configuration]: https://docs.rs/odra/2.6.0/odra/host/struct.UpgradeConfig.html
[automatically generated]: https://docs.rs/odra/2.6.0/odra/host/trait.UpgradeArgs.html
[upgrade configuration]: https://docs.rs/odra/2.8.0/odra/host/struct.UpgradeConfig.html
[automatically generated]: https://docs.rs/odra/2.8.0/odra/host/trait.UpgradeArgs.html
6 changes: 3 additions & 3 deletions docusaurus/docs/tutorials/using-proxy-caller.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ To interact with the contract, we use the `livenet` backend. It allows to write
```toml title=Cargo.toml
[package]
name = "odra-examples"
version = "2.6.0"
version = "2.8.0"
edition = "2021"

[dependencies]
odra = { path = "../odra", default-features = false }
... # other dependencies
odra-casper-livenet-env = { version = "2.6.0", optional = true }
odra-casper-livenet-env = { version = "2.8.0", optional = true }

... # other sections

Expand Down Expand Up @@ -339,4 +339,4 @@ f40e3ca983034435d829462dd53d801df4e98013009cbf4a6654b3ee467063a1 # the deploy ha
In this tutorial, we learned how to use the `proxy_caller` wasm to make a payable function call. We deployed the `TimeLockWallet` contract, deposited tokens using the `proxy_caller` with attached CSPRs, and withdrew them. You got to try it out in both `Rust` and `TypeScript`, so you can choose whichever you prefer. `Rust` code seemed simpler, thanks to the Odra `livenet` backend making chain interactions easier to handle.

[`casper-nctl-docker`]: https://github.com/make-software/casper-nctl-docker
[our Github repo]: https://github.com/odradev/odra/blob/release/2.6.0/examples/src/contracts/tlw.rs
[our Github repo]: https://github.com/odradev/odra/blob/release/2.8.0/examples/src/contracts/tlw.rs
2 changes: 1 addition & 1 deletion docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const config = {
sidebarPath: require.resolve('./sidebars.js'),
includeCurrentVersion: true,
showLastUpdateTime: true,
lastVersion: '2.6.0',
lastVersion: '2.8.0',
versions: {
current: {
label: 'next',
Expand Down
Loading
Loading