Skip to content

Instantly share code, notes, and snippets.

pragma solidity >=0.7.0 <0.9.0;
contract Base {
uint x;
constructor() public {
x = 10;
}
@ConsenSys-Academy
ConsenSys-Academy / test.app.js
Last active November 16, 2019 20:41
Test file for Ethereum developer ProjectSubmission coding exercise
// ===== DO NOT MODIFY THIS FILE =====
var assert = require('assert')
const Web3 = require('web3')
const App = require('../scripts/app.helper.js')
let accounts = []
/*
pragma solidity >=0.7.0 <0.9.0;
contract Base {
uint public num;
address public sender;
function setNum(uint _num) public {
num = _num;
sender = msg.sender;
}
@ConsenSys-Academy
ConsenSys-Academy / SimpleStorage.json
Last active October 24, 2021 23:10
A Solidity SimpleStorage contract
[
{
"constant": false,
"inputs": [
{
"internalType": "uint256",
"name": "x",
"type": "uint256"
}
],
@ConsenSys-Academy
ConsenSys-Academy / FactoryTest.sol
Last active July 25, 2019 22:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity ^0.5.0;
contract Child {
address creator;
event newChild(address _a);
constructor()
public
{
// ===== DO NOT MODIFY THIS FILE =====
const BN = web3.utils.BN
const SupplyChain = artifacts.require('SupplyChain')
contract('SupplyChain', accounts => {
const owner = accounts[0]
const alice = accounts[1]
const bob = accounts[2]
const price = '1000'
// This is an automated testing file for this repo: https://github.com/ConsenSys-Academy/event-ticket-exercise
var EventTicketsV2 = artifacts.require('EventTicketsV2')
let catchRevert = require("./exceptionsHelpers.js").catchRevert
const BN = web3.utils.BN
contract('EventTicketV2', function(accounts) {
const deployAccount = accounts[0]
const firstAccount = accounts[3]
@ConsenSys-Academy
ConsenSys-Academy / eventTickets.test.js
Last active June 5, 2019 15:22
This is one of the test files for the event tickets exercise here: https://github.com/ConsenSys-Academy/event-ticket-exercise
/*
This is one of the test files for the event tickets exercise here: https://github.com/ConsenSys-Academy/event-ticket-exercise
*/
var EventTickets = artifacts.require('EventTickets')
let catchRevert = require("./exceptionsHelpers.js").catchRevert
const BN = web3.utils.BN
contract('EventTicket', function(accounts) {
const firstAccount = accounts[0]
/*
This is the test file for the Supply Chain Exercise: https://github.com/ConsenSys-Academy/supply-chain-exercise
This test file has been updated for Truffle version 5.0. If your tests are failing, make sure that you are
using Truffle version 5.0. You can check this by running "truffle version" in the terminal. If version 5 is not
installed, you can uninstall the existing version with `npm uninstall -g truffle` and install the latest version (5.0)
with `npm install -g truffle`.
*/
let BN = web3.utils.BN
let SupplyChain = artifacts.require('SupplyChain')
/*
This test file has been updated for Truffle version 5.0. If your tests are failing, make sure that you are
using Truffle version 5.0. You can check this by running "trufffle version" in the terminal. If version 5 is not
installed, you can uninstall the existing version with `npm uninstall -g truffle` and install the latest version (5.0)
with `npm install -g truffle`.
*/
var SimpleBank = artifacts.require("./SimpleBank.sol");
const { expectRevert } = require('@openzeppelin/test-helpers');
contract("SimpleBank", function (accounts) {