@dashevo/token-history-contract 2.0.0-dev.1 → 2.0.0-rc.1

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 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-dev.1"
4
+ version = "2.0.0-rc.1"
5
5
  edition = "2021"
6
6
  rust-version.workspace = true
7
7
  license = "MIT"
8
8
 
9
9
  [dependencies]
10
- thiserror = "1.0.64"
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-dev.1",
3
+ "version": "2.0.0-rc.1",
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-dev.1",
19
+ "@dashevo/wasm-dpp": "2.0.0-rc.1",
20
20
  "chai": "^4.3.10",
21
21
  "dirty-chai": "^2.0.1",
22
22
  "eslint": "^8.53.0",
@@ -593,7 +593,10 @@
593
593
  },
594
594
  "distributionType": {
595
595
  "type": "integer",
596
- "minimum": 0,
596
+ "enum": [
597
+ 0,
598
+ 1
599
+ ],
597
600
  "description": "The type of distribution (0: PreProgrammed, 1: Perpetual)",
598
601
  "position": 3
599
602
  },
@@ -674,7 +677,7 @@
674
677
  0,
675
678
  1
676
679
  ],
677
- "description": "The action we are performing. 0 - Pause, 1 - Resume",
680
+ "description": "The action we are performing (0: Pause, 1: Resume)",
678
681
  "position": 1
679
682
  }
680
683
  },
@@ -756,5 +759,152 @@
756
759
  "$createdAtBlockHeight"
757
760
  ],
758
761
  "additionalProperties": false
762
+ },
763
+ "directPricing": {
764
+ "type": "object",
765
+ "documentsMutable": false,
766
+ "canBeDeleted": false,
767
+ "creationRestrictionMode": 2,
768
+ "indices": [
769
+ {
770
+ "name": "byDate",
771
+ "properties": [
772
+ {
773
+ "tokenId": "asc"
774
+ },
775
+ {
776
+ "$createdAt": "asc"
777
+ }
778
+ ]
779
+ }
780
+ ],
781
+ "properties": {
782
+ "tokenId": {
783
+ "type": "array",
784
+ "byteArray": true,
785
+ "minItems": 32,
786
+ "maxItems": 32,
787
+ "description": "The token ID",
788
+ "position": 0,
789
+ "contentMediaType": "application/x.dash.dpp.identifier"
790
+ },
791
+ "priceSchedule": {
792
+ "type": "array",
793
+ "byteArray": true,
794
+ "minItems": 1,
795
+ "maxItems": 2048,
796
+ "description": "The serialized price schedule for direct token purchases",
797
+ "position": 1
798
+ },
799
+ "note": {
800
+ "type": "string",
801
+ "maxLength": 2048,
802
+ "description": "An optional note explaining the pricing change",
803
+ "position": 2
804
+ }
805
+ },
806
+ "required": [
807
+ "tokenId",
808
+ "$createdAt",
809
+ "$createdAtBlockHeight"
810
+ ],
811
+ "additionalProperties": false
812
+ },
813
+ "directPurchase": {
814
+ "type": "object",
815
+ "documentsMutable": false,
816
+ "canBeDeleted": false,
817
+ "creationRestrictionMode": 2,
818
+ "indices": [
819
+ {
820
+ "name": "byDate",
821
+ "properties": [
822
+ {
823
+ "tokenId": "asc"
824
+ },
825
+ {
826
+ "$createdAt": "asc"
827
+ }
828
+ ]
829
+ },
830
+ {
831
+ "name": "byOwnerIdForToken",
832
+ "properties": [
833
+ {
834
+ "tokenId": "asc"
835
+ },
836
+ {
837
+ "$ownerId": "asc"
838
+ },
839
+ {
840
+ "$createdAt": "asc"
841
+ }
842
+ ]
843
+ },
844
+ {
845
+ "name": "byOwnerId",
846
+ "properties": [
847
+ {
848
+ "$ownerId": "asc"
849
+ },
850
+ {
851
+ "$createdAt": "asc"
852
+ }
853
+ ]
854
+ },
855
+ {
856
+ "name": "byPurchaseCost",
857
+ "properties": [
858
+ {
859
+ "purchaseCost": "asc"
860
+ }
861
+ ]
862
+ },
863
+ {
864
+ "name": "byTokenAmount",
865
+ "properties": [
866
+ {
867
+ "tokenId": "asc"
868
+ },
869
+ {
870
+ "tokenAmount": "asc"
871
+ },
872
+ {
873
+ "$createdAt": "asc"
874
+ }
875
+ ]
876
+ }
877
+ ],
878
+ "properties": {
879
+ "tokenId": {
880
+ "type": "array",
881
+ "byteArray": true,
882
+ "minItems": 32,
883
+ "maxItems": 32,
884
+ "description": "The token ID",
885
+ "position": 0,
886
+ "contentMediaType": "application/x.dash.dpp.identifier"
887
+ },
888
+ "tokenAmount": {
889
+ "type": "integer",
890
+ "minimum": 1,
891
+ "description": "The number of tokens purchased",
892
+ "position": 1
893
+ },
894
+ "purchaseCost": {
895
+ "type": "integer",
896
+ "minimum": 0,
897
+ "description": "The cost paid for the tokens in credits",
898
+ "position": 2
899
+ }
900
+ },
901
+ "required": [
902
+ "tokenId",
903
+ "tokenAmount",
904
+ "purchaseCost",
905
+ "$createdAt",
906
+ "$createdAtBlockHeight"
907
+ ],
908
+ "additionalProperties": false
759
909
  }
760
- }
910
+ }
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.withdrawals {
19
+ match platform_version.system_data_contracts.token_history {
20
20
  1 => Ok(None),
21
21
  version => Err(Error::UnknownVersionMismatch {
22
- method: "wallet_contract::load_definitions".to_string(),
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.withdrawals {
29
+ match platform_version.system_data_contracts.token_history {
30
30
  1 => v1::load_documents_schemas(),
31
31
  version => Err(Error::UnknownVersionMismatch {
32
- method: "wallet_contract::load_documents_schemas".to_string(),
32
+ method: "token_history_contract::load_documents_schemas".to_string(),
33
33
  known_versions: vec![1],
34
34
  received: version,
35
35
  }),