Skip to content

Commit

Permalink
Readme improvements (#27)
Browse files Browse the repository at this point in the history
* Use lazy storage for listed regions

* Readme improvements

* trying something

* maybe good now
  • Loading branch information
Szegoo authored Mar 8, 2024
1 parent d52b217 commit cd2500f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,29 @@ An explanation of our solution for transferring the metadata of regions acrross

### 2.2 Coretime Marketplace

The RegionX Coretime market utilizes an order-book model and integrates directly with the XcRegions contract. For a region to be listed on the market, it must be represented within the XcRegion contract.

The regions sold in the market are classified into two categories:
- Active regions. The tasks that are assigned to active regions can currently be performed on a Polkadot core.
- Inactive regions. These are the regions that will become active in the upcoming Bulk period. The regions purchased from the Coretime chain fall into this category until the start of the next Bulk period.

#### Region pricing

The formula used to calculate the price of a region listed for sale is as follows:

$$
r_{price}=(r_{end}- t)*(tp * c_{occupancy})
$$

Where:
- $r_{end}$: is the timeslice at which the region concludes
- $t$: represents the current timeslice
- $tp$: is the cost per timeslice defined by the seller upon listing the region on the market.
- $c_{occupancy}$: represents the proportion of the Core that is occupied by the region.


> The contract doesn't store the entire region's price; instead, it records the price of its timeslice, which is determined at the time of listing the region.
## 3. Develop

1. Make sure to have the latest [cargo contract](https://crates.io/crates/cargo-contract).
Expand Down Expand Up @@ -63,19 +86,19 @@ cargo contract build --release

4. Running e2e-tests

Considering that the xc-regions contract necessitates the underlying chain to implement the uniques pallet for running e2e tests, it is required to specify a custom contracts node. For this purpose, we utilize the Astar local node from [Coretime-Mock](https://github.com/RegionX-Labs/Coretime-Mock) directory:
Given that the xc-regions contract requires the underlying chain to implement the uniques pallet, specifying a custom contracts node is necessary when running e2e tests. For this purpose, we use the Astar local node from [Coretime-Mock](https://github.com/RegionX-Labs/Coretime-Mock) directory:

```sh
export CONTRACTS_NODE="~/Coretime-Mock/bin/astar-collator"
```

Once that is configured, we can proceed to run the e2e tests:"
Once that is configured, we can proceed to run the e2e tests:

```sh
cargo test --features e2e-tests
```

Additionally, this repository contains e2e typescript tests, which can be run with the following steps:
Additionally, this repository contains e2e typescript tests that can be executed using the steps below:

```sh
# in a separate terminal run a the astar-collator node from Coretime-Mock
Expand All @@ -101,9 +124,8 @@ For the xc-regions contract to function correctly, the chain on which it is depl
```rust
#[derive(scale::Encode, scale::Decode)]
pub enum RuntimeCall {
// E.g: on shibuya this is 37. in local-runtime this is 30.
#[codec(index = <CORRECT PALLET INDEX>)]
Uniques(uniques::UniquesCall),
}
```
Once this is correctly configured, the contract can then be deployed.
Once this is correctly configured, the contract can then be deployed.
3 changes: 1 addition & 2 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub type Version = u32;

#[derive(scale::Encode, scale::Decode)]
pub enum RuntimeCall {
// NOTE: on shibuya this is 37. in local-runtime this is 30.
#[codec(index = 30)]
#[codec(index = 37)]
Uniques(uniques::UniquesCall),
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2023-11-28"
channel = "nightly"
components = [ "rustfmt", "clippy" ]
targets = [ "wasm32-unknown-unknown"]
profile = "minimal"

0 comments on commit cd2500f

Please sign in to comment.