Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ–πŸ₯Ά ↝ Staking functionality added: Multitools can now be staked to earn rewards on planets #14

Merged
merged 3 commits into from
Jan 16, 2023

Conversation

Gizmotronn
Copy link
Member

Users can now receive rewards for staking multitools (aka planets) in the frontend/client.

Problems:

The frontend view currently only allows staking to be done if the player has an NFT from the planets collection. This should be improved where the staking (aka helper/planetHelper) contract also has this require function. We need to update the helper smart contract to point to multitools and not planets, as well as add a specific pointer and functionality to the PLANETS collection so that the require/ownedNfts statement on the frontend is coded into the contract itself.

Desired flow:
Contract for unconfirmed planet β†’ created via Deepnote flask
Once confirmed β†’ lazy mint on existing goerli contract
Mining multitool helper

Next step:
Replace the multitool with the planet (maybe switch them around). Figure out a format for tools/bots like the multitool to be acquired and added onto a staked planet - currently, while an object is staked, it has some erc20 tokens in ITS inventory - these are transferred to the user when unstaking the object. Add all token metadata for all the tokens visible on the /play page in /stake/frontend.
These next steps will be further refined in Friday's dev standup and then shared on Notion: https://skinetics.notion.site/Planet-Mining-multitool-8310fa1cd188440688bbcc19692b3b67

```next-dev.js?3515:25 Error: Contract transaction failed

Message: execution reverted: ERC1155: caller is not token owner nor approved

| Transaction info |

from:      0x8E818DF8441d4D13EA8fe8dd26967C061D956FE0
to:        0xA324960848a42Ef7664C0681207B42FDAA437Ac5
chain:     goerli (5)

| Failed contract call info |

function:  stake(uint256)
arguments: {
  "_tokenId": {
    "type": "BigNumber",
    "hex": "0x00"
  }
}

Need help with this error? Join our community: https://discord.gg/thirdweb

| Raw error |

{"reason":"execution reverted: ERC1155: caller is not token owner nor approved","code":"UNPREDICTABLE_GAS_LIMIT","method":"estimateGas","transaction":{"from":"0x8E818DF8441d4D13EA8fe8dd26967C061D956FE0","to":"0xA324960848a42Ef7664C0681207B42FDAA437Ac5","data":"0xa694fc3a0000000000000000000000000000000000000000000000000000000000000000","accessList":null},"error":{"code":-32603,"message":"execution reverted: ERC1155: caller is not token owner nor approved","data":{"originalError":{"code":3,"data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e6572206e6f7220617070726f7665640000000000000000000000000000000000","message":"execution reverted: ERC1155: caller is not token owner nor approved"}}}}
    at convertToTWError (thirdweb-checkout-3c….esm.js?75f7:1654:1)
    at ContractWrapper.sendTransactionByFunction (thirdweb-checkout-3c….esm.js?75f7:2759:1)
    at async ContractWrapper.sendTransaction (thirdweb-checkout-3c….esm.js?75f7:2737:1)
    at async ContractWrapper.call (thirdweb-checkout-3c….esm.js?75f7:2696:1)
window.console.error	@	next-dev.js?3515:25
execute	@	mutation.mjs?594f:154
await in execute (async)
mutate	@	mutationObserver.mjs?e722:81
eval	@	useMutation.mjs?94f3:18
onClick	@	index-aed60ee9.esm.js?304d:7228
callCallback	@	react-dom.development.js?ac89:4164
invokeGuardedCallbackDev	@	react-dom.development.js?ac89:4213
invokeGuardedCallback	@	react-dom.development.js?ac89:4277
invokeGuardedCallbackAndCatchFirstError	@	react-dom.development.js?ac89:4291
executeDispatch	@	react-dom.development.js?ac89:9041
processDispatchQueueItemsInOrder	@	react-dom.development.js?ac89:9073
processDispatchQueue	@	react-dom.development.js?ac89:9086
dispatchEventsForPlugins	@	react-dom.development.js?ac89:9097
eval	@	react-dom.development.js?ac89:9288
batchedUpdates$1	@	react-dom.development.js?ac89:26140
batchedUpdates	@	react-dom.development.js?ac89:3991
dispatchEventForPluginEventSystem	@	react-dom.development.js?ac89:9287
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay	@	react-dom.development.js?ac89:6465
dispatchEvent	@	react-dom.development.js?ac89:6457
dispatchDiscreteEvent
```
The frontend view currently only allows staking to be done if the player has an NFT from the planets collection. This should be improved where the staking (aka helper/planetHelper) contract also has this require function.

As per the [Star Sailors Web Flow Demo](https://www.notion.so/Star-Sailors-Web-Flow-Demo-d2b9180a577144f9a523e045d429076a) roadmap, we need to determine what is actually being staked (multiple nft collections at a time?) β†’ the planet, the multitool, or something else?

For Signal-K/sytizen#18 & Signal-K/sytizen#6

Notion: https://skinetics.notion.site/Planet-Mining-multitool-8310fa1cd188440688bbcc19692b3b67
Copy link
Member Author

@Gizmotronn Gizmotronn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build works :)

Just need to fix:

// 0xdf35Bb26d9AAD05EeC5183c6288f13c0136A7b43 is deployed from the correct wallet, but has a problem - it points to the Planets contract as the multitools contract (i.e. the planets are both the required nft and the nft that is being staked. This could be implemented in future...but for now we need to fix this.

And then migrate the components from stake/frontend into the root Next.js app. We've already started setting that up with the planetInteraction.module.css file format for the styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant