Skip to content

Sepolia Switch - #729

Merged
sneakzttv merged 52 commits into
mainfrom
sneakz/sepolia-take-2
Nov 13, 2023
Merged

sneakzttv merged 52 commits into
mainfrom
sneakz/sepolia-take-2

Conversation

@sneakzttv

@sneakzttv sneakzttv commented Nov 12, 2023

Copy link
Copy Markdown
Contributor

Changing all contracts and config over to Sepolia so that we're not caught out come early next year.

Updated all the sample scene, lootbox, web3auth and gelato calls to use Sepolia.

Added some new tests for ECDSA coverage & some other missing functions. Also updated the rest to match the new config.

Updated byte array result values in tests to big integers for ease of use. (converting byte arrays is tedious)

We had 3 eth method and ABI scripts all doing the same thing, got rid of the duplicates and updated the references.

Added a contract class next to the ABIs in runtime/evm/token to manage duplicate variables. Cleaned up some code too as i could change a few raw values to references.

Tests, samples & lootboxes all reference the ERC contracts and ABIs above so we only have to change them in 1 place.

Balance of batch for erc721 was using the old api which doesn't work on Sepolia (fun), i've updated this to use multicall now.

I've also uploaded these contracts to a repo here for future reference https://github.com/ChainSafe/SDKSampleContracts as i had to dive through the ABIs to build them to get the proper responses without changing the tests expected results.

Updated expected and actual positions for assert in tests as they were in the wrong order and added some helper comments.

Fixed tracker issue "Eliminate duplicated logic in the Chains class, considering the functionality of ChainProvider" Removed the duplicate functions as they had no usages anyway.

--------------------To Test----------------------------
Set server settings to Sepolia.
Import samples & lootboxes via package manager.
Login to main scene to test that everything is functioning as intended via Metamask.
Login to main scene to test that everything is functioning as intended via Web3Auth.
Run the lootboxes scene to test that everything is functioning as intended.
Check the test runner to ensure that all new tests are passing.

@sneakzttv sneakzttv added the Status: In Progress Added to issues to signal that its actively being worked on. label Nov 12, 2023
@sneakzttv sneakzttv self-assigned this Nov 12, 2023
@sneakzttv sneakzttv linked an issue Nov 12, 2023 that may be closed by this pull request
@sneakzttv sneakzttv added ready-to-merge Ready to Merge PR - this'll trigger required checks and removed ready-to-merge Ready to Merge PR - this'll trigger required checks labels Nov 13, 2023
/// <param name="_multicall">[Optional] The Multicall specific parameters, if any.</param>
/// <param name="_rpc">[Optional] The RPC (Remote Procedure Call) configuration, if needed.</param>
/// <returns>String encoded response from the MultiCall contract.</returns>
public static async Task<string> Multicall(Web3 web3, string _chain, string _network, string _contract, string _abi, string _method, string _args, string _multicall = "", string _rpc = "")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Where is this method switched to?

@sneakzttv sneakzttv Nov 13, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The initial function doesn't work on Sepolia as it was using the API for Goerli, similar for AllNfts which I'll look at for my next PR. Anyway I've amended and tested it with owner of batch 721 and multicall here starting on line 81.
https://github.com/ChainSafe/web3.unity/blob/82b53e47c22f3061fc40ab5215a2ad17ee5389af/Packages/io.chainsafe.web3-unity/Runtime/Scripts/EVM/Token/Erc721.cs

@kantagara

Copy link
Copy Markdown
Contributor

I have following issues:

  1. Server Settings aren't being saved whenever I changed them to Sepolia
  2. When I change them to Sepolia in editor, after I press "Continue with google" It automatically logins, without me doing proper authentication

@sneakzttv

sneakzttv commented Nov 13, 2023

Copy link
Copy Markdown
Contributor Author

I have following issues:

  1. Server Settings aren't being saved whenever I changed them to Sepolia
  2. When I change them to Sepolia in editor, after I press "Continue with google" It automatically logins, without me doing proper authentication
  1. Weird, mine is logging into sepolia and calling just fine for social logins and WC
    image

  2. It could be holding old authentication details somewhere also maybe, mine asks me to auth the first time but auto logs in the 2nd time, i think it's a w3a thing, maybe we make an issue if we want that to be cleared? Guessing it only does it if it still has your email logged in to your browser or session is still active etc.

