@hashpower/collateral-abi 1.0.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/README.md +40 -0
- package/deployments.json +22 -0
- package/dist/CollateralVault.d.ts +753 -0
- package/dist/CollateralVault.js +978 -0
- package/dist/ContractErrors.d.ts +225 -0
- package/dist/ContractErrors.js +297 -0
- package/dist/ICollateralVault.d.ts +211 -0
- package/dist/ICollateralVault.js +275 -0
- package/dist/IPoints.d.ts +63 -0
- package/dist/IPoints.js +83 -0
- package/dist/IPointsHook.d.ts +49 -0
- package/dist/IPointsHook.js +63 -0
- package/dist/IPortfolioMarginEngine.d.ts +49 -0
- package/dist/IPortfolioMarginEngine.js +66 -0
- package/dist/Points.d.ts +438 -0
- package/dist/Points.js +568 -0
- package/dist/PointsHook.d.ts +439 -0
- package/dist/PointsHook.js +567 -0
- package/dist/PointsRedeemer.d.ts +267 -0
- package/dist/PointsRedeemer.js +344 -0
- package/dist/PortfolioMarginEngine.d.ts +451 -0
- package/dist/PortfolioMarginEngine.js +588 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/json/CollateralVault.json +978 -0
- package/json/ContractErrors.json +297 -0
- package/json/ICollateralVault.json +275 -0
- package/json/IPoints.json +83 -0
- package/json/IPointsHook.json +63 -0
- package/json/IPortfolioMarginEngine.json +66 -0
- package/json/Points.json +568 -0
- package/json/PointsHook.json +567 -0
- package/json/PointsRedeemer.json +344 -0
- package/json/PortfolioMarginEngine.json +588 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @hashpower/collateral-abi
|
|
2
|
+
|
|
3
|
+
ABIs and deployment addresses for the Hashpower unified collateral system on Base:
|
|
4
|
+
|
|
5
|
+
| Contract | Purpose |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `CollateralVault` | Shared USDC custody — `deposit`, `withdraw` (IM-gated), `balanceOf` |
|
|
8
|
+
| `PortfolioMarginEngine` | Cross-product portfolio margin — `computePortfolioIM/MM`, `isHealthy`, `canPlaceOrder` |
|
|
9
|
+
| `Points` | Rewards ledger |
|
|
10
|
+
|
|
11
|
+
Collateral is unified across all Hashpower trading venues (futures, perps): deposit once to the vault, trade everywhere. Withdrawals are gated by portfolio initial margin.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { CollateralVaultAbi, PortfolioMarginEngineAbi } from "@hashpower/collateral-abi";
|
|
17
|
+
import deployments from "@hashpower/collateral-abi/deployments.json" with { type: "json" };
|
|
18
|
+
|
|
19
|
+
// "testnet" (Base Sepolia) or "mainnet" (Base)
|
|
20
|
+
const env = process.env.HASHPOWER_ENV ?? "testnet";
|
|
21
|
+
const { contracts } = deployments.environments[env];
|
|
22
|
+
|
|
23
|
+
const im = await client.readContract({
|
|
24
|
+
address: contracts.PortfolioMarginEngine,
|
|
25
|
+
abi: PortfolioMarginEngineAbi,
|
|
26
|
+
functionName: "computePortfolioIM",
|
|
27
|
+
args: [account],
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Raw JSON ABIs (for subgraphs and non-TypeScript consumers) are available under `@hashpower/collateral-abi/json/<Contract>.json`.
|
|
32
|
+
|
|
33
|
+
## How this package is built
|
|
34
|
+
|
|
35
|
+
Contents are generated — do not edit by hand:
|
|
36
|
+
|
|
37
|
+
- `src/` is copied from `../contracts/abi` (the Hardhat codegen output) by `scripts/build.mjs`, then compiled to `dist/`.
|
|
38
|
+
- `deployments.json` is the canonical address manifest for this repo; it is updated when contracts are (re)deployed.
|
|
39
|
+
|
|
40
|
+
Publishing happens automatically from CI when ABIs or the manifest change (see `.github/workflows/publish-collateral-abi.yml`).
|
package/deployments.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"package": "@hashpower/collateral-abi",
|
|
3
|
+
"environments": {
|
|
4
|
+
"testnet": {
|
|
5
|
+
"chainId": 84532,
|
|
6
|
+
"network": "base-sepolia",
|
|
7
|
+
"contracts": {
|
|
8
|
+
"CollateralVault": "0x54A79e2a5C60ACe37b280eBbCda51b4E903d25F0",
|
|
9
|
+
"PortfolioMarginEngine": "0x3899e429Ef47140eC46c6E23F04253C24F221b69",
|
|
10
|
+
"Points": "0x153F6cb4386d717AD94791E6Ee8ae37f80315972",
|
|
11
|
+
"CollateralToken": "0xDd15eED84065A58c9E9ff9E95fb996be0fff22AA"
|
|
12
|
+
},
|
|
13
|
+
"subgraphs": {}
|
|
14
|
+
},
|
|
15
|
+
"mainnet": {
|
|
16
|
+
"chainId": 8453,
|
|
17
|
+
"network": "base",
|
|
18
|
+
"contracts": {},
|
|
19
|
+
"subgraphs": {}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|