Skip to content

Commit

Permalink
Issue #126 (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
DVitaliy authored Dec 30, 2024
1 parent dda807c commit 585da79
Show file tree
Hide file tree
Showing 3 changed files with 25 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 @@ -83,5 +83,9 @@ export const BinanceTestChainConfig: TChainConfig = {
tokenNFTConnector: {
address: "0x99dfade11d9cd4c2b192efda205c50d982cd76a1",
nameVersion: "[email protected]"
},
dispenserProvider: {
address: "0xeff8a476a62Ba2Ff1C8a202BEC40b45B7b822EC1",
nameVersion: "[email protected]"
}
}
18 changes: 17 additions & 1 deletion src/poolz/ThePoolz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ThePoolz implements EnforceInterface<IThePoolzInterface, ThePoolz> {
public delayVaultProviderContract: IThePoolzInterface["delayVaultProviderContract"]
public delayVaultMigratorContract: IThePoolzInterface["delayVaultMigratorContract"]
public tokenNFTConnectorContract: IThePoolzInterface["tokenNFTConnectorContract"]
public dispenserProviderContract: IThePoolzInterface["dispenserProviderContract"]

#provider: typeof Web3.givenProvider
#contracts = new Map<string, Contract>()
Expand Down Expand Up @@ -108,7 +109,8 @@ class ThePoolz implements EnforceInterface<IThePoolzInterface, ThePoolz> {
multiSenderV2,
delayVaultProvider,
delayVaultMigrator,
tokenNFTConnector
tokenNFTConnector,
dispenserProvider
} = chainConfig

this.poolzTokenAddress = poolzTokenAddress
Expand Down Expand Up @@ -344,6 +346,20 @@ class ThePoolz implements EnforceInterface<IThePoolzInterface, ThePoolz> {
})
)
}
if (dispenserProvider) {
abifetchPromises.push(
this.fetchContractAbi(dispenserProvider.nameVersion)
.then((abi) => {
this.dispenserProviderContract = {
...dispenserProvider,
contract: new this.web3.eth.Contract(abi as AbiItem[], dispenserProvider.address)
}
})
.catch((e) => {
console.error(e)
})
)
}

try {
await Promise.allSettled(abifetchPromises)
Expand Down
4 changes: 4 additions & 0 deletions src/types/IThePoolzInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type AcceptableContractNames =
| "DelayVaultMigrator"
| "TokenNFTConnector"
| "MultiSenderV2"
| "DispenserProvider"

export type VersionNumber = `${number}.${number}.${number}`

Expand Down Expand Up @@ -97,6 +98,7 @@ export interface IThePoolzInterface {
delayVaultProviderContract?: IContractInfo
delayVaultMigratorContract?: IContractInfo
tokenNFTConnectorContract?: IContractInfo
dispenserProviderContract?: IContractInfo

init(): Promise<void>
getChaincoinInfo(k?: number): Promise<IChainInfo | undefined>
Expand Down Expand Up @@ -148,6 +150,8 @@ export interface IChainConfig {
delayVaultProvider: Omit<NonNullable<IThePoolzInterface["delayVaultProviderContract"]>, "contract">
delayVaultMigrator: Omit<NonNullable<IThePoolzInterface["delayVaultMigratorContract"]>, "contract">
tokenNFTConnector: Omit<NonNullable<IThePoolzInterface["tokenNFTConnectorContract"]>, "contract">

dispenserProvider: Omit<NonNullable<IThePoolzInterface["dispenserProviderContract"]>, "contract">
}

// copy chain data from https://chainid.network/chains.json
Expand Down

0 comments on commit 585da79

Please sign in to comment.