|
@@ -34,12 +34,17 @@ pub struct CallData {
|
|
|
pub proposal: pallas::Base,
|
|
pub proposal: pallas::Base,
|
|
|
pub coin_0: pallas::Base,
|
|
pub coin_0: pallas::Base,
|
|
|
pub coin_1: pallas::Base,
|
|
pub coin_1: pallas::Base,
|
|
|
|
|
+ // TODO: don't store the x, y like this
|
|
|
|
|
+ // store the actual point
|
|
|
pub win_votes_commit_x: pallas::Base,
|
|
pub win_votes_commit_x: pallas::Base,
|
|
|
pub win_votes_commit_y: pallas::Base,
|
|
pub win_votes_commit_y: pallas::Base,
|
|
|
pub total_votes_commit_x: pallas::Base,
|
|
pub total_votes_commit_x: pallas::Base,
|
|
|
pub total_votes_commit_y: pallas::Base,
|
|
pub total_votes_commit_y: pallas::Base,
|
|
|
pub input_value_commit_x: pallas::Base,
|
|
pub input_value_commit_x: pallas::Base,
|
|
|
pub input_value_commit_y: pallas::Base,
|
|
pub input_value_commit_y: pallas::Base,
|
|
|
|
|
+ /////
|
|
|
|
|
+
|
|
|
|
|
+ // Delete these values
|
|
|
pub dao_spend_hook: pallas::Base,
|
|
pub dao_spend_hook: pallas::Base,
|
|
|
pub user_spend_hook: pallas::Base,
|
|
pub user_spend_hook: pallas::Base,
|
|
|
pub user_data: pallas::Base,
|
|
pub user_data: pallas::Base,
|
|
@@ -59,9 +64,9 @@ impl CallDataBase for CallData {
|
|
|
self.total_votes_commit_y,
|
|
self.total_votes_commit_y,
|
|
|
self.input_value_commit_x,
|
|
self.input_value_commit_x,
|
|
|
self.input_value_commit_y,
|
|
self.input_value_commit_y,
|
|
|
- self.dao_spend_hook,
|
|
|
|
|
- self.user_spend_hook,
|
|
|
|
|
- self.user_data,
|
|
|
|
|
|
|
+ *super::FUNC_ID,
|
|
|
|
|
+ pallas::Base::from(0),
|
|
|
|
|
+ pallas::Base::from(0),
|
|
|
],
|
|
],
|
|
|
)]
|
|
)]
|
|
|
}
|
|
}
|
|
@@ -85,12 +90,20 @@ pub fn state_transition(
|
|
|
// This will be inside wasm so unwrap is fine.
|
|
// This will be inside wasm so unwrap is fine.
|
|
|
let call_data = call_data.unwrap();
|
|
let call_data = call_data.unwrap();
|
|
|
|
|
|
|
|
- //let example_state = states.lookup::<State>(&"Example".to_string()).unwrap();
|
|
|
|
|
|
|
+ // Enforce tx has correct format:
|
|
|
|
|
+ // 1. There should only be 2 calldata's
|
|
|
|
|
+ // 2. func_call_index == 1
|
|
|
|
|
+ // 3. First item should be a Money::transfer() calldata
|
|
|
|
|
+ // 4. Money::transfer() has exactly 2 outputs
|
|
|
|
|
+
|
|
|
|
|
+ // Checks:
|
|
|
|
|
|
|
|
- //if example_state.public_exists(&call_data.header.public_c) {
|
|
|
|
|
- // return Err(Error::ValueExists)
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ // 1. Check both coins in Money::transfer() are equal to our coin_0, coin_1
|
|
|
|
|
+ // 2. sum of Money::transfer() calldata input_value_commits == our input value commit
|
|
|
|
|
+ // 3. get the ProposalVote from DAO::State
|
|
|
|
|
+ // 4. check win/total_vote_commit is the same as in ProposalVote
|
|
|
|
|
|
|
|
|
|
+ // We need the proposal in here
|
|
|
Ok(Box::new(Update {}))
|
|
Ok(Box::new(Update {}))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -98,5 +111,7 @@ pub fn state_transition(
|
|
|
pub struct Update {}
|
|
pub struct Update {}
|
|
|
|
|
|
|
|
impl UpdateBase for Update {
|
|
impl UpdateBase for Update {
|
|
|
- fn apply(mut self: Box<Self>, states: &mut StateRegistry) {}
|
|
|
|
|
|
|
+ fn apply(mut self: Box<Self>, states: &mut StateRegistry) {
|
|
|
|
|
+ // Delete the ProposalVotes from DAO::State hashmap
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|