Skip to content

Commit

Permalink
Merge pull request #24 from The-Poolz/issue-23
Browse files Browse the repository at this point in the history
Issue #23
  • Loading branch information
DVitaliy authored Oct 23, 2023
2 parents 7e9ffd3 + 11ec25f commit 4b3b787
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/contracts/configs/BinanceTest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ export const BinanceTestChainConfig: TChainConfig = {
delayVault: {
address: "0x607155A953d5f598d2F7CcD9a6395Af389cfecE5",
nameVersion: "[email protected]"
},
lockDealNFT: {
address: "0xD40e523BCb4230FFA1126E301f4CA0294B8CF180",
nameVersion: "[email protected]"
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export { ThePoolzProvider, useThePoolz, useConnectWallet, useSiwe, useSidNameFor
export type { IThePoolzInterface, IERC20Info } from "./types/IThePoolzInterface"
export * from "./utils"
export * from "./constants"
export type { Contract } from "web3-eth-contract"
10 changes: 9 additions & 1 deletion src/poolz/ThePoolz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ThePoolz implements IThePoolzInterface {
public poolzBackWithdrawContract: IThePoolzInterface["poolzBackWithdrawContract"]
public lockedDealV2: IThePoolzInterface["lockedDealV2"]
public delayVaultContract: IThePoolzInterface["delayVaultContract"]
public lockDealNFTContract: IThePoolzInterface["lockDealNFTContract"]

#provider: typeof Web3.givenProvider
#contracts = new Map<string, Contract>()
Expand Down Expand Up @@ -70,7 +71,8 @@ class ThePoolz implements IThePoolzInterface {
private async initPoolzContracts() {
const chainConfig = AVAILABLE_CHAINS.get(this.chainId)
if (!chainConfig) return
const { poolzTokenAddress, poolzAddress, whiteListAddress, lockedDealV2, poolzBackWithdraw, signUpAddress, delayVault } = chainConfig
const { poolzTokenAddress, poolzAddress, whiteListAddress, lockedDealV2, poolzBackWithdraw, signUpAddress, delayVault, lockDealNFT } =
chainConfig

this.poolzTokenAddress = poolzTokenAddress

Expand Down Expand Up @@ -125,6 +127,12 @@ class ThePoolz implements IThePoolzInterface {
this.delayVaultContract = { ...delayVault, contract: new this.web3.eth.Contract(abi as AbiItem[], delayVault.address) }
} catch (e) {}
}
if (lockDealNFT) {
try {
const abi = await this.fetchContractAbi(lockDealNFT.nameVersion)
this.lockDealNFTContract = { ...lockDealNFT, contract: new this.web3.eth.Contract(abi as AbiItem[]) }
} catch (e) {}
}
}

async getChaincoinInfo(chainId?: typeof this.chainId) {
Expand Down
2 changes: 2 additions & 0 deletions src/types/IThePoolzInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface IThePoolzInterface {

poolzTokenAddress?: string
delayVaultContract?: IContractInfo
lockDealNFTContract?: IContractInfo

getChaincoinInfo(k?: number): Promise<IChainInfo | undefined>
ERC20Balance(token: string, account: string): Promise<string>
Expand Down Expand Up @@ -106,6 +107,7 @@ export interface IChainConfig {

poolzTokenAddress: IThePoolzInterface["poolzTokenAddress"]
delayVault: Omit<NonNullable<IThePoolzInterface["delayVaultContract"]>, "contract">
lockDealNFT: Omit<NonNullable<IThePoolzInterface["lockDealNFTContract"]>, "contract">
}

export type TChainConfig = Partial<IChainConfig>

0 comments on commit 4b3b787

Please sign in to comment.