From 031ace10f62ce80cf2f4221f8aa61f6fed6a74b8 Mon Sep 17 00:00:00 2001 From: Maar-io Date: Tue, 19 Jul 2022 17:14:20 +0200 Subject: [PATCH] Shiden upgraded to V4 --- .../shiden/.openzeppelin/unknown-31337.json | 174 +- .../shiden/.openzeppelin/unknown-336.json | 226 ++ contract/shiden/Astar_flat.sol | 3211 +++++++++++++++++ contract/shiden/abi.json | 60 +- .../{AstarBaseV3.sol => AstarBaseV4.sol} | 0 contract/shiden/scripts/upgrade.js | 4 +- ...starBase_flat.sol => AstarBaseV4_flat.sol} | 0 contract/shiden/test/console_test_upgrade.md | 13 +- 8 files changed, 3579 insertions(+), 109 deletions(-) create mode 100644 contract/shiden/Astar_flat.sol rename contract/shiden/contracts/{AstarBaseV3.sol => AstarBaseV4.sol} (100%) rename contract/shiden/shiden_not_upgradable/{AstarBase_flat.sol => AstarBaseV4_flat.sol} (100%) diff --git a/contract/shiden/.openzeppelin/unknown-31337.json b/contract/shiden/.openzeppelin/unknown-31337.json index 1b0512c..d537791 100644 --- a/contract/shiden/.openzeppelin/unknown-31337.json +++ b/contract/shiden/.openzeppelin/unknown-31337.json @@ -2,77 +2,77 @@ "manifestVersion": "3.2", "admin": { "address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512", - "txHash": "0xc240e5c29295cbb14f3c2ff4bbc06a9d7163d40e80abb0e497df3508b60db761" + "txHash": "0x71e61dff6cdc9e7d890a06a4be40901989678eeafc520590d8b76af33ce0e011" }, "proxies": [ { "address": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0", - "txHash": "0x3652f9685939d3b3d7b38a0bfbb80ae21fefdb1fdc353437069fe3d6218f93f5", + "txHash": "0x1d01b2d68cffdfd3e0df812bf7d01ea8366635ae78228134aadc3fcdcc8787f3", "kind": "transparent" }, { "address": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707", - "txHash": "0x40016b34383a315270fd7fcb6b301eba8a221f69d4ab4d1831512e3e4fab5db0", + "txHash": "0xce9a408f210d6a025a989305f9ff05dd66812efc0e07fdd1c7ec9ee69b3bad21", "kind": "transparent" }, { "address": "0x9A676e781A523b5d0C0e43731313A708CB607508", - "txHash": "0x33cebe109b06fee64d05b9e34a9685f98e294ceac7d58dd014f4fb66cb8d964f", + "txHash": "0x30480917724fec66a15f6ea79439025bd2adeb3e36606abb41318630f7de7dcb", "kind": "transparent" }, { "address": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1", - "txHash": "0x29e969553116c9e9554729919dbcfb2b92d6915880c4f985bb2d0ddd675e7493", + "txHash": "0xfa93664b84c63a3885b6f96cbe6906bf80aeee635711142df4f7b01566855cd2", "kind": "transparent" }, { "address": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E", - "txHash": "0xb3eb41f9e242cbeb9297692237785fcff7c9dfd396f54437f50570f325313070", + "txHash": "0x42f26d94ebf89afa8a9d6260990449e843288820b8e233acf82af402975e6d8b", "kind": "transparent" }, { "address": "0x95401dc811bb5740090279Ba06cfA8fcF6113778", - "txHash": "0x8b6ede61a608c4336168476d6d5597113f4becc159da6a7927baafed35d16b1a", + "txHash": "0x47ba2b3adfe6babb6967723950fac6b3dad6ac0026c335ae5f4e8c138979e21b", "kind": "transparent" }, { "address": "0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00", - "txHash": "0x4776ac29affb0a4ac92a23f891d5ecd9c3b8c680d3a37b46b1640f22a401d6d8", + "txHash": "0xa80dd0f33494937913a1b9386aca9efc74bdeddc199f0a73a1d633760ec07a19", "kind": "transparent" }, { "address": "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1", - "txHash": "0x2b8db3d287feee22d6606d4ebec0ff7f9f39defde6a1dafda3813fedc3475d05", + "txHash": "0x60e475f7bae2c068b2cf5aa39c944bbe765ad98bab79dffa7b96c75848855c1b", "kind": "transparent" }, { "address": "0xB0D4afd8879eD9F52b28595d31B441D079B2Ca07", - "txHash": "0x4ae6b059b58e704c33f0c6d4f51e9d6c2a62b44594e930b574a2780efe258a6d", + "txHash": "0xfdf0b49d4246023df9d760e09e49aaa75dd2a48c6de92612631f1485d04fb7ec", "kind": "transparent" }, { "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", - "txHash": "0xfe5ee29b2812c0b022faf483b3f32421d66434b34b246fc75f6314fec7ab120c", + "txHash": "0x8364b4a1566d0c0e40ef95b1f4393f3d72a151fd01fc269cebb32a4f423e9b8d", "kind": "transparent" }, { "address": "0x202CCe504e04bEd6fC0521238dDf04Bc9E8E15aB", - "txHash": "0x8f3de4848671873c93aa9138ccf1b6c69b836fc51f009ebe6cb5341c3163f1db", + "txHash": "0x1857564a63e8067a77ffc4e1078060868a6804da505848a2da6c45e2457fdaed", "kind": "transparent" }, { "address": "0xC9a43158891282A2B1475592D5719c001986Aaec", - "txHash": "0x6d9991b7a99567ce3dac38200a5d83199e68159f8ad8ffb221f8fd2f6e3d7f87", + "txHash": "0xd82401a52ccbe6ee197736a06374d287fe1df6583d126896e02148a7c90d8578", "kind": "transparent" }, { "address": "0xf953b3A269d80e3eB0F2947630Da976B896A8C5b", - "txHash": "0xa96a15b146de90cb114491f4a8490379ca0243f4d69adb974fc6d3bd6902b785", + "txHash": "0xe5e7222f22364056c8fb20206522e5c47d25f4911805983415e09af6924006a2", "kind": "transparent" }, { "address": "0xCace1b78160AE76398F486c8a18044da0d66d86D", - "txHash": "0x6d6053320d63b0e6fc4f2d3f99c596b3a12b68ba45f14156323c446d56150971", + "txHash": "0xd8c5106289e8541e21660d5ecb65a8dff7a4d92cea5925ae0ccaf4c582921703", "kind": "transparent" }, { @@ -102,9 +102,9 @@ } ], "impls": { - "c7f42606d6a3e5590882027cb67efe4089814aa6f5fee18c36d266901d4618f3": { - "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", - "txHash": "0x02d0382d1e15fa2c5115650913e093492dedf9b591e8f67b619cfc8e2d49b7cd", + "a68827f5e2bbc4440fa3ad5f1022ea4e6c42f53c38404c2484c5e33a59ca78b3": { + "address": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", + "txHash": "0x1405a2f0eb9e320582d9fe099482b3717f33a3286a4aa8b9653ec942cca20fa8", "layout": { "storage": [ { @@ -152,112 +152,104 @@ "offset": 0, "slot": "101", "type": "t_struct(Counter)488_storage", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:19" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:15" }, { "label": "version", "offset": 0, "slot": "102", "type": "t_uint256", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:20" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:16" }, { "label": "PREFIX", "offset": 0, "slot": "103", "type": "t_bytes_storage", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:21" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:17" }, { "label": "POSTFIX", "offset": 0, "slot": "104", "type": "t_bytes_storage", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:22" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:18" }, { "label": "MSG_PREFIX", "offset": 0, "slot": "105", "type": "t_string_storage", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:23" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:19" }, { "label": "beneficiary", "offset": 0, "slot": "106", "type": "t_address", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:24" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:20" }, { "label": "unregisterFee", "offset": 0, "slot": "107", "type": "t_uint256", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:25" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:21" }, { "label": "paused", "offset": 0, "slot": "108", "type": "t_bool", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:26" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:22" }, { "label": "addressMap", "offset": 0, "slot": "109", "type": "t_mapping(t_address,t_bytes_storage)", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:27" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:23" }, { "label": "ss58Map", "offset": 0, "slot": "110", "type": "t_mapping(t_bytes_memory_ptr,t_address)", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:28" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:24" }, { "label": "DAPPS_STAKING", "offset": 0, "slot": "111", "type": "t_contract(DappsStaking)2606", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:29" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:25" }, { "label": "SR25519Contract", "offset": 0, "slot": "112", "type": "t_contract(SR25519)3198", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:30" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:26" }, { "label": "ECDSAContract", "offset": 0, "slot": "113", "type": "t_contract(ECDSA)2894", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:31" - }, - { - "label": "externalAstarbaseAddress", - "offset": 0, - "slot": "114", - "type": "t_address", - "contract": "AstarBaseV4", - "src": "contracts/AstarBaseV3.sol:38" + "contract": "AstarBase", + "src": "contracts/AstarBase.sol:27" } ], "types": { @@ -328,9 +320,9 @@ } } }, - "a68827f5e2bbc4440fa3ad5f1022ea4e6c42f53c38404c2484c5e33a59ca78b3": { - "address": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", - "txHash": "0x83374f2341462ca4286cb14283fd930f8c30a483fadd23e9b33539a5f8662112", + "4e4d2153f48003d3852534ade3de04061f78d02edef4d7c30e36d648a460e712": { + "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", + "txHash": "0x406b84fb58a496d7cef4a17b75e1113f452cd907ac07bb1c62ad472a8861fc12", "layout": { "storage": [ { @@ -378,104 +370,112 @@ "offset": 0, "slot": "101", "type": "t_struct(Counter)488_storage", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:15" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:18" }, { "label": "version", "offset": 0, "slot": "102", "type": "t_uint256", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:16" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:19" }, { "label": "PREFIX", "offset": 0, "slot": "103", "type": "t_bytes_storage", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:17" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:20" }, { "label": "POSTFIX", "offset": 0, "slot": "104", "type": "t_bytes_storage", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:18" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:21" }, { "label": "MSG_PREFIX", "offset": 0, "slot": "105", "type": "t_string_storage", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:19" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:22" }, { "label": "beneficiary", "offset": 0, "slot": "106", "type": "t_address", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:20" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:23" }, { "label": "unregisterFee", "offset": 0, "slot": "107", "type": "t_uint256", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:21" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:24" }, { "label": "paused", "offset": 0, "slot": "108", "type": "t_bool", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:22" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:25" }, { "label": "addressMap", "offset": 0, "slot": "109", "type": "t_mapping(t_address,t_bytes_storage)", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:23" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:26" }, { "label": "ss58Map", "offset": 0, "slot": "110", "type": "t_mapping(t_bytes_memory_ptr,t_address)", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:24" + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:27" }, { "label": "DAPPS_STAKING", "offset": 0, "slot": "111", - "type": "t_contract(DappsStaking)2606", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:25" + "type": "t_contract(DappsStaking)2030", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:28" }, { "label": "SR25519Contract", "offset": 0, "slot": "112", - "type": "t_contract(SR25519)3198", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:26" + "type": "t_contract(SR25519)2106", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:29" }, { "label": "ECDSAContract", "offset": 0, "slot": "113", - "type": "t_contract(ECDSA)2894", - "contract": "AstarBase", - "src": "contracts/AstarBase.sol:27" + "type": "t_contract(ECDSA)2069", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:30" + }, + { + "label": "externalAstarbaseAddress", + "offset": 0, + "slot": "114", + "type": "t_address", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:37" } ], "types": { @@ -503,15 +503,15 @@ "label": "bytes", "numberOfBytes": "32" }, - "t_contract(DappsStaking)2606": { + "t_contract(DappsStaking)2030": { "label": "contract DappsStaking", "numberOfBytes": "20" }, - "t_contract(ECDSA)2894": { + "t_contract(ECDSA)2069": { "label": "contract ECDSA", "numberOfBytes": "20" }, - "t_contract(SR25519)3198": { + "t_contract(SR25519)2106": { "label": "contract SR25519", "numberOfBytes": "20" }, diff --git a/contract/shiden/.openzeppelin/unknown-336.json b/contract/shiden/.openzeppelin/unknown-336.json index 2b00873..499742b 100644 --- a/contract/shiden/.openzeppelin/unknown-336.json +++ b/contract/shiden/.openzeppelin/unknown-336.json @@ -229,6 +229,232 @@ } } } + }, + "4e4d2153f48003d3852534ade3de04061f78d02edef4d7c30e36d648a460e712": { + "address": "0x3504beF3F419B9525d0648B0a330aCD1B20D8b37", + "txHash": "0xf2e6c7103cb36372f4bf0cb60c3e84eec6ebdc386e722f8ab134184d177c43af", + "layout": { + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:87" + }, + { + "label": "registeredCnt", + "offset": 0, + "slot": "101", + "type": "t_struct(Counter)488_storage", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:18" + }, + { + "label": "version", + "offset": 0, + "slot": "102", + "type": "t_uint256", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:19" + }, + { + "label": "PREFIX", + "offset": 0, + "slot": "103", + "type": "t_bytes_storage", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:20" + }, + { + "label": "POSTFIX", + "offset": 0, + "slot": "104", + "type": "t_bytes_storage", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:21" + }, + { + "label": "MSG_PREFIX", + "offset": 0, + "slot": "105", + "type": "t_string_storage", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:22" + }, + { + "label": "beneficiary", + "offset": 0, + "slot": "106", + "type": "t_address", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:23" + }, + { + "label": "unregisterFee", + "offset": 0, + "slot": "107", + "type": "t_uint256", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:24" + }, + { + "label": "paused", + "offset": 0, + "slot": "108", + "type": "t_bool", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:25" + }, + { + "label": "addressMap", + "offset": 0, + "slot": "109", + "type": "t_mapping(t_address,t_bytes_storage)", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:26" + }, + { + "label": "ss58Map", + "offset": 0, + "slot": "110", + "type": "t_mapping(t_bytes_memory_ptr,t_address)", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:27" + }, + { + "label": "DAPPS_STAKING", + "offset": 0, + "slot": "111", + "type": "t_contract(DappsStaking)2030", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:28" + }, + { + "label": "SR25519Contract", + "offset": 0, + "slot": "112", + "type": "t_contract(SR25519)2106", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:29" + }, + { + "label": "ECDSAContract", + "offset": 0, + "slot": "113", + "type": "t_contract(ECDSA)2069", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:30" + }, + { + "label": "externalAstarbaseAddress", + "offset": 0, + "slot": "114", + "type": "t_address", + "contract": "AstarBaseV4", + "src": "contracts/AstarBaseV4.sol:37" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes_memory_ptr": { + "label": "bytes", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(DappsStaking)2030": { + "label": "contract DappsStaking", + "numberOfBytes": "20" + }, + "t_contract(ECDSA)2069": { + "label": "contract ECDSA", + "numberOfBytes": "20" + }, + "t_contract(SR25519)2106": { + "label": "contract SR25519", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bytes_storage)": { + "label": "mapping(address => bytes)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes_memory_ptr,t_address)": { + "label": "mapping(bytes => address)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Counter)488_storage": { + "label": "struct CountersUpgradeable.Counter", + "members": [ + { + "label": "_value", + "type": "t_uint256", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + } + } + } } } } diff --git a/contract/shiden/Astar_flat.sol b/contract/shiden/Astar_flat.sol new file mode 100644 index 0000000..30859ed --- /dev/null +++ b/contract/shiden/Astar_flat.sol @@ -0,0 +1,3211 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) + +pragma solidity ^0.8.7; + +/** + * @dev Collection of functions related to the address type + */ +library AddressUpgradeable { + /** + * @dev Returns true if `account` is a contract. + * + * [IMPORTANT] + * ==== + * It is unsafe to assume that an address for which this function returns + * false is an externally-owned account (EOA) and not a contract. + * + * Among others, `isContract` will return false for the following + * types of addresses: + * + * - an externally-owned account + * - a contract in construction + * - an address where a contract will be created + * - an address where a contract lived, but was destroyed + * ==== + * + * [IMPORTANT] + * ==== + * You shouldn't rely on `isContract` to protect against flash loan attacks! + * + * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets + * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract + * constructor. + * ==== + */ + function isContract(address account) internal view returns (bool) { + // This method relies on extcodesize/address.code.length, which returns 0 + // for contracts in construction, since the code is only stored at the end + // of the constructor execution. + + return account.code.length > 0; + } + + /** + * @dev Replacement for Solidity's `transfer`: sends `amount` wei to + * `recipient`, forwarding all available gas and reverting on errors. + * + * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost + * of certain opcodes, possibly making contracts go over the 2300 gas limit + * imposed by `transfer`, making them unable to receive funds via + * `transfer`. {sendValue} removes this limitation. + * + * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. + * + * IMPORTANT: because control is transferred to `recipient`, care must be + * taken to not create reentrancy vulnerabilities. Consider using + * {ReentrancyGuard} or the + * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. + */ + function sendValue(address payable recipient, uint256 amount) internal { + require(address(this).balance >= amount, "Address: insufficient balance"); + + (bool success, ) = recipient.call{value: amount}(""); + require(success, "Address: unable to send value, recipient may have reverted"); + } + + /** + * @dev Performs a Solidity function call using a low level `call`. A + * plain `call` is an unsafe replacement for a function call: use this + * function instead. + * + * If `target` reverts with a revert reason, it is bubbled up by this + * function (like regular Solidity function calls). + * + * Returns the raw returned data. To convert to the expected return value, + * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. + * + * Requirements: + * + * - `target` must be a contract. + * - calling `target` with `data` must not revert. + * + * _Available since v3.1._ + */ + function functionCall(address target, bytes memory data) internal returns (bytes memory) { + return functionCall(target, data, "Address: low-level call failed"); + } + + /** + * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with + * `errorMessage` as a fallback revert reason when `target` reverts. + * + * _Available since v3.1._ + */ + function functionCall( + address target, + bytes memory data, + string memory errorMessage + ) internal returns (bytes memory) { + return functionCallWithValue(target, data, 0, errorMessage); + } + + /** + * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], + * but also transferring `value` wei to `target`. + * + * Requirements: + * + * - the calling contract must have an ETH balance of at least `value`. + * - the called Solidity function must be `payable`. + * + * _Available since v3.1._ + */ + function functionCallWithValue( + address target, + bytes memory data, + uint256 value + ) internal returns (bytes memory) { + return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); + } + + /** + * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but + * with `errorMessage` as a fallback revert reason when `target` reverts. + * + * _Available since v3.1._ + */ + function functionCallWithValue( + address target, + bytes memory data, + uint256 value, + string memory errorMessage + ) internal returns (bytes memory) { + require(address(this).balance >= value, "Address: insufficient balance for call"); + require(isContract(target), "Address: call to non-contract"); + + (bool success, bytes memory returndata) = target.call{value: value}(data); + return verifyCallResult(success, returndata, errorMessage); + } + + /** + * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], + * but performing a static call. + * + * _Available since v3.3._ + */ + function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { + return functionStaticCall(target, data, "Address: low-level static call failed"); + } + + /** + * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], + * but performing a static call. + * + * _Available since v3.3._ + */ + function functionStaticCall( + address target, + bytes memory data, + string memory errorMessage + ) internal view returns (bytes memory) { + require(isContract(target), "Address: static call to non-contract"); + + (bool success, bytes memory returndata) = target.staticcall(data); + return verifyCallResult(success, returndata, errorMessage); + } + + /** + * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the + * revert reason using the provided one. + * + * _Available since v4.3._ + */ + function verifyCallResult( + bool success, + bytes memory returndata, + string memory errorMessage + ) internal pure returns (bytes memory) { + if (success) { + return returndata; + } else { + // Look for revert reason and bubble it up if present + if (returndata.length > 0) { + // The easiest way to bubble the revert reason is using memory via assembly + + assembly { + let returndata_size := mload(returndata) + revert(add(32, returndata), returndata_size) + } + } else { + revert(errorMessage); + } + } + } +} + + +// File @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol@v4.5.2 + +// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) + +pragma solidity ^0.8.7; + +/** + * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed + * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an + * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer + * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. + * + * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as + * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. + * + * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure + * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. + * + * [CAUTION] + * ==== + * Avoid leaving a contract uninitialized. + * + * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation + * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the + * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: + * + * [.hljs-theme-light.nopadding] + * ``` + * /// @custom:oz-upgrades-unsafe-allow constructor + * constructor() initializer {} + * ``` + * ==== + */ +abstract contract Initializable { + /** + * @dev Indicates that the contract has been initialized. + */ + bool private _initialized; + + /** + * @dev Indicates that the contract is in the process of being initialized. + */ + bool private _initializing; + + /** + * @dev Modifier to protect an initializer function from being invoked twice. + */ + modifier initializer() { + // If the contract is initializing we ignore whether _initialized is set in order to support multiple + // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the + // contract may have been reentered. + require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); + + bool isTopLevelCall = !_initializing; + if (isTopLevelCall) { + _initializing = true; + _initialized = true; + } + + _; + + if (isTopLevelCall) { + _initializing = false; + } + } + + /** + * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the + * {initializer} modifier, directly or indirectly. + */ + modifier onlyInitializing() { + require(_initializing, "Initializable: contract is not initializing"); + _; + } + + function _isConstructor() private view returns (bool) { + return !AddressUpgradeable.isContract(address(this)); + } +} + + +// File @openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol@v4.5.2 + +// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) + +pragma solidity ^0.8.7; + +/** + * @title Counters + * @author Matt Condon (@shrugs) + * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number + * of elements in a mapping, issuing ERC721 ids, or counting request ids. + * + * Include with `using Counters for Counters.Counter;` + */ +library CountersUpgradeable { + struct Counter { + // This variable should never be directly accessed by users of the library: interactions must be restricted to + // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add + // this feature: see https://github.com/ethereum/solidity/issues/4637 + uint256 _value; // default: 0 + } + + function current(Counter storage counter) internal view returns (uint256) { + return counter._value; + } + + function increment(Counter storage counter) internal { + unchecked { + counter._value += 1; + } + } + + function decrement(Counter storage counter) internal { + uint256 value = counter._value; + require(value > 0, "Counter: decrement overflow"); + unchecked { + counter._value = value - 1; + } + } + + function reset(Counter storage counter) internal { + counter._value = 0; + } +} + + +// File @openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol@v4.5.2 + +// OpenZeppelin Contracts v4.4.1 (utils/Context.sol) + +pragma solidity ^0.8.7; + +/** + * @dev Provides information about the current execution context, including the + * sender of the transaction and its data. While these are generally available + * via msg.sender and msg.data, they should not be accessed in such a direct + * manner, since when dealing with meta-transactions the account sending and + * paying for execution may not be the actual sender (as far as an application + * is concerned). + * + * This contract is only required for intermediate, library-like contracts. + */ +abstract contract ContextUpgradeable is Initializable { + function __Context_init() internal onlyInitializing { + } + + function __Context_init_unchained() internal onlyInitializing { + } + function _msgSender() internal view virtual returns (address) { + return msg.sender; + } + + function _msgData() internal view virtual returns (bytes calldata) { + return msg.data; + } + + /** + * @dev This empty reserved space is put in place to allow future versions to add new + * variables without shifting down storage in the inheritance chain. + * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + */ + uint256[50] private __gap; +} + + +// File @openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol@v4.5.2 + +// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) + +pragma solidity ^0.8.7; + + +/** + * @dev Contract module which provides a basic access control mechanism, where + * there is an account (an owner) that can be granted exclusive access to + * specific functions. + * + * By default, the owner account will be the one that deploys the contract. This + * can later be changed with {transferOwnership}. + * + * This module is used through inheritance. It will make available the modifier + * `onlyOwner`, which can be applied to your functions to restrict their use to + * the owner. + */ +abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { + address private _owner; + + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /** + * @dev Initializes the contract setting the deployer as the initial owner. + */ + function __Ownable_init() internal onlyInitializing { + __Ownable_init_unchained(); + } + + function __Ownable_init_unchained() internal onlyInitializing { + _transferOwnership(_msgSender()); + } + + /** + * @dev Returns the address of the current owner. + */ + function owner() public view virtual returns (address) { + return _owner; + } + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyOwner() { + require(owner() == _msgSender(), "Ownable: caller is not the owner"); + _; + } + + /** + * @dev Leaves the contract without owner. It will not be possible to call + * `onlyOwner` functions anymore. Can only be called by the current owner. + * + * NOTE: Renouncing ownership will leave the contract without an owner, + * thereby removing any functionality that is only available to the owner. + */ + function renounceOwnership() public virtual onlyOwner { + _transferOwnership(address(0)); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Can only be called by the current owner. + */ + function transferOwnership(address newOwner) public virtual onlyOwner { + require(newOwner != address(0), "Ownable: new owner is the zero address"); + _transferOwnership(newOwner); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Internal function without access restriction. + */ + function _transferOwnership(address newOwner) internal virtual { + address oldOwner = _owner; + _owner = newOwner; + emit OwnershipTransferred(oldOwner, newOwner); + } + + /** + * @dev This empty reserved space is put in place to allow future versions to add new + * variables without shifting down storage in the inheritance chain. + * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + */ + uint256[49] private __gap; +} + + +// File contracts/DappsStakingDummy.sol + + +pragma solidity ^0.8.7; + +/** + * @title Dummy implementation for DappsStaking precompiled contract + */ +contract DappsStaking { + + // Storage getters + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return era, The current era + function read_current_era() external pure returns (uint256){ + return 0; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return period, The unbonding period in eras + function read_unbonding_period() external pure returns (uint256){ + return 0; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return reward, Total network reward for the given era + function read_era_reward(uint32 era) external pure returns (uint128){ + return era; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return staked, Total staked amount for the given era + function read_era_staked(uint32 era) external pure returns (uint128){ + return era; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @param staker in form of 20 or 32 hex bytes + /// @return amount, Staked amount by the staker + function read_staked_amount(bytes calldata staker) external pure returns (uint128){ + if (staker[0] != 0) { + return 1; + } + else{ + return 0; + } + } + + /// @notice Read Staked amount on a given contract for the staker + /// @param contract_id contract evm address + /// @param staker in form of 20 or 32 hex bytes + /// @return amount, Staked amount by the staker + function read_staked_amount_on_contract(address contract_id, bytes calldata staker) external pure returns (uint128){ + if (staker[0] != 0) { + if (contract_id != address(0)){ + return 1; + } + } + else{ + return 0; + } + return 0; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return total, The most recent total staked amount on contract + function read_contract_stake(address contract_id) external pure returns (uint128){ + if (contract_id != address(0)) { + return 1; + } + else{ + return 0; + } + } + + // Extrinsic calls + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function register(address) external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function bond_and_stake(address, uint128) external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function unbond_and_unstake(address, uint128) external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function withdraw_unbonded() external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function claim_staker(address) external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function claim_dapp(address, uint128) external pure{ + return; + } + + enum RewardDestination {FreeBalance, StakeBalance} + /// @notice Set reward destination for staker rewards + function set_reward_destination(RewardDestination) external pure{ + return; + } +} + + +// File contracts/SR25519Dummy.sol + + +pragma solidity ^0.8.7; + +/** + * @title Dummy implementation for SR25519 + */ +contract SR25519 { + /** + * @dev Dummy implementation. This code is implemented in the precomiled contract + * @return A boolean confirming whether the public key is signer for the message. + */ + function verify( + bytes32 public_key, + bytes calldata signature, + bytes calldata message + ) external pure returns (bool){ + if( public_key == 0 || signature[0] == 0 || message[0] == 0) return false; + + return true; + } +} + + +// File contracts/ECDSADummy.sol + + +pragma solidity ^0.8.7; + +/** + * @title Dummy implementation for SR25519 + */ +contract ECDSA { + /** + * @dev Dummy implementation. This code is implemented in the precomiled contract + * @return A boolean confirming whether the public key is signer for the message. + */ + function verify( + bytes calldata public_key, + bytes calldata signature, + bytes calldata message + ) external pure returns (bool){ + if (public_key[0] == 0 || signature[0] == 0 || message[0] == 0) return false; + + return true; + } +} + + +// File contracts/AstarBase.sol + +pragma solidity ^0.8.7; + + + + + + +/// @author The Astar Network Team +/// @title Astarbase. A voluntary mapping of accounts ss58 <> H160 +contract AstarBase is Initializable, OwnableUpgradeable { + using CountersUpgradeable for CountersUpgradeable.Counter; + CountersUpgradeable.Counter public registeredCnt; + uint256 public version; + bytes PREFIX; + bytes POSTFIX; + string MSG_PREFIX; + address public beneficiary; + uint256 public unregisterFee; + bool public paused; + mapping(address => bytes) public addressMap; + mapping(bytes => address) public ss58Map; + DappsStaking public DAPPS_STAKING; + SR25519 public SR25519Contract; + ECDSA public ECDSAContract; + + // Emitted when the getVersion() is called + event ContractVersion(uint256 newValue); + event AstarBaseRegistered(address newEntry); + + function initialize() public initializer { + __Ownable_init(); + registeredCnt.reset(); + version = 0; + PREFIX = hex"3c42797465733e"; + POSTFIX = hex"3c2f42797465733e"; + paused = false; + MSG_PREFIX = "Sign this to register to AstarBase for:"; + unregisterFee = 1 ether; + beneficiary = 0x91986602d9c0d8A4f5BFB5F39a7Aa2cD73Db73B7; // Faucet on all Astar networks + DAPPS_STAKING = DappsStaking(0x0000000000000000000000000000000000005001); + SR25519Contract = SR25519(0x0000000000000000000000000000000000005002); + ECDSAContract = ECDSA(0x0000000000000000000000000000000000005003); + } + + /// @notice Check upgradable contract version. + /// @notice Change this version value for each new contract upgrade + function getVersion() public { + + emit ContractVersion(1); + } + + /// @notice Register senders' address with corresponding SS58 address and store to mapping + /// @notice The accounts authenticity is verified through signature + /// @param ss58PublicKey, SS58 address used for signing + /// @param signedMsg, The message that was signed should be constructed as: + /// MSG_PREFIX + ss58PublicKey + msg.sender + function register(bytes calldata ss58PublicKey, bytes calldata signedMsg) external { + require(!paused, "The contract is paused"); + require(ss58PublicKey.length != 0, "Can't register ss58PublicKey with 0"); + require(ss58Map[ss58PublicKey] == address(0), "Already used ss58 Public Key"); + require(addressMap[msg.sender].length == 0, "Already registered evm address"); + + bytes memory messageBytes = bytes(MSG_PREFIX); + bytes memory addressInBytes = abi.encodePacked(msg.sender); + bytes32 pubKey = bytesToBytes32(ss58PublicKey, 0); + bytes memory fullMessage = bytes.concat(PREFIX, messageBytes, pubKey, addressInBytes, POSTFIX); + bool address_verified = SR25519Contract.verify(pubKey, signedMsg, fullMessage); + + // ECDSA verify + if (!address_verified) { + address_verified = ECDSAContract.verify(ss58PublicKey, signedMsg, fullMessage); + } + + require(address_verified, "Signed message not confirmed"); + + addressMap[msg.sender] = ss58PublicKey; + ss58Map[ss58PublicKey] = msg.sender; + registeredCnt.increment(); + emit AstarBaseRegistered(msg.sender); + } + + /// @notice helper function to cast bytes to bytes32 + /// @param inputByte bytes to be casted + /// @param offset The the start byte to be copied + function bytesToBytes32(bytes calldata inputByte, uint offset) private pure returns (bytes32) { + bytes32 out; + + for (uint i = 0; i < 32; i++) { + out |= bytes32(inputByte[offset + i] & 0xFF) >> (i * 8); + } + return out; + } + + /// @notice unRegister senders' address + function unRegister() public payable { + require(!paused, "The contract is paused"); + require(msg.value == unregisterFee, "Not enough funds to unregister"); + + unRegisterExecute(msg.sender); + } + + /// @notice unRegister any address by contract owner + /// @param evmAddress, EVM address used for registration + function sudoUnRegister(address evmAddress) public onlyOwner { + unRegisterExecute(evmAddress); + } + + /// @notice execute unRegister function + /// @param evmAddress, EVM address used for registration + function unRegisterExecute(address evmAddress) private { + require(addressMap[evmAddress].length != 0, "Unregistring unknown entry"); + + bytes memory ss58PublicKey = bytes(addressMap[evmAddress]); + addressMap[evmAddress] = new bytes(0); + ss58Map[ss58PublicKey] = address(0); + registeredCnt.decrement(); + } + + /// @notice Check if given address was registered + /// @param evmAddress, EVM address used for registration + function isRegistered(address evmAddress) public view returns (bool) { + bytes memory ss58PublicKey = addressMap[evmAddress]; + + return ss58PublicKey.length != 0; + } + + /// @notice Check if given address was registered and return staked amount + /// @param evmAddress, EVM address used for registration + /// @return staked amount on the SS58 address + function checkStakerStatus(address evmAddress) public view returns (uint128) { + bytes memory ss58PublicKey = addressMap[evmAddress]; + bytes memory pubKeyBytes = bytes(abi.encodePacked(ss58PublicKey)); + uint128 stakedAmount = DAPPS_STAKING.read_staked_amount(pubKeyBytes); + + return stakedAmount; + } + + /// @notice Pause register and unregister functions + /// @param _state, true or false + function pause(bool _state) public onlyOwner { + paused = _state; + } + + /// @notice set new value for the unregisterFee + /// @param _newCost new fee cost + function setUnregisterFee(uint256 _newCost) public onlyOwner { + unregisterFee = _newCost; + } + + /// @notice set new beneficiary + /// @param _newBeneficiary new beneficiary address + function setBeneficiary(address _newBeneficiary) public onlyOwner { + beneficiary = _newBeneficiary; + } + + /// @notice withdraw contract's funds + function withdraw() public payable { + (bool success, ) = payable(beneficiary).call{value: address(this).balance}(""); + require(success); + } + + /// @notice setting precompile addresses for unit test purposes + /// @param dapps Dapps-staking precompile address + /// @param sr25529 SR25529 precompile address + function setPrecompileAddresses(address dapps, address sr25529) public onlyOwner { + DAPPS_STAKING = DappsStaking(dapps); + SR25519Contract = SR25519(sr25529); + } +} + + +// File @openzeppelin/contracts/utils/Counters.sol@v4.7.0 + +// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) + +pragma solidity ^0.8.7; + +/** + * @title Counters + * @author Matt Condon (@shrugs) + * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number + * of elements in a mapping, issuing ERC721 ids, or counting request ids. + * + * Include with `using Counters for Counters.Counter;` + */ +library Counters { + struct Counter { + // This variable should never be directly accessed by users of the library: interactions must be restricted to + // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add + // this feature: see https://github.com/ethereum/solidity/issues/4637 + uint256 _value; // default: 0 + } + + function current(Counter storage counter) internal view returns (uint256) { + return counter._value; + } + + function increment(Counter storage counter) internal { + unchecked { + counter._value += 1; + } + } + + function decrement(Counter storage counter) internal { + uint256 value = counter._value; + require(value > 0, "Counter: decrement overflow"); + unchecked { + counter._value = value - 1; + } + } + + function reset(Counter storage counter) internal { + counter._value = 0; + } +} + + +// File @openzeppelin/contracts/utils/Context.sol@v4.7.0 + +// OpenZeppelin Contracts v4.4.1 (utils/Context.sol) + +pragma solidity ^0.8.7; + +/** + * @dev Provides information about the current execution context, including the + * sender of the transaction and its data. While these are generally available + * via msg.sender and msg.data, they should not be accessed in such a direct + * manner, since when dealing with meta-transactions the account sending and + * paying for execution may not be the actual sender (as far as an application + * is concerned). + * + * This contract is only required for intermediate, library-like contracts. + */ +abstract contract Context { + function _msgSender() internal view virtual returns (address) { + return msg.sender; + } + + function _msgData() internal view virtual returns (bytes calldata) { + return msg.data; + } +} + + +// File @openzeppelin/contracts/access/Ownable.sol@v4.7.0 + +// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) + +pragma solidity ^0.8.7; + +/** + * @dev Contract module which provides a basic access control mechanism, where + * there is an account (an owner) that can be granted exclusive access to + * specific functions. + * + * By default, the owner account will be the one that deploys the contract. This + * can later be changed with {transferOwnership}. + * + * This module is used through inheritance. It will make available the modifier + * `onlyOwner`, which can be applied to your functions to restrict their use to + * the owner. + */ +abstract contract Ownable is Context { + address private _owner; + + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /** + * @dev Initializes the contract setting the deployer as the initial owner. + */ + constructor() { + _transferOwnership(_msgSender()); + } + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyOwner() { + _checkOwner(); + _; + } + + /** + * @dev Returns the address of the current owner. + */ + function owner() public view virtual returns (address) { + return _owner; + } + + /** + * @dev Throws if the sender is not the owner. + */ + function _checkOwner() internal view virtual { + require(owner() == _msgSender(), "Ownable: caller is not the owner"); + } + + /** + * @dev Leaves the contract without owner. It will not be possible to call + * `onlyOwner` functions anymore. Can only be called by the current owner. + * + * NOTE: Renouncing ownership will leave the contract without an owner, + * thereby removing any functionality that is only available to the owner. + */ + function renounceOwnership() public virtual onlyOwner { + _transferOwnership(address(0)); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Can only be called by the current owner. + */ + function transferOwnership(address newOwner) public virtual onlyOwner { + require(newOwner != address(0), "Ownable: new owner is the zero address"); + _transferOwnership(newOwner); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Internal function without access restriction. + */ + function _transferOwnership(address newOwner) internal virtual { + address oldOwner = _owner; + _owner = newOwner; + emit OwnershipTransferred(oldOwner, newOwner); + } +} + + +// File contracts/AstarBaseExt.sol + +pragma solidity ^0.8.7; + + + + +/// @author The Astar Network Team +/// @title Astarbase. Mapping of Stakers ss58 <> H160 +contract AstarBaseExt is Ownable { + using Counters for Counters.Counter; + Counters.Counter public registeredCnt; + bytes PREFIX= hex"3c42797465733e"; + bytes POSTFIX= hex"3c2f42797465733e"; + bool public paused; + mapping(address => bytes32) public addressMap; + mapping(bytes32 => address) public ss58Map; + DappsStaking public DAPPS_STAKING = DappsStaking(0x0000000000000000000000000000000000005001); + SR25519 public SR25519Contract = SR25519(0x0000000000000000000000000000000000005002); + string MSG_PREFIX = "Sign this to register to AstarBase for:"; + uint256 public unregisterFee = 1 ether; + address public beneficiary = 0x91986602d9c0d8A4f5BFB5F39a7Aa2cD73Db73B7; // Faucet on all Astar networks + + constructor() { + paused = false; + } + + /// @notice Register senders' address with corresponding SS58 address and store to mapping + /// @param ss58PublicKey, SS58 address used for signing + /// @param signedMsg, The message that was signed should be constructed as: + /// MSG_PREFIX + ss58PublicKey + msg.sender + function register(bytes32 ss58PublicKey, bytes calldata signedMsg) external { + require(!paused, "The contract is paused"); + require(ss58PublicKey != 0, "Can't register ss58PublicKey with 0"); + require(ss58Map[ss58PublicKey] == address(0), "Already used ss58 Public Key"); + require(addressMap[msg.sender] == 0, "Already registered evm address"); + + bytes memory messageBytes = bytes(MSG_PREFIX); + bytes memory addressInBytes = abi.encodePacked(msg.sender); + bytes memory fullMessage = bytes.concat(PREFIX, messageBytes, ss58PublicKey, addressInBytes, POSTFIX); + bool address_verified = SR25519Contract.verify(ss58PublicKey, signedMsg, fullMessage); + require(address_verified, "Signed message not confirmed"); + + addressMap[msg.sender] = ss58PublicKey; + ss58Map[ss58PublicKey] = msg.sender; + registeredCnt.increment(); + } + + /// @notice unRegister senders' address + function unRegister() public payable { + require(!paused, "The contract is paused"); + require(msg.value == unregisterFee, "Not enough funds to unregister"); + + unRegisterExecute(msg.sender); + } + + /// @notice unRegister any address by contract owner + /// @param evmAddress, EVM address used for registration + function sudoUnRegister(address evmAddress) public onlyOwner { + unRegisterExecute(evmAddress); + } + + /// @notice execute unRegister function + /// @param evmAddress, EVM address used for registration + function unRegisterExecute(address evmAddress) private { + require(addressMap[evmAddress] != 0, "Unregistring unknown entry"); + + bytes32 ss58PublicKey = bytes32(addressMap[evmAddress]); + addressMap[evmAddress] = 0; + ss58Map[ss58PublicKey] = address(0); + registeredCnt.decrement(); + } + + /// @notice Check if given address was registered + /// @param evmAddress, EVM address used for registration + function isRegistered(address evmAddress) public view returns (bool) { + bytes32 ss58PublicKey = addressMap[evmAddress]; + + return ss58PublicKey != 0; + } + + /// @notice Check if given address was registered and return staked amount + /// @param evmAddress, EVM address used for registration + /// @return staked amount on the SS58 address + function checkStakerStatus(address evmAddress) public view returns (uint128) { + bytes32 ss58PublicKey = addressMap[evmAddress]; + bytes memory pubKeyBytes = bytes(abi.encodePacked(ss58PublicKey)); + uint128 stakedAmount = DAPPS_STAKING.read_staked_amount(pubKeyBytes); + + return stakedAmount; + } + + /// @notice Pause register and unregister functions + /// @param _state, true or false + function pause(bool _state) public onlyOwner { + paused = _state; + } + + /// @notice set new value for the unregisterFee + /// @param _newCost new fee cost + function setUnregisterFee(uint256 _newCost) public onlyOwner { + unregisterFee = _newCost; + } + + /// @notice set new beneficiary + /// @param _newBeneficiary new beneficiary address + function setBeneficiary(address _newBeneficiary) public onlyOwner { + beneficiary = _newBeneficiary; + } + + /// @notice withdraw contract's funds + function withdraw() public payable { + (bool success, ) = payable(beneficiary).call{value: address(this).balance}(""); + require(success); + } + + /// @notice setting precompile addresses for unit test purposes + /// @param dapps Dapps-staking precompile address + /// @param sr25529 SR25529 precompile address + function setPrecompileAddresses(address dapps, address sr25529) public onlyOwner { + DAPPS_STAKING = DappsStaking(dapps); + SR25519Contract = SR25519(sr25529); + } +} + + +// File contracts/AstarBaseV4.sol + +pragma solidity ^0.8.7; + + + + + + + +/// @author The Astar Network Team +/// @title Astarbase. A voluntary mapping of accounts ss58 <> H160 +contract AstarBaseV4 + is Initializable, OwnableUpgradeable { + using CountersUpgradeable for CountersUpgradeable.Counter; + CountersUpgradeable.Counter public registeredCnt; + uint256 public version; + bytes PREFIX; + bytes POSTFIX; + string MSG_PREFIX; + address public beneficiary; + uint256 public unregisterFee; + bool public paused; + mapping(address => bytes) public addressMap; + mapping(bytes => address) public ss58Map; + DappsStaking public DAPPS_STAKING; + SR25519 public SR25519Contract; + ECDSA public ECDSAContract; + + // Emitted when the getVersion() is called + event ContractVersion(uint256 newValue); + event AstarBaseRegistered(address newEntry); + + // New global variables need to be added at the end, due to upgradable contract + address public externalAstarbaseAddress; + + function initialize() public initializer { + __Ownable_init(); + registeredCnt.reset(); + version = 0; + PREFIX = hex"3c42797465733e"; + POSTFIX = hex"3c2f42797465733e"; + paused = false; + MSG_PREFIX = "Sign this to register to AstarBase for:"; + unregisterFee = 1 ether; + beneficiary = 0x91986602d9c0d8A4f5BFB5F39a7Aa2cD73Db73B7; // Faucet on all Astar networks + DAPPS_STAKING = DappsStaking(0x0000000000000000000000000000000000005001); + SR25519Contract = SR25519(0x0000000000000000000000000000000000005002); + ECDSAContract = ECDSA(0x0000000000000000000000000000000000005003); + } + + /// @notice Check upgradable contract version. + /// @notice Change this version value for each new contract upgrade + function getVersion() public { + version = 4; + emit ContractVersion(4); + } + + /// @notice Register senders' address with corresponding SS58 address and store to mapping + /// @notice The accounts authenticity is verified through signature + /// @param ss58PublicKey, SS58 address used for signing + /// @param signedMsg, The message that was signed should be constructed as: + /// MSG_PREFIX + ss58PublicKey + msg.sender + function register(bytes calldata ss58PublicKey, bytes calldata signedMsg) external { + require(!paused, "The contract is paused"); + require(ss58PublicKey.length != 0, "Can't register ss58PublicKey with 0"); + require(ss58Map[ss58PublicKey] == address(0), "Already used ss58 Public Key"); + require(addressMap[msg.sender].length == 0, "Already registered evm address"); + + bytes memory messageBytes = bytes(MSG_PREFIX); + bytes memory addressInBytes = abi.encodePacked(msg.sender); + bytes memory fullMessage = bytes.concat(PREFIX, messageBytes, ss58PublicKey, addressInBytes, POSTFIX); + bytes32 pubKey = bytesToBytes32(ss58PublicKey, 0); + bool address_verified = SR25519Contract.verify(pubKey, signedMsg, fullMessage); + + // ECDSA verify + if (!address_verified) { + address_verified = ECDSAContract.verify(ss58PublicKey, signedMsg, fullMessage); + } + + require(address_verified, "Signed message not confirmed"); + + registerExecute(msg.sender, ss58PublicKey); + } + + /// @notice Execute register function + /// @param evmAddress, EVM address used for registration + /// @param ss58PublicKey, SS58 address used for signing + function registerExecute(address evmAddress, bytes memory ss58PublicKey) private { + addressMap[evmAddress] = ss58PublicKey; + ss58Map[ss58PublicKey] = evmAddress; + registeredCnt.increment(); + emit AstarBaseRegistered(msg.sender); + } + + /// @notice helper function to cast bytes to bytes32 + /// @param inputByte bytes to be casted + /// @param offset The the start byte to be copied + function bytesToBytes32(bytes calldata inputByte, uint offset) private pure returns (bytes32) { + bytes32 out; + + for (uint i = 0; i < 32; i++) { + out |= bytes32(inputByte[offset + i] & 0xFF) >> (i * 8); + } + return out; + } + + /// @notice unRegister senders' address + function unRegister() public payable { + require(!paused, "The contract is paused"); + require(msg.value == unregisterFee, "Not enough funds to unregister"); + + unRegisterExecute(msg.sender); + } + + /// @notice unRegister any address by contract owner + /// @param evmAddress, EVM address used for registration + function sudoUnRegister(address evmAddress) public onlyOwner { + unRegisterExecute(evmAddress); + } + + /// @notice execute unRegister function + /// @param evmAddress, EVM address used for registration + function unRegisterExecute(address evmAddress) private { + require(addressMap[evmAddress].length != 0, "Unregistring unknown entry"); + + bytes memory ss58PublicKey = bytes(addressMap[evmAddress]); + addressMap[evmAddress] = ""; + ss58Map[ss58PublicKey] = address(0); + registeredCnt.decrement(); + } + + /// @notice Check if given address was registered + /// @param evmAddress, EVM address used for registration + function isRegistered(address evmAddress) public returns (bool) { + require(evmAddress != address(0), "Bad input address"); + bytes memory ss58PublicKey = addressMap[evmAddress]; + + // check external Astarbase - applicable only for Shiden Network + if (ss58PublicKey.length == 0) { + if (externalAstarbaseAddress != address(0)){ + ss58PublicKey = externalAstarBaseCheck(evmAddress); + } + } + + return ss58PublicKey.length != 0; + } + + /// @notice sets external Astarbase contract address - applicable for Shiden only + /// @param _externalAstarbaseAddress, EVM address of external Astarbase contract + function setExternalAstarbaseAddress(address _externalAstarbaseAddress) external onlyOwner { + externalAstarbaseAddress = _externalAstarbaseAddress; + } + + /// @notice sets external Astarbase contract address - applicable for Shiden only + /// The external (old) Astarbase used bytes32 for private key + /// @param evmAddress, EVM address of external Astarbase contract + function externalAstarBaseCheck(address evmAddress) public returns (bytes memory){ + require(externalAstarbaseAddress != address(0), "Unknown external Astarbase address"); + + bytes memory ss58PublicKey = new bytes(32); + + AstarBaseExt externalAstarBase = AstarBaseExt(externalAstarbaseAddress); + bytes32 ss58PublicKey32 = externalAstarBase.addressMap(evmAddress); + ss58PublicKey = abi.encodePacked(ss58PublicKey32); + if (ss58PublicKey32 != 0){ + // register to avoid check in external astarbase next time + registerExecute(evmAddress, ss58PublicKey); + } + return ss58PublicKey; + } + + /// @notice Check if given address was registered and return staked amount on contract + /// @param evmAddress, EVM address used for registration + /// @param stakingContract, contract address + /// @return staked amount for the SS58 address + function checkStakerStatusOnContract(address evmAddress, address stakingContract) public view returns (uint128) { + bytes memory ss58PublicKey = addressMap[evmAddress]; + + if (ss58PublicKey.length == 0) { + return 0; + } + + uint128 stakedAmount = DAPPS_STAKING.read_staked_amount_on_contract(stakingContract, ss58PublicKey); + + return stakedAmount; + } + + /// @notice Check if given address was registered and return staked amount + /// @param evmAddress, EVM address used for registration + /// @return staked amount on the SS58 address + function checkStakerStatus(address evmAddress) public view returns (uint128) { + bytes memory ss58PublicKey = addressMap[evmAddress]; + + if (ss58PublicKey.length == 0) { + return 0; + } + + uint128 stakedAmount = DAPPS_STAKING.read_staked_amount(ss58PublicKey); + + return stakedAmount; + } + + /// @notice Pause register and unregister functions + /// @param _state, true or false + function pause(bool _state) public onlyOwner { + paused = _state; + } + + /// @notice set new value for the unregisterFee + /// @param _newCost new fee cost + function setUnregisterFee(uint256 _newCost) public onlyOwner { + unregisterFee = _newCost; + } + + /// @notice set new beneficiary + /// @param _newBeneficiary new beneficiary address + function setBeneficiary(address _newBeneficiary) public onlyOwner { + beneficiary = _newBeneficiary; + } + + /// @notice withdraw contract's funds + function withdraw() public payable { + (bool success, ) = payable(beneficiary).call{value: address(this).balance}(""); + require(success); + } + + /// @notice setting precompile addresses for unit test purposes + /// @param dapps Dapps-staking precompile address + /// @param sr25529 SR25529 precompile address + function setPrecompileAddresses(address dapps, address sr25529, address ecdsa) public onlyOwner { + DAPPS_STAKING = DappsStaking(dapps); + SR25519Contract = SR25519(sr25529); + ECDSAContract = ECDSA(ecdsa); + } +} + + +// File hardhat/console.sol@v2.9.1 + +pragma solidity ^0.8.7; + +library console { + address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); + + function _sendLogPayload(bytes memory payload) private view { + uint256 payloadLength = payload.length; + address consoleAddress = CONSOLE_ADDRESS; + assembly { + let payloadStart := add(payload, 32) + let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) + } + } + + function log() internal view { + _sendLogPayload(abi.encodeWithSignature("log()")); + } + + function logInt(int p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(int)", p0)); + } + + function logUint(uint p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); + } + + function logString(string memory p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); + } + + function logBool(bool p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); + } + + function logAddress(address p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); + } + + function logBytes(bytes memory p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); + } + + function logBytes1(bytes1 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); + } + + function logBytes2(bytes2 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); + } + + function logBytes3(bytes3 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); + } + + function logBytes4(bytes4 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); + } + + function logBytes5(bytes5 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); + } + + function logBytes6(bytes6 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); + } + + function logBytes7(bytes7 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); + } + + function logBytes8(bytes8 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); + } + + function logBytes9(bytes9 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); + } + + function logBytes10(bytes10 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); + } + + function logBytes11(bytes11 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); + } + + function logBytes12(bytes12 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); + } + + function logBytes13(bytes13 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); + } + + function logBytes14(bytes14 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); + } + + function logBytes15(bytes15 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); + } + + function logBytes16(bytes16 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); + } + + function logBytes17(bytes17 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); + } + + function logBytes18(bytes18 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); + } + + function logBytes19(bytes19 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); + } + + function logBytes20(bytes20 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); + } + + function logBytes21(bytes21 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); + } + + function logBytes22(bytes22 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); + } + + function logBytes23(bytes23 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); + } + + function logBytes24(bytes24 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); + } + + function logBytes25(bytes25 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); + } + + function logBytes26(bytes26 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); + } + + function logBytes27(bytes27 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); + } + + function logBytes28(bytes28 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); + } + + function logBytes29(bytes29 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); + } + + function logBytes30(bytes30 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); + } + + function logBytes31(bytes31 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); + } + + function logBytes32(bytes32 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); + } + + function log(uint p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); + } + + function log(string memory p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); + } + + function log(bool p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); + } + + function log(address p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); + } + + function log(uint p0, uint p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1)); + } + + function log(uint p0, string memory p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1)); + } + + function log(uint p0, bool p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1)); + } + + function log(uint p0, address p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1)); + } + + function log(string memory p0, uint p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1)); + } + + function log(string memory p0, string memory p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); + } + + function log(string memory p0, bool p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); + } + + function log(string memory p0, address p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); + } + + function log(bool p0, uint p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1)); + } + + function log(bool p0, string memory p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); + } + + function log(bool p0, bool p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); + } + + function log(bool p0, address p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); + } + + function log(address p0, uint p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1)); + } + + function log(address p0, string memory p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); + } + + function log(address p0, bool p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); + } + + function log(address p0, address p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); + } + + function log(uint p0, uint p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)); + } + + function log(uint p0, uint p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)); + } + + function log(uint p0, uint p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)); + } + + function log(uint p0, uint p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)); + } + + function log(uint p0, string memory p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)); + } + + function log(uint p0, string memory p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)); + } + + function log(uint p0, string memory p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)); + } + + function log(uint p0, string memory p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)); + } + + function log(uint p0, bool p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)); + } + + function log(uint p0, bool p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)); + } + + function log(uint p0, bool p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)); + } + + function log(uint p0, bool p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)); + } + + function log(uint p0, address p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)); + } + + function log(uint p0, address p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)); + } + + function log(uint p0, address p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)); + } + + function log(uint p0, address p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)); + } + + function log(string memory p0, uint p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)); + } + + function log(string memory p0, uint p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)); + } + + function log(string memory p0, uint p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)); + } + + function log(string memory p0, uint p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)); + } + + function log(string memory p0, string memory p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)); + } + + function log(string memory p0, string memory p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); + } + + function log(string memory p0, string memory p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); + } + + function log(string memory p0, string memory p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); + } + + function log(string memory p0, bool p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)); + } + + function log(string memory p0, bool p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); + } + + function log(string memory p0, bool p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); + } + + function log(string memory p0, bool p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); + } + + function log(string memory p0, address p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)); + } + + function log(string memory p0, address p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); + } + + function log(string memory p0, address p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); + } + + function log(string memory p0, address p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); + } + + function log(bool p0, uint p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)); + } + + function log(bool p0, uint p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)); + } + + function log(bool p0, uint p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)); + } + + function log(bool p0, uint p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)); + } + + function log(bool p0, string memory p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)); + } + + function log(bool p0, string memory p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); + } + + function log(bool p0, string memory p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); + } + + function log(bool p0, string memory p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); + } + + function log(bool p0, bool p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)); + } + + function log(bool p0, bool p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); + } + + function log(bool p0, bool p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); + } + + function log(bool p0, bool p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); + } + + function log(bool p0, address p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)); + } + + function log(bool p0, address p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); + } + + function log(bool p0, address p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); + } + + function log(bool p0, address p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); + } + + function log(address p0, uint p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)); + } + + function log(address p0, uint p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)); + } + + function log(address p0, uint p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)); + } + + function log(address p0, uint p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)); + } + + function log(address p0, string memory p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)); + } + + function log(address p0, string memory p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); + } + + function log(address p0, string memory p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); + } + + function log(address p0, string memory p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); + } + + function log(address p0, bool p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)); + } + + function log(address p0, bool p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); + } + + function log(address p0, bool p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); + } + + function log(address p0, bool p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); + } + + function log(address p0, address p1, uint p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)); + } + + function log(address p0, address p1, string memory p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); + } + + function log(address p0, address p1, bool p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); + } + + function log(address p0, address p1, address p2) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); + } + + function log(uint p0, uint p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, uint p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, string memory p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, bool p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3)); + } + + function log(uint p0, address p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, uint p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3)); + } + + function log(address p0, uint p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, uint p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, uint p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, uint p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, uint p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, string memory p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, string memory p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, string memory p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, string memory p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, bool p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, bool p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, bool p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, bool p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, address p2, uint p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, address p2, string memory p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, address p2, bool p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, address p2, address p3) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); + } + +} + + +// File contracts/Memory.sol + + +pragma solidity ^0.8.7; + + +library Memory { + + // Size of a word, in bytes. + uint internal constant WORD_SIZE = 32; + // Size of the header of a 'bytes' array. + uint internal constant BYTES_HEADER_SIZE = 32; + // Address of the free memory pointer. + uint internal constant FREE_MEM_PTR = 0x40; + + // Compares the 'len' bytes starting at address 'addr' in memory with the 'len' + // bytes starting at 'addr2'. + // Returns 'true' if the bytes are the same, otherwise 'false'. + function equals(uint addr, uint addr2, uint len) internal pure returns (bool equal) { + assembly { + equal := eq(keccak256(addr, len), keccak256(addr2, len)) + } + } + + // Compares the 'len' bytes starting at address 'addr' in memory with the bytes stored in + // 'bts'. It is allowed to set 'len' to a lower value then 'bts.length', in which case only + // the first 'len' bytes will be compared. + // Requires that 'bts.length >= len' + function equals(uint addr, uint len, bytes memory bts) internal pure returns (bool equal) { + require(bts.length >= len); + uint addr2; + assembly { + addr2 := add(bts, /*BYTES_HEADER_SIZE*/32) + } + return equals(addr, addr2, len); + } + + // Allocates 'numBytes' bytes in memory. This will prevent the Solidity compiler + // from using this area of memory. It will also initialize the area by setting + // each byte to '0'. + function allocate(uint numBytes) internal pure returns (uint addr) { + // Take the current value of the free memory pointer, and update. + assembly { + addr := mload(/*FREE_MEM_PTR*/0x40) + mstore(/*FREE_MEM_PTR*/0x40, add(addr, numBytes)) + } + uint words = (numBytes + WORD_SIZE - 1) / WORD_SIZE; + for (uint i = 0; i < words; i++) { + assembly { + mstore(add(addr, mul(i, /*WORD_SIZE*/32)), 0) + } + } + } + + // Copy 'len' bytes from memory address 'src', to address 'dest'. + // This function does not check the or destination, it only copies + // the bytes. + function copy(uint src, uint dest, uint len) internal pure { + // Copy word-length chunks while possible + for (; len >= WORD_SIZE; len -= WORD_SIZE) { + assembly { + mstore(dest, mload(src)) + } + dest += WORD_SIZE; + src += WORD_SIZE; + } + + // Copy remaining bytes + uint mask = 256 ** (WORD_SIZE - len) - 1; + assembly { + let srcpart := and(mload(src), not(mask)) + let destpart := and(mload(dest), mask) + mstore(dest, or(destpart, srcpart)) + } + } + + // Returns a memory pointer to the provided bytes array. + function ptr(bytes memory bts) internal pure returns (uint addr) { + assembly { + addr := bts + } + } + + // Returns a memory pointer to the data portion of the provided bytes array. + function dataPtr(bytes memory bts) internal pure returns (uint addr) { + assembly { + addr := add(bts, /*BYTES_HEADER_SIZE*/32) + } + } + + // This function does the same as 'dataPtr(bytes memory)', but will also return the + // length of the provided bytes array. + function fromBytes(bytes memory bts) internal pure returns (uint addr, uint len) { + len = bts.length; + assembly { + addr := add(bts, /*BYTES_HEADER_SIZE*/32) + } + } + + // Creates a 'bytes memory' variable from the memory address 'addr', with the + // length 'len'. The function will allocate new memory for the bytes array, and + // the 'len bytes starting at 'addr' will be copied into that new memory. + function toBytes(uint addr, uint len) internal pure returns (bytes memory bts) { + bts = new bytes(len); + uint btsptr; + assembly { + btsptr := add(bts, /*BYTES_HEADER_SIZE*/32) + } + copy(addr, btsptr, len); + } + + // Get the word stored at memory address 'addr' as a 'uint'. + function toUint(uint addr) internal pure returns (uint n) { + assembly { + n := mload(addr) + } + } + + // Get the word stored at memory address 'addr' as a 'bytes32'. + function toBytes32(uint addr) internal pure returns (bytes32 bts) { + assembly { + bts := mload(addr) + } + } + + /* + // Get the byte stored at memory address 'addr' as a 'byte'. + function toByte(uint addr, uint8 index) internal pure returns (byte b) { + require(index < WORD_SIZE); + uint8 n; + assembly { + n := byte(index, mload(addr)) + } + b = byte(n); + } + */ +} + + +// File contracts/DappsStakingMock.sol + + + +pragma solidity ^0.8.7; + +/** + * @title Dummy implementation for DappsStaking precompiled contract + */ +contract DappsStakingMock { + + // Storage getters + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return era, The current era + function read_current_era() external pure returns (uint256){ + return 0; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return period, The unbonding period in eras + function read_unbonding_period() external pure returns (uint256){ + return 0; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return reward, Total network reward for the given era + function read_era_reward(uint32 era) external pure returns (uint128){ + return era; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return staked, Total staked amount for the given era + function read_era_staked(uint32 era) external pure returns (uint128){ + return era; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @param staker in form of 20 or 32 hex bytes + /// @return amount, Staked amount by the staker + function read_staked_amount(bytes calldata staker) external view returns (uint128){ + // make hardhat bob account to be staker + bytes memory bobSS58 = bytes(hex"1111111111111111111111111111111111111111111111111111111111111111"); + if (equals(staker, bobSS58)) { + // console.log("staker confirmed:"); + // console.logBytes(staker); + return 50; + } + else{ + return 0; + } + } + + /// @notice Read Staked amount on a given contract for the staker + /// @param contract_id contract evm address + /// @param staker in form of 20 or 32 hex bytes + /// @return amount, Staked amount by the staker + function read_staked_amount_on_contract(address contract_id, bytes calldata staker) external view returns (uint128){ + // make hardhat bob account to be staker + bytes memory bobSS58 = bytes(hex"1111111111111111111111111111111111111111111111111111111111111111"); + address stakedContract = 0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa; + // console.log("contract %s", contract_id); + // console.logBytes(staker); + if (equals(staker, bobSS58) + && contract_id == stakedContract + ) { + if (contract_id != address(0)){ + // console.log("staker confirmed:"); + // console.logBytes(staker); + return 50; + } + } + else{ + // console.log("staker not confirmed 1"); + return 0; + } + console.log("staker not confirmed 2"); + return 0; + } + + // Checks if two `bytes memory` variables are equal. This is done using hashing, + // which is much more gas efficient then comparing each byte individually. + // Equality means that: + // - 'self.length == other.length' + // - For 'n' in '[0, self.length)', 'self[n] == other[n]' + function equals(bytes memory self, bytes memory other) internal pure returns (bool equal) { + if (self.length != other.length) { + return false; + } + uint addr; + uint addr2; + assembly { + addr := add(self, /*BYTES_HEADER_SIZE*/32) + addr2 := add(other, /*BYTES_HEADER_SIZE*/32) + } + equal = Memory.equals(addr, addr2, self.length); + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + /// @return total, The most recent total staked amount on contract + function read_contract_stake(address contract_id) external pure returns (uint128){ + if (contract_id != address(0)) { + return 1; + } + else{ + return 0; + } + } + + // Extrinsic calls + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function register(address) external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function bond_and_stake(address, uint128) external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function unbond_and_unstake(address, uint128) external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function withdraw_unbonded() external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function claim_staker(address) external pure{ + return; + } + + /// @notice Dummy implementation. This code is implemented in precompiled contract + function claim_dapp(address, uint128) external pure{ + return; + } + + enum RewardDestination {FreeBalance, StakeBalance} + /// @notice Set reward destination for staker rewards + function set_reward_destination(RewardDestination) external pure{ + return; + } +} + + +// File contracts/ECDSAMock.sol + + +pragma solidity ^0.8.7; + +/** + * @title Dummy implementation for SR25519 + */ +contract ECDSAMock { + /** + * @dev Dummy implementation. This code is implemented in the precomiled contract + * @return A boolean confirming whether the public key is signer for the message. + */ + function verify( + bytes calldata public_key, + bytes calldata signature, + bytes calldata message + ) external pure returns (bool){ + + bytes1 validKey = bytes1(uint8(0x22)); + bytes1 validMsg = bytes1(uint8(0x99)); + + // console.logBytes1(public_key[0]); + // console.logBytes1(signature[0]); + // console.logBytes1(message[0]); + + + if (public_key[0] == validKey + || signature[0] == validMsg + || message[0] == 0) { + // console.log("valid ECDSA signature"); + return true; + } + // console.log("invalid ECDSA signature"); + return false; + } +} + + +// File contracts/SR25519Mock.sol + + +pragma solidity ^0.8.7; + +/** + * @title Dummy implementation for SR25519 + */ +contract SR25519Mock { + /** + * @dev Dummy implementation. This code is implemented in the precomiled contract + * @return A boolean confirming whether the public key is signer for the message. + */ + function verify( + bytes32 public_key, + bytes calldata signature, + bytes calldata message + ) external pure returns (bool){ + + + bytes1 validKey = bytes1(uint8(0x11)); + bytes1 validMsg = bytes1(uint8(0x99)); + + // console.logBytes1(public_key[0]); + // console.logBytes1(signature[0]); + // console.logBytes1(message[0]); + + if( public_key[0] == validKey + && signature[0] == validMsg + ){ + // console.log("valid sr25519 signature"); + return true; + } + + // console.log("invalid sr25519 signature"); + return false; + } +} diff --git a/contract/shiden/abi.json b/contract/shiden/abi.json index d004931..1de33b0 100644 --- a/contract/shiden/abi.json +++ b/contract/shiden/abi.json @@ -25,19 +25,6 @@ "name": "ContractVersion", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -171,6 +158,38 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "evmAddress", + "type": "address" + } + ], + "name": "externalAstarBaseCheck", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "externalAstarbaseAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getVersion", @@ -201,7 +220,7 @@ "type": "bool" } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { @@ -294,6 +313,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_externalAstarbaseAddress", + "type": "address" + } + ], + "name": "setExternalAstarbaseAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/contract/shiden/contracts/AstarBaseV3.sol b/contract/shiden/contracts/AstarBaseV4.sol similarity index 100% rename from contract/shiden/contracts/AstarBaseV3.sol rename to contract/shiden/contracts/AstarBaseV4.sol diff --git a/contract/shiden/scripts/upgrade.js b/contract/shiden/scripts/upgrade.js index e330ba5..f56da4d 100644 --- a/contract/shiden/scripts/upgrade.js +++ b/contract/shiden/scripts/upgrade.js @@ -1,7 +1,7 @@ async function main() { - const newAstarBase = await ethers.getContractFactory('AstarBaseV3'); + const newAstarBase = await ethers.getContractFactory('AstarBaseV4'); let proxy = await upgrades.upgradeProxy( - '0x8E2fa5A4D4e4f0581B69aF2f8F2Ef2CF205aE8F0', + '0x25257be737210F72DA4F51aCB66903A7520e59d6', newAstarBase ); console.log('Your contract is upgraded! Proxy remains at:', proxy.address); diff --git a/contract/shiden/shiden_not_upgradable/AstarBase_flat.sol b/contract/shiden/shiden_not_upgradable/AstarBaseV4_flat.sol similarity index 100% rename from contract/shiden/shiden_not_upgradable/AstarBase_flat.sol rename to contract/shiden/shiden_not_upgradable/AstarBaseV4_flat.sol diff --git a/contract/shiden/test/console_test_upgrade.md b/contract/shiden/test/console_test_upgrade.md index b3ed3d9..7513675 100644 --- a/contract/shiden/test/console_test_upgrade.md +++ b/contract/shiden/test/console_test_upgrade.md @@ -1,11 +1,12 @@ -npx hardhat run --network astar scripts/upgrade.js -npx hardhat console --network astar -> const newAstarBase = await ethers.getContractFactory("AstarBaseV3") +npx hardhat run --network shiden scripts/upgrade.js +npx hardhat console --network shiden +> const newAstarBase = await ethers.getContractFactory("AstarBaseV4") undefined -> const astarbase = await newAstarBase.attach("0x8E2fa5A4D4e4f0581B69aF2f8F2Ef2CF205aE8F0") +> const astarbase = await newAstarBase.attach("0x25257be737210F72DA4F51aCB66903A7520e59d6") undefined -> await astarbase.version() > const tx = await astarbase.getVersion() > receipt = await tx.wait() > receipt.events[0].data -> implAddr = await upgrades.erc1967.getImplementationAddress("0x8E2fa5A4D4e4f0581B69aF2f8F2Ef2CF205aE8F0") \ No newline at end of file +> await astarbase.version() +> implAddr = await upgrades.erc1967.getImplementationAddress("0x25257be737210F72DA4F51aCB66903A7520e59d6") +'0x3504beF3F419B9525d0648B0a330aCD1B20D8b37' \ No newline at end of file