web3.pybefore we can play with our Dai. The
enable_unstable_package_management_apiflag is a temporary security measure. While
web3.pmis in alpha, we want to be extra sure that users understand the API might change in the future. This precaution will be removed once the
web3.pmAPI stabilizes in the next
erc20.snakecharmers.ethwhich resolves to the address
0x16763EaE3709e47eE6140507Ff84A61c23B0098A. You can explore the various erc20 tokens available on this registry on the ethPM explorer. Since our
w3instance is already connected to mainnet, all we have to do is set the registry.
dai-daipackage, it's quite simple to grab a contract instance class representing the Dai token contract. We will use the contract type
DSTokento grab the Dai instance.
dai_packageis an instance of
Packageclass. This class automatically filters available deployments that live on the connected
w3instance. To access a package's deployments that live on a different blockchain, you can pass a new
createcommand in combination with its corresponding Etherscan URI. If you're the curious type, and want to re-generate the package locally, these steps can be used to package up any of Etherscan's verified contracts on any blockchain.
_ethpm_packages/directory. You can use any package name or package version that makes sense.
ethpm install etherscan://0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359:1 --package-name my-package --package-version 1.0.0
_ethpm_packages/directory in the current working directory. If no such directory is found, it will automatically generate one. You can also pass the command an
--ethpm-dirflag to target a specific directory.
_ethpm_packages/directory, and you will also see it listed by calling