-
Notifications
You must be signed in to change notification settings - Fork 258
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
Implement multicall #1631
base: main
Are you sure you want to change the base?
Implement multicall #1631
Conversation
@@ -368,6 +369,10 @@ export async function setUpContracts(web3: Web3): Promise<Contracts> { | |||
const treasuryContractAddr = getConfigValue('VUE_APP_TREASURY_CONTRACT_ADDRESS') || (treasuryNetworks as Networks)[networkId]!.address; | |||
const Treasury = new web3.eth.Contract(treasuryAbi as Abi, treasuryContractAddr); | |||
|
|||
const multicallAddr = getConfigValue('VUE_APP_MULTICALL_CONTRACT_ADDRESS'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep line 109
if(process.env.NODE_ENV === 'development') return '';
This was originally commented out, and it isn't in CB-Marketplace, which is the only reason this would work in a dev environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to leave it, as it's in place for taking the address from generated abi files (as the addresses change every time you setup a dev env). I don't think we have multicall in our migrations, so it won't load it correctly. We somehow need to address this issue,
@@ -368,6 +369,10 @@ export async function setUpContracts(web3: Web3): Promise<Contracts> { | |||
const treasuryContractAddr = getConfigValue('VUE_APP_TREASURY_CONTRACT_ADDRESS') || (treasuryNetworks as Networks)[networkId]!.address; | |||
const Treasury = new web3.eth.Contract(treasuryAbi as Abi, treasuryContractAddr); | |||
|
|||
const multicallAddr = getConfigValue('VUE_APP_MULTICALL_CONTRACT_ADDRESS'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to leave it, as it's in place for taking the address from generated abi files (as the addresses change every time you setup a dev env). I don't think we have multicall in our migrations, so it won't load it correctly. We somehow need to address this issue,
const { Characters } = state.contracts(); | ||
if (!Characters) return; | ||
|
||
console.log('fetch 1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reminder comment to delete console.logs after the code is in a desired shape.
console.log('getNFTCall: ', getNFTCall(charactersAbi, Characters?.options.address, 'get', characterIds.map(characterId => [characterId]))); | ||
const multiCharacterDatas: string[] = await dispatch( | ||
'multicall', | ||
getNFTCall(charactersAbi, Characters?.options.address, 'get', characterIds.map(characterId => [characterId]))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need optional chaining operator "?", as at the start we have if (!Characters) return;
|
||
const multiWeaponDatas: string[] = await dispatch( | ||
'multicall', | ||
getNFTCall(weaponsAbi, Weapons?.options.address, 'get', weaponIds.map(weaponId => [weaponId]))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, "?" not needed
|
||
const multiShieldDatas: string[] = await dispatch( | ||
'multicall', | ||
getNFTCall(shieldsAbi, Shields?.options.address, 'get', shieldIds.map(shieldId => [shieldId]))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, "?" not needed
|
||
const multiTrinketDatas: string[] = await dispatch( | ||
'multicall', | ||
getNFTCall(raidTrinketsAbi, RaidTrinket?.options.address, 'get', trinketIds.map(trinketId => [trinketId]))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, "?" not needed
|
||
const multiJunkDatas = await dispatch( | ||
'multicall', | ||
getNFTCall(junkAbi, Junk?.options.address, 'get', junkIds.map(junkId => [junkId]))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, "?" not needed
All Submissions
New Feature Submissions
Notes
Please note, your code must pass all tests and lint checks before it can be merged.
PR Description
adding multiCall functionality used in CB Marketplace to store.ts in CB
Testing
Has the code been tested, or does it need double checking?