This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We require the Hardhat Runtime Environment explicitly here. This is optional | |
// but useful for running the script in a standalone fashion through `node <script>`. | |
// When running the script with `hardhat run <script>` you'll find the Hardhat | |
// Runtime Environment's members available in the global scope. | |
const hre = require("hardhat"); | |
async function main() { | |
// Hardhat always runs the compile task when running scripts through it. | |
// If this runs in a standalone fashion you may want to call compile manually | |
// to make sure everything is compiled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We require the Hardhat Runtime Environment explicitly here. This is optional | |
// but useful for running the script in a standalone fashion through `node <script>`. | |
// When running the script with `hardhat run <script>` you'll find the Hardhat | |
// Runtime Environment's members available in the global scope. | |
const hre = require("@nomiclabs/hardhat"); | |
async function main() { | |
// Hardhat always runs the compile task when running scripts through it. | |
// If this runs in a standalone fashion you may want to call compile manually | |
// to make sure everything is compiled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.21 <0.6.0; | |
contract TennisMatch { | |
address public owner; | |
uint8 public playerAScore = 0; | |
uint8 public playerAGamesWon = 0; | |
uint8 public playerBScore = 0; | |
uint8 public playerBGamesWon = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.21 <0.6.0; | |
contract TennisMatch { | |
address public owner; | |
uint8 public playerAScore = 0; | |
uint8 public playerAGamesWon = 0; | |
uint8 public playerBScore = 0; | |
uint8 public playerBGamesWon = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract Calculator { | |
uint c; | |
function add(uint a, uint b) public { | |
c = a + b; | |
} | |
function sub(uint a, uint b) public { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Calculator = artifacts.require('Calculator'); | |
module.exports = function (deployer) { | |
deployer.deploy(Calculator); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Calculator = artifacts.require("./Calculator.sol"); | |
contract('Calculator', function (accounts) { | |
it("shouldn't allow division by zero", async function () { | |
const fail = await Calculator.new(); | |
await fail.div(5, 0); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Calculator = artifacts.require("./Calculator.sol"); | |
contract('Calculator', function (accounts) { | |
it("shouldn't allow division by zero", async function () { | |
let error; | |
const fail = await Calculator.new(); | |
try { | |
await fail.div(5, 0); | |
} catch (e) { | |
error = e; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
networks: { | |
ganache: { | |
host: "127.0.0.1", | |
port: 8545, | |
network_id: "*", | |
}, | |
tenderly: { | |
host: "127.0.0.1", | |
port: 9545, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract Calculator { | |
uint c; | |
function add(uint a, uint b) public { | |
c = a + b; | |
} | |
function sub(uint a, uint b) public { |
NewerOlder