Skip to content

Remove compose and decompose transaction #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions core/src/codechain_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,6 @@ impl CodeChainMachine {
Action::IncreaseAssetSupply {
..
} => params.min_asset_supply_increase_cost(),
Action::ComposeAsset {
..
} => params.min_asset_compose_cost(),
Action::DecomposeAsset {
..
} => params.min_asset_decompose_cost(),
Action::UnwrapCCC {
..
} => params.min_asset_unwrap_ccc_cost(),
Expand Down
2 changes: 0 additions & 2 deletions rpc/src/v1/impls/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,6 @@ where
"store" => Some(common_parameters.min_store_transaction_cost()),
"remove" => Some(common_parameters.min_remove_transaction_cost()),
"custom" => Some(common_parameters.min_custom_transaction_cost()),
"composeAsset" => Some(common_parameters.min_asset_compose_cost()),
"decomposeAsset" => Some(common_parameters.min_asset_decompose_cost()),

_ => None,
})
Expand Down
127 changes: 0 additions & 127 deletions rpc/src/v1/types/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,6 @@ pub enum Action {
approvals: Vec<Signature>,
},
#[serde(rename_all = "camelCase")]
ComposeAsset {
network_id: NetworkId,
shard_id: ShardId,
metadata: String,
approver: Option<PlatformAddress>,
registrar: Option<PlatformAddress>,
allowed_script_hashes: Vec<H160>,
inputs: Vec<AssetTransferInput>,
output: Box<AssetMintOutput>,

approvals: Vec<Signature>,
},
#[serde(rename_all = "camelCase")]
DecomposeAsset {
network_id: NetworkId,
input: Box<AssetTransferInput>,
outputs: Vec<AssetTransferOutput>,

approvals: Vec<Signature>,
},
#[serde(rename_all = "camelCase")]
UnwrapCCC {
network_id: NetworkId,
burn: AssetTransferInput,
Expand Down Expand Up @@ -207,31 +186,7 @@ pub enum ActionWithTracker {

tracker: H256,
},
#[serde(rename_all = "camelCase")]
ComposeAsset {
network_id: NetworkId,
shard_id: ShardId,
metadata: String,
approver: Option<PlatformAddress>,
registrar: Option<PlatformAddress>,
allowed_script_hashes: Vec<H160>,
inputs: Vec<AssetTransferInput>,
output: Box<AssetMintOutput>,

approvals: Vec<Signature>,

tracker: H256,
},
#[serde(rename_all = "camelCase")]
DecomposeAsset {
network_id: NetworkId,
input: Box<AssetTransferInput>,
outputs: Vec<AssetTransferOutput>,

approvals: Vec<Signature>,

tracker: H256,
},
#[serde(rename_all = "camelCase")]
UnwrapCCC {
network_id: NetworkId,
Expand Down Expand Up @@ -367,40 +322,6 @@ impl ActionWithTracker {
approvals,
tracker: tracker.unwrap(),
},
ActionType::ComposeAsset {
network_id,
shard_id,
metadata,
approver,
registrar,
allowed_script_hashes,
inputs,
output,
approvals,
} => ActionWithTracker::ComposeAsset {
network_id,
shard_id,
metadata,
approver: approver.map(|approver| PlatformAddress::new_v1(network_id, approver)),
registrar: registrar.map(|registrar| PlatformAddress::new_v1(network_id, registrar)),
allowed_script_hashes,
inputs: inputs.into_iter().map(From::from).collect(),
output: Box::new((*output).into()),
approvals,
tracker: tracker.unwrap(),
},
ActionType::DecomposeAsset {
network_id,
input,
outputs,
approvals,
} => ActionWithTracker::DecomposeAsset {
network_id,
input: Box::new(input.into()),
outputs: outputs.into_iter().map(From::from).collect(),
approvals,
tracker: tracker.unwrap(),
},
ActionType::UnwrapCCC {
network_id,
burn,
Expand Down Expand Up @@ -597,54 +518,6 @@ impl TryFrom<Action> for ActionType {
approvals,
}
}
Action::ComposeAsset {
network_id,
shard_id,
metadata,
approver,
registrar,
allowed_script_hashes,
inputs,
output,

approvals,
} => {
let approver = match approver {
Some(approver) => Some(approver.try_into_address()?),
None => None,
};
let registrar = match registrar {
Some(registrar) => Some(registrar.try_into_address()?),
None => None,
};
let output_content = AssetMintOutputType::try_from(*output)?;
ActionType::ComposeAsset {
network_id,
shard_id,
metadata,
approver,
registrar,
allowed_script_hashes,
inputs: inputs.into_iter().map(From::from).collect(),
output: Box::new(output_content),
approvals,
}
}
Action::DecomposeAsset {
network_id,
input,
outputs,

approvals,
} => {
let outputs = outputs.into_iter().map(TryFrom::try_from).collect::<Result<_, _>>()?;
ActionType::DecomposeAsset {
network_id,
input: (*input).into(),
outputs,
approvals,
}
}
Action::UnwrapCCC {
network_id,
burn,
Expand Down
Loading