Skip to content

Commit

Permalink
contract added
Browse files Browse the repository at this point in the history
  • Loading branch information
KENILSHAHH committed Jul 1, 2024
1 parent 0254b1e commit 89764e6
Show file tree
Hide file tree
Showing 11 changed files with 1,644 additions and 32 deletions.
11 changes: 0 additions & 11 deletions packages/hardhat/.env.example

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,30 @@ import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";

//https://sepolia.basescan.org/address/0x059ee9bde2aff94d0e6ad396ec0ec7d27bff6dc8
contract MyToken is ERC20, Ownable, ERC20Permit {
contract FramifyFaucet is ERC20, Ownable, ERC20Permit {
uint256 public constant MAX_MINT = 100 * 10 ** 18;

constructor(
address initialOwner
) ERC20("USDC", "USDC") Ownable(initialOwner) ERC20Permit("MyToken") {}
) ERC20("USDC", "USDC") ERC20Permit("MyToken") {}

event Purchased(
address indexed seller,
address indexed buyer,
uint256 amount,
uint256 qt
);

function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
function mint(address to, uint256 amount) public {
require(
amount <= MAX_MINT,
"You can request only 100 USDC tokens as of now"
);
_mint(to, amount*10**18);
}

function trf(address seller, uint256 amount, uint256 qt) public {
uint256 tamount = qt * amount;
_transfer(msg.sender, seller, tamount);
emit Purchased(seller, msg.sender, amount, qt);
}
}
10 changes: 5 additions & 5 deletions packages/hardhat/deploy/00_deploy_your_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ const deployYourContract: DeployFunction = async function (hre: HardhatRuntimeEn
const { deployer } = await hre.getNamedAccounts();
const { deploy } = hre.deployments;

await deploy("YourContract", {
await deploy("FramifyFaucet", {
from: deployer,
// Contract constructor arguments
args: [deployer],
args: [],
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 yourContract = await hre.ethers.getContract<Contract>("FramifyFaucet", deployer);

};

export default deployYourContract;

// 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"];
deployYourContract.tags = ["FramifyFaucet"];
1 change: 1 addition & 0 deletions packages/hardhat/deployments/baseSepolia/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84532
Loading

0 comments on commit 89764e6

Please sign in to comment.