git.delta.rocks / unique-network / refs/commits / 231992803ffe

difftreelog

fix rename some methods

Trubnikov Sergey2022-09-19parent: #b85120e.patch.diff
in: master

6 files changed

modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -169,7 +169,7 @@
 	///
 	/// @param contractAddress The contract for which a sponsor is requested.
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	fn get_sponsor(&self, contract_address: address) -> Result<(address, uint256)> {
+	fn sponsor(&self, contract_address: address) -> Result<(address, uint256)> {
 		let sponsor =
 			Pallet::<T>::get_sponsor(contract_address).ok_or("Contract has no sponsor")?;
 		Ok(pallet_common::eth::convert_cross_account_to_tuple::<T>(
@@ -220,7 +220,7 @@
 	/// Get current contract sponsoring rate limit
 	/// @param contractAddress Contract to get sponsoring rate limit of
 	/// @return uint32 Amount of blocks between two sponsored transactions
-	fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {
+	fn sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {
 		self.recorder().consume_sload()?;
 
 		Ok(<SponsoringRateLimit<T>>::get(contract_address)
@@ -273,7 +273,7 @@
 	/// @param contractAddress Contract to get sponsoring fee limit of
 	/// @return uint256 Maximum amount of fee that could be spent by single
 	///  transaction
-	fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {
+	fn sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {
 		self.recorder().consume_sload()?;
 
 		Ok(get_sponsoring_fee_limit::<T>(contract_address))
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
+++ b/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
@@ -25,7 +25,7 @@
 }
 
 /// @title Magic contract, which allows users to reconfigure other contracts
-/// @dev the ERC-165 identifier for this interface is 0x172cb4fb
+/// @dev the ERC-165 identifier for this interface is 0x30afad04
 contract ContractHelpers is Dummy, ERC165, ContractHelpersEvents {
 	/// Get user, which deployed specified contract
 	/// @dev May return zero address in case if contract is deployed
@@ -94,9 +94,9 @@
 	///
 	/// @param contractAddress The contract for which a sponsor is requested.
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	/// @dev EVM selector for this function is: 0x743fc745,
-	///  or in textual repr: getSponsor(address)
-	function getSponsor(address contractAddress) public view returns (Tuple0 memory) {
+	/// @dev EVM selector for this function is: 0x766c4f37,
+	///  or in textual repr: sponsor(address)
+	function sponsor(address contractAddress) public view returns (Tuple0 memory) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
@@ -150,9 +150,9 @@
 	/// Get current contract sponsoring rate limit
 	/// @param contractAddress Contract to get sponsoring rate limit of
 	/// @return uint32 Amount of blocks between two sponsored transactions
-	/// @dev EVM selector for this function is: 0x610cfabd,
-	///  or in textual repr: getSponsoringRateLimit(address)
-	function getSponsoringRateLimit(address contractAddress) public view returns (uint32) {
+	/// @dev EVM selector for this function is: 0xf29694d8,
+	///  or in textual repr: sponsoringRateLimit(address)
+	function sponsoringRateLimit(address contractAddress) public view returns (uint32) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
@@ -193,9 +193,9 @@
 	/// @param contractAddress Contract to get sponsoring fee limit of
 	/// @return uint256 Maximum amount of fee that could be spent by single
 	///  transaction
-	/// @dev EVM selector for this function is: 0xc3fdc9ee,
-	///  or in textual repr: getSponsoringFeeLimit(address)
-	function getSponsoringFeeLimit(address contractAddress) public view returns (uint256) {
+	/// @dev EVM selector for this function is: 0x75b73606,
+	///  or in textual repr: sponsoringFeeLimit(address)
+	function sponsoringFeeLimit(address contractAddress) public view returns (uint256) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -20,7 +20,7 @@
 }
 
 /// @title Magic contract, which allows users to reconfigure other contracts
-/// @dev the ERC-165 identifier for this interface is 0x172cb4fb
+/// @dev the ERC-165 identifier for this interface is 0x30afad04
 interface ContractHelpers is Dummy, ERC165, ContractHelpersEvents {
 	/// Get user, which deployed specified contract
 	/// @dev May return zero address in case if contract is deployed
@@ -67,9 +67,9 @@
 	///
 	/// @param contractAddress The contract for which a sponsor is requested.
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	/// @dev EVM selector for this function is: 0x743fc745,
-	///  or in textual repr: getSponsor(address)
-	function getSponsor(address contractAddress) external view returns (Tuple0 memory);
+	/// @dev EVM selector for this function is: 0x766c4f37,
+	///  or in textual repr: sponsor(address)
+	function sponsor(address contractAddress) external view returns (Tuple0 memory);
 
 	/// Check tat contract has confirmed sponsor.
 	///
@@ -98,9 +98,9 @@
 	/// Get current contract sponsoring rate limit
 	/// @param contractAddress Contract to get sponsoring rate limit of
 	/// @return uint32 Amount of blocks between two sponsored transactions
-	/// @dev EVM selector for this function is: 0x610cfabd,
-	///  or in textual repr: getSponsoringRateLimit(address)
-	function getSponsoringRateLimit(address contractAddress) external view returns (uint32);
+	/// @dev EVM selector for this function is: 0xf29694d8,
+	///  or in textual repr: sponsoringRateLimit(address)
+	function sponsoringRateLimit(address contractAddress) external view returns (uint32);
 
 	/// Set contract sponsoring rate limit
 	/// @dev Sponsoring rate limit - is a minimum amount of blocks that should
@@ -126,9 +126,9 @@
 	/// @param contractAddress Contract to get sponsoring fee limit of
 	/// @return uint256 Maximum amount of fee that could be spent by single
 	///  transaction
-	/// @dev EVM selector for this function is: 0xc3fdc9ee,
-	///  or in textual repr: getSponsoringFeeLimit(address)
-	function getSponsoringFeeLimit(address contractAddress) external view returns (uint256);
+	/// @dev EVM selector for this function is: 0x75b73606,
+	///  or in textual repr: sponsoringFeeLimit(address)
+	function sponsoringFeeLimit(address contractAddress) external view returns (uint256);
 
 	/// Is specified user present in contract allow list
 	/// @dev Contract owner always implicitly included
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -223,7 +223,7 @@
     const helpers = contractHelpers(web3, owner);
     await helpers.methods.selfSponsoredEnable(flipper.options.address).send();
     
-    const result = await helpers.methods.getSponsor(flipper.options.address).call();
+    const result = await helpers.methods.sponsor(flipper.options.address).call();
 
     expect(result[0]).to.be.eq(flipper.options.address);
     expect(result[1]).to.be.eq('0');
@@ -237,7 +237,7 @@
     await helpers.methods.setSponsor(flipper.options.address, sponsor).send();
     await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});
     
-    const result = await helpers.methods.getSponsor(flipper.options.address).call();
+    const result = await helpers.methods.sponsor(flipper.options.address).call();
 
     expect(result[0]).to.be.eq(sponsor);
     expect(result[1]).to.be.eq('0');
@@ -482,7 +482,7 @@
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const flipper = await deployFlipper(web3, owner);
     const helpers = contractHelpers(web3, owner);
-    expect(await helpers.methods.getSponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');
+    expect(await helpers.methods.sponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');
   });
 });
 
@@ -551,7 +551,7 @@
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const flipper = await deployFlipper(web3, owner);
     const helpers = contractHelpers(web3, owner);
-    expect(await helpers.methods.getSponsoringFeeLimit(flipper.options.address).call()).to.be.equals('115792089237316195423570985008687907853269984665640564039457584007913129639935');
+    expect(await helpers.methods.sponsoringFeeLimit(flipper.options.address).call()).to.be.equals('115792089237316195423570985008687907853269984665640564039457584007913129639935');
   });
 
   itWeb3('Set fee limit', async ({api, web3, privateKeyWrapper}) => {
@@ -559,7 +559,7 @@
     const flipper = await deployFlipper(web3, owner);
     const helpers = contractHelpers(web3, owner);
     await helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send();
-    expect(await helpers.methods.getSponsoringFeeLimit(flipper.options.address).call()).to.be.equals('100');
+    expect(await helpers.methods.sponsoringFeeLimit(flipper.options.address).call()).to.be.equals('100');
   });
 
   itWeb3('Negative test - set fee limit by non-owner', async ({api, web3, privateKeyWrapper}) => {
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
before · tests/src/eth/util/contractHelpersAbi.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "contractAddress",9        "type": "address"10      }11    ],12    "name": "ContractSponsorRemoved",13    "type": "event"14  },15  {16    "anonymous": false,17    "inputs": [18      {19        "indexed": true,20        "internalType": "address",21        "name": "contractAddress",22        "type": "address"23      },24      {25        "indexed": false,26        "internalType": "address",27        "name": "sponsor",28        "type": "address"29      }30    ],31    "name": "ContractSponsorSet",32    "type": "event"33  },34  {35    "anonymous": false,36    "inputs": [37      {38        "indexed": true,39        "internalType": "address",40        "name": "contractAddress",41        "type": "address"42      },43      {44        "indexed": false,45        "internalType": "address",46        "name": "sponsor",47        "type": "address"48      }49    ],50    "name": "ContractSponsorshipConfirmed",51    "type": "event"52  },53  {54    "inputs": [55      {56        "internalType": "address",57        "name": "contractAddress",58        "type": "address"59      },60      { "internalType": "address", "name": "user", "type": "address" }61    ],62    "name": "allowed",63    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],64    "stateMutability": "view",65    "type": "function"66  },67  {68    "inputs": [69      {70        "internalType": "address",71        "name": "contractAddress",72        "type": "address"73      }74    ],75    "name": "allowlistEnabled",76    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],77    "stateMutability": "view",78    "type": "function"79  },80  {81    "inputs": [82      {83        "internalType": "address",84        "name": "contractAddress",85        "type": "address"86      }87    ],88    "name": "confirmSponsorship",89    "outputs": [],90    "stateMutability": "nonpayable",91    "type": "function"92  },93  {94    "inputs": [95      {96        "internalType": "address",97        "name": "contractAddress",98        "type": "address"99      }100    ],101    "name": "contractOwner",102    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],103    "stateMutability": "view",104    "type": "function"105  },106  {107    "inputs": [108      {109        "internalType": "address",110        "name": "contractAddress",111        "type": "address"112      }113    ],114    "name": "getSponsor",115    "outputs": [116      {117        "components": [118          { "internalType": "address", "name": "field_0", "type": "address" },119          { "internalType": "uint256", "name": "field_1", "type": "uint256" }120        ],121        "internalType": "struct Tuple0",122        "name": "",123        "type": "tuple"124      }125    ],126    "stateMutability": "view",127    "type": "function"128  },129  {130    "inputs": [131      {132        "internalType": "address",133        "name": "contractAddress",134        "type": "address"135      }136    ],137    "name": "getSponsoringFeeLimit",138    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],139    "stateMutability": "view",140    "type": "function"141  },142  {143    "inputs": [144      {145        "internalType": "address",146        "name": "contractAddress",147        "type": "address"148      }149    ],150    "name": "getSponsoringRateLimit",151    "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],152    "stateMutability": "view",153    "type": "function"154  },155  {156    "inputs": [157      {158        "internalType": "address",159        "name": "contractAddress",160        "type": "address"161      }162    ],163    "name": "hasPendingSponsor",164    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],165    "stateMutability": "view",166    "type": "function"167  },168  {169    "inputs": [170      {171        "internalType": "address",172        "name": "contractAddress",173        "type": "address"174      }175    ],176    "name": "hasSponsor",177    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],178    "stateMutability": "view",179    "type": "function"180  },181  {182    "inputs": [183      {184        "internalType": "address",185        "name": "contractAddress",186        "type": "address"187      }188    ],189    "name": "removeSponsor",190    "outputs": [],191    "stateMutability": "nonpayable",192    "type": "function"193  },194  {195    "inputs": [196      {197        "internalType": "address",198        "name": "contractAddress",199        "type": "address"200      }201    ],202    "name": "selfSponsoredEnable",203    "outputs": [],204    "stateMutability": "nonpayable",205    "type": "function"206  },207  {208    "inputs": [209      {210        "internalType": "address",211        "name": "contractAddress",212        "type": "address"213      },214      { "internalType": "address", "name": "sponsor", "type": "address" }215    ],216    "name": "setSponsor",217    "outputs": [],218    "stateMutability": "nonpayable",219    "type": "function"220  },221  {222    "inputs": [223      {224        "internalType": "address",225        "name": "contractAddress",226        "type": "address"227      },228      { "internalType": "uint256", "name": "feeLimit", "type": "uint256" }229    ],230    "name": "setSponsoringFeeLimit",231    "outputs": [],232    "stateMutability": "nonpayable",233    "type": "function"234  },235  {236    "inputs": [237      {238        "internalType": "address",239        "name": "contractAddress",240        "type": "address"241      },242      { "internalType": "uint8", "name": "mode", "type": "uint8" }243    ],244    "name": "setSponsoringMode",245    "outputs": [],246    "stateMutability": "nonpayable",247    "type": "function"248  },249  {250    "inputs": [251      {252        "internalType": "address",253        "name": "contractAddress",254        "type": "address"255      },256      { "internalType": "uint32", "name": "rateLimit", "type": "uint32" }257    ],258    "name": "setSponsoringRateLimit",259    "outputs": [],260    "stateMutability": "nonpayable",261    "type": "function"262  },263  {264    "inputs": [265      {266        "internalType": "address",267        "name": "contractAddress",268        "type": "address"269      }270    ],271    "name": "sponsoringEnabled",272    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],273    "stateMutability": "view",274    "type": "function"275  },276  {277    "inputs": [278      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }279    ],280    "name": "supportsInterface",281    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],282    "stateMutability": "view",283    "type": "function"284  },285  {286    "inputs": [287      {288        "internalType": "address",289        "name": "contractAddress",290        "type": "address"291      },292      { "internalType": "address", "name": "user", "type": "address" },293      { "internalType": "bool", "name": "isAllowed", "type": "bool" }294    ],295    "name": "toggleAllowed",296    "outputs": [],297    "stateMutability": "nonpayable",298    "type": "function"299  },300  {301    "inputs": [302      {303        "internalType": "address",304        "name": "contractAddress",305        "type": "address"306      },307      { "internalType": "bool", "name": "enabled", "type": "bool" }308    ],309    "name": "toggleAllowlist",310    "outputs": [],311    "stateMutability": "nonpayable",312    "type": "function"313  }314]
after · tests/src/eth/util/contractHelpersAbi.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "contractAddress",9        "type": "address"10      }11    ],12    "name": "ContractSponsorRemoved",13    "type": "event"14  },15  {16    "anonymous": false,17    "inputs": [18      {19        "indexed": true,20        "internalType": "address",21        "name": "contractAddress",22        "type": "address"23      },24      {25        "indexed": false,26        "internalType": "address",27        "name": "sponsor",28        "type": "address"29      }30    ],31    "name": "ContractSponsorSet",32    "type": "event"33  },34  {35    "anonymous": false,36    "inputs": [37      {38        "indexed": true,39        "internalType": "address",40        "name": "contractAddress",41        "type": "address"42      },43      {44        "indexed": false,45        "internalType": "address",46        "name": "sponsor",47        "type": "address"48      }49    ],50    "name": "ContractSponsorshipConfirmed",51    "type": "event"52  },53  {54    "inputs": [55      {56        "internalType": "address",57        "name": "contractAddress",58        "type": "address"59      },60      { "internalType": "address", "name": "user", "type": "address" }61    ],62    "name": "allowed",63    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],64    "stateMutability": "view",65    "type": "function"66  },67  {68    "inputs": [69      {70        "internalType": "address",71        "name": "contractAddress",72        "type": "address"73      }74    ],75    "name": "allowlistEnabled",76    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],77    "stateMutability": "view",78    "type": "function"79  },80  {81    "inputs": [82      {83        "internalType": "address",84        "name": "contractAddress",85        "type": "address"86      }87    ],88    "name": "confirmSponsorship",89    "outputs": [],90    "stateMutability": "nonpayable",91    "type": "function"92  },93  {94    "inputs": [95      {96        "internalType": "address",97        "name": "contractAddress",98        "type": "address"99      }100    ],101    "name": "contractOwner",102    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],103    "stateMutability": "view",104    "type": "function"105  },106  {107    "inputs": [108      {109        "internalType": "address",110        "name": "contractAddress",111        "type": "address"112      }113    ],114    "name": "hasPendingSponsor",115    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],116    "stateMutability": "view",117    "type": "function"118  },119  {120    "inputs": [121      {122        "internalType": "address",123        "name": "contractAddress",124        "type": "address"125      }126    ],127    "name": "hasSponsor",128    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],129    "stateMutability": "view",130    "type": "function"131  },132  {133    "inputs": [134      {135        "internalType": "address",136        "name": "contractAddress",137        "type": "address"138      }139    ],140    "name": "removeSponsor",141    "outputs": [],142    "stateMutability": "nonpayable",143    "type": "function"144  },145  {146    "inputs": [147      {148        "internalType": "address",149        "name": "contractAddress",150        "type": "address"151      }152    ],153    "name": "selfSponsoredEnable",154    "outputs": [],155    "stateMutability": "nonpayable",156    "type": "function"157  },158  {159    "inputs": [160      {161        "internalType": "address",162        "name": "contractAddress",163        "type": "address"164      },165      { "internalType": "address", "name": "sponsor", "type": "address" }166    ],167    "name": "setSponsor",168    "outputs": [],169    "stateMutability": "nonpayable",170    "type": "function"171  },172  {173    "inputs": [174      {175        "internalType": "address",176        "name": "contractAddress",177        "type": "address"178      },179      { "internalType": "uint256", "name": "feeLimit", "type": "uint256" }180    ],181    "name": "setSponsoringFeeLimit",182    "outputs": [],183    "stateMutability": "nonpayable",184    "type": "function"185  },186  {187    "inputs": [188      {189        "internalType": "address",190        "name": "contractAddress",191        "type": "address"192      },193      { "internalType": "uint8", "name": "mode", "type": "uint8" }194    ],195    "name": "setSponsoringMode",196    "outputs": [],197    "stateMutability": "nonpayable",198    "type": "function"199  },200  {201    "inputs": [202      {203        "internalType": "address",204        "name": "contractAddress",205        "type": "address"206      },207      { "internalType": "uint32", "name": "rateLimit", "type": "uint32" }208    ],209    "name": "setSponsoringRateLimit",210    "outputs": [],211    "stateMutability": "nonpayable",212    "type": "function"213  },214  {215    "inputs": [216      {217        "internalType": "address",218        "name": "contractAddress",219        "type": "address"220      }221    ],222    "name": "sponsor",223    "outputs": [224      {225        "components": [226          { "internalType": "address", "name": "field_0", "type": "address" },227          { "internalType": "uint256", "name": "field_1", "type": "uint256" }228        ],229        "internalType": "struct Tuple0",230        "name": "",231        "type": "tuple"232      }233    ],234    "stateMutability": "view",235    "type": "function"236  },237  {238    "inputs": [239      {240        "internalType": "address",241        "name": "contractAddress",242        "type": "address"243      }244    ],245    "name": "sponsoringEnabled",246    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],247    "stateMutability": "view",248    "type": "function"249  },250  {251    "inputs": [252      {253        "internalType": "address",254        "name": "contractAddress",255        "type": "address"256      }257    ],258    "name": "sponsoringFeeLimit",259    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],260    "stateMutability": "view",261    "type": "function"262  },263  {264    "inputs": [265      {266        "internalType": "address",267        "name": "contractAddress",268        "type": "address"269      }270    ],271    "name": "sponsoringRateLimit",272    "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],273    "stateMutability": "view",274    "type": "function"275  },276  {277    "inputs": [278      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }279    ],280    "name": "supportsInterface",281    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],282    "stateMutability": "view",283    "type": "function"284  },285  {286    "inputs": [287      {288        "internalType": "address",289        "name": "contractAddress",290        "type": "address"291      },292      { "internalType": "address", "name": "user", "type": "address" },293      { "internalType": "bool", "name": "isAllowed", "type": "bool" }294    ],295    "name": "toggleAllowed",296    "outputs": [],297    "stateMutability": "nonpayable",298    "type": "function"299  },300  {301    "inputs": [302      {303        "internalType": "address",304        "name": "contractAddress",305        "type": "address"306      },307      { "internalType": "bool", "name": "enabled", "type": "bool" }308    ],309    "name": "toggleAllowlist",310    "outputs": [],311    "stateMutability": "nonpayable",312    "type": "function"313  }314]