Skip to content

Commit

Permalink
made updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsley-einstein committed Feb 10, 2025
1 parent 49a0902 commit d7e4b50
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 144 deletions.
10 changes: 9 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,24 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { MoveUpRight } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useMemo } from "react";
import { useChainId, useChains } from "wagmi";
import { Button } from "../components/ui/button";

export default function Home() {
const chainId = useChainId();
const chains = useChains();
const activeChain = useMemo(
() => chains.find((chain) => chain.id === chainId),
[chainId, chains],
);
return (
<div className="">
<Link href={"/swap"}>
<div className="z-100 enchant-effect flex items-center justify-center gap-2 bg-secondary px-2 py-4">
<Image src={CongratesIcon} alt="icon" />
<p className="minecraft-enchant-text text-xs md:text-base">
Moniswap V1 Live on Bartio Testnet. Swap Now!
Moniswap V1 Live on {activeChain?.name}. Swap Now!
</p>
</div>
</Link>
Expand Down
3 changes: 2 additions & 1 deletion src/app/swap/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ export default function Page() {
{isConnected ? (
<>
{allowedToSpend >= amount ||
selectedTokens[0]?.address === __ETHER__ ? (
selectedTokens[0]?.address === __ETHER__ ||
(address0 === wrappedEther && address1 === wrappedEther) ? (
<Button
onClick={executeTx}
isLoading={swapPending || wethEthPending}
Expand Down
166 changes: 26 additions & 140 deletions src/assets/abis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12487,32 +12487,16 @@ export const oracleABI = [
type: "constructor",
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address",
},
],
inputs: [{ internalType: "address", name: "owner", type: "address" }],
name: "OwnableInvalidOwner",
type: "error",
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address",
},
],
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "OwnableUnauthorizedAccount",
type: "error",
},
{
inputs: [],
name: "UnrecognizedPriceSource",
type: "error",
},
{ inputs: [], name: "UnrecognizedPriceSource", type: "error" },
{
anonymous: false,
inputs: [
Expand Down Expand Up @@ -12549,169 +12533,77 @@ export const oracleABI = [
inputs: [],
name: "getAllPriceSources",
outputs: [
{
internalType: "contract IPriceSource[]",
name: "",
type: "address[]",
},
{ internalType: "contract IPriceSource[]", name: "", type: "address[]" },
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_token",
type: "address",
},
{
internalType: "uint256",
name: "_value",
type: "uint256",
},
{ internalType: "address", name: "_token", type: "address" },
{ internalType: "uint256", name: "_value", type: "uint256" },
],
name: "getAverageValueInETH",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
{
internalType: "int256",
name: "",
type: "int256",
},
{ internalType: "uint256", name: "", type: "uint256" },
{ internalType: "int256", name: "", type: "int256" },
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_token",
type: "address",
},
{
internalType: "uint256",
name: "_value",
type: "uint256",
},
{ internalType: "address", name: "_token", type: "address" },
{ internalType: "uint256", name: "_value", type: "uint256" },
],
name: "getAverageValueInUSD",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
{
internalType: "int256",
name: "",
type: "int256",
},
{ internalType: "uint256", name: "", type: "uint256" },
{ internalType: "int256", name: "", type: "int256" },
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IPriceSource",
name: "_pS",
type: "address",
},
{
internalType: "address",
name: "_token",
type: "address",
},
{
internalType: "uint256",
name: "_value",
type: "uint256",
},
{ internalType: "contract IPriceSource", name: "_pS", type: "address" },
{ internalType: "address", name: "_token", type: "address" },
{ internalType: "uint256", name: "_value", type: "uint256" },
],
name: "getAverageValueInUSDBySource",
outputs: [
{
internalType: "uint256",
name: "_avgEXP",
type: "uint256",
},
{
internalType: "int256",
name: "_avgNormal",
type: "int256",
},
{ internalType: "uint256", name: "_avgEXP", type: "uint256" },
{ internalType: "int256", name: "_avgNormal", type: "int256" },
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "contract IPriceSource",
name: "_pS",
type: "address",
},
{
internalType: "address",
name: "_token",
type: "address",
},
{
internalType: "uint256",
name: "_value",
type: "uint256",
},
{ internalType: "contract IPriceSource", name: "_pS", type: "address" },
{ internalType: "address", name: "_token", type: "address" },
{ internalType: "uint256", name: "_value", type: "uint256" },
],
name: "getValueInETH",
outputs: [
{
internalType: "uint256",
name: "_avgEXP",
type: "uint256",
},
{
internalType: "int256",
name: "_avgNormal",
type: "int256",
},
{ internalType: "uint256", name: "_avgEXP", type: "uint256" },
{ internalType: "int256", name: "_avgNormal", type: "int256" },
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
name: "priceSources",
outputs: [
{
internalType: "contract IPriceSource",
name: "",
type: "address",
},
{ internalType: "contract IPriceSource", name: "", type: "address" },
],
stateMutability: "view",
type: "function",
Expand All @@ -12737,13 +12629,7 @@ export const oracleABI = [
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
},
],
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
Expand Down
4 changes: 2 additions & 2 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ export const __VOTING_ESCROW__ = {
};
export const __PRICE_ORACLE__ = {
[__CHAIN_IDS__.bera_testnet]: "0x6D2015Dce2d839c23806278E4DA30500766AC44D",
[__CHAIN_IDS__.bera]: "0x4a61F6a5ee25d04271fec17471E727a089c7A22D",
[__CHAIN_IDS__.bera]: "0xCA6f864adD2cF45bf2b28FBbC990216Cc759B0Ca",
};
export const __DEDICATED_PRICE_SOURCE__ = {
[__CHAIN_IDS__.bera_testnet]: "0xd25758eD9D4555ceb2A3c27374aE08Cd470b6Fe3",
[__CHAIN_IDS__.bera]: "0xC481263897F96B4781219EDF5cfAa95ec49c200c",
[__CHAIN_IDS__.bera]: "0x34D9a3E8B5Df4DEdB388EB14b7416f76BFFf4E6f",
};
export const __WRAPPED_ETHER__ = {
[__CHAIN_IDS__.bera_testnet]: "0x7507c1dc16935B82698e4C63f2746A2fCf994dF8",
Expand Down

0 comments on commit d7e4b50

Please sign in to comment.