risk-contracts
v1.0.8
Published
This project provides a core contract SDK for interacting with the [core-protocol](https://github.com/RiskProtocol/core-protocol) contract interfaces.
Downloads
2
Readme
SDK Core Contract
This project provides a core contract SDK for interacting with the core-protocol contract interfaces.
Installation
To install the project dependencies, run:
yarn
Building
To build the project, run:
yarn build
This will generate the necessary files in the dist directory.
Usage
Install locally in another project
yarn add file:<path to sdk>
Import the RiskContracts class from the main entry point:
import { RiskContracts } from 'sdk-core-contract';
Then, use the RiskContracts class to interact with the contract interfaces.
const risk = new RiskContracts({
jsonRpcUrl: "https://eth-sepolia.g.alchemy.com/v2/<AlchemyKey>",
network:
{
name: "sepolia",
chainId: 11155111,
},
tokenFactory:
{
address: "0xc75D00f441D21A81526E65b0C2f36090aC997479",
}
});
const getBaseToken = await risk.tokenFactory.getBaseToken();
console.log("getBaseToken", getBaseToken);
const getRebalanceInterval = await risk.tokenFactory.rebalance.getRebalanceInterval();
console.log("getRebalanceInterval", getRebalanceInterval);
const rate = await risk.tokenFactory.managementFees.getRate();
const active = await risk.tokenFactory.managementFees.isFeeActive();
console.log("Fee Rate", rate);
console.log("Is Fee Active", active);
Contract Interfaces
The contract interfaces are located in the src/resources/contractInterface/abis directory. These interfaces are generated from the contract artifacts using the script.sh script.
src/resources/contractInterface/script.sh ../core-protocol/artifacts/contracts
Where ../core-protocol/artifacts/contracts
is the path to the artifacts/contracts
in the core-protocol repository