-
Hello Everyone, In "helpful_scripts.py" under function "fund_with_link" in course Patrick showed us 2 methods of passing deployed link_token contract address by using "LinkToken.sol" mock and by using "LinkTokenInterface.sol". I was trying to do it with that second method but I'm getting error that "link_token.address" has no argument address and obviously it is because we are not longer reading deployed "link_token" address from "deploy_mocks" function and it should be provided by "LinkTokenInterface" I believe. I have fixed below code by using global variable for "link_token" from "deploy_mocks" function and removing "link_token" argument from "fund_with_link" function but in this case we are still using deployed mock and not interface LinkTokenInterface. How to code it properly to get rid of error? def fund_with_link(contract_address, account = None, link_token = None, link_amount = 10 ** 17):
account = account if account else get_account()
link_token_contract = interface.LinkTokenInterface(link_token.address)
tx = link_token_contract.transfer(contract_address, link_amount, {"from": account})
tx.wait(1)
print("Contract Has Been Funded!")
return tx Thank you in advance for help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello @Neftyr so in this case you will have to put the address on brownie-config and then on your script get it using config. I hope this info might help. |
Beta Was this translation helpful? Give feedback.
Hello @Neftyr
An interface is something we use to interact with an already deployed contract but without having to implement all it's functions, so in order to interact with the link token interface, you should provide an address of the linktoken contract deployed (you will find the addresses on chainlink docs).
so in this case you will have to put the address on brownie-config and then on your script get it using config.
I hope this info might help.