Skip to content

Commit

Permalink
add test case (#5)
Browse files Browse the repository at this point in the history
* test

* tests

* hardhatconfig

* Update MergeTokenPortal.ts

* Update hardhat.config.ts

* new

* tsTojs

* add

* Delete artifacts directory

* Delete cache directory

* fix deployProxy and add require for addSourceToken

* add  some hardhat plugins

* test

* test

* 1

* balance after&before deposit

* balance after&before deposit

* del useless dependencies

* lint fix

* del abi files

* ignore abi files

---------

Co-authored-by: shonentropy3 <qwerdfkkt@163.com>
  • Loading branch information
zkJoaquin and shonentropy3 committed Mar 21, 2024
1 parent e41b381 commit 614ab1c
Show file tree
Hide file tree
Showing 8 changed files with 4,435 additions and 1,796 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# defaultNetwork
DEFAULT_NETWORK=zklinkGoerli
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ node_modules
log
tmp

.env
abi
# Hardhat files
cache-zk
artifacts-zk
cache
artifacts
coverage
coverage.json

# Openzeppelin upgrade
.upgradable
5 changes: 4 additions & 1 deletion .solhintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
artifacts-zk/
cache-zk/
cache-zk/
artifacts/
cache/
abi/
2 changes: 2 additions & 0 deletions contracts/merge/MergeTokenPortal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ contract MergeTokenPortal is IMergeTokenPortal, UUPSUpgradeable, OwnableUpgradea

/// @notice Add source token
function addSourceToken(address _sourceToken, address _mergeToken, uint256 _depositLimit) external onlyOwner {
SourceTokenInfo storage tokenInfo = sourceTokenInfoMap[_sourceToken];
require(!tokenInfo.isSupported, "Source token is already supported");
require(_sourceToken != address(0) && _mergeToken != address(0), "Invalid token address");
sourceTokenInfoMap[_sourceToken] = SourceTokenInfo({
isSupported: true,
Expand Down
26 changes: 20 additions & 6 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
require('@nomicfoundation/hardhat-ethers');
require('@nomicfoundation/hardhat-toolbox');
require('@openzeppelin/hardhat-upgrades');
require('@matterlabs/hardhat-zksync-deploy');
require('@matterlabs/hardhat-zksync-solc');
require('@matterlabs/hardhat-zksync-verify');
require('@matterlabs/hardhat-zksync-upgradable');
require('solidity-coverage');
require('hardhat-abi-exporter');
require('dotenv').config();

/**
* @type import('hardhat/config').HardhatUserConfig
*/
const hardhatUserConfig = {
abiExporter: {
path: './abi',
runOnCompile: true,
clear: true,
flat: true,
spacing: 2,
only: ['contracts/.*.sol'],
format: 'json',
},
solidity: {
compilers: [
{
Expand All @@ -22,14 +35,15 @@ const hardhatUserConfig = {
},
],
},
defaultNetwork: process.env.DEFAULT_NETWORK || 'hardhat',
networks: {
hardhat: {
zksync: true,
zksync: false,
},
zklinkSepoliaTest: {
url: 'https://sepolia.rpc.zklink.network',
ethNetwork: 'https://sepolia-rollup.arbitrum.io/rpc',
verifyURL: 'https://sepolia.verification.zklink.network/contract_verification',
zklinkGoerli: {
url: 'https://goerli.rpc.zklink.io',
ethNetwork: 'goerli',
verifyURL: 'https://goerli.explorer.zklink.io/contract_verification',
zksync: true,
},
},
Expand Down
Loading

0 comments on commit 614ab1c

Please sign in to comment.