IterableMapping library is deployed instead of the main contract

I wanted to test out this contract from BSC

upon copying it on remix and choosing the main contract a prompt with "test.sol:IterableMapping" is showing and upon deploying it on testnet the library IterableMapping is deployed instead of the main contract

anyone having the same issue in the past?

when you deployed it, there are two transaction, 1 for eploying main contract and another is for iterable contract. so while verification your main contract, you'll have to integrate this library [iterable].

1 Like

if you leave the library function as public you will deploy 2 different contracts.
Instead you can set the library function visbility to internal

1 Like

I don't understand, Whenever I am deploying it on the main contract "DaddyDollar" I only have a single prompt, it just says "creation of library test.sol:iterable mapping pending"

where can I find the other transaction?

for some reason it doesn't prompt 2 contract, it only does prompt one which was the library.
whenever I am trying to deploy the main contract (DaddyDollar) it just prompts a single one which is ""creation of library test.sol:iterablemapping pending"

so how do I set the library to internal?

Just replace public or external with internal for each function inside the library

1 Like

for those who have the same problem,

This is only applicable on remix :
you need to deploy the IterableMapping(or any library) first before the main contract, upon deploying the library, include it on the json of the main contract from the artifacts so that it will read that you have it already deployed

Eg.
MyToken.json
custom:
address :"0x00deployedlibrary" //<-edit this and replace the library address
DeployLib : false // <- true by default, just set to false


reference