Git Product home page Git Product logo

adventure-party's Introduction

Adventure Party

Summon/adventure multiple adventures at once!

Deploy instructions:

npm i
cp .env.template .env
# Edit .env
npm run compile
npm run test
# !!! Edit scripts/deploy.ts file to choose which class IDs you want !!! The default is one of each class.
# Test the deploy tx
npx hardhat run scripts/deploy.ts
# Actually deploy
npx hardhat run --network fantom scripts/deploy.ts

once deployed make sure to copy the created contract address in .env variable ADVENTURE_PARTY

Afterwards navigate to your deployed contract on ftmscan and use adventureAll() to adventure your entire party!

or

You can run party using npm run run-party You can display adventurers stats using npm run display-status

Schedule adventures

you can schedule parties to run on predefined schedule using nohup npm run schdule-party &

The schedule is controlled using CRON config through .env file. By default it'll try run party every 30min (it'll trigger transactions only when needed)

adventure-party's People

Contributors

cipherzzz avatar erain9 avatar sha-2048 avatar vfat0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

adventure-party's Issues

adventureAll function not working with too many summons

It looks like the function stops working when there are too many summons in the contract.
Tested 110 summons with the function which worked fine, then summoned another 500+ which then caused an error for the adventureAll function call.

FetchError: network timeout when calling "display-status" and "run-party" many times

Hi vfat,

It looks like the error happens after calling a method for the second time.

First time I queried for status successfully. The second time the error occurs. Not sure if there's any quota related to the method calls? I went to Etherscan.com and checked the API Keys' stats and saw empty API statistics.

Pretty sure my Internet connection is fine.

hieunguyen@hieunguyen adventure-party % npm run display-status

> [email protected] display-status
> hardhat run --network fantom scripts/status.ts

Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
my Adventurers: 
Barbarian (2448258): level: 1, xp: 250.0 (nb days to level up: 3). Next leveling 9/17/2021, 8:00:20 PM
Bard (2448259): level: 1, xp: 250.0 (nb days to level up: 3). Next leveling 9/17/2021, 8:00:20 PM

hieunguyen@hieunguyen adventure-party % npm run run-party

> [email protected] run-party
> hardhat run --network fantom scripts/run.ts

Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
hieunguyen@hieunguyen adventure-party % npm run run-party

