From 1b41994d49fed9e40c2c57e1964736960539a8dc Mon Sep 17 00:00:00 2001 From: Ashwin Arora Date: Thu, 16 Nov 2023 16:36:48 +0530 Subject: [PATCH] added new contract multiSender --- src/contracts/configs/BinanceMain.config.ts | 6 +++++- src/contracts/configs/BinanceTest.config.ts | 4 ++++ src/poolz/ThePoolz.ts | 12 +++++++++++- src/types/IThePoolzInterface.ts | 2 ++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/contracts/configs/BinanceMain.config.ts b/src/contracts/configs/BinanceMain.config.ts index 8bd0878..37795a2 100644 --- a/src/contracts/configs/BinanceMain.config.ts +++ b/src/contracts/configs/BinanceMain.config.ts @@ -10,5 +10,9 @@ export const BinanceMainChainConfig: TChainConfig = { signUpAddress: "0x41b56bF3b21C53F6394a44A2ff84f1d2bBC27841", poolzBackWithdraw: "0x7Ff9315f538dF7eC76Ec4815249Dd30519726460", poolzTokenAddress: "0xbAeA9aBA1454DF334943951d51116aE342eAB255", - delayVault: { address: "0x5eb57B1210338b13E3D5572d5e1670285Aa71702", nameVersion: "DelayVault@1.2.2" } + delayVault: { address: "0x5eb57B1210338b13E3D5572d5e1670285Aa71702", nameVersion: "DelayVault@1.2.2" }, + multiSender: { + address: "0x0759EdEd403B704dc8e76b4c73026782b58E0ED7", + nameVersion: "MultiSender@1.0.0" + } } diff --git a/src/contracts/configs/BinanceTest.config.ts b/src/contracts/configs/BinanceTest.config.ts index 31ba940..d6f2301 100644 --- a/src/contracts/configs/BinanceTest.config.ts +++ b/src/contracts/configs/BinanceTest.config.ts @@ -49,5 +49,9 @@ export const BinanceTestChainConfig: TChainConfig = { simpleRefundBuilder: { address: "0x9c39a03459522185a1598D4ad2a9cCCCB0F5Ff8f", nameVersion: "SimpleRefundBuilder@0.9.0" + }, + multiSender: { + address: "0x2dAc629DbD97f248A3443E446fA93330aF773571", + nameVersion: "MultiSender@1.0.0" } } diff --git a/src/poolz/ThePoolz.ts b/src/poolz/ThePoolz.ts index 94bfff0..6004b7d 100644 --- a/src/poolz/ThePoolz.ts +++ b/src/poolz/ThePoolz.ts @@ -38,6 +38,7 @@ class ThePoolz implements IThePoolzInterface { public refundProviderContract: IThePoolzInterface["refundProviderContract"] public simpleBuilderContract: IThePoolzInterface["simpleBuilderContract"] public simpleRefundBuilderContract: IThePoolzInterface["simpleRefundBuilderContract"] + public multiSenderContract: IThePoolzInterface["multiSenderContract"] #provider: typeof Web3.givenProvider #contracts = new Map() @@ -95,7 +96,8 @@ class ThePoolz implements IThePoolzInterface { collateralProvider, refundProvider, simpleBuilder, - simpleRefundBuilder + simpleRefundBuilder, + multiSender } = chainConfig this.poolzTokenAddress = poolzTokenAddress @@ -230,6 +232,14 @@ class ThePoolz implements IThePoolzInterface { .catch(e => {console.error(e)}) ); } + if (multiSender) { + abifetchPromises.push(this.fetchContractAbi(multiSender.nameVersion) + .then(abi => { + this.multiSenderContract = { ...multiSender, contract: new this.web3.eth.Contract(abi as AbiItem[], multiSender.address) } + }) + .catch(e => {console.error(e)}) + ); + } try { await Promise.allSettled(abifetchPromises) diff --git a/src/types/IThePoolzInterface.ts b/src/types/IThePoolzInterface.ts index 831cd83..b2dffe2 100644 --- a/src/types/IThePoolzInterface.ts +++ b/src/types/IThePoolzInterface.ts @@ -71,6 +71,7 @@ export interface IThePoolzInterface { refundProviderContract?: IContractInfo simpleBuilderContract?: IContractInfo simpleRefundBuilderContract?: IContractInfo + multiSenderContract?: IContractInfo getChaincoinInfo(k?: number): Promise ERC20Balance(token: string, account: string): Promise @@ -124,6 +125,7 @@ export interface IChainConfig { refundProvider: Omit, "contract"> simpleBuilder: Omit, "contract"> simpleRefundBuilder: Omit, "contract"> + multiSender: Omit, "contract"> } export type TChainConfig = Partial