diff --git a/Cargo.lock b/Cargo.lock index 931aca08..c24a53ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2901,6 +2901,7 @@ dependencies = [ "test_helpers", "token", "traceable_result", + "uint", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6fbdf298..2468008c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ ink = { version = "5.0.0", default-features = false } token = { path = "src/token", default-features = false, features = [ "ink-as-dependency", ] } +uint = {version = "0.9.5", default-features = false} [dev-dependencies] ink_e2e = "5.0.0" @@ -25,7 +26,7 @@ path = "src/lib.rs" [features] default = ["std"] -std = ["ink/std", "token/std"] +std = ["ink/std", "token/std", "uint/std"] ink-as-dependency = [] e2e-tests = [] diff --git a/sdk/contracts/invariant/invariant.json b/sdk/contracts/invariant/invariant.json index 8939d7fe..5f4ff477 100644 --- a/sdk/contracts/invariant/invariant.json +++ b/sdk/contracts/invariant/invariant.json @@ -1,6 +1,6 @@ { "source": { - "hash": "0x86f442ed070586bbb8157cda6fdc259b84f953e62727d779806988f81937cd1f", + "hash": "0xe5065094388665399a5388d0b73d0cfca82ffc9680284fcef1eeb053d5a4591f", "language": "ink! 5.0.0", "compiler": "rustc 1.77.0", "build_info": { @@ -33,6 +33,15 @@ ], "type": 18 } + }, + { + "label": "poc_field", + "type": { + "displayName": [ + "PocType" + ], + "type": 54 + } } ], "default": false, @@ -44,7 +53,7 @@ "ink_primitives", "ConstructorResult" ], - "type": 54 + "type": 57 }, "selector": "0x9bae9d5e" } @@ -73,13 +82,13 @@ "displayName": [ "ChainExtension" ], - "type": 113 + "type": 116 }, "hash": { "displayName": [ "Hash" ], - "type": 112 + "type": 115 }, "maxEventTopics": 4, "staticBufferSize": 16384, @@ -219,7 +228,7 @@ "displayName": [ "Vec" ], - "type": 103 + "type": 106 } } ], @@ -481,7 +490,7 @@ "displayName": [ "Option" ], - "type": 111 + "type": 114 } }, { @@ -494,7 +503,7 @@ "displayName": [ "Option" ], - "type": 111 + "type": 114 } }, { @@ -524,7 +533,7 @@ "ink", "LangError" ], - "type": 55 + "type": 58 }, "messages": [ { @@ -539,7 +548,7 @@ "ink", "MessageResult" ], - "type": 56 + "type": 59 }, "selector": "0xe285b69a" }, @@ -565,7 +574,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x5a059796" }, @@ -591,7 +600,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0xc8bd0f58" }, @@ -626,7 +635,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x0ebd3ec6" }, @@ -697,7 +706,7 @@ "ink", "MessageResult" ], - "type": 60 + "type": 63 }, "selector": "0x0a1ca76b" }, @@ -759,7 +768,7 @@ "ink", "MessageResult" ], - "type": 62 + "type": 65 }, "selector": "0x1c590004" }, @@ -798,7 +807,7 @@ "displayName": [ "Vec" ], - "type": 66 + "type": 69 } } ], @@ -812,7 +821,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x5ff8d655" }, @@ -874,7 +883,7 @@ "ink", "MessageResult" ], - "type": 68 + "type": 71 }, "selector": "0xa2bd3fc7" }, @@ -895,7 +904,7 @@ "displayName": [ "Vec" ], - "type": 66 + "type": 69 } } ], @@ -909,7 +918,7 @@ "ink", "MessageResult" ], - "type": 71 + "type": 74 }, "selector": "0x879b5256" }, @@ -944,7 +953,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0xe5af145a" }, @@ -979,7 +988,7 @@ "ink", "MessageResult" ], - "type": 60 + "type": 63 }, "selector": "0xccb84930" }, @@ -1005,7 +1014,7 @@ "ink", "MessageResult" ], - "type": 73 + "type": 76 }, "selector": "0xa509d69f" }, @@ -1049,7 +1058,7 @@ "ink", "MessageResult" ], - "type": 75 + "type": 78 }, "selector": "0xb2155f6b" }, @@ -1075,7 +1084,7 @@ "ink", "MessageResult" ], - "type": 80 + "type": 83 }, "selector": "0x4eb580e1" }, @@ -1101,7 +1110,7 @@ "ink", "MessageResult" ], - "type": 80 + "type": 83 }, "selector": "0xfe63d239" }, @@ -1127,7 +1136,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x009b6a3d" }, @@ -1153,7 +1162,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x3b497d6e" }, @@ -1179,7 +1188,7 @@ "ink", "MessageResult" ], - "type": 83 + "type": 86 }, "selector": "0x4e9e07ce" }, @@ -1241,7 +1250,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x98b595e9" }, @@ -1285,7 +1294,7 @@ "ink", "MessageResult" ], - "type": 84 + "type": 87 }, "selector": "0xf91e4a49" }, @@ -1320,7 +1329,7 @@ "ink", "MessageResult" ], - "type": 86 + "type": 89 }, "selector": "0xb62aa10d" }, @@ -1355,7 +1364,7 @@ "ink", "MessageResult" ], - "type": 90 + "type": 93 }, "selector": "0xeebd620b" }, @@ -1390,7 +1399,7 @@ "ink", "MessageResult" ], - "type": 83 + "type": 86 }, "selector": "0xdbae15e5" }, @@ -1425,7 +1434,7 @@ "ink", "MessageResult" ], - "type": 92 + "type": 95 }, "selector": "0x6dd2d776" }, @@ -1441,7 +1450,7 @@ "ink", "MessageResult" ], - "type": 96 + "type": 99 }, "selector": "0xd05b6003" }, @@ -1476,7 +1485,7 @@ "ink", "MessageResult" ], - "type": 97 + "type": 100 }, "selector": "0xcc9476e7" }, @@ -1529,7 +1538,7 @@ "ink", "MessageResult" ], - "type": 100 + "type": 103 }, "selector": "0x3b83b256" }, @@ -1550,7 +1559,7 @@ "displayName": [ "Vec" ], - "type": 103 + "type": 106 } } ], @@ -1564,7 +1573,7 @@ "ink", "MessageResult" ], - "type": 104 + "type": 107 }, "selector": "0x8ef8d345" }, @@ -1590,7 +1599,7 @@ "ink", "MessageResult" ], - "type": 108 + "type": 111 }, "selector": "0xd842f034" }, @@ -1634,7 +1643,7 @@ "ink", "MessageResult" ], - "type": 109 + "type": 112 }, "selector": "0xf360dea7" }, @@ -1660,7 +1669,7 @@ "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x06099ca3" } @@ -2405,6 +2414,41 @@ } }, "name": "protocol_fee" + }, + { + "layout": { + "struct": { + "fields": [ + { + "layout": { + "struct": { + "fields": [ + { + "layout": { + "array": { + "layout": { + "leaf": { + "key": "0x00000000", + "ty": 9 + } + }, + "len": 4, + "offset": "0x00000000" + } + }, + "name": "0" + } + ], + "name": "U256T" + } + }, + "name": "0" + } + ], + "name": "PocType" + } + }, + "name": "poc_field" } ], "name": "InvariantConfig" @@ -3641,6 +3685,11 @@ "name": "protocol_fee", "type": 18, "typeName": ",>>::Type" + }, + { + "name": "poc_field", + "type": 54, + "typeName": ",>>::Type" } ] } @@ -3656,6 +3705,61 @@ }, { "id": 54, + "type": { + "def": { + "composite": { + "fields": [ + { + "type": 55, + "typeName": "U256T" + } + ] + } + }, + "path": [ + "invariant", + "contracts", + "storage", + "invariant_config", + "PocType" + ] + } + }, + { + "id": 55, + "type": { + "def": { + "composite": { + "fields": [ + { + "type": 56, + "typeName": "[u64; 4]" + } + ] + } + }, + "path": [ + "invariant", + "contracts", + "storage", + "invariant_config", + "U256T" + ] + } + }, + { + "id": 56, + "type": { + "def": { + "array": { + "len": 4, + "type": 9 + } + } + } + }, + { + "id": 57, "type": { "def": { "variant": { @@ -3672,7 +3776,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -3688,7 +3792,7 @@ }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -3697,7 +3801,7 @@ } }, { - "id": 55, + "id": 58, "type": { "def": { "variant": { @@ -3716,7 +3820,7 @@ } }, { - "id": 56, + "id": 59, "type": { "def": { "variant": { @@ -3724,7 +3828,7 @@ { "fields": [ { - "type": 18 + "type": 54 } ], "index": 0, @@ -3733,7 +3837,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -3745,11 +3849,11 @@ "params": [ { "name": "T", - "type": 18 + "type": 54 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -3758,7 +3862,7 @@ } }, { - "id": 57, + "id": 60, "type": { "def": { "variant": { @@ -3766,7 +3870,7 @@ { "fields": [ { - "type": 58 + "type": 61 } ], "index": 0, @@ -3775,7 +3879,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -3787,11 +3891,11 @@ "params": [ { "name": "T", - "type": 58 + "type": 61 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -3800,7 +3904,7 @@ } }, { - "id": 58, + "id": 61, "type": { "def": { "variant": { @@ -3817,7 +3921,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -3833,7 +3937,7 @@ }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -3842,7 +3946,7 @@ } }, { - "id": 59, + "id": 62, "type": { "def": { "variant": { @@ -4015,7 +4119,7 @@ } }, { - "id": 60, + "id": 63, "type": { "def": { "variant": { @@ -4023,7 +4127,7 @@ { "fields": [ { - "type": 61 + "type": 64 } ], "index": 0, @@ -4032,7 +4136,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4044,11 +4148,11 @@ "params": [ { "name": "T", - "type": 61 + "type": 64 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4057,7 +4161,7 @@ } }, { - "id": 61, + "id": 64, "type": { "def": { "variant": { @@ -4074,7 +4178,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4090,7 +4194,7 @@ }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4099,7 +4203,7 @@ } }, { - "id": 62, + "id": 65, "type": { "def": { "variant": { @@ -4107,7 +4211,7 @@ { "fields": [ { - "type": 63 + "type": 66 } ], "index": 0, @@ -4116,7 +4220,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4128,11 +4232,11 @@ "params": [ { "name": "T", - "type": 63 + "type": 66 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4141,7 +4245,7 @@ } }, { - "id": 63, + "id": 66, "type": { "def": { "variant": { @@ -4149,7 +4253,7 @@ { "fields": [ { - "type": 64 + "type": 67 } ], "index": 0, @@ -4158,7 +4262,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4170,11 +4274,11 @@ "params": [ { "name": "T", - "type": 64 + "type": 67 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4183,7 +4287,7 @@ } }, { - "id": 64, + "id": 67, "type": { "def": { "composite": { @@ -4220,7 +4324,7 @@ }, { "name": "ticks", - "type": 65, + "type": 68, "typeName": "Vec" } ] @@ -4235,7 +4339,7 @@ } }, { - "id": 65, + "id": 68, "type": { "def": { "sequence": { @@ -4245,17 +4349,17 @@ } }, { - "id": 66, + "id": 69, "type": { "def": { "sequence": { - "type": 67 + "type": 70 } } } }, { - "id": 67, + "id": 70, "type": { "def": { "composite": { @@ -4282,7 +4386,7 @@ } }, { - "id": 68, + "id": 71, "type": { "def": { "variant": { @@ -4290,7 +4394,7 @@ { "fields": [ { - "type": 69 + "type": 72 } ], "index": 0, @@ -4299,7 +4403,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4311,11 +4415,11 @@ "params": [ { "name": "T", - "type": 69 + "type": 72 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4324,7 +4428,7 @@ } }, { - "id": 69, + "id": 72, "type": { "def": { "variant": { @@ -4332,7 +4436,7 @@ { "fields": [ { - "type": 70 + "type": 73 } ], "index": 0, @@ -4341,7 +4445,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4353,11 +4457,11 @@ "params": [ { "name": "T", - "type": 70 + "type": 73 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4366,7 +4470,7 @@ } }, { - "id": 70, + "id": 73, "type": { "def": { "composite": { @@ -4388,7 +4492,7 @@ }, { "name": "ticks", - "type": 65, + "type": 68, "typeName": "Vec" } ] @@ -4403,7 +4507,7 @@ } }, { - "id": 71, + "id": 74, "type": { "def": { "variant": { @@ -4411,7 +4515,7 @@ { "fields": [ { - "type": 72 + "type": 75 } ], "index": 0, @@ -4420,7 +4524,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4432,11 +4536,11 @@ "params": [ { "name": "T", - "type": 72 + "type": 75 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4445,7 +4549,7 @@ } }, { - "id": 72, + "id": 75, "type": { "def": { "variant": { @@ -4462,7 +4566,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4478,7 +4582,7 @@ }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4487,7 +4591,7 @@ } }, { - "id": 73, + "id": 76, "type": { "def": { "variant": { @@ -4495,7 +4599,7 @@ { "fields": [ { - "type": 74 + "type": 77 } ], "index": 0, @@ -4504,7 +4608,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4516,11 +4620,11 @@ "params": [ { "name": "T", - "type": 74 + "type": 77 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4529,7 +4633,7 @@ } }, { - "id": 74, + "id": 77, "type": { "def": { "sequence": { @@ -4539,7 +4643,7 @@ } }, { - "id": 75, + "id": 78, "type": { "def": { "variant": { @@ -4547,7 +4651,7 @@ { "fields": [ { - "type": 76 + "type": 79 } ], "index": 0, @@ -4556,7 +4660,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4568,11 +4672,11 @@ "params": [ { "name": "T", - "type": 76 + "type": 79 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4581,7 +4685,7 @@ } }, { - "id": 76, + "id": 79, "type": { "def": { "variant": { @@ -4589,7 +4693,7 @@ { "fields": [ { - "type": 77 + "type": 80 } ], "index": 0, @@ -4598,7 +4702,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4610,11 +4714,11 @@ "params": [ { "name": "T", - "type": 77 + "type": 80 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4623,28 +4727,28 @@ } }, { - "id": 77, + "id": 80, "type": { "def": { "tuple": [ - 78, + 81, 0 ] } } }, { - "id": 78, + "id": 81, "type": { "def": { "sequence": { - "type": 79 + "type": 82 } } } }, { - "id": 79, + "id": 82, "type": { "def": { "tuple": [ @@ -4657,7 +4761,7 @@ } }, { - "id": 80, + "id": 83, "type": { "def": { "variant": { @@ -4665,7 +4769,7 @@ { "fields": [ { - "type": 81 + "type": 84 } ], "index": 0, @@ -4674,7 +4778,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4686,11 +4790,11 @@ "params": [ { "name": "T", - "type": 81 + "type": 84 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4699,7 +4803,7 @@ } }, { - "id": 81, + "id": 84, "type": { "def": { "variant": { @@ -4707,7 +4811,7 @@ { "fields": [ { - "type": 82 + "type": 85 } ], "index": 0, @@ -4716,7 +4820,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4728,11 +4832,11 @@ "params": [ { "name": "T", - "type": 82 + "type": 85 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4741,7 +4845,7 @@ } }, { - "id": 82, + "id": 85, "type": { "def": { "tuple": [ @@ -4752,7 +4856,7 @@ } }, { - "id": 83, + "id": 86, "type": { "def": { "variant": { @@ -4769,7 +4873,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4785,7 +4889,7 @@ }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4794,7 +4898,7 @@ } }, { - "id": 84, + "id": 87, "type": { "def": { "variant": { @@ -4802,7 +4906,7 @@ { "fields": [ { - "type": 85 + "type": 88 } ], "index": 0, @@ -4811,7 +4915,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4823,11 +4927,11 @@ "params": [ { "name": "T", - "type": 85 + "type": 88 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4836,7 +4940,7 @@ } }, { - "id": 85, + "id": 88, "type": { "def": { "variant": { @@ -4853,7 +4957,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4869,7 +4973,7 @@ }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4878,7 +4982,7 @@ } }, { - "id": 86, + "id": 89, "type": { "def": { "variant": { @@ -4886,7 +4990,7 @@ { "fields": [ { - "type": 87 + "type": 90 } ], "index": 0, @@ -4895,7 +4999,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4907,11 +5011,11 @@ "params": [ { "name": "T", - "type": 87 + "type": 90 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4920,7 +5024,7 @@ } }, { - "id": 87, + "id": 90, "type": { "def": { "variant": { @@ -4928,7 +5032,7 @@ { "fields": [ { - "type": 88 + "type": 91 } ], "index": 0, @@ -4937,7 +5041,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4949,11 +5053,11 @@ "params": [ { "name": "T", - "type": 88 + "type": 91 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4962,17 +5066,17 @@ } }, { - "id": 88, + "id": 91, "type": { "def": { "sequence": { - "type": 89 + "type": 92 } } } }, { - "id": 89, + "id": 92, "type": { "def": { "tuple": [ @@ -4983,7 +5087,7 @@ } }, { - "id": 90, + "id": 93, "type": { "def": { "variant": { @@ -4991,7 +5095,7 @@ { "fields": [ { - "type": 91 + "type": 94 } ], "index": 0, @@ -5000,7 +5104,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5012,11 +5116,11 @@ "params": [ { "name": "T", - "type": 91 + "type": 94 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5025,7 +5129,7 @@ } }, { - "id": 91, + "id": 94, "type": { "def": { "variant": { @@ -5042,7 +5146,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -5058,7 +5162,7 @@ }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -5067,7 +5171,7 @@ } }, { - "id": 92, + "id": 95, "type": { "def": { "variant": { @@ -5075,7 +5179,7 @@ { "fields": [ { - "type": 93 + "type": 96 } ], "index": 0, @@ -5084,7 +5188,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5096,11 +5200,11 @@ "params": [ { "name": "T", - "type": 93 + "type": 96 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5109,7 +5213,7 @@ } }, { - "id": 93, + "id": 96, "type": { "def": { "variant": { @@ -5117,7 +5221,7 @@ { "fields": [ { - "type": 94 + "type": 97 } ], "index": 0, @@ -5126,7 +5230,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -5138,11 +5242,11 @@ "params": [ { "name": "T", - "type": 94 + "type": 97 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -5151,18 +5255,18 @@ } }, { - "id": 94, + "id": 97, "type": { "def": { "tuple": [ - 95, + 98, 10 ] } } }, { - "id": 95, + "id": 98, "type": { "def": { "sequence": { @@ -5172,7 +5276,7 @@ } }, { - "id": 96, + "id": 99, "type": { "def": { "variant": { @@ -5189,7 +5293,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5205,7 +5309,7 @@ }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5214,7 +5318,7 @@ } }, { - "id": 97, + "id": 100, "type": { "def": { "variant": { @@ -5222,7 +5326,7 @@ { "fields": [ { - "type": 98 + "type": 101 } ], "index": 0, @@ -5231,7 +5335,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5243,11 +5347,11 @@ "params": [ { "name": "T", - "type": 98 + "type": 101 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5256,17 +5360,17 @@ } }, { - "id": 98, + "id": 101, "type": { "def": { "sequence": { - "type": 99 + "type": 102 } } } }, { - "id": 99, + "id": 102, "type": { "def": { "composite": { @@ -5304,7 +5408,7 @@ } }, { - "id": 100, + "id": 103, "type": { "def": { "variant": { @@ -5312,7 +5416,7 @@ { "fields": [ { - "type": 101 + "type": 104 } ], "index": 0, @@ -5321,7 +5425,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5333,11 +5437,11 @@ "params": [ { "name": "T", - "type": 101 + "type": 104 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5346,17 +5450,17 @@ } }, { - "id": 101, + "id": 104, "type": { "def": { "sequence": { - "type": 102 + "type": 105 } } } }, { - "id": 102, + "id": 105, "type": { "def": { "tuple": [ @@ -5367,7 +5471,7 @@ } }, { - "id": 103, + "id": 106, "type": { "def": { "sequence": { @@ -5377,7 +5481,7 @@ } }, { - "id": 104, + "id": 107, "type": { "def": { "variant": { @@ -5385,7 +5489,7 @@ { "fields": [ { - "type": 105 + "type": 108 } ], "index": 0, @@ -5394,7 +5498,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5406,11 +5510,11 @@ "params": [ { "name": "T", - "type": 105 + "type": 108 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5419,7 +5523,7 @@ } }, { - "id": 105, + "id": 108, "type": { "def": { "variant": { @@ -5427,7 +5531,7 @@ { "fields": [ { - "type": 106 + "type": 109 } ], "index": 0, @@ -5436,7 +5540,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -5448,11 +5552,11 @@ "params": [ { "name": "T", - "type": 106 + "type": 109 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -5461,17 +5565,17 @@ } }, { - "id": 106, + "id": 109, "type": { "def": { "sequence": { - "type": 107 + "type": 110 } } } }, { - "id": 107, + "id": 110, "type": { "def": { "composite": { @@ -5504,7 +5608,7 @@ } }, { - "id": 108, + "id": 111, "type": { "def": { "variant": { @@ -5521,7 +5625,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5537,7 +5641,7 @@ }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5546,7 +5650,7 @@ } }, { - "id": 109, + "id": 112, "type": { "def": { "variant": { @@ -5554,7 +5658,7 @@ { "fields": [ { - "type": 110 + "type": 113 } ], "index": 0, @@ -5563,7 +5667,7 @@ { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5575,11 +5679,11 @@ "params": [ { "name": "T", - "type": 110 + "type": 113 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5588,7 +5692,7 @@ } }, { - "id": 110, + "id": 113, "type": { "def": { "variant": { @@ -5605,7 +5709,7 @@ { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -5621,7 +5725,7 @@ }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -5630,7 +5734,7 @@ } }, { - "id": 111, + "id": 114, "type": { "def": { "variant": { @@ -5663,7 +5767,7 @@ } }, { - "id": 112, + "id": 115, "type": { "def": { "composite": { @@ -5683,7 +5787,7 @@ } }, { - "id": 113, + "id": 116, "type": { "def": { "variant": {} diff --git a/sdk/contracts/invariant/invariant.wasm b/sdk/contracts/invariant/invariant.wasm index 98751cd2..29ef3405 100644 Binary files a/sdk/contracts/invariant/invariant.wasm and b/sdk/contracts/invariant/invariant.wasm differ diff --git a/sdk/contracts/psp22/psp22.json b/sdk/contracts/psp22/psp22.json index 9d94e68b..e812d7ef 100644 --- a/sdk/contracts/psp22/psp22.json +++ b/sdk/contracts/psp22/psp22.json @@ -1,6 +1,6 @@ { "source": { - "hash": "0xb4082b7d4aedb8479925aa96a383ea722dc1a7e9b29ad5a4d5f95ad707db4e09", + "hash": "0xb4a6778b80073e24c68d7aafad474beed429019761b4e2ba5786359aede38ed7", "language": "ink! 5.0.0", "compiler": "rustc 1.77.0", "build_info": { diff --git a/sdk/contracts/psp22/psp22.wasm b/sdk/contracts/psp22/psp22.wasm index f4950a15..1cfb90c9 100644 Binary files a/sdk/contracts/psp22/psp22.wasm and b/sdk/contracts/psp22/psp22.wasm differ diff --git a/sdk/src/abis/invariant.ts b/sdk/src/abis/invariant.ts index 164539be..896d139b 100644 --- a/sdk/src/abis/invariant.ts +++ b/sdk/src/abis/invariant.ts @@ -1,7 +1,7 @@ export const abi = ` { "source": { - "hash": "0x86f442ed070586bbb8157cda6fdc259b84f953e62727d779806988f81937cd1f", + "hash": "0xe5065094388665399a5388d0b73d0cfca82ffc9680284fcef1eeb053d5a4591f", "language": "ink! 5.0.0", "compiler": "rustc 1.77.0", "build_info": { @@ -34,6 +34,15 @@ export const abi = ` ], "type": 18 } + }, + { + "label": "poc_field", + "type": { + "displayName": [ + "PocType" + ], + "type": 54 + } } ], "default": false, @@ -45,7 +54,7 @@ export const abi = ` "ink_primitives", "ConstructorResult" ], - "type": 54 + "type": 57 }, "selector": "0x9bae9d5e" } @@ -74,13 +83,13 @@ export const abi = ` "displayName": [ "ChainExtension" ], - "type": 113 + "type": 116 }, "hash": { "displayName": [ "Hash" ], - "type": 112 + "type": 115 }, "maxEventTopics": 4, "staticBufferSize": 16384, @@ -220,7 +229,7 @@ export const abi = ` "displayName": [ "Vec" ], - "type": 103 + "type": 106 } } ], @@ -482,7 +491,7 @@ export const abi = ` "displayName": [ "Option" ], - "type": 111 + "type": 114 } }, { @@ -495,7 +504,7 @@ export const abi = ` "displayName": [ "Option" ], - "type": 111 + "type": 114 } }, { @@ -525,7 +534,7 @@ export const abi = ` "ink", "LangError" ], - "type": 55 + "type": 58 }, "messages": [ { @@ -540,7 +549,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 56 + "type": 59 }, "selector": "0xe285b69a" }, @@ -566,7 +575,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x5a059796" }, @@ -592,7 +601,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0xc8bd0f58" }, @@ -627,7 +636,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x0ebd3ec6" }, @@ -698,7 +707,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 60 + "type": 63 }, "selector": "0x0a1ca76b" }, @@ -760,7 +769,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 62 + "type": 65 }, "selector": "0x1c590004" }, @@ -799,7 +808,7 @@ export const abi = ` "displayName": [ "Vec" ], - "type": 66 + "type": 69 } } ], @@ -813,7 +822,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x5ff8d655" }, @@ -875,7 +884,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 68 + "type": 71 }, "selector": "0xa2bd3fc7" }, @@ -896,7 +905,7 @@ export const abi = ` "displayName": [ "Vec" ], - "type": 66 + "type": 69 } } ], @@ -910,7 +919,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 71 + "type": 74 }, "selector": "0x879b5256" }, @@ -945,7 +954,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0xe5af145a" }, @@ -980,7 +989,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 60 + "type": 63 }, "selector": "0xccb84930" }, @@ -1006,7 +1015,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 73 + "type": 76 }, "selector": "0xa509d69f" }, @@ -1050,7 +1059,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 75 + "type": 78 }, "selector": "0xb2155f6b" }, @@ -1076,7 +1085,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 80 + "type": 83 }, "selector": "0x4eb580e1" }, @@ -1102,7 +1111,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 80 + "type": 83 }, "selector": "0xfe63d239" }, @@ -1128,7 +1137,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x009b6a3d" }, @@ -1154,7 +1163,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x3b497d6e" }, @@ -1180,7 +1189,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 83 + "type": 86 }, "selector": "0x4e9e07ce" }, @@ -1242,7 +1251,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x98b595e9" }, @@ -1286,7 +1295,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 84 + "type": 87 }, "selector": "0xf91e4a49" }, @@ -1321,7 +1330,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 86 + "type": 89 }, "selector": "0xb62aa10d" }, @@ -1356,7 +1365,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 90 + "type": 93 }, "selector": "0xeebd620b" }, @@ -1391,7 +1400,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 83 + "type": 86 }, "selector": "0xdbae15e5" }, @@ -1426,7 +1435,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 92 + "type": 95 }, "selector": "0x6dd2d776" }, @@ -1442,7 +1451,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 96 + "type": 99 }, "selector": "0xd05b6003" }, @@ -1477,7 +1486,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 97 + "type": 100 }, "selector": "0xcc9476e7" }, @@ -1530,7 +1539,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 100 + "type": 103 }, "selector": "0x3b83b256" }, @@ -1551,7 +1560,7 @@ export const abi = ` "displayName": [ "Vec" ], - "type": 103 + "type": 106 } } ], @@ -1565,7 +1574,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 104 + "type": 107 }, "selector": "0x8ef8d345" }, @@ -1591,7 +1600,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 108 + "type": 111 }, "selector": "0xd842f034" }, @@ -1635,7 +1644,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 109 + "type": 112 }, "selector": "0xf360dea7" }, @@ -1661,7 +1670,7 @@ export const abi = ` "ink", "MessageResult" ], - "type": 57 + "type": 60 }, "selector": "0x06099ca3" } @@ -2406,6 +2415,41 @@ export const abi = ` } }, "name": "protocol_fee" + }, + { + "layout": { + "struct": { + "fields": [ + { + "layout": { + "struct": { + "fields": [ + { + "layout": { + "array": { + "layout": { + "leaf": { + "key": "0x00000000", + "ty": 9 + } + }, + "len": 4, + "offset": "0x00000000" + } + }, + "name": "0" + } + ], + "name": "U256T" + } + }, + "name": "0" + } + ], + "name": "PocType" + } + }, + "name": "poc_field" } ], "name": "InvariantConfig" @@ -3642,6 +3686,11 @@ export const abi = ` "name": "protocol_fee", "type": 18, "typeName": ",>>::Type" + }, + { + "name": "poc_field", + "type": 54, + "typeName": ",>>::Type" } ] } @@ -3657,6 +3706,61 @@ export const abi = ` }, { "id": 54, + "type": { + "def": { + "composite": { + "fields": [ + { + "type": 55, + "typeName": "U256T" + } + ] + } + }, + "path": [ + "invariant", + "contracts", + "storage", + "invariant_config", + "PocType" + ] + } + }, + { + "id": 55, + "type": { + "def": { + "composite": { + "fields": [ + { + "type": 56, + "typeName": "[u64; 4]" + } + ] + } + }, + "path": [ + "invariant", + "contracts", + "storage", + "invariant_config", + "U256T" + ] + } + }, + { + "id": 56, + "type": { + "def": { + "array": { + "len": 4, + "type": 9 + } + } + } + }, + { + "id": 57, "type": { "def": { "variant": { @@ -3673,7 +3777,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -3689,7 +3793,7 @@ export const abi = ` }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -3698,7 +3802,7 @@ export const abi = ` } }, { - "id": 55, + "id": 58, "type": { "def": { "variant": { @@ -3717,7 +3821,7 @@ export const abi = ` } }, { - "id": 56, + "id": 59, "type": { "def": { "variant": { @@ -3725,7 +3829,7 @@ export const abi = ` { "fields": [ { - "type": 18 + "type": 54 } ], "index": 0, @@ -3734,7 +3838,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -3746,11 +3850,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 18 + "type": 54 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -3759,7 +3863,7 @@ export const abi = ` } }, { - "id": 57, + "id": 60, "type": { "def": { "variant": { @@ -3767,7 +3871,7 @@ export const abi = ` { "fields": [ { - "type": 58 + "type": 61 } ], "index": 0, @@ -3776,7 +3880,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -3788,11 +3892,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 58 + "type": 61 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -3801,7 +3905,7 @@ export const abi = ` } }, { - "id": 58, + "id": 61, "type": { "def": { "variant": { @@ -3818,7 +3922,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -3834,7 +3938,7 @@ export const abi = ` }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -3843,7 +3947,7 @@ export const abi = ` } }, { - "id": 59, + "id": 62, "type": { "def": { "variant": { @@ -4016,7 +4120,7 @@ export const abi = ` } }, { - "id": 60, + "id": 63, "type": { "def": { "variant": { @@ -4024,7 +4128,7 @@ export const abi = ` { "fields": [ { - "type": 61 + "type": 64 } ], "index": 0, @@ -4033,7 +4137,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4045,11 +4149,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 61 + "type": 64 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4058,7 +4162,7 @@ export const abi = ` } }, { - "id": 61, + "id": 64, "type": { "def": { "variant": { @@ -4075,7 +4179,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4091,7 +4195,7 @@ export const abi = ` }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4100,7 +4204,7 @@ export const abi = ` } }, { - "id": 62, + "id": 65, "type": { "def": { "variant": { @@ -4108,7 +4212,7 @@ export const abi = ` { "fields": [ { - "type": 63 + "type": 66 } ], "index": 0, @@ -4117,7 +4221,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4129,11 +4233,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 63 + "type": 66 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4142,7 +4246,7 @@ export const abi = ` } }, { - "id": 63, + "id": 66, "type": { "def": { "variant": { @@ -4150,7 +4254,7 @@ export const abi = ` { "fields": [ { - "type": 64 + "type": 67 } ], "index": 0, @@ -4159,7 +4263,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4171,11 +4275,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 64 + "type": 67 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4184,7 +4288,7 @@ export const abi = ` } }, { - "id": 64, + "id": 67, "type": { "def": { "composite": { @@ -4221,7 +4325,7 @@ export const abi = ` }, { "name": "ticks", - "type": 65, + "type": 68, "typeName": "Vec" } ] @@ -4236,7 +4340,7 @@ export const abi = ` } }, { - "id": 65, + "id": 68, "type": { "def": { "sequence": { @@ -4246,17 +4350,17 @@ export const abi = ` } }, { - "id": 66, + "id": 69, "type": { "def": { "sequence": { - "type": 67 + "type": 70 } } } }, { - "id": 67, + "id": 70, "type": { "def": { "composite": { @@ -4283,7 +4387,7 @@ export const abi = ` } }, { - "id": 68, + "id": 71, "type": { "def": { "variant": { @@ -4291,7 +4395,7 @@ export const abi = ` { "fields": [ { - "type": 69 + "type": 72 } ], "index": 0, @@ -4300,7 +4404,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4312,11 +4416,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 69 + "type": 72 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4325,7 +4429,7 @@ export const abi = ` } }, { - "id": 69, + "id": 72, "type": { "def": { "variant": { @@ -4333,7 +4437,7 @@ export const abi = ` { "fields": [ { - "type": 70 + "type": 73 } ], "index": 0, @@ -4342,7 +4446,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4354,11 +4458,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 70 + "type": 73 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4367,7 +4471,7 @@ export const abi = ` } }, { - "id": 70, + "id": 73, "type": { "def": { "composite": { @@ -4389,7 +4493,7 @@ export const abi = ` }, { "name": "ticks", - "type": 65, + "type": 68, "typeName": "Vec" } ] @@ -4404,7 +4508,7 @@ export const abi = ` } }, { - "id": 71, + "id": 74, "type": { "def": { "variant": { @@ -4412,7 +4516,7 @@ export const abi = ` { "fields": [ { - "type": 72 + "type": 75 } ], "index": 0, @@ -4421,7 +4525,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4433,11 +4537,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 72 + "type": 75 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4446,7 +4550,7 @@ export const abi = ` } }, { - "id": 72, + "id": 75, "type": { "def": { "variant": { @@ -4463,7 +4567,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4479,7 +4583,7 @@ export const abi = ` }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4488,7 +4592,7 @@ export const abi = ` } }, { - "id": 73, + "id": 76, "type": { "def": { "variant": { @@ -4496,7 +4600,7 @@ export const abi = ` { "fields": [ { - "type": 74 + "type": 77 } ], "index": 0, @@ -4505,7 +4609,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4517,11 +4621,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 74 + "type": 77 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4530,7 +4634,7 @@ export const abi = ` } }, { - "id": 74, + "id": 77, "type": { "def": { "sequence": { @@ -4540,7 +4644,7 @@ export const abi = ` } }, { - "id": 75, + "id": 78, "type": { "def": { "variant": { @@ -4548,7 +4652,7 @@ export const abi = ` { "fields": [ { - "type": 76 + "type": 79 } ], "index": 0, @@ -4557,7 +4661,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4569,11 +4673,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 76 + "type": 79 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4582,7 +4686,7 @@ export const abi = ` } }, { - "id": 76, + "id": 79, "type": { "def": { "variant": { @@ -4590,7 +4694,7 @@ export const abi = ` { "fields": [ { - "type": 77 + "type": 80 } ], "index": 0, @@ -4599,7 +4703,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4611,11 +4715,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 77 + "type": 80 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4624,28 +4728,28 @@ export const abi = ` } }, { - "id": 77, + "id": 80, "type": { "def": { "tuple": [ - 78, + 81, 0 ] } } }, { - "id": 78, + "id": 81, "type": { "def": { "sequence": { - "type": 79 + "type": 82 } } } }, { - "id": 79, + "id": 82, "type": { "def": { "tuple": [ @@ -4658,7 +4762,7 @@ export const abi = ` } }, { - "id": 80, + "id": 83, "type": { "def": { "variant": { @@ -4666,7 +4770,7 @@ export const abi = ` { "fields": [ { - "type": 81 + "type": 84 } ], "index": 0, @@ -4675,7 +4779,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4687,11 +4791,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 81 + "type": 84 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4700,7 +4804,7 @@ export const abi = ` } }, { - "id": 81, + "id": 84, "type": { "def": { "variant": { @@ -4708,7 +4812,7 @@ export const abi = ` { "fields": [ { - "type": 82 + "type": 85 } ], "index": 0, @@ -4717,7 +4821,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4729,11 +4833,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 82 + "type": 85 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4742,7 +4846,7 @@ export const abi = ` } }, { - "id": 82, + "id": 85, "type": { "def": { "tuple": [ @@ -4753,7 +4857,7 @@ export const abi = ` } }, { - "id": 83, + "id": 86, "type": { "def": { "variant": { @@ -4770,7 +4874,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4786,7 +4890,7 @@ export const abi = ` }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4795,7 +4899,7 @@ export const abi = ` } }, { - "id": 84, + "id": 87, "type": { "def": { "variant": { @@ -4803,7 +4907,7 @@ export const abi = ` { "fields": [ { - "type": 85 + "type": 88 } ], "index": 0, @@ -4812,7 +4916,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4824,11 +4928,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 85 + "type": 88 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4837,7 +4941,7 @@ export const abi = ` } }, { - "id": 85, + "id": 88, "type": { "def": { "variant": { @@ -4854,7 +4958,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4870,7 +4974,7 @@ export const abi = ` }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4879,7 +4983,7 @@ export const abi = ` } }, { - "id": 86, + "id": 89, "type": { "def": { "variant": { @@ -4887,7 +4991,7 @@ export const abi = ` { "fields": [ { - "type": 87 + "type": 90 } ], "index": 0, @@ -4896,7 +5000,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -4908,11 +5012,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 87 + "type": 90 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -4921,7 +5025,7 @@ export const abi = ` } }, { - "id": 87, + "id": 90, "type": { "def": { "variant": { @@ -4929,7 +5033,7 @@ export const abi = ` { "fields": [ { - "type": 88 + "type": 91 } ], "index": 0, @@ -4938,7 +5042,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -4950,11 +5054,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 88 + "type": 91 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -4963,17 +5067,17 @@ export const abi = ` } }, { - "id": 88, + "id": 91, "type": { "def": { "sequence": { - "type": 89 + "type": 92 } } } }, { - "id": 89, + "id": 92, "type": { "def": { "tuple": [ @@ -4984,7 +5088,7 @@ export const abi = ` } }, { - "id": 90, + "id": 93, "type": { "def": { "variant": { @@ -4992,7 +5096,7 @@ export const abi = ` { "fields": [ { - "type": 91 + "type": 94 } ], "index": 0, @@ -5001,7 +5105,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5013,11 +5117,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 91 + "type": 94 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5026,7 +5130,7 @@ export const abi = ` } }, { - "id": 91, + "id": 94, "type": { "def": { "variant": { @@ -5043,7 +5147,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -5059,7 +5163,7 @@ export const abi = ` }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -5068,7 +5172,7 @@ export const abi = ` } }, { - "id": 92, + "id": 95, "type": { "def": { "variant": { @@ -5076,7 +5180,7 @@ export const abi = ` { "fields": [ { - "type": 93 + "type": 96 } ], "index": 0, @@ -5085,7 +5189,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5097,11 +5201,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 93 + "type": 96 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5110,7 +5214,7 @@ export const abi = ` } }, { - "id": 93, + "id": 96, "type": { "def": { "variant": { @@ -5118,7 +5222,7 @@ export const abi = ` { "fields": [ { - "type": 94 + "type": 97 } ], "index": 0, @@ -5127,7 +5231,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -5139,11 +5243,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 94 + "type": 97 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -5152,18 +5256,18 @@ export const abi = ` } }, { - "id": 94, + "id": 97, "type": { "def": { "tuple": [ - 95, + 98, 10 ] } } }, { - "id": 95, + "id": 98, "type": { "def": { "sequence": { @@ -5173,7 +5277,7 @@ export const abi = ` } }, { - "id": 96, + "id": 99, "type": { "def": { "variant": { @@ -5190,7 +5294,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5206,7 +5310,7 @@ export const abi = ` }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5215,7 +5319,7 @@ export const abi = ` } }, { - "id": 97, + "id": 100, "type": { "def": { "variant": { @@ -5223,7 +5327,7 @@ export const abi = ` { "fields": [ { - "type": 98 + "type": 101 } ], "index": 0, @@ -5232,7 +5336,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5244,11 +5348,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 98 + "type": 101 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5257,17 +5361,17 @@ export const abi = ` } }, { - "id": 98, + "id": 101, "type": { "def": { "sequence": { - "type": 99 + "type": 102 } } } }, { - "id": 99, + "id": 102, "type": { "def": { "composite": { @@ -5305,7 +5409,7 @@ export const abi = ` } }, { - "id": 100, + "id": 103, "type": { "def": { "variant": { @@ -5313,7 +5417,7 @@ export const abi = ` { "fields": [ { - "type": 101 + "type": 104 } ], "index": 0, @@ -5322,7 +5426,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5334,11 +5438,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 101 + "type": 104 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5347,17 +5451,17 @@ export const abi = ` } }, { - "id": 101, + "id": 104, "type": { "def": { "sequence": { - "type": 102 + "type": 105 } } } }, { - "id": 102, + "id": 105, "type": { "def": { "tuple": [ @@ -5368,7 +5472,7 @@ export const abi = ` } }, { - "id": 103, + "id": 106, "type": { "def": { "sequence": { @@ -5378,7 +5482,7 @@ export const abi = ` } }, { - "id": 104, + "id": 107, "type": { "def": { "variant": { @@ -5386,7 +5490,7 @@ export const abi = ` { "fields": [ { - "type": 105 + "type": 108 } ], "index": 0, @@ -5395,7 +5499,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5407,11 +5511,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 105 + "type": 108 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5420,7 +5524,7 @@ export const abi = ` } }, { - "id": 105, + "id": 108, "type": { "def": { "variant": { @@ -5428,7 +5532,7 @@ export const abi = ` { "fields": [ { - "type": 106 + "type": 109 } ], "index": 0, @@ -5437,7 +5541,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -5449,11 +5553,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 106 + "type": 109 }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -5462,17 +5566,17 @@ export const abi = ` } }, { - "id": 106, + "id": 109, "type": { "def": { "sequence": { - "type": 107 + "type": 110 } } } }, { - "id": 107, + "id": 110, "type": { "def": { "composite": { @@ -5505,7 +5609,7 @@ export const abi = ` } }, { - "id": 108, + "id": 111, "type": { "def": { "variant": { @@ -5522,7 +5626,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5538,7 +5642,7 @@ export const abi = ` }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5547,7 +5651,7 @@ export const abi = ` } }, { - "id": 109, + "id": 112, "type": { "def": { "variant": { @@ -5555,7 +5659,7 @@ export const abi = ` { "fields": [ { - "type": 110 + "type": 113 } ], "index": 0, @@ -5564,7 +5668,7 @@ export const abi = ` { "fields": [ { - "type": 55 + "type": 58 } ], "index": 1, @@ -5576,11 +5680,11 @@ export const abi = ` "params": [ { "name": "T", - "type": 110 + "type": 113 }, { "name": "E", - "type": 55 + "type": 58 } ], "path": [ @@ -5589,7 +5693,7 @@ export const abi = ` } }, { - "id": 110, + "id": 113, "type": { "def": { "variant": { @@ -5606,7 +5710,7 @@ export const abi = ` { "fields": [ { - "type": 59 + "type": 62 } ], "index": 1, @@ -5622,7 +5726,7 @@ export const abi = ` }, { "name": "E", - "type": 59 + "type": 62 } ], "path": [ @@ -5631,7 +5735,7 @@ export const abi = ` } }, { - "id": 111, + "id": 114, "type": { "def": { "variant": { @@ -5664,7 +5768,7 @@ export const abi = ` } }, { - "id": 112, + "id": 115, "type": { "def": { "composite": { @@ -5684,7 +5788,7 @@ export const abi = ` } }, { - "id": 113, + "id": 116, "type": { "def": { "variant": {} diff --git a/sdk/src/abis/psp22.ts b/sdk/src/abis/psp22.ts index 5e314bf1..5c9af541 100644 --- a/sdk/src/abis/psp22.ts +++ b/sdk/src/abis/psp22.ts @@ -1,7 +1,7 @@ export const abi = ` { "source": { - "hash": "0xb4082b7d4aedb8479925aa96a383ea722dc1a7e9b29ad5a4d5f95ad707db4e09", + "hash": "0xb4a6778b80073e24c68d7aafad474beed429019761b4e2ba5786359aede38ed7", "language": "ink! 5.0.0", "compiler": "rustc 1.77.0", "build_info": { diff --git a/sdk/src/invariant.ts b/sdk/src/invariant.ts index 838f0979..2d35ea70 100644 --- a/sdk/src/invariant.ts +++ b/sdk/src/invariant.ts @@ -1,10 +1,5 @@ /* eslint camelcase: off */ -import { ApiPromise } from '@polkadot/api' -import { Abi, ContractPromise } from '@polkadot/api-contract' -import { WeightV2 } from '@polkadot/types/interfaces' -import { IKeyringPair } from '@polkadot/types/types/interfaces' -import { deployContract } from '@scio-labs/use-inkathon' import { FeeTier, InvariantError, @@ -25,6 +20,12 @@ import { getMaxSqrtPrice, getMinSqrtPrice } from '@invariant-labs/a0-sdk-wasm/invariant_a0_wasm.js' +import { ApiPromise } from '@polkadot/api' +import { Abi, ContractPromise } from '@polkadot/api-contract' +import { SubmittableExtrinsic } from '@polkadot/api/types/submittable' +import { WeightV2 } from '@polkadot/types/interfaces' +import { IKeyringPair } from '@polkadot/types/types/interfaces' +import { deployContract } from '@scio-labs/use-inkathon' import { CHUNK_SIZE, DEFAULT_PROOF_SIZE, @@ -49,18 +50,17 @@ import { calculateSqrtPriceAfterSlippage, createSignAndSendTx, createTx, - getAbi, extractError, + getAbi, getDeploymentData, + getMaxTick, + getMinTick, integerSafeCast, parse, parseEvent, positionToTick, - sendQuery, - getMaxTick, - getMinTick + sendQuery } from './utils.js' -import { SubmittableExtrinsic } from '@polkadot/api/types/submittable' export class Invariant { contract: ContractPromise api: ApiPromise @@ -98,6 +98,7 @@ export class Invariant { fee: Percentage = 0n, options?: ContractOptions ): Promise { + const pocField = [1n, 0n, 0n, 0n] const deploymentData = await getDeploymentData('invariant') const deploy = await deployContract( api, @@ -105,7 +106,7 @@ export class Invariant { deploymentData.abi, deploymentData.wasm, 'new', - [fee] + [fee, pocField] ) return new Invariant( diff --git a/sdk/src/poc-u256.ts b/sdk/src/poc-u256.ts new file mode 100644 index 00000000..54e2301c --- /dev/null +++ b/sdk/src/poc-u256.ts @@ -0,0 +1,27 @@ +import { Keyring } from '@polkadot/api' +import { assert } from 'chai' +import { Invariant } from './invariant.js' +import { Network } from './network.js' +import { initPolkadotApi } from './utils.js' +import { receiveBigType } from './wasm/pkg/invariant_a0_wasm.js' + +const main = async () => { + const u128Max = BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') + const u192Max = BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') + const u256Max = BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') + assert.equal(receiveBigType(u128Max), u128Max) + assert.equal(receiveBigType(u192Max), u192Max) + assert.equal(receiveBigType(u256Max), u256Max) + + // Deploy invariant + const api = await initPolkadotApi(Network.Local) + const keyring = new Keyring({ type: 'sr25519' }) + const account = keyring.addFromUri('//Alice') + + const invariant = await Invariant.deploy(api, Network.Local, account, 10000000000n) + console.log(invariant) + const protocolFee = await invariant.getProtocolFee() + console.log(protocolFee) +} + +main() diff --git a/sdk/src/wasm/Cargo.toml b/sdk/src/wasm/Cargo.toml index 38fa807f..c21eca87 100644 --- a/sdk/src/wasm/Cargo.toml +++ b/sdk/src/wasm/Cargo.toml @@ -15,6 +15,7 @@ serde-wasm-bindgen = "0.6.3" tsify = "0.4.5" paste = "1.0.14" js-sys = "0.3.66" +uint = {version = "0.9.5", default-features = false} decimal = { path= "../../../src/decimal" } traceable_result = { path = "../../../src/traceable_result" } diff --git a/sdk/src/wasm/storage/invariant_config.rs b/sdk/src/wasm/storage/invariant_config.rs index b83bedc1..b823b373 100644 --- a/sdk/src/wasm/storage/invariant_config.rs +++ b/sdk/src/wasm/storage/invariant_config.rs @@ -1,8 +1,14 @@ use crate::alloc::string::ToString; +use crate::log; use crate::types::percentage::Percentage; +use js_sys::BigInt; use serde::{Deserialize, Serialize}; +use traceable_result::TrackableResult; use tsify::Tsify; +use uint::construct_uint; use wasm_bindgen::prelude::*; +use wasm_wrapper::wasm_wrapper; + #[derive(Debug, Clone, Tsify, Serialize, Deserialize)] #[tsify(into_wasm_abi, from_wasm_abi)] #[serde(rename_all = "camelCase")] @@ -10,4 +16,51 @@ pub struct InvariantConfig { #[tsify(type = "string")] pub admin: String, pub protocol_fee: Percentage, + pub poc_field: PocType, +} + +construct_uint! { + #[derive(Serialize, Deserialize, Tsify)] + pub struct U256T(4); +} + +#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Serialize, Deserialize, Tsify)] +#[tsify(into_wasm_abi, from_wasm_abi)] +pub struct PocType(pub U256T); + +#[wasm_bindgen(js_name = "receiveBigType")] +pub fn receive_big_type(big: JsValue) -> Result { + log(format!("received: {:?}", big).as_str()); + let mut arr = [0u64; 4]; + let big_int = BigInt::new(&big)?; + let x = BigInt::as_uint_n(256f64, &big_int); + + // cast to PocType + for i in 0..4 { + let shift_amount = BigInt::from(64 * i); + let x_shifted = &big_int >> shift_amount; + let mask = BigInt::from(0xFFFF_FFFF_FFFF_FFFFu64); + let x_masked = x_shifted & &mask; + + let package: u64 = serde_wasm_bindgen::from_value(x_masked.into())?; + arr[i] = package; + log(format!("Package: {:?} index: {:?}", package, i).as_str()); + } + + let nested_type: U256T = U256T(arr); + log(format!("nested_type: {:?}", nested_type).as_str()); + let big_type = PocType(nested_type); + log(format!("big_type: {:?}", big_type).as_str()); + + // cast back to BigInt + let mut cast_back = BigInt::from(0u64); + + for (index, &value) in arr.iter().enumerate() { + let value_bigint = BigInt::from(value); + let shift_amount = BigInt::from(64 * index); + let intermediate = value_bigint << shift_amount; + cast_back = cast_back + intermediate; + } + + Ok(cast_back) } diff --git a/src/contracts/entrypoints.rs b/src/contracts/entrypoints.rs index 7ef8e06f..a807a6bf 100644 --- a/src/contracts/entrypoints.rs +++ b/src/contracts/entrypoints.rs @@ -11,11 +11,13 @@ use crate::{ use alloc::vec::Vec; use ink::primitives::AccountId; +use super::PocType; + #[ink::trait_definition] pub trait InvariantTrait { /// Retrieves the protocol fee represented as a percentage. #[ink(message)] - fn get_protocol_fee(&self) -> Percentage; + fn get_protocol_fee(&self) -> PocType; /// Allows an fee receiver to withdraw collected fees. /// diff --git a/src/contracts/storage/invariant_config.rs b/src/contracts/storage/invariant_config.rs index 32b56947..ae534287 100644 --- a/src/contracts/storage/invariant_config.rs +++ b/src/contracts/storage/invariant_config.rs @@ -1,11 +1,13 @@ use crate::math::types::percentage::Percentage; use ink::primitives::AccountId; +use uint::construct_uint; #[ink::storage_item] #[derive(Debug)] pub struct InvariantConfig { pub admin: AccountId, pub protocol_fee: Percentage, + pub poc_field: PocType, } impl Default for InvariantConfig { @@ -13,6 +15,18 @@ impl Default for InvariantConfig { Self { admin: AccountId::from([0x0; 32]), protocol_fee: Default::default(), + poc_field: PocType(U256T::from(0)), } } } + +construct_uint! { + #[ink::scale_derive(Encode, Decode, TypeInfo)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + pub struct U256T(4); +} + +#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd)] +#[ink::scale_derive(Encode, Decode, TypeInfo)] +#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] +pub struct PocType(pub U256T); diff --git a/src/e2e/constructor.rs b/src/e2e/constructor.rs index bab6b4c3..7d0c62d5 100644 --- a/src/e2e/constructor.rs +++ b/src/e2e/constructor.rs @@ -1,5 +1,6 @@ #[cfg(test)] pub mod e2e_tests { + use crate::contracts::{PocType, U256T}; use crate::{invariant::InvariantRef, math::types::percentage::Percentage}; use decimal::*; use ink_e2e::ContractsBackend; @@ -17,7 +18,8 @@ pub mod e2e_tests { .await .expect("instantiate failed"); - let mut constructor = InvariantRef::new(Percentage::new(0)); + let poc_field = PocType(U256T::from(0)); + let mut constructor = InvariantRef::new(Percentage::new(0), poc_field); let _contract = client .instantiate("invariant", &ink_e2e::alice(), &mut constructor) .submit() diff --git a/src/e2e/mod.rs b/src/e2e/mod.rs index 646b50d0..4483ab24 100644 --- a/src/e2e/mod.rs +++ b/src/e2e/mod.rs @@ -1,25 +1,25 @@ -pub mod add_fee_tier; -pub mod change_fee_receiver; -pub mod change_protocol_fee; -pub mod claim; +// pub mod add_fee_tier; +// pub mod change_fee_receiver; +// pub mod change_protocol_fee; +// pub mod claim; pub mod constructor; -pub mod create_pool; -pub mod cross; -pub mod cross_both_side; -pub mod get_liquidity_ticks; -pub mod get_position_ticks; -pub mod get_positions; -pub mod get_tickmap; -pub mod interaction_with_pool_on_removed_fee_tier; -pub mod limits; -pub mod liquidity_gap; -pub mod max_tick_cross; -pub mod multiple_swap; -pub mod position; -pub mod position_list; -pub mod position_slippage; -pub mod protocol_fee; -pub mod remove_fee_tier; -pub mod slippage; -pub mod swap; -pub mod swap_route; +// pub mod create_pool; +// pub mod cross; +// pub mod cross_both_side; +// pub mod get_liquidity_ticks; +// pub mod get_position_ticks; +// pub mod get_positions; +// pub mod get_tickmap; +// pub mod interaction_with_pool_on_removed_fee_tier; +// pub mod limits; +// pub mod liquidity_gap; +// pub mod max_tick_cross; +// pub mod multiple_swap; +// pub mod position; +// pub mod position_list; +// pub mod position_slippage; +// pub mod protocol_fee; +// pub mod remove_fee_tier; +// pub mod slippage; +// pub mod swap; +// pub mod swap_route; diff --git a/src/lib.rs b/src/lib.rs index 26cb4595..2c5137a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,8 +10,8 @@ pub mod math; pub mod invariant { use crate::contracts::{ get_max_chunk, get_min_chunk, tick_to_position, CalculateSwapResult, CreatePositionEvent, - CrossTickEvent, FeeTier, FeeTiers, InvariantConfig, InvariantTrait, LiquidityTick, Pool, - PoolKey, PoolKeys, Pools, Position, PositionTick, Positions, QuoteResult, + CrossTickEvent, FeeTier, FeeTiers, InvariantConfig, InvariantTrait, LiquidityTick, PocType, + Pool, PoolKey, PoolKeys, Pools, Position, PositionTick, Positions, QuoteResult, RemovePositionEvent, SwapEvent, SwapHop, Tick, Tickmap, Ticks, UpdatePoolTick, CHUNK_SIZE, LIQUIDITY_TICK_LIMIT, MAX_TICKMAP_QUERY_SIZE, POSITION_TICK_LIMIT, }; @@ -60,11 +60,12 @@ pub mod invariant { impl Invariant { #[ink(constructor)] - pub fn new(protocol_fee: Percentage) -> Self { + pub fn new(protocol_fee: Percentage, poc_field: PocType) -> Self { Self { config: InvariantConfig { admin: Self::env().caller(), protocol_fee, + poc_field, }, ..Self::default() } @@ -414,8 +415,8 @@ pub mod invariant { impl InvariantTrait for Invariant { #[ink(message)] - fn get_protocol_fee(&self) -> Percentage { - self.config.protocol_fee + fn get_protocol_fee(&self) -> PocType { + self.config.poc_field } #[ink(message)] @@ -1146,12 +1147,14 @@ pub mod invariant { #[ink::test] fn initialize_works() { - let _ = Invariant::new(Percentage::new(0)); + let poc = PocType(U256T::from(0)); + let _ = Invariant::new(Percentage::new(0), poc); } #[ink::test] fn test_add_pool() { - let mut contract = Invariant::new(Percentage::new(0)); + let poc = PocType(U256T::from(0)); + let mut contract = Invariant::new(Percentage::new(0), poc); let token_0 = AccountId::from([0x01; 32]); let token_1 = AccountId::from([0x02; 32]); let fee_tier = FeeTier { @@ -1189,7 +1192,8 @@ pub mod invariant { #[ink::test] fn test_get_pool() { - let mut contract = Invariant::new(Percentage::new(0)); + let poc = PocType(U256T::from(0)); + let mut contract = Invariant::new(Percentage::new(0), poc); let token_0 = AccountId::from([0x01; 32]); let token_1 = AccountId::from([0x02; 32]); let init_sqrt_price = calculate_sqrt_price(0).unwrap(); @@ -1225,7 +1229,8 @@ pub mod invariant { #[ink::test] fn create_tick() { - let mut contract = Invariant::new(Percentage::new(0)); + let poc = PocType(U256T::from(0)); + let mut contract = Invariant::new(Percentage::new(0), poc); let init_sqrt_price = calculate_sqrt_price(0).unwrap(); let token_0 = AccountId::from([0x01; 32]); let token_1 = AccountId::from([0x02; 32]); @@ -1255,7 +1260,8 @@ pub mod invariant { #[ink::test] fn test_fee_tiers() { - let mut contract = Invariant::new(Percentage::new(0)); + let poc = PocType(U256T::from(0)); + let mut contract = Invariant::new(Percentage::new(0), poc); let fee_tier = FeeTier::new(Percentage::new(1), 10u16).unwrap(); let fee_tier_value = FeeTier { fee: Percentage::new(1),