Skip to content

Commit

Permalink
Merge pull request #189 from multiversx/feat/sovereign-forge
Browse files Browse the repository at this point in the history
`feat/sovereign-forge` merge into `feat/beta`
  • Loading branch information
andreiblt1304 authored Nov 21, 2024
2 parents f1f3703 + 321826d commit 6ff27a3
Show file tree
Hide file tree
Showing 110 changed files with 2,851 additions and 3,377 deletions.
39 changes: 23 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ members = [
"token-handler/meta",
"testing-sc",
"testing-sc/meta",
"sovereign-forge",
"sovereign-forge/meta",
]
3 changes: 3 additions & 0 deletions chain-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ version = "=0.54.3"

[dependencies.multiversx-sc-modules]
version = "=0.54.3"

[dependencies.transaction]
path = "../common/transaction"
7 changes: 3 additions & 4 deletions chain-config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
#![no_std]

use multiversx_sc_modules::only_admin;
use transaction::StakeMultiArg;
use validator_rules::TokenIdAmountPair;

multiversx_sc::imports!();

pub mod bridge;
pub mod validator_rules;

pub type StakeMultiArg<M> = MultiValue2<TokenIdentifier<M>, BigUint<M>>;

#[multiversx_sc::contract]
pub trait ChainConfigContract:
bridge::BridgeModule + validator_rules::ValidatorRulesModule + only_admin::OnlyAdminModule
{
#[init]
fn init(
&self,
min_validators: usize,
max_validators: usize,
min_validators: u64,
max_validators: u64,
min_stake: BigUint,
admin: ManagedAddress,
additional_stake_required: MultiValueEncoded<StakeMultiArg<Self::Api>>,
Expand Down
4 changes: 2 additions & 2 deletions chain-config/src/validator_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ pub struct TokenIdAmountPair<M: ManagedTypeApi> {
pub trait ValidatorRulesModule {
#[view(getMinValidators)]
#[storage_mapper("minValidators")]
fn min_validators(&self) -> SingleValueMapper<usize>;
fn min_validators(&self) -> SingleValueMapper<u64>;

#[view(getMaxValidators)]
#[storage_mapper("maxValidators")]
fn max_validators(&self) -> SingleValueMapper<usize>;
fn max_validators(&self) -> SingleValueMapper<u64>;

// TODO: Read user stake and verify
#[view(getMinStake)]
Expand Down
8 changes: 8 additions & 0 deletions chain-config/wasm-chain-config-full/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions chain-config/wasm-chain-config-view/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions chain-config/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions chain-factory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ path = "../chain-config"

[dependencies.proxies]
path = "../common/proxies"

[dependencies.transaction]
path = "../common/transaction"
7 changes: 3 additions & 4 deletions chain-factory/src/factory.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use chain_config::StakeMultiArg;

use multiversx_sc::imports::*;
use proxies::{
chain_config_proxy::ChainConfigContractProxy,
enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy,
fee_market_proxy::{FeeMarketProxy, FeeStruct},
header_verifier_proxy::HeaderverifierProxy,
};
use transaction::StakeMultiArg;
multiversx_sc::derive_imports!();

#[multiversx_sc::module]
Expand All @@ -15,8 +14,8 @@ pub trait FactoryModule {
#[endpoint(deploySovereignChainConfigContract)]
fn deploy_sovereign_chain_config_contract(
&self,
min_validators: usize,
max_validators: usize,
min_validators: u64,
max_validators: u64,
min_stake: BigUint,
additional_stake_required: MultiValueEncoded<StakeMultiArg<Self::Api>>,
) -> ManagedAddress {
Expand Down
2 changes: 1 addition & 1 deletion chain-factory/tests/chain_factory_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::env::current_dir;

use chain_config::StakeMultiArg;
use multiversx_sc::types::{
BigUint, CodeMetadata, MultiValueEncoded, TestAddress, TestSCAddress, TokenIdentifier,
};
Expand All @@ -10,6 +9,7 @@ use multiversx_sc_scenario::{
use proxies::{
chain_config_proxy::ChainConfigContractProxy, chain_factory_proxy::ChainFactoryContractProxy,
};
use transaction::StakeMultiArg;

const FACTORY_ADDRESS: TestSCAddress = TestSCAddress::new("chain-factory");
const CODE_PATH: MxscPath = MxscPath::new("output/chain-factory.mxsc.json");
Expand Down
11 changes: 2 additions & 9 deletions chain-factory/wasm-chain-factory-full/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions chain-factory/wasm-chain-factory-view/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions chain-factory/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6ff27a3

Please sign in to comment.