Remove tests
@sneakzttv
sneakzttv requested a review from robGG1997 November 13, 2023 11:10
@sneakzttv
sneakzttv requested a review from kantagara November 13, 2023 11:26
@sneakzttv sneakzttv added ready-to-merge Ready to Merge PR - this'll trigger required checks and removed ready-to-merge Ready to Merge PR - this'll trigger required checks labels Nov 13, 2023

@RyRy79261 RyRy79261 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good, just some minor semantics comments

namespace Scripts.EVM.Token
{
public static class CommonMethod
public static class EthMethod

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider, TokenMethod

@sneakzttv sneakzttv Nov 13, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Eth method was what we were using before in the other scripts that weren't common method, I merged them. I honestly prefer eth method though as above evm method - ethereum virtual machine method - eth method. Don't think it matters too much anyway unless you guys really think we should change it.

@juans-chainsafe juans-chainsafe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So far I only tested with Metamask, but I have some feedback:

  • SponsorCall fails with:
Web3Exception: GelatoRelaySDK/SponsoredCall: Failed with error: HTTP.POST to https://api.gelato.digital/relays/v2/sponsored-call responded with error: {"message":"Unauthorized sponsored target contract: 0x763D37aB388C5cdd2Fb0849d6275802F959fbF30"}
ChainSafe.GamingSdk.Gelato.Gelato.SponsoredCall (ChainSafe.GamingSdk.Gelato.Dto.SponsoredCallRequest request) (at <bd92b5b0e746460a848a0fcb5ec11108>:0)
GelatoSample.SponsorCall () (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Samples/GelatoSample.cs:91)
GelatoCalls.GelatoSponsorCall () (at Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Gelato/GelatoCalls.cs:44)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <b6c5d0f08ddf477186f780f49bb14dee>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)
  • ❌ Samples that requires to sign a transaction in the wallet can't track the transaction output (I see that the transaction is made successfully in the wallet, but in the console I get 2 different outputs: a "transaction not found" error or nothing happens), the error output:
Web3Exception: transaction not found
ChainSafe.Gaming.Evm.Providers.RpcProviderExtensions.GetTransaction (ChainSafe.Gaming.Evm.Providers.IRpcProvider provider, System.String transactionHash) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
ChainSafe.Gaming.WalletConnect.WalletConnectTransactionExecutor.SendTransaction (ChainSafe.Gaming.Evm.Transactions.TransactionRequest transaction) (at <0267720df1f44a20996aa61ee805516f>:0)
ChainSafe.Gaming.Evm.Contracts.Contract.SendWithReceipt (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
ChainSafe.Gaming.Evm.Contracts.Contract.Send (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
Scripts.EVM.Token.Erc721.MintErc721 (ChainSafe.Gaming.Web3.Web3 web3, System.String abi, System.String contractAddress, System.String uri) (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/EVM/Token/Erc721.cs:153)
Erc721Calls.MintErc721 () (at Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Erc721/Erc721Calls.cs:119)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <b6c5d0f08ddf477186f780f49bb14dee>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)
Screenshot 2023-11-13 at 09 55 50 Happens on samples like:
  • Mint ERC20
  • Transfer ERC20
  • Mint ERC721
  • Transfer ERC721
  • GetNonce
  • SendArray

@sneakzttv

sneakzttv commented Nov 13, 2023

Copy link
Copy Markdown
Contributor Author

So far I only tested with Metamask, but I have some feedback:

  • SponsorCall fails with:
Web3Exception: GelatoRelaySDK/SponsoredCall: Failed with error: HTTP.POST to https://api.gelato.digital/relays/v2/sponsored-call responded with error: {"message":"Unauthorized sponsored target contract: 0x763D37aB388C5cdd2Fb0849d6275802F959fbF30"}
ChainSafe.GamingSdk.Gelato.Gelato.SponsoredCall (ChainSafe.GamingSdk.Gelato.Dto.SponsoredCallRequest request) (at <bd92b5b0e746460a848a0fcb5ec11108>:0)
GelatoSample.SponsorCall () (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Samples/GelatoSample.cs:91)
GelatoCalls.GelatoSponsorCall () (at Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Gelato/GelatoCalls.cs:44)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <b6c5d0f08ddf477186f780f49bb14dee>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)
  • ❌ Samples that requires to sign a transaction in the wallet can't track the transaction output (I see that the transaction is made successfully in the wallet, but in the console I get 2 different outputs: a "transaction not found" error or nothing happens), the error output:
