Skip to content

Commit

Permalink
Fix prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadai2010 committed Jul 22, 2024
1 parent a5ea19e commit 1716138
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/nextjs/app/events/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ const Events: NextPage = () => {
);
};

export default Events;
export default Events;
2 changes: 1 addition & 1 deletion packages/nextjs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ const ScaffoldStarkApp = ({ children }: { children: React.ReactNode }) => {
);
};

export default ScaffoldStarkApp;
export default ScaffoldStarkApp;
2 changes: 1 addition & 1 deletion packages/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ const Home: NextPage = () => {
);
};

export default Home;
export default Home;
14 changes: 10 additions & 4 deletions packages/nextjs/app/token-vendor/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { useScaffoldMultiWriteContract } from "~~/hooks/scaffold-stark/useScaffo
import { useDeployedContractInfo } from "~~/hooks/scaffold-stark";
import { useBalance } from "@starknet-react/core";
import { formatEther } from "ethers";
import {getTokenPrice, multiplyTo1e18 } from "~~/utils/scaffold-stark/priceInWei";
import {
getTokenPrice,
multiplyTo1e18,
} from "~~/utils/scaffold-stark/priceInWei";

const TokenVendor: NextPage = () => {
const [toAddress, setToAddress] = useState("");
Expand Down Expand Up @@ -52,7 +55,10 @@ const TokenVendor: NextPage = () => {
address: vendorContractData?.address,
});

const eth_to_spent = getTokenPrice(tokensToBuy, tokensPerEth as unknown as bigint);
const eth_to_spent = getTokenPrice(
tokensToBuy,
tokensPerEth as unknown as bigint,
);

const { writeAsync: buy } = useScaffoldMultiWriteContract({
calls: [
Expand Down Expand Up @@ -97,7 +103,7 @@ const TokenVendor: NextPage = () => {
};

return (
<>
<>
<div className="flex items-center flex-col flex-grow py-10">
<div className="flex flex-col items-center bg-base-100 border-8 border-secondary rounded-xl p-6 mt-24 w-full max-w-lg">
<div className="text-xl">
Expand Down Expand Up @@ -203,4 +209,4 @@ const TokenVendor: NextPage = () => {
);
};

export default TokenVendor;
export default TokenVendor;
7 changes: 6 additions & 1 deletion packages/nextjs/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import React, { useCallback, useRef, useState, useEffect } from "react";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { Bars3Icon, BugAntIcon, CircleStackIcon, BoltIcon } from "@heroicons/react/24/outline";
import {
Bars3Icon,
BugAntIcon,
CircleStackIcon,
BoltIcon,
} from "@heroicons/react/24/outline";
import { useOutsideClick } from "~~/hooks/scaffold-stark";
import { CustomConnectButton } from "~~/components/scaffold-stark/CustomConnectButton";
import { useTheme } from "next-themes";
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/utils/scaffold-stark/priceInWei.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export function getTokenPrice(tokens: string | bigint, tokensPerEth?: bigint) {
const tokensMultiplied = multiplyTo1e18(tokens);

return tokensPerEth ? tokensMultiplied / tokensPerEth : tokensMultiplied;
}
}
6 changes: 4 additions & 2 deletions packages/snfoundry/contracts/src/Vendor.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ mod Vendor {
) { // Implement your function buy_tokens here.
}

fn withdraw(ref self: ContractState) {// Implement your function withdraw here.
fn withdraw(ref self: ContractState) { // Implement your function withdraw here.
}

fn sell_tokens(ref self: ContractState, amount_tokens: u256) {// Implement your function sell_tokens here.
fn sell_tokens(
ref self: ContractState, amount_tokens: u256
) { // Implement your function sell_tokens here.
}

fn send_tokens(ref self: ContractState, to: ContractAddress, amount_tokens: u256) {
Expand Down
2 changes: 1 addition & 1 deletion packages/snfoundry/contracts/src/YourToken.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ mod YourToken {
self.erc20.allowance(owner, spender)
}
}
}
}
2 changes: 1 addition & 1 deletion packages/snfoundry/contracts/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ mod mock_contracts {
#[cfg(test)]
mod test {
mod TestContract;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ pub mod MockETHToken {
let amount_to_mint = initial_supply / 10;
self.erc20._mint(recipient, amount_to_mint);
}
}
}
2 changes: 1 addition & 1 deletion packages/snfoundry/contracts/src/test/TestContract.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use contracts::YourToken::{IYourTokenDispatcher, IYourTokenDispatcherTrait};
use contracts::Vendor::{IVendorDispatcher, IVendorDispatcherTrait};
use contracts::YourToken::{IYourTokenDispatcher, IYourTokenDispatcherTrait};
use contracts::mock_contracts::MockETHToken;
use openzeppelin::tests::utils::constants::{RECIPIENT, OTHER};
use openzeppelin::token::erc20::interface::{IERC20CamelDispatcher, IERC20CamelDispatcherTrait};
Expand Down
26 changes: 18 additions & 8 deletions packages/snfoundry/scripts-ts/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { deployContract, deployer, exportDeployments, provider } from "./deploy-contract";
import {
deployContract,
deployer,
exportDeployments,
provider,
} from "./deploy-contract";
const { RpcProvider, Account } = require("starknet-dev");

const deployScript = async (): Promise<void> => {
Expand All @@ -14,7 +19,8 @@ const deployScript = async (): Promise<void> => {

const vendor = await deployContract(
{
eth_token_address: "0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7",
eth_token_address:
"0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7",
your_token_address: your_token.address,
owner: deployer.address,
},
Expand All @@ -23,8 +29,12 @@ const deployScript = async (): Promise<void> => {
const provider_v6 = new RpcProvider({
nodeUrl: provider.nodeUrl,
});
const deployer_v6 = new Account(provider_v6, deployer.address, deployer.signer, 1);

const deployer_v6 = new Account(
provider_v6,
deployer.address,
deployer.signer,
1
);

//transfer 1000 GLD tokens to VendorContract(ch2)
await deployer_v6.execute(
Expand All @@ -36,13 +46,13 @@ const deployScript = async (): Promise<void> => {
{
low: 1_000_000_000_000_000_000_000n, //1000 * 10^18
high: 0,
}
},
],
entrypoint: "transfer",
}
},
],
{
maxFee: 1e18
maxFee: 1e18,
}
);
};
Expand All @@ -52,4 +62,4 @@ deployScript()
exportDeployments();
console.log("All Setup Done");
})
.catch(console.error);
.catch(console.error);

0 comments on commit 1716138

Please sign in to comment.