Skip to content

Instantly share code, notes, and snippets.

@MCarlomagno
Created October 7, 2021 11:13
Show Gist options
  • Save MCarlomagno/bbdd51719de0a453840b7bc5d57d4aec to your computer and use it in GitHub Desktop.
Save MCarlomagno/bbdd51719de0a453840b7bc5d57d4aec to your computer and use it in GitHub Desktop.
Future<DeployedContract> getContract() async {
// abi.json is the contract metadata, you can download it from the remix IDE
String abi = await rootBundle.loadString("assets/abi.json");
String contractAddress = "my_contract_address"; // e.g. 0xd66C81d9b781152e2D9be07Ccdf2303A77B7163c
String contractName = "my_contract_name"; // you must set your own contract name here
DeployedContract contract = DeployedContract(
ContractAbi.fromJson(abi, contractName),
EthereumAddress.fromHex(contractAddress),
);
return contract;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment