I know that I can call methods or send transactions with web3.js
.
But, is it possible to interact with a deployed contract (not mine), like golem, status, etc.. with Remix Solidity IDE?
Interacting off-chain (web3js)
Yes, you will need to fetch ABI from a deployed contract. Popular contracts usually publish their code on sites like Etherscan. For example, here you can find a source code and ABI for Golem contract which is deployed to 0xa74476443119A942dE498590Fe1f2454d7D4aC0d
.
Then you may create an instance of contract
object using web3js
to interact with the deployed code at the given address:
var MyContract = web3.eth.contract(FETCHED_ABI);
// instantiate by address
var contractInstance = MyContract.at(DEPLOYED_ADDRESS);
Here you can read more about interacting with contracts.
Interacting on-chain (Remix)
In your contract can inline interface with the methods of Golem contract that you want to use:
contract GolemToken {
function totalSupply() external constant returns (uint256){}
}
Then you simply cast an address to this contract and call a method:
GolemToken token = GolemToken(ADDRESS);
uint supply = token.totalSuppy();
I hope it helps!
-
Thanks. I know I can interact with a deployed contract with web3.js. Sorry but I realize that I've made a mistake in my question. What I wuol like to know is if I can interact with a deployed contract using the Remix Solidity IDE (with Metamask). I edited the question. – d3llafr33 Jul 11 '17 at 15:43
-