1
0
forked from mico/idle_moloch

Merged latest main

This commit is contained in:
mic0 2024-10-25 10:57:00 +02:00
commit a5f1bc7a57
Signed by: mico
GPG Key ID: A3F8023524CF1C8D
12 changed files with 112 additions and 44 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
# Address
/app/contract_address.ts
# Compiler files # Compiler files
cache/ cache/
out/ out/

View File

@ -20,6 +20,8 @@ This is so time gets set on the local chain, otherwise you will start at 0 time
#### 3. 2. Point Metamask to Anvil network for local dev #### 3. 2. Point Metamask to Anvil network for local dev
#### 3. 3. Change `app/contract_address.ts` to match your program address if needed
### 4. Local development requires mining blocks by hand ### 4. Local development requires mining blocks by hand
Call `cast rpc anvil_mine` to mine next block, otherwise it wont ever progress and time "stands still" as far as the game is concerned Call `cast rpc anvil_mine` to mine next block, otherwise it wont ever progress and time "stands still" as far as the game is concerned

5
app/.gitignore vendored
View File

@ -1,4 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # See https://help.github.com/articles/ignoring-files/ for more about ignoring files
# address
contract_address.ts
# dependencies # dependencies
/node_modules /node_modules

4
app/contract_address.ts Normal file
View File

@ -0,0 +1,4 @@
const contractAddress = "0xbd06B0878888bf4c6895704fa603a5ADf7e65c66";
export default contractAddress

View File

@ -37,8 +37,6 @@ export const toReadable = (value: bigint, applyTokenDivision?: boolean) => {
{ value: BigInt('1000000000000000000000000000000000000000000000000000000'), suffix: 'septendecillion' }, { value: BigInt('1000000000000000000000000000000000000000000000000000000'), suffix: 'septendecillion' },
]; ];
console.log(value)
for (let i = 0; i < suffixes.length; i++) { for (let i = 0; i < suffixes.length; i++) {
if (value < suffixes[i].value) { if (value < suffixes[i].value) {
if (i == 0) { if (i == 0) {

View File

@ -25,7 +25,6 @@ const Header = () => {
const perSecondParagraph = useMemo(() => { const perSecondParagraph = useMemo(() => {
const perSecond = toReadable(army?.profit_per_second ?? BigInt(0)) const perSecond = toReadable(army?.profit_per_second ?? BigInt(0))
console.log(perSecond, army?.profit_per_second)
return (isRegistered) ? return (isRegistered) ?
<p className={styles.counter_per_seconds}>per second: {perSecond}</p> <p className={styles.counter_per_seconds}>per second: {perSecond}</p>
: null : null

View File

@ -26,7 +26,7 @@ const Home: NextPage = () => {
</main> </main>
<footer className={styles.footer}> <footer className={styles.footer}>
Made with by your fren mic0 Made with by your frens at 😈 Slay the Moloch team for Cohort VII of <a href="https://www.raidguild.org/" target="blank">RaidGuild</a>
</footer> </footer>
</div> </div>
); );

View File

@ -2,8 +2,8 @@ import React, { createContext, ReactNode, useCallback, useContext, useEffect } f
import { useAccount, useReadContract, useWriteContract } from 'wagmi' import { useAccount, useReadContract, useWriteContract } from 'wagmi'
import contractAbi from "../../../out/RaidGeld.sol/RaidGeld.json" import contractAbi from "../../../out/RaidGeld.sol/RaidGeld.json"
import { parseEther } from 'viem' import { parseEther } from 'viem'
import contractAddress from '../../contract_address'
const contractAddress = "0xbd06B0878888bf4c6895704fa603a5ADf7e65c66"
const abi = contractAbi.abi const abi = contractAbi.abi
export interface Player { export interface Player {

View File

@ -21,19 +21,10 @@
} }
.footer { .footer {
display: flex; margin-top: 2rem;
flex: 1;
padding: 2rem 0; padding: 2rem 0;
border-top: 1px solid #eaeaea; border-top: 1px solid #eaeaea;
justify-content: center; text-align: center;
align-items: center;
}
.footer a {
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
} }
.title a { .title a {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ import {Army, Raider} from "../src/RaidGeld.sol";
import "../src/RaidGeldUtils.sol"; import "../src/RaidGeldUtils.sol";
contract raid_geldTest is Test { contract raid_geldTest is Test {
function test_0_unit_price() public { function test_0_unit_price() pure public {
// buying 1 unit of moloch_denier // buying 1 unit of moloch_denier
uint256 basePriceMolochDenier = RaidGeldUtils.calculateUnitPrice(0, 0, 1); uint256 basePriceMolochDenier = RaidGeldUtils.calculateUnitPrice(0, 0, 1);
assertEq(basePriceMolochDenier, RaidGeldUtils.BASE_PRICE); assertEq(basePriceMolochDenier, RaidGeldUtils.BASE_PRICE);