Merge branch 'master' into master
This commit is contained in:
33
.github/ISSUE_TEMPLATE.md
vendored
Normal file
33
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
## The Problem
|
||||||
|
|
||||||
|
- [ ] 🐛 This is a bug report.
|
||||||
|
- [ ] 📈 This is a feature request.
|
||||||
|
|
||||||
|
<!-- Please check one of the above by placing an x in the box. -->
|
||||||
|
|
||||||
|
Briefly describe the issue you are experiencing (or the feature you want to see added to OpenZeppelin). Tell us what you were trying to do and what happened instead. **Remember, this is _not_ a place to ask for help debugging code; for that, we welcome you in the [OpenZeppelin Slack Channel](https://slack.openzeppelin.org/).**
|
||||||
|
|
||||||
|
## 💻 Environment
|
||||||
|
|
||||||
|
First, we need to know what your environment looks like.
|
||||||
|
|
||||||
|
- Which version of OpenZeppelin are you using?
|
||||||
|
- What network are you deploying to? testrpc? Ganache? Ropsten?
|
||||||
|
- How are you deploying your OpenZeppelin-backed contracts? truffle? Remix? Let us know!
|
||||||
|
|
||||||
|
## 📝 Details
|
||||||
|
|
||||||
|
Describe the problem you have been experiencing in more detail. Include as much information as you think is relevant. Keep in mind that transactions can fail for many reasons; context is key here.
|
||||||
|
|
||||||
|
## 🔢 Code To Reproduce Issue [ Good To Have ]
|
||||||
|
|
||||||
|
Please remember that with sample code it's easier to reproduce the bug and it's much faster to fix it.
|
||||||
|
|
||||||
|
```
|
||||||
|
insert short code snippets here
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- If your code is larger, consider linking us to a repo illustrating your issue. -->
|
||||||
|
|
||||||
|
## 👍 Other Information
|
||||||
|
<!-- List any other information that is relevant to your issue. Error logs, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
|
||||||
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!-- 🎉 Thank you for submitting a PR! Before submitting, please review the following checklist: -->
|
||||||
|
|
||||||
|
- [ ] 📘 I've reviewed the [OpenZeppelin Contributor Guidelines](/docs/CONTRIBUTING.md)
|
||||||
|
- [ ] ✅ I've added tests where applicable to test my new functionality.
|
||||||
|
- [ ] 📖 I've made sure that my contracts are well-documented.
|
||||||
|
- [ ] 🎨 I've run the JavaScript linter (`npm run lint:fix`) and fixed all issues.
|
||||||
|
|
||||||
|
<!-- **Does this close any open issues?** If so, list them here. -->
|
||||||
|
|
||||||
|
Fixes #
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🚀 Description
|
||||||
|
|
||||||
|
<!-- Describe the changes introduced in this pull request -->
|
||||||
|
<!-- Include any context necessary for understanding the PR's purpose. -->
|
||||||
@ -80,6 +80,8 @@ git checkout -b fix/some-bug
|
|||||||
git checkout -b remove/some-file
|
git checkout -b remove/some-file
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If your branch is planned to fix an open issue, postfix your branch name with the issue number like `fix/some-bug-#123`.
|
||||||
|
|
||||||
We expect pull requests to be rebased to the master branch before merging:
|
We expect pull requests to be rebased to the master branch before merging:
|
||||||
```sh
|
```sh
|
||||||
git remote add zep git@github.com:OpenZeppelin/zeppelin-solidity.git
|
git remote add zep git@github.com:OpenZeppelin/zeppelin-solidity.git
|
||||||
|
|||||||
@ -24,6 +24,7 @@ contract SimpleToken is StandardToken {
|
|||||||
function SimpleToken() public {
|
function SimpleToken() public {
|
||||||
totalSupply = INITIAL_SUPPLY;
|
totalSupply = INITIAL_SUPPLY;
|
||||||
balances[msg.sender] = INITIAL_SUPPLY;
|
balances[msg.sender] = INITIAL_SUPPLY;
|
||||||
|
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "scripts/test.sh",
|
"test": "scripts/test.sh",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
"lint:fix": "eslint . --fix",
|
||||||
"console": "truffle console",
|
"console": "truffle console",
|
||||||
"coverage": "scripts/coverage.sh"
|
"coverage": "scripts/coverage.sh"
|
||||||
},
|
},
|
||||||
|
|||||||
41
test/SimpleToken.test.js
Normal file
41
test/SimpleToken.test.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import decodeLogs from './helpers/decodeLogs';
|
||||||
|
const SimpleToken = artifacts.require('examples/SimpleToken.sol');
|
||||||
|
|
||||||
|
contract('SimpleToken', accounts => {
|
||||||
|
let token;
|
||||||
|
const creator = accounts[0];
|
||||||
|
|
||||||
|
beforeEach(async function () {
|
||||||
|
token = await SimpleToken.new({ from: creator });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has a name', async function () {
|
||||||
|
const name = await token.name();
|
||||||
|
assert.equal(name, 'SimpleToken');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has a symbol', async function () {
|
||||||
|
const symbol = await token.symbol();
|
||||||
|
assert.equal(symbol, 'SIM');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has 18 decimals', async function () {
|
||||||
|
const decimals = await token.decimals();
|
||||||
|
assert(decimals.eq(18));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('assigns the initial total supply to the creator', async function () {
|
||||||
|
const totalSupply = await token.totalSupply();
|
||||||
|
const creatorBalance = await token.balanceOf(creator);
|
||||||
|
|
||||||
|
assert(creatorBalance.eq(totalSupply));
|
||||||
|
|
||||||
|
const receipt = web3.eth.getTransactionReceipt(token.transactionHash);
|
||||||
|
const logs = decodeLogs(receipt.logs, SimpleToken, token.address);
|
||||||
|
assert.equal(logs.length, 1);
|
||||||
|
assert.equal(logs[0].event, 'Transfer');
|
||||||
|
assert.equal(logs[0].args.from.valueOf(), 0x0);
|
||||||
|
assert.equal(logs[0].args.to.valueOf(), creator);
|
||||||
|
assert(logs[0].args.value.eq(totalSupply));
|
||||||
|
});
|
||||||
|
});
|
||||||
8
test/helpers/decodeLogs.js
Normal file
8
test/helpers/decodeLogs.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const SolidityEvent = require('web3/lib/web3/event.js');
|
||||||
|
|
||||||
|
export default function decodeLogs (logs, contract, address) {
|
||||||
|
return logs.map(log => {
|
||||||
|
const event = new SolidityEvent(null, contract.events[log.topics[0]], address);
|
||||||
|
return event.decode(log);
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user