Skip to content

Commit

Permalink
transfer-contract: moved state to transfer-data contract
Browse files Browse the repository at this point in the history
  • Loading branch information
miloszm committed Jan 10, 2024
1 parent cbcf975 commit 9f48dbe
Show file tree
Hide file tree
Showing 15 changed files with 1,048 additions and 179 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"contracts/stake-types",
"contracts/governance",
"contracts/transfer",
"contracts/transfer-data",
"contracts/transfer-types",
"contracts/license",

Expand Down
2 changes: 1 addition & 1 deletion contracts/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS := stake-types transfer-types alice bob transfer stake governance license
SUBDIRS := stake-types transfer-types alice bob transfer transfer-data stake governance license

all: $(SUBDIRS) ## Build all the contracts

Expand Down
13 changes: 12 additions & 1 deletion contracts/stake/tests/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rand::rngs::StdRng;
use rand::{CryptoRng, RngCore, SeedableRng};
use rusk_abi::dusk::{dusk, LUX};
use rusk_abi::{CallReceipt, ContractData, ContractError, Error, Session, VM};
use rusk_abi::{STAKE_CONTRACT, TRANSFER_CONTRACT};
use rusk_abi::{STAKE_CONTRACT, TRANSFER_CONTRACT, TRANSFER_DATA_CONTRACT};
use stake_contract_types::{
allow_signature_message, stake_signature_message,
unstake_signature_message, withdraw_signature_message, Allow, Stake,
Expand Down Expand Up @@ -50,6 +50,9 @@ fn instantiate<Rng: RngCore + CryptoRng>(
psk: &PublicSpendKey,
pk: &PublicKey,
) -> Session {
let transfer_data_bytecode = include_bytes!(
"../../../target/wasm64-unknown-unknown/release/transfer_data_contract.wasm"
);
let transfer_bytecode = include_bytes!(
"../../../target/wasm64-unknown-unknown/release/transfer_contract.wasm"
);
Expand All @@ -59,6 +62,14 @@ fn instantiate<Rng: RngCore + CryptoRng>(

let mut session = rusk_abi::new_genesis_session(vm);

session
.deploy(
transfer_data_bytecode,
ContractData::builder(OWNER).contract_id(TRANSFER_DATA_CONTRACT),
POINT_LIMIT,
)
.expect("Deploying the transfer contract should succeed");

session
.deploy(
transfer_bytecode,
Expand Down
18 changes: 18 additions & 0 deletions contracts/transfer-data/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "transfer-data-contract"
version = "0.10.1"
edition = "2021"

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

[dependencies]
dusk-bls12_381 = { version = "0.12", default-features = false, features = ["rkyv-impl"] }
dusk-bytes = "0.1"
dusk-pki = { version = "0.13", default-features = false, features = ["rkyv-impl"] }
poseidon-merkle = { version = "0.3", features = ["rkyv-impl"] }
phoenix-core = { version = "0.21", default-features = false, features = ["rkyv-impl", "alloc"] }
rkyv = { version = "0.7", default-features = false, features = ["size_32"] }

[target.'cfg(target_family = "wasm")'.dependencies]
rusk-abi = { version = "0.12.0-rc", path = "../../rusk-abi" }
Loading

0 comments on commit 9f48dbe

Please sign in to comment.