Source:
dev 8cf2eb6
@railgun-reloaded/contract-abisA Collection of ABI for Interacting with Railgun Contracts
import {RailgunV1, RailgunV2_2} from '@railgun-reloaded/contract-abis'
// Or to import a single ABI
import RelayAdapt from '@railgun-reloaded/contract-abis/RelayAdapt.json'
RailgunV2_2 is the newest ABI. It declares the Action event.
Each file in abis/ has a typed module at
@railgun-reloaded/contract-abis/typed/<file name>, where <file name> is
the JSON file name without .json. The module exports one as const
fragment for each function and each event.
import { decodeFunctionData, encodeFunctionData } from 'viem'
import { shieldFunctionAbi } from '@railgun-reloaded/contract-abis/typed/RailgunV2_2'
const data = encodeFunctionData({ abi: shieldFunctionAbi, args: [[]] })
const { functionName, args } = decodeFunctionData({ abi: shieldFunctionAbi, data })
viem gets the argument and result types from as const. Each fragment holds
one item so that you import only the items that you use. A bundler includes
only the imported fragments, because the package sets sideEffects: false.
The export name is the item name in camel case, then Function or Event,
then Abi. For example, the shield function is shieldFunctionAbi and the
Shield event is shieldEventAbi. The fragments do not include
internalType, constructors, errors, or receive.
The typed/* subpath needs moduleResolution node16, nodenext, or
bundler in your tsconfig.json.
The JSON in abis/ is the source. typed/*.mts is generated from it. The
build makes typed/*.mjs and typed/*.d.mts, and the package publishes
those two. After you change a JSON file, run npm run generate:abi and
commit the result. npm run check:abi fails when a typed module does not
match its JSON file.
npm install @railgun-reloaded/contract-abis
| Network | Contract Address |
|---|---|
| Ethereum | 0xFA7093CDD9EE6932B4eb2c9e1cde7CE00B1FA4b9 |
| Polygon | 0x19b620929f97b7b990801496c3b361ca5def8c71 |
| BNB | 0x590162bf4b50F6576a459B75309eE21D92178A10 |
| Arbitrum | 0xFA7093CDD9EE6932B4eb2c9e1cde7CE00B1FA4b9 |
| Network | Contract Address |
|---|---|
| Ethereum | 0x4025ee6512DBbda97049Bcf5AA5D38C54aF6bE8a |
| Polygon | 0xc7FfA542736321A3dd69246d73987566a5486968 |
| BNB | 0x741936fb83DDf324636D3048b3E6bC800B8D9e12 |
| Arbitrum | 0x5aD95C537b002770a39dea342c4bb2b68B1497aA |
| Network | Contract Address | Block Range | Transaction Index | Transaction Hash |
|---|---|---|---|---|
| Ethereum | 0xBCFA4De73afb071C9FF18a20A22F818e657C541a | 14737691 - 16076750 | 257 | 0x2bd98cd135e2eaf7b7239bb4951a043f655629b5d0f0ca12334ce05718512361 |
| Polygon | 0x280E417Ab3CAfC378F3E6F91148FD8eF766d4C95 | 28083766 - 36219104 | 46 | 0x1eadf010811837102006cb9f0c3248ad98403d0577517130fd4d898284eb1dad |
| BNB | 0xB8Af889809211FB9496de885240593c1A9eFD3A9 | 17633701 - 23478204 | 64 | 0x8c5c12251678da3d5f497e8a59a8f4a351557fbee4abd35ebcb186a5ee78d26c |
| Network | Contract Address | Block Range | Transaction Index | Transaction Hash |
|---|---|---|---|---|
| Ethereum | 0x321617E18bE9EC7CFE5ab8856DE2aAbAA478E13B | 16076750 - 16790263 | 182 | 0xab0625746a64ed88fd040a39bdbe9ed930328d9b09245b36cd1d9a64444dad95 |
| Polygon | 0xa375b97b5701Bb85b963192072F1699B49c0e9F7 | 36219104 - 40143539 | 129 | 0x29d6d90f2efa6a05ea8342e6e9730a33f98f63fef1a15916829b763fac5f9216 |
| BNB | 0x2C4Fb0Bbb09945f8e5e2100d6cb4B69d994Fa293 | 23478204 - 26313947 | 106 | 0xba6271a84228b7e87078268c89150351cbcc1ff6fead26a66e67a25184122ac2 |
| Arbitrum | 0x5Eb61FD880eF65200Ef0bEB0d964fa6020FD5877 | 56109874 - 68196853 | 1 | 0xcd029a8262641a1871f79dc2e0593a0d921deccdffc4949aa249548ca8f2f02d |
| Network | Contract Address | Block Range | Transaction Index | Transaction Hash |
|---|---|---|---|---|
| Ethereum | 0xc0BEF2D373A1EfaDE8B952f33c1370E486f209Cc | 16790263 - 25753694 | 112 | 0xe001ac69697083957933db13ff27c56769ce8826d4ab676b3965d7a44b9f0668 |
| Polygon | 0x7A33eD42b44126FA285512e0d7D10FfBBcD0d559 | 40143539 - 74519326 | 73 | 0x27c85b2685f558ae745706dd8d3a72330cd2e532dcbd07ca839f5afa4fcc3e6c |
| BNB | 0x3352c7F34494201cd0F3621A8885B9f201582C24 | 26313947 - 55626526 | 123 | 0xf93d5313866a88e62cf4d8775691406b773c92b0f1ef4387897051a380e3b245 |
| Arbitrum | 0xeD378E351fAe20B849270B391aC4A973Df9E87bF | 68196853 - 362508491 | 1 | 0xca122fb81cc6802101ff1242703ba0a9d4175ed5e105741d84975a162e8fdd55 |
Adds the Action event. Every mainnet chain runs this implementation. The
implementation address differs per chain because each chain links its own
Poseidon library deployment, but the contract logic is the same.
| Network | Contract Address | Block Range |
|---|---|---|
| Ethereum | 0xD662C4B1F22AcEb0BEaCdf3A493De6f478686A0C | 25753684 - latest |
| Polygon | 0x4799527d8B767354FfC14E849cAE94A644A1F221 | 92007079 - latest |
| BNB | 0x4799527d8B767354FfC14E849cAE94A644A1F221 | 115899633 - latest |
| Arbitrum | 0x4799527d8B767354FfC14E849cAE94A644A1F221 | 494497453 - latest |
| Base | 0x8629b39134362fEdc001636E0726570B8d2DFfD1 | 50224713 - latest |
On Ethereum the first Action event emits at block 25753694, ten blocks
after the upgrade.
RailgunV2_2.json is a strict superset of RailgunV2_1.json: the Action
event is the only addition. Its canonical signature and topic0 are:
Action(address,(uint32,uint32,bool,bytes32)[])
0x29696e3cb1956aca85bbcae445e3ed9bb933a4b7328445f65e872e49af7229ea
The tuple is TXConfig, declared in contracts/logic/RailgunLogic.sol as
nullifiersCount, commitmentsCount, hasUnshield, boundParamsHash.
To confirm the ABI belongs to the deployed contracts, compile
contracts/logic/RailgunSmartWallet.sol from the contract repository and
compare deployedBytecode against eth_getCode for each implementation
address. Every mainnet implementation agrees with that build byte for byte
once the two Poseidon library placeholders are linked and the trailing solc
metadata is excluded. With the library slots masked, the chains are identical
to each other, which shows the differing addresses are library links and not
a logic difference.