@across-protocol/contracts 5.0.28 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/evm/artifacts/AcrossConfigStore.sol/AcrossConfigStore.json +1 -1
- package/dist/evm/artifacts/AcrossEventEmitter.sol/AcrossEventEmitter.json +1 -1
- package/dist/evm/artifacts/AcrossMerkleDistributor.sol/AcrossMerkleDistributor.json +1 -1
- package/dist/evm/artifacts/AcrossMessageHandlerMock.sol/AcrossMessageHandlerMock.json +1 -1
- package/dist/evm/artifacts/AdapterStore.sol/AdapterStore.json +1 -1
- package/dist/evm/artifacts/AdapterStore.sol/MessengerTypes.json +1 -1
- package/dist/evm/artifacts/Address.sol/Address.json +1 -1
- package/dist/evm/artifacts/AddressConverters.sol/Bytes32ToAddress.json +1 -1
- package/dist/evm/artifacts/AdminRelayTokensAdapter.sol/AdminRelayTokensAdapter.json +1 -1
- package/dist/evm/artifacts/AdminWithdrawManager.sol/AdminWithdrawManager.json +1 -1
- package/dist/evm/artifacts/ArbitrumMocks.sol/ArbitrumMockErc20GatewayRouter.json +1 -1
- package/dist/evm/artifacts/ArbitrumMocks.sol/Inbox.json +1 -1
- package/dist/evm/artifacts/ArbitrumMocks.sol/L2GatewayRouter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_Adapter.sol/Arbitrum_Adapter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_CustomGasToken_Adapter.sol/Arbitrum_CustomGasToken_Adapter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_Forwarder.sol/Arbitrum_Forwarder.json +1 -1
- package/dist/evm/artifacts/Arbitrum_RescueAdapter.sol/Arbitrum_RescueAdapter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_SendTokensAdapter.sol/Arbitrum_SendTokensAdapter.json +1 -1
- package/dist/evm/artifacts/Arbitrum_SpokePool.sol/Arbitrum_SpokePool.json +1 -1
- package/dist/evm/artifacts/Arbitrum_WithdrawalHelper.sol/Arbitrum_WithdrawalHelper.json +1 -1
- package/dist/evm/artifacts/Base_Adapter.sol/Base_Adapter.json +1 -1
- package/dist/evm/artifacts/BeaconProxy.sol/BeaconProxy.json +1 -1
- package/dist/evm/artifacts/BondToken.sol/BondToken.json +1 -1
- package/dist/evm/artifacts/BytesLib.sol/BytesLib.json +1 -1
- package/dist/evm/artifacts/Cher_SpokePool.sol/Cher_SpokePool.json +1 -1
- package/dist/evm/artifacts/CircleCCTPAdapter.sol/CircleDomainIds.json +1 -1
- package/dist/evm/artifacts/Constants.sol/Constants.json +1 -1
- package/dist/evm/artifacts/Constants.sol/OptimisticOracleConstraints.json +1 -1
- package/dist/evm/artifacts/Constants.sol/OracleInterfaces.json +1 -1
- package/dist/evm/artifacts/CoreExecution.sol/CoreExecution.json +1 -1
- package/dist/evm/artifacts/CoreSimulatorLib.sol/HypeSystemContract.json +1 -1
- package/dist/evm/artifacts/CoreState.sol/CoreState.json +1 -1
- package/dist/evm/artifacts/CoreView.sol/CoreView.json +1 -1
- package/dist/evm/artifacts/CoreWriterLib.sol/CoreWriterLib.json +1 -1
- package/dist/evm/artifacts/CoreWriterSim.sol/CoreWriterSim.json +1 -1
- package/dist/evm/artifacts/CounterfactualBeacon.sol/CounterfactualBeacon.json +1 -1
- package/dist/evm/artifacts/CounterfactualBeaconBootstrap.sol/CounterfactualBeaconBootstrap.json +1 -1
- package/dist/evm/artifacts/CounterfactualDeposit.sol/CounterfactualDeposit.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositCCTP.sol/CounterfactualDepositCCTP.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositFactory.sol/CounterfactualDepositFactory.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositFactoryTron.sol/CounterfactualDepositFactoryTron.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositOFT.sol/CounterfactualDepositOFT.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositSpokePool.sol/CounterfactualDepositSpokePool.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositSpokePoolTr.sol/CounterfactualDepositSpokePoolTr.json +1 -1
- package/dist/evm/artifacts/CounterfactualDepositVanillaCCTP.sol/CounterfactualDepositVanillaCCTP.json +1 -1
- package/dist/evm/artifacts/Create2.sol/Create2.json +1 -1
- package/dist/evm/artifacts/CrossDomainEnabled.sol/CrossDomainEnabled.json +1 -1
- package/dist/evm/artifacts/DeployedAddresses.sol/DeployedAddresses.json +1 -1
- package/dist/evm/artifacts/DeploymentUtils.sol/DeploymentUtils.json +1 -1
- package/dist/evm/artifacts/DoctorWho_Adapter.sol/DoctorWho_Adapter.json +1 -1
- package/dist/evm/artifacts/DonationBox.sol/DonationBox.json +1 -1
- package/dist/evm/artifacts/DstOFTHandler.sol/DstOFTHandler.json +1 -1
- package/dist/evm/artifacts/ECDSA.sol/ECDSA.json +1 -1
- package/dist/evm/artifacts/ERC1155.sol/ERC1155.json +1 -1
- package/dist/evm/artifacts/ERC1967Proxy.sol/ERC1967Proxy.json +1 -1
- package/dist/evm/artifacts/ERC1967Utils.sol/ERC1967Utils.json +1 -1
- package/dist/evm/artifacts/ERC20.sol/ERC20.json +1 -1
- package/dist/evm/artifacts/Errors.sol/Errors.json +1 -1
- package/dist/evm/artifacts/Ethereum_Adapter.sol/Ethereum_Adapter.json +1 -1
- package/dist/evm/artifacts/Ethereum_RescueAdapter.sol/Ethereum_RescueAdapter.json +1 -1
- package/dist/evm/artifacts/Ethereum_SpokePool.sol/Ethereum_SpokePool.json +1 -1
- package/dist/evm/artifacts/ExpandedERC20.sol/ExpandedERC20.json +1 -1
- package/dist/evm/artifacts/ExpandedERC20WithBlacklist.sol/ExpandedERC20WithBlacklist.json +1 -1
- package/dist/evm/artifacts/HLConstants.sol/HLConstants.json +1 -1
- package/dist/evm/artifacts/HLConversions.sol/HLConversions.json +1 -1
- package/dist/evm/artifacts/HubPool.sol/HubPool.json +1 -1
- package/dist/evm/artifacts/HubPoolStore.sol/HubPoolStore.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockAddressWhitelist.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockFinder.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockIdentifierWhitelist.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockLpTokenFactory.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockOptimisticOracle.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockStore.json +1 -1
- package/dist/evm/artifacts/HyperCore.sol/HyperCore.json +1 -1
- package/dist/evm/artifacts/HyperCoreFlowExecutor.sol/HyperCoreFlowExecutor.json +1 -1
- package/dist/evm/artifacts/HyperCoreLib.sol/HyperCoreLib.json +1 -1
- package/dist/evm/artifacts/HyperliquidDepositHandler.sol/HyperliquidDepositHandler.json +1 -1
- package/dist/evm/artifacts/Lens_SpokePool.sol/Lens_SpokePool.json +1 -1
- package/dist/evm/artifacts/LibVariable.sol/LibVariable.json +1 -1
- package/dist/evm/artifacts/LineaMocks.sol/MockL2MessageService.json +1 -1
- package/dist/evm/artifacts/LineaMocks.sol/MockL2TokenBridge.json +1 -1
- package/dist/evm/artifacts/Linea_Adapter.sol/Linea_Adapter.json +1 -1
- package/dist/evm/artifacts/Linea_SpokePool.sol/Linea_SpokePool.json +1 -1
- package/dist/evm/artifacts/Lisk_Adapter.sol/Lisk_Adapter.json +1 -1
- package/dist/evm/artifacts/Lisk_SpokePool.sol/Lisk_SpokePool.json +1 -1
- package/dist/evm/artifacts/Lockable.sol/Lockable.json +1 -1
- package/dist/evm/artifacts/LpTokenFactory.sol/LpTokenFactory.json +1 -1
- package/dist/evm/artifacts/Merkle.sol/Merkle.json +1 -1
- package/dist/evm/artifacts/MerkleDistributor.sol/MerkleDistributor.json +1 -1
- package/dist/evm/artifacts/MerkleLibTest.sol/MerkleLibTest.json +1 -1
- package/dist/evm/artifacts/MerkleProof.sol/MerkleProof.json +1 -1
- package/dist/evm/artifacts/MinimalLZOptions.sol/MinimalLZOptions.json +1 -1
- package/dist/evm/artifacts/MintableERC1155.sol/MintableERC1155.json +1 -1
- package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockCrossDomainMessenger.json +1 -1
- package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockL1StandardBridge.json +1 -1
- package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockL2StandardBridge.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessageTransmitter.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessageTransmitterV2.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessenger.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessengerV2.json +1 -1
- package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMinter.json +1 -1
- package/dist/evm/artifacts/MockCaller.sol/MockCaller.json +1 -1
- package/dist/evm/artifacts/MockERC1271.sol/MockERC1271.json +1 -1
- package/dist/evm/artifacts/MockERC20.sol/MintableERC20.json +1 -1
- package/dist/evm/artifacts/MockERC20.sol/MockERC20.json +1 -1
- package/dist/evm/artifacts/MockEndpoint.sol/MockEndpoint.json +1 -1
- package/dist/evm/artifacts/MockGateway.sol/MockGateway.json +1 -1
- package/dist/evm/artifacts/MockHubPool.sol/MockHubPool.json +1 -1
- package/dist/evm/artifacts/MockOFTMessenger.sol/MockOFTMessenger.json +1 -1
- package/dist/evm/artifacts/MockPermit2.sol/MockPermit2.json +1 -1
- package/dist/evm/artifacts/MockPermit2.sol/Permit2EIP712.json +1 -1
- package/dist/evm/artifacts/MockPermit2.sol/SignatureVerification.json +1 -1
- package/dist/evm/artifacts/MockSpokePool.sol/MockSpokePool.json +1 -1
- package/dist/evm/artifacts/MockSpokePoolV2.sol/MockSpokePoolV2.json +1 -1
- package/dist/evm/artifacts/MockTronUSDT.sol/MockTronUSDT.json +1 -1
- package/dist/evm/artifacts/MockZkStackBridgeHub.sol/MockBridgeHub.json +1 -1
- package/dist/evm/artifacts/Mock_Adapter.sol/Mock_Adapter.json +1 -1
- package/dist/evm/artifacts/Mock_Adapter.sol/Mock_Bridge.json +1 -1
- package/dist/evm/artifacts/Mode_Adapter.sol/Mode_Adapter.json +1 -1
- package/dist/evm/artifacts/MultiCaller.sol/MultiCaller.json +1 -1
- package/dist/evm/artifacts/MultiCallerUpgradeable.sol/MultiCallerUpgradeable.json +1 -1
- package/dist/evm/artifacts/Multicall3.sol/Multicall3.json +1 -1
- package/dist/evm/artifacts/MulticallHandler.sol/MulticallHandler.json +1 -1
- package/dist/evm/artifacts/OFTTransportAdapter.sol/OFTTransportAdapter.json +1 -1
- package/dist/evm/artifacts/OFTTransportAdapterWithStore.sol/OFTTransportAdapterWithStore.json +1 -1
- package/dist/evm/artifacts/OP_Adapter.sol/OP_Adapter.json +1 -1
- package/dist/evm/artifacts/OP_SpokePool.sol/OP_SpokePool.json +1 -1
- package/dist/evm/artifacts/Ovm_Forwarder.sol/Ovm_Forwarder.json +1 -1
- package/dist/evm/artifacts/Ovm_SpokePool.sol/Ovm_SpokePool.json +1 -1
- package/dist/evm/artifacts/Ovm_WithdrawalHelper.sol/Ovm_WithdrawalHelper.json +1 -1
- package/dist/evm/artifacts/PeripherySigningLib.sol/PeripherySigningLib.json +1 -1
- package/dist/evm/artifacts/PermissionedMulticallHandler.sol/PermissionedMulticallHandler.json +1 -1
- package/dist/evm/artifacts/PolygonERC20Test.sol/PolygonERC20Test.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/DepositManagerMock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/FxStateSenderMock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/PolygonERC20Mock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/PolygonERC20PredicateMock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/PolygonRegistryMock.json +1 -1
- package/dist/evm/artifacts/PolygonMocks.sol/RootChainManagerMock.json +1 -1
- package/dist/evm/artifacts/PolygonTokenBridger.sol/PolygonTokenBridger.json +1 -1
- package/dist/evm/artifacts/Polygon_Adapter.sol/Polygon_Adapter.json +1 -1
- package/dist/evm/artifacts/Polygon_SpokePool.sol/Polygon_SpokePool.json +1 -1
- package/dist/evm/artifacts/PrecompileLib.sol/PrecompileLib.json +1 -1
- package/dist/evm/artifacts/PrecompileSim.sol/PrecompileSim.json +1 -1
- package/dist/evm/artifacts/ProxyAdmin.sol/ProxyAdmin.json +1 -1
- package/dist/evm/artifacts/Router_Adapter.sol/Router_Adapter.json +1 -1
- package/dist/evm/artifacts/SP1AutoVerifier.sol/SP1AutoVerifier.json +1 -1
- package/dist/evm/artifacts/SP1Helios.sol/SP1Helios.json +1 -1
- package/dist/evm/artifacts/SP1MockVerifier.sol/SP1MockVerifier.json +1 -1
- package/dist/evm/artifacts/SafeCast.sol/SafeCast.json +1 -1
- package/dist/evm/artifacts/SafeERC20.sol/SafeERC20.json +1 -1
- package/dist/evm/artifacts/ShortStrings.sol/ShortStrings.json +1 -1
- package/dist/evm/artifacts/Solana_Adapter.sol/Solana_Adapter.json +1 -1
- package/dist/evm/artifacts/SpokePoolPeriphery.sol/SpokePoolPeriphery.json +1 -1
- package/dist/evm/artifacts/SpokePoolPeriphery.sol/SwapProxy.json +1 -1
- package/dist/evm/artifacts/SpokePoolVerifier.sol/SpokePoolVerifier.json +1 -1
- package/dist/evm/artifacts/SponsoredCCTPDstPeriphery.sol/SponsoredCCTPDstPeriphery.json +1 -1
- package/dist/evm/artifacts/SponsoredCCTPSrcPeriphery.sol/SponsoredCCTPSrcPeriphery.json +1 -1
- package/dist/evm/artifacts/SponsoredOFTSrcPeriphery.sol/SponsoredOFTSrcPeriphery.json +1 -1
- package/dist/evm/artifacts/StdConfig.sol/StdConfig.json +1 -1
- package/dist/evm/artifacts/Strings.sol/Strings.json +1 -1
- package/dist/evm/artifacts/SwapHandler.sol/SwapHandler.json +1 -1
- package/dist/evm/artifacts/Timer.sol/Timer.json +1 -1
- package/dist/evm/artifacts/TransferProxy.sol/TransferProxy.json +1 -1
- package/dist/evm/artifacts/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +1 -1
- package/dist/evm/artifacts/TronMulticallHandler.sol/TronMulticallHandler.json +1 -1
- package/dist/evm/artifacts/TronTransferLib.sol/TronTransferLib.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePool.sol/Tron_SpokePool.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SpokePoolPeriphery.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SwapProxy.json +1 -1
- package/dist/evm/artifacts/Universal_Adapter.sol/Universal_Adapter.json +1 -1
- package/dist/evm/artifacts/Universal_SpokePool.sol/Universal_SpokePool.json +1 -1
- package/dist/evm/artifacts/UpgradeableBeacon.sol/UpgradeableBeacon.json +1 -1
- package/dist/evm/artifacts/WETH9.sol/WETH9.json +1 -1
- package/dist/evm/artifacts/WithdrawImplementation.sol/WithdrawImplementation.json +1 -1
- package/dist/evm/artifacts/WithdrawImplementationTron.sol/WithdrawImplementationTron.json +1 -1
- package/dist/evm/artifacts/ZkStack_Adapter.sol/ZkStack_Adapter.json +1 -1
- package/dist/evm/artifacts/ZkStack_CustomGasToken_Adapter.sol/ZkStack_CustomGasToken_Adapter.json +1 -1
- package/dist/evm/artifacts/ZkSyncMocks.sol/MockL2Eth.json +1 -1
- package/dist/evm/artifacts/ZkSyncMocks.sol/MockZkBridge.json +1 -1
- package/dist/evm/artifacts/ZkSync_SpokePool.sol/ZkSync_SpokePool.json +1 -1
- package/dist/evm/artifacts/Zora_Adapter.sol/Zora_Adapter.json +1 -1
- package/dist/evm/artifacts/eraVM_EIP7702.sol/SimpleContract.json +1 -1
- package/dist/evm/artifacts/eraVM_EIP7702.sol/SpokePoolEIP7702Test.json +1 -1
- package/dist/evm/artifacts/eraVM_EIP7702.sol/TestableMockSpokePool.json +1 -1
- package/dist/src/DeploymentUtils.d.ts +1 -1
- package/dist/src/svm/assets/idl/sponsored_cctp_src_periphery.json +6 -46
- package/dist/src/svm/assets/sponsored_cctp_src_periphery.d.ts +6 -46
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/errors/sponsoredCctpSrcPeriphery.d.ts +7 -23
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/errors/sponsoredCctpSrcPeriphery.js +10 -34
- package/dist/src/svm/web3-v1/cctpHelpers.d.ts +1 -1
- package/dist/src/svm/web3-v1/cctpHelpers.js +2 -0
- package/dist/src/svm/web3-v1/cctpV2Helpers.d.ts +6 -6
- package/dist/src/svm/web3-v1/cctpV2Helpers.js +4 -6
- package/dist/src/svm/web3-v1/constants.d.ts +1 -1
- package/dist/src/svm/web3-v1/constants.js +2 -5
- package/dist/src/svm/web3-v1/conversionUtils.d.ts +7 -4
- package/dist/src/svm/web3-v1/conversionUtils.js +37 -16
- package/dist/src/svm/web3-v1/helpers.d.ts +1 -2
- package/dist/src/svm/web3-v1/helpers.js +4 -6
- package/dist/src/svm/web3-v1/relayHashUtils.d.ts +5 -4
- package/dist/src/svm/web3-v1/relayHashUtils.js +38 -25
- package/dist/src/svm/web3-v1/solanaProgramUtils.js +2 -3
- package/dist/src/svm/web3-v1/transactionUtils.js +2 -2
- package/dist/src/svm/web3-v2/solanaProgramUtils.js +3 -3
- package/dist/src/types/svm.d.ts +6 -7
- package/dist/utils/MerkleTree.js +3 -4
- package/package.json +46 -37
- package/dist/src/consts.d.ts +0 -51
- package/dist/src/consts.js +0 -342
- package/dist/utils/utils.d.ts +0 -28
- package/dist/utils/utils.js +0 -136
|
@@ -7,8 +7,11 @@ exports.hashNonEmptyMessage = hashNonEmptyMessage;
|
|
|
7
7
|
exports.calculateRelayerRefundLeafHashUint8Array = calculateRelayerRefundLeafHashUint8Array;
|
|
8
8
|
exports.slowFillHashFn = slowFillHashFn;
|
|
9
9
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
10
|
-
const
|
|
10
|
+
const sha3_js_1 = require("@noble/hashes/sha3.js");
|
|
11
|
+
const utils_js_1 = require("@noble/hashes/utils.js");
|
|
11
12
|
const borsh_1 = require("borsh");
|
|
13
|
+
const conversionUtils_1 = require("./conversionUtils");
|
|
14
|
+
const keccak256 = (data) => "0x" + (0, utils_js_1.bytesToHex)((0, sha3_js_1.keccak_256)(data));
|
|
12
15
|
/**
|
|
13
16
|
* Calculates the relay hash from relay data and chain ID.
|
|
14
17
|
*/
|
|
@@ -28,7 +31,7 @@ function calculateRelayHashUint8Array(relayData, chainId) {
|
|
|
28
31
|
hashNonEmptyMessage(relayData.message), // Replace with hash of message, so that relay hash can be recovered from event.
|
|
29
32
|
chainId.toArrayLike(Buffer, "le", 8),
|
|
30
33
|
]);
|
|
31
|
-
const relayHash =
|
|
34
|
+
const relayHash = keccak256(contentToHash);
|
|
32
35
|
const relayHashBuffer = Buffer.from(relayHash.slice(2), "hex");
|
|
33
36
|
return new Uint8Array(relayHashBuffer);
|
|
34
37
|
}
|
|
@@ -51,7 +54,7 @@ function calculateRelayEventHashUint8Array(relayEventData, chainId) {
|
|
|
51
54
|
Buffer.from(relayEventData.messageHash), // Renamed to messageHash in the event data.
|
|
52
55
|
chainId.toArrayLike(Buffer, "le", 8),
|
|
53
56
|
]);
|
|
54
|
-
const relayHash =
|
|
57
|
+
const relayHash = keccak256(contentToHash);
|
|
55
58
|
const relayHashBuffer = Buffer.from(relayHash.slice(2), "hex");
|
|
56
59
|
return new Uint8Array(relayHashBuffer);
|
|
57
60
|
}
|
|
@@ -71,7 +74,7 @@ exports.readUInt256BE = readUInt256BE;
|
|
|
71
74
|
*/
|
|
72
75
|
function hashNonEmptyMessage(message) {
|
|
73
76
|
if (message.length > 0) {
|
|
74
|
-
const hash =
|
|
77
|
+
const hash = keccak256(message);
|
|
75
78
|
return Uint8Array.from(Buffer.from(hash.slice(2), "hex"));
|
|
76
79
|
}
|
|
77
80
|
// else return zeroed bytes32
|
|
@@ -120,31 +123,41 @@ function calculateRelayerRefundLeafHashUint8Array(relayData) {
|
|
|
120
123
|
const serializedData = (0, borsh_1.serialize)(relayDataSchema, data);
|
|
121
124
|
// SVM leaves require the first 64 bytes to be 0 to ensure EVM leaves can never be played on SVM and vice versa.
|
|
122
125
|
const contentToHash = Buffer.concat([Buffer.alloc(64, 0), serializedData]);
|
|
123
|
-
return
|
|
126
|
+
return keccak256(contentToHash);
|
|
124
127
|
}
|
|
128
|
+
const uint256Word = (value) => {
|
|
129
|
+
if (typeof value !== "bigint" || value < 0n || value >= 2n ** 256n)
|
|
130
|
+
throw new Error(`Invalid uint256: ${value}`);
|
|
131
|
+
return value.toString(16).padStart(64, "0");
|
|
132
|
+
};
|
|
133
|
+
const addressWord = (address) => {
|
|
134
|
+
if (!(0, conversionUtils_1.isEvmAddress)(address))
|
|
135
|
+
throw new Error(`Invalid EVM address: ${address}`);
|
|
136
|
+
return address.slice(2).toLowerCase().padStart(64, "0");
|
|
137
|
+
};
|
|
125
138
|
/**
|
|
126
|
-
* Hash function for relayer refund leaves.
|
|
139
|
+
* Hash function for relayer refund leaves. EVM leaves are ABI-encoded as a single
|
|
140
|
+
* tuple(uint256 amountToReturn, uint256 chainId, uint256[] refundAmounts, uint256 leafId, address l2TokenAddress, address[] refundAddresses).
|
|
127
141
|
*/
|
|
128
142
|
const relayerRefundHashFn = (input) => {
|
|
129
|
-
if (
|
|
130
|
-
const abiCoder = new ethers_1.ethers.utils.AbiCoder();
|
|
131
|
-
const encodedData = abiCoder.encode([
|
|
132
|
-
"tuple( uint256 amountToReturn, uint256 chainId, uint256[] refundAmounts, uint256 leafId, address l2TokenAddress, address[] refundAddresses)",
|
|
133
|
-
], [
|
|
134
|
-
{
|
|
135
|
-
leafId: input.leafId,
|
|
136
|
-
chainId: input.chainId,
|
|
137
|
-
amountToReturn: input.amountToReturn,
|
|
138
|
-
l2TokenAddress: input.l2TokenAddress, // Type assertion
|
|
139
|
-
refundAddresses: input.refundAddresses, // Type assertion
|
|
140
|
-
refundAmounts: input.refundAmounts, // Type assertion
|
|
141
|
-
},
|
|
142
|
-
]);
|
|
143
|
-
return ethers_1.ethers.utils.keccak256(encodedData);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
143
|
+
if (input.isSolana)
|
|
146
144
|
return calculateRelayerRefundLeafHashUint8Array(input);
|
|
147
|
-
}
|
|
145
|
+
const { amountToReturn, chainId, refundAmounts, leafId, l2TokenAddress, refundAddresses } = input;
|
|
146
|
+
const headSize = 6n * 32n;
|
|
147
|
+
const encodedData = [
|
|
148
|
+
uint256Word(32n), // Offset to the tuple, which is dynamic.
|
|
149
|
+
uint256Word(amountToReturn),
|
|
150
|
+
uint256Word(chainId),
|
|
151
|
+
uint256Word(headSize), // Offset to refundAmounts, relative to the tuple.
|
|
152
|
+
uint256Word(leafId),
|
|
153
|
+
addressWord(l2TokenAddress),
|
|
154
|
+
uint256Word(headSize + 32n * BigInt(refundAmounts.length + 1)), // Offset to refundAddresses.
|
|
155
|
+
uint256Word(BigInt(refundAmounts.length)),
|
|
156
|
+
...refundAmounts.map(uint256Word),
|
|
157
|
+
uint256Word(BigInt(refundAddresses.length)),
|
|
158
|
+
...refundAddresses.map(addressWord),
|
|
159
|
+
].join("");
|
|
160
|
+
return keccak256(Buffer.from(encodedData, "hex"));
|
|
148
161
|
};
|
|
149
162
|
exports.relayerRefundHashFn = relayerRefundHashFn;
|
|
150
163
|
/**
|
|
@@ -205,5 +218,5 @@ function slowFillHashFn(slowFillLeaf) {
|
|
|
205
218
|
const serializedData = (0, borsh_1.serialize)(slowFillDataSchema, data);
|
|
206
219
|
// SVM leaves require the first 64 bytes to be 0 to ensure EVM leaves cannot be played on SVM and vice versa
|
|
207
220
|
const contentToHash = Buffer.concat([Buffer.alloc(64, 0), serializedData]);
|
|
208
|
-
return
|
|
221
|
+
return keccak256(contentToHash);
|
|
209
222
|
}
|
|
@@ -86,10 +86,9 @@ function processEventFromTx(txResult, programs) {
|
|
|
86
86
|
*/
|
|
87
87
|
async function readEventsUntilFound(connection, txSignature, programs) {
|
|
88
88
|
const startTime = Date.now();
|
|
89
|
-
let txResult = null;
|
|
90
89
|
while (Date.now() - startTime < 5000) {
|
|
91
90
|
// 5 seconds timeout to wait to find the event.
|
|
92
|
-
txResult = await connection.getTransaction(txSignature, {
|
|
91
|
+
const txResult = await connection.getTransaction(txSignature, {
|
|
93
92
|
commitment: "confirmed",
|
|
94
93
|
maxSupportedTransactionVersion: 0,
|
|
95
94
|
});
|
|
@@ -193,7 +192,7 @@ function stringifyCpiEvent(obj, eventName) {
|
|
|
193
192
|
else if (typeof obj === "bigint") {
|
|
194
193
|
return obj.toString();
|
|
195
194
|
}
|
|
196
|
-
else if (Array.isArray(obj) && obj.length
|
|
195
|
+
else if (Array.isArray(obj) && obj.length === 32) {
|
|
197
196
|
return Buffer.from(obj).toString("hex"); // Hex representation for fixed-length arrays
|
|
198
197
|
}
|
|
199
198
|
else if (Array.isArray(obj)) {
|
|
@@ -58,7 +58,7 @@ async function sendTransactionWithLookupTable(connection, instructions, sender,
|
|
|
58
58
|
versionedTx.sign([sender, ...additionalSigners]);
|
|
59
59
|
const txSignature = await connection.sendTransaction(versionedTx);
|
|
60
60
|
// Confirm the versioned transaction
|
|
61
|
-
|
|
61
|
+
const block = await connection.getLatestBlockhash();
|
|
62
62
|
await connection.confirmTransaction({ signature: txSignature, blockhash: block.blockhash, lastValidBlockHeight: block.lastValidBlockHeight }, "confirmed");
|
|
63
63
|
return { txSignature, lookupTableAddress };
|
|
64
64
|
}
|
|
@@ -76,7 +76,7 @@ async function sendTransactionWithExistingLookupTable(connection, instructions,
|
|
|
76
76
|
versionedTx.sign([sender, ...additionalSigners]);
|
|
77
77
|
const txSignature = await connection.sendTransaction(versionedTx);
|
|
78
78
|
// Confirm the versioned transaction
|
|
79
|
-
|
|
79
|
+
const block = await connection.getLatestBlockhash();
|
|
80
80
|
await connection.confirmTransaction({ signature: txSignature, blockhash: block.blockhash, lastValidBlockHeight: block.lastValidBlockHeight }, "confirmed");
|
|
81
81
|
return txSignature;
|
|
82
82
|
}
|
|
@@ -77,11 +77,11 @@ async function processEventFromTx(txResult, programId, programIdl) {
|
|
|
77
77
|
const singleIxAccount = ix.accounts.length === 1 ? messageAccountKeys[ix.accounts[0]] : undefined;
|
|
78
78
|
if (ixProgramId !== undefined &&
|
|
79
79
|
singleIxAccount !== undefined &&
|
|
80
|
-
programId
|
|
81
|
-
eventAuthorities.get(ixProgramId.toString())
|
|
80
|
+
programId === ixProgramId &&
|
|
81
|
+
eventAuthorities.get(ixProgramId.toString()) === singleIxAccount) {
|
|
82
82
|
const ixData = anchor_1.utils.bytes.bs58.decode(ix.data);
|
|
83
83
|
const eventData = anchor_1.utils.bytes.base64.encode(Buffer.from(new Uint8Array(ixData).slice(8)));
|
|
84
|
-
|
|
84
|
+
const event = new anchor_1.BorshEventCoder(programIdl).decode(eventData);
|
|
85
85
|
events.push({
|
|
86
86
|
program: programId,
|
|
87
87
|
data: event?.data,
|
package/dist/src/types/svm.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { BN } from "@coral-xyz/anchor";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
|
-
import { BigNumber } from "ethers";
|
|
4
3
|
/**
|
|
5
4
|
* Relayer Refund Interfaces
|
|
6
5
|
*/
|
|
7
6
|
export interface RelayerRefundLeaf {
|
|
8
|
-
isSolana:
|
|
9
|
-
amountToReturn:
|
|
10
|
-
chainId:
|
|
11
|
-
refundAmounts:
|
|
12
|
-
leafId:
|
|
7
|
+
isSolana: false;
|
|
8
|
+
amountToReturn: bigint;
|
|
9
|
+
chainId: bigint;
|
|
10
|
+
refundAmounts: bigint[];
|
|
11
|
+
leafId: bigint;
|
|
13
12
|
l2TokenAddress: string;
|
|
14
13
|
refundAddresses: string[];
|
|
15
14
|
}
|
|
16
15
|
export interface RelayerRefundLeafSolana {
|
|
17
|
-
isSolana:
|
|
16
|
+
isSolana: true;
|
|
18
17
|
amountToReturn: BN;
|
|
19
18
|
chainId: BN;
|
|
20
19
|
refundAmounts: BN[];
|
package/dist/utils/MerkleTree.js
CHANGED
|
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MerkleTree = exports.EMPTY_MERKLE_ROOT = void 0;
|
|
4
4
|
// Inlined from @uma/common MerkleTree. Based on the Uniswap merkle-distributor implementation:
|
|
5
5
|
// https://github.com/Uniswap/merkle-distributor/blob/master/src/merkle-tree.ts
|
|
6
|
-
const
|
|
7
|
-
const keccak256_1 = require("@ethersproject/keccak256");
|
|
6
|
+
const sha3_js_1 = require("@noble/hashes/sha3.js");
|
|
8
7
|
exports.EMPTY_MERKLE_ROOT = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
9
|
-
const bufferToHex = (buf) =>
|
|
10
|
-
const keccak256 = (buf) => Buffer.from((0,
|
|
8
|
+
const bufferToHex = (buf) => "0x" + buf.toString("hex");
|
|
9
|
+
const keccak256 = (buf) => Buffer.from((0, sha3_js_1.keccak_256)(buf));
|
|
11
10
|
class MerkleTree {
|
|
12
11
|
constructor(leaves, hashFn) {
|
|
13
12
|
this.hashFn = hashFn;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/contracts",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"author": "UMA Team",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/across-protocol/
|
|
8
|
+
"url": "git+https://github.com/across-protocol/contracts.git"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=22.18.0"
|
|
@@ -25,12 +25,11 @@
|
|
|
25
25
|
"forge-verify-zksync": "FOUNDRY_PROFILE=zksync forge verify-contract --zksync",
|
|
26
26
|
"lint": "yarn lint-solidity && yarn lint-js && yarn lint-rust",
|
|
27
27
|
"lint-solidity": "yarn solhint ./contracts/**/*.sol",
|
|
28
|
-
"lint-js": "yarn prettier --list-different **/*.js
|
|
28
|
+
"lint-js": "yarn eslint . && yarn prettier --list-different \"**/*.{js,ts}\"",
|
|
29
29
|
"lint-rust": "cargo +nightly fmt --all -- --check && cargo clippy",
|
|
30
30
|
"format-contracts": "prettier --write \"contracts/**/*.sol\" \"script/**/*.sol\"",
|
|
31
31
|
"check-format-contracts": "prettier --check \"contracts/**/*.sol\" \"script/**/*.sol\"",
|
|
32
|
-
"lint-fix": "yarn prettier --write **/*.js
|
|
33
|
-
"clean-fast": "for dir in node_modules dist cache-foundry out zkout; do mv \"${dir}\" \"_${dir}\"; rm -rf \"_${dir}\" &; done",
|
|
32
|
+
"lint-fix": "yarn eslint --fix . && yarn prettier --write \"**/*.{js,ts}\" ./programs/**/*.rs \"./contracts/**/*.sol\" && cargo +nightly fmt --all && cargo clippy",
|
|
34
33
|
"clean": "rm -rf node_modules dist cache-foundry out zkout",
|
|
35
34
|
"generate-svm-artifacts": "bash ./scripts/svm/buildHelpers/buildIdl.sh && sh ./scripts/svm/buildHelpers/generateSvmAssets.sh && yarn generate-svm-clients",
|
|
36
35
|
"generate-svm-clients": "yarn ts-node ./scripts/svm/buildHelpers/generateSvmClients.ts && yarn ts-node ./scripts/svm/buildHelpers/renameClientsImports.ts",
|
|
@@ -78,23 +77,24 @@
|
|
|
78
77
|
"dependencies": {
|
|
79
78
|
"@across-protocol/constants": "^3.1.124",
|
|
80
79
|
"@coral-xyz/anchor": "^0.31.1",
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@ethersproject/bytes": "5.8.0",
|
|
84
|
-
"@ethersproject/keccak256": "5.8.0",
|
|
85
|
-
"@openzeppelin/contracts": "5.5.0",
|
|
86
|
-
"@openzeppelin/contracts-upgradeable": "5.5.0",
|
|
87
|
-
"@openzeppelin/contracts-upgradeable-v4": "npm:@openzeppelin/contracts-upgradeable@4.9.6",
|
|
88
|
-
"@openzeppelin/contracts-v4": "npm:@openzeppelin/contracts@4.9.6",
|
|
80
|
+
"@coral-xyz/borsh": "^0.31.1",
|
|
81
|
+
"@noble/hashes": "^1.8.0",
|
|
89
82
|
"@solana-program/address-lookup-table": "0.10.0",
|
|
90
83
|
"@solana/kit": "^5.4.0",
|
|
91
|
-
"@solana/web3.js": "1.98.2",
|
|
84
|
+
"@solana/web3.js": "^1.98.2",
|
|
85
|
+
"borsh": "^0.7.0",
|
|
92
86
|
"bs58": "^6.0.0",
|
|
93
|
-
"
|
|
87
|
+
"superstruct": "^2.0.2"
|
|
94
88
|
},
|
|
95
89
|
"devDependencies": {
|
|
96
90
|
"@codama/nodes-from-anchor": "1.2.2",
|
|
97
91
|
"@codama/renderers-js": "1.3.0",
|
|
92
|
+
"@eslint/js": "^10.0.1",
|
|
93
|
+
"@eth-optimism/contracts": "^0.5.40",
|
|
94
|
+
"@openzeppelin/contracts": "5.5.0",
|
|
95
|
+
"@openzeppelin/contracts-upgradeable": "5.5.0",
|
|
96
|
+
"@openzeppelin/contracts-upgradeable-v4": "npm:@openzeppelin/contracts-upgradeable@4.9.6",
|
|
97
|
+
"@openzeppelin/contracts-v4": "npm:@openzeppelin/contracts@4.9.6",
|
|
98
98
|
"@openzeppelin/foundry-upgrades": "^0.4.0",
|
|
99
99
|
"@safe-global/protocol-kit": "7.0.0",
|
|
100
100
|
"@solana-program/token": "0.9.0",
|
|
@@ -104,18 +104,15 @@
|
|
|
104
104
|
"@types/mocha": "^9.1.1",
|
|
105
105
|
"@types/node": "^24.3.0",
|
|
106
106
|
"@types/yargs": "^17.0.33",
|
|
107
|
-
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
|
108
|
-
"@typescript-eslint/parser": "^4.29.1",
|
|
109
107
|
"chai": "^4.3.6",
|
|
110
108
|
"codama": "^1.3.0",
|
|
111
109
|
"dotenv": "^10.0.0",
|
|
112
|
-
"eslint": "^
|
|
113
|
-
"eslint-config-prettier": "^
|
|
114
|
-
"eslint-
|
|
115
|
-
"eslint-plugin-
|
|
116
|
-
"eslint-plugin-
|
|
117
|
-
"
|
|
118
|
-
"eslint-plugin-promise": "^5.1.0",
|
|
110
|
+
"eslint": "^10.14.0",
|
|
111
|
+
"eslint-config-prettier": "^10.1.8",
|
|
112
|
+
"eslint-plugin-chai-expect": "^4.1.1",
|
|
113
|
+
"eslint-plugin-mocha": "^11.3.0",
|
|
114
|
+
"eslint-plugin-n": "^17.24.0",
|
|
115
|
+
"ethers": "5.8.0",
|
|
119
116
|
"husky": "^4.2.3",
|
|
120
117
|
"mocha": "^10.0.0",
|
|
121
118
|
"prettier": "^3.8.1",
|
|
@@ -123,14 +120,37 @@
|
|
|
123
120
|
"prettier-plugin-solidity": "^2.2.1",
|
|
124
121
|
"pretty-quick": "^4.2.2",
|
|
125
122
|
"solhint": "^3.6.2",
|
|
126
|
-
"
|
|
123
|
+
"toml": "^3.0.0",
|
|
127
124
|
"tronweb": "^6.2.0",
|
|
125
|
+
"ts-mocha": "^10.0.0",
|
|
128
126
|
"ts-node": "^10.1.0",
|
|
129
127
|
"typescript": "^5.6.2",
|
|
128
|
+
"typescript-eslint": "^8.72.1",
|
|
130
129
|
"yargs": "^17.7.2"
|
|
131
130
|
},
|
|
132
131
|
"peerDependencies": {
|
|
133
|
-
"
|
|
132
|
+
"@eth-optimism/contracts": "^0.5.40",
|
|
133
|
+
"@openzeppelin/contracts": "^5.5.0",
|
|
134
|
+
"@openzeppelin/contracts-upgradeable": "^5.5.0",
|
|
135
|
+
"@openzeppelin/contracts-upgradeable-v4": "npm:@openzeppelin/contracts-upgradeable@^4.9.6",
|
|
136
|
+
"@openzeppelin/contracts-v4": "npm:@openzeppelin/contracts@^4.9.6"
|
|
137
|
+
},
|
|
138
|
+
"peerDependenciesMeta": {
|
|
139
|
+
"@eth-optimism/contracts": {
|
|
140
|
+
"optional": true
|
|
141
|
+
},
|
|
142
|
+
"@openzeppelin/contracts": {
|
|
143
|
+
"optional": true
|
|
144
|
+
},
|
|
145
|
+
"@openzeppelin/contracts-upgradeable": {
|
|
146
|
+
"optional": true
|
|
147
|
+
},
|
|
148
|
+
"@openzeppelin/contracts-upgradeable-v4": {
|
|
149
|
+
"optional": true
|
|
150
|
+
},
|
|
151
|
+
"@openzeppelin/contracts-v4": {
|
|
152
|
+
"optional": true
|
|
153
|
+
}
|
|
134
154
|
},
|
|
135
155
|
"husky": {
|
|
136
156
|
"hooks": {
|
|
@@ -141,16 +161,5 @@
|
|
|
141
161
|
"registry": "https://registry.npmjs.org/",
|
|
142
162
|
"access": "public",
|
|
143
163
|
"provenance": false
|
|
144
|
-
},
|
|
145
|
-
"overrides": {
|
|
146
|
-
"secp256k1@3.7.1": "3.8.1",
|
|
147
|
-
"secp256k1@4.0.3": "4.0.4",
|
|
148
|
-
"secp256k1@5.0.0": "5.0.1"
|
|
149
|
-
},
|
|
150
|
-
"resolutions": {
|
|
151
|
-
"**/eccrypto/secp256k1": "3.8.1",
|
|
152
|
-
"**/eth-crypto/secp256k1": "5.0.1",
|
|
153
|
-
"**/create-hash/sha.js": "2.4.12",
|
|
154
|
-
"sha.js": "2.4.12"
|
|
155
164
|
}
|
|
156
165
|
}
|
package/dist/src/consts.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2
|
-
export declare const USDC: {
|
|
3
|
-
133268194659241: string;
|
|
4
|
-
};
|
|
5
|
-
export declare const USDCe: {};
|
|
6
|
-
export declare const USDT: {};
|
|
7
|
-
export declare const WBTC: {};
|
|
8
|
-
export declare const WETH: {};
|
|
9
|
-
export declare const WMATIC: {};
|
|
10
|
-
export declare const WGRASS: {};
|
|
11
|
-
export declare const WGHO: {};
|
|
12
|
-
export declare const QUOTE_TIME_BUFFER = 3600;
|
|
13
|
-
export declare const FILL_DEADLINE_BUFFER: number;
|
|
14
|
-
export declare const ARBITRUM_MAX_SUBMISSION_COST = "10000000000000000";
|
|
15
|
-
export declare const CIRCLE_UNINITIALIZED_DOMAIN_ID = 4294967295;
|
|
16
|
-
export declare const ZK_L1_GAS_TO_L2_GAS_PER_PUBDATA_LIMIT = 800;
|
|
17
|
-
export declare const ZK_L2_GAS_LIMIT = 2000000;
|
|
18
|
-
export declare const ZK_MAX_GASPRICE = "10000000000000";
|
|
19
|
-
export declare const L1_ADDRESS_MAP: {
|
|
20
|
-
[key: number]: {
|
|
21
|
-
[contractName: string]: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare const OP_STACK_ADDRESS_MAP: {
|
|
25
|
-
[hubChainId: number]: {
|
|
26
|
-
[spokeChainId: number]: {
|
|
27
|
-
[contract: string]: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export declare const L2_ADDRESS_MAP: {
|
|
32
|
-
[key: number]: {
|
|
33
|
-
[contractName: string]: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export declare const POLYGON_CHAIN_IDS: {
|
|
37
|
-
[l1ChainId: number]: number;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* An official mapping of chain IDs to CCTP domains. This mapping is separate from chain identifiers
|
|
41
|
-
* and is an internal mappinng maintained by Circle.
|
|
42
|
-
* @link https://developers.circle.com/stablecoins/docs/supported-domains
|
|
43
|
-
*/
|
|
44
|
-
export declare const CIRCLE_DOMAIN_IDs: {
|
|
45
|
-
[k: string]: number;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Mapping chainId => oft endpoint id
|
|
49
|
-
* @link https://docs.layerzero.network/v2/deployments/deployed-contracts
|
|
50
|
-
*/
|
|
51
|
-
export declare const OFT_EIDs: Map<number, number>;
|