Skip to content

Commit 7717330

Browse files
authored
Merge pull request #9 from DeAccountSystems/develop
feat: implement secondary market
2 parents 66bc5bd + 104e029 commit 7717330

File tree

86 files changed

+6744
-4559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+6744
-4559
lines changed

Cargo.lock

Lines changed: 33 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ members = [
1313
"contracts/income-cell-type",
1414
"contracts/pre-account-cell-type",
1515
"contracts/proposal-cell-type",
16+
"contracts/account-sale-cell-type",
17+
"contracts/account-auction-cell-type",
1618
"tools/calculator",
1719
]
1820

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "account-auction-cell-type"
3+
version = "1.0.0"
4+
edition = "2018"
5+
6+
[features]
7+
dev = ["das-core/dev"]
8+
local = ["das-core/local"]
9+
testnet = ["das-core/testnet"]
10+
mainnet = ["das-core/mainnet"]
11+
12+
[dependencies]
13+
ckb-std = "0.7.1"
14+
das-map = { path = "../../libs/das-map" }
15+
das-core = { path = "../../libs/das-core", default-features = false }
16+
das-types = { path = "../../../das-types/rust", default-features = false }
17+
chrono = { version = "0.4", default-features = false }
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
use ckb_std::ckb_constants::Source;
2+
use das_core::{constants::*, debug, error::Error, util, witness_parser::WitnessesParser};
3+
4+
pub fn main() -> Result<(), Error> {
5+
debug!("====== Running account-auction-cell-type ======");
6+
let mut parser = WitnessesParser::new()?;
7+
let action_opt = parser.parse_action_with_params()?;
8+
if action_opt.is_none() {
9+
return Err(Error::ActionNotSupported);
10+
}
11+
12+
let (action_raw, _params_raw) = action_opt.unwrap();
13+
let action = action_raw.as_reader().raw_data();
14+
// let params = params_raw.iter().map(|param| param.as_reader()).collect::<Vec<_>>();
15+
16+
util::is_system_off(&mut parser)?;
17+
parser.parse_cell()?;
18+
19+
if action == b"start_account_auction"
20+
|| action == b"edit_account_auction"
21+
|| action == b"cancel_account_auction"
22+
|| action == b"bid_account_auction"
23+
|| action == b"confirm_account_auction"
24+
{
25+
// let timestamp = util::load_oracle_data(OracleCellType::Time)?;
26+
// let config_main_reader = parser.configs.main()?;
27+
// let config_secondary_market_reader = parser.configs.secondary_market()?;
28+
// let (input_auction_cell, output_auction_cell) = load_auction_cell()?;
29+
30+
if action == b"start_account_auction" {
31+
debug!("Route to start_account_auction action ...");
32+
} else if action == b"cancel_account_auction" {
33+
debug!("Route to cancel_account_auction action ...");
34+
} else if action == b"bid_account_auction" {
35+
debug!("Route to bid_account_auction action ...");
36+
} else if action == b"confirm_account_auction" {
37+
debug!("Route to confirm_account_auction action ...");
38+
}
39+
} else if action == b"force_recover_account_status" {
40+
util::require_type_script(
41+
&mut parser,
42+
TypeScript::AccountCellType,
43+
Source::Input,
44+
Error::InvalidTransactionStructure,
45+
)?;
46+
} else {
47+
return Err(Error::ActionNotSupported);
48+
}
49+
Ok(())
50+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//! Generated by capsule
2+
//!
3+
//! `main.rs` is used to define rust lang items and modules.
4+
//! See `entry.rs` for the `main` function.
5+
//! See `error.rs` for the `Error` type.
6+
7+
#![no_std]
8+
#![no_main]
9+
#![feature(lang_items)]
10+
#![feature(alloc_error_handler)]
11+
#![feature(panic_info_message)]
12+
13+
// define modules
14+
mod entry;
15+
16+
use ckb_std::default_alloc;
17+
18+
ckb_std::entry!(program_entry);
19+
default_alloc!();
20+
21+
/// program entry
22+
fn program_entry() -> i8 {
23+
// Call main function and return error code
24+
match entry::main() {
25+
Ok(_) => 0,
26+
Err(err) => err as i8,
27+
}
28+
}

contracts/account-cell-type/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "account-cell-type"
3-
version = "1.2.1"
3+
version = "1.3.1"
44
edition = "2018"
55

66
[features]

0 commit comments

Comments
 (0)