mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-13 13:17:13 +01:00
29 lines
676 B
JavaScript
29 lines
676 B
JavaScript
|
/*
|
||
|
* Use this class to store pre-deployed smart contract addresses of the contracts deployed to
|
||
|
* a local blockchain instance ran by Ganache.
|
||
|
*/
|
||
|
class GanacheContractAddressRegistry {
|
||
|
#addresses = {};
|
||
|
|
||
|
/**
|
||
|
* Store new contract address in key:value pair.
|
||
|
*
|
||
|
* @param contractName
|
||
|
* @param contractAddress
|
||
|
*/
|
||
|
storeNewContractAddress(contractName, contractAddress) {
|
||
|
this.#addresses[contractName] = contractAddress;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get deployed contract address by its name (key).
|
||
|
*
|
||
|
* @param contractName
|
||
|
*/
|
||
|
getContractAddress(contractName) {
|
||
|
return this.#addresses[contractName];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = GanacheContractAddressRegistry;
|