@Dennison asked on Twitter:
You can use --fork in ganache-cli to fork from an Ethereum network (e.g. mainnet).
You can also use --unlock, and ganache-cli will unlock the accounts so that you can send transactions from those addresses, even if you don't have the private key.
(Thanks @nventuro
)
ganache-cli documentation: https://github.com/trufflesuite/ganache-cli
"fork":stringorobject- Fork from another currently running Ethereum client at a given block. When astring, input should be the HTTP location and port of the other client, e.g.http://localhost:8545. You can optionally specify the block to fork from using an@sign:http://localhost:8545@1599200. Can also be aWeb3 Providerobject, optionally used in conjunction with thefork_block_numberoption below.
-uor--unlock: Specify--unlock ...any number of times passing either an address or an account index to unlock specific accounts. When used in conjunction with--secure,--unlockwill override the locked state of specified accounts.$ ganache-cli --secure --unlock "0x1234..." --unlock "0xabcd..."...
This feature can also be used to impersonate accounts and unlock addresses you wouldn't otherwise have access to. When used with the
--forkfeature, you can use ganache-cli to make transactions as any address on the blockchain, which is very useful for testing and dynamic analysis.
Have you checked https://github.com/makerdao/testchain/blob/dai.js/README.md ?
The ganache-cli fork functionality is useful. Either way, you can mint DAI on the test networks yourself:
var rinkebyDai = "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa";
const daiAmount = "10000000000000000000000";
module.exports = async function(deployer, network, accounts) {
if (network == "rinkeby") {
let dai = await IDai.at(rinkebyDai);
await dai.allocateTo(accounts[0], daiAmount);
}
}