diff --git a/Cargo.lock b/Cargo.lock index aaf33aa..15e87a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,7 +3,6 @@ version = 4 [[package]] -<<<<<<< HEAD name = "addr2line" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -19,20 +18,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -======= -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "android_system_properties" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -51,145 +36,12 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= -name = "ark-bls12-381" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-serialize", - "ark-std", -] - -[[package]] -name = "ark-bn254" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-std", -] - -[[package]] -name = "ark-ec" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" -dependencies = [ - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.13.2", - "itertools", - "num-traits", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", - "derivative", - "digest", - "itertools", - "num-bigint", - "num-traits", - "paste", - "rustc_version", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" -dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-poly" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" -dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.13.2", -] - -[[package]] -name = "ark-serialize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-serialize-derive", - "ark-std", - "digest", - "num-bigint", -] - -[[package]] -name = "ark-serialize-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-std" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand", -] - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "autocfg" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] -<<<<<<< HEAD name = "backtrace" version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -205,15 +57,12 @@ dependencies = [ ] [[package]] -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "base16ct" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] -<<<<<<< HEAD name = "base32" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -226,8 +75,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -269,11 +116,7 @@ dependencies = [ "num-bigint", "proc-macro2", "quote", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -293,20 +136,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] -<<<<<<< HEAD -======= -name = "cfg_eval" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", -] - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "chrono" version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -374,7 +203,6 @@ dependencies = [ [[package]] name = "ctor" -<<<<<<< HEAD version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" @@ -388,37 +216,13 @@ name = "curve25519-dalek" version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" -======= -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67773048316103656a637612c4a62477603b777d91d9c62ff2290f9cde178fdb" -dependencies = [ - "ctor-proc-macro", - "dtor", -] - -[[package]] -name = "ctor-proc-macro" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2" - -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest", "fiat-crypto", -<<<<<<< HEAD "platforms", -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "rustc_version", "subtle", "zeroize", @@ -432,83 +236,35 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "darling" -<<<<<<< HEAD version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", -======= -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" -dependencies = [ - "darling_core 0.20.11", - "darling_macro 0.20.11", -] - -[[package]] -name = "darling" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" -dependencies = [ - "darling_core 0.21.3", - "darling_macro 0.21.3", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "darling_core" -<<<<<<< HEAD version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -======= -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", -] - -[[package]] -name = "darling_core" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "darling_macro" -<<<<<<< HEAD version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" @@ -519,35 +275,6 @@ dependencies = [ ] [[package]] -======= -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" -dependencies = [ - "darling_core 0.20.11", - "quote", - "syn 2.0.115", -] - -[[package]] -name = "darling_macro" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" -dependencies = [ - "darling_core 0.21.3", - "quote", - "syn 2.0.115", -] - -[[package]] -name = "data-encoding" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "der" version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -559,37 +286,16 @@ dependencies = [ [[package]] name = "deranged" -<<<<<<< HEAD version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc" dependencies = [ "powerfmt", "serde", -======= -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc3dc5ad92c2e2d1c193bbbbdf2ea477cb81331de4f3103f267ca18368b988c4" -dependencies = [ - "powerfmt", - "serde_core", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "derive_arbitrary" -<<<<<<< HEAD version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" @@ -597,15 +303,6 @@ dependencies = [ "proc-macro2", "quote", "syn", -======= -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -627,30 +324,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] -<<<<<<< HEAD -======= -name = "dtor" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "404d02eeb088a82cfd873006cb713fe411306c7d182c344905e101fb1167d301" -dependencies = [ - "dtor-proc-macro", -] - -[[package]] -name = "dtor-proc-macro" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5" - -[[package]] -name = "dyn-clone" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "ecdsa" version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -661,10 +334,7 @@ dependencies = [ "elliptic-curve", "rfc6979", "signature", -<<<<<<< HEAD "spki", -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -679,25 +349,15 @@ dependencies = [ [[package]] name = "ed25519-dalek" -<<<<<<< HEAD version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" -======= -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "curve25519-dalek", "ed25519", "rand_core", "serde", "sha2", -<<<<<<< HEAD -======= - "subtle", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "zeroize", ] @@ -719,10 +379,7 @@ dependencies = [ "ff", "generic-array", "group", -<<<<<<< HEAD "pkcs8", -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "rand_core", "sec1", "subtle", @@ -743,15 +400,9 @@ checksum = "2bfcf67fea2815c2fc3b90873fae90957be12ff417335dfadc7f52927feb03b2" [[package]] name = "ethnum" -<<<<<<< HEAD version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" -======= -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca81e6b4777c89fd810c25a4be2b1bd93ea034fbe58e6a75216a34c6b82c539b" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 [[package]] name = "ff" @@ -794,15 +445,9 @@ dependencies = [ [[package]] name = "getrandom" -<<<<<<< HEAD version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" -======= -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "cfg-if", "js-sys", @@ -812,7 +457,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -826,8 +470,6 @@ dependencies = [ ] [[package]] -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "group" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -839,18 +481,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -858,40 +488,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -<<<<<<< HEAD version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -======= -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" - -[[package]] -name = "heapless" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" -dependencies = [ - "hash32", - "stable_deref_trait", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 [[package]] name = "hex" @@ -960,7 +559,6 @@ dependencies = [ [[package]] name = "indexmap" -<<<<<<< HEAD version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206a8042aec68fa4a62e8d3f7aa4ceb508177d9324faf261e1959e495b7a1921" @@ -968,16 +566,6 @@ dependencies = [ "equivalent", "hashbrown 0.15.5", "serde", -======= -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" -dependencies = [ - "equivalent", - "hashbrown 0.16.1", - "serde", - "serde_core", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -988,15 +576,9 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "itertools" -<<<<<<< HEAD version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -======= -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "either", ] @@ -1009,9 +591,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "js-sys" -version = "0.3.85" +version = "0.3.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +checksum = "c7e709f3e3d22866f9c25b3aff01af289b18422cc8b4262fb19103ee80fe513d" dependencies = [ "once_cell", "wasm-bindgen", @@ -1019,26 +601,16 @@ dependencies = [ [[package]] name = "k256" -<<<<<<< HEAD version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" -======= -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", -<<<<<<< HEAD "once_cell", "sha2", "signature", -======= - "sha2", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -1069,27 +641,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] -<<<<<<< HEAD -======= -name = "macro-string" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", -] - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "memchr" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] -<<<<<<< HEAD name = "miniz_oxide" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1105,20 +662,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", -======= -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "num-integer", "num-traits", ] [[package]] name = "num-conv" -<<<<<<< HEAD version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" @@ -1132,57 +681,28 @@ dependencies = [ "proc-macro2", "quote", "syn", -======= -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" - -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "num-integer" -<<<<<<< HEAD version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", -======= -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "num-traits", ] [[package]] name = "num-traits" -<<<<<<< HEAD version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -======= -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "autocfg", ] [[package]] -<<<<<<< HEAD name = "object" version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1192,29 +712,12 @@ dependencies = [ ] [[package]] -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] -<<<<<<< HEAD -======= -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1231,15 +734,12 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD name = "platforms" version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a546fc83c436ffbef8e7e639df8498bbc5122e0bd19cf8db208720c2cc85290e" [[package]] -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "powerfmt" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1247,73 +747,37 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -<<<<<<< HEAD version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -======= -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "zerocopy", ] [[package]] name = "prettyplease" -<<<<<<< HEAD version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", "syn", -======= -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn 2.0.115", -] - -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "proc-macro2" -<<<<<<< HEAD version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" -======= -version = "1.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "unicode-ident", ] [[package]] name = "quote" -<<<<<<< HEAD version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -======= -version = "1.0.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "proc-macro2", ] @@ -1349,29 +813,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= -name = "ref-cast" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", -] - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "rfc6979" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1382,15 +823,12 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD name = "rustc-demangle" version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" [[package]] -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "rustc_version" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1406,46 +844,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] -<<<<<<< HEAD name = "ryu" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" -======= -name = "schemars" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" -dependencies = [ - "dyn-clone", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 [[package]] name = "sec1" @@ -1456,10 +858,7 @@ dependencies = [ "base16ct", "der", "generic-array", -<<<<<<< HEAD "pkcs8", -======= ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "subtle", "zeroize", ] @@ -1472,32 +871,15 @@ checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" [[package]] name = "serde" -<<<<<<< HEAD version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" -======= -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -<<<<<<< HEAD version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" @@ -1505,20 +887,10 @@ dependencies = [ "proc-macro2", "quote", "syn", -======= -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "serde_json" -<<<<<<< HEAD version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" @@ -1526,22 +898,10 @@ dependencies = [ "itoa", "ryu", "serde", -======= -version = "1.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "serde_with" -<<<<<<< HEAD version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" @@ -1553,21 +913,6 @@ dependencies = [ "indexmap 2.11.1", "serde", "serde_derive", -======= -version = "3.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.13.0", - "schemars 0.8.22", - "schemars 0.9.0", - "schemars 1.2.1", - "serde_core", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "serde_json", "serde_with_macros", "time", @@ -1575,7 +920,6 @@ dependencies = [ [[package]] name = "serde_with_macros" -<<<<<<< HEAD version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" @@ -1584,29 +928,13 @@ dependencies = [ "proc-macro2", "quote", "syn", -======= -version = "3.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" -dependencies = [ - "darling 0.21.3", - "proc-macro2", - "quote", - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "sha2" -<<<<<<< HEAD version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -======= -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "cfg-if", "cpufeatures", @@ -1647,37 +975,21 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "soroban-builtin-sdk-macros" -<<<<<<< HEAD version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cc32c6e817f3ca269764ec0d7d14da6210b74a5bf14d4e745aa3ee860558900" -======= -version = "25.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7192e3a5551a7aeee90d2110b11b615798e81951fd8c8293c87ea7f88b0168f5" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "itertools", "proc-macro2", "quote", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "soroban-env-common" -<<<<<<< HEAD version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c14e18d879c520ff82612eaae0590acaf6a7f3b977407e1abb1c9e31f94c7814" -======= -version = "25.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfc49a80a68fc1005847308e63b9fce39874de731940b1807b721d472de3ff01" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "arbitrary", "crate-git-revision", @@ -1689,23 +1001,13 @@ dependencies = [ "soroban-wasmi", "static_assertions", "stellar-xdr", -<<<<<<< HEAD -======= - "wasmparser", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "soroban-env-guest" -<<<<<<< HEAD version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5122ca2abd5ebcc1e876a96b9b44f87ce0a0e06df8f7c09772ddb58b159b7454" -======= -version = "25.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2334ba1cfe0a170ab744d96db0b4ca86934de9ff68187ceebc09dc342def55" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "soroban-env-common", "static_assertions", @@ -1713,7 +1015,6 @@ dependencies = [ [[package]] name = "soroban-env-host" -<<<<<<< HEAD version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "114a0fa0d0cc39d0be16b1ee35b6e5f4ee0592ddcf459bde69391c02b03cf520" @@ -1721,22 +1022,6 @@ dependencies = [ "backtrace", "curve25519-dalek", "ed25519-dalek", -======= -version = "25.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43af5d53c57bc2f546e122adc0b1cca6f93942c718977379aa19ddd04f06fcec" -dependencies = [ - "ark-bls12-381", - "ark-bn254", - "ark-ec", - "ark-ff", - "ark-serialize", - "curve25519-dalek", - "ecdsa", - "ed25519-dalek", - "elliptic-curve", - "generic-array", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "getrandom", "hex-literal", "hmac", @@ -1744,40 +1029,22 @@ dependencies = [ "num-derive", "num-integer", "num-traits", -<<<<<<< HEAD "rand", "rand_chacha", -======= - "p256", - "rand", - "rand_chacha", - "sec1", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "sha2", "sha3", "soroban-builtin-sdk-macros", "soroban-env-common", "soroban-wasmi", "static_assertions", -<<<<<<< HEAD "stellar-strkey", -======= - "stellar-strkey 0.0.13", - "wasmparser", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "soroban-env-macros" -<<<<<<< HEAD version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b13e3f8c86f812e0669e78fcb3eae40c385c6a9dd1a4886a1de733230b4fcf27" -======= -version = "25.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a989167512e3592d455b1e204d703cfe578a36672a77ed2f9e6f7e1bbfd9cc5c" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "itertools", "proc-macro2", @@ -1785,24 +1052,14 @@ dependencies = [ "serde", "serde_json", "stellar-xdr", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "soroban-ledger-snapshot" -<<<<<<< HEAD version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61a54708f44890e0546180db6b4f530e2a88d83b05a9b38a131caa21d005e25a" -======= -version = "25.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c5285c83e7a5581879b7a65033eae53b24ac9689975aa6887f1d8ee3e941c9" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "serde", "serde_json", @@ -1814,7 +1071,6 @@ dependencies = [ [[package]] name = "soroban-sdk" -<<<<<<< HEAD version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84fc8be9068dd4e0212d8b13ad61089ea87e69ac212c262914503a961c8dc3a3" @@ -1824,37 +1080,17 @@ dependencies = [ "ctor", "ed25519-dalek", "rand", -======= -version = "25.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1262aa83e99a0fb3e8cd56d6e5ca4c28ac4f9871ac7173f65301a8b9a12c20f" -dependencies = [ - "arbitrary", - "bytes-lit", - "crate-git-revision", - "ctor", - "derive_arbitrary", - "ed25519-dalek", - "rand", - "rustc_version", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "serde", "serde_json", "soroban-env-guest", "soroban-env-host", "soroban-ledger-snapshot", "soroban-sdk-macros", -<<<<<<< HEAD "stellar-strkey", -======= - "stellar-strkey 0.0.16", - "visibility", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "soroban-sdk-macros" -<<<<<<< HEAD version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db20def4ead836663633f58d817d0ed8e1af052c9650a04adf730525af85b964" @@ -1865,45 +1101,21 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", -======= -version = "25.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93b62c526917a1e77b6dce3cd841b6c271f0fff344ea93ad92a8c45afe8051b6" -dependencies = [ - "darling 0.20.11", - "heck", - "itertools", - "macro-string", - "proc-macro2", - "quote", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "sha2", "soroban-env-common", "soroban-spec", "soroban-spec-rust", "stellar-xdr", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "soroban-spec" -<<<<<<< HEAD version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eefeb5d373b43f6828145d00f0c5cc35e96db56a6671ae9614f84beb2711cab" dependencies = [ "base64 0.13.1", -======= -version = "25.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0186c943a78de7038ce7eee478f521f7a7665440101ae0d24b4a59833fb6d833" -dependencies = [ - "base64", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "stellar-xdr", "thiserror", "wasmparser", @@ -1911,15 +1123,9 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -<<<<<<< HEAD version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3152bca4737ef734ac37fe47b225ee58765c9095970c481a18516a2b287c7a33" -======= -version = "25.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a948196ed0633be3a4125e0c7a4fc0bb6337942e538813b1f171331738f9058" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "prettyplease", "proc-macro2", @@ -1927,11 +1133,7 @@ dependencies = [ "sha2", "soroban-spec", "stellar-xdr", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "thiserror", ] @@ -1965,15 +1167,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1981,7 +1174,6 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stellar-strkey" -<<<<<<< HEAD version = "0.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12d2bf45e114117ea91d820a846fd1afbe3ba7d717988fee094ce8227a3bf8bd" @@ -1989,30 +1181,10 @@ dependencies = [ "base32", "crate-git-revision", "thiserror", -======= -version = "0.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee1832fb50c651ad10f734aaf5d31ca5acdfb197a6ecda64d93fcdb8885af913" -dependencies = [ - "crate-git-revision", - "data-encoding", -] - -[[package]] -name = "stellar-strkey" -version = "0.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084afcb0d458c3d5d5baa2d294b18f881e62cc258ef539d8fdf68be7dbe45520" -dependencies = [ - "crate-git-revision", - "data-encoding", - "heapless", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "stellar-xdr" -<<<<<<< HEAD version = "20.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e59cdf3eb4467fb5a4b00b52e7de6dca72f67fac6f9b700f55c95a5d86f09c9d" @@ -2025,23 +1197,6 @@ dependencies = [ "serde", "serde_with", "stellar-strkey", -======= -version = "25.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d20dafed80076b227d4b17c0c508a4bbc4d5e4c3d4c1de7cd42242df4b1eaf" -dependencies = [ - "arbitrary", - "base64", - "cfg_eval", - "crate-git-revision", - "escape-bytes", - "ethnum", - "hex", - "serde", - "serde_with", - "sha2", - "stellar-strkey 0.0.13", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -2058,26 +1213,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -<<<<<<< HEAD version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" -======= -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.115" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e614ed320ac28113fa64972c4262d5dbc89deacdfd00c34a3e4cea073243c12" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "proc-macro2", "quote", @@ -2086,22 +1224,15 @@ dependencies = [ [[package]] name = "thiserror" -<<<<<<< HEAD version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e3de26b0965292219b4287ff031fcba86837900fe9cd2b34ea8ad893c0953d2" -======= -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -<<<<<<< HEAD version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "268026685b2be38d7103e9e507c938a1fcb3d7e6eb15e87870b617bf37b6d581" @@ -2109,45 +1240,25 @@ dependencies = [ "proc-macro2", "quote", "syn", -======= -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] name = "time" -<<<<<<< HEAD version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" -======= -version = "0.3.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", -<<<<<<< HEAD "serde", -======= - "serde_core", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "time-core", "time-macros", ] [[package]] name = "time-core" -<<<<<<< HEAD version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" @@ -2157,17 +1268,6 @@ name = "time-macros" version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" -======= -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" - -[[package]] -name = "time-macros" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 dependencies = [ "num-conv", "time-core", @@ -2192,27 +1292,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -<<<<<<< HEAD -======= -name = "vesting_contracts" -version = "0.0.0" -dependencies = [ - "soroban-sdk", -] - -[[package]] -name = "visibility" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d674d135b4a8c1d7e813e2f8d1c9a58308aee4a680323066025e53132218bd91" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", -] - -[[package]] ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 name = "wasi" version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2220,9 +1299,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasm-bindgen" -version = "0.2.108" +version = "0.2.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +checksum = "ec1adf1535672f5b7824f817792b1afd731d7e843d2d04ec8f27e8cb51edd8ac" dependencies = [ "cfg-if", "once_cell", @@ -2233,9 +1312,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.108" +version = "0.2.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +checksum = "19e638317c08b21663aed4d2b9a2091450548954695ff4efa75bff5fa546b3b1" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2243,26 +1322,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.108" +version = "0.2.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +checksum = "2c64760850114d03d5f65457e96fc988f11f01d38fbaa51b254e4ab5809102af" dependencies = [ "bumpalo", "proc-macro2", "quote", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.108" +version = "0.2.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +checksum = "60eecd4fe26177cfa3339eb00b4a36445889ba3ad37080c2429879718e20ca41" dependencies = [ "unicode-ident", ] @@ -2287,20 +1362,11 @@ dependencies = [ [[package]] name = "wasmparser" -<<<<<<< HEAD version = "0.88.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb8cf7dd82407fe68161bedcd57fde15596f32ebf6e9b3bdbf3ae1da20e38e5e" dependencies = [ "indexmap 1.9.3", -======= -version = "0.116.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" -dependencies = [ - "indexmap 2.13.0", - "semver", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -2333,11 +1399,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -2348,11 +1410,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", -<<<<<<< HEAD "syn", -======= - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -2381,24 +1439,16 @@ dependencies = [ [[package]] name = "zerocopy" -<<<<<<< HEAD version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "byteorder", -======= -version = "0.8.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" -dependencies = [ ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -<<<<<<< HEAD version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" @@ -2406,15 +1456,6 @@ dependencies = [ "proc-macro2", "quote", "syn", -======= -version = "0.8.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 ] [[package]] @@ -2422,26 +1463,3 @@ name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -<<<<<<< HEAD -======= -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", -] - -[[package]] -name = "zmij" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" ->>>>>>> ce7eb66fb1d747f6801e3ee7512cf41d0eff7c70 diff --git a/contracts/grant_contracts/src/lib.rs b/contracts/grant_contracts/src/lib.rs index 41076b8..c77dbf3 100644 --- a/contracts/grant_contracts/src/lib.rs +++ b/contracts/grant_contracts/src/lib.rs @@ -1,559 +1,295 @@ #![no_std] use soroban_sdk::{ - contract, contractimpl, contracttype, Address, Env, Map, Symbol, String, Vec, - token, panic_with_error, unwrap::UnwrapOptimized + contract, contracterror, contractimpl, contracttype, symbol_short, Address, Env, }; #[contract] pub struct GrantContract; -#[contracttype] -pub enum DataKey { - Grant(Symbol), - Milestone(Symbol, Symbol), - MilestoneVote(Symbol, Symbol, Address), // grant_id, milestone_id, voter_address - CouncilMembers, - Withdrawn(Symbol, Address), // grant_id, grantee_address -} - -#[contracttype] -pub struct Grant { - pub admin: Address, - pub grantees: Map, // address -> basis points (10000 = 100%) - pub total_amount: u128, - pub released_amount: u128, - pub token_address: Address, - pub created_at: u64, - pub cliff_end: u64, // 0 means no cliff - pub status: GrantStatus, - pub council_members: Vec
, // For DAO governance - pub voting_threshold: u32, // Number of votes required for milestone approval - pub flow_rate: u128, // tokens per second streamed for this grant (0 if not used) - pub last_settled_at: u64, // timestamp of last settlement for streaming flows -} #[contracttype] pub enum GrantStatus { - Proposed, Active, - Paused, Completed, Cancelled, } +#[derive(Clone)] #[contracttype] -pub struct Milestone { - pub amount: u128, - pub description: String, - pub approved: bool, - pub approved_at: Option, - pub votes_for: u32, - pub votes_against: u32, - pub voting_deadline: u64, +pub struct Grant { + pub recipient: Address, + pub total_amount: i128, + pub withdrawn: i128, + pub claimable: i128, + pub flow_rate: i128, + pub last_update_ts: u64, + pub rate_updated_at: u64, + pub status: GrantStatus, } +#[derive(Clone)] #[contracttype] -pub enum GrantError { - GrantNotFound, - Unauthorized, - InvalidAmount, - MilestoneNotFound, - AlreadyApproved, - ExceedsTotalAmount, - InvalidStatus, - InvalidShares, - NotCouncilMember, - AlreadyVoted, - VotingExpired, - CliffNotPassed, - InvalidGrantee, +enum DataKey { + Admin, + Grant(u64), } -impl From for soroban_sdk::Error { - fn from(error: GrantError) -> Self { - match error { - GrantError::GrantNotFound => soroban_sdk::Error::from_contract_error(1), - GrantError::Unauthorized => soroban_sdk::Error::from_contract_error(2), - GrantError::InvalidAmount => soroban_sdk::Error::from_contract_error(3), - GrantError::MilestoneNotFound => soroban_sdk::Error::from_contract_error(4), - GrantError::AlreadyApproved => soroban_sdk::Error::from_contract_error(5), - GrantError::ExceedsTotalAmount => soroban_sdk::Error::from_contract_error(6), - GrantError::InvalidStatus => soroban_sdk::Error::from_contract_error(7), - GrantError::InvalidShares => soroban_sdk::Error::from_contract_error(8), - GrantError::NotCouncilMember => soroban_sdk::Error::from_contract_error(9), - GrantError::AlreadyVoted => soroban_sdk::Error::from_contract_error(10), - GrantError::VotingExpired => soroban_sdk::Error::from_contract_error(11), - GrantError::CliffNotPassed => soroban_sdk::Error::from_contract_error(12), - GrantError::InvalidGrantee => soroban_sdk::Error::from_contract_error(13), - } - } +#[contracterror] +#[derive(Clone, Copy, Eq, PartialEq, Debug)] +#[repr(u32)] +pub enum Error { + NotInitialized = 1, + AlreadyInitialized = 2, + NotAuthorized = 3, + GrantNotFound = 4, + GrantAlreadyExists = 5, + InvalidRate = 6, + InvalidAmount = 7, + InvalidState = 8, + MathOverflow = 9, } -#[contractimpl] -impl GrantContract { - pub fn create_grant( - env: Env, - grant_id: Symbol, - admin: Address, - grantees: Map, // address -> basis points - total_amount: u128, - token_address: Address, - cliff_end: u64, // 0 means no cliff - council_members: Vec
, - voting_threshold: u32, - ) { - admin.require_auth(); - - if total_amount == 0 { - panic_with_error!(&env, GrantError::InvalidAmount); - } +fn read_admin(env: &Env) -> Result { + env.storage() + .instance() + .get(&DataKey::Admin) + .ok_or(Error::NotInitialized) +} - // Validate that total shares equal 10000 basis points (100%) - let mut total_shares = 0u32; - for (_, share) in grantees.iter() { - total_shares += share; - } - if total_shares != 10000 { - panic_with_error!(&env, GrantError::InvalidShares); - } +fn require_admin_auth(env: &Env) -> Result<(), Error> { + let admin = read_admin(env)?; + admin.require_auth(); + Ok(()) +} - // Validate voting threshold - if voting_threshold == 0 || voting_threshold > council_members.len() as u32 { - panic_with_error!(&env, GrantError::InvalidAmount); - } +fn read_grant(env: &Env, grant_id: u64) -> Result { + env.storage() + .instance() + .get(&DataKey::Grant(grant_id)) + .ok_or(Error::GrantNotFound) +} - let grant = Grant { - admin: admin.clone(), - grantees: grantees.clone(), - total_amount, - released_amount: 0, - token_address: token_address.clone(), - created_at: env.ledger().timestamp(), - cliff_end, - status: GrantStatus::Proposed, - council_members: council_members.clone(), - voting_threshold, - flow_rate: 0, - last_settled_at: env.ledger().timestamp(), - }; - env.storage().instance().set(&DataKey::Grant(grant_id), &grant); - } - pub fn add_milestone( - env: Env, - grant_id: Symbol, - milestone_id: Symbol, - amount: u128, - description: String, - voting_period: u64, // voting period in seconds - ) { - let grant_key = DataKey::Grant(grant_id.clone()); - let grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); - - grant.admin.require_auth(); - - if amount == 0 { - panic_with_error!(&env, GrantError::InvalidAmount); - } +fn settle_grant(grant: &mut Grant, now: u64) -> Result<(), Error> { + if now < grant.last_update_ts { + return Err(Error::InvalidState); + } - let milestone = Milestone { - amount, - description, - approved: false, - approved_at: None, - votes_for: 0, - votes_against: 0, - voting_deadline: env.ledger().timestamp() + voting_period, - }; + let elapsed = now - grant.last_update_ts; + grant.last_update_ts = now; - env.storage().instance().set(&DataKey::Milestone(grant_id, milestone_id), &milestone); + if grant.status != GrantStatus::Active || elapsed == 0 || grant.flow_rate == 0 { + return Ok(()); } - // DAO Governance Functions - - pub fn propose_milestone_approval(env: Env, grant_id: Symbol, milestone_id: Symbol) { - let grant_key = DataKey::Grant(grant_id.clone()); - let grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); - - grant.admin.require_auth(); + if grant.flow_rate < 0 { + return Err(Error::InvalidRate); + } - let milestone_key = DataKey::Milestone(grant_id.clone(), milestone_id.clone()); - let mut milestone: Milestone = env.storage().instance() - .get::<_, Milestone>(&milestone_key) - .unwrap_optimized(); + let elapsed_i128 = i128::from(elapsed); + let accrued = grant + .flow_rate + .checked_mul(elapsed_i128) + .ok_or(Error::MathOverflow)?; - if milestone.approved { - panic_with_error!(&env, GrantError::AlreadyApproved); - } + let accounted = grant + .withdrawn + .checked_add(grant.claimable) + .ok_or(Error::MathOverflow)?; - // Reset voting when proposed - milestone.votes_for = 0; - milestone.votes_against = 0; - milestone.voting_deadline = env.ledger().timestamp() + 7 * 24 * 60 * 60; // 7 days default + if accounted > grant.total_amount { + return Err(Error::InvalidState); + } - env.storage().instance().set(&milestone_key, &milestone); + let remaining = grant + .total_amount + .checked_sub(accounted) + .ok_or(Error::MathOverflow)?; + + let delta = if accrued > remaining { + remaining + } else { + accrued + }; + + grant.claimable = grant + .claimable + .checked_add(delta) + .ok_or(Error::MathOverflow)?; + + let new_accounted = grant + .withdrawn + .checked_add(grant.claimable) + .ok_or(Error::MathOverflow)?; + + if new_accounted == grant.total_amount { + grant.status = GrantStatus::Completed; } - pub fn vote_milestone(env: Env, grant_id: Symbol, milestone_id: Symbol, approve: bool) { - let grant_key = DataKey::Grant(grant_id.clone()); - let grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); - - let caller = env.current_contract_address(); // In practice, this should be the signer - - // Check if caller is a council member - let mut is_council_member = false; - for member in grant.council_members.iter() { - if member == caller { - is_council_member = true; - break; - } - } - if !is_council_member { - panic_with_error!(&env, GrantError::NotCouncilMember); - } + Ok(()) +} - let milestone_key = DataKey::Milestone(grant_id.clone(), milestone_id.clone()); - let mut milestone: Milestone = env.storage().instance() - .get::<_, Milestone>(&milestone_key) - .unwrap_optimized(); +fn preview_grant_at_now(env: &Env, grant: &Grant) -> Result { + let mut preview = grant.clone(); + settle_grant(&mut preview, env.ledger().timestamp())?; + Ok(preview) +} - if milestone.approved { - panic_with_error!(&env, GrantError::AlreadyApproved); +#[contractimpl] +impl GrantContract { + pub fn initialize(env: Env, admin: Address) -> Result<(), Error> { + if env.storage().instance().has(&DataKey::Admin) { + return Err(Error::AlreadyInitialized); } + admin.require_auth(); + env.storage().instance().set(&DataKey::Admin, &admin); + Ok(()) + } - // Check if voting has expired - if env.ledger().timestamp() > milestone.voting_deadline { - panic_with_error!(&env, GrantError::VotingExpired); + pub fn create_grant( + env: Env, + grant_id: u64, + recipient: Address, + total_amount: i128, + flow_rate: i128, + ) -> Result<(), Error> { + require_admin_auth(&env)?; + + if total_amount <= 0 { + return Err(Error::InvalidAmount); } - // Check if already voted - let vote_key = DataKey::MilestoneVote(grant_id.clone(), milestone_id.clone(), caller.clone()); - if env.storage().instance().get::<_, bool>(&vote_key).is_some() { - panic_with_error!(&env, GrantError::AlreadyVoted); + if flow_rate < 0 { + return Err(Error::InvalidRate); } - // Record the vote - env.storage().instance().set(&vote_key, &approve); - - if approve { - milestone.votes_for += 1; - } else { - milestone.votes_against += 1; + let key = DataKey::Grant(grant_id); + if env.storage().instance().has(&key) { + return Err(Error::GrantAlreadyExists); } - // Check if threshold is reached - if milestone.votes_for >= grant.voting_threshold { - milestone.approved = true; - milestone.approved_at = Some(env.ledger().timestamp()); - - // Update grant and execute transfer - let mut grant_data: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); - - let new_released = grant_data.released_amount.checked_add(milestone.amount) - .unwrap_or_else(|| panic_with_error!(&env, GrantError::ExceedsTotalAmount)); - - if new_released > grant_data.total_amount { - panic_with_error!(&env, GrantError::ExceedsTotalAmount); - } - - grant_data.released_amount = new_released; - - if grant_data.released_amount == grant_data.total_amount { - grant_data.status = GrantStatus::Completed; - } - - env.storage().instance().set(&grant_key, &grant_data); - - // Transfer tokens to contract (will be distributed via withdraw) - Self::transfer_tokens(&env, &grant_data.token_address, &grant_data.admin, &env.current_contract_address(), milestone.amount); - } + let now = env.ledger().timestamp(); + let grant = Grant { + recipient, + total_amount, + withdrawn: 0, + claimable: 0, + flow_rate, + last_update_ts: now, + rate_updated_at: now, + status: GrantStatus::Active, + }; - env.storage().instance().set(&milestone_key, &milestone); + env.storage().instance().set(&key, &grant); + Ok(()) } - pub fn withdraw(env: Env, grant_id: Symbol, caller: Address) -> u128 { - let grant_key = DataKey::Grant(grant_id.clone()); - let mut grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); - - caller.require_auth(); + pub fn cancel_grant(env: Env, grant_id: u64) -> Result<(), Error> { + require_admin_auth(&env)?; + let mut grant = read_grant(&env, grant_id)?; - // Check if caller is a valid grantee - let caller_share = match grant.grantees.get(caller.clone()) { - Some(share) => share, - None => panic_with_error!(&env, GrantError::InvalidGrantee), - }; - - // Check cliff period - let current_time = env.ledger().timestamp(); - if grant.cliff_end > 0 && current_time < grant.cliff_end { - return 0; // Cliff not passed, no withdrawal allowed + if grant.status != GrantStatus::Active { + return Err(Error::InvalidState); } - // Calculate caller's total entitled amount based on their share - let caller_total_entitled = (grant.total_amount * caller_share as u128) / 10000; - - // Calculate how much the caller has already withdrawn - // For simplicity, we'll track this in a separate storage key per user - let withdrawn_key = DataKey::Withdrawn(grant_id.clone(), caller.clone()); - let already_withdrawn = env.storage().instance() - .get::<_, u128>(&withdrawn_key) - .unwrap_or(0); - - // Calculate available amount for this caller - let available_for_caller = caller_total_entitled.saturating_sub(already_withdrawn); - - if available_for_caller == 0 { - return 0; - } + settle_grant(&mut grant, env.ledger().timestamp())?; + grant.flow_rate = 0; + grant.status = GrantStatus::Cancelled; + write_grant(&env, grant_id, &grant); - // Update withdrawn amount - env.storage().instance().set(&withdrawn_key, &(already_withdrawn + available_for_caller)); - - // Update grant's released amount - grant.released_amount = grant.released_amount.checked_add(available_for_caller).unwrap_optimized(); - env.storage().instance().set(&grant_key, &grant); - - // Transfer tokens to caller - Self::transfer_tokens(&env, &grant.token_address, &env.current_contract_address(), &caller, available_for_caller); - - available_for_caller + Ok(()) } - pub fn activate_grant(env: Env, grant_id: Symbol) { - let grant_key = DataKey::Grant(grant_id.clone()); - let mut grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); - - grant.admin.require_auth(); - - match grant.status { - GrantStatus::Proposed => { - grant.status = GrantStatus::Active; - env.storage().instance().set(&grant_key, &grant); - } - _ => panic_with_error!(&env, GrantError::InvalidStatus), - } + pub fn get_grant(env: Env, grant_id: u64) -> Result { + let grant = read_grant(&env, grant_id)?; + preview_grant_at_now(&env, &grant) } - pub fn pause_grant(env: Env, grant_id: Symbol) { - let grant_key = DataKey::Grant(grant_id.clone()); - let mut grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); - - grant.admin.require_auth(); - - match grant.status { - GrantStatus::Active => { - grant.status = GrantStatus::Paused; - env.storage().instance().set(&grant_key, &grant); - } - _ => panic_with_error!(&env, GrantError::InvalidStatus), - } + pub fn claimable(env: Env, grant_id: u64) -> Result { + let grant = read_grant(&env, grant_id)?; + let preview = preview_grant_at_now(&env, &grant)?; + Ok(preview.claimable) } - pub fn resume_grant(env: Env, grant_id: Symbol) { - let grant_key = DataKey::Grant(grant_id.clone()); - let mut grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); - - grant.admin.require_auth(); - - match grant.status { - GrantStatus::Paused => { - grant.status = GrantStatus::Active; - env.storage().instance().set(&grant_key, &grant); - } - _ => panic_with_error!(&env, GrantError::InvalidStatus), + pub fn withdraw(env: Env, grant_id: u64, amount: i128) -> Result<(), Error> { + if amount <= 0 { + return Err(Error::InvalidAmount); } - } - pub fn cancel_grant(env: Env, grant_id: Symbol) { - let grant_key = DataKey::Grant(grant_id.clone()); - let mut grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); + let mut grant = read_grant(&env, grant_id)?; - grant.admin.require_auth(); - - match grant.status { - GrantStatus::Proposed | GrantStatus::Paused => { - grant.status = GrantStatus::Cancelled; - env.storage().instance().set(&grant_key, &grant); - } - _ => panic_with_error!(&env, GrantError::InvalidStatus), + if grant.status == GrantStatus::Cancelled { + return Err(Error::InvalidState); } - } - pub fn slash_flow_rate(env: Env, grant_id: Symbol, reduction_percentage: u32) { - let grant_key = DataKey::Grant(grant_id.clone()); - let mut grant: Grant = env.storage().instance() - .get::<_, Grant>(&grant_key) - .unwrap_optimized(); + grant.recipient.require_auth(); - grant.admin.require_auth(); + settle_grant(&mut grant, env.ledger().timestamp())?; - if reduction_percentage > 100 { - panic_with_error!(&env, GrantError::InvalidAmount); + if amount > grant.claimable { + return Err(Error::InvalidAmount); } - // Settle the current owed balance based on flow_rate and time elapsed - let now = env.ledger().timestamp(); - let elapsed = now.saturating_sub(grant.last_settled_at); - - if elapsed > 0 && grant.flow_rate > 0 { - let owed = grant.flow_rate.saturating_mul(elapsed as u128); - - let new_released = grant.released_amount.checked_add(owed) - .unwrap_or_else(|| panic_with_error!(&env, GrantError::ExceedsTotalAmount)); - - if new_released > grant.total_amount { - panic_with_error!(&env, GrantError::ExceedsTotalAmount); - } - - grant.released_amount = new_released; - grant.last_settled_at = now; + grant.claimable = grant + .claimable + .checked_sub(amount) + .ok_or(Error::MathOverflow)?; + grant.withdrawn = grant + .withdrawn + .checked_add(amount) + .ok_or(Error::MathOverflow)?; + + let accounted = grant + .withdrawn + .checked_add(grant.claimable) + .ok_or(Error::MathOverflow)?; + + if accounted > grant.total_amount { + return Err(Error::InvalidState); } - // Apply reduction to future flow rate - let new_rate = (grant.flow_rate.saturating_mul((100u128 - reduction_percentage as u128))) / 100u128; - grant.flow_rate = new_rate; - - env.storage().instance().set(&grant_key, &grant); + if grant.withdrawn == grant.total_amount { + grant.status = GrantStatus::Completed; + } - // Emit event: GrantSlashed(grant_id, new_rate) - env.events().publish((Symbol::short("GrantSlashed"),), (grant_id, new_rate)); - } - pub fn get_grant(env: Env, grant_id: Symbol) -> Grant { - env.storage().instance() - .get::<_, Grant>(&DataKey::Grant(grant_id)) - .unwrap_optimized() } - pub fn get_withdrawable_amount(env: Env, grant_id: Symbol, caller: Address) -> u128 { - let grant_id_clone = grant_id.clone(); - let grant: Grant = env.storage().instance() - .get::<_, Grant>(&DataKey::Grant(grant_id)) - .unwrap_optimized(); + pub fn update_rate(env: Env, grant_id: u64, new_rate: i128) -> Result<(), Error> { + require_admin_auth(&env)?; - // Check if caller is a valid grantee - let caller_share = match grant.grantees.get(caller.clone()) { - Some(share) => share, - None => return 0, - }; + if new_rate < 0 { + return Err(Error::InvalidRate); + } - // Check cliff period - let current_time = env.ledger().timestamp(); - if grant.cliff_end > 0 && current_time < grant.cliff_end { - return 0; // Cliff not passed, no withdrawal allowed + let mut grant = read_grant(&env, grant_id)?; + if grant.status != GrantStatus::Active { + return Err(Error::InvalidState); } - // Calculate caller's total entitled amount based on their share - let caller_total_entitled = (grant.total_amount * caller_share as u128) / 10000; - - // Calculate how much the caller has already withdrawn - let withdrawn_key = DataKey::Withdrawn(grant_id_clone, caller); - let already_withdrawn = env.storage().instance() - .get::<_, u128>(&withdrawn_key) - .unwrap_or(0); - - // Calculate available amount for this caller - caller_total_entitled.saturating_sub(already_withdrawn) - } + let old_rate = grant.flow_rate; - pub fn get_remaining_amount(env: Env, grant_id: Symbol) -> u128 { - let grant = Self::get_grant(env, grant_id); - grant.total_amount.saturating_sub(grant.released_amount) - } + settle_grant(&mut grant, env.ledger().timestamp())?; - fn transfer_tokens(env: &Env, token_address: &Address, from: &Address, to: &Address, amount: u128) { - let token_client = token::Client::new(env, token_address); - - // Handle potential transfer fees by checking balance after transfer - let from_balance_before = token_client.balance(from); - let to_balance_before = token_client.balance(to); - - token_client.transfer(from, to, &(amount as i128)); - - let from_balance_after = token_client.balance(from); - let to_balance_after = token_client.balance(to); - - // Verify transfer behavior for tokens with fees - let expected_from_decrease = amount as i128; - let actual_from_decrease = from_balance_before.saturating_sub(from_balance_after); - let actual_to_increase = to_balance_after.saturating_sub(to_balance_before); - - // For tokens with transfer fees, actual_to_increase might be less than amount - // This is expected behavior for fee-charging tokens - if actual_from_decrease != expected_from_decrease { - // Log warning but don't fail - some tokens might have complex fee structures - // Note: Logging is limited in Soroban, so we'll just continue - // The transfer fee detection logic is still useful for debugging + if grant.status != GrantStatus::Active { + write_grant(&env, grant_id, &grant); + return Err(Error::InvalidState); } - } -} -mod test; + grant.flow_rate = new_rate; + grant.rate_updated_at = grant.last_update_ts; -// Grant math utilities used by tests and (optionally) the contract. -pub mod grant { - /// Compute the claimable balance for a linear vesting grant. - /// - /// - `total`: total amount granted (u128) - /// - `start`: grant start timestamp (seconds, u64) - /// - `now`: current timestamp (seconds, u64) - /// - `duration`: grant duration (seconds, u64) - /// - /// Returns the amount (u128) claimable at `now` (clamped 0..=total). - pub fn compute_claimable_balance(total: u128, start: u64, now: u64, duration: u64) -> u128 { - if duration == 0 { - return if now >= start { total } else { 0 }; - } - if now <= start { - return 0; - } - let elapsed = now.saturating_sub(start); - if elapsed >= duration { - return total; - } + write_grant(&env, grant_id, &grant); - // Use decomposition to reduce risk of intermediate overflow: - // total * elapsed / duration == (total / duration) * elapsed + (total % duration) * elapsed / duration - let dur = duration as u128; - let el = elapsed as u128; - let whole = total / dur; - let rem = total % dur; - - // whole * el shouldn't overflow in realistic token amounts, but use checked_mul with fallback. - let part1 = match whole.checked_mul(el) { - Some(v) => v, - None => { - // fallback: perform (whole / dur) * (el * dur) approximated by dividing early - // This branch is extremely unlikely; clamp to total as safe fallback. - return total; - } - }; - let part2 = match rem.checked_mul(el) { - Some(v) => v / dur, - None => { - return total; - } - }; - part1 + part2 + env.events().publish( + (symbol_short!("rateupdt"), grant_id), + (old_rate, new_rate, grant.rate_updated_at), + ); + + Ok(()) } } + +mod test; diff --git a/contracts/grant_contracts/src/test.rs b/contracts/grant_contracts/src/test.rs index b614ce9..f285547 100644 --- a/contracts/grant_contracts/src/test.rs +++ b/contracts/grant_contracts/src/test.rs @@ -1,330 +1,273 @@ #![cfg(test)] -use soroban_sdk::{symbol_short, Address, Env}; -use crate::{GrantContract, GrantContractClient}; +use super::{Error, GrantContract, GrantContractClient, GrantStatus}; +use soroban_sdk::{ + testutils::{Address as _, AuthorizedFunction, Ledger}, + Address, Env, InvokeError, +}; + +fn set_timestamp(env: &Env, timestamp: u64) { + env.ledger().with_mut(|li| { + li.timestamp = timestamp; + }); +} + +fn assert_contract_error( + result: Result, Result>, + expected: Error, +) { + assert!(matches!(result, Err(Ok(err)) if err == expected)); +} #[test] -fn test_multiple_milestones() { +fn test_update_rate_settles_before_changing_rate() { let env = Env::default(); let admin = Address::generate(&env); - let grantee = Address::generate(&env); - let token_address = Address::generate(&env); + let recipient = Address::generate(&env); - let contract_id = env.register(GrantContract, ()); + let contract_id = env.register_contract(None, GrantContract); let client = GrantContractClient::new(&env, &contract_id); - // Create a grant - let grant_id = symbol_short!("grant_multi"); - client.create_grant(&grant_id, &admin, &grantee, &1_000_000, &token_address).unwrap(); - - // Add multiple milestones - let milestone_1 = symbol_short!("m1"); - let milestone_2 = symbol_short!("m2"); - let milestone_3 = symbol_short!("m3"); - - client.add_milestone(&grant_id, &milestone_1, &250_000, &String::from_str(&env, "Phase 1")).unwrap(); - client.add_milestone(&grant_id, &milestone_2, &350_000, &String::from_str(&env, "Phase 2")).unwrap(); - client.add_milestone(&grant_id, &milestone_3, &400_000, &String::from_str(&env, "Phase 3")).unwrap(); - - // Approve first milestone - client.approve_milestone(&grant_id, &milestone_1).unwrap(); - let grant_info = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info.released_amount, 250_000); - - // Approve second milestone - client.approve_milestone(&grant_id, &milestone_2).unwrap(); - let grant_info = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info.released_amount, 600_000); - - // Approve third milestone - client.approve_milestone(&grant_id, &milestone_3).unwrap(); - let grant_info = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info.released_amount, 1_000_000); + let grant_id: u64 = 1; + let rate_1: i128 = 10; + let rate_2: i128 = 25; + + set_timestamp(&env, 1_000); + client.mock_all_auths().initialize(&admin); + client + .mock_all_auths() + .create_grant(&grant_id, &recipient, &10_000, &rate_1); + + set_timestamp(&env, 1_100); + assert_eq!(client.claimable(&grant_id), 1_000); + + client.mock_all_auths().update_rate(&grant_id, &rate_2); + + let grant_after_update = client.get_grant(&grant_id); + assert_eq!(grant_after_update.claimable, 1_000); + assert_eq!(grant_after_update.flow_rate, rate_2); + assert_eq!(grant_after_update.last_update_ts, 1_100); + assert_eq!(grant_after_update.rate_updated_at, 1_100); + + set_timestamp(&env, 1_140); + assert_eq!(client.claimable(&grant_id), 1_000 + (40 * rate_2)); + + client.mock_all_auths().withdraw(&grant_id, &700); + assert_eq!(client.claimable(&grant_id), 1_000 + (40 * rate_2) - 700); + + set_timestamp(&env, 1_150); + assert_eq!(client.claimable(&grant_id), 1_000 + (50 * rate_2) - 700); } #[test] -fn test_double_release_prevention() { +fn test_update_rate_requires_admin_auth() { let env = Env::default(); let admin = Address::generate(&env); - let grantee = Address::generate(&env); - let token_address = Address::generate(&env); + let recipient = Address::generate(&env); - let contract_id = env.register(GrantContract, ()); + let contract_id = env.register_contract(None, GrantContract); let client = GrantContractClient::new(&env, &contract_id); - // Create a grant and milestone - let grant_id = symbol_short!("grant_double"); - client.create_grant(&grant_id, &admin, &grantee, &1_000_000, &token_address).unwrap(); + let grant_id: u64 = 2; - let milestone_id = symbol_short!("milestone_double"); - client.add_milestone( - &grant_id, - &milestone_id, - &500_000, - &String::from_str(&env, "Test"), - ).unwrap(); + set_timestamp(&env, 100); + client.mock_all_auths().initialize(&admin); + client + .mock_all_auths() + .create_grant(&grant_id, &recipient, &1_000, &5); - // Approve once - client.approve_milestone(&grant_id, &milestone_id).unwrap(); + client.mock_all_auths().update_rate(&grant_id, &7_i128); - // Try to approve again - should fail - let result = client.approve_milestone(&grant_id, &milestone_id); - assert!(result.is_err()); + let auths = env.auths(); + assert_eq!(auths.len(), 1); + assert_eq!(auths[0].0, admin); + assert!(matches!( + auths[0].1.function, + AuthorizedFunction::Contract((_, _, _)) + )); } #[test] -fn test_get_remaining_amount() { +fn test_update_rate_immediately_after_creation() { let env = Env::default(); let admin = Address::generate(&env); - let grantee = Address::generate(&env); - let token_address = Address::generate(&env); + let recipient = Address::generate(&env); - let contract_id = env.register(GrantContract, ()); + let contract_id = env.register_contract(None, GrantContract); let client = GrantContractClient::new(&env, &contract_id); - // Create a grant - let grant_id = symbol_short!("grant_remaining"); - client.create_grant(&grant_id, &admin, &grantee, &1_000_000, &token_address).unwrap(); + let grant_id: u64 = 3; - // Check remaining amount before any releases - let remaining = client.get_remaining_amount(&grant_id).unwrap(); - assert_eq!(remaining, 1_000_000); + set_timestamp(&env, 2_000); + client.mock_all_auths().initialize(&admin); + client + .mock_all_auths() + .create_grant(&grant_id, &recipient, &5_000, &4); - // Add and approve a milestone - let milestone_id = symbol_short!("m1"); - client.add_milestone(&grant_id, &milestone_id, &400_000, &String::from_str(&env, "Phase 1")).unwrap(); - client.approve_milestone(&grant_id, &milestone_id).unwrap(); + client.mock_all_auths().update_rate(&grant_id, &9); - // Check remaining amount after release - let remaining = client.get_remaining_amount(&grant_id).unwrap(); - assert_eq!(remaining, 600_000); + let grant = client.get_grant(&grant_id); + assert_eq!(grant.claimable, 0); + assert_eq!(grant.flow_rate, 9); + assert_eq!(grant.last_update_ts, 2_000); + + set_timestamp(&env, 2_010); + assert_eq!(client.claimable(&grant_id), 90); } #[test] -fn test_exceed_total_grant_amount() { +fn test_update_rate_multiple_times_with_time_gaps() { let env = Env::default(); let admin = Address::generate(&env); - let grantee = Address::generate(&env); - let token_address = Address::generate(&env); + let recipient = Address::generate(&env); - let contract_id = env.register(GrantContract, ()); + let contract_id = env.register_contract(None, GrantContract); let client = GrantContractClient::new(&env, &contract_id); - // Create a grant with 1M total - let grant_id = symbol_short!("grant_exceed"); - client.create_grant(&grant_id, &admin, &grantee, &1_000_000, &token_address).unwrap(); + let grant_id: u64 = 4; - // Add milestone for 600K - let milestone_1 = symbol_short!("m1"); - client.add_milestone(&grant_id, &milestone_1, &600_000, &String::from_str(&env, "Phase 1")).unwrap(); - client.approve_milestone(&grant_id, &milestone_1).unwrap(); + set_timestamp(&env, 10); + client.mock_all_auths().initialize(&admin); + client + .mock_all_auths() + .create_grant(&grant_id, &recipient, &10_000, &3); - // Add milestone for 500K (would exceed total) - let milestone_2 = symbol_short!("m2"); - client.add_milestone(&grant_id, &milestone_2, &500_000, &String::from_str(&env, "Phase 2")).unwrap(); + set_timestamp(&env, 20); + client.mock_all_auths().update_rate(&grant_id, &5); - // Trying to approve should fail - let result = client.approve_milestone(&grant_id, &milestone_2); - assert!(result.is_err()); -} + set_timestamp(&env, 40); + client.mock_all_auths().update_rate(&grant_id, &2); -#[test] -fn test_grant_simulation_10_years() { - // 10 years in seconds - let duration: u64 = 315_360_000; - - // Total grant amount - let total: u128 = 1_000_000_000u128; - - // Use a realistic large timestamp to catch overflow issues - let start: u64 = 1_700_000_000; - - // -------------------------------------------------- - // ✔ Start: nothing should be claimable - // -------------------------------------------------- - let claim0 = - grant::compute_claimable_balance(total, start, start, duration); - assert_eq!(claim0, 0); - - // -------------------------------------------------- - // ✔ Year 5: exactly 50% - // -------------------------------------------------- - let year5 = start + duration / 2; - let claim5 = - grant::compute_claimable_balance(total, start, year5, duration); - - assert_eq!(claim5, total / 2); - - // -------------------------------------------------- - // ✔ Year 10: 100% vested - // -------------------------------------------------- - let year10 = start + duration; - let claim10 = - grant::compute_claimable_balance(total, start, year10, duration); - - assert_eq!(claim10, total); - - // -------------------------------------------------- - // ✔ After expiry: must remain capped at total - // -------------------------------------------------- - let after = year10 + 1_000_000; - let claim_after = - grant::compute_claimable_balance(total, start, after, duration); - - assert_eq!(claim_after, total); - - // -------------------------------------------------- - // ✔ Verify constant equals 10-year duration - // -------------------------------------------------- - assert_eq!(duration, 315_360_000u64); + set_timestamp(&env, 70); + assert_eq!(client.claimable(&grant_id), 30 + 100 + 60); } #[test] -fn test_custom_token_with_transfer_fee() { +fn test_update_rate_pause_then_resume() { let env = Env::default(); let admin = Address::generate(&env); - let grantee = Address::generate(&env); - - // Deploy a custom token contract with transfer fee - let token_contract_id = env.register_stellar_asset_contract(admin.clone()); - let token_client = soroban_sdk::token::Client::new(&env, &token_contract_id); - - // Mint tokens to admin - token_client.mint(&admin, &1_000_000); - - let contract_id = env.register(GrantContract, ()); + let recipient = Address::generate(&env); + + let contract_id = env.register_contract(None, GrantContract); let client = GrantContractClient::new(&env, &contract_id); - // Create a grant with custom token - let grant_id = symbol_short!("grant_custom_token"); - client.create_grant(&grant_id, &admin, &grantee, &500_000, &token_contract_id).unwrap(); - - // Add milestone - let milestone_id = symbol_short!("m1"); - client.add_milestone(&grant_id, &milestone_id, &100_000, &String::from_str(&env, "Phase 1")).unwrap(); - - // Check contract balance before approval - let contract_balance_before = token_client.balance(&contract_id); - - // Approve milestone - this should handle transfer fees correctly - client.approve_milestone(&grant_id, &milestone_id).unwrap(); - - // Verify contract balance tracks correctly (accounting for potential fees) - let contract_balance_after = token_client.balance(&contract_id); - let grantee_balance = token_client.balance(&grantee); - - // The grantee should receive tokens (amount might be less due to fees) - assert!(grantee_balance > 0); - - // Contract should have remaining balance - assert_eq!(contract_balance_after, contract_balance_before); - - // Verify grant state - let grant_info = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info.released_amount, 100_000); + let grant_id: u64 = 5; + + set_timestamp(&env, 1_000); + client.mock_all_auths().initialize(&admin); + client + .mock_all_auths() + .create_grant(&grant_id, &recipient, &20_000, &4); + + set_timestamp(&env, 1_050); + client.mock_all_auths().update_rate(&grant_id, &0); + assert_eq!(client.claimable(&grant_id), 200); + + set_timestamp(&env, 1_250); + assert_eq!(client.claimable(&grant_id), 200); + + client.mock_all_auths().update_rate(&grant_id, &6); + + set_timestamp(&env, 1_300); + assert_eq!(client.claimable(&grant_id), 200 + (50 * 6)); } #[test] -fn test_long_pause_duration() { +fn test_update_rate_rejects_invalid_rate_and_inactive_states() { let env = Env::default(); let admin = Address::generate(&env); - let grantee = Address::generate(&env); - let token_address = Address::generate(&env); + let recipient = Address::generate(&env); - let contract_id = env.register(GrantContract, ()); + let contract_id = env.register_contract(None, GrantContract); let client = GrantContractClient::new(&env, &contract_id); - // Create a grant - let grant_id = symbol_short!("grant_long_pause"); - client.create_grant(&grant_id, &admin, &grantee, &1_000_000, &token_address).unwrap(); - - // Add milestone - let milestone_id = symbol_short!("m1"); - client.add_milestone(&grant_id, &milestone_id, &500_000, &String::from_str(&env, "Phase 1")).unwrap(); - - // Activate the grant - client.activate_grant(&grant_id).unwrap(); - - // Simulate long pause (100 years in seconds) - let hundred_years_seconds: u64 = 100 * 365 * 24 * 60 * 60; // ~3.15 billion seconds - env.ledger().set_timestamp(env.ledger().timestamp() + hundred_years_seconds); - - // Pause the grant - client.pause_grant(&grant_id).unwrap(); - - // Verify grant is paused - let grant_info = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info.status, crate::GrantStatus::Paused); - - // Resume after long pause - client.resume_grant(&grant_id).unwrap(); - - // Verify grant is active again - let grant_info_after = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info_after.status, crate::GrantStatus::Active); - - // Approve milestone should still work after long pause - client.approve_milestone(&grant_id, &milestone_id).unwrap(); - - // Verify total_withdrawn + remaining == initial_deposit - let remaining = client.get_remaining_amount(&grant_id).unwrap(); - let grant_info_final = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info_final.released_amount + remaining, 1_000_000); + set_timestamp(&env, 0); + client.mock_all_auths().initialize(&admin); + + let negative_rate_grant: u64 = 6; + client + .mock_all_auths() + .create_grant(&negative_rate_grant, &recipient, &1_000, &5); + assert_contract_error( + client + .mock_all_auths() + .try_update_rate(&negative_rate_grant, &-1_i128), + Error::InvalidRate, + ); + + let cancelled_grant: u64 = 7; + client + .mock_all_auths() + .create_grant(&cancelled_grant, &recipient, &1_000, &5); + client.mock_all_auths().cancel_grant(&cancelled_grant); + assert_contract_error( + client + .mock_all_auths() + .try_update_rate(&cancelled_grant, &8_i128), + Error::InvalidState, + ); + + let completed_grant: u64 = 8; + client + .mock_all_auths() + .create_grant(&completed_grant, &recipient, &100, &10); + set_timestamp(&env, 10); + client.mock_all_auths().withdraw(&completed_grant, &100); + + let completed = client.get_grant(&completed_grant); + assert_eq!(completed.status, GrantStatus::Completed); + + assert_contract_error( + client + .mock_all_auths() + .try_update_rate(&completed_grant, &4_i128), + Error::InvalidState, + ); } -// Fuzz test for extreme pause durations #[test] -fn test_fuzz_extreme_pause_durations() { +fn test_withdraw_after_rate_updates_no_extra_withdrawal() { let env = Env::default(); let admin = Address::generate(&env); - let grantee = Address::generate(&env); - let token_address = Address::generate(&env); + let recipient = Address::generate(&env); - let contract_id = env.register(GrantContract, ()); + let contract_id = env.register_contract(None, GrantContract); let client = GrantContractClient::new(&env, &contract_id); - // Test various extreme pause durations - let test_durations = vec![ - 0u64, // No pause - 1u64, // 1 second - 86_400u64, // 1 day - 31_536_000u64, // 1 year - 3_153_600_000u64, // 100 years - u64::MAX / 2, // Very large duration - ]; - - for (i, pause_duration) in test_durations.iter().enumerate() { - let grant_id = symbol_short!(&format!("grant_fuzz_{}", i)); - client.create_grant(&grant_id, &admin, &grantee, &1_000_000, &token_address).unwrap(); - - let milestone_id = symbol_short!(&format!("m_fuzz_{}", i)); - client.add_milestone(&grant_id, &milestone_id, &100_000, &String::from_str(&env, "Test")).unwrap(); - - // Activate the grant - client.activate_grant(&grant_id).unwrap(); - - // Advance time by pause duration - env.ledger().set_timestamp(env.ledger().timestamp() + pause_duration); - - // Pause and resume - client.pause_grant(&grant_id).unwrap(); - - // Verify paused status - let grant_info_paused = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info_paused.status, crate::GrantStatus::Paused); - - client.resume_grant(&grant_id).unwrap(); - - // Verify active status - let grant_info_resumed = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info_resumed.status, crate::GrantStatus::Active); - - // Approve milestone - client.approve_milestone(&grant_id, &milestone_id).unwrap(); - - // Verify invariants - let remaining = client.get_remaining_amount(&grant_id).unwrap(); - let grant_info = client.get_grant(&grant_id).unwrap(); - assert_eq!(grant_info.released_amount + remaining, 1_000_000); - } -} \ No newline at end of file + let grant_id: u64 = 9; + + set_timestamp(&env, 0); + client.mock_all_auths().initialize(&admin); + client + .mock_all_auths() + .create_grant(&grant_id, &recipient, &1_000, &10); + + set_timestamp(&env, 20); + client.mock_all_auths().update_rate(&grant_id, &5); + + set_timestamp(&env, 60); + assert_eq!(client.claimable(&grant_id), 400); + + client.mock_all_auths().withdraw(&grant_id, &400); + assert_eq!(client.claimable(&grant_id), 0); + + assert_contract_error( + client.mock_all_auths().try_withdraw(&grant_id, &1), + Error::InvalidAmount, + ); + + set_timestamp(&env, 180); + assert_eq!(client.claimable(&grant_id), 600); + + client.mock_all_auths().withdraw(&grant_id, &600); + assert_eq!(client.claimable(&grant_id), 0); + + let grant = client.get_grant(&grant_id); + assert_eq!(grant.withdrawn, 1_000); + assert_eq!(grant.status, GrantStatus::Completed); + + assert_contract_error( + client.mock_all_auths().try_withdraw(&grant_id, &1), + Error::InvalidAmount, + ); +} diff --git a/target/flycheck0/stderr b/target/flycheck0/stderr new file mode 100644 index 0000000..e75fc13 --- /dev/null +++ b/target/flycheck0/stderr @@ -0,0 +1,8 @@ +error: failed to parse lock file at: C:\Users\googl\Desktop\Drip wave 2\contracts\Cargo.lock + +Caused by: + TOML parse error at line 6, column 9 + | + 6 | <<<<<<< HEAD + | ^ + key with no value, expected `=` diff --git a/target/flycheck0/stdout b/target/flycheck0/stdout new file mode 100644 index 0000000..e69de29