Skip to content

Commit

Permalink
fixed installs
Browse files Browse the repository at this point in the history
  • Loading branch information
“Felix committed Mar 2, 2024
1 parent 40a6663 commit 6c93b4b
Show file tree
Hide file tree
Showing 20 changed files with 39,055 additions and 7,774 deletions.
29,545 changes: 29,545 additions & 0 deletions .pnp.cjs

Large diffs are not rendered by default.

2,076 changes: 2,076 additions & 0 deletions .pnp.loader.mjs

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions .yarn/patches/usehooks-ts-npm-2.7.2-fceffe0e43.patch

This file was deleted.

9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.3.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.0.cjs

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
enableColors: true
yarnPath: .yarn/releases/yarn-4.1.0.cjs

nmHoistingLimits: workspaces
packageExtensions:
"@wagmi/core@*":
dependencies:
"@tanstack/query-core": "*"

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-3.2.3.cjs
pnpMode: loose
pnpFallbackMode: dependencies-only
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"vercel": "yarn workspace @se-2/nextjs vercel",
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo"
},
"packageManager": "yarn@3.2.3",
"packageManager": "yarn@4.1.0",
"devDependencies": {
"husky": "^8.0.1",
"lint-staged": "^13.0.3"
Expand Down
26 changes: 20 additions & 6 deletions packages/hardhat/deploy/00_deploy_your_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DeployFunction } from "hardhat-deploy/types";
import { Contract } from "ethers";

/**
* Deploys a contract named "YourContract" using the deployer account and
* Deploys a contract named "TokenFactory" using the deployer account and
* constructor arguments set to the deployer address
*
* @param hre HardhatRuntimeEnvironment object.
Expand All @@ -22,7 +22,7 @@ const deployYourContract: DeployFunction = async function (hre: HardhatRuntimeEn
const { deployer } = await hre.getNamedAccounts();
const { deploy } = hre.deployments;

await deploy("YourContract", {
await deploy("TokenFactory", {
from: deployer,
// Contract constructor arguments
args: [deployer],
Expand All @@ -33,12 +33,26 @@ const deployYourContract: DeployFunction = async function (hre: HardhatRuntimeEn
});

// 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 tokenShopFactory = await hre.ethers.getContract<Contract>("TokenFactory", deployer);

console.log("owner:", await tokenShopFactory.owner());

// await tokenShopFactory.createToken(
// "BufficornCastle",
// "BCC",
// "500000",
// "1000000000000000000",
// 1709420650,
// "15000000000000000000",
// "10000000000000000000",
// "20000000000000000000",
// "https://daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.jpg",
// "15000000000000000000",
// );
};

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"];
// e.g. yarn deploy --tags TokenFactory
deployYourContract.tags = ["TokenFactory"];
13 changes: 0 additions & 13 deletions packages/nextjs/.env.example

This file was deleted.

3 changes: 3 additions & 0 deletions packages/nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"endOfLine": "auto"
}
]
},
"globals":{
"BigInt": true
}
}
2 changes: 1 addition & 1 deletion packages/nextjs/.npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
strict-peer-dependencies = false
strict-peer-dependencies = true
34 changes: 30 additions & 4 deletions packages/nextjs/app/investment/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import React, { useCallback, useState } from "react";
import { useParams } from "next/navigation";
import { mainnet, sepolia } from "@wagmi/core/chains";
import { write } from "fs";
import type { NextPage } from "next";
import { useAccount, useSwitchChain, useWalletClient } from "wagmi";
import { mockInvestments } from "~~/services/mockInvestment";
import { useAccount, useSwitchChain, useWalletClient, useWriteContract } from "wagmi";
import EtherIcon from "~~/components/EtherIcon";
// for development only
import Banner from "~~/components/InvestmentDetailsBanner";
import { RainbowKitCustomConnectButton } from "~~/components/scaffold-eth/RainbowKitCustomConnectButton";
import TokenAbi from "~~/contracts/TokenShop";
import { mockInvestments } from "~~/services/mockInvestment";

const validAmountRegex = /^[0-9]{0,78}\.?[0-9]{0,18}$/;

Expand All @@ -32,7 +34,8 @@ const InvestmentDetails: NextPage = () => {
// query for investment details
const investment = mockInvestments[0];

const { isConnected, chain: currentChain } = useAccount();
const { data: hash, writeContract } = useWriteContract();
const { isConnected, chain: currentChain, address: connectedAddress } = useAccount();
// console.log("account:", account);
const walletClient = useWalletClient();
// console.log("walletClient:", walletClient);
Expand Down Expand Up @@ -63,6 +66,27 @@ const InvestmentDetails: NextPage = () => {
},
[setAmount],
);

const handleBuy = async () => {
// const txn = await writeContract({
// address: connectedAddress as `0x${string}`,
// abi:
// });
// console.log("txn:", txn);
console.log("handleBuy");
};

const handleSell = () => {
console.log("handleSell");
};

const handleClick = useCallback(
async (e: React.ChangeEvent<HTMLInputElement>) => {
return activeTab === Tabs.Buy ? handleBuy() : handleSell();
},
[activeTab],
);

return (
<>
<Banner investment={investment} />
Expand Down Expand Up @@ -127,7 +151,9 @@ const InvestmentDetails: NextPage = () => {
</div>

{isConnected && currentChain && currentChain.id === chain.id ? (
<button className="btn btn-primary">Buy Now</button>
<button className="btn btn-primary" onClick={handleClick}>
{activeTab === Tabs.Buy ? "Buy Now" : "Redeem"}
</button>
) : isConnected && currentChain?.id !== chain.id ? (
<button className="btn btn-primary btn-error" onClick={() => switchChain({ chainId: chain.id })}>
Switch Network
Expand Down
Loading

0 comments on commit 6c93b4b

Please sign in to comment.