Skip to content
This repository was archived by the owner on Jan 4, 2024. It is now read-only.

Commit 402b76c

Browse files
committed
Add test folder for OpenZeppelin SimpleToken
1 parent 12c338d commit 402b76c

File tree

10 files changed

+3332
-0
lines changed

10 files changed

+3332
-0
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
docs/
2+
test/

test/metacoin/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
INFURA_ID=
2+
MNEMONIC=
3+
ETHERSCAN_API_KEY=
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
INFURA_ID=
2+
MNEMONIC=
3+
ETHERSCAN_API_KEY=
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.6.0;
3+
4+
contract Migrations {
5+
address public owner;
6+
uint public last_completed_migration;
7+
8+
constructor() public {
9+
owner = msg.sender;
10+
}
11+
12+
modifier restricted() {
13+
if (msg.sender == owner) _;
14+
}
15+
16+
function setCompleted(uint completed) public restricted {
17+
last_completed_migration = completed;
18+
}
19+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.6.0;
3+
4+
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5+
6+
/**
7+
* @title SimpleToken
8+
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
9+
* Note they can later distribute these tokens as they wish using `transfer` and other
10+
* `ERC20` functions.
11+
*/
12+
contract SimpleToken is ERC20 {
13+
14+
/**
15+
* @dev Constructor that gives msg.sender all of existing tokens.
16+
*/
17+
constructor () public ERC20("Simple Token", "SIM") {
18+
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
19+
}
20+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const Migrations = artifacts.require("Migrations");
2+
3+
module.exports = function (deployer) {
4+
deployer.deploy(Migrations);
5+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const SimpleToken = artifacts.require("SimpleToken");
2+
3+
module.exports = function(deployer) {
4+
deployer.deploy(SimpleToken);
5+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "openzeppelin-token",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"dependencies": {
7+
"@openzeppelin/contracts": "^3.2.0",
8+
"@truffle/hdwallet-provider": "^1.1.0",
9+
"dotenv": "^8.2.0",
10+
"truffle-plugin-verify": "../.."
11+
}
12+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const HDWalletProvider = require('@truffle/hdwallet-provider')
2+
require('dotenv').config()
3+
4+
module.exports = {
5+
compilers: {
6+
solc: {
7+
version: '0.6.11',
8+
}
9+
},
10+
plugins: ['truffle-plugin-verify'],
11+
api_keys: {
12+
etherscan: process.env.ETHERSCAN_API_KEY
13+
},
14+
networks: {
15+
rinkeby: {
16+
provider: () => {
17+
return new HDWalletProvider(`${process.env.MNEMONIC}`, `https://rinkeby.infura.io/v3/${process.env.INFURA_ID}`)
18+
},
19+
gas: 0x7a1200,
20+
network_id: 4,
21+
skipDryRun: true
22+
},
23+
goerli: {
24+
provider: () => {
25+
return new HDWalletProvider(`${process.env.MNEMONIC}`, `https://goerli.infura.io/v3/${process.env.INFURA_ID}`)
26+
},
27+
gas: 0x7a1200,
28+
network_id: 5,
29+
skipDryRun: true
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)