cosmos-evm-contracts 0.0.1

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/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # cosmos-evm-contracts
2
+
3
+ A collection of smart contracts for the Cosmos EVM blockchain.
4
+ The published package includes precompile interface sources (`.sol`) and ABIs (`.json`).
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ # pnpm
10
+ pnpm add cosmos-evm-contracts
11
+
12
+ # npm
13
+ npm install cosmos-evm-contracts
14
+
15
+ # yarn
16
+ yarn add cosmos-evm-contracts
17
+ ```
18
+
19
+ ## Package structure
20
+
21
+ After installation, use the following paths:
22
+
23
+ | Path | Description |
24
+ |------|-------------|
25
+ | `cosmos-evm-contracts/precompiles/` | Solidity sources (`.sol`) |
26
+ | `cosmos-evm-contracts/abi/precompiles/` | ABI-only JSON (`.json`) |
27
+
28
+ Included precompiles: `bank`, `bech32`, `callbacks`, `common`, `distribution`, `erc20`, `gov`, `ics02`, `ics20`, `slashing`, `staking`, `werc20` (testdata and testutil excluded).
29
+
30
+ ## Usage
31
+
32
+ ### Loading ABI (ethers / viem / web3, etc.)
33
+
34
+ ```javascript
35
+ import IBankAbi from "cosmos-evm-contracts/abi/precompiles/bank/IBank.json" assert { type: "json" };
36
+
37
+ // or Node
38
+ const IBankAbi = require("cosmos-evm-contracts/abi/precompiles/bank/IBank.json");
39
+ ```
40
+
41
+ ### Using interfaces in Hardhat
42
+
43
+ Import by package path in your contract:
44
+
45
+ ```solidity
46
+ import "cosmos-evm-contracts/precompiles/bank/IBank.sol";
47
+ ```
48
+
49
+ ### Using interfaces in Foundry
50
+
51
+ Add the following to `remappings.txt` for shorter import paths:
52
+
53
+ ```
54
+ cosmos-evm-contracts/=node_modules/cosmos-evm-contracts/precompiles/
55
+ ```
56
+
57
+ ```solidity
58
+ import "cosmos-evm-contracts/bank/IBank.sol";
59
+ ```
60
+
61
+ ### Path reference
62
+
63
+ - Interface ABI: `cosmos-evm-contracts/abi/precompiles/{module}/{Interface}.json`
64
+ e.g. `abi/precompiles/staking/StakingI.json`
65
+ - Common types: `cosmos-evm-contracts/precompiles/common/Types.sol` (structs only, no ABI)
@@ -0,0 +1,77 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "account",
7
+ "type": "address"
8
+ }
9
+ ],
10
+ "name": "balances",
11
+ "outputs": [
12
+ {
13
+ "components": [
14
+ {
15
+ "internalType": "address",
16
+ "name": "contractAddress",
17
+ "type": "address"
18
+ },
19
+ {
20
+ "internalType": "uint256",
21
+ "name": "amount",
22
+ "type": "uint256"
23
+ }
24
+ ],
25
+ "internalType": "struct Balance[]",
26
+ "name": "balances",
27
+ "type": "tuple[]"
28
+ }
29
+ ],
30
+ "stateMutability": "view",
31
+ "type": "function"
32
+ },
33
+ {
34
+ "inputs": [
35
+ {
36
+ "internalType": "address",
37
+ "name": "erc20Address",
38
+ "type": "address"
39
+ }
40
+ ],
41
+ "name": "supplyOf",
42
+ "outputs": [
43
+ {
44
+ "internalType": "uint256",
45
+ "name": "totalSupply",
46
+ "type": "uint256"
47
+ }
48
+ ],
49
+ "stateMutability": "view",
50
+ "type": "function"
51
+ },
52
+ {
53
+ "inputs": [],
54
+ "name": "totalSupply",
55
+ "outputs": [
56
+ {
57
+ "components": [
58
+ {
59
+ "internalType": "address",
60
+ "name": "contractAddress",
61
+ "type": "address"
62
+ },
63
+ {
64
+ "internalType": "uint256",
65
+ "name": "amount",
66
+ "type": "uint256"
67
+ }
68
+ ],
69
+ "internalType": "struct Balance[]",
70
+ "name": "totalSupply",
71
+ "type": "tuple[]"
72
+ }
73
+ ],
74
+ "stateMutability": "view",
75
+ "type": "function"
76
+ }
77
+ ]
@@ -0,0 +1,45 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "string",
6
+ "name": "bech32Address",
7
+ "type": "string"
8
+ }
9
+ ],
10
+ "name": "bech32ToHex",
11
+ "outputs": [
12
+ {
13
+ "internalType": "address",
14
+ "name": "addr",
15
+ "type": "address"
16
+ }
17
+ ],
18
+ "stateMutability": "nonpayable",
19
+ "type": "function"
20
+ },
21
+ {
22
+ "inputs": [
23
+ {
24
+ "internalType": "address",
25
+ "name": "addr",
26
+ "type": "address"
27
+ },
28
+ {
29
+ "internalType": "string",
30
+ "name": "prefix",
31
+ "type": "string"
32
+ }
33
+ ],
34
+ "name": "hexToBech32",
35
+ "outputs": [
36
+ {
37
+ "internalType": "string",
38
+ "name": "bech32Address",
39
+ "type": "string"
40
+ }
41
+ ],
42
+ "stateMutability": "nonpayable",
43
+ "type": "function"
44
+ }
45
+ ]
@@ -0,0 +1,63 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "string",
6
+ "name": "channelId",
7
+ "type": "string"
8
+ },
9
+ {
10
+ "internalType": "string",
11
+ "name": "portId",
12
+ "type": "string"
13
+ },
14
+ {
15
+ "internalType": "uint64",
16
+ "name": "sequence",
17
+ "type": "uint64"
18
+ },
19
+ {
20
+ "internalType": "bytes",
21
+ "name": "data",
22
+ "type": "bytes"
23
+ },
24
+ {
25
+ "internalType": "bytes",
26
+ "name": "acknowledgement",
27
+ "type": "bytes"
28
+ }
29
+ ],
30
+ "name": "onPacketAcknowledgement",
31
+ "outputs": [],
32
+ "stateMutability": "nonpayable",
33
+ "type": "function"
34
+ },
35
+ {
36
+ "inputs": [
37
+ {
38
+ "internalType": "string",
39
+ "name": "channelId",
40
+ "type": "string"
41
+ },
42
+ {
43
+ "internalType": "string",
44
+ "name": "portId",
45
+ "type": "string"
46
+ },
47
+ {
48
+ "internalType": "uint64",
49
+ "name": "sequence",
50
+ "type": "uint64"
51
+ },
52
+ {
53
+ "internalType": "bytes",
54
+ "name": "data",
55
+ "type": "bytes"
56
+ }
57
+ ],
58
+ "name": "onPacketTimeout",
59
+ "outputs": [],
60
+ "stateMutability": "nonpayable",
61
+ "type": "function"
62
+ }
63
+ ]