Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Aug 18, 2023
2 parents 9ac9d7b + 874301b commit 43dab1c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 47 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @andresaiello @lucas-janon @fadeev
17 changes: 2 additions & 15 deletions omnichain/minter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,10 @@ npx hardhat balances --address <address>

### Requesting Tokens from the Faucet

To request tokens from ZetaChain's faucet using the account from the `.env`
file, run the following command in your terminal:
To install a faucet, run the following command in your terminal:

```
npx hardhat faucet
```

To access the faucet, please authenticate with your GitHub account. Once
authenticated, the tokens will be sent to your specified address. It's important
to note that the faucet can only be called a limited number of times per day to
prevent misuse and abuse of its resources.

Alternatively, you can install a standalone faucet, run the following command in
your terminal:

```
yarn global add @zetachain/faucet-cli
yarn global add @zetachain/faucet-cli@athens3
```

You can then use it with the following command:
Expand Down
10 changes: 4 additions & 6 deletions omnichain/minter/contracts/Minter.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
pragma solidity 0.8.7;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@zetachain/protocol-contracts/contracts/zevm/interfaces/zContract.sol";
import "@zetachain/toolkit/contracts/BytesHelperLib.sol";
import "@zetachain/protocol-contracts/contracts/zevm/SystemContract.sol";
import "@zetachain/protocol-contracts/contracts/zevm/interfaces/zContract.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Minter is ERC20, zContract {
error SenderNotSystemContract();
Expand Down Expand Up @@ -32,11 +31,10 @@ contract Minter is ERC20, zContract {
if (msg.sender != address(systemContract)) {
revert SenderNotSystemContract();
}
address recipient = abi.decode(message, (address));
address acceptedZRC20 = systemContract.gasCoinZRC20ByChainId(chain);
if (zrc20 != acceptedZRC20) revert WrongChain();

address recipient = BytesHelperLib.bytesToAddress(message, 0);

_mint(recipient, amount);
}
}
3 changes: 1 addition & 2 deletions omnichain/minter/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import "./tasks/deploy";
import "@nomicfoundation/hardhat-toolbox";
import { getHardhatConfigNetworks } from "@zetachain/networks";
import "@zetachain/toolkit/tasks";
import { HardhatUserConfig } from "hardhat/config";

import "./tasks/deploy";

const config: HardhatUserConfig = {
solidity: "0.8.7",
networks: {
Expand Down
5 changes: 2 additions & 3 deletions omnichain/minter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
"@nomicfoundation/hardhat-toolbox": "^2.0.0",
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-etherscan": "^3.0.0",
"@openzeppelin/contracts": "^4.9.2",
"@typechain/ethers-v5": "^10.1.0",
"@typechain/hardhat": "^6.1.2",
"@types/chai": "^4.2.0",
"@types/mocha": ">=9.1.0",
"@types/node": ">=12.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@zetachain/faucet-cli": "^2.0.1",
"@zetachain/faucet-cli": "^2.0.1-beta.2",
"@zetachain/interfaces": "^0.0.1",
"@zetachain/networks": "^2.3.0-athens3",
"@zetachain/protocol-contracts": "^2.0.1",
Expand All @@ -54,4 +53,4 @@
"typechain": "^8.1.0",
"typescript": ">=4.5.0"
}
}
}
15 changes: 6 additions & 9 deletions omnichain/minter/tasks/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { getAddress } from "@zetachain/protocol-contracts";
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { getAddress } from "@zetachain/protocol-contracts";

const contractName = "Minter";

const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
if (hre.network.name !== "zeta_testnet") {
Expand All @@ -14,21 +12,20 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
const [signer] = await hre.ethers.getSigners();
console.log(`🔑 Using account: ${signer.address}\n`);

const SYSTEM_CONTRACT = getAddress("systemContract", hre.network.name);
const bitcoinChainID = 18332;
const systemContract = getAddress("systemContract", "zeta_testnet");

const factory = await hre.ethers.getContractFactory(contractName);
const factory = await hre.ethers.getContractFactory("Minter");
const bitcoinChainId = 18332;
const contract = await factory.deploy(
"Wrapped tBTC",
"WTBTC",
bitcoinChainID,
SYSTEM_CONTRACT
bitcoinChainId,
systemContract
);
await contract.deployed();

console.log(`🚀 Successfully deployed contract on ZetaChain.
📜 Contract address: ${contract.address}
🌍 Explorer: https://athens3.explorer.zetachain.com/address/${contract.address}
`);
};
Expand Down
19 changes: 7 additions & 12 deletions omnichain/minter/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1327,17 +1327,17 @@
"@uniswap/lib" "1.1.1"
"@uniswap/v2-core" "1.0.0"

"@zetachain/faucet-cli@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@zetachain/faucet-cli/-/faucet-cli-2.0.1.tgz#94b4316a6a62b0df781df40c6223a054338d46b6"
integrity sha512-OS5RF+oLoRgQFQ3ZokXMQa6Bfdcrrzh8KBmnVIdT3FEJAfSPi9TCBfC6nNghvvDnjniIF31qsPlwlBwA9cioww==
"@zetachain/faucet-cli@^2.0.1-beta.2":
version "2.0.1-beta.2"
resolved "https://registry.yarnpkg.com/@zetachain/faucet-cli/-/faucet-cli-2.0.1-beta.2.tgz#32c143d849163844037f7bf0602355d557f11353"
integrity sha512-d9nlW5lHquWVZmSwJ+VuGB/TlkaMiP7J0arorKyDt3Rw6hjQ3twaGTlK+nOTqJAxo2gwyGNrZVECmX6dWBY7rw==
dependencies:
commander "10.0.1"
figlet "1.6.0"
got "11.8.5"
launchdarkly-node-client-sdk "3.0.2"
readline "1.3.0"
typescript "4.7.4"
typescript "5.0.4"
zod "3.19.1"

"@zetachain/interfaces@^0.0.1":
Expand Down Expand Up @@ -1371,7 +1371,7 @@
"@nomiclabs/hardhat-ethers" "^2.2.3"
"@openzeppelin/contracts" "^4.9.2"
"@uniswap/v2-periphery" "^1.1.0-beta.0"
"@zetachain/faucet-cli" "^2.0.1"
"@zetachain/faucet-cli" "^2.0.1-beta.2"
"@zetachain/networks" "^2.3.0-athens3"
"@zetachain/protocol-contracts" "^1.0.1-athens3"
axios "^1.4.0"
Expand Down Expand Up @@ -6322,12 +6322,7 @@ typeforce@^1.11.3, typeforce@^1.18.0:
resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc"
integrity sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==

typescript@4.7.4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==

typescript@>=4.5.0:
typescript@5.0.4, typescript@>=4.5.0:
version "5.0.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
Expand Down

0 comments on commit 43dab1c

Please sign in to comment.