-
Notifications
You must be signed in to change notification settings - Fork 172
Bulker contract updates for audit #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kevincheng96
merged 3 commits into
kevin/audit-feedback
from
kevin/audit-contract-changes
Dec 12, 2022
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.15; | ||
|
||
/** | ||
* @title IERC20NonStandard | ||
* @dev Version of ERC20 with no return values for `transfer` and `transferFrom` | ||
* See https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca | ||
*/ | ||
interface IERC20NonStandard { | ||
function approve(address spender, uint256 amount) external; | ||
function transfer(address to, uint256 value) external; | ||
function transferFrom(address from, address to, uint256 value) external; | ||
function balanceOf(address account) external view returns (uint256); | ||
} | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.15; | ||
|
||
/** | ||
* @title Non-standard ERC20 token | ||
* @dev Implementation of the basic standard token. | ||
* See https://github.com/ethereum/EIPs/issues/20 | ||
* @dev Note: `transfer` and `transferFrom` do not return a boolean | ||
*/ | ||
contract NonStandardToken { | ||
string public name; | ||
string public symbol; | ||
uint8 public decimals; | ||
uint256 public totalSupply; | ||
mapping (address => mapping (address => uint256)) public allowance; | ||
mapping(address => uint256) public balanceOf; | ||
event Approval(address indexed owner, address indexed spender, uint256 value); | ||
event Transfer(address indexed from, address indexed to, uint256 value); | ||
|
||
constructor(uint256 _initialAmount, string memory _tokenName, uint8 _decimalUnits, string memory _tokenSymbol) { | ||
totalSupply = _initialAmount; | ||
balanceOf[msg.sender] = _initialAmount; | ||
name = _tokenName; | ||
symbol = _tokenSymbol; | ||
decimals = _decimalUnits; | ||
} | ||
|
||
function transfer(address dst, uint256 amount) external virtual { | ||
require(amount <= balanceOf[msg.sender], "ERC20: transfer amount exceeds balance"); | ||
balanceOf[msg.sender] = balanceOf[msg.sender] - amount; | ||
balanceOf[dst] = balanceOf[dst] + amount; | ||
emit Transfer(msg.sender, dst, amount); | ||
} | ||
|
||
function transferFrom(address src, address dst, uint256 amount) external virtual { | ||
require(amount <= allowance[src][msg.sender], "ERC20: transfer amount exceeds allowance"); | ||
require(amount <= balanceOf[src], "ERC20: transfer amount exceeds balance"); | ||
allowance[src][msg.sender] = allowance[src][msg.sender] - amount; | ||
balanceOf[src] = balanceOf[src] - amount; | ||
balanceOf[dst] = balanceOf[dst] + amount; | ||
emit Transfer(src, dst, amount); | ||
} | ||
|
||
function approve(address _spender, uint256 amount) external returns (bool) { | ||
allowance[msg.sender][_spender] = amount; | ||
emit Approval(msg.sender, _spender, amount); | ||
return true; | ||
} | ||
} | ||
|
||
/** | ||
* @title The Compound Faucet Test Token | ||
* @author Compound | ||
* @notice A simple test token that lets anyone get more of it. | ||
*/ | ||
contract NonStandardFaucetToken is NonStandardToken { | ||
constructor(uint256 _initialAmount, string memory _tokenName, uint8 _decimalUnits, string memory _tokenSymbol) | ||
NonStandardToken(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) { | ||
} | ||
|
||
function allocateTo(address _owner, uint256 value) public { | ||
balanceOf[_owner] += value; | ||
totalSupply += value; | ||
emit Transfer(address(this), _owner, value); | ||
} | ||
} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.