Skip to content

Instantly share code, notes, and snippets.

💭
Try Buidler, the new Solidity dev tool https://buidler.dev

Franco Zeoli fzeoli

💭
Try Buidler, the new Solidity dev tool https://buidler.dev
Block or report user

Report or block fzeoli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View buidler.config.js
usePlugin("@nomiclabs/buidler-web3");
task("balance", "Prints an account's balance")
.addParam("account", "The account's address")
.setAction(async taskArgs => {
const account = web3.utils.toChecksumAddress(taskArgs.account);
const balance = await web3.eth.getBalance(account);
console.log(web3.utils.fromWei(balance, "ether"), "ETH");
});
View buidler.config.js
usePlugin("@nomiclabs/buidler-web3");
task("balance", "Prints an account's balance")
.addParam("account", "The account's address")
module.exports = {};
View buidler.config.js
usePlugin("@nomiclabs/buidler-web3");
task("balance", "Prints an account's balance");
module.exports = {};
View buidler.config.js
extendEnvironment((env) => {
const wrapper = new EthersProviderWrapper(env.ethereum);
env.ethers = {
provider: wrapper,
getContract: async function (name) {
const artifact = await readArtifact(env.config.paths.artifacts, name);
const bytecode = artifact.bytecode;
const signers = await env.ethers.signers();
View deploy.js
async function main() {
const Greeter = artifacts.require("Greeter");
const greeter = await Greeter.new("Hello, Buidler!");
console.log("Greeter deployed to:", greeter.address);
}
main()
.then(() => process.exit(0))
.catch(error => {
View sample-test.js
const assert = require("assert");
describe("Ethereum provider", function() {
it("Should return the accounts", async function() {
const accounts = await ethereum.send("eth_accounts");
assert(accounts.length !== 0, "No account was returned");
});
});
contract("Greeter", function() {
View buidler.config.js
require("@nomiclabs/buidler-truffle5");
module.exports = {
solc: {version: "0.5.2"}
};
View buidler.config.js
extendEnvironment((env) => {
env.hi = "hello, buidler";
});
task("envtest", (args, env) => {
console.log(env.hi);
});
module.exports = {};
View buidler.config.js
extendEnvironment((env) => {
env.hi = "hello, buidler";
});
module.exports = {};
View buidler.config.js
const { ContractFactory, ethers, Signer } = require("ethers");
const {JsonRpcProvider} = require("ethers/providers");
function createJsonRpcRequest(method, params) {
return {
id: nextId++,
jsonrpc: "2.0",
method,
params
};
You can’t perform that action at this time.