Web3Exception: transaction not found
ChainSafe.Gaming.Evm.Providers.RpcProviderExtensions.GetTransaction (ChainSafe.Gaming.Evm.Providers.IRpcProvider provider, System.String transactionHash) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
ChainSafe.Gaming.WalletConnect.WalletConnectTransactionExecutor.SendTransaction (ChainSafe.Gaming.Evm.Transactions.TransactionRequest transaction) (at <0267720df1f44a20996aa61ee805516f>:0)
ChainSafe.Gaming.Evm.Contracts.Contract.SendWithReceipt (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
ChainSafe.Gaming.Evm.Contracts.Contract.Send (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
Scripts.EVM.Token.Erc721.MintErc721 (ChainSafe.Gaming.Web3.Web3 web3, System.String abi, System.String contractAddress, System.String uri) (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/EVM/Token/Erc721.cs:153)
Erc721Calls.MintErc721 () (at Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Erc721/Erc721Calls.cs:119)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <b6c5d0f08ddf477186f780f49bb14dee>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)

Screenshot 2023-11-13 at 09 55 50 Happens on samples like:

  • Mint ERC20
  • Transfer ERC20
  • Mint ERC721
  • Transfer ERC721
  • GetNonce
  • SendArray

sponsor call fixed will dm you to go through the rest, works here, odd
image
image

@juans-chainsafe

Copy link
Copy Markdown
Contributor

So far I only tested with Metamask, but I have some feedback:

  • SponsorCall fails with:
Web3Exception: GelatoRelaySDK/SponsoredCall: Failed with error: HTTP.POST to https://api.gelato.digital/relays/v2/sponsored-call responded with error: {"message":"Unauthorized sponsored target contract: 0x763D37aB388C5cdd2Fb0849d6275802F959fbF30"}
ChainSafe.GamingSdk.Gelato.Gelato.SponsoredCall (ChainSafe.GamingSdk.Gelato.Dto.SponsoredCallRequest request) (at <bd92b5b0e746460a848a0fcb5ec11108>:0)
GelatoSample.SponsorCall () (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Samples/GelatoSample.cs:91)
GelatoCalls.GelatoSponsorCall () (at Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Gelato/GelatoCalls.cs:44)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <b6c5d0f08ddf477186f780f49bb14dee>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)
  • ❌ Samples that requires to sign a transaction in the wallet can't track the transaction output (I see that the transaction is made successfully in the wallet, but in the console I get 2 different outputs: a "transaction not found" error or nothing happens), the error output:
Web3Exception: transaction not found
ChainSafe.Gaming.Evm.Providers.RpcProviderExtensions.GetTransaction (ChainSafe.Gaming.Evm.Providers.IRpcProvider provider, System.String transactionHash) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
ChainSafe.Gaming.WalletConnect.WalletConnectTransactionExecutor.SendTransaction (ChainSafe.Gaming.Evm.Transactions.TransactionRequest transaction) (at <0267720df1f44a20996aa61ee805516f>:0)
ChainSafe.Gaming.Evm.Contracts.Contract.SendWithReceipt (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
ChainSafe.Gaming.Evm.Contracts.Contract.Send (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) (at <a9022bec331e4a99a4e22386a313a3bb>:0)
Scripts.EVM.Token.Erc721.MintErc721 (ChainSafe.Gaming.Web3.Web3 web3, System.String abi, System.String contractAddress, System.String uri) (at /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/EVM/Token/Erc721.cs:153)
Erc721Calls.MintErc721 () (at Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Erc721/Erc721Calls.cs:119)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <b6c5d0f08ddf477186f780f49bb14dee>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)

