
How to get Uniswap V3 liquidity pool address for whitelisting?
Similar to what we did for Uniswap V2 on how to find address of smart contract pool that will be generated we can do the same for V3 https://mirror.xyz/n00b21337.eth/0QkNt3NnLnnUSy4jFmWnaeRr_38Z3wlYKKf1O6URG3c Depending on what chain we are at, you can find all the addresses of Factories here https://github.com/Uniswap/sdk-core/blob/5365ae4cd021ab53b94b0879ec6ceb6ad3ebdce9/src/addresses.ts#L135 Aim for the v3CoreFactoryAddress values.**So there are a few methods to do that, one could be to us...
Example of implementation of EIP 4906 metadata updates
EIP 4096 has an interesting method of updating your metadata with events, more details here. https://eips.ethereum.org/EIPS/eip-4906 So lets see how to implement it with an example. First you need to create a file with interface that has this code in itpragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /// @title EIP-721 Metadata Update Extension interface IERC4906 is IERC165 { /// @dev This event emits when the metadata of a token is changed. /// Third-...
Transaction Bytecode vs Deployed Bytecode, differences and how to read them
Main difference between deployed bytecode or runtime bytecode and bytecode that is shown in deployed transaction is that later has initial code in it and its bigger in size. So what is initial(init) code?A smart contract's constructor is a one-time function not stored on the blockchain but present in the initial code. When creating a contract, users can also send native currency. It's vital to ensure the contract can accept this currency at deployment. If it can't, the creation...
R4Nd0m k0lLEC7I0N 0F U5EFul PHindiN92 0N mY j0URney PhR0m n00b 2 1337. rAmBL1N92 aBoUt 5Ol1d17y, rE4C7, nf7, dEfi, WE83

How to get Uniswap V3 liquidity pool address for whitelisting?
Similar to what we did for Uniswap V2 on how to find address of smart contract pool that will be generated we can do the same for V3 https://mirror.xyz/n00b21337.eth/0QkNt3NnLnnUSy4jFmWnaeRr_38Z3wlYKKf1O6URG3c Depending on what chain we are at, you can find all the addresses of Factories here https://github.com/Uniswap/sdk-core/blob/5365ae4cd021ab53b94b0879ec6ceb6ad3ebdce9/src/addresses.ts#L135 Aim for the v3CoreFactoryAddress values.**So there are a few methods to do that, one could be to us...
Example of implementation of EIP 4906 metadata updates
EIP 4096 has an interesting method of updating your metadata with events, more details here. https://eips.ethereum.org/EIPS/eip-4906 So lets see how to implement it with an example. First you need to create a file with interface that has this code in itpragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /// @title EIP-721 Metadata Update Extension interface IERC4906 is IERC165 { /// @dev This event emits when the metadata of a token is changed. /// Third-...
Transaction Bytecode vs Deployed Bytecode, differences and how to read them
Main difference between deployed bytecode or runtime bytecode and bytecode that is shown in deployed transaction is that later has initial code in it and its bigger in size. So what is initial(init) code?A smart contract's constructor is a one-time function not stored on the blockchain but present in the initial code. When creating a contract, users can also send native currency. It's vital to ensure the contract can accept this currency at deployment. If it can't, the creation...
R4Nd0m k0lLEC7I0N 0F U5EFul PHindiN92 0N mY j0URney PhR0m n00b 2 1337. rAmBL1N92 aBoUt 5Ol1d17y, rE4C7, nf7, dEfi, WE83
Share Dialog
Share Dialog

Subscribe to N00b21337

Subscribe to N00b21337
<100 subscribers
<100 subscribers
Exporting function signatures and especially error signatures which are still not properly showcased on etherscan and others is useful thing to have so you can match your errors or your function calls. To do that I made a custom hardhat task that will do that if you pass it name of the contract. Put this into tasks folder
import { task } from 'hardhat/config';
task('sigs', 'Generate ABI signatures for errors and functions')
.addParam('c', 'Name of the contract for which to generate ABI data')
.addOptionalParam('f', 'Name of Solidity file where contract is stored')
.setAction(async (taskArgs: any, { ethers }) => {
// If 'f' is not defined, use the value of 'c' for it
const fileName = taskArgs.f || taskArgs.c;
// Load the contract ABI based on the contract name
const ABI = (await import(`../artifacts/src/${fileName}.sol/${taskArgs.c}.json`)).abi;
const prepareData = (e: { name: string; inputs: { type: string }[] }) =>
`${e.name}(${e.inputs.map((param) => param.type)})`;
const encodeSelector = (f: string) => ethers.utils.id(f).slice(0, 10);
// Parse ABI
const output = ABI.filter((e: any) => ['function', 'error'].includes(e.type)).flatMap(
(e: any) => `${encodeSelector(prepareData(e))}: ${prepareData(e)}`
);
console.log(output);
});
And in your hardhat config add that file or folder with import
import './tasks/signatures';
you can now just run
hh sigs -c myContract
And you will get nice output of the functions/errors and corresponding signatures.If you need some help with making tasks, there is nice link with some other examples here
You might find this tool also useful for searching function signatures
or this if you need to quickly get one from some function definition
https://piyolab.github.io/playground/ethereum/getEncodedFunctionSignature/
Code is JS/TS so you can easily adjust this if you want to some other framework or just plain JS script.
Exporting function signatures and especially error signatures which are still not properly showcased on etherscan and others is useful thing to have so you can match your errors or your function calls. To do that I made a custom hardhat task that will do that if you pass it name of the contract. Put this into tasks folder
import { task } from 'hardhat/config';
task('sigs', 'Generate ABI signatures for errors and functions')
.addParam('c', 'Name of the contract for which to generate ABI data')
.addOptionalParam('f', 'Name of Solidity file where contract is stored')
.setAction(async (taskArgs: any, { ethers }) => {
// If 'f' is not defined, use the value of 'c' for it
const fileName = taskArgs.f || taskArgs.c;
// Load the contract ABI based on the contract name
const ABI = (await import(`../artifacts/src/${fileName}.sol/${taskArgs.c}.json`)).abi;
const prepareData = (e: { name: string; inputs: { type: string }[] }) =>
`${e.name}(${e.inputs.map((param) => param.type)})`;
const encodeSelector = (f: string) => ethers.utils.id(f).slice(0, 10);
// Parse ABI
const output = ABI.filter((e: any) => ['function', 'error'].includes(e.type)).flatMap(
(e: any) => `${encodeSelector(prepareData(e))}: ${prepareData(e)}`
);
console.log(output);
});
And in your hardhat config add that file or folder with import
import './tasks/signatures';
you can now just run
hh sigs -c myContract
And you will get nice output of the functions/errors and corresponding signatures.If you need some help with making tasks, there is nice link with some other examples here
You might find this tool also useful for searching function signatures
or this if you need to quickly get one from some function definition
https://piyolab.github.io/playground/ethereum/getEncodedFunctionSignature/
Code is JS/TS so you can easily adjust this if you want to some other framework or just plain JS script.
No activity yet