Conversation
K-Ho
left a comment
There was a problem hiding this comment.
Great! Left some comments, mostly style - I can go through and make all of these changes myself or happy to walk you through
|
|
||
| using SafeMath for uint; | ||
|
|
||
| uint256 constant private MAX_UINT256 = 2**256 - 1; |
There was a problem hiding this comment.
This line isn't needed because we have SafeMath
| } | ||
|
|
||
| function transferFrom(address from, address to, uint value) external returns (bool) { | ||
| if (allowance[from][msg.sender] != uint(-1)) { |
There was a problem hiding this comment.
pretty sure we can remove this line. Also need to add check that the amount allowed is greater than or equal to the value, see: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.0.0/contracts/token/ERC20/ERC20.sol#L96
| _amount | ||
| ); | ||
| // Tell L2 to mint corresponding coins | ||
| MockL1ToL2MessagePasser(l1ToL2MessagePasser).passMessageToL2(messageData); |
There was a problem hiding this comment.
| MockL1ToL2MessagePasser(l1ToL2MessagePasser).passMessageToL2(messageData); | |
| IL1ToL2MessagePasser(l1ToL2MessagePasser).passMessageToL2(messageData); |
| pragma experimental ABIEncoderV2; | ||
| import { ERC20 } from "./ERC20.sol"; | ||
| import { ContractResolver } from "../utils/resolvers/ContractResolver.sol"; | ||
| import { MockL1ToL2MessagePasser } from "../ovm/test-helpers/MockL1ToL2MessagePasser.sol"; |
There was a problem hiding this comment.
| import { MockL1ToL2MessagePasser } from "../ovm/test-helpers/MockL1ToL2MessagePasser.sol"; | |
| import { IL1ToL2MessagePasser } from "./IL1ToL2MessagePasser.sol"; |
| it('sets DepositedERC20 factory address correctly', async () => { | ||
| const factoryAddress = await depositedERC20.l2ERC20Bridge() | ||
| factoryAddress.should.equal(await wallet.getAddress()) | ||
| console.log('test') |
| const evilDepositedERC20 = depositedERC20.connect(badwallet) | ||
| await TestUtils.assertRevertsAsync( | ||
| 'Get outta here. L2 factory bridge address ONLY.', | ||
| async () => { | ||
| await evilDepositedERC20.processDeposit('0x' + '00'.repeat(20), 5) | ||
| } | ||
| ) |
There was a problem hiding this comment.
| const evilDepositedERC20 = depositedERC20.connect(badwallet) | |
| await TestUtils.assertRevertsAsync( | |
| 'Get outta here. L2 factory bridge address ONLY.', | |
| async () => { | |
| await evilDepositedERC20.processDeposit('0x' + '00'.repeat(20), 5) | |
| } | |
| ) | |
| await TestUtils.assertRevertsAsync( | |
| 'Get outta here. L2 factory bridge address ONLY.', | |
| async () => { | |
| await depositedERC20 | |
| .connect(badwallet) | |
| .processDeposit('0x' + '00'.repeat(20), 5) | |
| } | |
| ) |
There was a problem hiding this comment.
Also can update '0x' + '00'.repeat(20) -> ZERO_ADDRESS
| it('mints tokens and increases total supply', async () => { | ||
|
|
||
| const initialTotalSupply = (await depositedERC20.totalSupply()).toNumber() | ||
| const depositAmount = 5 |
There was a problem hiding this comment.
Define a DEFAULT_DEPOSIT_AMOUNT = 5 at the start of test file and you can just use that in all of your tests :)
| MockL1ToL2MessagePasser = await ethers.getContractFactory( | ||
| 'MockL1ToL2MessagePasser' | ||
| ) | ||
| ERC20 = await (await ethers.getContractFactory('ERC20')).connect(depositer) |
There was a problem hiding this comment.
| ERC20 = await (await ethers.getContractFactory('ERC20')).connect(depositer) | |
| ERC20 = await ethers.getContractFactory('ERC20').connect(depositer) |
| describe('setCorrespondingL2BridgeAddress()', async () => { | ||
| it('Sets address correctly, and throws if address has already been set', async () => { | ||
| await l1ERC20Bridge.setCorrespondingL2BridgeAddress(l2ERC20Bridge.address) | ||
| const l2BridgeAddress = await l1ERC20Bridge.l2ERC20BridgeAddress() |
There was a problem hiding this comment.
need another check that this was actually set to l2ERC20Bridge.address
| _amount | ||
| ); | ||
| // Tell L2 to mint corresponding coins | ||
| MockL1ToL2MessagePasser(l1ToL2MessagePasser).passMessageToL2(messageData); |
There was a problem hiding this comment.
Send to L1ToL2Transaction queue with
{calldata: messageData,
to: L2ERC20Bridge
gasLimit..
etc
}
|
Closing for now, can always re-open if needed |
* Bump version to 0.1.5 * Update changelog
…m-v1.7.7 Merge upstream v1.7.7
### Description Removes the publishing of basic docs to gh-pages. There's now a nice mdbook that's published by the books.yml workflow.
Description
Questions
Metadata
Fixes
Contributing Agreement