-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c575d3
commit 8893efa
Showing
11 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,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.
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,15 @@ | ||
use scrypto::prelude::*; | ||
|
||
blueprint! { | ||
struct DAO { | ||
} | ||
|
||
impl DAO { | ||
pub fn instantiate_dao() -> ComponentAddress { | ||
|
||
Self {} | ||
.instantiate() | ||
.globalize() | ||
} | ||
} | ||
} |
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 @@ | ||
mod dao; |
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,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(); | ||
} |