Skip to content

Commit

Permalink
Merge pull request #957 from multiversx/metabonding-staking-legacy-sc
Browse files Browse the repository at this point in the history
Metabonding Staking Legacy SC
  • Loading branch information
psorinionut authored Oct 7, 2024
2 parents 9c34c42 + eca22f4 commit 0315421
Show file tree
Hide file tree
Showing 10 changed files with 391 additions and 0 deletions.
17 changes: 17 additions & 0 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 @@ -41,6 +41,8 @@ members = [
"legacy-contracts/simple-lock-legacy/meta",
"legacy-contracts/farm-staking-proxy-v13",
"legacy-contracts/farm-staking-proxy-v13/meta",
"legacy-contracts/metabonding-staking-legacy",
"legacy-contracts/metabonding-staking-legacy/meta",
"legacy-contracts/farm-v12",
"legacy-contracts/farm-v12/meta",
"legacy-contracts/farm-v13",
Expand Down
18 changes: 18 additions & 0 deletions legacy-contracts/metabonding-staking-legacy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "metabonding-staking-legacy"
version = "0.0.0"
authors = ["you"]
edition = "2021"
publish = false

[lib]
path = "src/lib.rs"

[dependencies.multiversx-sc]
version = "0.53.2"

[dev-dependencies]
num-bigint = "0.4"

[dev-dependencies.multiversx-sc-scenario]
version = "0.53.2"
12 changes: 12 additions & 0 deletions legacy-contracts/metabonding-staking-legacy/meta/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "metabonding-staking-legacy-meta"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies.metabonding-staking-legacy]
path = ".."

[dependencies.multiversx-sc-meta-lib]
version = "0.53.2"
default-features = false
3 changes: 3 additions & 0 deletions legacy-contracts/metabonding-staking-legacy/meta/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
multiversx_sc_meta_lib::cli_main::<metabonding_staking_legacy::AbiProvider>();
}
3 changes: 3 additions & 0 deletions legacy-contracts/metabonding-staking-legacy/multiversx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"language": "rust"
}
78 changes: 78 additions & 0 deletions legacy-contracts/metabonding-staking-legacy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#![no_std]

use multiversx_sc::derive_imports::*;
use multiversx_sc::imports::*;

pub type SnapshotEntry<M> = MultiValue2<ManagedAddress<M>, BigUint<M>>;

#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, Debug, PartialEq)]
pub struct UserEntry<M: ManagedTypeApi> {
pub token_nonce: u64,
pub stake_amount: BigUint<M>,
pub unstake_amount: BigUint<M>,
pub unbond_epoch: u64,
}

#[multiversx_sc::contract]
pub trait MetabondingStakingLegacy {
#[init]
fn init(&self) {}

#[upgrade]
fn upgrade(&self) {}

#[payable("*")]
#[endpoint(stakeLockedAsset)]
fn stake_locked_asset(&self) {
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint]
fn unstake(&self, _amount: BigUint) {
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[endpoint]
fn unbond(&self) {
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getStakedAmountForUser)]
fn get_staked_amount_for_user(&self, _user_address: ManagedAddress) -> BigUint {
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getUserEntry)]
fn get_user_entry(&self, _user_address: ManagedAddress) -> OptionalValue<UserEntry<Self::Api>> {
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

#[view(getSnapshot)]
fn get_snapshot(&self) -> MultiValueEncoded<SnapshotEntry<Self::Api>> {
sc_panic!("This is a no-code version of a legacy contract. The logic of the endpoints has not been implemented.");
}

// storage

#[view(getLockedAssetTokenId)]
#[storage_mapper("lockedAssetTokenId")]
fn locked_asset_token_id(&self) -> SingleValueMapper<TokenIdentifier>;

#[view(getLockedAssetFactoryAddress)]
#[storage_mapper("lockedAssetFactoryAddress")]
fn locked_asset_factory_address(&self) -> SingleValueMapper<ManagedAddress>;

#[view(getTotalLockedAssetSupply)]
#[storage_mapper("totalLockedAssetSupply")]
fn total_locked_asset_supply(&self) -> SingleValueMapper<BigUint>;

#[storage_mapper("entryForUser")]
fn entry_for_user(
&self,
user_address: &ManagedAddress,
) -> SingleValueMapper<UserEntry<Self::Api>>;

#[view(getUserList)]
#[storage_mapper("userList")]
fn user_list(&self) -> UnorderedSetMapper<ManagedAddress>;
}
188 changes: 188 additions & 0 deletions legacy-contracts/metabonding-staking-legacy/wasm/Cargo.lock

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

34 changes: 34 additions & 0 deletions legacy-contracts/metabonding-staking-legacy/wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Code generated by the multiversx-sc build system. DO NOT EDIT.

# ##########################################
# ############## AUTO-GENERATED #############
# ##########################################

[package]
name = "metabonding-staking-legacy-wasm"
version = "0.0.0"
edition = "2021"
publish = false

[lib]
crate-type = ["cdylib"]

[profile.release]
codegen-units = 1
opt-level = "z"
lto = true
debug = false
panic = "abort"
overflow-checks = false

[profile.dev]
panic = "abort"

[dependencies.metabonding-staking-legacy]
path = ".."

[dependencies.multiversx-sc-wasm-adapter]
version = "0.53.2"

[workspace]
members = ["."]
Loading

0 comments on commit 0315421

Please sign in to comment.