Skip to content

Commit c5a3702

Browse files
committed
fix: cleaned up hardhat config, fixed gasless transactions
gasless requires _msgSender() instead of msg.sender, at least if we're using OZ's gasless standard. Future-proofing. 1000 round optimization made bytecode size go down 17k -> 8.7k, interesting...
1 parent 19ef4d6 commit c5a3702

File tree

2 files changed

+8
-35
lines changed

2 files changed

+8
-35
lines changed

contracts/DATAv2onPolygon.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ contract DATAv2onPolygon is DATAv2 {
2424
* Equal amount of tokens got locked in RootChainManager on the mainnet side
2525
*/
2626
function deposit(address user, bytes calldata depositData) external {
27-
require(msg.sender == bridgeAddress, "error_onlyBridge");
27+
require(_msgSender() == bridgeAddress, "error_onlyBridge");
2828
uint256 amount = abi.decode(depositData, (uint256));
2929
_mint(address(this), amount);
3030
transferAndCall(user, amount, depositData);
@@ -34,6 +34,6 @@ contract DATAv2onPolygon is DATAv2 {
3434
* When returning to mainnet, it's enough to simply burn the tokens on the Polygon side
3535
*/
3636
function withdraw(uint256 amount) external {
37-
_burn(msg.sender, amount);
37+
_burn(_msgSender(), amount);
3838
}
3939
}

hardhat.config.js

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
1-
/*global task, ethers */
2-
31
require("@nomiclabs/hardhat-waffle")
42
require("solidity-coverage")
53
require("hardhat-gas-reporter")
64

7-
//require("hardhat-erc1820") // this was for ERC777 token study, required for ERC777 tokens
8-
9-
// This is a sample Hardhat task. To learn how to create your own go to
10-
// https://hardhat.org/guides/create-task.html
11-
task("accounts", "Prints the list of accounts", async () => {
12-
const accounts = await ethers.getSigners()
13-
14-
for (const account of accounts) {
15-
console.log(account.address)
16-
}
17-
})
18-
195
// You need to export an object to set up your config
206
// Go to https://hardhat.org/config/ to learn more
217

@@ -27,29 +13,16 @@ module.exports = {
2713
compilers: [
2814
{
2915
version: "0.8.6",
16+
settings: {
17+
optimizer: {
18+
enabled: true,
19+
runs: 1000,
20+
},
21+
},
3022
},
3123
{
3224
version: "0.4.11"
3325
}
3426
]
3527
}
36-
37-
// solidity: {
38-
// version: "0.8.3",
39-
// overrides: {
40-
// "contracts/CrowdsaleToken.sol": {
41-
// version: "0.4.8"
42-
// }
43-
// }
44-
// }
45-
46-
// this seriously breaks things because lots of things don't wait for transactions, also there's no way to do that for HardhatProvider, apparently
47-
// networks: {
48-
// hardhat: {
49-
// mining: {
50-
// auto: false,
51-
// interval: 1000,
52-
// },
53-
// },
54-
// },
5528
}

0 commit comments

Comments
 (0)