difftreelog
Merge branch 'develop' into feature/types-repo
in: master
102 files changed
.devcontainer/Dockerfilediffbeforeafterboth13 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \13 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \14 nvm install v16.2.0 && \14 nvm install v16.2.0 && \15 npm install -g yarn && \15 npm install -g yarn && \16 rustup toolchain install nightly-2021-06-28 && \16 rustup toolchain install nightly-2021-11-11 && \17 rustup default nightly-2021-06-28 && \17 rustup default nightly-2021-11-11 && \18 rustup target add wasm32-unknown-unknown && \18 rustup target add wasm32-unknown-unknown && \19 rustup component add rustfmt clippy && \19 rustup component add rustfmt clippy && \20 cargo install cargo-expand cargo-edit cargo-contract20 cargo install cargo-expand cargo-edit cargo-contract.envdiffbeforeafterboth1RUST_TOOLCHAIN=nightly-2021-06-281RUST_TOOLCHAIN=nightly-2021-11-112RUST_C=1.55.0-nightly2RUST_C=1.55.0-nightly3POLKA_VERSION=v0.9.123POLKA_VERSION=v0.9.124UNIQUE_BRANCH=develop4UNIQUE_BRANCH=develop.maintain/frame-weight-template.hbsdiffbeforeafterboth14#![cfg_attr(rustfmt, rustfmt_skip)]14#![cfg_attr(rustfmt, rustfmt_skip)]15#![allow(unused_parens)]15#![allow(unused_parens)]16#![allow(unused_imports)]16#![allow(unused_imports)]17#![allow(clippy::unnecessary_cast)]171818use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};19use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};19use sp_std::marker::PhantomData;20use sp_std::marker::PhantomData;Cargo.lockdiffbeforeafterboth117117118[[package]]118[[package]]119name = "anyhow"119name = "anyhow"120version = "1.0.44"120version = "1.0.48"121source = "registry+https://github.com/rust-lang/crates.io-index"121source = "registry+https://github.com/rust-lang/crates.io-index"122checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1"122checksum = "62e1f47f7dc0422027a4e370dd4548d4d66b26782e513e98dca1e689e058a80e"123123124[[package]]124[[package]]125name = "approx"125name = "approx"259259260[[package]]260[[package]]261name = "async-process"261name = "async-process"262version = "1.2.0"262version = "1.3.0"263source = "registry+https://github.com/rust-lang/crates.io-index"263source = "registry+https://github.com/rust-lang/crates.io-index"264checksum = "b21b63ab5a0db0369deb913540af2892750e42d949faacc7a61495ac418a1692"264checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6"265dependencies = [265dependencies = [266 "async-io",266 "async-io",267 "blocking",267 "blocking",362362363[[package]]363[[package]]364name = "atomic"364name = "atomic"365version = "0.5.0"365version = "0.5.1"366source = "registry+https://github.com/rust-lang/crates.io-index"366source = "registry+https://github.com/rust-lang/crates.io-index"367checksum = "c3410529e8288c463bedb5930f82833bc0c90e5d2fe639a56582a4d09220b281"367checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c"368dependencies = [368dependencies = [369 "autocfg",369 "autocfg",370]370]460dependencies = [460dependencies = [461 "beefy-primitives",461 "beefy-primitives",462 "fnv",462 "fnv",463 "futures 0.3.17",463 "futures 0.3.18",464 "log",464 "log",465 "parity-scale-codec",465 "parity-scale-codec",466 "parking_lot 0.11.2",466 "parking_lot 0.11.2",488dependencies = [488dependencies = [489 "beefy-gadget",489 "beefy-gadget",490 "beefy-primitives",490 "beefy-primitives",491 "futures 0.3.17",491 "futures 0.3.18",492 "jsonrpc-core",492 "jsonrpc-core",493 "jsonrpc-core-client",493 "jsonrpc-core-client",494 "jsonrpc-derive",494 "jsonrpc-derive",531531532[[package]]532[[package]]533name = "bindgen"533name = "bindgen"534version = "0.59.1"534version = "0.59.2"535source = "registry+https://github.com/rust-lang/crates.io-index"535source = "registry+https://github.com/rust-lang/crates.io-index"536checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375"536checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8"537dependencies = [537dependencies = [538 "bitflags",538 "bitflags",539 "cexpr",539 "cexpr",554source = "registry+https://github.com/rust-lang/crates.io-index"554source = "registry+https://github.com/rust-lang/crates.io-index"555checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"555checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"556557[[package]]558name = "bitvec"559version = "0.19.5"560source = "registry+https://github.com/rust-lang/crates.io-index"561checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321"562dependencies = [563 "funty",564 "radium 0.5.3",565 "tap",566 "wyz",567]568556569[[package]]557[[package]]570name = "bitvec"558name = "bitvec"573checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848"561checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848"574dependencies = [562dependencies = [575 "funty",563 "funty",576 "radium 0.6.2",564 "radium",577 "tap",565 "tap",578 "wyz",566 "wyz",579]567]675663676[[package]]664[[package]]677name = "blocking"665name = "blocking"678version = "1.0.2"666version = "1.1.0"679source = "registry+https://github.com/rust-lang/crates.io-index"667source = "registry+https://github.com/rust-lang/crates.io-index"680checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9"668checksum = "046e47d4b2d391b1f6f8b407b1deb8dee56c1852ccd868becf2710f601b5f427"681dependencies = [669dependencies = [682 "async-channel",670 "async-channel",683 "async-task",671 "async-task",729version = "0.1.0"717version = "0.1.0"730source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"718source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"731dependencies = [719dependencies = [732 "bitvec 0.20.4",720 "bitvec",733 "bp-runtime",721 "bp-runtime",734 "frame-support",722 "frame-support",735 "frame-system",723 "frame-system",736 "impl-trait-for-tuples 0.2.1",724 "impl-trait-for-tuples",737 "parity-scale-codec",725 "parity-scale-codec",738 "scale-info",726 "scale-info",739 "serde",727 "serde",971959972[[package]]960[[package]]973name = "cc"961name = "cc"974version = "1.0.71"962version = "1.0.72"975source = "registry+https://github.com/rust-lang/crates.io-index"963source = "registry+https://github.com/rust-lang/crates.io-index"976checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd"964checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"977dependencies = [965dependencies = [978 "jobserver",966 "jobserver",979]967]980968981[[package]]969[[package]]982name = "cexpr"970name = "cexpr"983version = "0.5.0"971version = "0.6.0"984source = "registry+https://github.com/rust-lang/crates.io-index"972source = "registry+https://github.com/rust-lang/crates.io-index"985checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89"973checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"986dependencies = [974dependencies = [987 "nom",975 "nom",988]976]1080dependencies = [1068dependencies = [1081 "glob",1069 "glob",1082 "libc",1070 "libc",1083 "libloading 0.7.1",1071 "libloading 0.7.2",1084]1072]108510731086[[package]]1074[[package]]114611341147[[package]]1135[[package]]1148name = "cpp_demangle"1136name = "cpp_demangle"1149version = "0.3.3"1137version = "0.3.4"1150source = "registry+https://github.com/rust-lang/crates.io-index"1138source = "registry+https://github.com/rust-lang/crates.io-index"1151checksum = "8ea47428dc9d2237f3c6bc134472edfd63ebba0af932e783506dcfd66f10d18a"1139checksum = "931ab2a3e6330a07900b8e7ca4e106cdcbb93f2b9a52df55e54ee53d8305b55d"1152dependencies = [1140dependencies = [1153 "cfg-if 1.0.0",1141 "cfg-if 1.0.0",1154]1142]126312511264[[package]]1252[[package]]1265name = "crc32fast"1253name = "crc32fast"1266version = "1.2.1"1254version = "1.2.2"1267source = "registry+https://github.com/rust-lang/crates.io-index"1255source = "registry+https://github.com/rust-lang/crates.io-index"1268checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"1256checksum = "3825b1e8580894917dc4468cb634a1b4e9745fddc854edad72d9c04644c0319f"1269dependencies = [1257dependencies = [1270 "cfg-if 1.0.0",1258 "cfg-if 1.0.0",1271]1259]1392[[package]]1380[[package]]1393name = "cumulus-client-cli"1381name = "cumulus-client-cli"1394version = "0.1.0"1382version = "0.1.0"1395source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1383source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1396dependencies = [1384dependencies = [1397 "sc-cli",1385 "sc-cli",1398 "sc-service",1386 "sc-service",1402[[package]]1390[[package]]1403name = "cumulus-client-collator"1391name = "cumulus-client-collator"1404version = "0.1.0"1392version = "0.1.0"1405source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1393source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1406dependencies = [1394dependencies = [1407 "cumulus-client-consensus-common",1395 "cumulus-client-consensus-common",1408 "cumulus-client-network",1396 "cumulus-client-network",1409 "cumulus-primitives-core",1397 "cumulus-primitives-core",1410 "futures 0.3.17",1398 "futures 0.3.18",1411 "parity-scale-codec",1399 "parity-scale-codec",1412 "parking_lot 0.10.2",1400 "parking_lot 0.10.2",1413 "polkadot-node-primitives",1401 "polkadot-node-primitives",1425[[package]]1413[[package]]1426name = "cumulus-client-consensus-aura"1414name = "cumulus-client-consensus-aura"1427version = "0.1.0"1415version = "0.1.0"1428source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1416source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1429dependencies = [1417dependencies = [1430 "async-trait",1418 "async-trait",1431 "cumulus-client-consensus-common",1419 "cumulus-client-consensus-common",1432 "cumulus-primitives-core",1420 "cumulus-primitives-core",1433 "futures 0.3.17",1421 "futures 0.3.18",1434 "parity-scale-codec",1422 "parity-scale-codec",1435 "polkadot-client",1423 "polkadot-client",1436 "sc-client-api",1424 "sc-client-api",1455[[package]]1443[[package]]1456name = "cumulus-client-consensus-common"1444name = "cumulus-client-consensus-common"1457version = "0.1.0"1445version = "0.1.0"1458source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1446source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1459dependencies = [1447dependencies = [1460 "async-trait",1448 "async-trait",1461 "dyn-clone",1449 "dyn-clone",1462 "futures 0.3.17",1450 "futures 0.3.18",1463 "parity-scale-codec",1451 "parity-scale-codec",1464 "polkadot-primitives",1452 "polkadot-primitives",1465 "sc-client-api",1453 "sc-client-api",1475[[package]]1463[[package]]1476name = "cumulus-client-network"1464name = "cumulus-client-network"1477version = "0.1.0"1465version = "0.1.0"1478source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1466source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1479dependencies = [1467dependencies = [1480 "derive_more",1468 "derive_more",1481 "futures 0.3.17",1469 "futures 0.3.18",1482 "futures-timer 3.0.2",1470 "futures-timer 3.0.2",1483 "parity-scale-codec",1471 "parity-scale-codec",1484 "parking_lot 0.10.2",1472 "parking_lot 0.10.2",1498[[package]]1486[[package]]1499name = "cumulus-client-pov-recovery"1487name = "cumulus-client-pov-recovery"1500version = "0.1.0"1488version = "0.1.0"1501source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1489source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1502dependencies = [1490dependencies = [1503 "cumulus-primitives-core",1491 "cumulus-primitives-core",1504 "futures 0.3.17",1492 "futures 0.3.18",1505 "futures-timer 3.0.2",1493 "futures-timer 3.0.2",1506 "parity-scale-codec",1494 "parity-scale-codec",1507 "polkadot-node-primitives",1495 "polkadot-node-primitives",1521[[package]]1509[[package]]1522name = "cumulus-client-service"1510name = "cumulus-client-service"1523version = "0.1.0"1511version = "0.1.0"1524source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1512source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1525dependencies = [1513dependencies = [1526 "cumulus-client-collator",1514 "cumulus-client-collator",1527 "cumulus-client-consensus-common",1515 "cumulus-client-consensus-common",1550[[package]]1538[[package]]1551name = "cumulus-pallet-aura-ext"1539name = "cumulus-pallet-aura-ext"1552version = "0.1.0"1540version = "0.1.0"1553source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1541source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1554dependencies = [1542dependencies = [1555 "frame-executive",1543 "frame-executive",1556 "frame-support",1544 "frame-support",1568[[package]]1556[[package]]1569name = "cumulus-pallet-dmp-queue"1557name = "cumulus-pallet-dmp-queue"1570version = "0.1.0"1558version = "0.1.0"1571source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1559source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1572dependencies = [1560dependencies = [1573 "cumulus-primitives-core",1561 "cumulus-primitives-core",1574 "frame-support",1562 "frame-support",1586[[package]]1574[[package]]1587name = "cumulus-pallet-parachain-system"1575name = "cumulus-pallet-parachain-system"1588version = "0.1.0"1576version = "0.1.0"1589source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1577source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1590dependencies = [1578dependencies = [1591 "cumulus-pallet-parachain-system-proc-macro",1579 "cumulus-pallet-parachain-system-proc-macro",1592 "cumulus-primitives-core",1580 "cumulus-primitives-core",1615[[package]]1603[[package]]1616name = "cumulus-pallet-parachain-system-proc-macro"1604name = "cumulus-pallet-parachain-system-proc-macro"1617version = "0.1.0"1605version = "0.1.0"1618source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1606source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1619dependencies = [1607dependencies = [1620 "proc-macro-crate 1.1.0",1608 "proc-macro-crate 1.1.0",1621 "proc-macro2",1609 "proc-macro2",1626[[package]]1614[[package]]1627name = "cumulus-pallet-xcm"1615name = "cumulus-pallet-xcm"1628version = "0.1.0"1616version = "0.1.0"1629source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1617source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1630dependencies = [1618dependencies = [1631 "cumulus-primitives-core",1619 "cumulus-primitives-core",1632 "frame-support",1620 "frame-support",1643[[package]]1631[[package]]1644name = "cumulus-pallet-xcmp-queue"1632name = "cumulus-pallet-xcmp-queue"1645version = "0.1.0"1633version = "0.1.0"1646source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1634source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1647dependencies = [1635dependencies = [1648 "cumulus-primitives-core",1636 "cumulus-primitives-core",1649 "frame-support",1637 "frame-support",1661[[package]]1649[[package]]1662name = "cumulus-primitives-core"1650name = "cumulus-primitives-core"1663version = "0.1.0"1651version = "0.1.0"1664source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1652source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1665dependencies = [1653dependencies = [1666 "frame-support",1654 "frame-support",1667 "impl-trait-for-tuples 0.2.1",1655 "impl-trait-for-tuples",1668 "parity-scale-codec",1656 "parity-scale-codec",1669 "polkadot-core-primitives",1657 "polkadot-core-primitives",1670 "polkadot-parachain",1658 "polkadot-parachain",1678[[package]]1666[[package]]1679name = "cumulus-primitives-parachain-inherent"1667name = "cumulus-primitives-parachain-inherent"1680version = "0.1.0"1668version = "0.1.0"1681source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1669source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1682dependencies = [1670dependencies = [1683 "async-trait",1671 "async-trait",1684 "cumulus-primitives-core",1672 "cumulus-primitives-core",1700[[package]]1688[[package]]1701name = "cumulus-primitives-timestamp"1689name = "cumulus-primitives-timestamp"1702version = "0.1.0"1690version = "0.1.0"1703source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1691source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1704dependencies = [1692dependencies = [1705 "cumulus-primitives-core",1693 "cumulus-primitives-core",1706 "sp-inherents",1694 "sp-inherents",1711[[package]]1699[[package]]1712name = "cumulus-primitives-utility"1700name = "cumulus-primitives-utility"1713version = "0.1.0"1701version = "0.1.0"1714source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1702source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1715dependencies = [1703dependencies = [1716 "cumulus-primitives-core",1704 "cumulus-primitives-core",1717 "frame-support",1705 "frame-support",1728[[package]]1716[[package]]1729name = "cumulus-test-relay-sproof-builder"1717name = "cumulus-test-relay-sproof-builder"1730version = "0.1.0"1718version = "0.1.0"1731source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1719source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1732dependencies = [1720dependencies = [1733 "cumulus-primitives-core",1721 "cumulus-primitives-core",1734 "parity-scale-codec",1722 "parity-scale-codec",195319411954[[package]]1942[[package]]1955name = "ed25519"1943name = "ed25519"1956version = "1.2.0"1944version = "1.3.0"1957source = "registry+https://github.com/rust-lang/crates.io-index"1945source = "registry+https://github.com/rust-lang/crates.io-index"1958checksum = "4620d40f6d2601794401d6dd95a5cf69b6c157852539470eeda433a99b3c0efc"1946checksum = "74e1069e39f1454367eb2de793ed062fac4c35c2934b76a81d90dd9abcd28816"1959dependencies = [1947dependencies = [1960 "signature",1948 "signature",1961]1949]211120992112[[package]]2100[[package]]2113name = "ethereum"2101name = "ethereum"2114version = "0.9.0"2102version = "0.10.0"2115source = "git+https://github.com/purestake/ethereum?branch=joshy-scale-info#2b98173bd88c05bfeefad421d260101b9008497b"2103source = "registry+https://github.com/rust-lang/crates.io-index"2104checksum = "81fb916554a4dba293ea69c69ad5653e21d770a9d0c2496b5fa0a1f5a3946d87"2116dependencies = [2105dependencies = [2117 "bytes 1.1.0",2106 "bytes 1.1.0",2118 "ethereum-types",2107 "ethereum-types",215121402152[[package]]2141[[package]]2153name = "evm"2142name = "evm"2154version = "0.30.0"2143version = "0.33.0"2155source = "git+https://github.com/uniquenetwork/evm.git?branch=precompile-output-parachain#bed08923a76339880e05df25a52c5334e9997bb2"2144source = "git+https://github.com/uniquenetwork/evm.git?branch=unique-weights#3113ac1ced53bf27e9845107fd30901708824cc4"2156dependencies = [2145dependencies = [2157 "environmental",2146 "environmental",2158 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2147 "ethereum 0.10.0",2159 "evm-core",2148 "evm-core",2160 "evm-gasometer",2149 "evm-gasometer",2161 "evm-runtime",2150 "evm-runtime",2172name = "evm-coder"2161name = "evm-coder"2173version = "0.1.0"2162version = "0.1.0"2174dependencies = [2163dependencies = [2175 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2164 "ethereum 0.10.0",2176 "evm-coder-macros",2165 "evm-coder-macros",2177 "evm-core",2166 "evm-core",2178 "hex",2167 "hex",2179 "hex-literal",2168 "hex-literal",2180 "impl-trait-for-tuples 0.2.1",2169 "impl-trait-for-tuples",2181 "primitive-types 0.10.1",2170 "primitive-types 0.10.1",2182]2171]21832172219621852197[[package]]2186[[package]]2198name = "evm-core"2187name = "evm-core"2199version = "0.30.0"2188version = "0.33.0"2200source = "git+https://github.com/uniquenetwork/evm.git?branch=precompile-output-parachain#bed08923a76339880e05df25a52c5334e9997bb2"2189source = "git+https://github.com/uniquenetwork/evm.git?branch=unique-weights#3113ac1ced53bf27e9845107fd30901708824cc4"2201dependencies = [2190dependencies = [2202 "funty",2191 "funty",2203 "parity-scale-codec",2192 "parity-scale-codec",220821972209[[package]]2198[[package]]2210name = "evm-gasometer"2199name = "evm-gasometer"2211version = "0.30.0"2200version = "0.33.0"2212source = "git+https://github.com/uniquenetwork/evm.git?branch=precompile-output-parachain#bed08923a76339880e05df25a52c5334e9997bb2"2201source = "git+https://github.com/uniquenetwork/evm.git?branch=unique-weights#3113ac1ced53bf27e9845107fd30901708824cc4"2213dependencies = [2202dependencies = [2214 "environmental",2203 "environmental",2215 "evm-core",2204 "evm-core",221922082220[[package]]2209[[package]]2221name = "evm-runtime"2210name = "evm-runtime"2222version = "0.30.0"2211version = "0.33.0"2223source = "git+https://github.com/uniquenetwork/evm.git?branch=precompile-output-parachain#bed08923a76339880e05df25a52c5334e9997bb2"2212source = "git+https://github.com/uniquenetwork/evm.git?branch=unique-weights#3113ac1ced53bf27e9845107fd30901708824cc4"2224dependencies = [2213dependencies = [2225 "environmental",2214 "environmental",2226 "evm-core",2215 "evm-core",2234source = "registry+https://github.com/rust-lang/crates.io-index"2223source = "registry+https://github.com/rust-lang/crates.io-index"2235checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5"2224checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5"2236dependencies = [2225dependencies = [2237 "futures 0.3.17",2226 "futures 0.3.18",2238]2227]223922282240[[package]]2229[[package]]2261[[package]]2250[[package]]2262name = "fc-consensus"2251name = "fc-consensus"2263version = "2.0.0-dev"2252version = "2.0.0-dev"2264source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2253source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2265dependencies = [2254dependencies = [2266 "async-trait",2255 "async-trait",2267 "derive_more",2256 "derive_more",2268 "fc-db",2257 "fc-db",2269 "fp-consensus",2258 "fp-consensus",2270 "fp-rpc",2259 "fp-rpc",2271 "futures 0.3.17",2260 "futures 0.3.18",2272 "log",2261 "log",2273 "parity-scale-codec",2262 "parity-scale-codec",2274 "sc-client-api",2263 "sc-client-api",2288[[package]]2277[[package]]2289name = "fc-db"2278name = "fc-db"2290version = "2.0.0-dev"2279version = "2.0.0-dev"2291source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2280source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2292dependencies = [2281dependencies = [2293 "fp-storage",2282 "fp-storage",2294 "kvdb",2283 "kvdb",2304[[package]]2293[[package]]2305name = "fc-mapping-sync"2294name = "fc-mapping-sync"2306version = "2.0.0-dev"2295version = "2.0.0-dev"2307source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2296source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2308dependencies = [2297dependencies = [2309 "fc-consensus",2298 "fc-consensus",2310 "fc-db",2299 "fc-db",2311 "fp-consensus",2300 "fp-consensus",2312 "fp-rpc",2301 "fp-rpc",2313 "futures 0.3.17",2302 "futures 0.3.18",2314 "futures-timer 3.0.2",2303 "futures-timer 3.0.2",2315 "log",2304 "log",2316 "sc-client-api",2305 "sc-client-api",2322[[package]]2311[[package]]2323name = "fc-rpc"2312name = "fc-rpc"2324version = "2.0.0-dev"2313version = "2.0.0-dev"2325source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2314source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2326dependencies = [2315dependencies = [2327 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2316 "ethereum 0.10.0",2328 "ethereum-types",2317 "ethereum-types",2329 "evm",2318 "evm",2330 "fc-consensus",2319 "fc-consensus",2334 "fp-evm",2323 "fp-evm",2335 "fp-rpc",2324 "fp-rpc",2336 "fp-storage",2325 "fp-storage",2337 "futures 0.3.17",2326 "futures 0.3.18",2338 "futures-util",2327 "futures-util",2339 "jsonrpc-core",2328 "jsonrpc-core",2340 "jsonrpc-pubsub",2329 "jsonrpc-pubsub",2366[[package]]2355[[package]]2367name = "fc-rpc-core"2356name = "fc-rpc-core"2368version = "1.1.0-dev"2357version = "1.1.0-dev"2369source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2358source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2370dependencies = [2359dependencies = [2371 "ethereum-types",2360 "ethereum-types",2372 "jsonrpc-core",2361 "jsonrpc-core",2404checksum = "e8ac3ff5224ef91f3c97e03eb1de2db82743427e91aaa5ac635f454f0b164f5a"2393checksum = "e8ac3ff5224ef91f3c97e03eb1de2db82743427e91aaa5ac635f454f0b164f5a"2405dependencies = [2394dependencies = [2406 "either",2395 "either",2407 "futures 0.3.17",2396 "futures 0.3.18",2408 "futures-timer 3.0.2",2397 "futures-timer 3.0.2",2409 "log",2398 "log",2410 "num-traits",2399 "num-traits",2487[[package]]2476[[package]]2488name = "fp-consensus"2477name = "fp-consensus"2489version = "2.0.0-dev"2478version = "2.0.0-dev"2490source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2479source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2491dependencies = [2480dependencies = [2492 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2481 "ethereum 0.10.0",2493 "parity-scale-codec",2482 "parity-scale-codec",2494 "rlp",2483 "rlp",2495 "sha3 0.8.2",2484 "sha3 0.8.2",2501[[package]]2490[[package]]2502name = "fp-evm"2491name = "fp-evm"2503version = "3.0.0-dev"2492version = "3.0.0-dev"2504source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2493source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2505dependencies = [2494dependencies = [2506 "evm",2495 "evm",2507 "impl-trait-for-tuples 0.1.3",2496 "impl-trait-for-tuples",2508 "parity-scale-codec",2497 "parity-scale-codec",2509 "scale-info",2498 "scale-info",2510 "serde",2499 "serde",2515[[package]]2504[[package]]2516name = "fp-rpc"2505name = "fp-rpc"2517version = "3.0.0-dev"2506version = "3.0.0-dev"2518source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2507source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2519dependencies = [2508dependencies = [2520 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2509 "ethereum 0.10.0",2521 "ethereum-types",2510 "ethereum-types",2522 "fp-evm",2511 "fp-evm",2523 "parity-scale-codec",2512 "parity-scale-codec",2532[[package]]2521[[package]]2533name = "fp-self-contained"2522name = "fp-self-contained"2534version = "1.0.0-dev"2523version = "1.0.0-dev"2535source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2524source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2536dependencies = [2525dependencies = [2537 "ethereum 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",2526 "ethereum 0.9.0",2538 "frame-support",2527 "frame-support",2539 "parity-scale-codec",2528 "parity-scale-codec",2540 "parity-util-mem",2529 "parity-util-mem",2549[[package]]2538[[package]]2550name = "fp-storage"2539name = "fp-storage"2551version = "2.0.0"2540version = "2.0.0"2552source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2541source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"255325422554[[package]]2543[[package]]2555name = "frame-benchmarking"2544name = "frame-benchmarking"262926182630[[package]]2619[[package]]2631name = "frame-metadata"2620name = "frame-metadata"2632version = "14.0.0"2621version = "14.2.0"2633source = "registry+https://github.com/rust-lang/crates.io-index"2622source = "registry+https://github.com/rust-lang/crates.io-index"2634checksum = "96616f82e069102b95a72c87de4c84d2f87ef7f0f20630e78ce3824436483110"2623checksum = "37ed5e5c346de62ca5c184b4325a6600d1eaca210666e4606fe4e449574978d0"2635dependencies = [2624dependencies = [2636 "cfg-if 1.0.0",2625 "cfg-if 1.0.0",2637 "parity-scale-codec",2626 "parity-scale-codec",2647 "bitflags",2636 "bitflags",2648 "frame-metadata",2637 "frame-metadata",2649 "frame-support-procedural",2638 "frame-support-procedural",2650 "impl-trait-for-tuples 0.2.1",2639 "impl-trait-for-tuples",2651 "log",2640 "log",2652 "once_cell",2641 "once_cell",2653 "parity-scale-codec",2642 "parity-scale-codec",281027992811[[package]]2800[[package]]2812name = "futures"2801name = "futures"2813version = "0.3.17"2802version = "0.3.18"2814source = "registry+https://github.com/rust-lang/crates.io-index"2803source = "registry+https://github.com/rust-lang/crates.io-index"2815checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca"2804checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e"2816dependencies = [2805dependencies = [2817 "futures-channel",2806 "futures-channel",2818 "futures-core",2807 "futures-core",282528142826[[package]]2815[[package]]2827name = "futures-channel"2816name = "futures-channel"2828version = "0.3.17"2817version = "0.3.18"2829source = "registry+https://github.com/rust-lang/crates.io-index"2818source = "registry+https://github.com/rust-lang/crates.io-index"2830checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888"2819checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27"2831dependencies = [2820dependencies = [2832 "futures-core",2821 "futures-core",2833 "futures-sink",2822 "futures-sink",2834]2823]283528242836[[package]]2825[[package]]2837name = "futures-core"2826name = "futures-core"2838version = "0.3.17"2827version = "0.3.18"2839source = "registry+https://github.com/rust-lang/crates.io-index"2828source = "registry+https://github.com/rust-lang/crates.io-index"2840checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d"2829checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445"284128302842[[package]]2831[[package]]2843name = "futures-executor"2832name = "futures-executor"2844version = "0.3.17"2833version = "0.3.18"2845source = "registry+https://github.com/rust-lang/crates.io-index"2834source = "registry+https://github.com/rust-lang/crates.io-index"2846checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c"2835checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97"2847dependencies = [2836dependencies = [2848 "futures-core",2837 "futures-core",2849 "futures-task",2838 "futures-task",285328422854[[package]]2843[[package]]2855name = "futures-io"2844name = "futures-io"2856version = "0.3.17"2845version = "0.3.18"2857source = "registry+https://github.com/rust-lang/crates.io-index"2846source = "registry+https://github.com/rust-lang/crates.io-index"2858checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"2847checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11"285928482860[[package]]2849[[package]]2861name = "futures-lite"2850name = "futures-lite"287428632875[[package]]2864[[package]]2876name = "futures-macro"2865name = "futures-macro"2877version = "0.3.17"2866version = "0.3.18"2878source = "registry+https://github.com/rust-lang/crates.io-index"2867source = "registry+https://github.com/rust-lang/crates.io-index"2879checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"2868checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd"2880dependencies = [2869dependencies = [2881 "autocfg",2882 "proc-macro-hack",2883 "proc-macro2",2870 "proc-macro2",2884 "quote",2871 "quote",2885 "syn",2872 "syn",289828852899[[package]]2886[[package]]2900name = "futures-sink"2887name = "futures-sink"2901version = "0.3.17"2888version = "0.3.18"2902source = "registry+https://github.com/rust-lang/crates.io-index"2889source = "registry+https://github.com/rust-lang/crates.io-index"2903checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11"2890checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af"290428912905[[package]]2892[[package]]2906name = "futures-task"2893name = "futures-task"2907version = "0.3.17"2894version = "0.3.18"2908source = "registry+https://github.com/rust-lang/crates.io-index"2895source = "registry+https://github.com/rust-lang/crates.io-index"2909checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99"2896checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12"291028972911[[package]]2898[[package]]2912name = "futures-timer"2899name = "futures-timer"292229092923[[package]]2910[[package]]2924name = "futures-util"2911name = "futures-util"2925version = "0.3.17"2912version = "0.3.18"2926source = "registry+https://github.com/rust-lang/crates.io-index"2913source = "registry+https://github.com/rust-lang/crates.io-index"2927checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481"2914checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e"2928dependencies = [2915dependencies = [2929 "autocfg",2930 "futures 0.1.31",2916 "futures 0.1.31",2931 "futures-channel",2917 "futures-channel",2932 "futures-core",2918 "futures-core",2937 "memchr",2923 "memchr",2938 "pin-project-lite 0.2.7",2924 "pin-project-lite 0.2.7",2939 "pin-utils",2925 "pin-utils",2940 "proc-macro-hack",2941 "proc-macro-nested",2942 "slab",2926 "slab",2943]2927]29442928310830923109[[package]]3093[[package]]3110name = "hex-literal"3094name = "hex-literal"3111version = "0.3.3"3095version = "0.3.4"3112source = "registry+https://github.com/rust-lang/crates.io-index"3096source = "registry+https://github.com/rust-lang/crates.io-index"3113checksum = "21e4590e13640f19f249fe3e4eca5113bc4289f2497710378190e7f4bd96f45b"3097checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"311430983115[[package]]3099[[package]]3116name = "hex_fmt"3100name = "hex_fmt"321131953212[[package]]3196[[package]]3213name = "httpdate"3197name = "httpdate"3214version = "1.0.1"3198version = "1.0.2"3215source = "registry+https://github.com/rust-lang/crates.io-index"3199source = "registry+https://github.com/rust-lang/crates.io-index"3216checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440"3200checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"321732013218[[package]]3202[[package]]3219name = "humantime"3203name = "humantime"323232163233[[package]]3217[[package]]3234name = "hyper"3218name = "hyper"3235version = "0.14.14"3219version = "0.14.15"3236source = "registry+https://github.com/rust-lang/crates.io-index"3220source = "registry+https://github.com/rust-lang/crates.io-index"3237checksum = "2b91bb1f221b6ea1f1e4371216b70f40748774c2fb5971b450c07773fb92d26b"3221checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c"3238dependencies = [3222dependencies = [3239 "bytes 1.1.0",3223 "bytes 1.1.0",3240 "futures-channel",3224 "futures-channel",3247 "itoa",3231 "itoa",3248 "pin-project-lite 0.2.7",3232 "pin-project-lite 0.2.7",3249 "socket2 0.4.2",3233 "socket2 0.4.2",3250 "tokio 1.13.0",3234 "tokio 1.14.0",3251 "tower-service",3235 "tower-service",3252 "tracing",3236 "tracing",3253 "want",3237 "want",3265 "log",3249 "log",3266 "rustls",3250 "rustls",3267 "rustls-native-certs",3251 "rustls-native-certs",3268 "tokio 1.13.0",3252 "tokio 1.14.0",3269 "tokio-rustls",3253 "tokio-rustls",3270 "webpki",3254 "webpki",3271]3255]330032843301[[package]]3285[[package]]3302name = "if-addrs"3286name = "if-addrs"3303version = "0.6.6"3287version = "0.6.7"3304source = "registry+https://github.com/rust-lang/crates.io-index"3288source = "registry+https://github.com/rust-lang/crates.io-index"3305checksum = "c9a83ec4af652890ac713ffd8dc859e650420a5ef47f7b9be29b6664ab50fbc8"3289checksum = "2273e421f7c4f0fc99e1934fe4776f59d8df2972f4199d703fc0da9f2a9f73de"3306dependencies = [3290dependencies = [3307 "if-addrs-sys",3291 "if-addrs-sys",3308 "libc",3292 "libc",3326checksum = "ae8ab7f67bad3240049cb24fb9cb0b4c2c6af4c245840917fbbdededeee91179"3310checksum = "ae8ab7f67bad3240049cb24fb9cb0b4c2c6af4c245840917fbbdededeee91179"3327dependencies = [3311dependencies = [3328 "async-io",3312 "async-io",3329 "futures 0.3.17",3313 "futures 0.3.18",3330 "futures-lite",3314 "futures-lite",3331 "if-addrs",3315 "if-addrs",3332 "ipnet",3316 "ipnet",335533393356[[package]]3340[[package]]3357name = "impl-serde"3341name = "impl-serde"3358version = "0.3.1"3342version = "0.3.2"3359source = "registry+https://github.com/rust-lang/crates.io-index"3343source = "registry+https://github.com/rust-lang/crates.io-index"3360checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f"3344checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c"3361dependencies = [3345dependencies = [3362 "serde",3346 "serde",3363]3347]33643365[[package]]3366name = "impl-trait-for-tuples"3367version = "0.1.3"3368source = "registry+https://github.com/rust-lang/crates.io-index"3369checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d"3370dependencies = [3371 "proc-macro2",3372 "quote",3373 "syn",3374]337533483376[[package]]3349[[package]]3377name = "impl-trait-for-tuples"3350name = "impl-trait-for-tuples"3425source = "registry+https://github.com/rust-lang/crates.io-index"3398source = "registry+https://github.com/rust-lang/crates.io-index"3426checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275"3399checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275"3427dependencies = [3400dependencies = [3428 "futures 0.3.17",3401 "futures 0.3.18",3429 "futures-timer 2.0.2",3402 "futures-timer 2.0.2",3430]3403]34313404344034133441[[package]]3414[[package]]3442name = "ip_network"3415name = "ip_network"3443version = "0.4.0"3416version = "0.4.1"3444source = "registry+https://github.com/rust-lang/crates.io-index"3417source = "registry+https://github.com/rust-lang/crates.io-index"3445checksum = "09b746553d2f4a1ca26fab939943ddfb217a091f34f53571620a8e3d30691303"3418checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1"344634193447[[package]]3420[[package]]3448name = "ipconfig"3421name = "ipconfig"3502checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a"3475checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a"3503dependencies = [3476dependencies = [3504 "derive_more",3477 "derive_more",3505 "futures 0.3.17",3478 "futures 0.3.18",3506 "jsonrpc-core",3479 "jsonrpc-core",3507 "jsonrpc-pubsub",3480 "jsonrpc-pubsub",3508 "log",3481 "log",3517source = "registry+https://github.com/rust-lang/crates.io-index"3490source = "registry+https://github.com/rust-lang/crates.io-index"3518checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb"3491checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb"3519dependencies = [3492dependencies = [3520 "futures 0.3.17",3493 "futures 0.3.18",3521 "futures-executor",3494 "futures-executor",3522 "futures-util",3495 "futures-util",3523 "log",3496 "log",3532source = "registry+https://github.com/rust-lang/crates.io-index"3505source = "registry+https://github.com/rust-lang/crates.io-index"3533checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0"3506checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0"3534dependencies = [3507dependencies = [3535 "futures 0.3.17",3508 "futures 0.3.18",3536 "jsonrpc-client-transports",3509 "jsonrpc-client-transports",3537]3510]353835113554source = "registry+https://github.com/rust-lang/crates.io-index"3527source = "registry+https://github.com/rust-lang/crates.io-index"3555checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff"3528checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff"3556dependencies = [3529dependencies = [3557 "futures 0.3.17",3530 "futures 0.3.18",3558 "hyper",3531 "hyper",3559 "jsonrpc-core",3532 "jsonrpc-core",3560 "jsonrpc-server-utils",3533 "jsonrpc-server-utils",3570source = "registry+https://github.com/rust-lang/crates.io-index"3543source = "registry+https://github.com/rust-lang/crates.io-index"3571checksum = "382bb0206323ca7cda3dcd7e245cea86d37d02457a02a975e3378fb149a48845"3544checksum = "382bb0206323ca7cda3dcd7e245cea86d37d02457a02a975e3378fb149a48845"3572dependencies = [3545dependencies = [3573 "futures 0.3.17",3546 "futures 0.3.18",3574 "jsonrpc-core",3547 "jsonrpc-core",3575 "jsonrpc-server-utils",3548 "jsonrpc-server-utils",3576 "log",3549 "log",3585source = "registry+https://github.com/rust-lang/crates.io-index"3558source = "registry+https://github.com/rust-lang/crates.io-index"3586checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011"3559checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011"3587dependencies = [3560dependencies = [3588 "futures 0.3.17",3561 "futures 0.3.18",3589 "jsonrpc-core",3562 "jsonrpc-core",3590 "lazy_static",3563 "lazy_static",3591 "log",3564 "log",3601checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4"3574checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4"3602dependencies = [3575dependencies = [3603 "bytes 1.1.0",3576 "bytes 1.1.0",3604 "futures 0.3.17",3577 "futures 0.3.18",3605 "globset",3578 "globset",3606 "jsonrpc-core",3579 "jsonrpc-core",3607 "lazy_static",3580 "lazy_static",3608 "log",3581 "log",3609 "tokio 1.13.0",3582 "tokio 1.14.0",3610 "tokio-stream",3583 "tokio-stream",3611 "tokio-util",3584 "tokio-util",3612 "unicase",3585 "unicase",3618source = "registry+https://github.com/rust-lang/crates.io-index"3591source = "registry+https://github.com/rust-lang/crates.io-index"3619checksum = "f892c7d766369475ab7b0669f417906302d7c0fb521285c0a0c92e52e7c8e946"3592checksum = "f892c7d766369475ab7b0669f417906302d7c0fb521285c0a0c92e52e7c8e946"3620dependencies = [3593dependencies = [3621 "futures 0.3.17",3594 "futures 0.3.18",3622 "jsonrpc-core",3595 "jsonrpc-core",3623 "jsonrpc-server-utils",3596 "jsonrpc-server-utils",3624 "log",3597 "log",3667dependencies = [3640dependencies = [3668 "async-trait",3641 "async-trait",3669 "fnv",3642 "fnv",3670 "futures 0.3.17",3643 "futures 0.3.18",3671 "jsonrpsee-types",3644 "jsonrpsee-types",3672 "log",3645 "log",3673 "pin-project 1.0.8",3646 "pin-project 1.0.8",3677 "serde_json",3650 "serde_json",3678 "soketto 0.6.0",3651 "soketto 0.6.0",3679 "thiserror",3652 "thiserror",3680 "tokio 1.13.0",3653 "tokio 1.14.0",3681 "tokio-rustls",3654 "tokio-rustls",3682 "tokio-util",3655 "tokio-util",3683 "url 2.2.2",3656 "url 2.2.2",3705source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"3678source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"3706dependencies = [3679dependencies = [3707 "beefy-primitives",3680 "beefy-primitives",3708 "bitvec 0.20.4",3681 "bitvec",3709 "frame-benchmarking",3682 "frame-benchmarking",3710 "frame-election-provider-support",3683 "frame-election-provider-support",3711 "frame-executive",3684 "frame-executive",384738203848[[package]]3821[[package]]3849name = "libc"3822name = "libc"3850version = "0.2.106"3823version = "0.2.108"3851source = "registry+https://github.com/rust-lang/crates.io-index"3824source = "registry+https://github.com/rust-lang/crates.io-index"3852checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673"3825checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"385338263854[[package]]3827[[package]]3855name = "libloading"3828name = "libloading"386338363864[[package]]3837[[package]]3865name = "libloading"3838name = "libloading"3866version = "0.7.1"3839version = "0.7.2"3867source = "registry+https://github.com/rust-lang/crates.io-index"3840source = "registry+https://github.com/rust-lang/crates.io-index"3868checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0"3841checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52"3869dependencies = [3842dependencies = [3870 "cfg-if 1.0.0",3843 "cfg-if 1.0.0",3871 "winapi 0.3.9",3844 "winapi 0.3.9",3885dependencies = [3858dependencies = [3886 "atomic",3859 "atomic",3887 "bytes 1.1.0",3860 "bytes 1.1.0",3888 "futures 0.3.17",3861 "futures 0.3.18",3889 "lazy_static",3862 "lazy_static",3890 "libp2p-core",3863 "libp2p-core",3891 "libp2p-deflate",3864 "libp2p-deflate",3927 "ed25519-dalek",3900 "ed25519-dalek",3928 "either",3901 "either",3929 "fnv",3902 "fnv",3930 "futures 0.3.17",3903 "futures 0.3.18",3931 "futures-timer 3.0.2",3904 "futures-timer 3.0.2",3932 "lazy_static",3905 "lazy_static",3933 "libsecp256k1 0.5.0",3906 "libsecp256k1 0.5.0",3945 "sha2 0.9.8",3918 "sha2 0.9.8",3946 "smallvec",3919 "smallvec",3947 "thiserror",3920 "thiserror",3948 "unsigned-varint 0.7.0",3921 "unsigned-varint 0.7.1",3949 "void",3922 "void",3950 "zeroize",3923 "zeroize",3951]3924]3957checksum = "66097fccc0b7f8579f90a03ea76ba6196332ea049fd07fd969490a06819dcdc8"3930checksum = "66097fccc0b7f8579f90a03ea76ba6196332ea049fd07fd969490a06819dcdc8"3958dependencies = [3931dependencies = [3959 "flate2",3932 "flate2",3960 "futures 0.3.17",3933 "futures 0.3.18",3961 "libp2p-core",3934 "libp2p-core",3962]3935]396339363968checksum = "58ff08b3196b85a17f202d80589e93b1660a574af67275706657fdc762e42c32"3941checksum = "58ff08b3196b85a17f202d80589e93b1660a574af67275706657fdc762e42c32"3969dependencies = [3942dependencies = [3970 "async-std-resolver",3943 "async-std-resolver",3971 "futures 0.3.17",3944 "futures 0.3.18",3972 "libp2p-core",3945 "libp2p-core",3973 "log",3946 "log",3974 "smallvec",3947 "smallvec",3983dependencies = [3956dependencies = [3984 "cuckoofilter",3957 "cuckoofilter",3985 "fnv",3958 "fnv",3986 "futures 0.3.17",3959 "futures 0.3.18",3987 "libp2p-core",3960 "libp2p-core",3988 "libp2p-swarm",3961 "libp2p-swarm",3989 "log",3962 "log",4004 "byteorder",3977 "byteorder",4005 "bytes 1.1.0",3978 "bytes 1.1.0",4006 "fnv",3979 "fnv",4007 "futures 0.3.17",3980 "futures 0.3.18",4008 "hex_fmt",3981 "hex_fmt",4009 "libp2p-core",3982 "libp2p-core",4010 "libp2p-swarm",3983 "libp2p-swarm",4015 "regex",3988 "regex",4016 "sha2 0.9.8",3989 "sha2 0.9.8",4017 "smallvec",3990 "smallvec",4018 "unsigned-varint 0.7.0",3991 "unsigned-varint 0.7.1",4019 "wasm-timer",3992 "wasm-timer",4020]3993]402139944025source = "registry+https://github.com/rust-lang/crates.io-index"3998source = "registry+https://github.com/rust-lang/crates.io-index"4026checksum = "a7b61f6cf07664fb97016c318c4d4512b3dd4cc07238607f3f0163245f99008e"3999checksum = "a7b61f6cf07664fb97016c318c4d4512b3dd4cc07238607f3f0163245f99008e"4027dependencies = [4000dependencies = [4028 "futures 0.3.17",4001 "futures 0.3.18",4029 "libp2p-core",4002 "libp2p-core",4030 "libp2p-swarm",4003 "libp2p-swarm",4031 "log",4004 "log",4046 "bytes 1.1.0",4019 "bytes 1.1.0",4047 "either",4020 "either",4048 "fnv",4021 "fnv",4049 "futures 0.3.17",4022 "futures 0.3.18",4050 "libp2p-core",4023 "libp2p-core",4051 "libp2p-swarm",4024 "libp2p-swarm",4052 "log",4025 "log",4056 "sha2 0.9.8",4029 "sha2 0.9.8",4057 "smallvec",4030 "smallvec",4058 "uint",4031 "uint",4059 "unsigned-varint 0.7.0",4032 "unsigned-varint 0.7.1",4060 "void",4033 "void",4061 "wasm-timer",4034 "wasm-timer",4062]4035]4070 "async-io",4043 "async-io",4071 "data-encoding",4044 "data-encoding",4072 "dns-parser",4045 "dns-parser",4073 "futures 0.3.17",4046 "futures 0.3.18",4074 "if-watch",4047 "if-watch",4075 "lazy_static",4048 "lazy_static",4076 "libp2p-core",4049 "libp2p-core",4090dependencies = [4063dependencies = [4091 "asynchronous-codec 0.6.0",4064 "asynchronous-codec 0.6.0",4092 "bytes 1.1.0",4065 "bytes 1.1.0",4093 "futures 0.3.17",4066 "futures 0.3.18",4094 "libp2p-core",4067 "libp2p-core",4095 "log",4068 "log",4096 "nohash-hasher",4069 "nohash-hasher",4097 "parking_lot 0.11.2",4070 "parking_lot 0.11.2",4098 "rand 0.7.3",4071 "rand 0.7.3",4099 "smallvec",4072 "smallvec",4100 "unsigned-varint 0.7.0",4073 "unsigned-varint 0.7.1",4101]4074]410240754103[[package]]4076[[package]]4108dependencies = [4081dependencies = [4109 "bytes 1.1.0",4082 "bytes 1.1.0",4110 "curve25519-dalek 3.2.0",4083 "curve25519-dalek 3.2.0",4111 "futures 0.3.17",4084 "futures 0.3.18",4112 "lazy_static",4085 "lazy_static",4113 "libp2p-core",4086 "libp2p-core",4114 "log",4087 "log",4128source = "registry+https://github.com/rust-lang/crates.io-index"4101source = "registry+https://github.com/rust-lang/crates.io-index"4129checksum = "2482cfd9eb0b7a0baaf3e7b329dc4f2785181a161b1a47b7192f8d758f54a439"4102checksum = "2482cfd9eb0b7a0baaf3e7b329dc4f2785181a161b1a47b7192f8d758f54a439"4130dependencies = [4103dependencies = [4131 "futures 0.3.17",4104 "futures 0.3.18",4132 "libp2p-core",4105 "libp2p-core",4133 "libp2p-swarm",4106 "libp2p-swarm",4134 "log",4107 "log",4145dependencies = [4118dependencies = [4146 "asynchronous-codec 0.6.0",4119 "asynchronous-codec 0.6.0",4147 "bytes 1.1.0",4120 "bytes 1.1.0",4148 "futures 0.3.17",4121 "futures 0.3.18",4149 "libp2p-core",4122 "libp2p-core",4150 "log",4123 "log",4151 "prost",4124 "prost",4152 "prost-build",4125 "prost-build",4153 "unsigned-varint 0.7.0",4126 "unsigned-varint 0.7.1",4154 "void",4127 "void",4155]4128]415641294160source = "registry+https://github.com/rust-lang/crates.io-index"4133source = "registry+https://github.com/rust-lang/crates.io-index"4161checksum = "07cb4dd4b917e5b40ddefe49b96b07adcd8d342e0317011d175b7b2bb1dcc974"4134checksum = "07cb4dd4b917e5b40ddefe49b96b07adcd8d342e0317011d175b7b2bb1dcc974"4162dependencies = [4135dependencies = [4163 "futures 0.3.17",4136 "futures 0.3.18",4164 "log",4137 "log",4165 "pin-project 1.0.8",4138 "pin-project 1.0.8",4166 "rand 0.7.3",4139 "rand 0.7.3",4176dependencies = [4149dependencies = [4177 "asynchronous-codec 0.6.0",4150 "asynchronous-codec 0.6.0",4178 "bytes 1.1.0",4151 "bytes 1.1.0",4179 "futures 0.3.17",4152 "futures 0.3.18",4180 "futures-timer 3.0.2",4153 "futures-timer 3.0.2",4181 "libp2p-core",4154 "libp2p-core",4182 "libp2p-swarm",4155 "libp2p-swarm",4186 "prost-build",4159 "prost-build",4187 "rand 0.7.3",4160 "rand 0.7.3",4188 "smallvec",4161 "smallvec",4189 "unsigned-varint 0.7.0",4162 "unsigned-varint 0.7.1",4190 "void",4163 "void",4191 "wasm-timer",4164 "wasm-timer",4192]4165]4199dependencies = [4172dependencies = [4200 "async-trait",4173 "async-trait",4201 "bytes 1.1.0",4174 "bytes 1.1.0",4202 "futures 0.3.17",4175 "futures 0.3.18",4203 "libp2p-core",4176 "libp2p-core",4204 "libp2p-swarm",4177 "libp2p-swarm",4205 "log",4178 "log",4206 "lru 0.6.6",4179 "lru 0.6.6",4207 "minicbor",4180 "minicbor",4208 "rand 0.7.3",4181 "rand 0.7.3",4209 "smallvec",4182 "smallvec",4210 "unsigned-varint 0.7.0",4183 "unsigned-varint 0.7.1",4211 "wasm-timer",4184 "wasm-timer",4212]4185]421341864218checksum = "7083861341e1555467863b4cd802bea1e8c4787c0f7b5110097d0f1f3248f9a9"4191checksum = "7083861341e1555467863b4cd802bea1e8c4787c0f7b5110097d0f1f3248f9a9"4219dependencies = [4192dependencies = [4220 "either",4193 "either",4221 "futures 0.3.17",4194 "futures 0.3.18",4222 "libp2p-core",4195 "libp2p-core",4223 "log",4196 "log",4224 "rand 0.7.3",4197 "rand 0.7.3",4244checksum = "79edd26b6b4bb5feee210dcda562dca186940dfecb0024b979c3f50824b3bf28"4217checksum = "79edd26b6b4bb5feee210dcda562dca186940dfecb0024b979c3f50824b3bf28"4245dependencies = [4218dependencies = [4246 "async-io",4219 "async-io",4247 "futures 0.3.17",4220 "futures 0.3.18",4248 "futures-timer 3.0.2",4221 "futures-timer 3.0.2",4249 "if-watch",4222 "if-watch",4250 "ipnet",4223 "ipnet",4261checksum = "280e793440dd4e9f273d714f4497325c72cddb0fe85a49f9a03c88f41dd20182"4234checksum = "280e793440dd4e9f273d714f4497325c72cddb0fe85a49f9a03c88f41dd20182"4262dependencies = [4235dependencies = [4263 "async-std",4236 "async-std",4264 "futures 0.3.17",4237 "futures 0.3.18",4265 "libp2p-core",4238 "libp2p-core",4266 "log",4239 "log",4267]4240]4272source = "registry+https://github.com/rust-lang/crates.io-index"4245source = "registry+https://github.com/rust-lang/crates.io-index"4273checksum = "f553b7140fad3d7a76f50497b0ea591e26737d9607428a75509fc191e4d1b1f6"4246checksum = "f553b7140fad3d7a76f50497b0ea591e26737d9607428a75509fc191e4d1b1f6"4274dependencies = [4247dependencies = [4275 "futures 0.3.17",4248 "futures 0.3.18",4276 "js-sys",4249 "js-sys",4277 "libp2p-core",4250 "libp2p-core",4278 "parity-send-wrapper",4251 "parity-send-wrapper",4287checksum = "ddf99dcbf5063e9d59087f61b1e85c686ceab2f5abedb472d32288065c0e5e27"4260checksum = "ddf99dcbf5063e9d59087f61b1e85c686ceab2f5abedb472d32288065c0e5e27"4288dependencies = [4261dependencies = [4289 "either",4262 "either",4290 "futures 0.3.17",4263 "futures 0.3.18",4291 "futures-rustls",4264 "futures-rustls",4292 "libp2p-core",4265 "libp2p-core",4293 "log",4266 "log",4304source = "registry+https://github.com/rust-lang/crates.io-index"4277source = "registry+https://github.com/rust-lang/crates.io-index"4305checksum = "214cc0dd9c37cbed27f0bb1eba0c41bbafdb93a8be5e9d6ae1e6b4b42cd044bf"4278checksum = "214cc0dd9c37cbed27f0bb1eba0c41bbafdb93a8be5e9d6ae1e6b4b42cd044bf"4306dependencies = [4279dependencies = [4307 "futures 0.3.17",4280 "futures 0.3.18",4308 "libp2p-core",4281 "libp2p-core",4309 "parking_lot 0.11.2",4282 "parking_lot 0.11.2",4310 "thiserror",4283 "thiserror",460345764604[[package]]4577[[package]]4605name = "matrixmultiply"4578name = "matrixmultiply"4606version = "0.3.1"4579version = "0.3.2"4607source = "registry+https://github.com/rust-lang/crates.io-index"4580source = "registry+https://github.com/rust-lang/crates.io-index"4608checksum = "5a8a15b776d9dfaecd44b03c5828c2199cddff5247215858aac14624f8d6b741"4581checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84"4609dependencies = [4582dependencies = [4610 "rawpointer",4583 "rawpointer",4611]4584]4678source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"4651source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"4679dependencies = [4652dependencies = [4680 "derive_more",4653 "derive_more",4681 "futures 0.3.17",4654 "futures 0.3.18",4682 "futures-timer 3.0.2",4655 "futures-timer 3.0.2",4683 "thiserror",4656 "thiserror",4684 "tracing",4657 "tracing",4685]4658]468646594687[[package]]4660[[package]]4688name = "mick-jaeger"4661name = "mick-jaeger"4689version = "0.1.4"4662version = "0.1.6"4690source = "registry+https://github.com/rust-lang/crates.io-index"4663source = "registry+https://github.com/rust-lang/crates.io-index"4691checksum = "c023c3f16109e7f33aa451f773fd61070e265b4977d0b6e344a51049296dd7df"4664checksum = "eaa77fad8461bb1e0d01be11299e24c6e544007715ed442bfec29f165dc487ae"4692dependencies = [4665dependencies = [4693 "futures 0.3.17",4666 "futures 0.3.18",4694 "rand 0.7.3",4667 "rand 0.7.3",4695 "thrift",4668 "thrift",4696]4669]4715 "syn",4688 "syn",4716]4689]46904691[[package]]4692name = "minimal-lexical"4693version = "0.2.1"4694source = "registry+https://github.com/rust-lang/crates.io-index"4695checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"471746964718[[package]]4697[[package]]4719name = "miniz_oxide"4698name = "miniz_oxide"479247714793[[package]]4772[[package]]4794name = "more-asserts"4773name = "more-asserts"4795version = "0.2.1"4774version = "0.2.2"4796source = "registry+https://github.com/rust-lang/crates.io-index"4775source = "registry+https://github.com/rust-lang/crates.io-index"4797checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"4776checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389"479847774799[[package]]4778[[package]]4800name = "multiaddr"4779name = "multiaddr"4810 "percent-encoding 2.1.0",4789 "percent-encoding 2.1.0",4811 "serde",4790 "serde",4812 "static_assertions",4791 "static_assertions",4813 "unsigned-varint 0.7.0",4792 "unsigned-varint 0.7.1",4814 "url 2.2.2",4793 "url 2.2.2",4815]4794]481647954852 "generic-array 0.14.4",4831 "generic-array 0.14.4",4853 "multihash-derive",4832 "multihash-derive",4854 "sha2 0.9.8",4833 "sha2 0.9.8",4855 "unsigned-varint 0.7.0",4834 "unsigned-varint 0.7.1",4856]4835]485748364858[[package]]4837[[package]]4882checksum = "56a336acba8bc87c8876f6425407dbbe6c417bf478b22015f8fb0994ef3bc0ab"4861checksum = "56a336acba8bc87c8876f6425407dbbe6c417bf478b22015f8fb0994ef3bc0ab"4883dependencies = [4862dependencies = [4884 "bytes 1.1.0",4863 "bytes 1.1.0",4885 "futures 0.3.17",4864 "futures 0.3.18",4886 "log",4865 "log",4887 "pin-project 1.0.8",4866 "pin-project 1.0.8",4888 "smallvec",4867 "smallvec",4889 "unsigned-varint 0.7.0",4868 "unsigned-varint 0.7.1",4890]4869]489148704892[[package]]4871[[package]]495249314953[[package]]4932[[package]]4954name = "nom"4933name = "nom"4955version = "6.1.2"4934version = "7.1.0"4956source = "registry+https://github.com/rust-lang/crates.io-index"4935source = "registry+https://github.com/rust-lang/crates.io-index"4957checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2"4936checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"4958dependencies = [4937dependencies = [4959 "bitvec 0.19.5",4960 "funty",4961 "memchr",4938 "memchr",4939 "minimal-lexical",4962 "version_check",4940 "version_check",4963]4941]496449425160dependencies = [5138dependencies = [5161 "frame-support",5139 "frame-support",5162 "frame-system",5140 "frame-system",5163 "impl-trait-for-tuples 0.2.1",5141 "impl-trait-for-tuples",5164 "parity-scale-codec",5142 "parity-scale-codec",5165 "scale-info",5143 "scale-info",5166 "sp-authorship",5144 "sp-authorship",5330version = "0.1.0"5308version = "0.1.0"5331source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"5309source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"5332dependencies = [5310dependencies = [5333 "bitvec 0.20.4",5311 "bitvec",5334 "bp-message-dispatch",5312 "bp-message-dispatch",5335 "bp-messages",5313 "bp-messages",5336 "bp-rialto",5314 "bp-rialto",5509[[package]]5487[[package]]5510name = "pallet-ethereum"5488name = "pallet-ethereum"5511version = "4.0.0-dev"5489version = "4.0.0-dev"5512source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"5490source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"5513dependencies = [5491dependencies = [5514 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5492 "ethereum 0.10.0",5515 "ethereum-types",5493 "ethereum-types",5516 "evm",5494 "evm",5517 "fp-consensus",5495 "fp-consensus",5538[[package]]5516[[package]]5539name = "pallet-evm"5517name = "pallet-evm"5540version = "6.0.0-dev"5518version = "6.0.0-dev"5541source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"5519source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"5542dependencies = [5520dependencies = [5543 "evm",5521 "evm",5544 "evm-gasometer",5522 "evm-gasometer",5548 "frame-support",5526 "frame-support",5549 "frame-system",5527 "frame-system",5550 "hex",5528 "hex",5551 "impl-trait-for-tuples 0.2.1",5529 "impl-trait-for-tuples",5552 "log",5530 "log",5553 "pallet-balances",5531 "pallet-balances",5554 "pallet-timestamp",5532 "pallet-timestamp",5568name = "pallet-evm-coder-substrate"5546name = "pallet-evm-coder-substrate"5569version = "0.1.0"5547version = "0.1.0"5570dependencies = [5548dependencies = [5571 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5549 "ethereum 0.10.0",5572 "evm-coder",5550 "evm-coder",5551 "frame-benchmarking",5573 "frame-support",5552 "frame-support",5574 "frame-system",5553 "frame-system",5575 "pallet-ethereum",5554 "pallet-ethereum",5638name = "pallet-fungible"5617name = "pallet-fungible"5639version = "0.1.0"5618version = "0.1.0"5640dependencies = [5619dependencies = [5641 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5620 "ethereum 0.10.0",5642 "evm-coder",5621 "evm-coder",5643 "frame-benchmarking",5622 "frame-benchmarking",5644 "frame-support",5623 "frame-support",5864name = "pallet-nonfungible"5843name = "pallet-nonfungible"5865version = "0.1.0"5844version = "0.1.0"5866dependencies = [5845dependencies = [5867 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5846 "ethereum 0.10.0",5868 "evm-coder",5847 "evm-coder",5869 "frame-benchmarking",5848 "frame-benchmarking",5870 "frame-support",5849 "frame-support",6001dependencies = [5980dependencies = [6002 "frame-support",5981 "frame-support",6003 "frame-system",5982 "frame-system",6004 "impl-trait-for-tuples 0.2.1",5983 "impl-trait-for-tuples",6005 "log",5984 "log",6006 "pallet-timestamp",5985 "pallet-timestamp",6007 "parity-scale-codec",5986 "parity-scale-codec",6212 "frame-benchmarking",6191 "frame-benchmarking",6213 "frame-support",6192 "frame-support",6214 "frame-system",6193 "frame-system",6215 "impl-trait-for-tuples 0.2.1",6194 "impl-trait-for-tuples",6216 "pallet-balances",6195 "pallet-balances",6217 "parity-scale-codec",6196 "parity-scale-codec",6218 "scale-info",6197 "scale-info",6225name = "pallet-unique"6204name = "pallet-unique"6226version = "0.1.0"6205version = "0.1.0"6227dependencies = [6206dependencies = [6228 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",6207 "ethereum 0.10.0",6229 "evm-coder",6208 "evm-coder",6230 "fp-evm",6209 "fp-evm",6231 "frame-benchmarking",6210 "frame-benchmarking",6346[[package]]6325[[package]]6347name = "parachain-info"6326name = "parachain-info"6348version = "0.1.0"6327version = "0.1.0"6349source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"6328source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"6350dependencies = [6329dependencies = [6351 "cumulus-primitives-core",6330 "cumulus-primitives-core",6352 "frame-support",6331 "frame-support",635863376359[[package]]6338[[package]]6360name = "parity-db"6339name = "parity-db"6361version = "0.3.3"6340version = "0.3.5"6362source = "registry+https://github.com/rust-lang/crates.io-index"6341source = "registry+https://github.com/rust-lang/crates.io-index"6363checksum = "e7ccc4a8687027deb53d45c5434a1f1b330c9d1069a59cfe80a62aa9a1da25ae"6342checksum = "78a95abf24f1097c6e3181abbbbfc3630b3b5e681470940f719b69acb4911c7f"6364dependencies = [6343dependencies = [6365 "blake2-rfc",6344 "blake2-rfc",6366 "crc32fast",6345 "crc32fast",6382checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909"6361checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909"6383dependencies = [6362dependencies = [6384 "arrayvec 0.7.2",6363 "arrayvec 0.7.2",6385 "bitvec 0.20.4",6364 "bitvec",6386 "byte-slice-cast",6365 "byte-slice-cast",6387 "impl-trait-for-tuples 0.2.1",6366 "impl-trait-for-tuples",6388 "parity-scale-codec-derive",6367 "parity-scale-codec-derive",6389 "serde",6368 "serde",6390]6369]6413source = "registry+https://github.com/rust-lang/crates.io-index"6392source = "registry+https://github.com/rust-lang/crates.io-index"6414checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6"6393checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6"6415dependencies = [6394dependencies = [6416 "futures 0.3.17",6395 "futures 0.3.18",6417 "libc",6396 "libc",6418 "log",6397 "log",6419 "rand 0.7.3",6398 "rand 0.7.3",6420 "tokio 1.13.0",6399 "tokio 1.14.0",6421 "winapi 0.3.9",6400 "winapi 0.3.9",6422]6401]642364026430 "cfg-if 1.0.0",6409 "cfg-if 1.0.0",6431 "ethereum-types",6410 "ethereum-types",6432 "hashbrown",6411 "hashbrown",6433 "impl-trait-for-tuples 0.2.1",6412 "impl-trait-for-tuples",6434 "lru 0.6.6",6413 "lru 0.6.6",6435 "parity-util-mem-derive",6414 "parity-util-mem-derive",6436 "parking_lot 0.11.2",6415 "parking_lot 0.11.2",654065196541[[package]]6520[[package]]6542name = "paste"6521name = "paste"6543version = "1.0.5"6522version = "1.0.6"6544source = "registry+https://github.com/rust-lang/crates.io-index"6523source = "registry+https://github.com/rust-lang/crates.io-index"6545checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58"6524checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5"654665256547[[package]]6526[[package]]6548name = "pbkdf2"6527name = "pbkdf2"6708version = "0.9.12"6687version = "0.9.12"6709source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6688source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6710dependencies = [6689dependencies = [6711 "futures 0.3.17",6690 "futures 0.3.18",6712 "polkadot-node-network-protocol",6691 "polkadot-node-network-protocol",6713 "polkadot-node-primitives",6692 "polkadot-node-primitives",6714 "polkadot-node-subsystem",6693 "polkadot-node-subsystem",6722version = "0.9.12"6701version = "0.9.12"6723source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6702source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6724dependencies = [6703dependencies = [6725 "futures 0.3.17",6704 "futures 0.3.18",6726 "polkadot-node-network-protocol",6705 "polkadot-node-network-protocol",6727 "polkadot-node-subsystem",6706 "polkadot-node-subsystem",6728 "polkadot-node-subsystem-util",6707 "polkadot-node-subsystem-util",6736source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6715source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6737dependencies = [6716dependencies = [6738 "derive_more",6717 "derive_more",6739 "futures 0.3.17",6718 "futures 0.3.18",6740 "lru 0.7.0",6719 "lru 0.7.0",6741 "parity-scale-codec",6720 "parity-scale-codec",6742 "polkadot-erasure-coding",6721 "polkadot-erasure-coding",6757version = "0.9.12"6736version = "0.9.12"6758source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6737source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6759dependencies = [6738dependencies = [6760 "futures 0.3.17",6739 "futures 0.3.18",6761 "lru 0.7.0",6740 "lru 0.7.0",6762 "parity-scale-codec",6741 "parity-scale-codec",6763 "polkadot-erasure-coding",6742 "polkadot-erasure-coding",6778source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6757source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6779dependencies = [6758dependencies = [6780 "frame-benchmarking-cli",6759 "frame-benchmarking-cli",6781 "futures 0.3.17",6760 "futures 0.3.18",6782 "log",6761 "log",6783 "polkadot-node-core-pvf",6762 "polkadot-node-core-pvf",6784 "polkadot-service",6763 "polkadot-service",6829dependencies = [6808dependencies = [6830 "always-assert",6809 "always-assert",6831 "derive_more",6810 "derive_more",6832 "futures 0.3.17",6811 "futures 0.3.18",6833 "futures-timer 3.0.2",6812 "futures-timer 3.0.2",6834 "polkadot-node-network-protocol",6813 "polkadot-node-network-protocol",6835 "polkadot-node-primitives",6814 "polkadot-node-primitives",6862source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6841source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6863dependencies = [6842dependencies = [6864 "derive_more",6843 "derive_more",6865 "futures 0.3.17",6844 "futures 0.3.18",6866 "lru 0.7.0",6845 "lru 0.7.0",6867 "parity-scale-codec",6846 "parity-scale-codec",6868 "polkadot-erasure-coding",6847 "polkadot-erasure-coding",6897version = "0.9.12"6876version = "0.9.12"6898source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6877source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6899dependencies = [6878dependencies = [6900 "futures 0.3.17",6879 "futures 0.3.18",6901 "futures-timer 3.0.2",6880 "futures-timer 3.0.2",6902 "polkadot-node-network-protocol",6881 "polkadot-node-network-protocol",6903 "polkadot-node-subsystem",6882 "polkadot-node-subsystem",6918source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6897source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6919dependencies = [6898dependencies = [6920 "async-trait",6899 "async-trait",6921 "futures 0.3.17",6900 "futures 0.3.18",6922 "parity-scale-codec",6901 "parity-scale-codec",6923 "parking_lot 0.11.2",6902 "parking_lot 0.11.2",6924 "polkadot-node-network-protocol",6903 "polkadot-node-network-protocol",6936version = "0.9.12"6915version = "0.9.12"6937source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6916source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6938dependencies = [6917dependencies = [6939 "futures 0.3.17",6918 "futures 0.3.18",6940 "parity-scale-codec",6919 "parity-scale-codec",6941 "polkadot-erasure-coding",6920 "polkadot-erasure-coding",6942 "polkadot-node-primitives",6921 "polkadot-node-primitives",6954version = "0.9.12"6933version = "0.9.12"6955source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6934source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6956dependencies = [6935dependencies = [6957 "bitvec 0.20.4",6936 "bitvec",6958 "derive_more",6937 "derive_more",6959 "futures 0.3.17",6938 "futures 0.3.18",6960 "futures-timer 3.0.2",6939 "futures-timer 3.0.2",6961 "kvdb",6940 "kvdb",6962 "lru 0.7.0",6941 "lru 0.7.0",6982version = "0.9.12"6961version = "0.9.12"6983source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6962source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6984dependencies = [6963dependencies = [6985 "bitvec 0.20.4",6964 "bitvec",6986 "futures 0.3.17",6965 "futures 0.3.18",6987 "futures-timer 3.0.2",6966 "futures-timer 3.0.2",6988 "kvdb",6967 "kvdb",6989 "parity-scale-codec",6968 "parity-scale-codec",7002version = "0.9.12"6981version = "0.9.12"7003source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6982source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7004dependencies = [6983dependencies = [7005 "bitvec 0.20.4",6984 "bitvec",7006 "futures 0.3.17",6985 "futures 0.3.18",7007 "polkadot-erasure-coding",6986 "polkadot-erasure-coding",7008 "polkadot-node-primitives",6987 "polkadot-node-primitives",7009 "polkadot-node-subsystem",6988 "polkadot-node-subsystem",7020version = "0.9.12"6999version = "0.9.12"7021source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7000source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7022dependencies = [7001dependencies = [7023 "futures 0.3.17",7002 "futures 0.3.18",7024 "polkadot-node-subsystem",7003 "polkadot-node-subsystem",7025 "polkadot-node-subsystem-util",7004 "polkadot-node-subsystem-util",7026 "polkadot-primitives",7005 "polkadot-primitives",7036source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7015source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7037dependencies = [7016dependencies = [7038 "async-trait",7017 "async-trait",7039 "futures 0.3.17",7018 "futures 0.3.18",7040 "parity-scale-codec",7019 "parity-scale-codec",7041 "polkadot-node-core-pvf",7020 "polkadot-node-core-pvf",7042 "polkadot-node-primitives",7021 "polkadot-node-primitives",7053version = "0.9.12"7032version = "0.9.12"7054source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7033source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7055dependencies = [7034dependencies = [7056 "futures 0.3.17",7035 "futures 0.3.18",7057 "polkadot-node-subsystem",7036 "polkadot-node-subsystem",7058 "polkadot-node-subsystem-util",7037 "polkadot-node-subsystem-util",7059 "polkadot-primitives",7038 "polkadot-primitives",7068version = "0.9.12"7047version = "0.9.12"7069source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7048source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7070dependencies = [7049dependencies = [7071 "futures 0.3.17",7050 "futures 0.3.18",7072 "futures-timer 3.0.2",7051 "futures-timer 3.0.2",7073 "kvdb",7052 "kvdb",7074 "parity-scale-codec",7053 "parity-scale-codec",7085version = "0.9.12"7064version = "0.9.12"7086source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7065source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7087dependencies = [7066dependencies = [7088 "bitvec 0.20.4",7067 "bitvec",7089 "derive_more",7068 "derive_more",7090 "futures 0.3.17",7069 "futures 0.3.18",7091 "kvdb",7070 "kvdb",7092 "parity-scale-codec",7071 "parity-scale-codec",7093 "polkadot-node-primitives",7072 "polkadot-node-primitives",7104version = "0.9.12"7083version = "0.9.12"7105source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7084source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7106dependencies = [7085dependencies = [7107 "futures 0.3.17",7086 "futures 0.3.18",7108 "polkadot-node-primitives",7087 "polkadot-node-primitives",7109 "polkadot-node-subsystem",7088 "polkadot-node-subsystem",7110 "polkadot-primitives",7089 "polkadot-primitives",7118source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7097source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7119dependencies = [7098dependencies = [7120 "async-trait",7099 "async-trait",7121 "futures 0.3.17",7100 "futures 0.3.18",7122 "futures-timer 3.0.2",7101 "futures-timer 3.0.2",7123 "polkadot-node-subsystem",7102 "polkadot-node-subsystem",7124 "polkadot-primitives",7103 "polkadot-primitives",7134version = "0.9.12"7113version = "0.9.12"7135source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7114source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7136dependencies = [7115dependencies = [7137 "bitvec 0.20.4",7116 "bitvec",7138 "futures 0.3.17",7117 "futures 0.3.18",7139 "futures-timer 3.0.2",7118 "futures-timer 3.0.2",7140 "polkadot-node-subsystem",7119 "polkadot-node-subsystem",7141 "polkadot-node-subsystem-util",7120 "polkadot-node-subsystem-util",7153 "assert_matches",7132 "assert_matches",7154 "async-process",7133 "async-process",7155 "async-std",7134 "async-std",7156 "futures 0.3.17",7135 "futures 0.3.18",7157 "futures-timer 3.0.2",7136 "futures-timer 3.0.2",7158 "libc",7137 "libc",7159 "parity-scale-codec",7138 "parity-scale-codec",7180version = "0.9.12"7159version = "0.9.12"7181source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7160source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7182dependencies = [7161dependencies = [7183 "futures 0.3.17",7162 "futures 0.3.18",7184 "memory-lru",7163 "memory-lru",7185 "parity-util-mem",7164 "parity-util-mem",7186 "polkadot-node-subsystem",7165 "polkadot-node-subsystem",7216version = "0.9.12"7195version = "0.9.12"7217source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7196source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7218dependencies = [7197dependencies = [7219 "futures 0.3.17",7198 "futures 0.3.18",7220 "futures-timer 3.0.2",7199 "futures-timer 3.0.2",7221 "metered-channel",7200 "metered-channel",7222 "substrate-prometheus-endpoint",7201 "substrate-prometheus-endpoint",7229dependencies = [7208dependencies = [7230 "async-trait",7209 "async-trait",7231 "derive_more",7210 "derive_more",7232 "futures 0.3.17",7211 "futures 0.3.18",7233 "parity-scale-codec",7212 "parity-scale-codec",7234 "polkadot-node-jaeger",7213 "polkadot-node-jaeger",7235 "polkadot-node-primitives",7214 "polkadot-node-primitives",7246source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7225source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7247dependencies = [7226dependencies = [7248 "bounded-vec",7227 "bounded-vec",7249 "futures 0.3.17",7228 "futures 0.3.18",7250 "parity-scale-codec",7229 "parity-scale-codec",7251 "polkadot-parachain",7230 "polkadot-parachain",7252 "polkadot-primitives",7231 "polkadot-primitives",7278source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7257source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7279dependencies = [7258dependencies = [7280 "derive_more",7259 "derive_more",7281 "futures 0.3.17",7260 "futures 0.3.18",7282 "polkadot-node-jaeger",7261 "polkadot-node-jaeger",7283 "polkadot-node-network-protocol",7262 "polkadot-node-network-protocol",7284 "polkadot-node-primitives",7263 "polkadot-node-primitives",7298dependencies = [7277dependencies = [7299 "async-trait",7278 "async-trait",7300 "derive_more",7279 "derive_more",7301 "futures 0.3.17",7280 "futures 0.3.18",7302 "itertools",7281 "itertools",7303 "lru 0.7.0",7282 "lru 0.7.0",7304 "metered-channel",7283 "metered-channel",7323version = "0.9.12"7302version = "0.9.12"7324source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7303source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7325dependencies = [7304dependencies = [7326 "futures 0.3.17",7305 "futures 0.3.18",7327 "futures-timer 3.0.2",7306 "futures-timer 3.0.2",7328 "lru 0.7.0",7307 "lru 0.7.0",7329 "parity-util-mem",7308 "parity-util-mem",7345source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7324source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7346dependencies = [7325dependencies = [7347 "async-trait",7326 "async-trait",7348 "futures 0.3.17",7327 "futures 0.3.18",7349 "futures-timer 3.0.2",7328 "futures-timer 3.0.2",7350 "metered-channel",7329 "metered-channel",7351 "pin-project 1.0.8",7330 "pin-project 1.0.8",7389version = "0.9.12"7368version = "0.9.12"7390source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7369source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7391dependencies = [7370dependencies = [7392 "bitvec 0.20.4",7371 "bitvec",7393 "frame-system",7372 "frame-system",7394 "hex-literal",7373 "hex-literal",7395 "parity-scale-codec",7374 "parity-scale-codec",7451source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7430source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7452dependencies = [7431dependencies = [7453 "beefy-primitives",7432 "beefy-primitives",7454 "bitvec 0.20.4",7433 "bitvec",7455 "frame-benchmarking",7434 "frame-benchmarking",7456 "frame-election-provider-support",7435 "frame-election-provider-support",7457 "frame-executive",7436 "frame-executive",7528source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7507source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7529dependencies = [7508dependencies = [7530 "beefy-primitives",7509 "beefy-primitives",7531 "bitvec 0.20.4",7510 "bitvec",7532 "frame-benchmarking",7511 "frame-benchmarking",7533 "frame-election-provider-support",7512 "frame-election-provider-support",7534 "frame-support",7513 "frame-support",7535 "frame-system",7514 "frame-system",7536 "impl-trait-for-tuples 0.2.1",7515 "impl-trait-for-tuples",7537 "libsecp256k1 0.7.0",7516 "libsecp256k1 0.7.0",7538 "log",7517 "log",7539 "pallet-authorship",7518 "pallet-authorship",7575source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7554source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7576dependencies = [7555dependencies = [7577 "bitflags",7556 "bitflags",7578 "bitvec 0.20.4",7557 "bitvec",7579 "derive_more",7558 "derive_more",7580 "frame-benchmarking",7559 "frame-benchmarking",7581 "frame-support",7560 "frame-support",7617 "beefy-gadget",7596 "beefy-gadget",7618 "beefy-primitives",7597 "beefy-primitives",7619 "frame-system-rpc-runtime-api",7598 "frame-system-rpc-runtime-api",7620 "futures 0.3.17",7599 "futures 0.3.18",7621 "hex-literal",7600 "hex-literal",7622 "kusama-runtime",7601 "kusama-runtime",7623 "kvdb",7602 "kvdb",7713dependencies = [7692dependencies = [7714 "arrayvec 0.5.2",7693 "arrayvec 0.5.2",7715 "derive_more",7694 "derive_more",7716 "futures 0.3.17",7695 "futures 0.3.18",7717 "indexmap",7696 "indexmap",7718 "parity-scale-codec",7697 "parity-scale-codec",7719 "polkadot-node-network-protocol",7698 "polkadot-node-network-protocol",7743source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7722source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7744dependencies = [7723dependencies = [7745 "beefy-primitives",7724 "beefy-primitives",7746 "bitvec 0.20.4",7725 "bitvec",7747 "frame-election-provider-support",7726 "frame-election-provider-support",7748 "frame-executive",7727 "frame-executive",7749 "frame-support",7728 "frame-support",7806 "frame-benchmarking",7785 "frame-benchmarking",7807 "frame-system",7786 "frame-system",7808 "futures 0.1.31",7787 "futures 0.1.31",7809 "futures 0.3.17",7788 "futures 0.3.18",7810 "hex",7789 "hex",7811 "pallet-balances",7790 "pallet-balances",7812 "pallet-staking",7791 "pallet-staking",7847 "sp-state-machine",7826 "sp-state-machine",7848 "substrate-test-client",7827 "substrate-test-client",7849 "tempfile",7828 "tempfile",7850 "tokio 1.13.0",7829 "tokio 1.14.0",7851 "tracing",7830 "tracing",7852]7831]785378327854[[package]]7833[[package]]7855name = "polling"7834name = "polling"7856version = "2.1.0"7835version = "2.2.0"7857source = "registry+https://github.com/rust-lang/crates.io-index"7836source = "registry+https://github.com/rust-lang/crates.io-index"7858checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25"7837checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259"7859dependencies = [7838dependencies = [7860 "cfg-if 1.0.0",7839 "cfg-if 1.0.0",7861 "libc",7840 "libc",7988 "version_check",7967 "version_check",7989]7968]79907991[[package]]7992name = "proc-macro-hack"7993version = "0.5.19"7994source = "registry+https://github.com/rust-lang/crates.io-index"7995checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"79967997[[package]]7998name = "proc-macro-nested"7999version = "0.1.7"8000source = "registry+https://github.com/rust-lang/crates.io-index"8001checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"800279698003[[package]]7970[[package]]8004name = "proc-macro2"7971name = "proc-macro2"8126 "proc-macro2",8093 "proc-macro2",8127]8094]81288129[[package]]8130name = "radium"8131version = "0.5.3"8132source = "registry+https://github.com/rust-lang/crates.io-index"8133checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"813480958135[[package]]8096[[package]]8136name = "radium"8097name = "radium"8617source = "registry+https://github.com/rust-lang/crates.io-index"8578source = "registry+https://github.com/rust-lang/crates.io-index"8618checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020"8579checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020"8619dependencies = [8580dependencies = [8620 "futures 0.3.17",8581 "futures 0.3.18",8621 "pin-project 0.4.28",8582 "pin-project 0.4.28",8622 "static_assertions",8583 "static_assertions",8623]8584]8673dependencies = [8634dependencies = [8674 "async-trait",8635 "async-trait",8675 "derive_more",8636 "derive_more",8676 "futures 0.3.17",8637 "futures 0.3.18",8677 "futures-timer 3.0.2",8638 "futures-timer 3.0.2",8678 "ip_network",8639 "ip_network",8679 "libp2p",8640 "libp2p",8698version = "0.10.0-dev"8659version = "0.10.0-dev"8699source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8660source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8700dependencies = [8661dependencies = [8701 "futures 0.3.17",8662 "futures 0.3.18",8702 "futures-timer 3.0.2",8663 "futures-timer 3.0.2",8703 "log",8664 "log",8704 "parity-scale-codec",8665 "parity-scale-codec",8737version = "4.0.0-dev"8698version = "4.0.0-dev"8738source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8699source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8739dependencies = [8700dependencies = [8740 "impl-trait-for-tuples 0.2.1",8701 "impl-trait-for-tuples",8741 "parity-scale-codec",8702 "parity-scale-codec",8742 "sc-chain-spec-derive",8703 "sc-chain-spec-derive",8743 "sc-network",8704 "sc-network",8766dependencies = [8727dependencies = [8767 "chrono",8728 "chrono",8768 "fdlimit",8729 "fdlimit",8769 "futures 0.3.17",8730 "futures 0.3.18",8770 "hex",8731 "hex",8771 "libp2p",8732 "libp2p",8772 "log",8733 "log",8794 "structopt",8755 "structopt",8795 "thiserror",8756 "thiserror",8796 "tiny-bip39",8757 "tiny-bip39",8797 "tokio 1.13.0",8758 "tokio 1.14.0",8798]8759]879987608800[[package]]8761[[package]]8803source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8764source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8804dependencies = [8765dependencies = [8805 "fnv",8766 "fnv",8806 "futures 0.3.17",8767 "futures 0.3.18",8807 "hash-db",8768 "hash-db",8808 "log",8769 "log",8809 "parity-scale-codec",8770 "parity-scale-codec",8856source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8817source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8857dependencies = [8818dependencies = [8858 "async-trait",8819 "async-trait",8859 "futures 0.3.17",8820 "futures 0.3.18",8860 "futures-timer 3.0.2",8821 "futures-timer 3.0.2",8861 "libp2p",8822 "libp2p",8862 "log",8823 "log",8881dependencies = [8842dependencies = [8882 "async-trait",8843 "async-trait",8883 "derive_more",8844 "derive_more",8884 "futures 0.3.17",8845 "futures 0.3.18",8885 "log",8846 "log",8886 "parity-scale-codec",8847 "parity-scale-codec",8887 "sc-block-builder",8848 "sc-block-builder",8911 "async-trait",8872 "async-trait",8912 "derive_more",8873 "derive_more",8913 "fork-tree",8874 "fork-tree",8914 "futures 0.3.17",8875 "futures 0.3.18",8915 "log",8876 "log",8916 "merlin",8877 "merlin",8917 "num-bigint",8878 "num-bigint",8952source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8913source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8953dependencies = [8914dependencies = [8954 "derive_more",8915 "derive_more",8955 "futures 0.3.17",8916 "futures 0.3.18",8956 "jsonrpc-core",8917 "jsonrpc-core",8957 "jsonrpc-core-client",8918 "jsonrpc-core-client",8958 "jsonrpc-derive",8919 "jsonrpc-derive",8989source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8950source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8990dependencies = [8951dependencies = [8991 "async-trait",8952 "async-trait",8992 "futures 0.3.17",8953 "futures 0.3.18",8993 "futures-timer 3.0.2",8954 "futures-timer 3.0.2",8994 "log",8955 "log",8995 "parity-scale-codec",8956 "parity-scale-codec",9108 "dyn-clone",9069 "dyn-clone",9109 "finality-grandpa",9070 "finality-grandpa",9110 "fork-tree",9071 "fork-tree",9111 "futures 0.3.17",9072 "futures 0.3.18",9112 "futures-timer 3.0.2",9073 "futures-timer 3.0.2",9113 "log",9074 "log",9114 "parity-scale-codec",9075 "parity-scale-codec",9142dependencies = [9103dependencies = [9143 "derive_more",9104 "derive_more",9144 "finality-grandpa",9105 "finality-grandpa",9145 "futures 0.3.17",9106 "futures 0.3.18",9146 "jsonrpc-core",9107 "jsonrpc-core",9147 "jsonrpc-core-client",9108 "jsonrpc-core-client",9148 "jsonrpc-derive",9109 "jsonrpc-derive",9165source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9126source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9166dependencies = [9127dependencies = [9167 "ansi_term 0.12.1",9128 "ansi_term 0.12.1",9168 "futures 0.3.17",9129 "futures 0.3.18",9169 "futures-timer 3.0.2",9130 "futures-timer 3.0.2",9170 "log",9131 "log",9171 "parity-util-mem",9132 "parity-util-mem",9224 "either",9185 "either",9225 "fnv",9186 "fnv",9226 "fork-tree",9187 "fork-tree",9227 "futures 0.3.17",9188 "futures 0.3.18",9228 "futures-timer 3.0.2",9189 "futures-timer 3.0.2",9229 "hex",9190 "hex",9230 "ip_network",9191 "ip_network",9265version = "0.10.0-dev"9226version = "0.10.0-dev"9266source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9227source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9267dependencies = [9228dependencies = [9268 "futures 0.3.17",9229 "futures 0.3.18",9269 "futures-timer 3.0.2",9230 "futures-timer 3.0.2",9270 "libp2p",9231 "libp2p",9271 "log",9232 "log",9283dependencies = [9244dependencies = [9284 "bytes 1.1.0",9245 "bytes 1.1.0",9285 "fnv",9246 "fnv",9286 "futures 0.3.17",9247 "futures 0.3.18",9287 "futures-timer 3.0.2",9248 "futures-timer 3.0.2",9288 "hex",9249 "hex",9289 "hyper",9250 "hyper",9308version = "4.0.0-dev"9269version = "4.0.0-dev"9309source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9270source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9310dependencies = [9271dependencies = [9311 "futures 0.3.17",9272 "futures 0.3.18",9312 "libp2p",9273 "libp2p",9313 "log",9274 "log",9314 "sc-utils",9275 "sc-utils",9330version = "4.0.0-dev"9291version = "4.0.0-dev"9331source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9292source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9332dependencies = [9293dependencies = [9333 "futures 0.3.17",9294 "futures 0.3.18",9334 "hash-db",9295 "hash-db",9335 "jsonrpc-core",9296 "jsonrpc-core",9336 "jsonrpc-pubsub",9297 "jsonrpc-pubsub",9361version = "0.10.0-dev"9322version = "0.10.0-dev"9362source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9323source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9363dependencies = [9324dependencies = [9364 "futures 0.3.17",9325 "futures 0.3.18",9365 "jsonrpc-core",9326 "jsonrpc-core",9366 "jsonrpc-core-client",9327 "jsonrpc-core-client",9367 "jsonrpc-derive",9328 "jsonrpc-derive",9386version = "4.0.0-dev"9347version = "4.0.0-dev"9387source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9348source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9388dependencies = [9349dependencies = [9389 "futures 0.3.17",9350 "futures 0.3.18",9390 "jsonrpc-core",9351 "jsonrpc-core",9391 "jsonrpc-http-server",9352 "jsonrpc-http-server",9392 "jsonrpc-ipc-server",9353 "jsonrpc-ipc-server",9395 "log",9356 "log",9396 "serde_json",9357 "serde_json",9397 "substrate-prometheus-endpoint",9358 "substrate-prometheus-endpoint",9398 "tokio 1.13.0",9359 "tokio 1.14.0",9399]9360]940093619401[[package]]9362[[package]]9406 "async-trait",9367 "async-trait",9407 "directories",9368 "directories",9408 "exit-future",9369 "exit-future",9409 "futures 0.3.17",9370 "futures 0.3.18",9410 "futures-timer 3.0.2",9371 "futures-timer 3.0.2",9411 "hash-db",9372 "hash-db",9412 "jsonrpc-core",9373 "jsonrpc-core",9458 "substrate-prometheus-endpoint",9419 "substrate-prometheus-endpoint",9459 "tempfile",9420 "tempfile",9460 "thiserror",9421 "thiserror",9461 "tokio 1.13.0",9422 "tokio 1.14.0",9462 "tracing",9423 "tracing",9463 "tracing-futures",9424 "tracing-futures",9464]9425]9505source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9466source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9506dependencies = [9467dependencies = [9507 "chrono",9468 "chrono",9508 "futures 0.3.17",9469 "futures 0.3.18",9509 "libp2p",9470 "libp2p",9510 "log",9471 "log",9511 "parking_lot 0.11.2",9472 "parking_lot 0.11.2",9563version = "4.0.0-dev"9524version = "4.0.0-dev"9564source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9525source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9565dependencies = [9526dependencies = [9566 "futures 0.3.17",9527 "futures 0.3.18",9567 "intervalier",9528 "intervalier",9568 "linked-hash-map",9529 "linked-hash-map",9569 "log",9530 "log",9591source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9552source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9592dependencies = [9553dependencies = [9593 "derive_more",9554 "derive_more",9594 "futures 0.3.17",9555 "futures 0.3.18",9595 "log",9556 "log",9596 "serde",9557 "serde",9597 "sp-blockchain",9558 "sp-blockchain",9604version = "4.0.0-dev"9565version = "4.0.0-dev"9605source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9566source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9606dependencies = [9567dependencies = [9607 "futures 0.3.17",9568 "futures 0.3.18",9608 "futures-timer 3.0.2",9569 "futures-timer 3.0.2",9609 "lazy_static",9570 "lazy_static",9610 "prometheus",9571 "prometheus",9616source = "registry+https://github.com/rust-lang/crates.io-index"9577source = "registry+https://github.com/rust-lang/crates.io-index"9617checksum = "5c55b744399c25532d63a0d2789b109df8d46fc93752d46b0782991a931a782f"9578checksum = "5c55b744399c25532d63a0d2789b109df8d46fc93752d46b0782991a931a782f"9618dependencies = [9579dependencies = [9619 "bitvec 0.20.4",9580 "bitvec",9620 "cfg-if 1.0.0",9581 "cfg-if 1.0.0",9621 "derive_more",9582 "derive_more",9622 "parity-scale-codec",9583 "parity-scale-codec",978397449784[[package]]9745[[package]]9785name = "serde_json"9746name = "serde_json"9786version = "1.0.68"9747version = "1.0.72"9787source = "registry+https://github.com/rust-lang/crates.io-index"9748source = "registry+https://github.com/rust-lang/crates.io-index"9788checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8"9749checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527"9789dependencies = [9750dependencies = [9790 "itoa",9751 "itoa",9791 "ryu",9752 "ryu",10006 "base64 0.12.3",9967 "base64 0.12.3",10007 "bytes 0.5.6",9968 "bytes 0.5.6",10008 "flate2",9969 "flate2",10009 "futures 0.3.17",9970 "futures 0.3.18",10010 "httparse",9971 "httparse",10011 "log",9972 "log",10012 "rand 0.7.3",9973 "rand 0.7.3",10021dependencies = [9982dependencies = [10022 "base64 0.13.0",9983 "base64 0.13.0",10023 "bytes 1.1.0",9984 "bytes 1.1.0",10024 "futures 0.3.17",9985 "futures 0.3.18",10025 "httparse",9986 "httparse",10026 "log",9987 "log",10027 "rand 0.8.4",9988 "rand 0.8.4",10127version = "4.0.0-dev"10088version = "4.0.0-dev"10128source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10089source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10129dependencies = [10090dependencies = [10130 "futures 0.3.17",10091 "futures 0.3.18",10131 "log",10092 "log",10132 "lru 0.6.6",10093 "lru 0.6.6",10133 "parity-scale-codec",10094 "parity-scale-codec",10146source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10107source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10147dependencies = [10108dependencies = [10148 "async-trait",10109 "async-trait",10149 "futures 0.3.17",10110 "futures 0.3.18",10150 "futures-timer 3.0.2",10111 "futures-timer 3.0.2",10151 "log",10112 "log",10152 "parity-scale-codec",10113 "parity-scale-codec",10233 "byteorder",10194 "byteorder",10234 "dyn-clonable",10195 "dyn-clonable",10235 "ed25519-dalek",10196 "ed25519-dalek",10236 "futures 0.3.17",10197 "futures 0.3.18",10237 "hash-db",10198 "hash-db",10238 "hash256-std-hasher",10199 "hash256-std-hasher",10239 "hex",10200 "hex",10323source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10284source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10324dependencies = [10285dependencies = [10325 "async-trait",10286 "async-trait",10326 "impl-trait-for-tuples 0.2.1",10287 "impl-trait-for-tuples",10327 "parity-scale-codec",10288 "parity-scale-codec",10328 "sp-core",10289 "sp-core",10329 "sp-runtime",10290 "sp-runtime",10336version = "4.0.0-dev"10297version = "4.0.0-dev"10337source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10298source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10338dependencies = [10299dependencies = [10339 "futures 0.3.17",10300 "futures 0.3.18",10340 "hash-db",10301 "hash-db",10341 "libsecp256k1 0.6.0",10302 "libsecp256k1 0.6.0",10342 "log",10303 "log",10373dependencies = [10334dependencies = [10374 "async-trait",10335 "async-trait",10375 "derive_more",10336 "derive_more",10376 "futures 0.3.17",10337 "futures 0.3.18",10377 "merlin",10338 "merlin",10378 "parity-scale-codec",10339 "parity-scale-codec",10379 "parking_lot 0.11.2",10340 "parking_lot 0.11.2",10452dependencies = [10413dependencies = [10453 "either",10414 "either",10454 "hash256-std-hasher",10415 "hash256-std-hasher",10455 "impl-trait-for-tuples 0.2.1",10416 "impl-trait-for-tuples",10456 "log",10417 "log",10457 "parity-scale-codec",10418 "parity-scale-codec",10458 "parity-util-mem",10419 "parity-util-mem",10472version = "4.0.0-dev"10433version = "4.0.0-dev"10473source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10434source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10474dependencies = [10435dependencies = [10475 "impl-trait-for-tuples 0.2.1",10436 "impl-trait-for-tuples",10476 "parity-scale-codec",10437 "parity-scale-codec",10477 "primitive-types 0.10.1",10438 "primitive-types 0.10.1",10478 "sp-externalities",10439 "sp-externalities",10698version = "4.0.0-dev"10659version = "4.0.0-dev"10699source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10660source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10700dependencies = [10661dependencies = [10701 "impl-trait-for-tuples 0.2.1",10662 "impl-trait-for-tuples",10702 "parity-scale-codec",10663 "parity-scale-codec",10703 "sp-std",10664 "sp-std",10704 "wasmi",10665 "wasmi",107121067310713[[package]]10674[[package]]10714name = "ss58-registry"10675name = "ss58-registry"10715version = "1.2.0"10676version = "1.8.1"10716source = "registry+https://github.com/rust-lang/crates.io-index"10677source = "registry+https://github.com/rust-lang/crates.io-index"10717checksum = "bb102b328df61c67f8ccf8471b29c31c7d6da646a867aff95fe8bff386fe7c4d"10678checksum = "78abb01d308934b82e34e9cf1f45846d31539246501745b129539176f4f3368d"10718dependencies = [10679dependencies = [10719 "Inflector",10680 "Inflector",10720 "proc-macro2",10681 "proc-macro2",10897source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10858source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10898dependencies = [10859dependencies = [10899 "frame-system-rpc-runtime-api",10860 "frame-system-rpc-runtime-api",10900 "futures 0.3.17",10861 "futures 0.3.18",10901 "jsonrpc-core",10862 "jsonrpc-core",10902 "jsonrpc-core-client",10863 "jsonrpc-core-client",10903 "jsonrpc-derive",10864 "jsonrpc-derive",10924 "hyper",10885 "hyper",10925 "log",10886 "log",10926 "prometheus",10887 "prometheus",10927 "tokio 1.13.0",10888 "tokio 1.14.0",10928]10889]109291089010930[[package]]10891[[package]]10933source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10894source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10934dependencies = [10895dependencies = [10935 "async-trait",10896 "async-trait",10936 "futures 0.3.17",10897 "futures 0.3.18",10937 "hex",10898 "hex",10938 "parity-scale-codec",10899 "parity-scale-codec",10939 "sc-client-api",10900 "sc-client-api",10959version = "4.0.0-dev"10920version = "4.0.0-dev"10960source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10921source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10961dependencies = [10922dependencies = [10962 "futures 0.3.17",10923 "futures 0.3.18",10963 "substrate-test-utils-derive",10924 "substrate-test-utils-derive",10964 "tokio 1.13.0",10925 "tokio 1.14.0",10965]10926]109661092710967[[package]]10928[[package]]110041096511005[[package]]10966[[package]]11006name = "syn"10967name = "syn"11007version = "1.0.81"10968version = "1.0.82"11008source = "registry+https://github.com/rust-lang/crates.io-index"10969source = "registry+https://github.com/rust-lang/crates.io-index"11009checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"10970checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"11010dependencies = [10971dependencies = [11011 "proc-macro2",10972 "proc-macro2",11012 "quote",10973 "quote",111721113311173[[package]]11134[[package]]11174name = "tinyvec"11135name = "tinyvec"11175version = "1.5.0"11136version = "1.5.1"11176source = "registry+https://github.com/rust-lang/crates.io-index"11137source = "registry+https://github.com/rust-lang/crates.io-index"11177checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7"11138checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"11178dependencies = [11139dependencies = [11179 "tinyvec_macros",11140 "tinyvec_macros",11180]11141]111991116011200[[package]]11161[[package]]11201name = "tokio"11162name = "tokio"11202version = "1.13.0"11163version = "1.14.0"11203source = "registry+https://github.com/rust-lang/crates.io-index"11164source = "registry+https://github.com/rust-lang/crates.io-index"11204checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee"11165checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"11205dependencies = [11166dependencies = [11206 "autocfg",11167 "autocfg",11207 "bytes 1.1.0",11168 "bytes 1.1.0",11212 "once_cell",11173 "once_cell",11213 "pin-project-lite 0.2.7",11174 "pin-project-lite 0.2.7",11214 "signal-hook-registry",11175 "signal-hook-registry",11215 "tokio-macros 1.5.1",11176 "tokio-macros 1.6.0",11216 "winapi 0.3.9",11177 "winapi 0.3.9",11217]11178]1121811179112291119011230[[package]]11191[[package]]11231name = "tokio-macros"11192name = "tokio-macros"11232version = "1.5.1"11193version = "1.6.0"11233source = "registry+https://github.com/rust-lang/crates.io-index"11194source = "registry+https://github.com/rust-lang/crates.io-index"11234checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095"11195checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e"11235dependencies = [11196dependencies = [11236 "proc-macro2",11197 "proc-macro2",11237 "quote",11198 "quote",11245checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"11206checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"11246dependencies = [11207dependencies = [11247 "rustls",11208 "rustls",11248 "tokio 1.13.0",11209 "tokio 1.14.0",11249 "webpki",11210 "webpki",11250]11211]112511121211257dependencies = [11218dependencies = [11258 "futures-core",11219 "futures-core",11259 "pin-project-lite 0.2.7",11220 "pin-project-lite 0.2.7",11260 "tokio 1.13.0",11221 "tokio 1.14.0",11261]11222]112621122311263[[package]]11224[[package]]11272 "futures-sink",11233 "futures-sink",11273 "log",11234 "log",11274 "pin-project-lite 0.2.7",11235 "pin-project-lite 0.2.7",11275 "tokio 1.13.0",11236 "tokio 1.14.0",11276]11237]112771123811278[[package]]11239[[package]]11596 "fp-rpc",11557 "fp-rpc",11597 "frame-benchmarking",11558 "frame-benchmarking",11598 "frame-benchmarking-cli",11559 "frame-benchmarking-cli",11599 "futures 0.3.17",11560 "futures 0.3.18",11600 "jsonrpc-core",11561 "jsonrpc-core",11601 "jsonrpc-pubsub",11562 "jsonrpc-pubsub",11602 "log",11563 "log",11660 "fc-rpc",11621 "fc-rpc",11661 "fc-rpc-core",11622 "fc-rpc-core",11662 "fp-rpc",11623 "fp-rpc",11663 "futures 0.3.17",11624 "futures 0.3.18",11664 "jsonrpc-core",11625 "jsonrpc-core",11665 "jsonrpc-pubsub",11626 "jsonrpc-pubsub",11666 "pallet-ethereum",11627 "pallet-ethereum",118001176111801[[package]]11762[[package]]11802name = "unsigned-varint"11763name = "unsigned-varint"11803version = "0.7.0"11764version = "0.7.1"11804source = "registry+https://github.com/rust-lang/crates.io-index"11765source = "registry+https://github.com/rust-lang/crates.io-index"11805checksum = "5f8d425fafb8cd76bc3f22aace4af471d3156301d7508f2107e98fbeae10bc7f"11766checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836"11806dependencies = [11767dependencies = [11807 "asynchronous-codec 0.6.0",11768 "asynchronous-codec 0.6.0",11808 "bytes 1.1.0",11769 "bytes 1.1.0",11857version = "0.1.0"11818version = "0.1.0"11858source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#ab8b91e9350a31133f3a3e4f52a84c6de4108e95"11819source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#ab8b91e9350a31133f3a3e4f52a84c6de4108e95"11859dependencies = [11820dependencies = [11860 "impl-trait-for-tuples 0.2.1",11821 "impl-trait-for-tuples",11861]11822]118621182311863[[package]]11824[[package]]12039source = "registry+https://github.com/rust-lang/crates.io-index"12000source = "registry+https://github.com/rust-lang/crates.io-index"12040checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"12001checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"12041dependencies = [12002dependencies = [12042 "futures 0.3.17",12003 "futures 0.3.18",12043 "js-sys",12004 "js-sys",12044 "parking_lot 0.11.2",12005 "parking_lot 0.11.2",12045 "pin-utils",12006 "pin-utils",12279source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"12240source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"12280dependencies = [12241dependencies = [12281 "beefy-primitives",12242 "beefy-primitives",12282 "bitvec 0.20.4",12243 "bitvec",12283 "frame-benchmarking",12244 "frame-benchmarking",12284 "frame-election-provider-support",12245 "frame-election-provider-support",12285 "frame-executive",12246 "frame-executive",12459source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"12420source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"12460dependencies = [12421dependencies = [12461 "derivative",12422 "derivative",12462 "impl-trait-for-tuples 0.2.1",12423 "impl-trait-for-tuples",12463 "log",12424 "log",12464 "parity-scale-codec",12425 "parity-scale-codec",12465 "scale-info",12426 "scale-info",12493dependencies = [12454dependencies = [12494 "frame-benchmarking",12455 "frame-benchmarking",12495 "frame-support",12456 "frame-support",12496 "impl-trait-for-tuples 0.2.1",12457 "impl-trait-for-tuples",12497 "log",12458 "log",12498 "parity-scale-codec",12459 "parity-scale-codec",12499 "sp-arithmetic",12460 "sp-arithmetic",12520source = "registry+https://github.com/rust-lang/crates.io-index"12481source = "registry+https://github.com/rust-lang/crates.io-index"12521checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107"12482checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107"12522dependencies = [12483dependencies = [12523 "futures 0.3.17",12484 "futures 0.3.18",12524 "log",12485 "log",12525 "nohash-hasher",12486 "nohash-hasher",12526 "parking_lot 0.11.2",12487 "parking_lot 0.11.2",125361249712537[[package]]12498[[package]]12538name = "zeroize"12499name = "zeroize"12539version = "1.4.2"12500version = "1.4.3"12540source = "registry+https://github.com/rust-lang/crates.io-index"12501source = "registry+https://github.com/rust-lang/crates.io-index"12541checksum = "bf68b08513768deaa790264a7fac27a58cbf2705cfcdc9448362229217d7e970"12502checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619"12542dependencies = [12503dependencies = [12543 "zeroize_derive",12504 "zeroize_derive",12544]12505]125451250612546[[package]]12507[[package]]12547name = "zeroize_derive"12508name = "zeroize_derive"12548version = "1.2.0"12509version = "1.2.2"12549source = "registry+https://github.com/rust-lang/crates.io-index"12510source = "registry+https://github.com/rust-lang/crates.io-index"12550checksum = "bdff2024a851a322b08f179173ae2ba620445aef1e838f0c196820eade4ae0c7"12511checksum = "65f1a51723ec88c66d5d1fe80c841f17f63587d6691901d66be9bec6c3b51f73"12551dependencies = [12512dependencies = [12552 "proc-macro2",12513 "proc-macro2",12553 "quote",12514 "quote",Dockerfile-parachaindiffbeforeafterboth2FROM phusion/baseimage:focal-1.0.0 as rust-builder2FROM phusion/baseimage:focal-1.0.0 as rust-builder3LABEL maintainer="Unique.Network"3LABEL maintainer="Unique.Network"445ARG RUST_TOOLCHAIN=nightly-2021-06-285ARG RUST_TOOLCHAIN=nightly-2021-11-116#ARG RUST_C=1.55.0-nightly6#ARG RUST_C=1.55.0-nightly7ARG POLKA_VERSION=v0.9.127ARG POLKA_VERSION=v0.9.128ARG UNIQUE_BRANCH=develop8ARG UNIQUE_BRANCH=developREADME.mddiffbeforeafterboth6363642. Remove all installed toolchains with `rustup toolchain list` and `rustup toolchain uninstall <toolchain>`.642. Remove all installed toolchains with `rustup toolchain list` and `rustup toolchain uninstall <toolchain>`.6565663. Install install nightly 2021-06-28 and make it default:663. Install install nightly 2021-11-11 and make it default:676768```bash68```bash69rustup toolchain install nightly-2021-06-2869rustup toolchain install nightly-2021-11-1170rustup default nightly-2021-06-2870rustup default nightly-2021-11-1171```71```7272734. Add wasm target for nightly toolchain:734. Add wasm target for nightly toolchain:747475```bash75```bash76rustup target add wasm32-unknown-unknown --toolchain nightly-2021-06-2876rustup target add wasm32-unknown-unknown --toolchain nightly-2021-11-1177```77```7878795. Build:795. Build:135135136## Building and Running as Parachain locally136## Building and Running as Parachain locally137137138Rust toolchain: nightly-2021-06-28138Rust toolchain: nightly-2021-11-11139Note: checkout this project and polkadot project (see below) in the sibling folders (both under the same folder)139Note: checkout this project and polkadot project (see below) in the sibling folders (both under the same folder)140140141### Build relay141### Build relay208208209First of all, add rust toolchain and make it default.209First of all, add rust toolchain and make it default.210```bash210```bash211rustup target add wasm32-unknown-unknown --toolchain nightly-2021-06-28211rustup target add wasm32-unknown-unknown --toolchain nightly-2021-11-11212```212```213213214Then in "/node/src" run build command below214Then in "/node/src" run build command below215```bash215```bash216cargo +nightly-2021-06-28 build --release --features runtime-benchmarks216cargo +nightly-2021-11-11 build --release --features runtime-benchmarks217```217```218218219Run benchmark219Run benchmarkclient/rpc/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "uc-rpc"2name = "uc-rpc"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies]6[dependencies]7pallet-common = { default-features = false, path = '../../pallets/common' }7pallet-common = { default-features = false, path = '../../pallets/common' }crates/evm-coder-macros/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "evm-coder-macros"2name = "evm-coder-macros"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[lib]6[lib]7proc-macro = true7proc-macro = truecrates/evm-coder-macros/src/lib.rsdiffbeforeafterboth27/// Returns solidity function selector (first 4 bytes of hash) by its27/// Returns solidity function selector (first 4 bytes of hash) by its28/// textual representation28/// textual representation29///29///30/// ```rs30/// ```ignore31/// use evm_coder_macros::fn_selector;31/// use evm_coder_macros::fn_selector;32///32///33/// assert_eq!(fn_selector!(transfer(address, uint256)), 0xa9059cbb);33/// assert_eq!(fn_selector!(transfer(address, uint256)), 0xa9059cbb);555556/// Returns solidity topic (hash) by its textual representation56/// Returns solidity topic (hash) by its textual representation57///57///58/// ```rs58/// ```ignore59/// use evm_coder_macros::event_topic;59/// use evm_coder_macros::event_topic;60///60///61/// assert_eq!(61/// assert_eq!(184 Ident::new(&name, ident.span())184 Ident::new(&name, ident.span())185}185}186186187/// Derives call enum implementing [`evm_coder::Callable`], [`evm_coder::Weighted`]188/// and [`evm_coder::Call`] from impl block189///190/// ## Macro syntax191///192/// `#[solidity_interface(name, is, inline_is, events)]`193/// - *name*: used in generated code, and for Call enum name194/// - *is*: used to provide call inheritance, not found methods will be delegated to all contracts195/// specified in is/inline_is196/// - *inline_is*: same as is, but selectors for passed contracts will be used by derived ERC165197/// implementation198///199/// `#[weight(value)]`200/// Can be added to every method of impl block, used for deriving [`evm_coder::Weighted`], which201/// is used by substrate bridge202/// - *value*: expression, which evaluates to weight required to call this method.203/// This expression can use call arguments to calculate non-constant execution time.204/// This expression should evaluate faster than actual execution does, and may provide worser case205/// than one is called206///207/// `#[solidity_interface(rename_selector)]`208/// - *rename_selector*: by default, selector name will be generated by transforming method name209/// from snake_case to camelCase. Use this option, if other naming convention is required.210/// I.e: method `token_uri` will be automatically renamed to `tokenUri` in selector, but name211/// required by ERC721 standard is `tokenURI`, thus we need to specify `rename_selector = "tokenURI"`212/// explicitly213///214/// Also, any contract method may have doc comments, which will be automatically added to generated215/// solidity interface definitions216///217/// ## Example218///219/// ```ignore220/// struct SuperContract;221/// struct InlineContract;222/// struct Contract;223///224/// #[derive(ToLog)]225/// enum ContractEvents {226/// Event(#[indexed] uint32),227/// }228///229/// #[solidity_interface(name = "MyContract", is(SuperContract), inline_is(InlineContract))]230/// impl Contract {231/// /// Multiply two numbers232/// #[weight(200 + a + b)]233/// #[solidity_interface(rename_selector = "mul")]234/// fn mul(&mut self, a: uint32, b: uint32) -> Result<uint32> {235/// Ok(a.checked_mul(b).ok_or("overflow")?)236/// }237/// }238/// ```187#[proc_macro_attribute]239#[proc_macro_attribute]188pub fn solidity_interface(args: TokenStream, stream: TokenStream) -> TokenStream {240pub fn solidity_interface(args: TokenStream, stream: TokenStream) -> TokenStream {189 let args = parse_macro_input!(args as AttributeArgs);241 let args = parse_macro_input!(args as AttributeArgs);211pub fn solidity(_args: TokenStream, stream: TokenStream) -> TokenStream {263pub fn solidity(_args: TokenStream, stream: TokenStream) -> TokenStream {212 stream264 stream213}265}214266#[proc_macro_attribute]267pub fn weight(_args: TokenStream, stream: TokenStream) -> TokenStream {268 stream269}270271/// ## Syntax272///273/// `#[indexed]`274/// Marks this field as indexed, so it will appear in [`ethereum::Log`] topics instead of data215#[proc_macro_derive(ToLog, attributes(indexed))]275#[proc_macro_derive(ToLog, attributes(indexed))]216pub fn to_log(value: TokenStream) -> TokenStream {276pub fn to_log(value: TokenStream) -> TokenStream {217 let input = parse_macro_input!(value as DeriveInput);277 let input = parse_macro_input!(value as DeriveInput);crates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth6use std::fmt::Write;6use std::fmt::Write;7use syn::{7use syn::{8 Expr, FnArg, GenericArgument, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, Lit, Meta,8 Expr, FnArg, GenericArgument, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, Lit, Meta,9 NestedMeta, PatType, Path, PathArguments, ReturnType, Type, spanned::Spanned,9 MetaNameValue, NestedMeta, PatType, Path, PathArguments, ReturnType, Type, spanned::Spanned,10};10};111112use crate::{12use crate::{30 })30 })31 }31 }323233 fn expand_call_def(&self) -> proc_macro2::TokenStream {33 fn expand_call_def(&self, gen_ref: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {34 let name = &self.name;34 let name = &self.name;35 let pascal_call_name = &self.pascal_call_name;35 let pascal_call_name = &self.pascal_call_name;36 quote! {36 quote! {37 #name(#pascal_call_name)37 #name(#pascal_call_name #gen_ref)38 }38 }39 }39 }404046 }46 }474748 fn expand_supports_interface(&self) -> proc_macro2::TokenStream {48 fn expand_supports_interface(49 &self,50 generics: &proc_macro2::TokenStream,51 ) -> proc_macro2::TokenStream {49 let pascal_call_name = &self.pascal_call_name;52 let pascal_call_name = &self.pascal_call_name;50 quote! {53 quote! {51 #pascal_call_name::supports_interface(interface_id)54 <#pascal_call_name #generics>::supports_interface(interface_id)52 }55 }53 }56 }5758 fn expand_variant_weight(&self) -> proc_macro2::TokenStream {59 let name = &self.name;60 quote! {61 Self::#name(call) => call.weight()62 }63 }546455 fn expand_variant_call(&self) -> proc_macro2::TokenStream {65 fn expand_variant_call(66 &self,67 call_name: &proc_macro2::Ident,68 generics: &proc_macro2::TokenStream,69 ) -> proc_macro2::TokenStream {56 let name = &self.name;70 let name = &self.name;57 let pascal_call_name = &self.pascal_call_name;71 let pascal_call_name = &self.pascal_call_name;58 quote! {72 quote! {59 InternalCall::#name(call) => return <Self as ::evm_coder::Callable<#pascal_call_name>>::call(self, Msg {73 #call_name::#name(call) => return <Self as ::evm_coder::Callable<#pascal_call_name #generics>>::call(self, Msg {60 call,74 call,61 caller: c.caller,75 caller: c.caller,62 value: c.value,76 value: c.value,63 })77 })64 }78 }65 }79 }668067 fn expand_parse(&self) -> proc_macro2::TokenStream {81 fn expand_parse(&self, generics: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {68 let name = &self.name;82 let name = &self.name;69 let pascal_call_name = &self.pascal_call_name;83 let pascal_call_name = &self.pascal_call_name;70 quote! {84 quote! {71 if let Some(parsed_call) = #pascal_call_name::parse(method_id, reader)? {85 if let Some(parsed_call) = <#pascal_call_name #generics>::parse(method_id, reader)? {72 return Ok(Some(Self::#name(parsed_call)))86 return Ok(Some(Self::#name(parsed_call)))73 }87 }74 }88 }75 }89 }769077 fn expand_generator(&self) -> proc_macro2::TokenStream {91 fn expand_generator(&self, generics: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {78 let pascal_call_name = &self.pascal_call_name;92 let pascal_call_name = &self.pascal_call_name;79 quote! {93 quote! {80 #pascal_call_name::generate_solidity_interface(tc, is_impl);94 <#pascal_call_name #generics>::generate_solidity_interface(tc, is_impl);81 }95 }82 }96 }8397212 }226 }213 }227 }214 fn is_value(&self) -> bool {228 fn is_value(&self) -> bool {215 match self {229 matches!(self, Self::Plain(v) if v == "value")216 Self::Plain(v) if v == "value" => true,217 _ => false,218 }219 }230 }220 fn is_caller(&self) -> bool {231 fn is_caller(&self) -> bool {221 match self {232 matches!(self, Self::Plain(v) if v == "caller")222 Self::Plain(v) if v == "caller" => true,223 _ => false,224 }225 }233 }226 fn is_special(&self) -> bool {234 fn is_special(&self) -> bool {227 self.is_caller() || self.is_value()235 self.is_caller() || self.is_value()351 Pure,359 Pure,352}360}361362pub struct WeightAttr(syn::Expr);363364mod keyword {365 syn::custom_keyword!(weight);366}367368impl syn::parse::Parse for WeightAttr {369 fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {370 input.parse::<syn::Token![#]>()?;371 let content;372 syn::bracketed!(content in input);373 content.parse::<keyword::weight>()?;374375 let weight_content;376 syn::parenthesized!(weight_content in content);377 Ok(WeightAttr(weight_content.parse::<syn::Expr>()?))378 }379}353380354struct Method {381struct Method {355 name: Ident,382 name: Ident,362 has_normal_args: bool,389 has_normal_args: bool,363 mutability: Mutability,390 mutability: Mutability,364 result: Type,391 result: Type,392 weight: Option<Expr>,393 docs: Vec<String>,365}394}366impl Method {395impl Method {367 fn try_from(value: &ImplItemMethod) -> syn::Result<Self> {396 fn try_from(value: &ImplItemMethod) -> syn::Result<Self> {368 let mut info = MethodInfo {397 let mut info = MethodInfo {369 rename_selector: None,398 rename_selector: None,370 };399 };400 let mut docs = Vec::new();401 let mut weight = None;371 for attr in &value.attrs {402 for attr in &value.attrs {372 let ident = parse_ident_from_path(&attr.path, false)?;403 let ident = parse_ident_from_path(&attr.path, false)?;373 if ident == "solidity" {404 if ident == "solidity" {374 let args = attr.parse_meta().unwrap();405 let args = attr.parse_meta().unwrap();375 info = MethodInfo::from_meta(&args).unwrap();406 info = MethodInfo::from_meta(&args).unwrap();376 } else if ident == "doc" {407 } else if ident == "doc" {377 // TODO: Add docs to evm interfaces408 let args = attr.parse_meta().unwrap();409 let value = match args {410 Meta::NameValue(MetaNameValue {411 lit: Lit::Str(str), ..412 }) => str.value(),413 _ => unreachable!(),414 };415 docs.push(value);378 }416 } else if ident == "weight" {417 weight = Some(syn::parse2::<WeightAttr>(attr.to_token_stream())?.0);418 }379 }419 }380 let ident = &value.sig.ident;420 let ident = &value.sig.ident;381 let ident_str = ident.to_string();421 let ident_str = ident.to_string();457 has_normal_args,497 has_normal_args,458 mutability,498 mutability,459 result: result.clone(),499 result: result.clone(),500 weight,501 docs,460 })502 })461 }503 }462 fn expand_call_def(&self) -> proc_macro2::TokenStream {504 fn expand_call_def(&self) -> proc_macro2::TokenStream {518 }560 }519 }561 }520562521 fn expand_variant_call(&self) -> proc_macro2::TokenStream {563 fn expand_variant_call(&self, call_name: &proc_macro2::Ident) -> proc_macro2::TokenStream {522 let pascal_name = &self.pascal_name;564 let pascal_name = &self.pascal_name;523 let name = &self.name;565 let name = &self.name;524566545 let args = self.args.iter().map(|a| a.expand_call_arg());587 let args = self.args.iter().map(|a| a.expand_call_arg());546588547 quote! {589 quote! {548 InternalCall::#pascal_name #matcher => {590 #call_name::#pascal_name #matcher => {549 let result = #receiver #name(591 let result = #receiver #name(550 #(592 #(551 #args,593 #args,552 )*594 )*553 )?;595 )?;554 (&result).abi_write(&mut writer);596 (&result).to_result()555 }597 }556 }598 }557 }599 }600601 fn expand_variant_weight(&self) -> proc_macro2::TokenStream {602 let pascal_name = &self.pascal_name;603 if let Some(weight) = &self.weight {604 let matcher = if self.has_normal_args {605 let names = self606 .args607 .iter()608 .filter(|a| !a.is_special())609 .map(|a| &a.name);610611 quote! {{612 #(613 #names,614 )*615 }}616 } else {617 quote! {}618 };619 quote! {620 Self::#pascal_name #matcher => (#weight).into()621 }622 } else {623 let matcher = if self.has_normal_args {624 quote! {{..}}625 } else {626 quote! {}627 };628 quote! {629 Self::#pascal_name #matcher => ().into()630 }631 }632 }558633559 fn expand_solidity_function(&self) -> proc_macro2::TokenStream {634 fn expand_solidity_function(&self) -> proc_macro2::TokenStream {560 let camel_name = &self.camel_name;635 let camel_name = &self.camel_name;570 .iter()645 .iter()571 .filter(|a| !a.is_special())646 .filter(|a| !a.is_special())572 .map(MethodArg::expand_solidity_argument);647 .map(MethodArg::expand_solidity_argument);648 let docs = self.docs.iter();573 let selector = format!("{} {:0>8x}", self.selector_str, self.selector);649 let selector = format!("{} {:0>8x}", self.selector_str, self.selector);574650575 quote! {651 quote! {576 SolidityFunction {652 SolidityFunction {653 docs: &[#(#docs),*],577 selector: #selector,654 selector: #selector,578 name: #camel_name,655 name: #camel_name,579 mutability: #mutability,656 mutability: #mutability,588 }665 }589}666}667668fn generics_list(gen: &Generics) -> proc_macro2::TokenStream {669 if gen.params.is_empty() {670 return quote! {};671 }672 let params = gen.params.iter().map(|p| match p {673 syn::GenericParam::Type(id) => {674 let v = &id.ident;675 quote! {#v}676 }677 syn::GenericParam::Lifetime(lt) => {678 let v = <.lifetime;679 quote! {#v}680 }681 syn::GenericParam::Const(c) => {682 let i = &c.ident;683 quote! {#i}684 }685 });686 quote! { #(#params),* }687}688fn generics_reference(gen: &Generics) -> proc_macro2::TokenStream {689 if gen.params.is_empty() {690 return quote! {};691 }692 let list = generics_list(gen);693 quote! { <#list> }694}695fn generics_data(gen: &Generics) -> proc_macro2::TokenStream {696 let list = generics_list(gen);697 if gen.params.len() == 1 {698 quote! {#list}699 } else {700 quote! { (#list) }701 }702}590703591pub struct SolidityInterface {704pub struct SolidityInterface {592 generics: Generics,705 generics: Generics,616 let solidity_name = self.info.name.to_string();729 let solidity_name = self.info.name.to_string();617 let call_name = pascal_ident_to_call(&self.info.name);730 let call_name = pascal_ident_to_call(&self.info.name);618 let generics = self.generics;731 let generics = self.generics;732 let gen_ref = generics_reference(&generics);733 let gen_data = generics_data(&generics);619734620 let call_sub = self735 let call_sub = self621 .info736 .info622 .inline_is737 .inline_is623 .0738 .0624 .iter()739 .iter()625 .chain(self.info.is.0.iter())740 .chain(self.info.is.0.iter())626 .map(Is::expand_call_def);741 .map(|c| Is::expand_call_def(c, &gen_ref));627 let call_parse = self742 let call_parse = self628 .info743 .info629 .inline_is744 .inline_is630 .0745 .0631 .iter()746 .iter()632 .chain(self.info.is.0.iter())747 .chain(self.info.is.0.iter())633 .map(Is::expand_parse);748 .map(|is| Is::expand_parse(is, &gen_ref));634 let call_variants = self749 let call_variants = self635 .info750 .info636 .inline_is751 .inline_is637 .0752 .0638 .iter()753 .iter()639 .chain(self.info.is.0.iter())754 .chain(self.info.is.0.iter())640 .map(Is::expand_variant_call);755 .map(|c| Is::expand_variant_call(c, &call_name, &gen_ref));756 let weight_variants = self757 .info758 .inline_is759 .0760 .iter()761 .chain(self.info.is.0.iter())762 .map(Is::expand_variant_weight);641763642 let inline_interface_id = self.info.inline_is.0.iter().map(Is::expand_interface_id);764 let inline_interface_id = self.info.inline_is.0.iter().map(Is::expand_interface_id);643 let supports_interface = self.info.is.0.iter().map(Is::expand_supports_interface);765 let supports_interface = self766 .info767 .is768 .0769 .iter()770 .map(|is| Is::expand_supports_interface(is, &gen_ref));644771645 let calls = self.methods.iter().map(Method::expand_call_def);772 let calls = self.methods.iter().map(Method::expand_call_def);646 let consts = self.methods.iter().map(Method::expand_const);773 let consts = self.methods.iter().map(Method::expand_const);647 let interface_id = self.methods.iter().map(Method::expand_interface_id);774 let interface_id = self.methods.iter().map(Method::expand_interface_id);648 let parsers = self.methods.iter().map(Method::expand_parse);775 let parsers = self.methods.iter().map(Method::expand_parse);649 let call_variants_this = self.methods.iter().map(Method::expand_variant_call);776 let call_variants_this = self777 .methods778 .iter()779 .map(|m| Method::expand_variant_call(m, &call_name));780 let weight_variants_this = self.methods.iter().map(Method::expand_variant_weight);650 let solidity_functions = self.methods.iter().map(Method::expand_solidity_function);781 let solidity_functions = self.methods.iter().map(Method::expand_solidity_function);651782652 // TODO: Inline inline_is783 // TODO: Inline inline_is664 .0795 .0665 .iter()796 .iter()666 .chain(self.info.inline_is.0.iter())797 .chain(self.info.inline_is.0.iter())667 .map(Is::expand_generator);798 .map(|is| Is::expand_generator(is, &gen_ref));668 let solidity_event_generators = self.info.events.0.iter().map(Is::expand_event_generator);799 let solidity_event_generators = self.info.events.0.iter().map(Is::expand_event_generator);669800670 // let methods = self.methods.iter().map(Method::solidity_def);801 // let methods = self.methods.iter().map(Method::solidity_def);671802672 quote! {803 quote! {673 #[derive(Debug)]804 #[derive(Debug)]674 pub enum #call_name {805 pub enum #call_name #gen_ref {675 ERC165Call(::evm_coder::ERC165Call),806 ERC165Call(::evm_coder::ERC165Call, ::core::marker::PhantomData<#gen_data>),676 #(807 #(677 #calls,808 #calls,678 )*809 )*679 #(810 #(680 #call_sub,811 #call_sub,681 )*812 )*682 }813 }683 impl #call_name {814 impl #gen_ref #call_name #gen_ref {684 #(815 #(685 #consts816 #consts686 )*817 )*687 pub const fn interface_id() -> u32 {818 pub fn interface_id() -> u32 {688 let mut interface_id = 0;819 let mut interface_id = 0;689 #(#interface_id)*820 #(#interface_id)*690 #(#inline_interface_id)*821 #(#inline_interface_id)*704 use core::fmt::Write;835 use core::fmt::Write;705 let interface = SolidityInterface {836 let interface = SolidityInterface {706 name: #solidity_name,837 name: #solidity_name,838 selector: Self::interface_id(),707 is: &["Dummy", "ERC165", #(839 is: &["Dummy", "ERC165", #(708 #solidity_is,840 #solidity_is,709 )* #(841 )* #(735 tc.collect(out);867 tc.collect(out);736 }868 }737 }869 }738 impl ::evm_coder::Call for #call_name {870 impl #gen_ref ::evm_coder::Call for #call_name #gen_ref {739 fn parse(method_id: u32, reader: &mut ::evm_coder::abi::AbiReader) -> ::evm_coder::execution::Result<Option<Self>> {871 fn parse(method_id: u32, reader: &mut ::evm_coder::abi::AbiReader) -> ::evm_coder::execution::Result<Option<Self>> {740 use ::evm_coder::abi::AbiRead;872 use ::evm_coder::abi::AbiRead;741 match method_id {873 match method_id {742 ::evm_coder::ERC165Call::INTERFACE_ID => return Ok(::evm_coder::ERC165Call::parse(method_id, reader)?.map(Self::ERC165Call)),874 ::evm_coder::ERC165Call::INTERFACE_ID => return Ok(875 ::evm_coder::ERC165Call::parse(method_id, reader)?876 .map(|c| Self::ERC165Call(c, ::core::marker::PhantomData))877 ),743 #(878 #(744 #parsers,879 #parsers,751 return Ok(None);886 return Ok(None);752 }887 }753 }888 }754 impl #generics ::evm_coder::Callable<#call_name> for #name {889 impl #generics ::evm_coder::Weighted for #call_name #gen_ref {890 #[allow(unused_variables)]891 fn weight(&self) -> ::evm_coder::execution::DispatchInfo {892 match self {893 #(894 #weight_variants,895 )*896 // TODO: It should be very cheap, but not free897 Self::ERC165Call(::evm_coder::ERC165Call::SupportsInterface {..}, _) => 100u64.into(),898 #(899 #weight_variants_this,900 )*901 }902 }903 }904 impl #generics ::evm_coder::Callable<#call_name #gen_ref> for #name {755 #[allow(unreachable_code)] // In case of no inner calls905 #[allow(unreachable_code)] // In case of no inner calls756 fn call(&mut self, c: Msg<#call_name>) -> Result<::evm_coder::abi::AbiWriter> {906 fn call(&mut self, c: Msg<#call_name #gen_ref>) -> ::evm_coder::execution::ResultWithPostInfo<::evm_coder::abi::AbiWriter> {757 use ::evm_coder::abi::AbiWrite;907 use ::evm_coder::abi::AbiWrite;758 type InternalCall = #call_name;759 match c.call {908 match c.call {760 #(909 #(761 #call_variants,910 #call_variants,762 )*911 )*763 InternalCall::ERC165Call(::evm_coder::ERC165Call::SupportsInterface {interface_id}) => {912 #call_name::ERC165Call(::evm_coder::ERC165Call::SupportsInterface {interface_id}, _) => {764 let mut writer = ::evm_coder::abi::AbiWriter::default();913 let mut writer = ::evm_coder::abi::AbiWriter::default();765 writer.bool(&InternalCall::supports_interface(interface_id));914 writer.bool(&<#call_name #gen_ref>::supports_interface(interface_id));766 return Ok(writer);915 return Ok(writer.into());767 }916 }768 _ => {},917 _ => {},769 }918 }774 )*923 )*775 _ => unreachable!()924 _ => unreachable!()776 }925 }777 Ok(writer)778 }926 }779 }927 }780 }928 }crates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth183 use evm_coder::solidity::*;183 use evm_coder::solidity::*;184 use core::fmt::Write;184 use core::fmt::Write;185 let interface = SolidityInterface {185 let interface = SolidityInterface {186 selector: 0,186 name: #solidity_name,187 name: #solidity_name,187 is: &[],188 is: &[],188 functions: (#(189 functions: (#(crates/evm-coder/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "evm-coder"2name = "evm-coder"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies]6[dependencies]7evm-coder-macros = { path = "../evm-coder-macros" }7evm-coder-macros = { path = "../evm-coder-macros" }8primitive-types = { version = "0.10.1", default-features = false }8primitive-types = { version = "0.10.1", default-features = false }9hex-literal = "0.3.3"9hex-literal = "0.3.3"10ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }10ethereum = { version = "0.10.0", default-features = false }11evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm.git", branch="precompile-output-parachain" }11evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm.git", branch = "unique-weights" }12impl-trait-for-tuples = "0.2.1"12impl-trait-for-tuples = "0.2.1"131314[dev-dependencies]14[dev-dependencies]crates/evm-coder/src/abi.rsdiffbeforeafterboth12use primitive_types::{H160, U256};12use primitive_types::{H160, U256};131314use crate::{execution::Error, types::string};14use crate::{15 execution::{Error, ResultWithPostInfo, WithPostDispatchInfo},16 types::string,17};15use crate::execution::Result;18use crate::execution::Result;1619244}247}245248246impl_abi_readable!(u32, uint32);249impl_abi_readable!(u32, uint32);250impl_abi_readable!(u64, uint64);247impl_abi_readable!(u128, uint128);251impl_abi_readable!(u128, uint128);248impl_abi_readable!(U256, uint256);252impl_abi_readable!(U256, uint256);249impl_abi_readable!(H160, address);253impl_abi_readable!(H160, address);306310307pub trait AbiWrite {311pub trait AbiWrite {308 fn abi_write(&self, writer: &mut AbiWriter);312 fn abi_write(&self, writer: &mut AbiWriter);313 fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {314 let mut writer = AbiWriter::new();315 self.abi_write(&mut writer);316 Ok(writer.into())317 }309}318}319320impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {321 // this particular AbiWrite implementation should be split to another trait,322 // which only implements [`to_result`]323 //324 // But due to lack of specialization feature in stable Rust, we can't have325 // blanket impl of this trait `for T where T: AbiWrite`, so here we abusing326 // default trait methods for it327 fn abi_write(&self, _writer: &mut AbiWriter) {328 debug_assert!(false, "shouldn't be called, see comment")329 }330 fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {331 match self {332 Ok(v) => Ok(WithPostDispatchInfo {333 post_info: v.post_info.clone(),334 data: {335 let mut out = AbiWriter::new();336 v.data.abi_write(&mut out);337 out338 },339 }),340 Err(e) => Err(e.clone()),341 }342 }343}310344311macro_rules! impl_abi_writeable {345macro_rules! impl_abi_writeable {312 ($ty:ty, $method:ident) => {346 ($ty:ty, $method:ident) => {crates/evm-coder/src/execution.rsdiffbeforeafterboth4#[cfg(feature = "std")]4#[cfg(feature = "std")]5use std::string::{String, ToString};5use std::string::{String, ToString};67use crate::Weight;687#[derive(Debug)]9#[derive(Debug, Clone)]8pub enum Error {10pub enum Error {9 Revert(String),11 Revert(String),10 Fatal(ExitFatal),12 Fatal(ExitFatal),222423pub type Result<T> = core::result::Result<T, Error>;25pub type Result<T> = core::result::Result<T, Error>;2627pub struct DispatchInfo {28 pub weight: Weight,29}3031impl From<Weight> for DispatchInfo {32 fn from(weight: Weight) -> Self {33 Self { weight }34 }35}36impl From<()> for DispatchInfo {37 fn from(_: ()) -> Self {38 Self { weight: 0 }39 }40}4142#[derive(Default, Clone)]43pub struct PostDispatchInfo {44 actual_weight: Option<Weight>,45}4647impl PostDispatchInfo {48 pub fn calc_unspent(&self, info: &DispatchInfo) -> Weight {49 info.weight - self.calc_actual_weight(info)50 }5152 pub fn calc_actual_weight(&self, info: &DispatchInfo) -> Weight {53 if let Some(actual_weight) = self.actual_weight {54 actual_weight.min(info.weight)55 } else {56 info.weight57 }58 }59}6061#[derive(Clone)]62pub struct WithPostDispatchInfo<T> {63 pub data: T,64 pub post_info: PostDispatchInfo,65}6667impl<T> From<T> for WithPostDispatchInfo<T> {68 fn from(data: T) -> Self {69 Self {70 data,71 post_info: Default::default(),72 }73 }74}7576pub type ResultWithPostInfo<T> =77 core::result::Result<WithPostDispatchInfo<T>, WithPostDispatchInfo<Error>>;2478crates/evm-coder/src/lib.rsdiffbeforeafterboth3extern crate alloc;3extern crate alloc;445use abi::{AbiRead, AbiReader, AbiWriter};5use abi::{AbiRead, AbiReader, AbiWriter};6pub use evm_coder_macros::{event_topic, fn_selector, solidity_interface, solidity, ToLog};6pub use evm_coder_macros::{event_topic, fn_selector, solidity_interface, solidity, weight, ToLog};7pub mod abi;7pub mod abi;8pub mod events;8pub mod events;9pub use events::ToLog;9pub use events::ToLog;10use execution::DispatchInfo;10pub mod execution;11pub mod execution;11pub mod solidity;12pub mod solidity;121357 fn parse(selector: u32, input: &mut AbiReader) -> execution::Result<Option<Self>>;58 fn parse(selector: u32, input: &mut AbiReader) -> execution::Result<Option<Self>>;58}59}6061pub type Weight = u64;6263pub trait Weighted: Call {64 fn weight(&self) -> DispatchInfo;65}596660pub trait Callable<C: Call> {67pub trait Callable<C: Call> {61 fn call(&mut self, call: types::Msg<C>) -> execution::Result<AbiWriter>;68 fn call(&mut self, call: types::Msg<C>) -> execution::ResultWithPostInfo<AbiWriter>;62}69}637064/// Implementation is implicitly provided for all interfaces71/// Implementation is implicitly provided for all interfaces84 }91 }85}92}869394/// Generate "tests", which will generate solidity code on execution and print it to stdout95/// Script at .maintain/scripts/generate_api.sh can split this output from test runtime96///97/// This macro receives type usage as second argument, but you can use anything as generics,98/// because no bounds are implied87#[macro_export]99#[macro_export]88macro_rules! generate_stubgen {100macro_rules! generate_stubgen {89 ($name:ident, $decl:ident, $is_impl:literal) => {101 ($name:ident, $decl:ty, $is_impl:literal) => {90 #[test]102 #[test]91 #[ignore]103 #[ignore]92 fn $name() {104 fn $name() {93 use evm_coder::solidity::TypeCollector;105 use evm_coder::solidity::TypeCollector;94 let mut out = TypeCollector::new();106 let mut out = TypeCollector::new();95 $decl::generate_solidity_interface(&mut out, $is_impl);107 <$decl>::generate_solidity_interface(&mut out, $is_impl);96 println!("=== SNIP START ===");108 println!("=== SNIP START ===");97 println!("// SPDX-License-Identifier: OTHER");109 println!("// SPDX-License-Identifier: OTHER");98 println!("// This code is automatically generated");110 println!("// This code is automatically generated");crates/evm-coder/src/solidity.rsdiffbeforeafterboth84solidity_type_name! {84solidity_type_name! {85 uint8 => "uint8" true = "0",85 uint8 => "uint8" true = "0",86 uint32 => "uint32" true = "0",86 uint32 => "uint32" true = "0",87 uint64 => "uint64" true = "0",87 uint128 => "uint128" true = "0",88 uint128 => "uint128" true = "0",88 uint256 => "uint256" true = "0",89 uint256 => "uint256" true = "0",89 address => "address" true = "0x0000000000000000000000000000000000000000",90 address => "address" true = "0x0000000000000000000000000000000000000000",376 Mutable,377 Mutable,377}378}378pub struct SolidityFunction<A, R> {379pub struct SolidityFunction<A, R> {380 pub docs: &'static [&'static str],379 pub selector: &'static str,381 pub selector: &'static str,380 pub name: &'static str,382 pub name: &'static str,381 pub args: A,383 pub args: A,389 writer: &mut impl fmt::Write,391 writer: &mut impl fmt::Write,390 tc: &TypeCollector,392 tc: &TypeCollector,391 ) -> fmt::Result {393 ) -> fmt::Result {394 for doc in self.docs {395 writeln!(writer, "\t//{}", doc)?;396 }397 if !self.docs.is_empty() {398 writeln!(writer, "\t//")?;399 }392 writeln!(writer, "\t// Selector: {}", self.selector)?;400 writeln!(writer, "\t// Selector: {}", self.selector)?;393 write!(writer, "\tfunction {}(", self.name)?;401 write!(writer, "\tfunction {}(", self.name)?;394 self.args.solidity_name(writer, tc)?;402 self.args.solidity_name(writer, tc)?;449}457}450458451pub struct SolidityInterface<F: SolidityFunctions> {459pub struct SolidityInterface<F: SolidityFunctions> {460 pub selector: u32,452 pub name: &'static str,461 pub name: &'static str,453 pub is: &'static [&'static str],462 pub is: &'static [&'static str],454 pub functions: F,463 pub functions: F,461 out: &mut impl fmt::Write,470 out: &mut impl fmt::Write,462 tc: &TypeCollector,471 tc: &TypeCollector,463 ) -> fmt::Result {472 ) -> fmt::Result {473 if self.selector != 0 {474 writeln!(out, "// Selector: {:0>8x}", self.selector)?;475 }464 if is_impl {476 if is_impl {465 write!(out, "contract ")?;477 write!(out, "contract ")?;466 } else {478 } else {crates/evm-coder/tests/a.rsdiffbeforeafterbothno changes
crates/evm-coder/tests/generics.rsdiffbeforeafterbothno changes
crates/evm-coder/tests/log.rsdiffbeforeafterbothno changes
crates/evm-coder/tests/random.rsdiffbeforeafterbothno changes
crates/evm-coder/tests/solidity_generation.rsdiffbeforeafterbothno changes
launch-config-westend.jsondiffbeforeafterbothno changes
launch-config.jsondiffbeforeafterboth57 {57 {58 "bin": "../unique-chain/target/release/unique-collator",58 "bin": "../unique-chain/target/release/unique-collator",59 "id": "2000",59 "id": "2000",60 "balance": "1000000000000000000000",60 "balance": "1000000000000000000000000",61 "nodes": [61 "nodes": [62 {62 {63 "port": 31200,63 "port": 31200,node/cli/Cargo.tomldiffbeforeafterboth268jsonrpc-core = '18.0.0'268jsonrpc-core = '18.0.0'269jsonrpc-pubsub = "18.0.0"269jsonrpc-pubsub = "18.0.0"270270271fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }271fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }272fc-consensus = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }272fc-consensus = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }273fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }273fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }274fc-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }274fc-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }275fc-db = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }275fc-db = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }276fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }276fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }277pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }277pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }278278279unique-rpc = { path = "../rpc" }279unique-rpc = { path = "../rpc" }280280node/cli/src/chain_spec.rsdiffbeforeafterboth535354pub fn development_config(id: ParaId) -> ChainSpec {54pub fn development_config(id: ParaId) -> ChainSpec {55 let mut properties = Map::new();55 let mut properties = Map::new();56 properties.insert("tokenSymbol".into(), "testUNQ".into());56 properties.insert("tokenSymbol".into(), "OPL".into());57 properties.insert("tokenDecimals".into(), 15.into());57 properties.insert("tokenDecimals".into(), 15.into());58 properties.insert("ss58Format".into(), 42.into()); // Generic Substrate wildcard (SS58 checksum preimage)58 properties.insert("ss58Format".into(), 42.into());595960 ChainSpec::from_genesis(60 ChainSpec::from_genesis(61 // Name61 // Name95 )95 )96}96}979798pub fn local_testnet_config(id: ParaId) -> ChainSpec {98pub fn local_testnet_rococo_config(id: ParaId) -> ChainSpec {99 ChainSpec::from_genesis(99 ChainSpec::from_genesis(100 // Name100 // Name101 "Local Testnet",101 "Local Testnet",144 )144 )145}145}146147pub fn local_testnet_westend_config(id: ParaId) -> ChainSpec {148 ChainSpec::from_genesis(149 // Name150 "Local Testnet",151 // ID152 "local_testnet",153 ChainType::Local,154 move || {155 testnet_genesis(156 // Sudo account157 get_account_id_from_seed::<sr25519::Public>("Alice"),158 vec![159 get_from_seed::<AuraId>("Alice"),160 get_from_seed::<AuraId>("Bob"),161 get_from_seed::<AuraId>("Charlie"),162 get_from_seed::<AuraId>("Dave"),163 get_from_seed::<AuraId>("Eve"),164 ],165 // Pre-funded accounts166 vec![167 get_account_id_from_seed::<sr25519::Public>("Alice"),168 get_account_id_from_seed::<sr25519::Public>("Bob"),169 get_account_id_from_seed::<sr25519::Public>("Charlie"),170 get_account_id_from_seed::<sr25519::Public>("Dave"),171 get_account_id_from_seed::<sr25519::Public>("Eve"),172 get_account_id_from_seed::<sr25519::Public>("Ferdie"),173 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),174 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),175 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),176 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),177 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),178 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),179 ],180 id,181 )182 },183 // Bootnodes184 vec![],185 // Telemetry186 None,187 // Protocol ID188 None,189 // Properties190 None,191 // Extensions192 Extensions {193 relay_chain: "westend-local".into(),194 para_id: id.into(),195 },196 )197}146198147fn testnet_genesis(199fn testnet_genesis(148 root_key: AccountId,200 root_key: AccountId,161 balances: endowed_accounts213 balances: endowed_accounts162 .iter()214 .iter()163 .cloned()215 .cloned()216 // 1e13 UNQ164 .map(|k| (k, 1 << 70))217 .map(|k| (k, 1 << 100))165 .collect(),218 .collect(),166 },219 },167 treasury: Default::default(),220 treasury: Default::default(),node/cli/src/command.rsdiffbeforeafterboth42 para_id: ParaId,42 para_id: ParaId,43) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {43) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {44 Ok(match id {44 Ok(match id {45 "westend-local" => Box::new(chain_spec::local_testnet_westend_config(para_id)),45 "dev" => Box::new(chain_spec::development_config(para_id)),46 "dev" => Box::new(chain_spec::development_config(para_id)),46 "" | "local" => Box::new(chain_spec::local_testnet_config(para_id)),47 "" | "local" => Box::new(chain_spec::local_testnet_rococo_config(para_id)),47 path => Box::new(chain_spec::ChainSpec::from_json_file(48 path => Box::new(chain_spec::ChainSpec::from_json_file(48 std::path::PathBuf::from(path),49 std::path::PathBuf::from(path),49 )?),50 )?),84 }85 }858686 fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {87 fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {87 load_spec(id, self.run.parachain_id.unwrap_or(200).into())88 load_spec(id, self.run.parachain_id.unwrap_or(2000).into())88 }89 }899090 fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {91 fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {217218218 let block: Block = generate_genesis_block(&load_spec(219 let block: Block = generate_genesis_block(&load_spec(219 ¶ms.chain.clone().unwrap_or_default(),220 ¶ms.chain.clone().unwrap_or_default(),220 params.parachain_id.unwrap_or(200).into(),221 params.parachain_id.unwrap_or(2000).into(),221 )?)?;222 )?)?;222 let raw_header = block.header().encode();223 let raw_header = block.header().encode();223 let output_buf = if params.raw {224 let output_buf = if params.raw {280 .chain(cli.relaychain_args.iter()),281 .chain(cli.relaychain_args.iter()),281 );282 );282283283 let id = ParaId::from(cli.run.parachain_id.or(para_id).unwrap_or(200));284 let id = ParaId::from(cli.run.parachain_id.or(para_id).unwrap_or(2000));284285285 let parachain_account =286 let parachain_account =286 AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);287 AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);node/rpc/Cargo.tomldiffbeforeafterboth3version = "0.1.0"3version = "0.1.0"4authors = ['Unique Network <support@uniquenetwork.io>']4authors = ['Unique Network <support@uniquenetwork.io>']5license = 'All Rights Reserved'5license = 'All Rights Reserved'6edition = "2018"6edition = "2021"7description = "Unique chain rpc"7description = "Unique chain rpc"889[package.metadata.docs.rs]9[package.metadata.docs.rs]41substrate-frame-rpc-system = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }41substrate-frame-rpc-system = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }42tokio = { version = "0.2.25", features = ["macros", "sync"] }42tokio = { version = "0.2.25", features = ["macros", "sync"] }434344pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }44pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }45fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }45fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }46fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }46fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }47fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }47fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }48fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }48fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }49fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }49fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }505051pallet-unique = { path = "../../pallets/unique" }51pallet-unique = { path = "../../pallets/unique" }52uc-rpc = { path = "../../client/rpc" }52uc-rpc = { path = "../../client/rpc" }node/rpc/src/lib.rsdiffbeforeafterboth214 500_usize, // max stored filters214 500_usize, // max stored filters215 overrides.clone(),215 overrides.clone(),216 max_past_logs,216 max_past_logs,217 block_data_cache.clone(),217 block_data_cache,218 )));218 )));219 }219 }220220pallets/common/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-common"2name = "pallet-common"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies.codec]6[dependencies.codec]7default-features = false7default-features = false19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }20pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }20pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }21evm-coder = { default-features = false, path = '../../crates/evm-coder' }21evm-coder = { default-features = false, path = '../../crates/evm-coder' }22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }23serde = { version = "1.0.130", default-features = false }23serde = { version = "1.0.130", default-features = false }24scale-info = { version = "1.0.0", default-features = false, features = [24scale-info = { version = "1.0.0", default-features = false, features = [25 "derive",25 "derive",pallets/common/src/benchmarking.rsdiffbeforeafterboth54 variable_on_chain_schema,54 variable_on_chain_schema,55 const_on_chain_schema,55 const_on_chain_schema,56 meta_update_permission: Default::default(),56 meta_update_permission: Default::default(),57 transfers_enabled: true,58 })57 })59 .and_then(CollectionHandle::try_get)58 .and_then(CollectionHandle::try_get)60 .map(cast)59 .map(cast)pallets/common/src/erc.rsdiffbeforeafterboth1pub use pallet_evm::PrecompileOutput;1pub use pallet_evm::PrecompileOutput;2pub use pallet_evm::PrecompileResult;2use sp_core::{H160, U256};3use sp_core::{H160, U256};344/// Does not always represent a full collection, for RFT it is either5/// Does not always represent a full collection, for RFT it is either5/// collection (Implementing ERC721), or specific collection token (Implementing ERC20)6/// collection (Implementing ERC721), or specific collection token (Implementing ERC20)6pub trait CommonEvmHandler {7pub trait CommonEvmHandler {7 const CODE: &'static [u8];8 const CODE: &'static [u8];899 fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput>;10 fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;10}11}1112pallets/common/src/lib.rsdiffbeforeafterboth1#![cfg_attr(not(feature = "std"), no_std)]1#![cfg_attr(not(feature = "std"), no_std)]223use core::ops::{Deref, DerefMut};3use core::ops::{Deref, DerefMut};4use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};4use sp_std::vec::Vec;5use sp_std::vec::Vec;5use account::CrossAccountId;6use account::CrossAccountId;6use frame_support::{7use frame_support::{7 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo},8 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo},8 ensure, fail,9 ensure, fail,9 traits::{Imbalance, Get, Currency},10 traits::{Imbalance, Get, Currency},10};11};12use pallet_evm::GasWeightMapping;11use up_data_structs::{13use up_data_structs::{12 COLLECTION_NUMBER_LIMIT, Collection, CollectionId, CreateItemData, ExistenceRequirement,14 COLLECTION_NUMBER_LIMIT, Collection, CollectionId, CreateItemData, ExistenceRequirement,13 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,15 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,27pub struct CollectionHandle<T: Config> {29pub struct CollectionHandle<T: Config> {28 pub id: CollectionId,30 pub id: CollectionId,29 collection: Collection<T::AccountId>,31 collection: Collection<T::AccountId>,30 pub recorder: pallet_evm_coder_substrate::SubstrateRecorder<T>,32 pub recorder: SubstrateRecorder<T>,31}33}34impl<T: Config> WithRecorder<T> for CollectionHandle<T> {35 fn recorder(&self) -> &SubstrateRecorder<T> {36 &self.recorder37 }38 fn into_recorder(self) -> SubstrateRecorder<T> {39 self.recorder40 }41}32impl<T: Config> CollectionHandle<T> {42impl<T: Config> CollectionHandle<T> {33 pub fn new_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {43 pub fn new_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {34 <CollectionById<T>>::get(id).map(|collection| Self {44 <CollectionById<T>>::get(id).map(|collection| Self {35 id,45 id,36 collection,46 collection,37 recorder: pallet_evm_coder_substrate::SubstrateRecorder::new(47 recorder: SubstrateRecorder::new(eth::collection_id_to_address(id), gas_limit),38 eth::collection_id_to_address(id),39 gas_limit,40 ),44 Self::new_with_gas_limit(id, u64::MAX)51 Self::new_with_gas_limit(id, u64::MAX)45 }52 }46 pub fn try_get(id: CollectionId) -> Result<Self, DispatchError> {53 pub fn try_get(id: CollectionId) -> Result<Self, DispatchError> {47 Ok(Self::new(id).ok_or_else(|| <Error<T>>::CollectionNotFound)?)54 Ok(Self::new(id).ok_or(<Error<T>>::CollectionNotFound)?)48 }55 }49 pub fn log(&self, log: impl evm_coder::ToLog) -> DispatchResult {56 pub fn log(&self, log: impl evm_coder::ToLog) {50 self.recorder.log_sub(log)57 self.recorder.log(log)51 }58 }52 pub fn log_infallible(&self, log: impl evm_coder::ToLog) {59 pub fn consume_store_reads(&self, reads: u64) -> evm_coder::execution::Result<()> {53 self.recorder.log_infallible(log)54 }55 #[allow(dead_code)]56 fn consume_gas(&self, gas: u64) -> DispatchResult {57 self.recorder.consume_gas_sub(gas)58 }59 pub fn consume_sload(&self) -> DispatchResult {60 self.recorder.consume_sload_sub()60 self.recorder61 .consume_gas(T::GasWeightMapping::weight_to_gas(62 <T as frame_system::Config>::DbWeight::get()63 .read64 .saturating_mul(reads),65 ))61 }66 }62 pub fn consume_sstores(&self, amount: usize) -> DispatchResult {67 pub fn consume_store_writes(&self, writes: u64) -> evm_coder::execution::Result<()> {63 self.recorder.consume_sstores_sub(amount)64 }65 pub fn consume_sstore(&self) -> DispatchResult {66 self.recorder.consume_sstore_sub()67 }68 pub fn consume_log(&self, topics: usize, data: usize) -> DispatchResult {69 self.recorder.consume_log_sub(topics, data)68 self.recorder69 .consume_gas(T::GasWeightMapping::weight_to_gas(70 <T as frame_system::Config>::DbWeight::get()71 .write72 .saturating_mul(writes),73 ))70 }74 }71 pub fn submit_logs(self) -> DispatchResult {75 pub fn submit_logs(self) {72 self.recorder.submit_logs()76 self.recorder.submit_logs()73 }77 }74 pub fn save(self) -> DispatchResult {78 pub fn save(self) -> DispatchResult {75 self.recorder.submit_logs()?;79 self.recorder.submit_logs();76 <CollectionById<T>>::insert(self.id, self.collection);80 <CollectionById<T>>::insert(self.id, self.collection);77 Ok(())81 Ok(())78 }82 }96 ensure!(*subject.as_sub() == self.owner, <Error<T>>::NoPermission);100 ensure!(*subject.as_sub() == self.owner, <Error<T>>::NoPermission);97 Ok(())101 Ok(())98 }102 }99 pub fn is_owner_or_admin(&self, subject: &T::CrossAccountId) -> Result<bool, DispatchError> {103 pub fn is_owner_or_admin(&self, subject: &T::CrossAccountId) -> bool {100 self.consume_sload()?;101102 Ok(*subject.as_sub() == self.owner || <IsAdmin<T>>::get((self.id, subject)))104 *subject.as_sub() == self.owner || <IsAdmin<T>>::get((self.id, subject))103 }105 }104 pub fn check_is_owner_or_admin(&self, subject: &T::CrossAccountId) -> DispatchResult {106 pub fn check_is_owner_or_admin(&self, subject: &T::CrossAccountId) -> DispatchResult {105 ensure!(self.is_owner_or_admin(subject)?, <Error<T>>::NoPermission);107 ensure!(self.is_owner_or_admin(subject), <Error<T>>::NoPermission);106 Ok(())108 Ok(())107 }109 }108 pub fn ignores_allowance(&self, user: &T::CrossAccountId) -> Result<bool, DispatchError> {110 pub fn ignores_allowance(&self, user: &T::CrossAccountId) -> bool {109 Ok(self.limits.owner_can_transfer() && self.is_owner_or_admin(user)?)111 self.limits.owner_can_transfer() && self.is_owner_or_admin(user)110 }112 }111 pub fn ignores_owned_amount(&self, user: &T::CrossAccountId) -> Result<bool, DispatchError> {113 pub fn ignores_owned_amount(&self, user: &T::CrossAccountId) -> bool {112 Ok(self.limits.owner_can_transfer() && self.is_owner_or_admin(user)?)114 self.limits.owner_can_transfer() && self.is_owner_or_admin(user)113 }115 }114 pub fn check_allowlist(&self, user: &T::CrossAccountId) -> DispatchResult {116 pub fn check_allowlist(&self, user: &T::CrossAccountId) -> DispatchResult {115 self.consume_sload()?;116117 ensure!(117 ensure!(118 <Allowlist<T>>::get((self.id, user)),118 <Allowlist<T>>::get((self.id, user)),187 /// * account_id: Collection owner.187 /// * account_id: Collection owner.188 CollectionCreated(CollectionId, u8, T::AccountId),188 CollectionCreated(CollectionId, u8, T::AccountId),189190 /// New collection was destroyed191 ///192 /// # Arguments193 ///194 /// * collection_id: Globally unique identifier of collection.195 CollectionDestroyed(CollectionId),189196190 /// New item was created.197 /// New item was created.191 ///198 ///410417411 // bound Total number of collections418 // bound Total number of collections412 ensure!(419 ensure!(413 created_count - destroyed_count < COLLECTION_NUMBER_LIMIT,420 created_count - destroyed_count <= COLLECTION_NUMBER_LIMIT,414 <Error<T>>::TotalCollectionsLimitExceeded421 <Error<T>>::TotalCollectionsLimitExceeded415 );422 );416423453 collection.limits.owner_can_destroy(),460 collection.limits.owner_can_destroy(),454 <Error<T>>::NoPermission,461 <Error<T>>::NoPermission,455 );462 );456 collection.check_is_owner(&sender)?;463 collection.check_is_owner(sender)?;457464458 let destroyed_collections = <DestroyedCollectionCount<T>>::get()465 let destroyed_collections = <DestroyedCollectionCount<T>>::get()459 .0466 .0468 <IsAdmin<T>>::remove_prefix((collection.id,), None);475 <IsAdmin<T>>::remove_prefix((collection.id,), None);469 <Allowlist<T>>::remove_prefix((collection.id,), None);476 <Allowlist<T>>::remove_prefix((collection.id,), None);477478 <Pallet<T>>::deposit_event(Event::CollectionDestroyed(collection.id));470 Ok(())479 Ok(())471 }480 }472481476 user: &T::CrossAccountId,485 user: &T::CrossAccountId,477 allowed: bool,486 allowed: bool,478 ) -> DispatchResult {487 ) -> DispatchResult {479 collection.check_is_owner_or_admin(&sender)?;488 collection.check_is_owner_or_admin(sender)?;480489481 // =========490 // =========482491495 user: &T::CrossAccountId,504 user: &T::CrossAccountId,496 admin: bool,505 admin: bool,497 ) -> DispatchResult {506 ) -> DispatchResult {498 collection.check_is_owner_or_admin(&sender)?;507 collection.check_is_owner_or_admin(sender)?;499508500 let was_admin = <IsAdmin<T>>::get((collection.id, user));509 let was_admin = <IsAdmin<T>>::get((collection.id, user));501 if was_admin == admin {510 if was_admin == admin {pallets/contract-helpers/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-contract-helpers"2name = "pallet-contract-helpers"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies.codec]6[dependencies.codec]7default-features = false7default-features = falsepallets/evm-coder-substrate/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-evm-coder-substrate"2name = "pallet-evm-coder-substrate"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies]6[dependencies]7scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }7scale-info = { version = "1.0.0", default-features = false, features = [8 "derive",9] }8sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }10sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }9sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }11sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }10ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }12ethereum = { version = "0.10.0", default-features = false }11evm-coder = { default-features = false, path = "../../crates/evm-coder" }13evm-coder = { default-features = false, path = "../../crates/evm-coder" }12pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }14pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }13pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }15pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }14frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }16frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }15frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }17frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }18frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }161917[dependencies.codec]20[dependencies.codec]18default-features = false21default-features = false31 "pallet-evm/std",34 "pallet-evm/std",32 "frame-support/std",35 "frame-support/std",33 "frame-system/std",36 "frame-system/std",37 'frame-benchmarking/std',34]38]39runtime-benchmarks = ['frame-benchmarking']3540pallets/evm-coder-substrate/src/benchmarking.rsdiffbeforeafterbothno changes
pallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth223#[cfg(not(feature = "std"))]3#[cfg(not(feature = "std"))]4extern crate alloc;4extern crate alloc;5// #[cfg(feature = "runtime-benchmarks")]6// pub mod benchmarking;576pub use pallet::*;8pub use pallet::*;7917 types::{Msg, value},19 types::{Msg, value},18 };20 };19 use frame_support::{ensure};21 use frame_support::{ensure};20 use pallet_evm::{ExitError, ExitReason, ExitRevert, ExitSucceed, PrecompileOutput};22 use pallet_evm::{23 ExitError, ExitRevert, ExitSucceed, GasWeightMapping, PrecompileFailure, PrecompileOutput,24 PrecompileResult,25 };26 use frame_system::ensure_signed;21 pub use frame_support::dispatch::DispatchResult;27 pub use frame_support::dispatch::DispatchResult;22 use pallet_ethereum::EthereumTransactionSender;28 use pallet_ethereum::EthereumTransactionSender;23 use sp_std::cell::RefCell;29 use sp_std::cell::RefCell;24 use sp_std::vec::Vec;30 use sp_std::vec::Vec;25 use sp_core::{H160, H256};31 use sp_core::{H160, H256};26 use ethereum::Log;32 use ethereum::Log;27 use frame_support::{pallet_prelude::*, traits::PalletInfo};33 use frame_support::{pallet_prelude::*, traits::PalletInfo};34 use frame_system::pallet_prelude::*;283529 /// DispatchError is opaque, but we need to somehow extract correct error in case of OutOfGas failure36 /// DispatchError is opaque, but we need to somehow extract correct error in case of OutOfGas failure30 /// So we have this pallet, which defines OutOfGas error, and knews its own id to check if DispatchError37 /// So we have this pallet, which defines OutOfGas error, and knews its own id to check if DispatchError40 #[pallet::config]47 #[pallet::config]41 pub trait Config: frame_system::Config {48 pub trait Config: frame_system::Config {42 type EthereumTransactionSender: pallet_ethereum::EthereumTransactionSender;49 type EthereumTransactionSender: pallet_ethereum::EthereumTransactionSender;50 type GasWeightMapping: pallet_evm::GasWeightMapping;43 }51 }445245 #[pallet::pallet]53 #[pallet::pallet]46 pub struct Pallet<T>(_);54 pub struct Pallet<T>(_);475548 // FIXME: those items are defined as private in evm_gasometer::consts, and we can't directly use it56 #[pallet::call]49 pub const G_LOG: u64 = 375;50 pub const G_LOGDATA: u64 = 8;57 impl<T: Config> Pallet<T> {58 #[pallet::weight(0)]51 pub const G_LOGTOPIC: u64 = 375;59 pub fn empty_call(origin: OriginFor<T>) -> DispatchResult {60 let _sender = ensure_signed(origin)?;61 Ok(())62 }63 }526453 // From instabul hardfork configuration: https://github.com/rust-blockchain/evm/blob/fd4fd6acc0ca3208d6770fdb3ba407c94cdf97c6/runtime/src/lib.rs#L28465 // From instabul hardfork configuration: https://github.com/rust-blockchain/evm/blob/fd4fd6acc0ca3208d6770fdb3ba407c94cdf97c6/runtime/src/lib.rs#L28454 pub const G_SLOAD_WORD: u64 = 800;66 pub const G_SLOAD_WORD: u64 = 800;55 pub const G_SSTORE_WORD: u64 = 20000;67 pub const G_SSTORE_WORD: u64 = 20000;5657 fn log_price(data: usize, topics: usize) -> u64 {58 G_LOG59 .saturating_add((data as u64).saturating_mul(G_LOGDATA))60 .saturating_add((topics as u64).saturating_mul(G_LOGTOPIC))61 }626863 pub fn generate_transaction() -> ethereum::TransactionV0 {69 pub fn generate_transaction() -> ethereum::TransactionV0 {64 use ethereum::{TransactionV0, TransactionAction, TransactionSignature};70 use ethereum::{TransactionV0, TransactionAction, TransactionSignature};98 pub fn is_empty(&self) -> bool {104 pub fn is_empty(&self) -> bool {99 self.logs.borrow().is_empty()105 self.logs.borrow().is_empty()100 }106 }101 pub fn log_sub(&self, log: impl ToLog) -> DispatchResult {107 // TODO: Replace with real storage in pallet-ethereum,102 self.log_raw_sub(log.to_log(self.contract))108 // same way as it is done with frame_system's Events103 }104 pub fn log_raw_sub(&self, log: Log) -> DispatchResult {105 self.consume_gas_sub(log_price(log.data.len(), log.topics.len()))?;106 self.logs.borrow_mut().push(log);107 Ok(())108 }109 /// Doesn't consumes any gas, should be used after consume_log_sub109 /// Doesn't consumes any gas, should be used after consume_log_sub110 pub fn log_infallible(&self, log: impl ToLog) {110 pub fn log(&self, log: impl ToLog) {111 self.logs.borrow_mut().push(log.to_log(self.contract));111 self.logs.borrow_mut().push(log.to_log(self.contract));112 }112 }113 pub fn retrieve_logs(self) -> Vec<Log> {113 pub fn retrieve_logs(self) -> Vec<Log> {126 pub fn consume_sstore_sub(&self) -> DispatchResult {126 pub fn consume_sstore_sub(&self) -> DispatchResult {127 self.consume_gas_sub(G_SSTORE_WORD)127 self.consume_gas_sub(G_SSTORE_WORD)128 }128 }129 pub fn consume_log_sub(&self, topics: usize, data: usize) -> DispatchResult {130 self.consume_gas_sub(log_price(data, topics))131 }132 pub fn consume_gas_sub(&self, gas: u64) -> DispatchResult {129 pub fn consume_gas_sub(&self, gas: u64) -> DispatchResult {133 ensure!(gas != u64::MAX, Error::<T>::OutOfGas);130 ensure!(gas != u64::MAX, Error::<T>::OutOfGas);134 let mut gas_limit = self.gas_limit.borrow_mut();131 let mut gas_limit = self.gas_limit.borrow_mut();154 *gas_limit -= gas;151 *gas_limit -= gas;155 Ok(())152 Ok(())156 }153 }154 pub fn return_gas(&self, gas: u64) {155 let mut gas_limit = self.gas_limit.borrow_mut();156 *gas_limit += gas;157 }157158158 pub fn evm_to_precompile_output(159 pub fn evm_to_precompile_output(159 self,160 self,160 result: evm_coder::execution::Result<Option<AbiWriter>>,161 result: evm_coder::execution::Result<Option<AbiWriter>>,161 ) -> Option<PrecompileOutput> {162 ) -> Option<PrecompileResult> {162 use evm_coder::execution::Error;163 use evm_coder::execution::Error;163 let (writer, reason) = match result {164 Some(match result {164 Ok(Some(v)) => (v, ExitReason::Succeed(ExitSucceed::Returned)),165 Ok(Some(v)) => Ok(PrecompileOutput {166 exit_status: ExitSucceed::Returned,167 cost: self.initial_gas - self.gas_left(),168 logs: self.retrieve_logs(),169 output: v.finish(),170 }),165 Ok(None) => return None,171 Ok(None) => return None,166 Err(Error::Revert(e)) => {172 Err(Error::Revert(e)) => {167 let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));173 let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));168 (&e as &str).abi_write(&mut writer);174 (&e as &str).abi_write(&mut writer);169175170 (writer, ExitReason::Revert(ExitRevert::Reverted))176 Err(PrecompileFailure::Revert {177 exit_status: ExitRevert::Reverted,178 cost: self.initial_gas - self.gas_left(),179 output: writer.finish(),180 })171 }181 }172 Err(Error::Fatal(f)) => (AbiWriter::new(), ExitReason::Fatal(f)),182 Err(Error::Fatal(f)) => Err(f.into()),173 Err(Error::Error(e)) => (AbiWriter::new(), ExitReason::Error(e)),183 Err(Error::Error(e)) => Err(e.into()),174 };184 })175176 Some(PrecompileOutput {177 cost: self.initial_gas - self.gas_left(),178 exit_status: reason,179 logs: self.retrieve_logs(),180 output: writer.finish(),181 })182 }185 }183186184 pub fn submit_logs(self) -> DispatchResult {187 pub fn submit_logs(self) {185 let logs = self.retrieve_logs();188 let logs = self.retrieve_logs();186 if logs.is_empty() {189 if logs.is_empty() {187 return Ok(());190 return;188 }191 }189 T::EthereumTransactionSender::submit_logs_transaction(generate_transaction(), logs)192 T::EthereumTransactionSender::submit_logs_transaction(193 Default::default(),194 generate_transaction(),195 logs,196 )190 }197 }191 }198 }215 }222 }216 }223 }217224218 pub fn call_internal<C: evm_coder::Call, E: evm_coder::Callable<C>>(225 pub trait WithRecorder<T: Config> {226 fn recorder(&self) -> &SubstrateRecorder<T>;227 fn into_recorder(self) -> SubstrateRecorder<T>;228 }229230 /// Helper to simplify implementing bridge between evm-coder definitions and pallet-evm231 pub fn call<232 T: Config,233 C: evm_coder::Call + evm_coder::Weighted,234 E: evm_coder::Callable<C> + WithRecorder<T>,235 >(236 caller: H160,237 mut e: E,238 value: value,239 input: &[u8],240 ) -> Option<PrecompileResult> {241 let result = call_internal(caller, &mut e, value, input);242 e.into_recorder().evm_to_precompile_output(result)243 }244245 fn call_internal<246 T: Config,247 C: evm_coder::Call + evm_coder::Weighted,248 E: evm_coder::Callable<C> + WithRecorder<T>,249 >(219 caller: H160,250 caller: H160,220 e: &mut E,251 e: &mut E,228 }259 }229 let call = call.unwrap();260 let call = call.unwrap();261262 let dispatch_info = call.weight();263 e.recorder()264 .consume_gas(T::GasWeightMapping::weight_to_gas(dispatch_info.weight))?;265230 e.call(Msg {266 match e.call(Msg {231 call,267 call,232 caller,268 caller,233 value,269 value,234 })270 }) {271 Ok(v) => {272 let unspent = v.post_info.calc_unspent(&dispatch_info);273 e.recorder()235 .map(Some)274 .return_gas(T::GasWeightMapping::weight_to_gas(unspent));275 Ok(Some(v.data))276 }277 Err(v) => {278 let unspent = v.post_info.calc_unspent(&dispatch_info);279 e.recorder()280 .return_gas(T::GasWeightMapping::weight_to_gas(unspent));281 Err(v.data)282 }283 }236 }284 }237}285}238286pallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-evm-contract-helpers"2name = "pallet-evm-contract-helpers"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies]6[dependencies]7scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }7scale-info = { version = "1.0.0", default-features = false, features = [12sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }14sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }13evm-coder = { default-features = false, path = '../../crates/evm-coder' }15evm-coder = { default-features = false, path = '../../crates/evm-coder' }14pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }16pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }15pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }17pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }16up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" } 18up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }17log = "0.4.14"19log = "0.4.14"1820pallets/evm-contract-helpers/exp.rsdiffbeforeafterbothno changes
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth1use core::marker::PhantomData;1use core::marker::PhantomData;2use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};2use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};3use pallet_evm_coder_substrate::SubstrateRecorder;3use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};4use pallet_evm::{ExitReason, ExitRevert, OnCreate, OnMethodCall, PrecompileOutput};4use pallet_evm::{ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure};5use sp_core::H160;5use sp_core::H160;6use crate::{6use crate::{7 AllowlistEnabled, Config, Owner, Pallet, SelfSponsoring, SponsorBasket, SponsoringRateLimit,7 AllowlistEnabled, Config, Owner, Pallet, SelfSponsoring, SponsorBasket, SponsoringRateLimit,11use sp_std::{convert::TryInto, vec::Vec};11use sp_std::{convert::TryInto, vec::Vec};121213struct ContractHelpers<T: Config>(SubstrateRecorder<T>);13struct ContractHelpers<T: Config>(SubstrateRecorder<T>);14impl<T: Config> WithRecorder<T> for ContractHelpers<T> {15 fn recorder(&self) -> &SubstrateRecorder<T> {16 &self.017 }1819 fn into_recorder(self) -> SubstrateRecorder<T> {20 self.021 }22}142315#[solidity_interface(name = "ContractHelpers")]24#[solidity_interface(name = "ContractHelpers")]16impl<T: Config> ContractHelpers<T> {25impl<T: Config> ContractHelpers<T> {17 fn contract_owner(&self, contract_address: address) -> Result<address> {26 fn contract_owner(&self, contract_address: address) -> Result<address> {18 self.0.consume_sload()?;19 Ok(<Owner<T>>::get(contract_address))27 Ok(<Owner<T>>::get(contract_address))20 }28 }212922 fn sponsoring_enabled(&self, contract_address: address) -> Result<bool> {30 fn sponsoring_enabled(&self, contract_address: address) -> Result<bool> {23 self.0.consume_sload()?;24 Ok(<SelfSponsoring<T>>::get(contract_address))31 Ok(<SelfSponsoring<T>>::get(contract_address))25 }32 }263330 contract_address: address,37 contract_address: address,31 enabled: bool,38 enabled: bool,32 ) -> Result<void> {39 ) -> Result<void> {33 self.0.consume_sload()?;34 <Pallet<T>>::ensure_owner(contract_address, caller)?;40 <Pallet<T>>::ensure_owner(contract_address, caller)?;35 self.0.consume_sstore()?;36 <Pallet<T>>::toggle_sponsoring(contract_address, enabled);41 <Pallet<T>>::toggle_sponsoring(contract_address, enabled);37 Ok(())42 Ok(())38 }43 }43 contract_address: address,48 contract_address: address,44 rate_limit: uint32,49 rate_limit: uint32,45 ) -> Result<void> {50 ) -> Result<void> {46 self.0.consume_sload()?;47 <Pallet<T>>::ensure_owner(contract_address, caller)?;51 <Pallet<T>>::ensure_owner(contract_address, caller)?;48 self.0.consume_sstore()?;49 <Pallet<T>>::set_sponsoring_rate_limit(contract_address, rate_limit.into());52 <Pallet<T>>::set_sponsoring_rate_limit(contract_address, rate_limit.into());50 Ok(())53 Ok(())51 }54 }525553 fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {56 fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {54 self.0.consume_sload()?;55 Ok(<SponsoringRateLimit<T>>::get(contract_address)57 Ok(<SponsoringRateLimit<T>>::get(contract_address)56 .try_into()58 .try_into()57 .map_err(|_| "rate limit > u32::MAX")?)59 .map_err(|_| "rate limit > u32::MAX")?)64 }66 }656766 fn allowlist_enabled(&self, contract_address: address) -> Result<bool> {68 fn allowlist_enabled(&self, contract_address: address) -> Result<bool> {67 self.0.consume_sload()?;68 Ok(<AllowlistEnabled<T>>::get(contract_address))69 Ok(<AllowlistEnabled<T>>::get(contract_address))69 }70 }707174 contract_address: address,75 contract_address: address,75 enabled: bool,76 enabled: bool,76 ) -> Result<void> {77 ) -> Result<void> {77 self.0.consume_sload()?;78 <Pallet<T>>::ensure_owner(contract_address, caller)?;78 <Pallet<T>>::ensure_owner(contract_address, caller)?;79 self.0.consume_sstore()?;80 <Pallet<T>>::toggle_allowlist(contract_address, enabled);79 <Pallet<T>>::toggle_allowlist(contract_address, enabled);81 Ok(())80 Ok(())82 }81 }88 user: address,87 user: address,89 allowed: bool,88 allowed: bool,90 ) -> Result<void> {89 ) -> Result<void> {91 self.0.consume_sload()?;92 <Pallet<T>>::ensure_owner(contract_address, caller)?;90 <Pallet<T>>::ensure_owner(contract_address, caller)?;93 self.0.consume_sstore()?;94 <Pallet<T>>::toggle_allowed(contract_address, user, allowed);91 <Pallet<T>>::toggle_allowed(contract_address, user, allowed);95 Ok(())92 Ok(())96 }93 }112 gas_left: u64,109 gas_left: u64,113 input: &[u8],110 input: &[u8],114 value: sp_core::U256,111 value: sp_core::U256,115 ) -> Option<PrecompileOutput> {112 ) -> Option<PrecompileResult> {116 // TODO: Extract to another OnMethodCall handler113 // TODO: Extract to another OnMethodCall handler117 if <AllowlistEnabled<T>>::get(target) && !<Pallet<T>>::allowed(*target, *source) {114 if <AllowlistEnabled<T>>::get(target) && !<Pallet<T>>::allowed(*target, *source) {118 return Some(PrecompileOutput {115 return Some(Err(PrecompileFailure::Revert {119 exit_status: ExitReason::Revert(ExitRevert::Reverted),116 exit_status: ExitRevert::Reverted,120 cost: 0,117 cost: 0,121 output: {118 output: {122 let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));119 let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));123 writer.string("Target contract is allowlisted");120 writer.string("Target contract is allowlisted");124 writer.finish()121 writer.finish()125 },122 },126 logs: sp_std::vec![],127 });123 }));128 }124 }129125130 if target != &T::ContractAddress::get() {126 if target != &T::ContractAddress::get() {131 return None;127 return None;132 }128 }133129134 let mut helpers = ContractHelpers::<T>(SubstrateRecorder::<T>::new(*target, gas_left));130 let helpers = ContractHelpers::<T>(SubstrateRecorder::<T>::new(*target, gas_left));135 let result = pallet_evm_coder_substrate::call_internal(*source, &mut helpers, value, input);131 pallet_evm_coder_substrate::call(*source, helpers, value, input)136 helpers.0.evm_to_precompile_output(result)137 }132 }138133139 fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {134 fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {163 if let Some(last_tx_block) = <SponsorBasket<T>>::get(&call.0, who) {158 if let Some(last_tx_block) = <SponsorBasket<T>>::get(&call.0, who) {164 let limit = <SponsoringRateLimit<T>>::get(&call.0);159 let limit = <SponsoringRateLimit<T>>::get(&call.0);165160166 let timeout = last_tx_block + limit.into();161 let timeout = last_tx_block + limit;167 if block_number < timeout {162 if block_number < timeout {168 return None;163 return None;169 }164 }175 }170 }176}171}177172178generate_stubgen!(contract_helpers_impl, ContractHelpersCall, true);173generate_stubgen!(contract_helpers_impl, ContractHelpersCall<()>, true);179generate_stubgen!(contract_helpers_iface, ContractHelpersCall, false);174generate_stubgen!(contract_helpers_iface, ContractHelpersCall<()>, false);180175pallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth21 }21 }22}22}232324// Selector: 31acb1fe24contract ContractHelpers is Dummy, ERC165 {25contract ContractHelpers is Dummy, ERC165 {25 // Selector: contractOwner(address) 5152b14c26 // Selector: contractOwner(address) 5152b14c26 function contractOwner(address contractAddress)27 function contractOwner(address contractAddress)pallets/evm-migration/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-evm-migration"2name = "pallet-evm-migration"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies]6[dependencies]7scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }7scale-info = { version = "1.0.0", default-features = false, features = [12sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }14sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }13sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }15sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }14sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }16sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }15pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }17pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }16fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }18fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }171918[dependencies.codec]20[dependencies.codec]19default-features = false21default-features = falsepallets/evm-migration/src/lib.rsdiffbeforeafterboth98 _gas_left: u64,98 _gas_left: u64,99 _input: &[u8],99 _input: &[u8],100 _value: sp_core::U256,100 _value: sp_core::U256,101 ) -> Option<pallet_evm::PrecompileOutput> {101 ) -> Option<pallet_evm::PrecompileResult> {102 None102 None103 }103 }104104pallets/evm-migration/src/weights.rsdiffbeforeafterboth25#![cfg_attr(rustfmt, rustfmt_skip)]25#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]26#![allow(unused_parens)]27#![allow(unused_imports)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]282929use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use sp_std::marker::PhantomData;31use sp_std::marker::PhantomData;pallets/evm-transaction-payment/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-evm-transaction-payment"2name = "pallet-evm-transaction-payment"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies]6[dependencies]7scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }7scale-info = { version = "1.0.0", default-features = false, features = [11sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }13sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }12sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }14sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }13sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }15sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }14pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }16pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }15fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }17fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }16pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }18pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }17up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" } 19up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }18up-evm-mapping = { default-features = false, path = "../../primitives/evm-mapping" }20up-evm-mapping = { default-features = false, path = "../../primitives/evm-mapping" }1921pallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth128 let sponsor = frame_support::storage::with_transaction(|| {128 let sponsor = frame_support::storage::with_transaction(|| {129 TransactionOutcome::Rollback(T::EvmSponsorshipHandler::get_sponsor(129 TransactionOutcome::Rollback(T::EvmSponsorshipHandler::get_sponsor(130 &who,130 &who,131 &(target.clone(), input.clone()),131 &(*target, input.clone()),132 ))132 ))133 })?;133 })?;134 let sponsor = T::EvmAddressMapping::into_account_id(sponsor);134 let sponsor = T::EvmAddressMapping::into_account_id(sponsor);pallets/fungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-fungible"2name = "pallet-fungible"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies.codec]6[dependencies.codec]7default-features = false7default-features = false19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }22ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }22ethereum = { version = "0.10.0", default-features = false }23frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }23frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }24scale-info = { version = "1.0.0", default-features = false, features = [24scale-info = { version = "1.0.0", default-features = false, features = [25 "derive",25 "derive",pallets/fungible/src/benchmarking.rsdiffbeforeafterboth59 <Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;59 <Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;60 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100)?}60 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100)?}6162 burn_from {63 bench_init!{64 owner: sub; collection: collection(owner);65 owner: cross_from_sub; sender: cross_sub; burner: cross_sub;66 };67 <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;68 <Pallet<T>>::set_allowance(&collection, &sender, &burner, 200)?;69 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, 100)?}61}70}6271pallets/fungible/src/common.rsdiffbeforeafterboth37 }37 }383839 fn burn_from() -> Weight {39 fn burn_from() -> Weight {40 040 <SelfWeightOf<T>>::burn_from()41 }41 }424243 fn set_variable_metadata(_bytes: u32) -> Weight {43 fn set_variable_metadata(_bytes: u32) -> Weight {116 );116 );117117118 with_weight(118 with_weight(119 <Pallet<T>>::transfer(&self, &from, &to, amount),119 <Pallet<T>>::transfer(self, &from, &to, amount),120 <CommonWeights<T>>::transfer(),120 <CommonWeights<T>>::transfer(),121 )121 )122 }122 }134 );134 );135135136 with_weight(136 with_weight(137 <Pallet<T>>::set_allowance(&self, &sender, &spender, amount),137 <Pallet<T>>::set_allowance(self, &sender, &spender, amount),138 <CommonWeights<T>>::approve(),138 <CommonWeights<T>>::approve(),139 )139 )140 }140 }153 );153 );154154155 with_weight(155 with_weight(156 <Pallet<T>>::transfer_from(&self, &sender, &from, &to, amount),156 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount),157 <CommonWeights<T>>::transfer_from(),157 <CommonWeights<T>>::transfer_from(),158 )158 )159 }159 }171 );171 );172172173 with_weight(173 with_weight(174 <Pallet<T>>::burn_from(&self, &sender, &from, amount),174 <Pallet<T>>::burn_from(self, &sender, &from, amount),175 <CommonWeights<T>>::burn_from(),175 <CommonWeights<T>>::burn_from(),176 )176 )177 }177 }pallets/fungible/src/erc.rsdiffbeforeafterboth1use core::char::{REPLACEMENT_CHARACTER, decode_utf16};1use core::char::{REPLACEMENT_CHARACTER, decode_utf16};2use core::convert::TryInto;2use core::convert::TryInto;3use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*};3use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};4use up_data_structs::CollectionMode;4use up_data_structs::CollectionMode;5use pallet_common::erc::CommonEvmHandler;5use pallet_common::erc::{CommonEvmHandler, PrecompileResult};6use sp_core::{H160, U256};6use sp_core::{H160, U256};7use sp_std::vec::Vec;7use sp_std::vec::Vec;8use pallet_common::account::CrossAccountId;8use pallet_common::account::CrossAccountId;9use pallet_common::erc::PrecompileOutput;10use pallet_evm_coder_substrate::{call_internal, dispatch_to_evm};9use pallet_evm_coder_substrate::{call, dispatch_to_evm};111012use crate::{Allowance, Balance, Config, FungibleHandle, Pallet, TotalSupply};11use crate::{12 Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,13 weights::WeightInfo,14};131514#[derive(ToLog)]16#[derive(ToLog)]40 Ok(string::from_utf8_lossy(&self.token_prefix).into())42 Ok(string::from_utf8_lossy(&self.token_prefix).into())41 }43 }42 fn total_supply(&self) -> Result<uint256> {44 fn total_supply(&self) -> Result<uint256> {45 self.consume_store_reads(1)?;43 Ok(<TotalSupply<T>>::get(self.id).into())46 Ok(<TotalSupply<T>>::get(self.id).into())44 }47 }454851 })54 })52 }55 }53 fn balance_of(&self, owner: address) -> Result<uint256> {56 fn balance_of(&self, owner: address) -> Result<uint256> {57 self.consume_store_reads(1)?;54 let owner = T::CrossAccountId::from_eth(owner);58 let owner = T::CrossAccountId::from_eth(owner);55 let balance = <Balance<T>>::get((self.id, owner));59 let balance = <Balance<T>>::get((self.id, owner));56 Ok(balance.into())60 Ok(balance.into())57 }61 }62 #[weight(<SelfWeightOf<T>>::transfer())]58 fn transfer(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {63 fn transfer(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {59 let caller = T::CrossAccountId::from_eth(caller);64 let caller = T::CrossAccountId::from_eth(caller);60 let to = T::CrossAccountId::from_eth(to);65 let to = T::CrossAccountId::from_eth(to);63 <Pallet<T>>::transfer(self, &caller, &to, amount).map_err(|_| "transfer error")?;68 <Pallet<T>>::transfer(self, &caller, &to, amount).map_err(|_| "transfer error")?;64 Ok(true)69 Ok(true)65 }70 }71 #[weight(<SelfWeightOf<T>>::transfer_from())]66 fn transfer_from(72 fn transfer_from(67 &mut self,73 &mut self,68 caller: caller,74 caller: caller,79 .map_err(dispatch_to_evm::<T>)?;85 .map_err(dispatch_to_evm::<T>)?;80 Ok(true)86 Ok(true)81 }87 }88 #[weight(<SelfWeightOf<T>>::approve())]82 fn approve(&mut self, caller: caller, spender: address, amount: uint256) -> Result<bool> {89 fn approve(&mut self, caller: caller, spender: address, amount: uint256) -> Result<bool> {83 let caller = T::CrossAccountId::from_eth(caller);90 let caller = T::CrossAccountId::from_eth(caller);84 let spender = T::CrossAccountId::from_eth(spender);91 let spender = T::CrossAccountId::from_eth(spender);89 Ok(true)96 Ok(true)90 }97 }91 fn allowance(&self, owner: address, spender: address) -> Result<uint256> {98 fn allowance(&self, owner: address, spender: address) -> Result<uint256> {99 self.consume_store_reads(1)?;92 let owner = T::CrossAccountId::from_eth(owner);100 let owner = T::CrossAccountId::from_eth(owner);93 let spender = T::CrossAccountId::from_eth(spender);101 let spender = T::CrossAccountId::from_eth(spender);941029810699#[solidity_interface(name = "ERC20UniqueExtensions")]107#[solidity_interface(name = "ERC20UniqueExtensions")]100impl<T: Config> FungibleHandle<T> {108impl<T: Config> FungibleHandle<T> {109 #[weight(<SelfWeightOf<T>>::burn_from())]101 fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {110 fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {102 let caller = T::CrossAccountId::from_eth(caller);111 let caller = T::CrossAccountId::from_eth(caller);103 let from = T::CrossAccountId::from_eth(from);112 let from = T::CrossAccountId::from_eth(from);111#[solidity_interface(name = "UniqueFungible", is(ERC20))]120#[solidity_interface(name = "UniqueFungible", is(ERC20))]112impl<T: Config> FungibleHandle<T> {}121impl<T: Config> FungibleHandle<T> {}113122114generate_stubgen!(gen_impl, UniqueFungibleCall, true);123generate_stubgen!(gen_impl, UniqueFungibleCall<()>, true);115generate_stubgen!(gen_iface, UniqueFungibleCall, false);124generate_stubgen!(gen_iface, UniqueFungibleCall<()>, false);116125117impl<T: Config> CommonEvmHandler for FungibleHandle<T> {126impl<T: Config> CommonEvmHandler for FungibleHandle<T> {118 const CODE: &'static [u8] = include_bytes!("./stubs/UniqueFungible.raw");127 const CODE: &'static [u8] = include_bytes!("./stubs/UniqueFungible.raw");119128120 fn call(mut self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput> {129 fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult> {121 let result = call_internal::<UniqueFungibleCall, _>(*source, &mut self, value, input);130 call::<T, UniqueFungibleCall<T>, _>(*source, self, value, input)122 self.0.recorder.evm_to_precompile_output(result)123 }131 }124}132}125133pallets/fungible/src/lib.rsdiffbeforeafterboth6use pallet_common::{6use pallet_common::{7 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, account::CrossAccountId,7 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, account::CrossAccountId,8};8};9use pallet_evm_coder_substrate::WithRecorder;9use sp_core::H160;10use sp_core::H160;10use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};11use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};11use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};12use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};82 self.083 self.083 }84 }84}85}86impl<T: Config> WithRecorder<T> for FungibleHandle<T> {87 fn recorder(&self) -> &pallet_evm_coder_substrate::SubstrateRecorder<T> {88 self.0.recorder()89 }90 fn into_recorder(self) -> pallet_evm_coder_substrate::SubstrateRecorder<T> {91 self.0.into_recorder()92 }93}85impl<T: Config> Deref for FungibleHandle<T> {94impl<T: Config> Deref for FungibleHandle<T> {86 type Target = pallet_common::CollectionHandle<T>;95 type Target = pallet_common::CollectionHandle<T>;8796136 }145 }137 <TotalSupply<T>>::insert(collection.id, total_supply);146 <TotalSupply<T>>::insert(collection.id, total_supply);138147139 collection.log_infallible(ERC20Events::Transfer {148 collection.log(ERC20Events::Transfer {140 from: *owner.as_eth(),149 from: *owner.as_eth(),141 to: H160::default(),150 to: H160::default(),142 value: amount.into(),151 value: amount.into(),180 None189 None181 };190 };182183 collection.consume_sstore()?;184 collection.consume_sstore()?;185 collection.consume_log(2, 32)?;186 collection.consume_sstore()?;187191188 // =========192 // =========189193197 <Balance<T>>::insert((collection.id, to), balance_to);201 <Balance<T>>::insert((collection.id, to), balance_to);198 }202 }199203200 collection.log_infallible(ERC20Events::Transfer {204 collection.log(ERC20Events::Transfer {201 from: *from.as_eth(),205 from: *from.as_eth(),202 to: *to.as_eth(),206 to: *to.as_eth(),203 value: amount.into(),207 value: amount.into(),217 sender: &T::CrossAccountId,221 sender: &T::CrossAccountId,218 data: Vec<CreateItemData<T>>,222 data: Vec<CreateItemData<T>>,219 ) -> DispatchResult {223 ) -> DispatchResult {220 let unrestricted_minting = collection.is_owner_or_admin(sender)?;224 if !collection.is_owner_or_admin(sender) {221 if !unrestricted_minting {222 ensure!(225 ensure!(223 collection.mint_mode,226 collection.mint_mode,224 <CommonError<T>>::PublicMintingNotAllowed227 <CommonError<T>>::PublicMintingNotAllowed241 .ok_or(ArithmeticError::Overflow)?;244 .ok_or(ArithmeticError::Overflow)?;242245243 for (user, amount) in data.into_iter() {246 for (user, amount) in data.into_iter() {244 collection.consume_sload()?;245 let balance = balances247 let balance = balances246 .entry(user.clone())248 .entry(user.clone())247 .or_insert_with(|| <Balance<T>>::get((collection.id, user)));249 .or_insert_with(|| <Balance<T>>::get((collection.id, user)));250 .ok_or(ArithmeticError::Overflow)?;252 .ok_or(ArithmeticError::Overflow)?;251 }253 }252253 collection.consume_sstore()?;254 for _ in &balances {255 collection.consume_sstore()?;256 collection.consume_log(2, 32)?;257 collection.consume_sstore()?;258 }259254260 // =========255 // =========261256262 <TotalSupply<T>>::insert(collection.id, total_supply);257 <TotalSupply<T>>::insert(collection.id, total_supply);263 for (user, amount) in balances {258 for (user, amount) in balances {264 <Balance<T>>::insert((collection.id, &user), amount);259 <Balance<T>>::insert((collection.id, &user), amount);265260266 collection.log_infallible(ERC20Events::Transfer {261 collection.log(ERC20Events::Transfer {267 from: H160::default(),262 from: H160::default(),268 to: *user.as_eth(),263 to: *user.as_eth(),269 value: amount.into(),264 value: amount.into(),291 <Allowance<T>>::insert((collection.id, owner, spender), amount);286 <Allowance<T>>::insert((collection.id, owner, spender), amount);292 }287 }293288294 collection.log_infallible(ERC20Events::Approval {289 collection.log(ERC20Events::Approval {295 owner: *owner.as_eth(),290 owner: *owner.as_eth(),296 spender: *spender.as_eth(),291 spender: *spender.as_eth(),297 value: amount.into(),292 value: amount.into(),312 amount: u128,307 amount: u128,313 ) -> DispatchResult {308 ) -> DispatchResult {314 if collection.access == AccessMode::AllowList {309 if collection.access == AccessMode::AllowList {315 collection.check_allowlist(&owner)?;310 collection.check_allowlist(owner)?;316 collection.check_allowlist(&spender)?;311 collection.check_allowlist(spender)?;317 }312 }318313319 if <Balance<T>>::get((collection.id, owner)) < amount {314 if <Balance<T>>::get((collection.id, owner)) < amount {320 ensure!(315 ensure!(321 collection.ignores_owned_amount(owner)?,316 collection.ignores_owned_amount(owner),322 <CommonError<T>>::CantApproveMoreThanOwned317 <CommonError<T>>::CantApproveMoreThanOwned323 );318 );324 }319 }347 let allowance = <Allowance<T>>::get((collection.id, from, spender)).checked_sub(amount);342 let allowance = <Allowance<T>>::get((collection.id, from, spender)).checked_sub(amount);348 if allowance.is_none() {343 if allowance.is_none() {349 ensure!(344 ensure!(350 collection.ignores_allowance(spender)?,345 collection.ignores_allowance(spender),351 <CommonError<T>>::TokenValueNotEnough346 <CommonError<T>>::TokenValueNotEnough352 );347 );353 }348 }378 let allowance = <Allowance<T>>::get((collection.id, from, spender)).checked_sub(amount);373 let allowance = <Allowance<T>>::get((collection.id, from, spender)).checked_sub(amount);379 if allowance.is_none() {374 if allowance.is_none() {380 ensure!(375 ensure!(381 collection.ignores_allowance(spender)?,376 collection.ignores_allowance(spender),382 <CommonError<T>>::TokenValueNotEnough377 <CommonError<T>>::TokenValueNotEnough383 );378 );384 }379 }pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth31 );31 );32}32}333334// Selector: 942e8b2234contract ERC20 is Dummy, ERC165, ERC20Events {35contract ERC20 is Dummy, ERC165, ERC20Events {35 // Selector: name() 06fdde0336 // Selector: name() 06fdde0336 function name() public view returns (string memory) {37 function name() public view returns (string memory) {pallets/fungible/src/weights.rsdiffbeforeafterboth25#![cfg_attr(rustfmt, rustfmt_skip)]25#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]26#![allow(unused_parens)]27#![allow(unused_imports)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]282929use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use sp_std::marker::PhantomData;31use sp_std::marker::PhantomData;36 fn transfer() -> Weight;37 fn transfer() -> Weight;37 fn approve() -> Weight;38 fn approve() -> Weight;38 fn transfer_from() -> Weight;39 fn transfer_from() -> Weight;40 fn burn_from() -> Weight;39}41}404241/// Weights for pallet_fungible using the Substrate node and recommended hardware.43/// Weights for pallet_fungible using the Substrate node and recommended hardware.75 .saturating_add(T::DbWeight::get().reads(3 as Weight))77 .saturating_add(T::DbWeight::get().reads(3 as Weight))76 .saturating_add(T::DbWeight::get().writes(3 as Weight))78 .saturating_add(T::DbWeight::get().writes(3 as Weight))77 }79 }80 // Storage: Fungible Allowance (r:1 w:1)81 // Storage: Fungible TotalSupply (r:1 w:1)82 // Storage: Fungible Balance (r:1 w:1)83 fn burn_from() -> Weight {84 (55_874_000 as Weight)85 .saturating_add(T::DbWeight::get().reads(3 as Weight))86 .saturating_add(T::DbWeight::get().writes(3 as Weight))87 }78}88}798980// For backwards compatibility and tests90// For backwards compatibility and tests113 .saturating_add(RocksDbWeight::get().reads(3 as Weight))123 .saturating_add(RocksDbWeight::get().reads(3 as Weight))114 .saturating_add(RocksDbWeight::get().writes(3 as Weight))124 .saturating_add(RocksDbWeight::get().writes(3 as Weight))115 }125 }126 // Storage: Fungible Allowance (r:1 w:1)127 // Storage: Fungible TotalSupply (r:1 w:1)128 // Storage: Fungible Balance (r:1 w:1)129 fn burn_from() -> Weight {130 (55_874_000 as Weight)131 .saturating_add(RocksDbWeight::get().reads(3 as Weight))132 .saturating_add(RocksDbWeight::get().writes(3 as Weight))133 }116}134}117135pallets/nonfungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-nonfungible"2name = "pallet-nonfungible"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies.codec]6[dependencies.codec]7default-features = false7default-features = false19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }22ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }22ethereum = { version = "0.10.0", default-features = false }23frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }23frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }24scale-info = { version = "1.0.0", default-features = false, features = [24scale-info = { version = "1.0.0", default-features = false, features = [25 "derive",25 "derive",pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth89 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;89 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;90 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item)?}90 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item)?}9192 burn_from {93 bench_init!{94 owner: sub; collection: collection(owner);95 owner: cross_from_sub; sender: cross_sub; burner: cross_sub;96 };97 let item = create_max_item(&collection, &owner, sender.clone())?;98 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;99 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item)?}9110092 set_variable_metadata {101 set_variable_metadata {93 let b in 0..CUSTOM_DATA_LIMIT;102 let b in 0..CUSTOM_DATA_LIMIT;pallets/nonfungible/src/common.rsdiffbeforeafterboth38 }38 }393940 fn burn_from() -> Weight {40 fn burn_from() -> Weight {41 041 <SelfWeightOf<T>>::burn_from()42 }42 }434344 fn set_variable_metadata(bytes: u32) -> Weight {44 fn set_variable_metadata(bytes: u32) -> Weight {100 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);100 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);101 if amount == 1 {101 if amount == 1 {102 with_weight(102 with_weight(103 <Pallet<T>>::burn(&self, &sender, token),103 <Pallet<T>>::burn(self, &sender, token),104 <CommonWeights<T>>::burn_item(),104 <CommonWeights<T>>::burn_item(),105 )105 )106 } else {106 } else {118 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);118 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);119 if amount == 1 {119 if amount == 1 {120 with_weight(120 with_weight(121 <Pallet<T>>::transfer(&self, &from, &to, token),121 <Pallet<T>>::transfer(self, &from, &to, token),122 <CommonWeights<T>>::transfer(),122 <CommonWeights<T>>::transfer(),123 )123 )124 } else {124 } else {137137138 with_weight(138 with_weight(139 if amount == 1 {139 if amount == 1 {140 <Pallet<T>>::set_allowance(&self, &sender, token, Some(&spender))140 <Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))141 } else {141 } else {142 <Pallet<T>>::set_allowance(&self, &sender, token, None)142 <Pallet<T>>::set_allowance(self, &sender, token, None)143 },143 },144 <CommonWeights<T>>::approve(),144 <CommonWeights<T>>::approve(),145 )145 )157157158 if amount == 1 {158 if amount == 1 {159 with_weight(159 with_weight(160 <Pallet<T>>::transfer_from(&self, &sender, &from, &to, token),160 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token),161 <CommonWeights<T>>::transfer_from(),161 <CommonWeights<T>>::transfer_from(),162 )162 )163 } else {163 } else {176176177 if amount == 1 {177 if amount == 1 {178 with_weight(178 with_weight(179 <Pallet<T>>::burn_from(&self, &sender, &from, token),179 <Pallet<T>>::burn_from(self, &sender, &from, token),180 <CommonWeights<T>>::burn_from(),180 <CommonWeights<T>>::burn_from(),181 )181 )182 } else {182 } else {192 ) -> DispatchResultWithPostInfo {192 ) -> DispatchResultWithPostInfo {193 let len = data.len();193 let len = data.len();194 with_weight(194 with_weight(195 <Pallet<T>>::set_variable_metadata(&self, &sender, token, data),195 <Pallet<T>>::set_variable_metadata(self, &sender, token, data),196 <CommonWeights<T>>::set_variable_metadata(len as u32),196 <CommonWeights<T>>::set_variable_metadata(len as u32),197 )197 )198 }198 }218 }218 }219 fn const_metadata(&self, token: TokenId) -> Vec<u8> {219 fn const_metadata(&self, token: TokenId) -> Vec<u8> {220 <TokenData<T>>::get((self.id, token))220 <TokenData<T>>::get((self.id, token))221 .map(|t| t.const_data.clone())221 .map(|t| t.const_data)222 .unwrap_or_default()222 .unwrap_or_default()223 }223 }224 fn variable_metadata(&self, token: TokenId) -> Vec<u8> {224 fn variable_metadata(&self, token: TokenId) -> Vec<u8> {225 <TokenData<T>>::get((self.id, token))225 <TokenData<T>>::get((self.id, token))226 .map(|t| t.variable_data.clone())226 .map(|t| t.variable_data)227 .unwrap_or_default()227 .unwrap_or_default()228 }228 }229229pallets/nonfungible/src/erc.rsdiffbeforeafterboth2 char::{REPLACEMENT_CHARACTER, decode_utf16},2 char::{REPLACEMENT_CHARACTER, decode_utf16},3 convert::TryInto,3 convert::TryInto,4};4};5use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*};5use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};6use frame_support::BoundedVec;6use frame_support::BoundedVec;7use up_data_structs::TokenId;7use up_data_structs::TokenId;8use pallet_evm_coder_substrate::dispatch_to_evm;8use pallet_evm_coder_substrate::dispatch_to_evm;9use sp_core::{H160, U256};9use sp_core::{H160, U256};10use sp_std::{vec::Vec, vec};10use sp_std::{vec::Vec, vec};11use pallet_common::{account::CrossAccountId, erc::CommonEvmHandler};11use pallet_common::{12 account::CrossAccountId,13 erc::{CommonEvmHandler, PrecompileResult},14};12use pallet_evm_coder_substrate::call_internal;15use pallet_evm_coder_substrate::call;13use pallet_common::erc::PrecompileOutput;141615use crate::{17use crate::{16 AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,18 AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,19 SelfWeightOf, weights::WeightInfo,17};20};182119#[derive(ToLog)]22#[derive(ToLog)]61 Ok(string::from_utf8_lossy(&self.token_prefix).into())64 Ok(string::from_utf8_lossy(&self.token_prefix).into())62 }65 }636667 /// Returns token's const_metadata64 #[solidity(rename_selector = "tokenURI")]68 #[solidity(rename_selector = "tokenURI")]65 fn token_uri(&self, token_id: uint256) -> Result<string> {69 fn token_uri(&self, token_id: uint256) -> Result<string> {70 self.consume_store_reads(1)?;66 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;71 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;67 Ok(string::from_utf8_lossy(72 Ok(string::from_utf8_lossy(68 &<TokenData<T>>::get((self.id, token_id))73 &<TokenData<T>>::get((self.id, token_id))79 Ok(index)84 Ok(index)80 }85 }818687 /// Not implemented82 fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {88 fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {83 // TODO: Not implemetable89 // TODO: Not implemetable84 Err("not implemented".into())90 Err("not implemented".into())85 }91 }869287 fn total_supply(&self) -> Result<uint256> {93 fn total_supply(&self) -> Result<uint256> {94 self.consume_store_reads(1)?;88 Ok(<Pallet<T>>::total_supply(self).into())95 Ok(<Pallet<T>>::total_supply(self).into())89 }96 }90}97}919892#[solidity_interface(name = "ERC721", events(ERC721Events))]99#[solidity_interface(name = "ERC721", events(ERC721Events))]93impl<T: Config> NonfungibleHandle<T> {100impl<T: Config> NonfungibleHandle<T> {94 fn balance_of(&self, owner: address) -> Result<uint256> {101 fn balance_of(&self, owner: address) -> Result<uint256> {102 self.consume_store_reads(1)?;95 let owner = T::CrossAccountId::from_eth(owner);103 let owner = T::CrossAccountId::from_eth(owner);96 let balance = <AccountBalance<T>>::get((self.id, owner));104 let balance = <AccountBalance<T>>::get((self.id, owner));97 Ok(balance.into())105 Ok(balance.into())98 }106 }99 fn owner_of(&self, token_id: uint256) -> Result<address> {107 fn owner_of(&self, token_id: uint256) -> Result<address> {108 self.consume_store_reads(1)?;100 let token: TokenId = token_id.try_into()?;109 let token: TokenId = token_id.try_into()?;101 Ok(*<TokenData<T>>::get((self.id, token))110 Ok(*<TokenData<T>>::get((self.id, token))102 .ok_or("token not found")?111 .ok_or("token not found")?103 .owner112 .owner104 .as_eth())113 .as_eth())105 }114 }115 /// Not implemented106 fn safe_transfer_from_with_data(116 fn safe_transfer_from_with_data(107 &mut self,117 &mut self,108 _from: address,118 _from: address,114 // TODO: Not implemetable124 // TODO: Not implemetable115 Err("not implemented".into())125 Err("not implemented".into())116 }126 }127 /// Not implemented117 fn safe_transfer_from(128 fn safe_transfer_from(118 &mut self,129 &mut self,119 _from: address,130 _from: address,125 Err("not implemented".into())136 Err("not implemented".into())126 }137 }127138139 #[weight(<SelfWeightOf<T>>::transfer_from())]128 fn transfer_from(140 fn transfer_from(129 &mut self,141 &mut self,130 caller: caller,142 caller: caller,143 Ok(())155 Ok(())144 }156 }145157158 #[weight(<SelfWeightOf<T>>::approve())]146 fn approve(159 fn approve(147 &mut self,160 &mut self,148 caller: caller,161 caller: caller,159 Ok(())172 Ok(())160 }173 }161174175 /// Not implemented162 fn set_approval_for_all(176 fn set_approval_for_all(163 &mut self,177 &mut self,164 _caller: caller,178 _caller: caller,169 Err("not implemented".into())183 Err("not implemented".into())170 }184 }171185186 /// Not implemented172 fn get_approved(&self, _token_id: uint256) -> Result<address> {187 fn get_approved(&self, _token_id: uint256) -> Result<address> {173 // TODO: Not implemetable188 // TODO: Not implemetable174 Err("not implemented".into())189 Err("not implemented".into())175 }190 }176191192 /// Not implemented177 fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {193 fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {178 // TODO: Not implemetable194 // TODO: Not implemetable179 Err("not implemented".into())195 Err("not implemented".into())182198183#[solidity_interface(name = "ERC721Burnable")]199#[solidity_interface(name = "ERC721Burnable")]184impl<T: Config> NonfungibleHandle<T> {200impl<T: Config> NonfungibleHandle<T> {201 #[weight(<SelfWeightOf<T>>::burn_item())]185 fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {202 fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {186 let caller = T::CrossAccountId::from_eth(caller);203 let caller = T::CrossAccountId::from_eth(caller);187 let token = token_id.try_into()?;204 let token = token_id.try_into()?;197 Ok(false)214 Ok(false)198 }215 }199216217 /// `token_id` should be obtained with `next_token_id` method,218 /// unlike standard, you can't specify it manually219 #[weight(<SelfWeightOf<T>>::create_item())]200 fn mint(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {220 fn mint(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {201 let caller = T::CrossAccountId::from_eth(caller);221 let caller = T::CrossAccountId::from_eth(caller);202 let to = T::CrossAccountId::from_eth(to);222 let to = T::CrossAccountId::from_eth(to);223 Ok(true)243 Ok(true)224 }244 }225245246 /// `token_id` should be obtained with `next_token_id` method,247 /// unlike standard, you can't specify it manually226 #[solidity(rename_selector = "mintWithTokenURI")]248 #[solidity(rename_selector = "mintWithTokenURI")]249 #[weight(<SelfWeightOf<T>>::create_item())]227 fn mint_with_token_uri(250 fn mint_with_token_uri(228 &mut self,251 &mut self,229 caller: caller,252 caller: caller,257 Ok(true)280 Ok(true)258 }281 }259282283 /// Not implemented260 fn finish_minting(&mut self, _caller: caller) -> Result<bool> {284 fn finish_minting(&mut self, _caller: caller) -> Result<bool> {261 Err("not implementable".into())285 Err("not implementable".into())262 }286 }263}287}264288265#[solidity_interface(name = "ERC721UniqueExtensions")]289#[solidity_interface(name = "ERC721UniqueExtensions")]266impl<T: Config> NonfungibleHandle<T> {290impl<T: Config> NonfungibleHandle<T> {291 #[weight(<SelfWeightOf<T>>::transfer())]267 fn transfer(292 fn transfer(268 &mut self,293 &mut self,269 caller: caller,294 caller: caller,279 Ok(())304 Ok(())280 }305 }281306307 #[weight(<SelfWeightOf<T>>::burn_from())]282 fn burn_from(308 fn burn_from(283 &mut self,309 &mut self,284 caller: caller,310 caller: caller,295 }321 }296322297 fn next_token_id(&self) -> Result<uint256> {323 fn next_token_id(&self) -> Result<uint256> {324 self.consume_store_reads(1)?;298 Ok(<TokensMinted<T>>::get(self.id)325 Ok(<TokensMinted<T>>::get(self.id)299 .checked_add(1)326 .checked_add(1)300 .ok_or("item id overflow")?327 .ok_or("item id overflow")?301 .into())328 .into())302 }329 }303330331 #[weight(<SelfWeightOf<T>>::set_variable_metadata(data.len() as u32))]304 fn set_variable_metadata(332 fn set_variable_metadata(305 &mut self,333 &mut self,306 caller: caller,334 caller: caller,316 }344 }317345318 fn get_variable_metadata(&self, token_id: uint256) -> Result<bytes> {346 fn get_variable_metadata(&self, token_id: uint256) -> Result<bytes> {347 self.consume_store_reads(1)?;319 let token: TokenId = token_id.try_into()?;348 let token: TokenId = token_id.try_into()?;320349321 Ok(<TokenData<T>>::get((self.id, token))350 Ok(<TokenData<T>>::get((self.id, token))322 .ok_or("token not found")?351 .ok_or("token not found")?323 .variable_data)352 .variable_data)324 }353 }325354355 #[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]326 fn mint_bulk(&mut self, caller: caller, to: address, token_ids: Vec<uint256>) -> Result<bool> {356 fn mint_bulk(&mut self, caller: caller, to: address, token_ids: Vec<uint256>) -> Result<bool> {327 let caller = T::CrossAccountId::from_eth(caller);357 let caller = T::CrossAccountId::from_eth(caller);328 let to = T::CrossAccountId::from_eth(to);358 let to = T::CrossAccountId::from_eth(to);351 }381 }352382353 #[solidity(rename_selector = "mintBulkWithTokenURI")]383 #[solidity(rename_selector = "mintBulkWithTokenURI")]384 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]354 fn mint_bulk_with_token_uri(385 fn mint_bulk_with_token_uri(355 &mut self,386 &mut self,356 caller: caller,387 caller: caller,399impl<T: Config> NonfungibleHandle<T> {}430impl<T: Config> NonfungibleHandle<T> {}400431401// Not a tests, but code generators432// Not a tests, but code generators402generate_stubgen!(gen_impl, UniqueNFTCall, true);433generate_stubgen!(gen_impl, UniqueNFTCall<()>, true);403generate_stubgen!(gen_iface, UniqueNFTCall, false);434generate_stubgen!(gen_iface, UniqueNFTCall<()>, false);404405pub const CODE: &[u8] = include_bytes!("./stubs/UniqueNFT.raw");406435407impl<T: Config> CommonEvmHandler for NonfungibleHandle<T> {436impl<T: Config> CommonEvmHandler for NonfungibleHandle<T> {408 const CODE: &'static [u8] = include_bytes!("./stubs/UniqueNFT.raw");437 const CODE: &'static [u8] = include_bytes!("./stubs/UniqueNFT.raw");409438410 fn call(mut self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput> {439 fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult> {411 let result = call_internal::<UniqueNFTCall, _>(*source, &mut self, value, input);440 call::<T, UniqueNFTCall<T>, _>(*source, self, value, input)412 self.0.recorder.evm_to_precompile_output(result)413 }441 }414}442}415443pallets/nonfungible/src/lib.rsdiffbeforeafterboth8use pallet_common::{8use pallet_common::{9 Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, account::CrossAccountId,9 Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, account::CrossAccountId,10};10};11use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};11use sp_core::H160;12use sp_core::H160;12use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};13use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};13use sp_std::{vec::Vec, vec};14use sp_std::{vec::Vec, vec};114 self.0115 self.0115 }116 }116}117}118impl<T: Config> WithRecorder<T> for NonfungibleHandle<T> {119 fn recorder(&self) -> &SubstrateRecorder<T> {120 self.0.recorder()121 }122 fn into_recorder(self) -> SubstrateRecorder<T> {123 self.0.into_recorder()124 }125}117impl<T: Config> Deref for NonfungibleHandle<T> {126impl<T: Config> Deref for NonfungibleHandle<T> {118 type Target = pallet_common::CollectionHandle<T>;127 type Target = pallet_common::CollectionHandle<T>;119128161 token: TokenId,170 token: TokenId,162 ) -> DispatchResult {171 ) -> DispatchResult {163 let token_data = <TokenData<T>>::get((collection.id, token))172 let token_data =164 .ok_or_else(|| <CommonError<T>>::TokenNotFound)?;173 <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;165 ensure!(174 ensure!(166 &token_data.owner == sender175 &token_data.owner == sender167 || (collection.limits.owner_can_transfer()176 || (collection.limits.owner_can_transfer() && collection.is_owner_or_admin(sender)),168 && collection.is_owner_or_admin(sender)?),169 <CommonError<T>>::NoPermission177 <CommonError<T>>::NoPermission170 );178 );171179188 }196 }189 // =========197 // =========190198191 <Owned<T>>::remove((collection.id, &token_data.owner.clone(), token));199 <Owned<T>>::remove((collection.id, &token_data.owner, token));192 <TokensBurnt<T>>::insert(collection.id, burnt);200 <TokensBurnt<T>>::insert(collection.id, burnt);193 <TokenData<T>>::remove((collection.id, token));201 <TokenData<T>>::remove((collection.id, token));194 let old_spender = <Allowance<T>>::take((collection.id, token));202 let old_spender = <Allowance<T>>::take((collection.id, token));198 collection.id,206 collection.id,199 token,207 token,200 sender.clone(),208 sender.clone(),201 old_spender.clone(),209 old_spender,202 0,210 0,203 ));211 ));204 }212 }205213206 collection.log_infallible(ERC721Events::Transfer {214 collection.log(ERC721Events::Transfer {207 from: *token_data.owner.as_eth(),215 from: *token_data.owner.as_eth(),208 to: H160::default(),216 to: H160::default(),209 token_id: token.into(),217 token_id: token.into(),214 token_data.owner,222 token_data.owner,215 1,223 1,216 ));224 ));217 return Ok(());225 Ok(())218 }226 }219227220 pub fn transfer(228 pub fn transfer(229 );237 );230238231 let token_data = <TokenData<T>>::get((collection.id, token))239 let token_data =232 .ok_or_else(|| <CommonError<T>>::TokenNotFound)?;240 <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;233 ensure!(241 ensure!(234 &token_data.owner == from242 &token_data.owner == from235 || (collection.limits.owner_can_transfer()243 || (collection.limits.owner_can_transfer() && collection.is_owner_or_admin(from)),236 && collection.is_owner_or_admin(from)?),237 <CommonError<T>>::NoPermission244 <CommonError<T>>::NoPermission238 );245 );239246261 None268 None262 };269 };263264 collection.consume_sstores(4)?;265 collection.consume_log(3, 0)?;266270267 // =========271 // =========268272287 }291 }288 Self::set_allowance_unchecked(collection, from, token, None, true);292 Self::set_allowance_unchecked(collection, from, token, None, true);289293290 collection.log_infallible(ERC721Events::Transfer {294 collection.log(ERC721Events::Transfer {291 from: *from.as_eth(),295 from: *from.as_eth(),292 to: *to.as_eth(),296 to: *to.as_eth(),293 token_id: token.into(),297 token_id: token.into(),307 sender: &T::CrossAccountId,311 sender: &T::CrossAccountId,308 data: Vec<CreateItemData<T>>,312 data: Vec<CreateItemData<T>>,309 ) -> DispatchResult {313 ) -> DispatchResult {310 let unrestricted_minting = collection.is_owner_or_admin(sender)?;314 if !collection.is_owner_or_admin(sender) {311 if !unrestricted_minting {312 ensure!(315 ensure!(313 collection.mint_mode,316 collection.mint_mode,314 <CommonError<T>>::PublicMintingNotAllowed317 <CommonError<T>>::PublicMintingNotAllowed322325323 for data in data.iter() {326 for data in data.iter() {324 <PalletCommon<T>>::ensure_correct_receiver(&data.owner)?;327 <PalletCommon<T>>::ensure_correct_receiver(&data.owner)?;325 if !data.const_data.is_empty() {326 collection.consume_sstore()?;327 }328 if !data.variable_data.is_empty() {329 collection.consume_sstore()?;330 }331 collection.consume_sstore()?;332 collection.consume_log(3, 0)?;333 }328 }334329335 let first_token = <TokensMinted<T>>::get(collection.id);330 let first_token = <TokensMinted<T>>::get(collection.id);340 tokens_minted <= collection.limits.token_limit(),335 tokens_minted <= collection.limits.token_limit(),341 <CommonError<T>>::CollectionTokenLimitExceeded336 <CommonError<T>>::CollectionTokenLimitExceeded342 );337 );343 collection.consume_sstore()?;344338345 let mut balances = BTreeMap::new();339 let mut balances = BTreeMap::new();346 for data in &data {340 for data in &data {354 <CommonError<T>>::AccountTokenLimitExceeded,348 <CommonError<T>>::AccountTokenLimitExceeded,355 );349 );356 }350 }357 collection.consume_sstores(balances.len())?;358351359 // =========352 // =========360353375 );368 );376 <Owned<T>>::insert((collection.id, &data.owner, token), true);369 <Owned<T>>::insert((collection.id, &data.owner, token), true);377370378 collection.log_infallible(ERC721Events::Transfer {371 collection.log(ERC721Events::Transfer {379 from: H160::default(),372 from: H160::default(),380 to: *data.owner.as_eth(),373 to: *data.owner.as_eth(),381 token_id: token.into(),374 token_id: token.into(),402 <Allowance<T>>::insert((collection.id, token), spender);395 <Allowance<T>>::insert((collection.id, token), spender);403 // In ERC721 there is only one possible approved user of token, so we set396 // In ERC721 there is only one possible approved user of token, so we set404 // approved user to spender397 // approved user to spender405 collection.log_infallible(ERC721Events::Approval {398 collection.log(ERC721Events::Approval {406 owner: *sender.as_eth(),399 owner: *sender.as_eth(),407 approved: *spender.as_eth(),400 approved: *spender.as_eth(),408 token_id: token.into(),401 token_id: token.into(),415 collection.id,408 collection.id,416 token,409 token,417 sender.clone(),410 sender.clone(),418 old_owner.clone(),411 old_owner,419 0,412 0,420 ));413 ));421 }414 }432 if !assume_implicit_eth {425 if !assume_implicit_eth {433 // In ERC721 there is only one possible approved user of token, so we set426 // In ERC721 there is only one possible approved user of token, so we set434 // approved user to zero address427 // approved user to zero address435 collection.log_infallible(ERC721Events::Approval {428 collection.log(ERC721Events::Approval {436 owner: *sender.as_eth(),429 owner: *sender.as_eth(),437 approved: H160::default(),430 approved: H160::default(),438 token_id: token.into(),431 token_id: token.into(),445 collection.id,438 collection.id,446 token,439 token,447 sender.clone(),440 sender.clone(),448 old_spender.clone(),441 old_spender,449 0,442 0,450 ));443 ));451 }444 }459 spender: Option<&T::CrossAccountId>,452 spender: Option<&T::CrossAccountId>,460 ) -> DispatchResult {453 ) -> DispatchResult {461 if collection.access == AccessMode::AllowList {454 if collection.access == AccessMode::AllowList {462 collection.check_allowlist(&sender)?;455 collection.check_allowlist(sender)?;463 if let Some(spender) = spender {456 if let Some(spender) = spender {464 collection.check_allowlist(&spender)?;457 collection.check_allowlist(spender)?;465 }458 }466 }459 }467460472 <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;465 <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;473 if &token_data.owner != sender {466 if &token_data.owner != sender {474 ensure!(467 ensure!(475 collection.ignores_owned_amount(sender)?,468 collection.ignores_owned_amount(sender),476 <CommonError<T>>::CantApproveMoreThanOwned469 <CommonError<T>>::CantApproveMoreThanOwned477 );470 );478 }471 }500493501 if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {494 if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {502 ensure!(495 ensure!(503 collection.ignores_allowance(spender)?,496 collection.ignores_allowance(spender),504 <CommonError<T>>::TokenValueNotEnough497 <CommonError<T>>::TokenValueNotEnough505 );498 );506 }499 }507500508 // =========501 // =========509502510 Self::transfer(collection, &from, to, token)?;503 Self::transfer(collection, from, to, token)?;511 // Allowance is reset in [`transfer`]504 // Allowance is reset in [`transfer`]512 Ok(())505 Ok(())513 }506 }528521529 if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {522 if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {530 ensure!(523 ensure!(531 collection.ignores_allowance(spender)?,524 collection.ignores_allowance(spender),532 <CommonError<T>>::TokenValueNotEnough525 <CommonError<T>>::TokenValueNotEnough533 );526 );534 }527 }535528536 // =========529 // =========537530538 Self::burn(collection, &from, token)531 Self::burn(collection, from, token)539 }532 }540533541 pub fn set_variable_metadata(534 pub fn set_variable_metadata(552 <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;545 <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;553 collection.check_can_update_meta(sender, &token_data.owner)?;546 collection.check_can_update_meta(sender, &token_data.owner)?;554555 collection.consume_sstore()?;556547557 // =========548 // =========558549pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth51 event MintingFinished();51 event MintingFinished();52}52}535354contract ERC721 is Dummy, ERC165, ERC721Events {54// Selector: 42966c6855 // Selector: balanceOf(address) 70a0823156 function balanceOf(address owner) public view returns (uint256) {57 require(false, stub_error);58 owner;59 dummy;60 return 0;61 }6263 // Selector: ownerOf(uint256) 6352211e64 function ownerOf(uint256 tokenId) public view returns (address) {65 require(false, stub_error);66 tokenId;67 dummy;68 return 0x0000000000000000000000000000000000000000;69 }7071 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167272 function safeTransferFromWithData(73 address from,74 address to,75 uint256 tokenId,76 bytes memory data77 ) public {78 require(false, stub_error);79 from;80 to;81 tokenId;82 data;83 dummy = 0;84 }8586 // Selector: safeTransferFrom(address,address,uint256) 42842e0e87 function safeTransferFrom(88 address from,89 address to,90 uint256 tokenId91 ) public {92 require(false, stub_error);93 from;94 to;95 tokenId;96 dummy = 0;97 }9899 // Selector: transferFrom(address,address,uint256) 23b872dd100 function transferFrom(101 address from,102 address to,103 uint256 tokenId104 ) public {105 require(false, stub_error);106 from;107 to;108 tokenId;109 dummy = 0;110 }111112 // Selector: approve(address,uint256) 095ea7b3113 function approve(address approved, uint256 tokenId) public {114 require(false, stub_error);115 approved;116 tokenId;117 dummy = 0;118 }119120 // Selector: setApprovalForAll(address,bool) a22cb465121 function setApprovalForAll(address operator, bool approved) public {122 require(false, stub_error);123 operator;124 approved;125 dummy = 0;126 }127128 // Selector: getApproved(uint256) 081812fc129 function getApproved(uint256 tokenId) public view returns (address) {130 require(false, stub_error);131 tokenId;132 dummy;133 return 0x0000000000000000000000000000000000000000;134 }135136 // Selector: isApprovedForAll(address,address) e985e9c5137 function isApprovedForAll(address owner, address operator)138 public139 view140 returns (address)141 {142 require(false, stub_error);143 owner;144 operator;145 dummy;146 return 0x0000000000000000000000000000000000000000;147 }148}149150contract ERC721Burnable is Dummy, ERC165 {55contract ERC721Burnable is Dummy, ERC165 {151 // Selector: burn(uint256) 42966c6856 // Selector: burn(uint256) 42966c68156 }61 }157}62}1586364// Selector: 58800161159contract ERC721Enumerable is Dummy, ERC165 {65contract ERC721 is Dummy, ERC165, ERC721Events {160 // Selector: tokenByIndex(uint256) 4f6ccce766 // Selector: balanceOf(address) 70a08231161 function tokenByIndex(uint256 index) public view returns (uint256) {67 function balanceOf(address owner) public view returns (uint256) {162 require(false, stub_error);68 require(false, stub_error);163 index;69 owner;164 dummy;70 dummy;165 return 0;71 return 0;166 }72 }7374 // Selector: ownerOf(uint256) 6352211e75 function ownerOf(uint256 tokenId) public view returns (address) {76 require(false, stub_error);77 tokenId;78 dummy;79 return 0x0000000000000000000000000000000000000000;80 }8182 // Not implemented83 //84 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167285 function safeTransferFromWithData(86 address from,87 address to,88 uint256 tokenId,89 bytes memory data90 ) public {91 require(false, stub_error);92 from;93 to;94 tokenId;95 data;96 dummy = 0;97 }9899 // Not implemented100 //101 // Selector: safeTransferFrom(address,address,uint256) 42842e0e102 function safeTransferFrom(103 address from,104 address to,105 uint256 tokenId106 ) public {107 require(false, stub_error);108 from;109 to;110 tokenId;111 dummy = 0;112 }167113168 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59114 // Selector: transferFrom(address,address,uint256) 23b872dd169 function tokenOfOwnerByIndex(address owner, uint256 index)115 function transferFrom(116 address from,117 address to,118 uint256 tokenId119 ) public {120 require(false, stub_error);121 from;122 to;123 tokenId;124 dummy = 0;125 }126127 // Selector: approve(address,uint256) 095ea7b3170 public128 function approve(address approved, uint256 tokenId) public {129 require(false, stub_error);130 approved;131 tokenId;132 dummy = 0;133 }134135 // Not implemented136 //137 // Selector: setApprovalForAll(address,bool) a22cb465138 function setApprovalForAll(address operator, bool approved) public {139 require(false, stub_error);140 operator;141 approved;142 dummy = 0;143 }144145 // Not implemented146 //147 // Selector: getApproved(uint256) 081812fc171 view148 function getApproved(uint256 tokenId) public view returns (address) {172 returns (uint256)173 {174 require(false, stub_error);149 require(false, stub_error);175 owner;150 tokenId;176 index;177 dummy;151 dummy;178 return 0;152 return 0x0000000000000000000000000000000000000000;179 }153 }180154181 // Selector: totalSupply() 18160ddd155 // Not implemented156 //157 // Selector: isApprovedForAll(address,address) e985e9c5182 function totalSupply() public view returns (uint256) {158 function isApprovedForAll(address owner, address operator)159 public160 view161 returns (address)162 {183 require(false, stub_error);163 require(false, stub_error);164 owner;165 operator;184 dummy;166 dummy;185 return 0;167 return 0x0000000000000000000000000000000000000000;186 }168 }187}169}188170171// Selector: 5b5e139f189contract ERC721Metadata is Dummy, ERC165 {172contract ERC721Metadata is Dummy, ERC165 {190 // Selector: name() 06fdde03173 // Selector: name() 06fdde03191 function name() public view returns (string memory) {174 function name() public view returns (string memory) {201 return "";184 return "";202 }185 }203186187 // Returns token's const_metadata188 //204 // Selector: tokenURI(uint256) c87b56dd189 // Selector: tokenURI(uint256) c87b56dd205 function tokenURI(uint256 tokenId) public view returns (string memory) {190 function tokenURI(uint256 tokenId) public view returns (string memory) {206 require(false, stub_error);191 require(false, stub_error);210 }195 }211}196}212197198// Selector: 68ccfe89213contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {199contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {214 // Selector: mintingFinished() 05d2035b200 // Selector: mintingFinished() 05d2035b215 function mintingFinished() public view returns (bool) {201 function mintingFinished() public view returns (bool) {218 return false;204 return false;219 }205 }220206207 // `token_id` should be obtained with `next_token_id` method,208 // unlike standard, you can't specify it manually209 //221 // Selector: mint(address,uint256) 40c10f19210 // Selector: mint(address,uint256) 40c10f19222 function mint(address to, uint256 tokenId) public returns (bool) {211 function mint(address to, uint256 tokenId) public returns (bool) {223 require(false, stub_error);212 require(false, stub_error);227 return false;216 return false;228 }217 }229218219 // `token_id` should be obtained with `next_token_id` method,220 // unlike standard, you can't specify it manually221 //230 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f222 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f231 function mintWithTokenURI(223 function mintWithTokenURI(232 address to,224 address to,241 return false;233 return false;242 }234 }243235236 // Not implemented237 //244 // Selector: finishMinting() 7d64bcb4238 // Selector: finishMinting() 7d64bcb4245 function finishMinting() public returns (bool) {239 function finishMinting() public returns (bool) {246 require(false, stub_error);240 require(false, stub_error);249 }243 }250}244}251245246// Selector: 780e9d63247contract ERC721Enumerable is Dummy, ERC165 {248 // Selector: tokenByIndex(uint256) 4f6ccce7249 function tokenByIndex(uint256 index) public view returns (uint256) {250 require(false, stub_error);251 index;252 dummy;253 return 0;254 }255256 // Not implemented257 //258 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59259 function tokenOfOwnerByIndex(address owner, uint256 index)260 public261 view262 returns (uint256)263 {264 require(false, stub_error);265 owner;266 index;267 dummy;268 return 0;269 }270271 // Selector: totalSupply() 18160ddd272 function totalSupply() public view returns (uint256) {273 require(false, stub_error);274 dummy;275 return 0;276 }277}278279// Selector: e562194d252contract ERC721UniqueExtensions is Dummy, ERC165 {280contract ERC721UniqueExtensions is Dummy, ERC165 {253 // Selector: transfer(address,uint256) a9059cbb281 // Selector: transfer(address,uint256) a9059cbb254 function transfer(address to, uint256 tokenId) public {282 function transfer(address to, uint256 tokenId) public {pallets/nonfungible/src/weights.rsdiffbeforeafterboth25#![cfg_attr(rustfmt, rustfmt_skip)]25#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]26#![allow(unused_parens)]27#![allow(unused_imports)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]282929use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use sp_std::marker::PhantomData;31use sp_std::marker::PhantomData;37 fn transfer() -> Weight;38 fn transfer() -> Weight;38 fn approve() -> Weight;39 fn approve() -> Weight;39 fn transfer_from() -> Weight;40 fn transfer_from() -> Weight;41 fn burn_from() -> Weight;40 fn set_variable_metadata(b: u32, ) -> Weight;42 fn set_variable_metadata(b: u32, ) -> Weight;41}43}424498 .saturating_add(T::DbWeight::get().reads(4 as Weight))100 .saturating_add(T::DbWeight::get().reads(4 as Weight))99 .saturating_add(T::DbWeight::get().writes(6 as Weight))101 .saturating_add(T::DbWeight::get().writes(6 as Weight))100 }102 }103 // Storage: Nonfungible Allowance (r:1 w:1)104 // Storage: Nonfungible TokenData (r:1 w:1)105 // Storage: Nonfungible TokensBurnt (r:1 w:1)106 // Storage: Nonfungible Owned (r:0 w:1)107 fn burn_from() -> Weight {108 (53_429_000 as Weight)109 .saturating_add(T::DbWeight::get().reads(3 as Weight))110 .saturating_add(T::DbWeight::get().writes(4 as Weight))111 }101 // Storage: Nonfungible TokenData (r:1 w:1)112 // Storage: Nonfungible TokenData (r:1 w:1)102 fn set_variable_metadata(_b: u32, ) -> Weight {113 fn set_variable_metadata(_b: u32, ) -> Weight {103 (6_380_000 as Weight)114 (6_380_000 as Weight)163 .saturating_add(RocksDbWeight::get().reads(4 as Weight))174 .saturating_add(RocksDbWeight::get().reads(4 as Weight))164 .saturating_add(RocksDbWeight::get().writes(6 as Weight))175 .saturating_add(RocksDbWeight::get().writes(6 as Weight))165 }176 }177 // Storage: Nonfungible Allowance (r:1 w:1)178 // Storage: Nonfungible TokenData (r:1 w:1)179 // Storage: Nonfungible TokensBurnt (r:1 w:1)180 // Storage: Nonfungible Owned (r:0 w:1)181 fn burn_from() -> Weight {182 (53_429_000 as Weight)183 .saturating_add(RocksDbWeight::get().reads(3 as Weight))184 .saturating_add(RocksDbWeight::get().writes(4 as Weight))185 }166 // Storage: Nonfungible TokenData (r:1 w:1)186 // Storage: Nonfungible TokenData (r:1 w:1)167 fn set_variable_metadata(_b: u32, ) -> Weight {187 fn set_variable_metadata(_b: u32, ) -> Weight {168 (6_380_000 as Weight)188 (6_380_000 as Weight)pallets/refungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-refungible"2name = "pallet-refungible"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies.codec]6[dependencies.codec]7default-features = false7default-features = falsepallets/refungible/src/benchmarking.rsdiffbeforeafterboth149 <Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 200)?;149 <Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 200)?;150 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, 200)?}150 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, 200)?}151152 // Both source account and token is destroyed153 burn_from {154 bench_init!{155 owner: sub; collection: collection(owner);156 owner: cross_from_sub; sender: cross_sub; burner: cross_sub;157 };158 let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;159 <Pallet<T>>::set_allowance(&collection, &sender, &burner, item, 200)?;160 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, 200)?}151161152 set_variable_metadata {162 set_variable_metadata {153 let b in 0..CUSTOM_DATA_LIMIT;163 let b in 0..CUSTOM_DATA_LIMIT;pallets/refungible/src/common.rsdiffbeforeafterboth58 }58 }595960 fn burn_from() -> Weight {60 fn burn_from() -> Weight {61 061 <SelfWeightOf<T>>::burn_from()62 }62 }636364 fn set_variable_metadata(bytes: u32) -> Weight {64 fn set_variable_metadata(bytes: u32) -> Weight {135 amount: u128,135 amount: u128,136 ) -> DispatchResultWithPostInfo {136 ) -> DispatchResultWithPostInfo {137 with_weight(137 with_weight(138 <Pallet<T>>::transfer(&self, &from, &to, token, amount),138 <Pallet<T>>::transfer(self, &from, &to, token, amount),139 <CommonWeights<T>>::transfer(),139 <CommonWeights<T>>::transfer(),140 )140 )141 }141 }148 amount: u128,148 amount: u128,149 ) -> DispatchResultWithPostInfo {149 ) -> DispatchResultWithPostInfo {150 with_weight(150 with_weight(151 <Pallet<T>>::set_allowance(&self, &sender, &spender, token, amount),151 <Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),152 <CommonWeights<T>>::approve(),152 <CommonWeights<T>>::approve(),153 )153 )154 }154 }162 amount: u128,162 amount: u128,163 ) -> DispatchResultWithPostInfo {163 ) -> DispatchResultWithPostInfo {164 with_weight(164 with_weight(165 <Pallet<T>>::transfer_from(&self, &sender, &from, &to, token, amount),165 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount),166 <CommonWeights<T>>::transfer_from(),166 <CommonWeights<T>>::transfer_from(),167 )167 )168 }168 }175 amount: u128,175 amount: u128,176 ) -> DispatchResultWithPostInfo {176 ) -> DispatchResultWithPostInfo {177 with_weight(177 with_weight(178 <Pallet<T>>::burn_from(&self, &sender, &from, token, amount),178 <Pallet<T>>::burn_from(self, &sender, &from, token, amount),179 <CommonWeights<T>>::burn_from(),179 <CommonWeights<T>>::burn_from(),180 )180 )181 }181 }188 ) -> DispatchResultWithPostInfo {188 ) -> DispatchResultWithPostInfo {189 let len = data.len();189 let len = data.len();190 with_weight(190 with_weight(191 <Pallet<T>>::set_variable_metadata(&self, &sender, token, data),191 <Pallet<T>>::set_variable_metadata(self, &sender, token, data),192 <CommonWeights<T>>::set_variable_metadata(len as u32),192 <CommonWeights<T>>::set_variable_metadata(len as u32),193 )193 )194 }194 }pallets/refungible/src/erc.rsdiffbeforeafterboth11 _source: &sp_core::H160,11 _source: &sp_core::H160,12 _input: &[u8],12 _input: &[u8],13 _value: sp_core::U256,13 _value: sp_core::U256,14 ) -> Option<pallet_common::erc::PrecompileOutput> {14 ) -> Option<pallet_common::erc::PrecompileResult> {15 // TODO: Implement RFT variant of ERC72115 // TODO: Implement RFT variant of ERC72116 None16 None17 }17 }27 _source: &sp_core::H160,27 _source: &sp_core::H160,28 _input: &[u8],28 _input: &[u8],29 _value: sp_core::U256,29 _value: sp_core::U256,30 ) -> Option<pallet_common::erc::PrecompileOutput> {30 ) -> Option<pallet_common::erc::PrecompileResult> {31 // TODO: Implement RFT variant of ERC2031 // TODO: Implement RFT variant of ERC2032 None32 None33 }33 }pallets/refungible/src/lib.rsdiffbeforeafterboth191 <Balance<T>>::remove_prefix((collection.id, token_id), None);191 <Balance<T>>::remove_prefix((collection.id, token_id), None);192 <Allowance<T>>::remove_prefix((collection.id, token_id), None);192 <Allowance<T>>::remove_prefix((collection.id, token_id), None);193 // TODO: ERC721 transfer event193 // TODO: ERC721 transfer event194 return Ok(());194 Ok(())195 }195 }196196197 pub fn burn(197 pub fn burn(361 sender: &T::CrossAccountId,361 sender: &T::CrossAccountId,362 data: Vec<CreateItemData<T>>,362 data: Vec<CreateItemData<T>>,363 ) -> DispatchResult {363 ) -> DispatchResult {364 let unrestricted_minting = collection.is_owner_or_admin(sender)?;364 if !collection.is_owner_or_admin(sender) {365 if !unrestricted_minting {366 ensure!(365 ensure!(367 collection.mint_mode,366 collection.mint_mode,368 <CommonError<T>>::PublicMintingNotAllowed367 <CommonError<T>>::PublicMintingNotAllowed369 );368 );370 collection.check_allowlist(sender)?;369 collection.check_allowlist(sender)?;371370372 for item in data.iter() {371 for item in data.iter() {373 for (user, _) in &item.users {372 for user in item.users.keys() {374 collection.check_allowlist(&user)?;373 collection.check_allowlist(user)?;375 }374 }376 }375 }377 }376 }412411413 let mut balances = BTreeMap::new();412 let mut balances = BTreeMap::new();414 for data in &data {413 for data in &data {415 for (owner, _) in &data.users {414 for owner in data.users.keys() {416 let balance = balances415 let balance = balances417 .entry(owner)416 .entry(owner)418 .or_insert_with(|| <AccountBalance<T>>::get((collection.id, owner)));417 .or_insert_with(|| <AccountBalance<T>>::get((collection.id, owner)));490 amount: u128,489 amount: u128,491 ) -> DispatchResult {490 ) -> DispatchResult {492 if collection.access == AccessMode::AllowList {491 if collection.access == AccessMode::AllowList {493 collection.check_allowlist(&sender)?;492 collection.check_allowlist(sender)?;494 collection.check_allowlist(&spender)?;493 collection.check_allowlist(spender)?;495 }494 }496495497 <PalletCommon<T>>::ensure_correct_receiver(spender)?;496 <PalletCommon<T>>::ensure_correct_receiver(spender)?;498497499 if <Balance<T>>::get((collection.id, token, sender)) < amount {498 if <Balance<T>>::get((collection.id, token, sender)) < amount {500 ensure!(499 ensure!(501 collection.ignores_owned_amount(sender)? && Self::token_exists(collection, token),500 collection.ignores_owned_amount(sender) && Self::token_exists(collection, token),502 <CommonError<T>>::CantApproveMoreThanOwned501 <CommonError<T>>::CantApproveMoreThanOwned503 );502 );504 }503 }529 <Allowance<T>>::get((collection.id, token, from, &spender)).checked_sub(amount);528 <Allowance<T>>::get((collection.id, token, from, &spender)).checked_sub(amount);530 if allowance.is_none() {529 if allowance.is_none() {531 ensure!(530 ensure!(532 collection.ignores_allowance(spender)?,531 collection.ignores_allowance(spender),533 <CommonError<T>>::TokenValueNotEnough532 <CommonError<T>>::TokenValueNotEnough534 );533 );535 }534 }562 <Allowance<T>>::get((collection.id, token, from, &spender)).checked_sub(amount);561 <Allowance<T>>::get((collection.id, token, from, &spender)).checked_sub(amount);563 if allowance.is_none() {562 if allowance.is_none() {564 ensure!(563 ensure!(565 collection.ignores_allowance(spender)?,564 collection.ignores_allowance(spender),566 <CommonError<T>>::TokenValueNotEnough565 <CommonError<T>>::TokenValueNotEnough567 );566 );568 }567 }591 &T::CrossAccountId::from_sub(collection.owner.clone()),590 &T::CrossAccountId::from_sub(collection.owner.clone()),592 )?;591 )?;593592594 collection.consume_sstore()?;595 let token_data = <TokenData<T>>::get((collection.id, token));593 let token_data = <TokenData<T>>::get((collection.id, token));596594597 // =========595 // =========pallets/refungible/src/weights.rsdiffbeforeafterboth25#![cfg_attr(rustfmt, rustfmt_skip)]25#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]26#![allow(unused_parens)]27#![allow(unused_imports)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]282929use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use sp_std::marker::PhantomData;31use sp_std::marker::PhantomData;44 fn transfer_from_creating() -> Weight;45 fn transfer_from_creating() -> Weight;45 fn transfer_from_removing() -> Weight;46 fn transfer_from_removing() -> Weight;46 fn transfer_from_creating_removing() -> Weight;47 fn transfer_from_creating_removing() -> Weight;48 fn burn_from() -> Weight;47 fn set_variable_metadata(b: u32, ) -> Weight;49 fn set_variable_metadata(b: u32, ) -> Weight;48}50}4951166 .saturating_add(T::DbWeight::get().reads(5 as Weight))168 .saturating_add(T::DbWeight::get().reads(5 as Weight))167 .saturating_add(T::DbWeight::get().writes(7 as Weight))169 .saturating_add(T::DbWeight::get().writes(7 as Weight))168 }170 }171 // Storage: Refungible Allowance (r:1 w:1)172 // Storage: Refungible TotalSupply (r:1 w:1)173 // Storage: Refungible Balance (r:1 w:1)174 // Storage: Refungible AccountBalance (r:1 w:1)175 // Storage: Refungible TokensBurnt (r:1 w:1)176 // Storage: Refungible TokenData (r:0 w:1)177 // Storage: Refungible Owned (r:0 w:1)178 fn burn_from() -> Weight {179 (60_903_000 as Weight)180 .saturating_add(T::DbWeight::get().reads(5 as Weight))181 .saturating_add(T::DbWeight::get().writes(7 as Weight))182 }169 // Storage: Refungible TokenData (r:1 w:1)183 // Storage: Refungible TokenData (r:1 w:1)170 fn set_variable_metadata(_b: u32, ) -> Weight {184 fn set_variable_metadata(_b: u32, ) -> Weight {171 (6_801_000 as Weight)185 (6_801_000 as Weight)292 .saturating_add(RocksDbWeight::get().reads(5 as Weight))306 .saturating_add(RocksDbWeight::get().reads(5 as Weight))293 .saturating_add(RocksDbWeight::get().writes(7 as Weight))307 .saturating_add(RocksDbWeight::get().writes(7 as Weight))294 }308 }309 // Storage: Refungible Allowance (r:1 w:1)310 // Storage: Refungible TotalSupply (r:1 w:1)311 // Storage: Refungible Balance (r:1 w:1)312 // Storage: Refungible AccountBalance (r:1 w:1)313 // Storage: Refungible TokensBurnt (r:1 w:1)314 // Storage: Refungible TokenData (r:0 w:1)315 // Storage: Refungible Owned (r:0 w:1)316 fn burn_from() -> Weight {317 (60_903_000 as Weight)318 .saturating_add(RocksDbWeight::get().reads(5 as Weight))319 .saturating_add(RocksDbWeight::get().writes(7 as Weight))320 }295 // Storage: Refungible TokenData (r:1 w:1)321 // Storage: Refungible TokenData (r:1 w:1)296 fn set_variable_metadata(_b: u32, ) -> Weight {322 fn set_variable_metadata(_b: u32, ) -> Weight {297 (6_801_000 as Weight)323 (6_801_000 as Weight)pallets/scheduler/Cargo.tomldiffbeforeafterboth2name = "pallet-unq-scheduler"2name = "pallet-unq-scheduler"3version = "0.1.0"3version = "0.1.0"4authors = ["Unique Network <support@uniquenetwork.io>"]4authors = ["Unique Network <support@uniquenetwork.io>"]5edition = "2018"5edition = "2021"6license = "All Rights Reserved"6license = "All Rights Reserved"7homepage = "https://unique.network"7homepage = "https://unique.network"8repository = "https://github.com/UniqueNetwork/unique-chain"8repository = "https://github.com/UniqueNetwork/unique-chain"pallets/scheduler/src/benchmarking.rsdiffbeforeafterboth33// Add `n` named items to the schedule33// Add `n` named items to the schedule34fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {34fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {35 // Essentially a no-op call.35 // Essentially a no-op call.36 let call = frame_system::Call::set_storage(vec![]);36 let call = frame_system::Call::set_storage { items: vec![] };37 for i in 0..n {37 for i in 0..n {38 // Named schedule is strictly heavier than anonymous38 // Named schedule is strictly heavier than anonymous39 Scheduler::<T>::do_schedule_named(39 Scheduler::<T>::do_schedule_named(61 let periodic = Some((T::BlockNumber::one(), 100));61 let periodic = Some((T::BlockNumber::one(), 100));62 let priority = 0;62 let priority = 0;63 // Essentially a no-op call.63 // Essentially a no-op call.64 let call = Box::new(frame_system::Call::set_storage(vec![]).into());64 let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());656566 fill_schedule::<T>(when, s)?;66 fill_schedule::<T>(when, s)?;67 }: _(RawOrigin::Root, when, periodic, priority, call)67 }: _(RawOrigin::Root, when, periodic, priority, call)98 let periodic = Some((T::BlockNumber::one(), 100));98 let periodic = Some((T::BlockNumber::one(), 100));99 let priority = 0;99 let priority = 0;100 // Essentially a no-op call.100 // Essentially a no-op call.101 let call = Box::new(frame_system::Call::set_storage(vec![]).into());101 let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());102102103 fill_schedule::<T>(when, s)?;103 fill_schedule::<T>(when, s)?;104 }: _(RawOrigin::Root, id, when, periodic, priority, call)104 }: _(RawOrigin::Root, id, when, periodic, priority, call)pallets/unique/Cargo.tomldiffbeforeafterboth127scale-info = { version = "1.0.0", default-features = false, features = [127scale-info = { version = "1.0.0", default-features = false, features = [128 "derive",128 "derive",129] }129] }130ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }130ethereum = { version = "0.10.0", default-features = false }131rlp = { default-features = false, version = "0.5.0" }131rlp = { default-features = false, version = "0.5.0" }132sp-api = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.12" }132sp-api = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.12" }133133139 "serde_no_std",139 "serde_no_std",140] }140] }141141142pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }142pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }143pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }143pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }144fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }144fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }145hex-literal = "0.3.3"145hex-literal = "0.3.3"146146147pallet-common = { default-features = false, path = "../common" }147pallet-common = { default-features = false, path = "../common" }pallets/unique/src/benchmarking.rsdiffbeforeafterboth155155156 let cl = CollectionLimits {156 let cl = CollectionLimits {157 account_token_ownership_limit: Some(0),157 account_token_ownership_limit: Some(0),158 sponsored_data_size: 0,158 sponsored_data_size: Some(0),159 token_limit: 1,159 token_limit: Some(1),160 sponsor_transfer_timeout: 0,160 sponsor_transfer_timeout: Some(0),161 sponsor_approve_timeout: None,161 owner_can_destroy: true,162 owner_can_destroy: Some(true),162 owner_can_transfer: true,163 owner_can_transfer: Some(true),163 sponsored_data_rate_limit: None,164 sponsored_data_rate_limit: None,165 transfers_enabled: Some(true),164 };166 };165 }: set_collection_limits(RawOrigin::Signed(caller.clone()), collection, cl)167 }: set_collection_limits(RawOrigin::Signed(caller.clone()), collection, cl)166168pallets/unique/src/dispatch.rsdiffbeforeafterboth83 _ => {}83 _ => {}84 }84 }858586 // TODO: Make submit_logs infallible, but it shouldn't fail here anyway87 dispatched86 dispatched.into_inner().submit_logs();88 .into_inner()89 .submit_logs()90 .expect("should succeed");91 result87 result92}88}9389pallets/unique/src/eth/mod.rsdiffbeforeafterboth1pub mod sponsoring;1pub mod sponsoring;223use fp_evm::PrecompileResult;3use pallet_common::{4use pallet_common::{4 CollectionById,5 CollectionById,5 erc::CommonEvmHandler,6 erc::CommonEvmHandler,10use pallet_refungible::{RefungibleHandle, erc::RefungibleTokenHandle};11use pallet_refungible::{RefungibleHandle, erc::RefungibleTokenHandle};11use sp_std::borrow::ToOwned;12use sp_std::borrow::ToOwned;12use sp_std::vec::Vec;13use sp_std::vec::Vec;13use pallet_evm::{PrecompileOutput};14use sp_core::{H160, U256};14use sp_core::{H160, U256};15use crate::{CollectionMode, Config, dispatch::Dispatched};15use crate::{CollectionMode, Config, dispatch::Dispatched};16use pallet_common::CollectionHandle;16use pallet_common::CollectionHandle;54 gas_limit: u64,54 gas_limit: u64,55 input: &[u8],55 input: &[u8],56 value: U256,56 value: U256,57 ) -> Option<PrecompileOutput> {57 ) -> Option<PrecompileResult> {58 if let Some(collection_id) = map_eth_to_id(target) {58 if let Some(collection_id) = map_eth_to_id(target) {59 let collection = <CollectionHandle<T>>::new_with_gas_limit(collection_id, gas_limit)?;59 let collection = <CollectionHandle<T>>::new_with_gas_limit(collection_id, gas_limit)?;60 let dispatched = Dispatched::dispatch(collection);60 let dispatched = Dispatched::dispatch(collection);pallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth27 let (method_id, mut reader) = AbiReader::new_call(&call.1).ok()?;27 let (method_id, mut reader) = AbiReader::new_call(&call.1).ok()?;28 match &collection.mode {28 match &collection.mode {29 crate::CollectionMode::NFT => {29 crate::CollectionMode::NFT => {30 let call = UniqueNFTCall::parse(method_id, &mut reader).ok()??;30 let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;31 match call {31 match call {32 UniqueNFTCall::ERC721UniqueExtensions(32 UniqueNFTCall::ERC721UniqueExtensions(33 ERC721UniqueExtensionsCall::Transfer { token_id, .. },33 ERC721UniqueExtensionsCall::Transfer { token_id, .. },49 }49 }50 }50 }51 crate::CollectionMode::Fungible(_) => {51 crate::CollectionMode::Fungible(_) => {52 let call = UniqueFungibleCall::parse(method_id, &mut reader).ok()??;52 let call = <UniqueFungibleCall<T>>::parse(method_id, &mut reader).ok()??;53 #[allow(clippy::single_match)]53 #[allow(clippy::single_match)]54 match call {54 match call {55 UniqueFungibleCall::ERC20(ERC20Call::Transfer { .. }) => {55 UniqueFungibleCall::ERC20(ERC20Call::Transfer { .. }) => {pallets/unique/src/lib.rsdiffbeforeafterboth16pub use serde::{Serialize, Deserialize};16pub use serde::{Serialize, Deserialize};171718pub use frame_support::{18pub use frame_support::{19 construct_runtime, decl_module, decl_storage, decl_error,19 construct_runtime, decl_module, decl_storage, decl_error, decl_event,20 dispatch::DispatchResult,20 dispatch::DispatchResult,21 ensure, fail, parameter_types,21 ensure, fail, parameter_types,22 traits::{22 traits::{97 + Sized98 + Sized98 + TypeInfo99 + TypeInfo99{100{101 type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;102100 /// Weight information for extrinsics in this pallet.103 /// Weight information for extrinsics in this pallet.101 type WeightInfo: WeightInfo;104 type WeightInfo: WeightInfo;102}105}106107decl_event! {108 pub enum Event<T>109 where110 <T as frame_system::Config>::AccountId,111 <T as pallet_common::Config>::CrossAccountId,112 {113 /// Collection sponsor was removed114 ///115 /// # Arguments116 ///117 /// * collection_id: Globally unique collection identifier.118 CollectionSponsorRemoved(CollectionId),119120 /// Collection admin was added121 ///122 /// # Arguments123 ///124 /// * collection_id: Globally unique collection identifier.125 ///126 /// * admin: Admin address.127 CollectionAdminAdded(CollectionId, CrossAccountId),128129 /// Collection owned was change130 ///131 /// # Arguments132 ///133 /// * collection_id: Globally unique collection identifier.134 ///135 /// * owner: New owner address.136 CollectionOwnedChanged(CollectionId, AccountId),137138 /// Collection sponsor was set139 ///140 /// # Arguments141 ///142 /// * collection_id: Globally unique collection identifier.143 ///144 /// * owner: New sponsor address.145 CollectionSponsorSet(CollectionId, AccountId),146147 /// const on chain schema was set148 ///149 /// # Arguments150 ///151 /// * collection_id: Globally unique collection identifier.152 ConstOnChainSchemaSet(CollectionId),153154 /// New sponsor was confirm155 ///156 /// # Arguments157 ///158 /// * collection_id: Globally unique collection identifier.159 ///160 /// * sponsor: New sponsor address.161 SponsorshipConfirmed(CollectionId, AccountId),162163 /// Collection admin was removed164 ///165 /// # Arguments166 ///167 /// * collection_id: Globally unique collection identifier.168 ///169 /// * admin: Admin address.170 CollectionAdminRemoved(CollectionId, CrossAccountId),171172 /// Address was remove from allow list173 ///174 /// # Arguments175 ///176 /// * collection_id: Globally unique collection identifier.177 ///178 /// * user: Address.179 AllowListAddressRemoved(CollectionId, CrossAccountId),180181 /// Address was add to allow list182 ///183 /// # Arguments184 ///185 /// * collection_id: Globally unique collection identifier.186 ///187 /// * user: Address.188 AllowListAddressAdded(CollectionId, CrossAccountId),189190 /// Collection limits was set191 ///192 /// # Arguments193 ///194 /// * collection_id: Globally unique collection identifier.195 CollectionLimitSet(CollectionId),196197 /// Mint permission was set198 ///199 /// # Arguments200 ///201 /// * collection_id: Globally unique collection identifier.202 MintPermissionSet(CollectionId),203204 /// Offchain schema was set205 ///206 /// # Arguments207 ///208 /// * collection_id: Globally unique collection identifier.209 OffchainSchemaSet(CollectionId),210211 /// Public access mode was set212 ///213 /// # Arguments214 ///215 /// * collection_id: Globally unique collection identifier.216 ///217 /// * mode: New access state.218 PublicAccessModeSet(CollectionId, AccessMode),219220 /// Schema version was set221 ///222 /// # Arguments223 ///224 /// * collection_id: Globally unique collection identifier.225 SchemaVersionSet(CollectionId),226227 /// Variable on chain schema was set228 ///229 /// # Arguments230 ///231 /// * collection_id: Globally unique collection identifier.232 VariableOnChainSchemaSet(CollectionId),233 }234}103235104type SelfWeightOf<T> = <T as Config>::WeightInfo;236type SelfWeightOf<T> = <T as Config>::WeightInfo;105237162 {294 {163 type Error = Error<T>;295 type Error = Error<T>;296297 fn deposit_event() = default;164298165 fn on_initialize(_now: T::BlockNumber) -> Weight {299 fn on_initialize(_now: T::BlockNumber) -> Weight {166 0300 0195329196 // Create new collection330 // Create new collection197 let new_collection = Collection {331 let new_collection = Collection {198 owner: who.clone(),332 owner: who,199 name: collection_name,333 name: collection_name,200 mode: mode.clone(),334 mode: mode.clone(),201 mint_mode: false,335 mint_mode: false,289 true,423 true,290 )?;424 )?;425426 Self::deposit_event(Event::<T>::AllowListAddressAdded(427 collection_id,428 address429 ));291430292 Ok(())431 Ok(())293 }432 }318 false,457 false,319 )?;458 )?;459460 <Pallet<T>>::deposit_event(Event::<T>::AllowListAddressRemoved(461 collection_id,462 address463 ));320464321 Ok(())465 Ok(())322 }466 }341 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;485 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;342 target_collection.check_is_owner(&sender)?;486 target_collection.check_is_owner(&sender)?;343487344 target_collection.access = mode;488 target_collection.access = mode.clone();489490 <Pallet<T>>::deposit_event(Event::<T>::PublicAccessModeSet(491 collection_id,492 mode493 ));494345 target_collection.save()495 target_collection.save()346 }496 }369519370 target_collection.mint_mode = mint_permission;520 target_collection.mint_mode = mint_permission;521522 <Pallet<T>>::deposit_event(Event::<T>::MintPermissionSet(523 collection_id524 ));525371 target_collection.save()526 target_collection.save()372 }527 }391 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;546 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;392 target_collection.check_is_owner(&sender)?;547 target_collection.check_is_owner(&sender)?;393548394 target_collection.owner = new_owner;549 target_collection.owner = new_owner.clone();550 <Pallet<T>>::deposit_event(Event::<T>::CollectionOwnedChanged(551 collection_id,552 new_owner553 ));554395 target_collection.save()555 target_collection.save()396 }556 }414 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);574 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);415 let collection = <CollectionHandle<T>>::try_get(collection_id)?;575 let collection = <CollectionHandle<T>>::try_get(collection_id)?;576577 <Pallet<T>>::deposit_event(Event::<T>::CollectionAdminAdded(578 collection_id,579 new_admin_id.clone()580 ));416581417 <PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)582 <PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)418 }583 }435 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);600 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);436 let collection = <CollectionHandle<T>>::try_get(collection_id)?;601 let collection = <CollectionHandle<T>>::try_get(collection_id)?;602603 <Pallet<T>>::deposit_event(Event::<T>::CollectionAdminRemoved(604 collection_id,605 account_id.clone()606 ));437607438 <PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)608 <PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)439 }609 }455 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;625 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;456 target_collection.check_is_owner(&sender)?;626 target_collection.check_is_owner(&sender)?;457627458 target_collection.sponsorship = SponsorshipState::Unconfirmed(new_sponsor);628 target_collection.sponsorship = SponsorshipState::Unconfirmed(new_sponsor.clone());629630 <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(631 collection_id,632 new_sponsor633 ));634459 target_collection.save()635 target_collection.save()460 }636 }477 Error::<T>::ConfirmUnsetSponsorFail653 Error::<T>::ConfirmUnsetSponsorFail478 );654 );479655480 target_collection.sponsorship = SponsorshipState::Confirmed(sender);656 target_collection.sponsorship = SponsorshipState::Confirmed(sender.clone());657658 <Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(659 collection_id,660 sender661 ));662481 target_collection.save()663 target_collection.save()482 }664 }500682501 target_collection.sponsorship = SponsorshipState::Disabled;683 target_collection.sponsorship = SponsorshipState::Disabled;684685 <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorRemoved(686 collection_id687 ));502 target_collection.save()688 target_collection.save()503 }689 }504690794 target_collection.check_is_owner_or_admin(&sender)?;980 target_collection.check_is_owner_or_admin(&sender)?;795 target_collection.schema_version = version;981 target_collection.schema_version = version;982983 <Pallet<T>>::deposit_event(Event::<T>::SchemaVersionSet(984 collection_id985 ));986796 target_collection.save()987 target_collection.save()797 }988 }8241015825 target_collection.offchain_schema = schema;1016 target_collection.offchain_schema = schema;10171018 <Pallet<T>>::deposit_event(Event::<T>::OffchainSchemaSet(1019 collection_id1020 ));1021826 target_collection.save()1022 target_collection.save()827 }1023 }8541050855 target_collection.const_on_chain_schema = schema;1051 target_collection.const_on_chain_schema = schema;10521053 <Pallet<T>>::deposit_event(Event::<T>::ConstOnChainSchemaSet(1054 collection_id1055 ));1056856 target_collection.save()1057 target_collection.save()857 }1058 }8841085885 target_collection.variable_on_chain_schema = schema;1086 target_collection.variable_on_chain_schema = schema;10871088 <Pallet<T>>::deposit_event(Event::<T>::VariableOnChainSchemaSet(1089 collection_id1090 ));1091886 target_collection.save()1092 target_collection.save()887 }1093 }9491155950 target_collection.limits = new_limit;1156 target_collection.limits = new_limit;11571158 <Pallet<T>>::deposit_event(Event::<T>::CollectionLimitSet(1159 collection_id1160 ));9511161952 target_collection.save()1162 target_collection.save()953 }1163 }pallets/unique/src/mock.rsdiffbeforeafterboth1#![allow(clippy::from_over_into)]1#![allow(clippy::from_over_into)]223use crate as pallet_template;3use crate as pallet_template;4use sp_core::H256;4use sp_core::{H160, H256};5use frame_support::{parameter_types, traits::Everything, weights::IdentityFee};5use frame_support::{parameter_types, traits::Everything, weights::IdentityFee};6use sp_runtime::{6use sp_runtime::{7 traits::{BlakeTwo256, IdentityLookup},7 traits::{BlakeTwo256, IdentityLookup},159pub struct TestEtheremTransactionSender;159pub struct TestEtheremTransactionSender;160impl pallet_ethereum::EthereumTransactionSender for TestEtheremTransactionSender {160impl pallet_ethereum::EthereumTransactionSender for TestEtheremTransactionSender {161 fn submit_logs_transaction(161 fn submit_logs_transaction(162 _source: H160,162 _tx: pallet_ethereum::Transaction,163 _tx: pallet_ethereum::Transaction,163 _logs: Vec<pallet_ethereum::Log>,164 _logs: Vec<pallet_ethereum::Log>,164 ) -> Result<(), sp_runtime::DispatchError> {165 ) {165 Ok(())166 }166 }167}167}168168169impl pallet_evm_coder_substrate::Config for Test {169impl pallet_evm_coder_substrate::Config for Test {170 type EthereumTransactionSender = TestEtheremTransactionSender;170 type EthereumTransactionSender = TestEtheremTransactionSender;171 type GasWeightMapping = ();171}172}172173173impl pallet_common::Config for Test {174impl pallet_common::Config for Test {pallets/unique/src/tests.rsdiffbeforeafterboth2247#[test]2247#[test]2248fn create_max_collections() {2248fn create_max_collections() {2249 new_test_ext().execute_with(|| {2249 new_test_ext().execute_with(|| {2250 for i in 1..=COLLECTION_NUMBER_LIMIT {2250 for i in 1..COLLECTION_NUMBER_LIMIT {2251 create_test_collection(&CollectionMode::NFT, CollectionId(i));2251 create_test_collection(&CollectionMode::NFT, CollectionId(i));2252 }2252 }2253 });2253 });2259 new_test_ext().execute_with(|| {2259 new_test_ext().execute_with(|| {2260 let origin1 = Origin::signed(1);2260 let origin1 = Origin::signed(1);226122612262 for i in 1..=COLLECTION_NUMBER_LIMIT {2262 for i in 1..COLLECTION_NUMBER_LIMIT {2263 create_test_collection(&CollectionMode::NFT, CollectionId(i));2263 create_test_collection(&CollectionMode::NFT, CollectionId(i));2264 }2264 }22652265pallets/unique/src/weights.rsdiffbeforeafterboth25#![cfg_attr(rustfmt, rustfmt_skip)]25#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]26#![allow(unused_parens)]27#![allow(unused_imports)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]282929use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use sp_std::marker::PhantomData;31use sp_std::marker::PhantomData;primitives/data-structs/Cargo.tomldiffbeforeafterboth2name = "up-data-structs"2name = "up-data-structs"3authors = ["Unique Network <support@uniquenetwork.io>"]3authors = ["Unique Network <support@uniquenetwork.io>"]4description = "Unique data structs definitions"4description = "Unique data structs definitions"5edition = "2018"5edition = "2021"6license = 'All Rights Reserved'6license = 'All Rights Reserved'7homepage = "https://unique.network"7homepage = "https://unique.network"8repository = 'https://github.com/UniqueNetwork/unique-chain'8repository = 'https://github.com/UniqueNetwork/unique-chain'primitives/data-structs/src/lib.rsdiffbeforeafterboth31pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;31pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;323233pub const MAX_TOKEN_OWNERSHIP: u32 = if cfg!(not(feature = "limit-testing")) {33pub const MAX_TOKEN_OWNERSHIP: u32 = if cfg!(not(feature = "limit-testing")) {34 10_000_00034 100_00035} else {35} else {36 1036 1037};37};61pub const SPONSOR_APPROVE_TIMEOUT: u32 = 5;61pub const SPONSOR_APPROVE_TIMEOUT: u32 = 5;626263// Schema limits63// Schema limits64pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 1024;64pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;65pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 1024;65pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;66pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 1024;66pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 1048576;676768pub const MAX_COLLECTION_NAME_LENGTH: usize = 64;68pub const MAX_COLLECTION_NAME_LENGTH: usize = 64;69pub const MAX_COLLECTION_DESCRIPTION_LENGTH: usize = 256;69pub const MAX_COLLECTION_DESCRIPTION_LENGTH: usize = 256;331 D: ser::Serializer,331 D: ser::Serializer,332 V: Serialize,332 V: Serialize,333 {333 {334 let vec: &Vec<_> = &value;334 (value as &Vec<_>).serialize(serializer)335 vec.serialize(serializer)336 }335 }337336338 pub fn deserialize<'de, D, V, S>(deserializer: D) -> Result<BoundedVec<V, S>, D::Error>337 pub fn deserialize<'de, D, V, S>(deserializer: D) -> Result<BoundedVec<V, S>, D::Error>primitives/evm-mapping/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "up-evm-mapping"2name = "up-evm-mapping"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies]6[dependencies]7sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }7sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }primitives/rpc/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "up-rpc"2name = "up-rpc"3version = "0.1.0"3version = "0.1.0"4edition = "2018"4edition = "2021"556[dependencies]6[dependencies]7pallet-common = { default-features = false, path = '../../pallets/common' }7pallet-common = { default-features = false, path = '../../pallets/common' }runtime/Cargo.tomldiffbeforeafterboth23 'frame-support/runtime-benchmarks',23 'frame-support/runtime-benchmarks',24 'frame-system-benchmarking',24 'frame-system-benchmarking',25 'frame-system/runtime-benchmarks',25 'frame-system/runtime-benchmarks',26 'pallet-ethereum/runtime-benchmarks',26 'pallet-evm-migration/runtime-benchmarks',27 'pallet-evm-migration/runtime-benchmarks',28 'pallet-evm-coder-substrate/runtime-benchmarks',27 'pallet-balances/runtime-benchmarks',29 'pallet-balances/runtime-benchmarks',28 'pallet-timestamp/runtime-benchmarks',30 'pallet-timestamp/runtime-benchmarks',29 'pallet-common/runtime-benchmarks',31 'pallet-common/runtime-benchmarks',391pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }393pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }392pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }394pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }393395394pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }396pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }395pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }397pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }396fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }398fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }397fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }399fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }398400399################################################################################401################################################################################400# Build Dependencies402# Build Dependenciesruntime/src/lib.rsdiffbeforeafterboth65};65};66use smallvec::smallvec;66use smallvec::smallvec;67use codec::{Encode, Decode};67use codec::{Encode, Decode};68use pallet_evm::{Account as EVMAccount, FeeCalculator, OnMethodCall};68use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};69use fp_rpc::TransactionStatus;69use fp_rpc::TransactionStatus;70use sp_core::crypto::Public;70use sp_core::crypto::Public;71use sp_runtime::{71use sp_runtime::{242pub struct FixedFee;242pub struct FixedFee;243impl FeeCalculator for FixedFee {243impl FeeCalculator for FixedFee {244 fn min_gas_price() -> U256 {244 fn min_gas_price() -> U256 {245 // Targeting 0.15 UNQ per transfer245 1.into()246 1_024_947_215_000u64.into()246 }247 }247}248}249250// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case251// (contract, which only writes a lot of data),252// approximating on top of our real store write weight253parameter_types! {254 pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;255 pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;256 pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();257}258259/// Limiting EVM execution to 50% of block for substrate users and management tasks260/// EVM transaction consumes more weight than substrate's, so we can't rely on them being261/// scheduled fairly262const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);263parameter_types! {264 pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());265}266267pub enum FixedGasWeightMapping {}268impl GasWeightMapping for FixedGasWeightMapping {269 fn gas_to_weight(gas: u64) -> Weight {270 gas.saturating_mul(WeightPerGas::get())271 }272 fn weight_to_gas(weight: Weight) -> u64 {273 weight / WeightPerGas::get()274 }275}248276249impl pallet_evm::Config for Runtime {277impl pallet_evm::Config for Runtime {250 type BlockGasLimit = BlockGasLimit;278 type BlockGasLimit = BlockGasLimit;251 type FeeCalculator = FixedFee;279 type FeeCalculator = FixedFee;252 type GasWeightMapping = ();280 type GasWeightMapping = FixedGasWeightMapping;253 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;281 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;254 type CallOrigin = EnsureAddressTruncated;282 type CallOrigin = EnsureAddressTruncated;255 type WithdrawOrigin = EnsureAddressTruncated;283 type WithdrawOrigin = EnsureAddressTruncated;288 }316 }289}317}290291parameter_types! {292 pub BlockGasLimit: U256 = U256::from(u32::max_value());293}294318295impl pallet_ethereum::Config for Runtime {319impl pallet_ethereum::Config for Runtime {296 type Event = Event;320 type Event = Event;297 type StateRoot = pallet_ethereum::IntermediateStateRoot;321 type StateRoot = pallet_ethereum::IntermediateStateRoot;298 type EvmSubmitLog = pallet_evm::Pallet<Self>;299}322}300323301impl pallet_randomness_collective_flip::Config for Runtime {}324impl pallet_randomness_collective_flip::Config for Runtime {}380 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;403 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;381}404}382405383pub const MICROUNIQUE: Balance = 1_000_000_000;406pub const MICROUNIQUE: Balance = 1_000_000_000_000;384pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;407pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;385pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;408pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;386pub const UNIQUE: Balance = 100 * CENTIUNIQUE;409pub const UNIQUE: Balance = 100 * CENTIUNIQUE;457480458 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {481 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {459 smallvec!(WeightToFeeCoefficient {482 smallvec!(WeightToFeeCoefficient {483 // Targeting 0.1 Unique per NFT transfer460 coeff_integer: 146_700u32.into(), // Targeting 0.1 Unique per NFT transfer484 coeff_integer: 142_688_000u32.into(),461 coeff_frac: Perbill::zero(),485 coeff_frac: Perbill::zero(),462 negative: false,486 negative: false,463 degree: 1,487 degree: 1,686710687impl pallet_evm_coder_substrate::Config for Runtime {711impl pallet_evm_coder_substrate::Config for Runtime {688 type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;712 type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;713 type GasWeightMapping = FixedGasWeightMapping;689}714}690715691impl pallet_xcm::Config for Runtime {716impl pallet_xcm::Config for Runtime {756}781}757782758impl pallet_unique::Config for Runtime {783impl pallet_unique::Config for Runtime {784 type Event = Event;759 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;785 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;760}786}761787856882857 // Unique Pallets883 // Unique Pallets858 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,884 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,859 Unique: pallet_unique::{Pallet, Call, Storage} = 61,885 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,860 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,886 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,861 // free = 63887 // free = 63862 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,888 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1151 EVM::account_storages(address, H256::from_slice(&tmp[..]))1177 EVM::account_storages(address, H256::from_slice(&tmp[..]))1152 }1178 }115311791180 #[allow(clippy::redundant_closure)]1154 fn call(1181 fn call(1155 from: H160,1182 from: H160,1156 to: H160,1183 to: H160,1181 ).map_err(|err| err.into())1208 ).map_err(|err| err.into())1182 }1209 }118312101211 #[allow(clippy::redundant_closure)]1184 fn create(1212 fn create(1185 from: H160,1213 from: H160,1186 data: Vec<u8>,1214 data: Vec<u8>,1342 list_benchmark!(list, extra, pallet_fungible, Fungible);1370 list_benchmark!(list, extra, pallet_fungible, Fungible);1343 list_benchmark!(list, extra, pallet_refungible, Refungible);1371 list_benchmark!(list, extra, pallet_refungible, Refungible);1344 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1372 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1373 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);134513741346 let storage_info = AllPalletsWithSystem::storage_info();1375 let storage_info = AllPalletsWithSystem::storage_info();134713761375 add_benchmark!(params, batches, pallet_fungible, Fungible);1404 add_benchmark!(params, batches, pallet_fungible, Fungible);1376 add_benchmark!(params, batches, pallet_refungible, Refungible);1405 add_benchmark!(params, batches, pallet_refungible, Refungible);1377 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1406 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1407 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);137814081379 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1409 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1380 Ok(batches)1410 Ok(batches)smart_contracs/transfer/Cargo.tomldiffbeforeafterboth2name = "nft_transfer"2name = "nft_transfer"3version = "0.1.0"3version = "0.1.0"4authors = ["[Greg Zaitsev] <[your_email]>"]4authors = ["[Greg Zaitsev] <[your_email]>"]5edition = "2018"5edition = "2021"667[workspace]7[workspace]88tests/README.mddiffbeforeafterboth8git checkout release-v0.9.128git checkout release-v0.9.129```9```1010112. Build with nightly-2021-06-28112. Build with nightly-2021-11-1112```bash12```bash13cargo build --release13cargo build --release14```14```281. Run `yarn install`.281. Run `yarn install`.292. Optional step - configure tests with env variables or by editing [configuration file](src/config.ts).292. Optional step - configure tests with env variables or by editing [configuration file](src/config.ts).303. Run `yarn test`.303. Run `yarn test`.313231tests/flipper-src/Cargo.tomldiffbeforeafterboth2name = "flipper"2name = "flipper"3version = "3.0.0-rc1"3version = "3.0.0-rc1"4authors = ["Parity Technologies <admin@parity.io>"]4authors = ["Parity Technologies <admin@parity.io>"]5edition = "2018"5edition = "2021"667[dependencies]7[dependencies]8ink_primitives = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false }8ink_primitives = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false }tests/ink-types-node-runtime/Cargo.tomldiffbeforeafterboth2name = "ink_types_node_runtime"2name = "ink_types_node_runtime"3version = "0.1.0"3version = "0.1.0"4authors = ["Parity Technologies <admin@parity.io>"]4authors = ["Parity Technologies <admin@parity.io>"]5edition = "2018"5edition = "2021"667license = "GPL-3.0"7license = "GPL-3.0"8readme = "README.md"8readme = "README.md"tests/ink-types-node-runtime/examples/calls/.ink/abi_gen/Cargo.tomldiffbeforeafterboth2name = "abi-gen"2name = "abi-gen"3version = "0.1.0"3version = "0.1.0"4authors = ["Parity Technologies <admin@parity.io>"]4authors = ["Parity Technologies <admin@parity.io>"]5edition = "2018"5edition = "2021"6publish = false6publish = false778[[bin]]8[[bin]]tests/ink-types-node-runtime/examples/calls/Cargo.tomldiffbeforeafterboth2name = "calls"2name = "calls"3version = "0.1.0"3version = "0.1.0"4authors = ["Parity Technologies <admin@parity.io>"]4authors = ["Parity Technologies <admin@parity.io>"]5edition = "2018"5edition = "2021"667[dependencies]7[dependencies]8ink_abi = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_abi", default-features = false, features = ["derive"], optional = true }8ink_abi = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_abi", default-features = false, features = ["derive"], optional = true }tests/loadtester-src/Cargo.tomldiffbeforeafterboth2name = "loadtester"2name = "loadtester"3version = "0.1.0"3version = "0.1.0"4authors = ["[your_name] <[your_email]>"]4authors = ["[your_name] <[your_email]>"]5edition = "2018"5edition = "2021"667[dependencies]7[dependencies]8ink_primitives = { version = "3.0.0-rc2", default-features = false }8ink_primitives = { version = "3.0.0-rc2", default-features = false }tests/src/confirmSponsorship.test.tsdiffbeforeafterboth21 normalizeAccountId,21 normalizeAccountId,22 addCollectionAdminExpectSuccess,22 addCollectionAdminExpectSuccess,23 getCreatedCollectionCount,23 getCreatedCollectionCount,24 UNIQUE,24} from './util/helpers';25} from './util/helpers';25import {Keyring} from '@polkadot/api';26import {Keyring} from '@polkadot/api';26import {IKeyringPair} from '@polkadot/types/types';27import {IKeyringPair} from '@polkadot/types/types';198 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();199 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();199200200 // Try again after Zero gets some balance - now it should succeed201 // Try again after Zero gets some balance - now it should succeed201 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);202 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);202 await submitTransactionAsync(alice, balancetx);203 await submitTransactionAsync(alice, balancetx);203 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);204 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);204 const result2 = getGenericResult(events2);205 const result2 = getGenericResult(events2);232 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();233 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();233234234 // Try again after Zero gets some balance - now it should succeed235 // Try again after Zero gets some balance - now it should succeed235 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);236 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);236 await submitTransactionAsync(alice, balancetx);237 await submitTransactionAsync(alice, balancetx);237 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);238 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);238 const result2 = getGenericResult(events2);239 const result2 = getGenericResult(events2);268 expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);269 expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);269270270 // Try again after Zero gets some balance - now it should succeed271 // Try again after Zero gets some balance - now it should succeed271 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);272 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);272 await submitTransactionAsync(alice, balancetx);273 await submitTransactionAsync(alice, balancetx);273 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);274 const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);274 const result2 = getGenericResult(events2);275 const result2 = getGenericResult(events2);307 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();308 const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();308309309 // Try again after Zero gets some balance - now it should succeed310 // Try again after Zero gets some balance - now it should succeed310 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);311 const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);311 await submitTransactionAsync(alice, balancetx);312 await submitTransactionAsync(alice, balancetx);312 await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);313 await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);313314tests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth154 const aliceBalanceAfter: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();154 const aliceBalanceAfter: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();155 const fee = aliceBalanceBefore - aliceBalanceAfter;155 const fee = aliceBalanceBefore - aliceBalanceAfter;156156157 expect(fee / 10n ** 15n < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;157 expect(fee / UNIQUE < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;158 expect(fee / 10n ** 15n < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;158 expect(fee / UNIQUE < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;159 });159 });160 });160 });161161173 const fee = Number(aliceBalanceBefore - aliceBalanceAfter) / Number(UNIQUE);174 const fee = Number(aliceBalanceBefore - aliceBalanceAfter) / Number(UNIQUE);174175 const expectedTransferFee = 0.1;175 const expectedTransferFee = 0.1;176 // fee drifts because of NextFeeMultiplier176 const tolerance = 0.001;177 const tolerance = 0.001;178177 expect(Number(fee) / Number(UNIQUE) - expectedTransferFee).to.be.lessThan(tolerance);179 expect(Math.abs(fee - expectedTransferFee)).to.be.lessThan(tolerance);178 });180 });179 });181 });180182tests/src/eth/api/ContractHelpers.soldiffbeforeafterboth12 function supportsInterface(bytes4 interfaceID) external view returns (bool);12 function supportsInterface(bytes4 interfaceID) external view returns (bool);13}13}141415// Selector: 31acb1fe15interface ContractHelpers is Dummy, ERC165 {16interface ContractHelpers is Dummy, ERC165 {16 // Selector: contractOwner(address) 5152b14c17 // Selector: contractOwner(address) 5152b14c17 function contractOwner(address contractAddress)18 function contractOwner(address contractAddress)tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth22 );22 );23}23}242425// Selector: 942e8b2225interface ERC20 is Dummy, ERC165, ERC20Events {26interface ERC20 is Dummy, ERC165, ERC20Events {26 // Selector: name() 06fdde0327 // Selector: name() 06fdde0327 function name() external view returns (string memory);28 function name() external view returns (string memory);tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth42 event MintingFinished();42 event MintingFinished();43}43}444445interface ERC721 is Dummy, ERC165, ERC721Events {45// Selector: 42966c6846 // Selector: balanceOf(address) 70a0823147 function balanceOf(address owner) external view returns (uint256);4849 // Selector: ownerOf(uint256) 6352211e50 function ownerOf(uint256 tokenId) external view returns (address);5152 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167253 function safeTransferFromWithData(54 address from,55 address to,56 uint256 tokenId,57 bytes memory data58 ) external;5960 // Selector: safeTransferFrom(address,address,uint256) 42842e0e61 function safeTransferFrom(62 address from,63 address to,64 uint256 tokenId65 ) external;6667 // Selector: transferFrom(address,address,uint256) 23b872dd68 function transferFrom(69 address from,70 address to,71 uint256 tokenId72 ) external;7374 // Selector: approve(address,uint256) 095ea7b375 function approve(address approved, uint256 tokenId) external;7677 // Selector: setApprovalForAll(address,bool) a22cb46578 function setApprovalForAll(address operator, bool approved) external;7980 // Selector: getApproved(uint256) 081812fc81 function getApproved(uint256 tokenId) external view returns (address);8283 // Selector: isApprovedForAll(address,address) e985e9c584 function isApprovedForAll(address owner, address operator)85 external86 view87 returns (address);88}8990interface ERC721Burnable is Dummy, ERC165 {46interface ERC721Burnable is Dummy, ERC165 {91 // Selector: burn(uint256) 42966c6847 // Selector: burn(uint256) 42966c6892 function burn(uint256 tokenId) external;48 function burn(uint256 tokenId) external;93}49}945051// Selector: 5880016195interface ERC721Enumerable is Dummy, ERC165 {52interface ERC721 is Dummy, ERC165, ERC721Events {96 // Selector: tokenByIndex(uint256) 4f6ccce753 // Selector: balanceOf(address) 70a0823197 function tokenByIndex(uint256 index) external view returns (uint256);54 function balanceOf(address owner) external view returns (uint256);5556 // Selector: ownerOf(uint256) 6352211e57 function ownerOf(uint256 tokenId) external view returns (address);5859 // Not implemented60 //61 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167262 function safeTransferFromWithData(63 address from,64 address to,65 uint256 tokenId,66 bytes memory data67 ) external;6869 // Not implemented70 //71 // Selector: safeTransferFrom(address,address,uint256) 42842e0e72 function safeTransferFrom(73 address from,74 address to,75 uint256 tokenId76 ) external;987799 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c5978 // Selector: transferFrom(address,address,uint256) 23b872dd100 function tokenOfOwnerByIndex(address owner, uint256 index)79 function transferFrom(80 address from,81 address to,82 uint256 tokenId83 ) external;8485 // Selector: approve(address,uint256) 095ea7b3101 external86 function approve(address approved, uint256 tokenId) external;8788 // Not implemented89 //90 // Selector: setApprovalForAll(address,bool) a22cb46591 function setApprovalForAll(address operator, bool approved) external;9293 // Not implemented94 //95 // Selector: getApproved(uint256) 081812fc102 view96 function getApproved(uint256 tokenId) external view returns (address);103 returns (uint256);9710498 // Not implemented105 // Selector: totalSupply() 18160ddd99 //100 // Selector: isApprovedForAll(address,address) e985e9c5106 function totalSupply() external view returns (uint256);101 function isApprovedForAll(address owner, address operator)102 external103 view104 returns (address);107}105}108106107// Selector: 5b5e139f109interface ERC721Metadata is Dummy, ERC165 {108interface ERC721Metadata is Dummy, ERC165 {110 // Selector: name() 06fdde03109 // Selector: name() 06fdde03111 function name() external view returns (string memory);110 function name() external view returns (string memory);112111113 // Selector: symbol() 95d89b41112 // Selector: symbol() 95d89b41114 function symbol() external view returns (string memory);113 function symbol() external view returns (string memory);115114115 // Returns token's const_metadata116 //116 // Selector: tokenURI(uint256) c87b56dd117 // Selector: tokenURI(uint256) c87b56dd117 function tokenURI(uint256 tokenId) external view returns (string memory);118 function tokenURI(uint256 tokenId) external view returns (string memory);118}119}119120121// Selector: 68ccfe89120interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {122interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {121 // Selector: mintingFinished() 05d2035b123 // Selector: mintingFinished() 05d2035b122 function mintingFinished() external view returns (bool);124 function mintingFinished() external view returns (bool);123125126 // `token_id` should be obtained with `next_token_id` method,127 // unlike standard, you can't specify it manually128 //124 // Selector: mint(address,uint256) 40c10f19129 // Selector: mint(address,uint256) 40c10f19125 function mint(address to, uint256 tokenId) external returns (bool);130 function mint(address to, uint256 tokenId) external returns (bool);126131132 // `token_id` should be obtained with `next_token_id` method,133 // unlike standard, you can't specify it manually134 //127 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f135 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f128 function mintWithTokenURI(136 function mintWithTokenURI(129 address to,137 address to,130 uint256 tokenId,138 uint256 tokenId,131 string memory tokenUri139 string memory tokenUri132 ) external returns (bool);140 ) external returns (bool);133141142 // Not implemented143 //134 // Selector: finishMinting() 7d64bcb4144 // Selector: finishMinting() 7d64bcb4135 function finishMinting() external returns (bool);145 function finishMinting() external returns (bool);136}146}137147148// Selector: 780e9d63149interface ERC721Enumerable is Dummy, ERC165 {150 // Selector: tokenByIndex(uint256) 4f6ccce7151 function tokenByIndex(uint256 index) external view returns (uint256);152153 // Not implemented154 //155 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59156 function tokenOfOwnerByIndex(address owner, uint256 index)157 external158 view159 returns (uint256);160161 // Selector: totalSupply() 18160ddd162 function totalSupply() external view returns (uint256);163}164165// Selector: e562194d138interface ERC721UniqueExtensions is Dummy, ERC165 {166interface ERC721UniqueExtensions is Dummy, ERC165 {139 // Selector: transfer(address,uint256) a9059cbb167 // Selector: transfer(address,uint256) a9059cbb140 function transfer(address to, uint256 tokenId) external;168 function transfer(address to, uint256 tokenId) external;tests/src/eth/base.test.tsdiffbeforeafterboth112import {createEthAccount, createEthAccountWithBalance, deployFlipper, ethBalanceViaSub, GAS_ARGS, itWeb3, recordEthFee} from './util/helpers';2import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, deployFlipper, ethBalanceViaSub, GAS_ARGS, itWeb3, recordEthFee} from './util/helpers';3import {expect} from 'chai';3import {expect} from 'chai';4import {UNIQUE} from '../util/helpers';4import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../util/helpers';5import nonFungibleAbi from './nonFungibleAbi.json';6import privateKey from '../substrate/privateKey';576describe('Contract calls', () => {8describe('Contract calls', () => {7 itWeb3('Call of simple contract fee is less than 0.2 UNQ', async ({web3, api}) => {9 itWeb3('Call of simple contract fee is less than 0.2 UNQ', async ({web3, api}) => {20 expect(cost - await ethBalanceViaSub(api, userB) < BigInt(0.2 * Number(UNIQUE))).to.be.true;22 expect(cost - await ethBalanceViaSub(api, userB) < BigInt(0.2 * Number(UNIQUE))).to.be.true;21 });23 });2425 itWeb3('NFT transfer is close to 0.15 UNQ', async ({web3, api}) => {26 const caller = await createEthAccountWithBalance(api, web3);27 const receiver = createEthAccount(web3);2829 const alice = privateKey('//Alice');30 const collection = await createCollectionExpectSuccess({31 mode: {type: 'NFT'},32 });33 const itemId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});3435 const address = collectionIdToAddress(collection);36 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});3738 const cost = await recordEthFee(api, caller, () => contract.methods.transfer(receiver, itemId).send(caller));3940 const fee = Number(cost) / Number(UNIQUE);41 const expectedFee = 0.15;42 const tolerance = 0.00001;4344 expect(Math.abs(fee - expectedFee)).to.be.lessThan(tolerance);45 });22});46});2347tests/src/eth/fungible.test.tsdiffbeforeafterboth95 const alice = privateKey('//Alice');95 const alice = privateKey('//Alice');969697 const owner = createEthAccount(web3);97 const owner = createEthAccount(web3);98 await transferBalanceToEth(api, alice, owner, 999999999999999);98 await transferBalanceToEth(api, alice, owner);9999100 await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Ethereum: owner});100 await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Ethereum: owner});101101102 const spender = createEthAccount(web3);102 const spender = createEthAccount(web3);103 await transferBalanceToEth(api, alice, spender, 999999999999999);103 await transferBalanceToEth(api, alice, spender);104104105 const receiver = createEthAccount(web3);105 const receiver = createEthAccount(web3);106106153 const alice = privateKey('//Alice');153 const alice = privateKey('//Alice');154154155 const owner = createEthAccount(web3);155 const owner = createEthAccount(web3);156 await transferBalanceToEth(api, alice, owner, 999999999999999);156 await transferBalanceToEth(api, alice, owner);157157158 await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Ethereum: owner});158 await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Ethereum: owner});159159160 const receiver = createEthAccount(web3);160 const receiver = createEthAccount(web3);161 await transferBalanceToEth(api, alice, receiver, 999999999999999);161 await transferBalanceToEth(api, alice, receiver);162162163 const address = collectionIdToAddress(collection);163 const address = collectionIdToAddress(collection);164 const contract = new web3.eth.Contract(fungibleAbi as any, address, {from: owner, ...GAS_ARGS});164 const contract = new web3.eth.Contract(fungibleAbi as any, address, {from: owner, ...GAS_ARGS});tests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterboth1import {readFile} from 'fs/promises';1import {readFile} from 'fs/promises';2import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';2import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';3import privateKey from '../../substrate/privateKey';3import privateKey from '../../substrate/privateKey';4import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';4import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionLimitsExpectSuccess, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';5import {collectionIdToAddress, contractHelpers, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase, transferBalanceToEth} from '../util/helpers';5import {collectionIdToAddress, contractHelpers, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase, transferBalanceToEth} from '../util/helpers';6import {evmToAddress} from '@polkadot/util-crypto';6import {evmToAddress} from '@polkadot/util-crypto';7import nonFungibleAbi from '../nonFungibleAbi.json';7import nonFungibleAbi from '../nonFungibleAbi.json';13describe('Matcher contract usage', () => {13describe('Matcher contract usage', () => {14 itWeb3('With UNQ', async ({api, web3}) => {14 itWeb3('With UNQ', async ({api, web3}) => {15 const alice = privateKey('//Alice');15 const alice = privateKey('//Alice');16 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});17 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId));18 const matcherOwner = await createEthAccountWithBalance(api, web3);16 const matcherOwner = await createEthAccountWithBalance(api, web3);19 const helpers = contractHelpers(web3, matcherOwner);2021 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {17 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {22 from: matcherOwner,18 from: matcherOwner,23 ...GAS_ARGS,19 ...GAS_ARGS,24 });20 });25 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments:[matcherOwner]}).send({from: matcherOwner});21 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments:[matcherOwner]}).send({from: matcherOwner});2622 const helpers = contractHelpers(web3, matcherOwner);27 await transferBalanceToEth(api, alice, matcher.options.address);23 await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});28 await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});24 await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});2930 await transferBalanceToEth(api, alice, subToEth(alice.address));25 await transferBalanceToEth(api, alice, matcher.options.address);2627 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});28 await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorApproveTimeout: 1});29 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});31 await setCollectionSponsorExpectSuccess(collectionId, alice.address);30 await setCollectionSponsorExpectSuccess(collectionId, alice.address);31 await transferBalanceToEth(api, alice, subToEth(alice.address));32 await confirmSponsorshipExpectSuccess(collectionId);32 await confirmSponsorshipExpectSuccess(collectionId);333334 const seller = privateKey('//Seller/' + Date.now());34 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});35 await addToAllowListExpectSuccess(alice, collectionId, {Ethereum:subToEth(seller.address)});35 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));3637 const seller = privateKey(`//Seller/${Date.now()}`);36 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});38 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});373938 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);40 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);394140 // To transfer item to matcher it first needs to be transfered to EVM account of seller42 // To transfer item to matcher it first needs to be transfered to EVM account of bob41 await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});43 await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});4445 // Token is owned by seller initially42 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});46 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});434744 // Ask48 // Ask45 {49 {46 await executeEthTxOnSub(api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));50 await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));47 await executeEthTxOnSub(api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));51 await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));48 }52 }495350 // Token is transferred to matcher54 // Token is transferred to matcher53 // Buy57 // Buy54 {58 {55 const sellerBalanceBeforePurchase = await getBalanceSingle(api, seller.address);59 const sellerBalanceBeforePurchase = await getBalanceSingle(api, seller.address);56 await executeEthTxOnSub(api, alice, matcher, m => m.buy(evmCollection.options.address, tokenId), {value: PRICE});60 await executeEthTxOnSub(web3, api, alice, matcher, m => m.buy(evmCollection.options.address, tokenId), {value: PRICE});57 expect(await getBalanceSingle(api, seller.address) - sellerBalanceBeforePurchase === PRICE);61 expect(await getBalanceSingle(api, seller.address) - sellerBalanceBeforePurchase === PRICE);58 }62 }5963697370 // selling for custom tokens excluded from release74 // selling for custom tokens excluded from release71 itWeb3.skip('With custom ERC20', async ({api, web3}) => {75 itWeb3.skip('With custom ERC20', async ({api, web3}) => {76 const alice = privateKey('//Alice');72 const matcherOwner = await createEthAccountWithBalance(api, web3);77 const matcherOwner = await createEthAccountWithBalance(api, web3);73 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {78 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {74 from: matcherOwner,79 from: matcherOwner,75 ...GAS_ARGS,80 ...GAS_ARGS,76 });81 });77 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});82 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});788379 const alice = privateKey('//Alice');80 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});84 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});81 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});85 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});828699103100 // Ask104 // Ask101 {105 {102 await executeEthTxOnSub(api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));106 await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));103 await executeEthTxOnSub(api, seller, matcher, m => m.setAsk(PRICE, evmFungible.options.address, evmCollection.options.address, tokenId, 1));107 await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, evmFungible.options.address, evmCollection.options.address, tokenId, 1));104 }108 }105109106 // Token is transferred to matcher110 // Token is transferred to matcher111 const sellerBalanceBeforePurchase = BigInt(await evmFungible.methods.balanceOf(subToEth(seller.address)).call());115 const sellerBalanceBeforePurchase = BigInt(await evmFungible.methods.balanceOf(subToEth(seller.address)).call());112 const buyerBalanceBeforePurchase = BigInt(await evmFungible.methods.balanceOf(subToEth(alice.address)).call());116 const buyerBalanceBeforePurchase = BigInt(await evmFungible.methods.balanceOf(subToEth(alice.address)).call());113117114 await executeEthTxOnSub(api, alice, evmFungible, m => m.approve(matcher.options.address, PRICE));118 await executeEthTxOnSub(web3, api, alice, evmFungible, m => m.approve(matcher.options.address, PRICE));115 // There is two functions named 'buy', so we should provide full signature119 // There is two functions named 'buy', so we should provide full signature116 await executeEthTxOnSub(api, alice, matcher, m =>120 await executeEthTxOnSub(web3, api, alice, matcher, m =>117 m['buy(address,uint256,address,uint256)'](evmCollection.options.address, tokenId, evmFungible.options.address, PRICE));121 m['buy(address,uint256,address,uint256)'](evmCollection.options.address, tokenId, evmFungible.options.address, PRICE));118122119 // Approved price is removed from buyer balance, and added to seller123 // Approved price is removed from buyer balance, and added to seller134138135 itWeb3('With escrow', async ({api, web3}) => {139 itWeb3('With escrow', async ({api, web3}) => {136 const alice = privateKey('//Alice');140 const alice = privateKey('//Alice');137 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});138 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId));139 const matcherOwner = await createEthAccountWithBalance(api, web3);141 const matcherOwner = await createEthAccountWithBalance(api, web3);140 const helpers = contractHelpers(web3, matcherOwner);141 const escrow = await createEthAccountWithBalance(api, web3);142 const escrow = await createEthAccountWithBalance(api, web3);142143 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {143 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {144 from: matcherOwner,144 from: matcherOwner,145 ...GAS_ARGS,145 ...GAS_ARGS,146 });146 });147 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});147 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner, gas: 10000000});148 await matcher.methods.setEscrow(escrow).send({from: matcherOwner});148 await matcher.methods.setEscrow(escrow).send({from: matcherOwner});149149 const helpers = contractHelpers(web3, matcherOwner);150 await transferBalanceToEth(api, alice, matcher.options.address);150 await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});151 await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});151 await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});152153 await transferBalanceToEth(api, alice, subToEth(alice.address));152 await transferBalanceToEth(api, alice, matcher.options.address);153154 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});155 await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorApproveTimeout: 1});156 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});154 await setCollectionSponsorExpectSuccess(collectionId, alice.address);157 await setCollectionSponsorExpectSuccess(collectionId, alice.address);155 await confirmSponsorshipExpectSuccess(collectionId);158 await transferBalanceToEth(api, alice, subToEth(alice.address));156157 const seller = privateKey('//Seller/' + Date.now());159 await confirmSponsorshipExpectSuccess(collectionId);160158 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});161 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});159 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));162 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));163164 const seller = privateKey(`//Seller/${Date.now()}`);165 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});160166161 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);167 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);162168163 // To transfer item to matcher it first needs to be transfered to EVM account of seller169 // To transfer item to matcher it first needs to be transfered to EVM account of bob164 await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});170 await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});171172 // Token is owned by seller initially165 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});173 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});166174167 // Ask175 // Ask168 {176 {169 await executeEthTxOnSub(api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));177 await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));170 await executeEthTxOnSub(api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));178 await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));171 }179 }172180173 // Token is transferred to matcher181 // Token is transferred to matcher181 expect(await matcher.methods.balanceKSM(subToEth(seller.address)).call()).to.be.equal('0');189 expect(await matcher.methods.balanceKSM(subToEth(seller.address)).call()).to.be.equal('0');182 expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal(PRICE.toString());190 expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal(PRICE.toString());183191184 await executeEthTxOnSub(api, alice, matcher, m => m.buyKSM(evmCollection.options.address, tokenId, subToEth(alice.address), subToEth(alice.address)));192 await executeEthTxOnSub(web3, api, alice, matcher, m => m.buyKSM(evmCollection.options.address, tokenId, subToEth(alice.address), subToEth(alice.address)));185193186 // Price is removed from buyer balance, and added to seller194 // Price is removed from buyer balance, and added to seller187 expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal('0');195 expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal('0');tests/src/eth/nonFungible.test.tsdiffbeforeafterboth203 const alice = privateKey('//Alice');203 const alice = privateKey('//Alice');204204205 const owner = createEthAccount(web3);205 const owner = createEthAccount(web3);206 await transferBalanceToEth(api, alice, owner, 999999999999999);206 await transferBalanceToEth(api, alice, owner);207207208 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});208 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});209209213 const contract = new web3.eth.Contract(nonFungibleAbi as any, address);213 const contract = new web3.eth.Contract(nonFungibleAbi as any, address);214214215 {215 {216 const result = await contract.methods.approve(spender, tokenId).send({from: owner, gas: '0x1000000', gasPrice: '0x01'});216 const result = await contract.methods.approve(spender, tokenId).send({from: owner, ...GAS_ARGS});217 const events = normalizeEvents(result.events);217 const events = normalizeEvents(result.events);218218219 expect(events).to.be.deep.equal([219 expect(events).to.be.deep.equal([237 const alice = privateKey('//Alice');237 const alice = privateKey('//Alice');238238239 const owner = createEthAccount(web3);239 const owner = createEthAccount(web3);240 await transferBalanceToEth(api, alice, owner, 999999999999999);240 await transferBalanceToEth(api, alice, owner);241241242 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});242 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});243243244 const spender = createEthAccount(web3);244 const spender = createEthAccount(web3);245 await transferBalanceToEth(api, alice, spender, 999999999999999);245 await transferBalanceToEth(api, alice, spender);246246247 const receiver = createEthAccount(web3);247 const receiver = createEthAccount(web3);248248285 const alice = privateKey('//Alice');285 const alice = privateKey('//Alice');286286287 const owner = createEthAccount(web3);287 const owner = createEthAccount(web3);288 await transferBalanceToEth(api, alice, owner, 999999999999999);288 await transferBalanceToEth(api, alice, owner);289289290 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});290 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});291291292 const receiver = createEthAccount(web3);292 const receiver = createEthAccount(web3);293 await transferBalanceToEth(api, alice, receiver, 999999999999999);293 await transferBalanceToEth(api, alice, receiver);294294295 const address = collectionIdToAddress(collection);295 const address = collectionIdToAddress(collection);296 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: owner, ...GAS_ARGS});296 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: owner, ...GAS_ARGS});tests/src/eth/payable.test.tsdiffbeforeafterboth1import {expect} from 'chai';1import {expect} from 'chai';2import privateKey from '../substrate/privateKey';2import privateKey from '../substrate/privateKey';3import {submitTransactionAsync} from '../substrate/substrate-api';3import {submitTransactionAsync} from '../substrate/substrate-api';4import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth} from './util/helpers';4import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth, transferBalanceToEth} from './util/helpers';5import {evmToAddress} from '@polkadot/util-crypto';5import {evmToAddress} from '@polkadot/util-crypto';6import {getGenericResult} from '../util/helpers';6import {getGenericResult} from '../util/helpers';7import {getBalanceSingle, transferBalanceExpectSuccess} from '../substrate/get-balance';7import {getBalanceSingle, transferBalanceExpectSuccess} from '../substrate/get-balance';232324 // Transaction fee/value will be payed from subToEth(sender) evm balance,24 // Transaction fee/value will be payed from subToEth(sender) evm balance,25 // which is backed by evmToAddress(subToEth(sender)) substrate balance25 // which is backed by evmToAddress(subToEth(sender)) substrate balance26 await transferBalanceExpectSuccess(api, alice, evmToAddress(subToEth(alice.address)), '1000000000000');26 await transferBalanceToEth(api, alice, subToEth(alice.address));272728 {28 {29 const tx = api.tx.evm.call(29 const tx = api.tx.evm.call(32 contract.methods.giveMoney().encodeABI(),32 contract.methods.giveMoney().encodeABI(),33 '10000',33 '10000',34 GAS_ARGS.gas,34 GAS_ARGS.gas,35 GAS_ARGS.gasPrice,35 await web3.eth.getGasPrice(),36 null,36 null,37 );37 );38 const events = await submitTransactionAsync(alice, tx);38 const events = await submitTransactionAsync(alice, tx);tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth224 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});224 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});225225226 {226 {227 const result = await contract.methods.approve(spender, tokenId).send({from: caller, gas: '0x1000000', gasPrice: '0x01'});227 const result = await contract.methods.approve(spender, tokenId).send({from: caller, ...GAS_ARGS});228 const events = normalizeEvents(result.events);228 const events = normalizeEvents(result.events);229229230 expect(events).to.be.deep.equal([230 expect(events).to.be.deep.equal([tests/src/eth/util/helpers.tsdiffbeforeafterboth12import usingApi, {submitTransactionAsync} from '../../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../../substrate/substrate-api';13import {IKeyringPair} from '@polkadot/types/types';13import {IKeyringPair} from '@polkadot/types/types';14import {expect} from 'chai';14import {expect} from 'chai';15import {getGenericResult} from '../../util/helpers';15import {getGenericResult, UNIQUE} from '../../util/helpers';16import * as solc from 'solc';16import * as solc from 'solc';17import config from '../../config';17import config from '../../config';18import privateKey from '../../substrate/privateKey';18import privateKey from '../../substrate/privateKey';19import contractHelpersAbi from './contractHelpersAbi.json';19import contractHelpersAbi from './contractHelpersAbi.json';20import getBalance from '../../substrate/get-balance';20import getBalance from '../../substrate/get-balance';212122export const GAS_ARGS = {gas: 0x1000000, gasPrice: '0x01'};22export const GAS_ARGS = {gas: 2500000};232324let web3Connected = false;24let web3Connected = false;25export async function usingWeb3<T>(cb: (web3: Web3) => Promise<T> | T): Promise<T> {25export async function usingWeb3<T>(cb: (web3: Web3) => Promise<T> | T): Promise<T> {63 return account;63 return account;64}64}656566export async function transferBalanceToEth(api: ApiPromise, source: IKeyringPair, target: string, amount = 999999999999999) {66export async function transferBalanceToEth(api: ApiPromise, source: IKeyringPair, target: string, amount = 1000n * UNIQUE) {67 const tx = api.tx.balances.transfer(evmToAddress(target), amount);67 const tx = api.tx.balances.transfer(evmToAddress(target), amount);68 const events = await submitTransactionAsync(source, tx);68 const events = await submitTransactionAsync(source, tx);69 const result = getGenericResult(events);69 const result = getGenericResult(events);228 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});228 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});229}229}230230231/**231/**232 * Execute ethereum method call using substrate account232 * Execute ethereum method call using substrate account233 * @param to target contract233 * @param to target contract234 * @param mkTx - closure, receiving `contract.methods`, and returning method call,234 * @param mkTx - closure, receiving `contract.methods`, and returning method call,235 * to be used as following (assuming `to` = erc20 contract):235 * to be used as following (assuming `to` = erc20 contract):236 * `m => m.transfer(to, amount)`236 * `m => m.transfer(to, amount)`237 * 237 *238 * # Example238 * # Example239 * ```ts239 * ```ts240 * executeEthTxOnSub(api, alice, erc20Contract, m => m.transfer(target, amount));240 * executeEthTxOnSub(api, alice, erc20Contract, m => m.transfer(target, amount));241 * ```241 * ```242 */242 */243export async function executeEthTxOnSub(api: ApiPromise, from: IKeyringPair, to: any, mkTx: (methods: any) => any, {value = 0}: {value?: bigint | number} = { }) {243export async function executeEthTxOnSub(web3: Web3, api: ApiPromise, from: IKeyringPair, to: any, mkTx: (methods: any) => any, {value = 0}: {value?: bigint | number} = { }) {244 const tx = api.tx.evm.call(244 const tx = api.tx.evm.call(245 subToEth(from.address),245 subToEth(from.address),246 to.options.address,246 to.options.address,247 mkTx(to.methods).encodeABI(),247 mkTx(to.methods).encodeABI(),248 value,248 value,249 GAS_ARGS.gas,249 GAS_ARGS.gas,250 GAS_ARGS.gasPrice,250 await web3.eth.getGasPrice(),251 null,251 null,252 );252 );253 const events = await submitTransactionAsync(from, tx);253 const events = await submitTransactionAsync(from, tx);258 return (await getBalance(api, [evmToAddress(address)]))[0];258 return (await getBalance(api, [evmToAddress(address)]))[0];259}259}260260261/**261/**262 * Measure how much gas given closure consumes262 * Measure how much gas given closure consumes263 * 263 *264 * @param user which user balance will be checked264 * @param user which user balance will be checked265 */265 */266export async function recordEthFee(api: ApiPromise, user: string, call: () => Promise<any>): Promise<bigint> {266export async function recordEthFee(api: ApiPromise, user: string, call: () => Promise<any>): Promise<bigint> {267 const before = await ethBalanceViaSub(api, user);267 const before = await ethBalanceViaSub(api, user);268268tests/src/util/helpers.tsdiffbeforeafterboth696970export const U128_MAX = (1n << 128n) - 1n;70export const U128_MAX = (1n << 128n) - 1n;717172const MICROUNIQUE = 1_000_000_000n;72const MICROUNIQUE = 1_000_000_000_000n;73const MILLIUNIQUE = 1_000n * MICROUNIQUE;73const MILLIUNIQUE = 1_000n * MICROUNIQUE;74const CENTIUNIQUE = 10n * MILLIUNIQUE;74const CENTIUNIQUE = 10n * MILLIUNIQUE;75export const UNIQUE = 100n * CENTIUNIQUE;75export const UNIQUE = 100n * CENTIUNIQUE;