mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 07:08:05 -05:00
example/dummy-contract: Fix paths
This commit is contained in:
2
example/dummy-contract/.gitignore
vendored
Normal file
2
example/dummy-contract/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
target/
|
||||
Cargo.lock
|
||||
@@ -30,3 +30,7 @@ path = "src/runtime.rs"
|
||||
[features]
|
||||
default = []
|
||||
no-entrypoint = []
|
||||
|
||||
[patch.crates-io]
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="v4"}
|
||||
halo2_gadgets = {git="https://github.com/parazyd/halo2", branch="v4"}
|
||||
|
||||
@@ -16,7 +16,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use darkfi_sdk::{crypto::ContractId, error::ContractResult};
|
||||
use darkfi_sdk::{
|
||||
crypto::ContractId,
|
||||
db::{db_init, db_lookup},
|
||||
error::ContractResult,
|
||||
};
|
||||
|
||||
darkfi_sdk::define_contract!(
|
||||
init: init_contract,
|
||||
@@ -25,8 +29,12 @@ darkfi_sdk::define_contract!(
|
||||
metadata: get_metadata
|
||||
);
|
||||
|
||||
fn init_contract(_cid: ContractId, _ix: &[u8]) -> ContractResult {
|
||||
//panic!("ohai");
|
||||
fn init_contract(cid: ContractId, _ix: &[u8]) -> ContractResult {
|
||||
let db = match db_lookup(cid, "dummy_db") {
|
||||
Ok(v) => v,
|
||||
Err(_) => db_init(cid, "dummy_db")?,
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -34,7 +42,9 @@ fn get_metadata(_cid: ContractId, _ix: &[u8]) -> ContractResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn process_instruction(_cid: ContractId, _ix: &[u8]) -> ContractResult {
|
||||
fn process_instruction(cid: ContractId, _ix: &[u8]) -> ContractResult {
|
||||
let db = db_lookup(cid, "dummy_db")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ fn main() {
|
||||
let timekeeper = TimeKeeper::new(Timestamp::current_time(), 10, 90, 0);
|
||||
|
||||
let wasm_bytes =
|
||||
include_bytes!("../../../target/wasm32-unknown-unknown/release/darkfi_dummy_contract.wasm");
|
||||
include_bytes!("../target/wasm32-unknown-unknown/release/darkfi_dummy_contract.wasm");
|
||||
|
||||
let contract_id = ContractId::from(pallas::Base::from(69));
|
||||
|
||||
@@ -55,4 +55,9 @@ fn main() {
|
||||
Ok(()) => {}
|
||||
Err(e) => println!("Error running deploy: {:#?}", e),
|
||||
}
|
||||
|
||||
match runtime.exec(&[]) {
|
||||
Ok(_) => {}
|
||||
Err(e) => println!("Error running exec: {:#?}", e),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user