Skip to content

Commit fc488fa

Browse files
committed
[WIP] Remove order
1 parent 96f7f94 commit fc488fa

File tree

20 files changed

+30
-2158
lines changed

20 files changed

+30
-2158
lines changed

core/src/codechain_machine.rs

+1-16
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use ckey::Address;
1919
use cstate::{StateError, TopState, TopStateView};
2020
use ctypes::errors::{HistoryError, SyntaxError};
21-
use ctypes::transaction::{Action, AssetTransferInput, OrderOnTransfer, Timelock};
21+
use ctypes::transaction::{Action, AssetTransferInput, Timelock};
2222
use ctypes::{CommonParams, Header};
2323

2424
use crate::block::{ExecutedBlock, IsBlock};
@@ -79,7 +79,6 @@ impl CodeChainMachine {
7979
) -> Result<(), Error> {
8080
if let Action::TransferAsset {
8181
inputs,
82-
orders,
8382
expiration,
8483
..
8584
} = &tx.action
@@ -88,7 +87,6 @@ impl CodeChainMachine {
8887
if verify_timelock {
8988
Self::verify_transfer_timelock(inputs, header, client)?;
9089
}
91-
Self::verify_transfer_order_expired(orders, header)?;
9290
}
9391
// FIXME: Filter transactions.
9492
Ok(())
@@ -176,19 +174,6 @@ impl CodeChainMachine {
176174
Ok(())
177175
}
178176

179-
fn verify_transfer_order_expired(orders: &[OrderOnTransfer], header: &Header) -> Result<(), Error> {
180-
for order_tx in orders {
181-
if order_tx.order.expiration < header.timestamp() {
182-
return Err(HistoryError::OrderExpired {
183-
expiration: order_tx.order.expiration,
184-
timestamp: header.timestamp(),
185-
}
186-
.into())
187-
}
188-
}
189-
Ok(())
190-
}
191-
192177
pub fn min_cost(params: &CommonParams, action: &Action) -> u64 {
193178
match action {
194179
Action::MintAsset {

rpc/src/v1/impls/devel.rs

-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ where
174174
burns: vec![],
175175
inputs: $inputs,
176176
outputs: $outputs,
177-
orders: vec![],
178177
metadata: "".to_string(),
179178
approvals: vec![],
180179
expiration: None,

rpc/src/v1/types/action.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use primitives::{Bytes, H160, H256};
2424
use rustc_serialize::hex::{FromHex, ToHex};
2525

2626
use super::super::errors::ConversionError;
27-
use super::{AssetMintOutput, AssetTransferInput, AssetTransferOutput, OrderOnTransfer};
27+
use super::{AssetMintOutput, AssetTransferInput, AssetTransferOutput};
2828

2929
#[derive(Debug, Deserialize, PartialEq)]
3030
#[serde(rename_all = "camelCase", tag = "type")]
@@ -48,7 +48,6 @@ pub enum Action {
4848
burns: Vec<AssetTransferInput>,
4949
inputs: Vec<AssetTransferInput>,
5050
outputs: Vec<AssetTransferOutput>,
51-
orders: Vec<OrderOnTransfer>,
5251

5352
metadata: String,
5453
approvals: Vec<Signature>,
@@ -172,7 +171,6 @@ pub enum ActionWithTracker {
172171
burns: Vec<AssetTransferInput>,
173172
inputs: Vec<AssetTransferInput>,
174173
outputs: Vec<AssetTransferOutput>,
175-
orders: Vec<OrderOnTransfer>,
176174

177175
metadata: String,
178176
approvals: Vec<Signature>,
@@ -314,7 +312,6 @@ impl ActionWithTracker {
314312
burns,
315313
inputs,
316314
outputs,
317-
orders,
318315
metadata,
319316
approvals,
320317
expiration,
@@ -323,7 +320,6 @@ impl ActionWithTracker {
323320
burns: burns.into_iter().map(From::from).collect(),
324321
inputs: inputs.into_iter().map(From::from).collect(),
325322
outputs: outputs.into_iter().map(From::from).collect(),
326-
orders: orders.into_iter().map(From::from).collect(),
327323
metadata,
328324
approvals,
329325
expiration: expiration.map(From::from),
@@ -528,20 +524,17 @@ impl TryFrom<Action> for ActionType {
528524
burns,
529525
inputs,
530526
outputs,
531-
orders,
532527

533528
metadata,
534529
approvals,
535530
expiration,
536531
} => {
537532
let outputs = outputs.into_iter().map(TryFrom::try_from).collect::<Result<_, _>>()?;
538-
let orders = orders.into_iter().map(TryFrom::try_from).collect::<Result<_, _>>()?;
539533
ActionType::TransferAsset {
540534
network_id,
541535
burns: burns.into_iter().map(From::from).collect(),
542536
inputs: inputs.into_iter().map(From::from).collect(),
543537
outputs,
544-
orders,
545538
metadata,
546539
approvals,
547540
expiration: expiration.map(From::from),

rpc/src/v1/types/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ mod asset_input;
2020
mod asset_output;
2121
mod asset_scheme;
2222
mod block;
23-
mod order;
2423
mod text;
2524
mod transaction;
2625
mod unsigned_transaction;
@@ -31,7 +30,6 @@ use primitives::H256;
3130
use self::asset::Asset;
3231
use self::asset_input::{AssetOutPoint, AssetTransferInput};
3332
use self::asset_output::{AssetMintOutput, AssetTransferOutput};
34-
use self::order::OrderOnTransfer;
3533

3634
pub use self::action::{Action, ActionWithTracker};
3735
pub use self::asset::OwnedAsset;

rpc/src/v1/types/order.rs

-144
This file was deleted.

spec/Asset-Exchange-Protocol.md

-75
This file was deleted.

0 commit comments

Comments
 (0)