Skip to content

Commit

Permalink
init project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
motosharpley committed Oct 3, 2022
1 parent 3c575d3 commit 8893efa
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions dao/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "dao"
version = "0.1.0"
edition = "2021"

[dependencies]
sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }
scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }

[dev-dependencies]
transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }
radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }
scrypto-unit = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }

[profile.release]
opt-level = 's' # Optimize for size.
lto = true # Enable Link Time Optimization.
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
panic = 'abort' # Abort on panic.
strip = "debuginfo" # Strip debug info.
overflow-checks = true # Panic in the case of an overflow.

[lib]
crate-type = ["cdylib", "lib"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions dao/src/dao.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use scrypto::prelude::*;

blueprint! {
struct DAO {
}

impl DAO {
pub fn instantiate_dao() -> ComponentAddress {

Self {}
.instantiate()
.globalize()
}
}
}
1 change: 1 addition & 0 deletions dao/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod dao;
43 changes: 43 additions & 0 deletions dao/tests/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
use radix_engine::ledger::*;
use scrypto::core::NetworkDefinition;
use scrypto::prelude::*;
use scrypto_unit::*;
use transaction::builder::ManifestBuilder;

#[test]
fn test_hello() {
// Setup the environment
let mut store = TypedInMemorySubstateStore::with_bootstrap();
let mut test_runner = TestRunner::new(true, &mut store);

// Create an account
let (public_key, _private_key, account_component) = test_runner.new_account();

// Publish package
let package_address = test_runner.compile_and_publish(this_package!());

// Test the `instantiate_hello` function.
let manifest = ManifestBuilder::new(&NetworkDefinition::simulator())
.call_function(package_address, "Hello", "instantiate_hello", args!())
.build();
let receipt = test_runner.execute_manifest_ignoring_fee(manifest, vec![public_key.into()]);
println!("{:?}\n", receipt);
receipt.expect_commit_success();
let component = receipt
.expect_commit()
.entity_changes
.new_component_addresses[0];

// Test the `free_token` method.
let manifest = ManifestBuilder::new(&NetworkDefinition::simulator())
.call_method(component, "free_token", args!())
.call_method(
account_component,
"deposit_batch",
args!(Expression::entire_worktop()),
)
.build();
let receipt = test_runner.execute_manifest_ignoring_fee(manifest, vec![public_key.into()]);
println!("{:?}\n", receipt);
receipt.expect_commit_success();
}

0 comments on commit 8893efa

Please sign in to comment.