1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00
metamask-extension/test/e2e/seeder/ganache-contract-address-registry.js
David Drazic 76c06692df
[e2e] Deploy contracts directly seeding Ganache (#14631)
* Add some experimental Ganache seeder WIP

Refactor GanacheSeeder

* Added all smart contract bytecodes and abis

* Deploy smart contract by contract name

* Clean up and fix tx hash

* Removed console logs

* Remove last console log

* Use node module path for grabbing contract constants

* Remove contract deployment example on e2e test

* Small refactor for removing extra line

Co-authored-by: seaona <mariona@gmx.es>
2022-07-21 19:08:01 +02:00

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;