Screenshot 2023-11-13 at 09 55 50 Happens on samples like:

  • Mint ERC20
  • Transfer ERC20
  • Mint ERC721
  • Transfer ERC721
  • GetNonce
  • SendArray

sponsor call fixed will dm you to go through the rest, works here, odd image

SponsorCall and all gelato examples working now ✅

@sneakzttv
sneakzttv merged commit 7a5a9e1 into main Nov 13, 2023
@sneakzttv
sneakzttv deleted the sneakz/sepolia-take-2 branch November 13, 2023 18:18

@juans-chainsafe juans-chainsafe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All working now! but in WebGL we have a different error, created this ticket for that: #730

rob1997 pushed a commit that referenced this pull request Jan 16, 2025
* tests

tests

* almost all passing

almost all passing

* Duplicates removed

* organizing

* Cleanup

* cleanup

* Cleanup

Cleanup

* ecdsa

ecdsa

* Update SampleBehaviour.cs

* Cleanup

Cleanup

* cleanup

cleanup

* cleanup

cleanup

* Update SampleMain.unity

* Auto-duplicate Packages Samples

* Update ChainlinkLootboxSampleLauncher.cs

* Auto-duplicate Packages Samples

* Update Erc721Tests.cs

* Update Chains.cs

* Published Solution Dependencies to Package Libraries as DLLs

* Update Erc721Tests.cs

* Update EvmTests.cs

* Update Erc721.cs

* update templates

update templates

* gas limit fixed

gas limit fixed

* Auto-duplicate Packages Samples

* update

update

* ownerOf

ownerOf

* Auto-duplicate Packages Samples

* owner of batch working

* Auto-duplicate Packages Samples

* tests

* Auto-duplicate Packages Samples

* Update Erc1155Tests.cs

* tests fixed

tests fixed

* Auto-duplicate Packages Samples

* Update SampleMain.unity

* Auto-duplicate Packages Samples

* Remove tests

Remove tests

* Gelato fix

Gelato fix

* Auto-duplicate Packages Samples

* Update SampleLogin.unity

* Auto-duplicate Packages Samples

* allerc prep

allerc prep

* Auto-duplicate Packages Samples

---------

Co-authored-by: sneakzttv <sneakzttv@users.noreply.github.com>
sergeypanin1994 pushed a commit to sergeypanin1994/web3.unity that referenced this pull request Mar 16, 2025
* tests

tests

* almost all passing

almost all passing

* Duplicates removed

* organizing

* Cleanup

* cleanup

* Cleanup

Cleanup

* ecdsa

ecdsa

* Update SampleBehaviour.cs

* Cleanup

Cleanup

* cleanup

cleanup

* cleanup

cleanup

* Update SampleMain.unity

* Auto-duplicate Packages Samples

* Update ChainlinkLootboxSampleLauncher.cs

* Auto-duplicate Packages Samples

* Update Erc721Tests.cs

* Update Chains.cs

* Published Solution Dependencies to Package Libraries as DLLs

* Update Erc721Tests.cs

* Update EvmTests.cs

* Update Erc721.cs

* update templates

update templates

* gas limit fixed

gas limit fixed

* Auto-duplicate Packages Samples

* update

update

* ownerOf

ownerOf

* Auto-duplicate Packages Samples

* owner of batch working

* Auto-duplicate Packages Samples

* tests

* Auto-duplicate Packages Samples

* Update Erc1155Tests.cs

* tests fixed

tests fixed

* Auto-duplicate Packages Samples

* Update SampleMain.unity

* Auto-duplicate Packages Samples

* Remove tests

Remove tests

* Gelato fix

Gelato fix

* Auto-duplicate Packages Samples

* Update SampleLogin.unity

* Auto-duplicate Packages Samples

* allerc prep

allerc prep

* Auto-duplicate Packages Samples

---------

Co-authored-by: sneakzttv <sneakzttv@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Ready to Merge PR - this'll trigger required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Demo Scene to Sepolia

5 participants