Skip to content

Commit

Permalink
Fix/lfg (#93)
Browse files Browse the repository at this point in the history
* pixel app in tsx

* fix test namespace and pump dm start
  • Loading branch information
MSghais authored Aug 29, 2024
1 parent eae6c49 commit 59be154
Show file tree
Hide file tree
Showing 12 changed files with 984 additions and 24 deletions.
4 changes: 4 additions & 0 deletions apps/mobile/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ EXPO_NODE_ENV="development"
EXPO_PUBLIC_INDEXER_BACKEND_URL=""
EXPO_PUBLIC_PIXEL_URL="http://localhost:3000/pixel"

REACT_APP_USERNAME_STORE_CONTRACT_ADDRESS=
REACT_APP_CANVAS_NFT_CONTRACT_ADDRESS=
REACT_APP_USERNAME_STORE_CONTRACT_ADDRESS=
REACT_APP_NODE_ENV=
3 changes: 2 additions & 1 deletion apps/mobile/src/modules/PixelPeace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const PixelPeace: React.FC = () => {
{Platform.OS == "web" && process.env.EXPO_PUBLIC_PIXEL_URL &&
<>
<iframe src={process.env.EXPO_PUBLIC_PIXEL_URL}
height={isDesktop ? 750 : 550}
// height={isDesktop ? 750 : 550}
height={550}
width={"100%"}
></iframe>

Expand Down
46 changes: 46 additions & 0 deletions apps/website/src/app/components/NavbarPixel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use client';

import Link from 'next/link';
import React, {useState} from 'react';
import {createPortal} from 'react-dom';

import {MobileNavBar} from './MobileNavBar';
import {NavigationLinks} from './NavigationLinks';

export function NavbarPixel() {
const [toggleNav, setToggleNav] = useState(false);
return (
<div className="desktop:py-[26px] py-3 px-6 desktop:px-[120px] bg-black flex justify-between items-center">
<div className="flex items-center gap-x-[10px] text">
<img
src="/assets/pepe-logo.png"
className="desktop:h-[52px] w-9 h-9 desktop:w-[52px]"
alt=""
/>
<Link href="/">
<h5 className="desktop:text-2xl text-lg leading-7 font-bold text-white">AFK</h5>
</Link>
</div>
{/* <NavigationLinks /> */}
{/* <div className="desktop:flex hidden items-center gap-x-4 font-bold text-sm leading-[16px]">
<button className="py-[15px] px-[48px] bg-white">
<a href="https://afk-community.xyz" target="_blank">
Log in
</a>
</button>
</div> */}
<button
className="flex desktop:hidden"
onClick={() => {
setToggleNav(true);
window.scrollTo({top: 0, left: 0, behavior: 'smooth'});
}}
>
<img src="assets/hamburger-icon.svg" className="w-6 h-6" alt="" />
</button>

{toggleNav &&
createPortal(<MobileNavBar setToggle={setToggleNav} toggle={toggleNav} />, document.body)}
</div>
);
}
9 changes: 4 additions & 5 deletions apps/website/src/app/pixel/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
'use client';
import {AppRender} from 'pixel_ui';

import {Footer} from '../components/Footer';
import {Navbar} from '../components/Navbar';
import { NavbarPixel } from '../components/NavbarPixel';

export default function Pixel() {
return (
<div className="min-h-screen w-full relative bg-black">
<Navbar />
<NavbarPixel/>
{/* <App></App> */}

{typeof window !== 'undefined' && <AppRender></AppRender>}
<Footer />
{/* {typeof window !== 'undefined' && <App></App>} */}
{/* <Footer /> */}
</div>
);
}
49 changes: 45 additions & 4 deletions onchain/solidity_contracts/src/launchpad/LaunchpadPumpDualVM.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import {CairoLib} from "kakarot-lib/CairoLib.sol";

using CairoLib for uint256;

contract LaunchpadPumpDualVM {
/// @dev The address of the cairo contract to call
uint256 immutable starknetLaunchpad;
Expand Down Expand Up @@ -69,20 +73,57 @@ contract LaunchpadPumpDualVM {
function getLaunchPump(uint256 tokenAddress) public {

uint256[] memory tokenAddressCalldata = new uint256[](1);
tokenAddressCalldata[0] = uint256(uint160(from));
tokenAddressCalldata[0] = uint256(uint160(tokenAddress));
uint256 tokenStarknetAddress =
abi.decode(kakarot.staticcallCairo("compute_starknet_address", tokenAddressCalldata), (uint256));
abi.decode(starknetLaunchpad.staticcallCairo("compute_starknet_address", tokenAddressCalldata), (uint256));

// call launch that sent struct
// todo how do it?
}

function createToken() public {

/** */
function createToken(address recipient,
bytes calldata symbol,
bytes calldata name,
uint256 initialSupply,
bytes calldata contractAddressSalt
) public {

uint256[] memory recipientAddressCalldata = new uint256[](1);
recipientAddressCalldata[0] = uint256(uint160(recipient));
uint256 recipientStarknetAddress =
abi.decode(starknetLaunchpad.staticcallCairo("compute_starknet_address", recipientAddressCalldata), (uint256));

uint128 amountLow = uint128(initialSupply);
uint128 amountHigh = uint128(initialSupply >> 128);

uint256[] memory createTokenCallData = new uint256[](6);
createTokenCallData[0] = recipientStarknetAddress;
// Decode the first 32 bytes (a uint256 is 32 bytes)
uint256 symbolResult = abi.decode(symbol, (uint256));
uint256 nameResult = abi.decode(name, (uint256));
uint256 contractAddressSaltResult = abi.decode(contractAddressSalt, (uint256));

createTokenCallData[1] = uint(symbolResult);
createTokenCallData[2] = uint(nameResult);
createTokenCallData[3] = uint256(amountLow);
createTokenCallData[4] = uint256(amountHigh);
createTokenCallData[5] = uint256(contractAddressSaltResult);

starknetLaunchpad.callCairo(FUNCTION_SELECTOR_CREATE_TOKEN, createTokenCallData);

}


function createAndLaunchToken() public {
function createAndLaunchToken(
address recipient,
bytes calldata symbol,
bytes calldata name,
uint256 initialSupply,
bytes calldata contractAddressSalt
) public {


}

Expand Down
19 changes: 12 additions & 7 deletions onchain/solidity_contracts/src/nostr/Namespace.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;


import {CairoLib} from "kakarot-lib/CairoLib.sol";

using CairoLib for uint256;

contract Namespace {

/// @dev The address of the starknet token to call
/// @dev The address of the starknet token to call
uint256 immutable namespaceAddress;

constructor(uint256 _namespaceAddress) {
Expand All @@ -18,12 +23,12 @@ contract Namespace {
kakarotCallData[0] = uint256(uint160(userAddress));

uint256 userStarknetAddress =
abi.decode(kakarot.staticcallCairo("compute_starknet_address", kakarotCallData), (uint256));
abi.decode(namespaceAddress.staticcallCairo("compute_starknet_address", kakarotCallData), (uint256));

uint256[] memory addressOfCallData = new uint256[](1);
addressOfCallData[0] = userStarknetAddress;
bytes memory returnData = namespaceAddress.staticcallCairo("get_nostr_by_sn_default", balanceOfCallData);
return abi.decode(returnData, (uint256));
bytes memory returnData = namespaceAddress.staticcallCairo("get_nostr_by_sn_default", addressOfCallData);
// return abi.decode(returnData, (uint256));
}


Expand All @@ -34,12 +39,12 @@ contract Namespace {
kakarotCallData[0] = uint256(uint160(nostrAddress));

uint256 userStarknetAddress =
abi.decode(kakarot.staticcallCairo("compute_starknet_address", kakarotCallData), (uint256));
abi.decode(namespaceAddress.staticcallCairo("compute_starknet_address", kakarotCallData), (uint256));

uint256[] memory addressOfCallData = new uint256[](1);
addressOfCallData[0] = userStarknetAddress;
bytes memory returnData = namespaceAddress.staticcallCairo("get_sn_by_nostr_default", balanceOfCallData);
return abi.decode(returnData, (uint256));
bytes memory returnData = namespaceAddress.staticcallCairo("get_sn_by_nostr_default", addressOfCallData);
// return abi.decode(returnData, (uint256));
}

function linkNostrAddress() public {
Expand Down
3 changes: 2 additions & 1 deletion packages/pixel_ui/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./src/App"
// export * from "./src/App"
export * from "./src/App.tsx"
// export * from "./src"
1 change: 0 additions & 1 deletion packages/pixel_ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import NotificationPanel from './tabs/NotificationPanel.js';
import ModalPanel from './ui/ModalPanel.js';
import Hamburger from './resources/icons/Hamburger.png';
import useMediaQuery from './hooks/useMediaQuery';
// import { useMediaQuery } from 'react-responsive';

function App() {
// Window management
Expand Down
Loading

0 comments on commit 59be154

Please sign in to comment.