-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #957 from multiversx/metabonding-staking-legacy-sc
Metabonding Staking Legacy SC
- Loading branch information
Showing
10 changed files
with
391 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
12
legacy-contracts/metabonding-staking-legacy/meta/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"language": "rust" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
188
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.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
legacy-contracts/metabonding-staking-legacy/wasm/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = ["."] |
Oops, something went wrong.