I use Truffle and Ganache and I want to test some contracts that use the ERC820 Registry. I'm new to Truffle (and JavaScript in general) and I'm struggling to follow the instructions described in EIP-820 to get the registry deployed.
I have a 1_initial_migration.js
and a 2_deploy_contracts.js
file in my migrations
folder. That look like:
var Migrations = artifacts.require("./Migrations.sol");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};
and
var Registry = artifacts.require("./ERC820Registry.sol");
var Token = artifacts.require("./Token.sol");
module.exports = function (deployer) {
deployer.deploy(Registry);
deployer.deploy(Token);
};
This obviously deploys the ERC820 to another address than 0x820b586C8C28125366C998641B09DCbE7d4cBF06
.
How would I have to change my deployment file for it to be able to deploy the ERC820 Registry to its correct address?
deploy to its correct address
????? Either this contract is not yet deployed, in which case it can be deployed at any address with no impact on its behavior whatsoever, or it is already deployed at the address that you've mentioned, in which case you don't need to deploy it at all.0x820b586C8C28125366C998641B09DCbE7d4cBF06
. It is true that the behaviour does not change if it would be deployed to another address, but other contracts using the registry are counting on it being at address0x820b586C8C28125366C998641B09DCbE7d4cBF06
.var registry = await Registry.at("0x820b586C8C28125366C998641B09DCbE7d4cBF06");
in order to get a handle to it.ERC820Registry constant ERC820REGISTRY = ERC820Registry(0x820b586C8C28125366C998641B09DCbE7d4cBF06);
, will that work if the contract is not actually deployed? (that example line is a copy of how the ERC820 reference implementation uses it athttps://github.com/jbaylina/ERC820/blob/master/contracts/ERC820Client.sol
)will that work if the contract is not actually deployed
- Of course not, but based on everything else that you've described here, it IS deployed at that specific address (how else wouldother contracts using the registry be counting on it being at that address
?).