git.delta.rocks / unique-network / refs/commits / 5aafe0c25b7b

difftreelog

add contracts consts

PraetorP2022-11-24parent: #c4f8efb.patch.diff
in: master

7 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
376 type TreasuryAccountId: Get<Self::AccountId>;376 type TreasuryAccountId: Get<Self::AccountId>;
377377
378 /// Address under which the CollectionHelper contract would be available.378 /// Address under which the CollectionHelper contract would be available.
379 #[pallet::constant]
379 type ContractAddress: Get<H160>;380 type ContractAddress: Get<H160>;
380381
381 /// Mapper for token addresses to Ethereum addresses.382 /// Mapper for token addresses to Ethereum addresses.
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
47 type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;47 type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;
4848
49 /// Address, under which magic contract will be available49 /// Address, under which magic contract will be available
50 #[pallet::constant]
50 type ContractAddress: Get<H160>;51 type ContractAddress: Get<H160>;
5152
52 /// In case of enabled sponsoring, but no sponsoring rate limit set,53 /// In case of enabled sponsoring, but no sponsoring rate limit set,
modifiedtests/src/apiConsts.test.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {ApiPromise} from '@polkadot/api';17import {ApiPromise} from '@polkadot/api';
18import {ApiBase} from '@polkadot/api/base';
18import {usingPlaygrounds, itSub, expect} from './util';19import {usingPlaygrounds, itSub, expect} from './util';
1920
2021
41 transfersEnabled: true,42 transfersEnabled: true,
42};43};
44
45const EVM_COLLECTION_HELPERS_ADDRESS = '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f';
46const HELPERS_CONTRACT_ADDRESS = '0x842899ECF380553E8a4de75bF534cdf6fBF64049';
4347
44describe('integration test: API UNIQUE consts', () => {48describe('integration test: API UNIQUE consts', () => {
45 let api: ApiPromise;49 let api: ApiPromise;
102 checkConst(api.consts.unique.collectionAdminsLimit, COLLECTION_ADMINS_LIMIT);106 checkConst(api.consts.unique.collectionAdminsLimit, COLLECTION_ADMINS_LIMIT);
103 });107 });
108
109 itSub('HELPERS_CONTRACT_ADDRESS', () => {
110 expect(api.consts.evmContractHelpers.contractAddress.toString().toLowerCase()).to.be.equal(HELPERS_CONTRACT_ADDRESS.toLowerCase());
111 });
112
113 itSub('EVM_COLLECTION_HELPERS_ADDRESS', () => {
114 expect(api.consts.common.contractAddress.toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS.toLowerCase());
115 });
104});116});
105117
106function checkConst<T>(constValue: any, expectedValue: T) {118function checkConst<T>(constValue: any, expectedValue: T) {
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
103103
104 contractHelpers(caller: string): Contract {104 contractHelpers(caller: string): Contract {
105 const web3 = this.helper.getWeb3();105 const web3 = this.helper.getWeb3();
106 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, gas: this.helper.eth.DEFAULT_GAS});106 return new web3.eth.Contract(contractHelpersAbi as any, this.helper.getApi().consts.evmContractHelpers.contractAddress.toString(), {from: caller, gas: this.helper.eth.DEFAULT_GAS});
107 }107 }
108108
109 collectionHelpers(caller: string) {109 collectionHelpers(caller: string) {
110 const web3 = this.helper.getWeb3();110 const web3 = this.helper.getWeb3();
111 return new web3.eth.Contract(collectionHelpersAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, gas: this.helper.eth.DEFAULT_GAS});111 return new web3.eth.Contract(collectionHelpersAbi as any, this.helper.getApi().consts.common.contractAddress.toString(), {from: caller, gas: this.helper.eth.DEFAULT_GAS});
112 }112 }
113113
114 collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false): Contract {114 collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false): Contract {
modifiedtests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth
8import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';8import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';
9import type { Option, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';9import type { Option, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
10import type { Codec } from '@polkadot/types-codec/types';10import type { Codec } from '@polkadot/types-codec/types';
11import type { Perbill, Permill, Weight } from '@polkadot/types/interfaces/runtime';11import type { H160, Perbill, Permill, Weight } from '@polkadot/types/interfaces/runtime';
12import type { FrameSupportPalletId, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpVersionRuntimeVersion, SpWeightsRuntimeDbWeight, UpDataStructsCollectionLimits, XcmV1MultiLocation } from '@polkadot/types/lookup';12import type { FrameSupportPalletId, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpVersionRuntimeVersion, SpWeightsRuntimeDbWeight, UpDataStructsCollectionLimits, XcmV1MultiLocation } from '@polkadot/types/lookup';
1313
14export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;14export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;
69 * Set price to create a collection.69 * Set price to create a collection.
70 **/70 **/
71 collectionCreationPrice: u128 & AugmentedConst<ApiType>;71 collectionCreationPrice: u128 & AugmentedConst<ApiType>;
72 /**
73 * Address under which the CollectionHelper contract would be available.
74 **/
75 contractAddress: H160 & AugmentedConst<ApiType>;
72 /**76 /**
73 * Generic const77 * Generic const
74 **/78 **/
82 **/86 **/
83 [key: string]: Codec;87 [key: string]: Codec;
84 };88 };
89 evmContractHelpers: {
90 /**
91 * Address, under which magic contract will be available
92 **/
93 contractAddress: H160 & AugmentedConst<ApiType>;
94 /**
95 * Generic const
96 **/
97 [key: string]: Codec;
98 };
85 inflation: {99 inflation: {
86 /**100 /**
87 * Number of blocks that pass between treasury balance updates due to inflation101 * Number of blocks that pass between treasury balance updates due to inflation
modifiedtests/src/interfaces/lookup.tsdiffbeforeafterboth
2935 }2935 }
2936 }2936 }
2937 },2937 },
2938 /**2938 /**
2939 * Lookup340: pallet_maintenance::pallet::Call<T>2939 * Lookup338: pallet_maintenance::pallet::Call<T>
2940 **/2940 **/
2941 PalletMaintenanceCall: {2941 PalletMaintenanceCall: {
2942 _enum: ['enable', 'disable']2942 _enum: ['enable', 'disable']
2943 },2943 },
2944 /**2944 /**
2945 * Lookup341: pallet_test_utils::pallet::Call<T>2945 * Lookup339: pallet_test_utils::pallet::Call<T>
2946 **/2946 **/
2947 PalletTestUtilsCall: {2947 PalletTestUtilsCall: {
2948 _enum: {2948 _enum: {
2949 enable: 'Null',2949 enable: 'Null',
modifiedtests/src/interfaces/types-lookup.tsdiffbeforeafterboth
3175 readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents';3175 readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents';
3176 }3176 }
31773177
3178 /** @name PalletMaintenanceCall (340) */3178 /** @name PalletMaintenanceCall (338) */
3179 interface PalletMaintenanceCall extends Enum {3179 interface PalletMaintenanceCall extends Enum {
3180 readonly isEnable: boolean;3180 readonly isEnable: boolean;
3181 readonly isDisable: boolean;3181 readonly isDisable: boolean;
3182 readonly type: 'Enable' | 'Disable';3182 readonly type: 'Enable' | 'Disable';
3183 }3183 }
31843184
3185 /** @name PalletTestUtilsCall (341) */3185 /** @name PalletTestUtilsCall (339) */
3186 interface PalletTestUtilsCall extends Enum {3186 interface PalletTestUtilsCall extends Enum {
3187 readonly isEnable: boolean;3187 readonly isEnable: boolean;
3188 readonly isSetTestValue: boolean;3188 readonly isSetTestValue: boolean;