Turn a mess of tricky Solidity tools into a smooth workflow

Unlock your productivity through flexibility, interoperability, and standardization.

hero

Buidler is a task runner for Ethereum smart contract developers.

It works with all developer tools, rather than replace any specific ones. It's value comes from being the connective tissue, rather than from specific functionality. It's an integration platform for other tools to build upon.

hero

How?

1. Write your contract


import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

pragma solidity ^0.5.1;
    
contract DeathStar is ERC721 {

  address private owner;

  constructor (address owner) public {
    owner = owner;
  }

  function shoot(string memory planet) public {
    require(msg.sender == owner);
    // TODO: BAM
  }
}

2. Choose your plugins & setup

// For unit tests
usePlugin("@nomiclabs/buidler-truffle5");
usePlugin("@nomiclabs/buidler-ganache");
usePlugin("buidler-gas-reporter");

// Linting
usePlugin("@nomiclabs/buidler-solhint");

// For scripts
usePlugin("@nomiclabs/buidler-ethers");

// Faster compilation
usePlugin("@nomiclabs/buidler-docker-solc");

module.exports = {
  buidlerevm: {
    throwOnTransactionFailures: true
  }
};

3. Write your tests

contract('ERC721', function () {
  describe('safeTransferFrom to a contract that does not implement the required function', function () {
    it('reverts', async function () {

      const invalidReceiver = this.token;

      await this.token.safeTransferFrom(
        owner,
        invalidReceiver.address,
        tokenId,
        { from: owner }
      )        
    });
  });
});

4. Debug your code with Buidler EVM

$ npx buidler test

Contract: DeathStar
  safeTransferFrom to a contract that does not implement the required function:

Error: Transaction reverted: function selector was not recognized and there's no fallback function
  at DeathStar.<unrecognized-selector> (contracts/DeathStar.sol:9)
  at DeathStar._checkOnERC721Received (contracts/token/ERC721/ERC721.sol:334)
  at DeathStar._safeTransferFrom (contracts/token/ERC721/ERC721.sol:196)
  at DeathStar.safeTransferFrom (contracts/token/ERC721/ERC721.sol:179)
  at DeathStar.safeTransferFrom (contracts/token/ERC721/ERC721.sol:162)
  at TruffleContract.safeTransferFrom (node_modules/@nomiclabs/truffle-contract/lib/execute.js:157:24)
  at Context.<anonymous> (test/DeathStar-test.js:321:26)


Used By

Migrate from Truffle now