Commit 986bf5c0 authored by Hero Bird's avatar Hero Bird

[pdsl_model] Implement proper ContractInstance::deploy

parent 902a2b43
......@@ -275,13 +275,23 @@ pub struct ContractInstance<State, DeployArgs, HandlerChain> {
handlers: HandlerChain,
}
impl<State, DeployArgs, HandlerChain> Contract for ContractInstance<State, DeployArgs, HandlerChain> {
impl<State, DeployArgs, HandlerChain> Contract for ContractInstance<State, DeployArgs, HandlerChain>
where
State: ContractState,
DeployArgs: parity_codec::Decode,
HandlerChain: crate::HandleCall<State>,
{
fn deploy(self) {
// Deploys the contract state.
//
// Should be performed exactly once during contract lifetime.
// Consumes the contract since nothing should be done afterwards.
unimplemented!()
use pdsl_core::env::Env;
let input = pdsl_core::env::ContractEnv::input();
let deploy_params = DeployArgs::decode(&mut &input[..]).unwrap();
let mut this = self;
(this.deployer.deploy_fn)(&mut this.env, deploy_params);
this.env.state.flush()
}
fn dispatch(self) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment