Skip to content

Commit

Permalink
chore: Natspec, whitespace, checksum (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
deluca-mike authored Dec 24, 2021
1 parent 3e5f4f1 commit c3d599d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 38 deletions.
40 changes: 20 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
version: 2.1

jobs:
dapp_test:
docker:
- image: bakii0499/dapptools:0.48.0-solc-0.8.7
steps:
- run:
name: Checkout erc20
command: |
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone [email protected]:maple-labs/erc20.git .
git checkout $CIRCLE_BRANCH
- run:
name: Build and test contracts
command: |
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git submodule update --init --recursive
./test.sh -c ./config/ci.json
no_output_timeout: 60m
dapp_test:
docker:
- image: bakii0499/dapptools:0.48.0-solc-0.8.7
steps:
- run:
name: Checkout erc20
command: |
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone [email protected]:maple-labs/erc20.git .
git checkout $CIRCLE_BRANCH
- run:
name: Build and test contracts
command: |
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git submodule update --init --recursive
./test.sh -c ./config/ci.json
no_output_timeout: 60m
workflows:
version: 2
test_all:
jobs:
- dapp_test:
context: seth
version: 2
test_all:
jobs:
- dapp_test:
context: seth
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/out
out/*
hevm*
.vscode/*
artifacts/*
docs/*
metadata.json
10 changes: 7 additions & 3 deletions src/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { IERC20 } from "./interfaces/IERC20.sol";

/**
* @title Modern and gas efficient ERC-20 implementation.
* @dev Code taken from https://github.com/maple-labs/erc20
* @dev Acknowledgements to Solmate, OpenZeppelin, and DSS for inspiring this code.
*/
contract ERC20 is IERC20 {
Expand All @@ -21,6 +20,11 @@ contract ERC20 is IERC20 {

mapping(address => mapping(address => uint256)) public override allowance;

/**
* @param name_ The name of the token.
* @param symbol_ The symbol of the token.
* @param decimals_ The decimal precision used by the token.
*/
constructor(string memory name_, string memory symbol_, uint8 decimals_) {
name = name_;
symbol = symbol_;
Expand All @@ -36,8 +40,8 @@ contract ERC20 is IERC20 {
return true;
}

function transfer(address to_, uint256 amount_) external override returns (bool success_) {
_transfer(msg.sender, to_, amount_);
function transfer(address recipient_, uint256 amount_) external override returns (bool success_) {
_transfer(msg.sender, recipient_, amount_);
return true;
}

Expand Down
24 changes: 12 additions & 12 deletions src/interfaces/IERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ interface IERC20 {

/**
* @dev Emits an event indicating that tokens have moved from one account to another.
* @param from Account that tokens have moved from.
* @param to Account that tokens have moved to.
* @param amount Amount of tokens that have been transferred.
* @param owner_ Account that tokens have moved from.
* @param recipient_ Account that tokens have moved to.
* @param amount_ Amount of tokens that have been transferred.
*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Transfer(address indexed owner_, address indexed recipient_, uint256 amount_);

/**
* @dev Emits an event indicating that one account has set the allowance of another account over their tokens.
* @param owner Account that tokens are approved from.
* @param spender Account that tokens are approved for.
* @param amount Amount of tokens that have been approved.
* @param owner_ Account that tokens are approved from.
* @param spender_ Account that tokens are approved for.
* @param amount_ Amount of tokens that have been approved.
*/
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Approval(address indexed owner_, address indexed spender_, uint256 amount_);

/**
* @dev Returns the name of the token.
Expand Down Expand Up @@ -55,7 +55,7 @@ interface IERC20 {

/**
* @dev Function that allows one account to set the allowance of another account over their tokens.
* @dev Emits an {Approval} event.
* Emits an {Approval} event.
* @param spender_ Account that tokens are approved for.
* @param amount_ Amount of tokens that have been approved.
* @return success_ Boolean indicating whether the operation succeeded.
Expand All @@ -64,7 +64,7 @@ interface IERC20 {

/**
* @dev Moves an amount of tokens from `msg.sender` to a specified account.
* @dev Emits a {Transfer} event.
* Emits a {Transfer} event.
* @param recipient_ Account that receives tokens.
* @param amount_ Amount of tokens that are transferred.
* @return success_ Boolean indicating whether the operation succeeded.
Expand All @@ -73,8 +73,8 @@ interface IERC20 {

/**
* @dev Moves a pre-approved amount of tokens from a sender to a specified account.
* @dev Emits a {Transfer} event.
* @dev Emits an {Approval} event.
* Emits a {Transfer} event.
* Emits an {Approval} event.
* @param owner_ Account that tokens are moving from.
* @param recipient_ Account that receives tokens.
* @param amount_ Amount of tokens that are transferred.
Expand Down
4 changes: 2 additions & 2 deletions src/test/ERC20.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract ERC20Test is DSTest {
}

function prove_burn(address account, uint256 amount0, uint256 amount1) public {
if (amount1 > amount0) return; // Mint amount must exceed burn amount
if (amount1 > amount0) return; // Mint amount must exceed burn amount.

token.mint(account, amount0);
token.burn(account, amount1);
Expand Down Expand Up @@ -70,7 +70,7 @@ contract ERC20Test is DSTest {
}

function prove_transferFrom(address to, uint256 approval, uint256 amount) public {
if (amount > approval) return; // Owner must approve for more than amount
if (amount > approval) return; // Owner must approve for more than amount.

ERC20User owner = new ERC20User();

Expand Down

0 comments on commit c3d599d

Please sign in to comment.