> [email protected] run-party
> hardhat run --network fantom scripts/run.ts

Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
HardhatError: HH109: Network connection timed out.
Please check your internet connection and networks config
    at HttpProvider._fetchJsonRpcResponse (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/http.ts:184:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at HttpProvider.request (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/http.ts:55:29)
    at GanacheGasMultiplierProvider._isGanache (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:315:30)
    at GanacheGasMultiplierProvider.request (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:304:23)
    at EthersProviderWrapper.send (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
    at Object.getSigners (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:23:20)

    Caused by: FetchError: network timeout at: https://rpc.ftm.tools/
        at Timeout.<anonymous> (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/node-fetch/lib/index.js:1454:13)
        at listOnTimeout (node:internal/timers:557:17)
        at processTimers (node:internal/timers:500:7)
hieunguyen@hieunguyen adventure-party % npm run run-party

> [email protected] run-party
> hardhat run --network fantom scripts/run.ts

Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
HardhatError: HH109: Network connection timed out.
Please check your internet connection and networks config
    at HttpProvider._fetchJsonRpcResponse (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/http.ts:184:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at HttpProvider.request (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/http.ts:55:29)
    at GanacheGasMultiplierProvider._isGanache (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:315:30)
    at GanacheGasMultiplierProvider.request (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:304:23)
    at EthersProviderWrapper.send (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
    at Object.getSigners (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:23:20)

    Caused by: FetchError: network timeout at: https://rpc.ftm.tools/
        at Timeout.<anonymous> (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/node-fetch/lib/index.js:1454:13)
        at listOnTimeout (node:internal/timers:557:17)
        at processTimers (node:internal/timers:500:7)
hieunguyen@hieunguyen adventure-party % npm run display-status                            

> [email protected] display-status
> hardhat run --network fantom scripts/status.ts

Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
my Adventurers: 
FetchError: request to https://rpc.ftm.tools/ failed, reason: socket hang up
    at ClientRequest.<anonymous> (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/node-fetch/lib/index.js:1461:11)
    at ClientRequest.emit (node:events:394:28)
    at ClientRequest.emit (node:domain:475:12)
    at TLSSocket.socketOnEnd (node:_http_client:471:9)
    at TLSSocket.emit (node:events:406:35)
    at TLSSocket.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1348:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'system',
  errno: 'ECONNRESET',
  code: 'ECONNRESET'
}
hieunguyen@hieunguyen adventure-party % npm run display-status

> [email protected] display-status
> hardhat run --network fantom scripts/status.ts

Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
my Adventurers: 
HardhatError: HH109: Network connection timed out.
Please check your internet connection and networks config
    at HttpProvider._fetchJsonRpcResponse (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/http.ts:184:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at HttpProvider.request (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/http.ts:55:29)
    at EthersProviderWrapper.send (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)

    Caused by: FetchError: network timeout at: https://rpc.ftm.tools/
        at Timeout.<anonymous> (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/node-fetch/lib/index.js:1454:13)
        at listOnTimeout (node:internal/timers:557:17)
        at processTimers (node:internal/timers:500:7)

AdventureParty isn't deployed

Hi, I've follow the instruction. Tests succeeded. Deployment worked.

hieunguyen@hieunguyen adventure-party % npx hardhat run scripts/deploy.ts
Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
AdventureParty deployed to: 0x82e01223d51Eb87e16A03E24687EDF0F294da6f1
Summoming 1,2 adventurers, please wait...
Adventurer number 2's summoner ID is 2446751

When I search for that "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1" in FTMScan, I didn't see any contract or transaction.

I tried deploying again. The same string "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1" was returned.

What can I do to fix it?

Sometimes "Error: cannot estimate gas; transaction may fail or may require manual gas limit"

Sometimes summoning shows this error. I created 1st party, error. I created 2nd party, no error. I created 3rd party, error.
All the parties were created successfully and can be queries on ftmscan.com.

hieunguyen@hieunguyen adventure-party % npx hardhat run scripts/deploy.ts --network fantom
Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
AdventureParty deployed to: 0xFcf9dC9ba107blahblahblahblahblahblahblahblah
Summoming 1,2,3,4,5,6,7,8,9,10,11 adventurers, please wait...
Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"name":"ProviderError","code":3,"_isProviderError":true,"data":"0x4e487b710000000000000000000000000000000000000000000000000000000000000032"}, method="call", transaction={"from":"0x417FDA4Fd1851E5A1861cblahblahblahblahblahblah","to":"0xFcf9dC9ba107d1BB543blahblahblahblahblahblah","data":"0x4a2fc9e8000000000000000000000000000000000000000000000000000000000000000a","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.4.5)
at Logger.makeError (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.throwError (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at checkError (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:80:16)
at EthersProviderWrapper. (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:555:20)
at step (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.throw (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at rejected (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
code: 'UNPREDICTABLE_GAS_LIMIT',
error: ProviderError: execution reverted
at HttpProvider.request (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/http.ts:49:19)
at LocalAccountsProvider.request (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/hardhat/src/internal/core/providers/accounts.ts:168:34)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at EthersProviderWrapper.send (/Users/hieunguyen/Downloads/Rarity/adventure-party/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20),
method: 'call',
transaction: {
from: '0x417FDA4Fd1851E5A1861cblahblahblahblahblahblah',
to: '0xFcf9dC9ba107d1BB543e1C270blahblahblahblahblahblah',
data: '0x4a2fc9e8000000000000000000000000000000000000000000000000000000000000000a',
accessList: null
}
}

Unable to deploy due to error estimating gas. Where should I edit? Thank you

Unable to deploy due to error estimating gas. Where should I edit? Thank you this is awesome!
Here's the return:

Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"name":"ProviderError","code":-32000,"_isProviderError":true}, method="estimateGas", transaction={"from":"0xBf42034D91a1Cb630f4F332a7A14039eda0747D6",

Source Code Verification on FTMscan

Hi,

Appreciate the update, I just ran and deployed the latest scripts.

The contract code isn't verified yet on ftmscan.com so I can't interact with the contract there.

Was going through the verify process (not sure if I should as I didn't create it), but not sure where the ABI constructor arguments would be or if they are different than the old contract.

Thanks!

Auto Leveling up doesn't seem to work

Hi there,

Been using the script well over the past few days, but now the auto leveling up function doesn't seem to actually level everyone up:

Barbarian (733309): level: 1, xp: 1000.0 (nb days to level up: 0). Next leveling 9/13/2021, 2:31:12 PM
Bard (733310): level: 1, xp: 1000.0 (nb days to level up: 0). Next leveling 9/13/2021, 2:31:12 PM
Cleric (733311): level: 1, xp: 1000.0 (nb days to level up: 0). Next leveling 9/13/2021, 2:31:12 PM
Druid (733312): level: 1, xp: 1000.0 (nb days to level up: 0). Next leveling 9/13/2021, 2:31:12 PM

I called the function manually in ftmscan and they're still level 1. Any ideas?

Owner check will always fail because rarity.ownerOf always return UPPERCASE

Hi,

I'm trying to import my summoners into the contract, but the owner check will always fail because rarity is returning all uppercase address even I am the true owner

//(rarity.ownerOf(summonerIDs[i]) == address(this))
Error: VM Exception while processing transaction: reverted with reason string 'Ownable: caller is not the owner'

Withdraw tokens from adventure-party contract to eoa

This is an awesome package! I'm a little concerned that I could have some awesome characters and not be able to withdraw them from the contract based on the code. how do I transfer a summoner from the contract?

New Schedule Scripts Failing

Hey there,

I've used the old deploy scripts with no issues in the past, was trying out the automation scripts and am getting some errors:


[email protected] display-status
npx hardhat run scripts/status.ts

Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!

/Users/Downloads/adventure-party/node_modules/ts-node/src/index.ts:692
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
typechain/factories/AdventureParty__factory.ts:16:3 - error TS2416: Property 'deploy' in type 'AdventureParty__factory' is not assignable to the same property in base type 'ContractFactory'.
Type '(overrides?: Overrides | undefined) => Promise' is not assignable to type '(...args: any[]) => Promise'.
Type 'Promise' is not assignable to type 'Promise'.
Type 'AdventureParty' is not assignable to type 'Contract'.
The types returned by 'queryFilter(...)' are incompatible between these types.
Type 'Promise<TypedEvent[]>' is not assignable to type 'Promise<Event[]>'.
Type 'TypedEvent[]' is not assignable to type 'Event[]'.
Type 'TypedEvent' is not assignable to type 'Event'.
Types of property 'args' are incompatible.
Type 'unknown' is not assignable to type 'Result | undefined'.
Type 'unknown' is not assignable to type 'Result'.

16 deploy(overrides?: Overrides): Promise {
~~~~~~
typechain/factories/AdventureParty__factory.ts:22:3 - error TS2416: Property 'attach' in type 'AdventureParty__factory' is not assignable to the same property in base type 'ContractFactory'.
Type '(address: string) => AdventureParty' is not assignable to type '(address: string) => Contract'.
Type 'AdventureParty' is not assignable to type 'Contract'.

22 attach(address: string): AdventureParty {
~~~~~~
typechain/factories/AdventureParty__factory.ts:25:3 - error TS2416: Property 'connect' in type 'AdventureParty__factory' is not assignable to the same property in base type 'ContractFactory'.
Type '(signer: Signer) => AdventureParty__factory' is not assignable to type '(signer: Signer) => ContractFactory'.
Call signature return types 'AdventureParty__factory' and 'ContractFactory' are incompatible.
The types of 'deploy' are incompatible between these types.
Type '(overrides?: Overrides | undefined) => Promise' is not assignable to type '(...args: any[]) => Promise'.

25 connect(signer: Signer): AdventureParty__factory {
~~~~~~~

at createTSError (/Users/Downloads/adventure-party/node_modules/ts-node/src/index.ts:692:12)
at reportTSError (/Users/Downloads/adventure-party/node_modules/ts-node/src/index.ts:696:19)
at getOutput (/Users/Downloads/adventure-party/node_modules/ts-node/src/index.ts:883:36)
at Object.compile (/Users/Downloads/adventure-party/node_modules/ts-node/src/index.ts:1185:30)
at Module.m._compile (/Users/Downloads/adventure-party/node_modules/ts-node/src/index.ts:1309:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Object.require.extensions.<computed> [as .ts] (/Users/Downloads/adventure-party/node_modules/ts-node/src/index.ts:1313:12)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)

any idea how to resolve? Double checked and followed the instructions in the readme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.