@dashevo/token-history-contract 2.0.0-dev.1 → 2.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +2 -2
- package/package.json +2 -2
- package/schema/v1/token-history-contract-documents.json +187 -12
- package/src/lib.rs +4 -4
package/Cargo.toml
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "token-history-contract"
|
|
3
3
|
description = "Token history data contract schema and tools"
|
|
4
|
-
version = "2.0.0-
|
|
4
|
+
version = "2.0.0-rc.10"
|
|
5
5
|
edition = "2021"
|
|
6
6
|
rust-version.workspace = true
|
|
7
7
|
license = "MIT"
|
|
8
8
|
|
|
9
9
|
[dependencies]
|
|
10
|
-
thiserror = "
|
|
10
|
+
thiserror = "2.0.12"
|
|
11
11
|
platform-version = { path = "../rs-platform-version" }
|
|
12
12
|
serde_json = { version = "1.0" }
|
|
13
13
|
platform-value = { path = "../rs-platform-value" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/token-history-contract",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.10",
|
|
4
4
|
"description": "The token history contract",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint .",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@dashevo/wasm-dpp": "2.0.0-
|
|
19
|
+
"@dashevo/wasm-dpp": "2.0.0-rc.10",
|
|
20
20
|
"chai": "^4.3.10",
|
|
21
21
|
"dirty-chai": "^2.0.1",
|
|
22
22
|
"eslint": "^8.53.0",
|
|
@@ -362,6 +362,12 @@
|
|
|
362
362
|
"description": "The identity Id of the frozen token account",
|
|
363
363
|
"position": 1,
|
|
364
364
|
"contentMediaType": "application/x.dash.dpp.identifier"
|
|
365
|
+
},
|
|
366
|
+
"note": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"maxLength": 2048,
|
|
369
|
+
"description": "An optional explanation for this identity freeze",
|
|
370
|
+
"position": 2
|
|
365
371
|
}
|
|
366
372
|
},
|
|
367
373
|
"required": [
|
|
@@ -425,6 +431,12 @@
|
|
|
425
431
|
"description": "The identity Id of the frozen token account",
|
|
426
432
|
"position": 1,
|
|
427
433
|
"contentMediaType": "application/x.dash.dpp.identifier"
|
|
434
|
+
},
|
|
435
|
+
"note": {
|
|
436
|
+
"type": "string",
|
|
437
|
+
"maxLength": 2048,
|
|
438
|
+
"description": "An optional explanation for this identity unfreeze",
|
|
439
|
+
"position": 2
|
|
428
440
|
}
|
|
429
441
|
},
|
|
430
442
|
"required": [
|
|
@@ -505,6 +517,12 @@
|
|
|
505
517
|
"minimum": 0,
|
|
506
518
|
"description": "The amount that was frost burned",
|
|
507
519
|
"position": 2
|
|
520
|
+
},
|
|
521
|
+
"note": {
|
|
522
|
+
"type": "string",
|
|
523
|
+
"maxLength": 2048,
|
|
524
|
+
"description": "An optional explanation for destroying these frozen funds",
|
|
525
|
+
"position": 3
|
|
508
526
|
}
|
|
509
527
|
},
|
|
510
528
|
"required": [
|
|
@@ -539,9 +557,6 @@
|
|
|
539
557
|
{
|
|
540
558
|
"tokenId": "asc"
|
|
541
559
|
},
|
|
542
|
-
{
|
|
543
|
-
"recipientType": "asc"
|
|
544
|
-
},
|
|
545
560
|
{
|
|
546
561
|
"recipientId": "asc"
|
|
547
562
|
},
|
|
@@ -551,16 +566,13 @@
|
|
|
551
566
|
]
|
|
552
567
|
},
|
|
553
568
|
{
|
|
554
|
-
"name": "
|
|
569
|
+
"name": "byAmount",
|
|
555
570
|
"properties": [
|
|
556
571
|
{
|
|
557
572
|
"tokenId": "asc"
|
|
558
573
|
},
|
|
559
574
|
{
|
|
560
|
-
"
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
"$createdAt": "asc"
|
|
575
|
+
"amount": "asc"
|
|
564
576
|
}
|
|
565
577
|
]
|
|
566
578
|
}
|
|
@@ -587,13 +599,16 @@
|
|
|
587
599
|
"byteArray": true,
|
|
588
600
|
"minItems": 32,
|
|
589
601
|
"maxItems": 32,
|
|
590
|
-
"description": "An
|
|
602
|
+
"description": "An identity ID for direct recipient distributions",
|
|
591
603
|
"contentMediaType": "application/x.dash.dpp.identifier",
|
|
592
604
|
"position": 2
|
|
593
605
|
},
|
|
594
606
|
"distributionType": {
|
|
595
607
|
"type": "integer",
|
|
596
|
-
"
|
|
608
|
+
"enum": [
|
|
609
|
+
0,
|
|
610
|
+
1
|
|
611
|
+
],
|
|
597
612
|
"description": "The type of distribution (0: PreProgrammed, 1: Perpetual)",
|
|
598
613
|
"position": 3
|
|
599
614
|
},
|
|
@@ -613,6 +628,7 @@
|
|
|
613
628
|
"required": [
|
|
614
629
|
"tokenId",
|
|
615
630
|
"recipientType",
|
|
631
|
+
"recipientId",
|
|
616
632
|
"distributionType",
|
|
617
633
|
"amount",
|
|
618
634
|
"$createdAt",
|
|
@@ -674,8 +690,14 @@
|
|
|
674
690
|
0,
|
|
675
691
|
1
|
|
676
692
|
],
|
|
677
|
-
"description": "The action we are performing
|
|
693
|
+
"description": "The action we are performing (0: Pause, 1: Resume)",
|
|
678
694
|
"position": 1
|
|
695
|
+
},
|
|
696
|
+
"note": {
|
|
697
|
+
"type": "string",
|
|
698
|
+
"maxLength": 2048,
|
|
699
|
+
"description": "An optional explanation for this emergency action",
|
|
700
|
+
"position": 2
|
|
679
701
|
}
|
|
680
702
|
},
|
|
681
703
|
"required": [
|
|
@@ -746,6 +768,12 @@
|
|
|
746
768
|
"minItems": 1,
|
|
747
769
|
"description": "The change item in serialized form",
|
|
748
770
|
"position": 2
|
|
771
|
+
},
|
|
772
|
+
"note": {
|
|
773
|
+
"type": "string",
|
|
774
|
+
"maxLength": 2048,
|
|
775
|
+
"description": "An optional explanation for this config update",
|
|
776
|
+
"position": 3
|
|
749
777
|
}
|
|
750
778
|
},
|
|
751
779
|
"required": [
|
|
@@ -756,5 +784,152 @@
|
|
|
756
784
|
"$createdAtBlockHeight"
|
|
757
785
|
],
|
|
758
786
|
"additionalProperties": false
|
|
787
|
+
},
|
|
788
|
+
"directPricing": {
|
|
789
|
+
"type": "object",
|
|
790
|
+
"documentsMutable": false,
|
|
791
|
+
"canBeDeleted": false,
|
|
792
|
+
"creationRestrictionMode": 2,
|
|
793
|
+
"indices": [
|
|
794
|
+
{
|
|
795
|
+
"name": "byDate",
|
|
796
|
+
"properties": [
|
|
797
|
+
{
|
|
798
|
+
"tokenId": "asc"
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
"$createdAt": "asc"
|
|
802
|
+
}
|
|
803
|
+
]
|
|
804
|
+
}
|
|
805
|
+
],
|
|
806
|
+
"properties": {
|
|
807
|
+
"tokenId": {
|
|
808
|
+
"type": "array",
|
|
809
|
+
"byteArray": true,
|
|
810
|
+
"minItems": 32,
|
|
811
|
+
"maxItems": 32,
|
|
812
|
+
"description": "The token ID",
|
|
813
|
+
"position": 0,
|
|
814
|
+
"contentMediaType": "application/x.dash.dpp.identifier"
|
|
815
|
+
},
|
|
816
|
+
"priceSchedule": {
|
|
817
|
+
"type": "array",
|
|
818
|
+
"byteArray": true,
|
|
819
|
+
"minItems": 1,
|
|
820
|
+
"maxItems": 2048,
|
|
821
|
+
"description": "The serialized price schedule for direct token purchases",
|
|
822
|
+
"position": 1
|
|
823
|
+
},
|
|
824
|
+
"note": {
|
|
825
|
+
"type": "string",
|
|
826
|
+
"maxLength": 2048,
|
|
827
|
+
"description": "An optional explanation for the pricing change",
|
|
828
|
+
"position": 2
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
"required": [
|
|
832
|
+
"tokenId",
|
|
833
|
+
"$createdAt",
|
|
834
|
+
"$createdAtBlockHeight"
|
|
835
|
+
],
|
|
836
|
+
"additionalProperties": false
|
|
837
|
+
},
|
|
838
|
+
"directPurchase": {
|
|
839
|
+
"type": "object",
|
|
840
|
+
"documentsMutable": false,
|
|
841
|
+
"canBeDeleted": false,
|
|
842
|
+
"creationRestrictionMode": 2,
|
|
843
|
+
"indices": [
|
|
844
|
+
{
|
|
845
|
+
"name": "byDate",
|
|
846
|
+
"properties": [
|
|
847
|
+
{
|
|
848
|
+
"tokenId": "asc"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
"$createdAt": "asc"
|
|
852
|
+
}
|
|
853
|
+
]
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"name": "byOwnerIdForToken",
|
|
857
|
+
"properties": [
|
|
858
|
+
{
|
|
859
|
+
"tokenId": "asc"
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
"$ownerId": "asc"
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
"$createdAt": "asc"
|
|
866
|
+
}
|
|
867
|
+
]
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
"name": "byOwnerId",
|
|
871
|
+
"properties": [
|
|
872
|
+
{
|
|
873
|
+
"$ownerId": "asc"
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"$createdAt": "asc"
|
|
877
|
+
}
|
|
878
|
+
]
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
"name": "byPurchaseCost",
|
|
882
|
+
"properties": [
|
|
883
|
+
{
|
|
884
|
+
"purchaseCost": "asc"
|
|
885
|
+
}
|
|
886
|
+
]
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"name": "byTokenAmount",
|
|
890
|
+
"properties": [
|
|
891
|
+
{
|
|
892
|
+
"tokenId": "asc"
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
"tokenAmount": "asc"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"$createdAt": "asc"
|
|
899
|
+
}
|
|
900
|
+
]
|
|
901
|
+
}
|
|
902
|
+
],
|
|
903
|
+
"properties": {
|
|
904
|
+
"tokenId": {
|
|
905
|
+
"type": "array",
|
|
906
|
+
"byteArray": true,
|
|
907
|
+
"minItems": 32,
|
|
908
|
+
"maxItems": 32,
|
|
909
|
+
"description": "The token ID",
|
|
910
|
+
"position": 0,
|
|
911
|
+
"contentMediaType": "application/x.dash.dpp.identifier"
|
|
912
|
+
},
|
|
913
|
+
"tokenAmount": {
|
|
914
|
+
"type": "integer",
|
|
915
|
+
"minimum": 1,
|
|
916
|
+
"description": "The number of tokens purchased",
|
|
917
|
+
"position": 1
|
|
918
|
+
},
|
|
919
|
+
"purchaseCost": {
|
|
920
|
+
"type": "integer",
|
|
921
|
+
"minimum": 0,
|
|
922
|
+
"description": "The cost paid for the tokens in credits",
|
|
923
|
+
"position": 2
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
"required": [
|
|
927
|
+
"tokenId",
|
|
928
|
+
"tokenAmount",
|
|
929
|
+
"purchaseCost",
|
|
930
|
+
"$createdAt",
|
|
931
|
+
"$createdAtBlockHeight"
|
|
932
|
+
],
|
|
933
|
+
"additionalProperties": false
|
|
759
934
|
}
|
|
760
|
-
}
|
|
935
|
+
}
|
package/src/lib.rs
CHANGED
|
@@ -16,20 +16,20 @@ pub const OWNER_ID_BYTES: [u8; 32] = [0; 32];
|
|
|
16
16
|
pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES));
|
|
17
17
|
pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES));
|
|
18
18
|
pub fn load_definitions(platform_version: &PlatformVersion) -> Result<Option<Value>, Error> {
|
|
19
|
-
match platform_version.system_data_contracts.
|
|
19
|
+
match platform_version.system_data_contracts.token_history {
|
|
20
20
|
1 => Ok(None),
|
|
21
21
|
version => Err(Error::UnknownVersionMismatch {
|
|
22
|
-
method: "
|
|
22
|
+
method: "token_history_contract::load_definitions".to_string(),
|
|
23
23
|
known_versions: vec![1],
|
|
24
24
|
received: version,
|
|
25
25
|
}),
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result<Value, Error> {
|
|
29
|
-
match platform_version.system_data_contracts.
|
|
29
|
+
match platform_version.system_data_contracts.token_history {
|
|
30
30
|
1 => v1::load_documents_schemas(),
|
|
31
31
|
version => Err(Error::UnknownVersionMismatch {
|
|
32
|
-
method: "
|
|
32
|
+
method: "token_history_contract::load_documents_schemas".to_string(),
|
|
33
33
|
known_versions: vec![1],
|
|
34
34
|
received: version,
|
|
35
35
|
}),
|