daod/ example_contract: rename EXAMPLE to Example

This commit is contained in:
ihateface
2022-08-24 12:38:02 +02:00
parent 6be84bda13
commit 67797d6b19
3 changed files with 7 additions and 7 deletions

View File

@@ -227,7 +227,7 @@ pub async fn example() -> Result<()> {
zk_bins.add_contract("example-foo".to_string(), zk_example_foo_bin, 13);
let example_state = example_contract::state::State::new();
states.register("EXAMPLE".to_string(), example_state);
states.register("Example".to_string(), example_state);
let foo = example_contract::foo::wallet::Foo { a: 5, b: 10 };
@@ -236,7 +236,7 @@ pub async fn example() -> Result<()> {
let tx = Transaction { func_calls: vec![func_call] };
for (idx, func_call) in tx.func_calls.iter().enumerate() {
if func_call.func_id == "EXAMPLE::foo()" {
if func_call.func_id == "Example::foo()" {
debug!("example_contract::foo::state_transition()");
let update = example_contract::foo::validate::state_transition(&states, idx, &tx)

View File

@@ -65,7 +65,7 @@ pub fn state_transition(
// This will be inside wasm so unwrap is fine.
let call_data = call_data.unwrap();
let example_state = states.lookup::<State>(&"EXAMPLE".to_string()).unwrap();
let example_state = states.lookup::<State>(&"Example".to_string()).unwrap();
if example_state.public_exists(&call_data.header.public_c) {
return Err(Error::ValueExists)
@@ -80,6 +80,6 @@ pub struct Update {
}
pub fn apply(states: &mut StateRegistry, update: Update) {
let example_state = states.lookup_mut::<State>(&"EXAMPLE".to_string()).unwrap();
let example_state = states.lookup_mut::<State>(&"Example".to_string()).unwrap();
example_state.add_public_value(update.public_value);
}

View File

@@ -53,7 +53,7 @@ impl Builder {
debug!(target: "example_contract::foo::wallet::Builder", "input_proof Proof::create()");
let proving_key = &zk_info.proving_key;
let input_proof = Proof::create(proving_key, &[circuit], &public_inputs, &mut OsRng)
.expect("EXAMPLE::foo() proving error!)");
.expect("Example::foo() proving error!)");
proofs.push(input_proof);
let header = Header { public_c: c };
@@ -61,8 +61,8 @@ impl Builder {
let call_data = CallData { header };
FuncCall {
contract_id: "EXAMPLE".to_string(),
func_id: "EXAMPLE::foo()".to_string(),
contract_id: "Example".to_string(),
func_id: "Example::foo()".to_string(),
call_data: Box::new(call_data),
proofs,
}