diff --git a/.changeset/remove-ibc-oracle-precompiles.md b/.changeset/remove-ibc-oracle-precompiles.md new file mode 100644 index 000000000..2da185e11 --- /dev/null +++ b/.changeset/remove-ibc-oracle-precompiles.md @@ -0,0 +1,7 @@ +--- +'@sei-js/precompiles': major +--- + +**Breaking:** remove the IBC and Oracle precompiles. `IBC_PRECOMPILE_ADDRESS`, `IBC_PRECOMPILE_ABI`, `ETHERS_IBC_PRECOMPILE_ABI`, `getIbcPrecompileEthersV6Contract`, `VIEM_IBC_PRECOMPILE_ABI`, `ORACLE_PRECOMPILE_ADDRESS`, `ORACLE_PRECOMPILE_ABI`, `ETHERS_ORACLE_PRECOMPILE_ABI`, `getOraclePrecompileEthersV6Contract`, and `VIEM_ORACLE_PRECOMPILE_ABI` are no longer exported. + +Neither precompile is supported on Sei any more, so calls to them fail on-chain regardless of where the address and ABI come from. There is no drop-in replacement: re-declaring them locally will not restore working calls, and code still depending on them needs to move off these precompiles. diff --git a/packages/precompiles/src/ethers/__tests__/ethersPrecompiles.spec.ts b/packages/precompiles/src/ethers/__tests__/ethersPrecompiles.spec.ts index 4fd7aaea0..3b45dbb43 100644 --- a/packages/precompiles/src/ethers/__tests__/ethersPrecompiles.spec.ts +++ b/packages/precompiles/src/ethers/__tests__/ethersPrecompiles.spec.ts @@ -5,9 +5,7 @@ import { ETHERS_BANK_PRECOMPILE_ABI, ETHERS_DISTRIBUTION_PRECOMPILE_ABI, ETHERS_GOVERNANCE_PRECOMPILE_ABI, - ETHERS_IBC_PRECOMPILE_ABI, ETHERS_JSON_PRECOMPILE_ABI, - ETHERS_ORACLE_PRECOMPILE_ABI, ETHERS_POINTERVIEW_PRECOMPILE_ABI, ETHERS_POINTER_PRECOMPILE_ABI, ETHERS_SOLO_PRECOMPILE_ABI, @@ -17,9 +15,7 @@ import { getBankPrecompileEthersV6Contract, getDistributionPrecompileEthersV6Contract, getGovernancePrecompileEthersV6Contract, - getIbcPrecompileEthersV6Contract, getJSONPrecompileEthersV6Contract, - getOraclePrecompileEthersV6Contract, getPointerPrecompileEthersV6Contract, getPointerviewPrecompileEthersV6Contract, getSoloPrecompileEthersV6Contract, @@ -36,12 +32,8 @@ import { DISTRIBUTION_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI, GOVERNANCE_PRECOMPILE_ADDRESS, - IBC_PRECOMPILE_ABI, - IBC_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI, JSON_PRECOMPILE_ADDRESS, - ORACLE_PRECOMPILE_ABI, - ORACLE_PRECOMPILE_ADDRESS, POINTERVIEW_PRECOMPILE_ABI, POINTERVIEW_PRECOMPILE_ADDRESS, POINTER_PRECOMPILE_ABI, @@ -59,9 +51,7 @@ const FACTORIES: [string, string, InterfaceAbi, unknown, (runner: ContractRunner ['BANK', BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI, ETHERS_BANK_PRECOMPILE_ABI, getBankPrecompileEthersV6Contract], ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI, ETHERS_DISTRIBUTION_PRECOMPILE_ABI, getDistributionPrecompileEthersV6Contract], ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI, ETHERS_GOVERNANCE_PRECOMPILE_ABI, getGovernancePrecompileEthersV6Contract], - ['IBC', IBC_PRECOMPILE_ADDRESS, IBC_PRECOMPILE_ABI, ETHERS_IBC_PRECOMPILE_ABI, getIbcPrecompileEthersV6Contract], ['JSON', JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI, ETHERS_JSON_PRECOMPILE_ABI, getJSONPrecompileEthersV6Contract], - ['ORACLE', ORACLE_PRECOMPILE_ADDRESS, ORACLE_PRECOMPILE_ABI, ETHERS_ORACLE_PRECOMPILE_ABI, getOraclePrecompileEthersV6Contract], ['POINTER', POINTER_PRECOMPILE_ADDRESS, POINTER_PRECOMPILE_ABI, ETHERS_POINTER_PRECOMPILE_ABI, getPointerPrecompileEthersV6Contract], ['POINTERVIEW', POINTERVIEW_PRECOMPILE_ADDRESS, POINTERVIEW_PRECOMPILE_ABI, ETHERS_POINTERVIEW_PRECOMPILE_ABI, getPointerviewPrecompileEthersV6Contract], ['SOLO', SOLO_PRECOMPILE_ADDRESS, SOLO_PRECOMPILE_ABI, ETHERS_SOLO_PRECOMPILE_ABI, getSoloPrecompileEthersV6Contract], diff --git a/packages/precompiles/src/ethers/ibcPrecompile.ts b/packages/precompiles/src/ethers/ibcPrecompile.ts deleted file mode 100644 index d9a15ad55..000000000 --- a/packages/precompiles/src/ethers/ibcPrecompile.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Contract, type ContractRunner, type InterfaceAbi } from 'ethers'; -import { IBC_PRECOMPILE_ABI, IBC_PRECOMPILE_ADDRESS } from '../precompiles'; - -/** - * The ABI for the IBC precompile contract, used to create an Ethers contract. - * @category ABI - */ -export const ETHERS_IBC_PRECOMPILE_ABI = IBC_PRECOMPILE_ABI as InterfaceAbi; - -/** - * Creates and returns a typed Ethers v6 contract instance for the IBC precompile contract. - * This contract is used for interoperability between the EVM and Cosmos. - * - * @example - * ```tsx - * import { getIbcPrecompileEthersV6Contract } from '@sei-js/precompiles/ethers'; - * import { ethers } from 'ethers'; - * - * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider - * const signer = await provider.getSigner(); - * - * const ibcPrecompileContract = getIbcPrecompileEthersV6Contract(signer); - * const cosmosAddress = 'cosmos1...'; - * - * const bool = await ibcPrecompileContract.transfer(cosmosAddress, 'transfer', 'channel-0', 'usei', 100, 1n, 1n, 1n, 'memo'); - * console.log('Transfer successful:', bool); - * ``` - * - * @param runner A [Provider](https://docs.ethers.org/v6/api/providers/) (read-only) or ethers.Signer to use with the contract. - * @returns The typed contract instance for interacting with the IBC precompile contract. - * @category Contract Factory - */ -export const getIbcPrecompileEthersV6Contract = (runner: ContractRunner) => { - return new Contract(IBC_PRECOMPILE_ADDRESS, ETHERS_IBC_PRECOMPILE_ABI, runner); -}; diff --git a/packages/precompiles/src/ethers/index.ts b/packages/precompiles/src/ethers/index.ts index bda78cf27..5cecb81c1 100644 --- a/packages/precompiles/src/ethers/index.ts +++ b/packages/precompiles/src/ethers/index.ts @@ -2,9 +2,7 @@ export * from './addressPrecompile'; export * from './bankPrecompile'; export * from './distributionPrecompile'; export * from './governancePrecompile'; -export * from './ibcPrecompile'; export * from './jsonPrecompile'; -export * from './oraclePrecompile'; export * from './pointerPrecompile'; export * from './pointerviewPrecompile'; export * from './soloPrecompile'; diff --git a/packages/precompiles/src/ethers/oraclePrecompile.ts b/packages/precompiles/src/ethers/oraclePrecompile.ts deleted file mode 100644 index 3e35794b2..000000000 --- a/packages/precompiles/src/ethers/oraclePrecompile.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Contract, type ContractRunner, type InterfaceAbi } from 'ethers'; -import { ORACLE_PRECOMPILE_ABI, ORACLE_PRECOMPILE_ADDRESS } from '../precompiles'; - -/** - * The ABI for the Oracle precompile contract, used to create an Ethers contract. - * @category ABI - */ -export const ETHERS_ORACLE_PRECOMPILE_ABI = ORACLE_PRECOMPILE_ABI as InterfaceAbi; - -/** - * Creates and returns a typed Ethers v6 contract instance for the Oracle precompile contract. - * This contract is used for interoperability between the EVM and Cosmos. - * - * @example - * ```tsx - * import { getOraclePrecompileEthersV6Contract } from '@sei-js/precompiles/ethers'; - * import { ethers } from 'ethers'; - * - * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider - * const signer = await provider.getSigner(); - * - * const oraclePrecompileContract = getOraclePrecompileEthersV6Contract(signer); - * - * const exchangeRates = await oraclePrecompileContract.getExchangeRates(); - * console.log('Exchange Rates:', exchangeRates); - * ``` - * - * @param runner A [Provider](https://docs.ethers.org/v6/api/providers/) (read-only) or ethers.Signer to use with the contract. - * @returns The typed contract instance for interacting with the Oracle precompile contract. - * @category Contract Factory - */ -export const getOraclePrecompileEthersV6Contract = (runner: ContractRunner) => { - return new Contract(ORACLE_PRECOMPILE_ADDRESS, ETHERS_ORACLE_PRECOMPILE_ABI, runner); -}; diff --git a/packages/precompiles/src/precompiles/ibc.ts b/packages/precompiles/src/precompiles/ibc.ts deleted file mode 100644 index fae7b0187..000000000 --- a/packages/precompiles/src/precompiles/ibc.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * The address of the IBC precompile contract. - * @category Address - */ -export const IBC_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001009'; - -/** - * The ABI for the IBC precompile contract. - * @category ABI - */ -export const IBC_PRECOMPILE_ABI = [ - { - inputs: [ - { internalType: 'string', name: 'toAddress', type: 'string' }, - { internalType: 'string', name: 'port', type: 'string' }, - { internalType: 'string', name: 'channel', type: 'string' }, - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'uint256', name: 'amount', type: 'uint256' }, - { internalType: 'uint64', name: 'revisionNumber', type: 'uint64' }, - { internalType: 'uint64', name: 'revisionHeight', type: 'uint64' }, - { internalType: 'uint64', name: 'timeoutTimestamp', type: 'uint64' }, - { internalType: 'string', name: 'memo', type: 'string' } - ], - name: 'transfer', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'string', name: 'toAddress', type: 'string' }, - { internalType: 'string', name: 'port', type: 'string' }, - { internalType: 'string', name: 'channel', type: 'string' }, - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'uint256', name: 'amount', type: 'uint256' }, - { internalType: 'string', name: 'memo', type: 'string' } - ], - name: 'transferWithDefaultTimeout', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; diff --git a/packages/precompiles/src/precompiles/index.ts b/packages/precompiles/src/precompiles/index.ts index aaef11e4a..516fa3f13 100644 --- a/packages/precompiles/src/precompiles/index.ts +++ b/packages/precompiles/src/precompiles/index.ts @@ -2,9 +2,7 @@ export * from './address'; export * from './bank'; export * from './distribution'; export * from './governance'; -export * from './ibc'; export * from './json'; -export * from './oracle'; export * from './pointer'; export * from './pointerview'; export * from './solo'; diff --git a/packages/precompiles/src/precompiles/oracle.ts b/packages/precompiles/src/precompiles/oracle.ts deleted file mode 100644 index 4fc3f1d39..000000000 --- a/packages/precompiles/src/precompiles/oracle.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * The address of the Oracle precompile contract. - * @category Address - */ -export const ORACLE_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001008'; - -/** - * The ABI for the Oracle precompile contract. - * @category ABI - */ -export const ORACLE_PRECOMPILE_ABI = [ - { - inputs: [], - name: 'getExchangeRates', - outputs: [ - { - components: [ - { internalType: 'string', name: 'denom', type: 'string' }, - { - components: [ - { internalType: 'string', name: 'exchangeRate', type: 'string' }, - { internalType: 'string', name: 'lastUpdate', type: 'string' }, - { internalType: 'int64', name: 'lastUpdateTimestamp', type: 'int64' } - ], - internalType: 'struct IOracle.OracleExchangeRate', - name: 'oracleExchangeRateVal', - type: 'tuple' - } - ], - internalType: 'struct IOracle.DenomOracleExchangeRatePair[]', - name: '', - type: 'tuple[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [{ internalType: 'uint64', name: 'lookback_seconds', type: 'uint64' }], - name: 'getOracleTwaps', - outputs: [ - { - components: [ - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'string', name: 'twap', type: 'string' }, - { internalType: 'int64', name: 'lookbackSeconds', type: 'int64' } - ], - internalType: 'struct IOracle.OracleTwap[]', - name: '', - type: 'tuple[]' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; diff --git a/packages/precompiles/src/viem/__tests__/viemPrecompiles.spec.ts b/packages/precompiles/src/viem/__tests__/viemPrecompiles.spec.ts index 1595ea1ca..c3614bcb7 100644 --- a/packages/precompiles/src/viem/__tests__/viemPrecompiles.spec.ts +++ b/packages/precompiles/src/viem/__tests__/viemPrecompiles.spec.ts @@ -4,9 +4,7 @@ import { BANK_PRECOMPILE_ABI, DISTRIBUTION_PRECOMPILE_ABI, GOVERNANCE_PRECOMPILE_ABI, - IBC_PRECOMPILE_ABI, JSON_PRECOMPILE_ABI, - ORACLE_PRECOMPILE_ABI, POINTERVIEW_PRECOMPILE_ABI, POINTER_PRECOMPILE_ABI, SOLO_PRECOMPILE_ABI, @@ -19,9 +17,7 @@ import { VIEM_BANK_PRECOMPILE_ABI, VIEM_DISTRIBUTION_PRECOMPILE_ABI, VIEM_GOVERNANCE_PRECOMPILE_ABI, - VIEM_IBC_PRECOMPILE_ABI, VIEM_JSON_PRECOMPILE_ABI, - VIEM_ORACLE_PRECOMPILE_ABI, VIEM_POINTERVIEW_PRECOMPILE_ABI, VIEM_POINTER_PRECOMPILE_ABI, VIEM_SOLO_PRECOMPILE_ABI, @@ -34,9 +30,7 @@ const PRECOMPILE_VIEM_ABIS: [string, Abi][] = [ ['BANK', BANK_PRECOMPILE_ABI as Abi], ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ABI as Abi], ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ABI as Abi], - ['IBC', IBC_PRECOMPILE_ABI as Abi], ['JSON', JSON_PRECOMPILE_ABI as Abi], - ['ORACLE', ORACLE_PRECOMPILE_ABI as Abi], ['POINTER', POINTER_PRECOMPILE_ABI as Abi], ['POINTERVIEW', POINTERVIEW_PRECOMPILE_ABI as Abi], ['SOLO', SOLO_PRECOMPILE_ABI as Abi], @@ -58,9 +52,7 @@ const ABI_PAIRS: [string, Abi, Abi][] = [ ['BANK', BANK_PRECOMPILE_ABI, VIEM_BANK_PRECOMPILE_ABI], ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ABI, VIEM_DISTRIBUTION_PRECOMPILE_ABI], ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ABI, VIEM_GOVERNANCE_PRECOMPILE_ABI], - ['IBC', IBC_PRECOMPILE_ABI, VIEM_IBC_PRECOMPILE_ABI], ['JSON', JSON_PRECOMPILE_ABI, VIEM_JSON_PRECOMPILE_ABI], - ['ORACLE', ORACLE_PRECOMPILE_ABI, VIEM_ORACLE_PRECOMPILE_ABI], ['POINTER', POINTER_PRECOMPILE_ABI, VIEM_POINTER_PRECOMPILE_ABI], ['POINTERVIEW', POINTERVIEW_PRECOMPILE_ABI, VIEM_POINTERVIEW_PRECOMPILE_ABI], ['SOLO', SOLO_PRECOMPILE_ABI, VIEM_SOLO_PRECOMPILE_ABI], diff --git a/packages/precompiles/src/viem/ibcPrecompile.ts b/packages/precompiles/src/viem/ibcPrecompile.ts deleted file mode 100644 index e93f4c144..000000000 --- a/packages/precompiles/src/viem/ibcPrecompile.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Abi } from 'viem'; -import { IBC_PRECOMPILE_ABI } from '../precompiles'; - -/** - * The Viem ABI for the IBC precompile contract. - * @category ABI - */ -export const VIEM_IBC_PRECOMPILE_ABI = IBC_PRECOMPILE_ABI as Abi; diff --git a/packages/precompiles/src/viem/index.ts b/packages/precompiles/src/viem/index.ts index e392bfad2..1529954c6 100644 --- a/packages/precompiles/src/viem/index.ts +++ b/packages/precompiles/src/viem/index.ts @@ -2,9 +2,7 @@ export * from './addressPrecompile'; export * from './bankPrecompile'; export * from './distributionPrecompile'; export * from './governancePrecompile'; -export * from './ibcPrecompile'; export * from './jsonPrecompile'; -export * from './oraclePrecompile'; export * from './pointerPrecompile'; export * from './pointerviewPrecompile'; export * from './soloPrecompile'; diff --git a/packages/precompiles/src/viem/oraclePrecompile.ts b/packages/precompiles/src/viem/oraclePrecompile.ts deleted file mode 100644 index a57534d80..000000000 --- a/packages/precompiles/src/viem/oraclePrecompile.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Abi } from 'viem'; -import { ORACLE_PRECOMPILE_ABI } from '../precompiles'; - -/** - * The Viem ABI for the Oracle precompile contract. - * @category ABI - */ -export const VIEM_ORACLE_PRECOMPILE_ABI = ORACLE_PRECOMPILE_ABI as Abi;