Skip to content

Commit

Permalink
Starting to modify FRONTEND
Browse files Browse the repository at this point in the history
  • Loading branch information
manudev97 committed Jul 15, 2024
1 parent 4060795 commit e9bcae8
Show file tree
Hide file tree
Showing 20 changed files with 3,179 additions and 276 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
"packageManager": "[email protected]",
"engines": {
"node": ">=18.17.0"
},
"dependencies": {
"@openzeppelin/contracts": "^5.0.2"
}
}
3 changes: 2 additions & 1 deletion packages/hardhat/contracts/ATM.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.20;
pragma solidity >=0.8.0 <0.9.0;
import "./MerkleTree.sol";
import "./ZKATM_Token.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // Importar interfaz del token ERC20
Expand Down Expand Up @@ -30,6 +30,7 @@ contract ATM is MerkleTree {
mapping (address _account => bool) public initialized;
// almacenar compromisos para evitar depósitos accidentales con el mismo compromiso.
mapping(bytes32 => bool) public commitments;
string public greeting = "Starting to build my ZKATM proyect!!!";
// _verifier --> la dirección del contrato verificador para este SNARK
// _hasher --> la dirección del contrato hash poseidon
// _denomination --> cantidad a transferir por cada deposito
Expand Down
87 changes: 0 additions & 87 deletions packages/hardhat/contracts/YourContract.sol

This file was deleted.

4 changes: 3 additions & 1 deletion packages/hardhat/contracts/ZKATM_Token.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
pragma solidity >=0.8.20 <0.9.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract ZKATM_Token is ERC20, ERC20Pausable, Ownable {
string public greeting = "Deploy token ZKATM";

constructor(address initialOwner)
ERC20("ZKATM_Token", "ZKATM")
Ownable(initialOwner)
Expand Down
41 changes: 41 additions & 0 deletions packages/hardhat/deploy/01_deploy_zkatm_token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { Contract } from "ethers";

/**
* Deploys a contract named "ZKATM_Token" using the deployer account and
* constructor arguments set to the deployer address
*
* @param hre HardhatRuntimeEnvironment object.
*/
const deployZKATM_Token: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
/*
On localhost, the deployer account is the one that comes with Hardhat, which is already funded.
When deploying to live networks (e.g `yarn deploy --network sepolia`), the deployer account
should have sufficient balance to pay for the gas fees for contract creation.
You can generate a random account with `yarn generate` which will fill DEPLOYER_PRIVATE_KEY
with a random private key in the .env file (then used on hardhat.config.ts)
You can run the `yarn account` command to check your balance in every network.
*/
const { deployer } = await hre.getNamedAccounts();
const { deploy } = hre.deployments;

await deploy("ZKATM_Token", {
from: deployer,
args: [deployer],
log: true,
autoMine: true,
});

// Get the deployed contract to interact with it after deploying.
const ZKATM_Token = await hre.ethers.getContract<Contract>("ZKATM_Token", deployer);
console.log("👋 Initial greeting:", await ZKATM_Token.greeting());
};

export default deployZKATM_Token;

// Tags are useful if you have multiple deploy files and only want to run one of them.
// e.g. yarn deploy --tags ZKATM_Token
deployZKATM_Token.tags = ["ZKATM_Token"];
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { DeployFunction } from "hardhat-deploy/types";
import { Contract } from "ethers";

/**
* Deploys a contract named "YourContract" using the deployer account and
* Deploys a contract named "ATM" using the deployer account and
* constructor arguments set to the deployer address
*
* @param hre HardhatRuntimeEnvironment object.
*/
const deployYourContract: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const deployATM: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
/*
On localhost, the deployer account is the one that comes with Hardhat, which is already funded.
Expand All @@ -21,24 +21,24 @@ const deployYourContract: DeployFunction = async function (hre: HardhatRuntimeEn
*/
const { deployer } = await hre.getNamedAccounts();
const { deploy } = hre.deployments;

await deploy("YourContract", {
await deploy("ATM", {
from: deployer,
// Contract constructor arguments
args: [deployer],
args: ["0x0918fe077e800b24E1D64c2FE9bb6a12E0255CA9", "0xCc735e52E393f125cAFc4E0aEbD80AEd81eA4B41", "5", "2", "0xd1020f336bebdd4649Daa32B6bAb0660492A7C5b"],
log: true,
// autoMine: can be passed to the deploy function to make the deployment process faster on local networks by
// automatically mining the contract deployment transaction. There is no effect on live networks.
autoMine: true,
});

// Get the deployed contract to interact with it after deploying.
const yourContract = await hre.ethers.getContract<Contract>("YourContract", deployer);
console.log("👋 Initial greeting:", await yourContract.greeting());
const ATM = await hre.ethers.getContract<Contract>("ATM", deployer);
console.log("👋 Saludo Inicial:", await ATM.greeting());
};

export default deployYourContract;
export default deployATM;

// Tags are useful if you have multiple deploy files and only want to run one of them.
// e.g. yarn deploy --tags YourContract
deployYourContract.tags = ["YourContract"];
// e.g. yarn deploy --tags ATM
deployATM.tags = ["ATM"];
Loading

0 comments on commit e9bcae8

Please sign in to comment.