Skip to content

Commit 90dc150

Browse files
authored
Merge pull request #3 from flare-foundation/feat/rename-interfaces-directory
Update contract artifacts to version 0.1.22
2 parents d8e5ba3 + e9b838e commit 90dc150

File tree

161 files changed

+253
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+253
-175
lines changed

README.md

Lines changed: 97 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,102 @@
1-
# Flare smart contracts periphery
1+
# Flare Smart Contracts Periphery
22

3-
This package contains ABIs, typechain artifacts and addresses for smart contracts on Flare networks Flare, Songbird,
4-
Coston and Coston2.
3+
This package contains ABIs and addresses for smart contracts deployed on [Flare networks](https://dev.flare.network/network/solidity-reference):
54

6-
Enjoy
5+
- Flare Mainnet
6+
- Songbird Canary Network
7+
- Songbird Testnet Coston
8+
- Flare Testnet Coston2
79

10+
## Installation
11+
12+
```bash
13+
npm install @flarenetwork/flare-periphery-contract
14+
# or
15+
yarn add @flarenetwork/flare-periphery-contract
16+
```
817

918
## Features
10-
This library exposes the following names at top level:
11-
* `nameToAbi(name:string, network: string): any` and `interfaceToAbi(name: string, network: string): any` -
12-
return abi an array of objects.
13-
Name is the name of contract/interface and network can be one of coston, coston2, songbird and flare.
14-
* `nameToAddress(name: string, provider: ethers.JsonRpcApiProvider): Promise<string>` and `namesToAddresses(names: string[], provider: ethers.JsonRpcApiProvider): Promise<string[]>`.
15-
Provider is used to get contract address(es). They are read from FlareContractRegistryLibrary on chain.
16-
* `FlareContractRegistryAddress` - hardcoded address constant, the same for all chains and should never change.
17-
* `coston`, `coston2`, `flare` and `songbird` - namespaces with 4 exports:
18-
- `products` - an object exposing contracts through `.ContractName` syntax. They have fields
19-
`name`, `interface` - interface's name and `abi`, and method `getAddress(provider: JsonRpcProvider): Promise<string>`.
20-
- `interfaceAbis` - a class allowing access to abis using `.InterfaceName` syntax. Interface names are
21-
usually contract names prefixed with capital letter `I`.
22-
- `nameToAbi(name: string): any` and `interfaceToAbi(name: string): any` - the same as top level functions, with omitted network argument
23-
24-
Additionally typechain artifacts are stored in `artifacts/contracts` folders for every chain.
19+
20+
### Top Level Exports
21+
22+
#### ABI Access Functions
23+
24+
- `nameToAbi(name: string, network: string): any`
25+
- `interfaceToAbi(name: string, network: string): any`
26+
27+
Both functions return an ABI array. The `network` parameter must be one of:
28+
29+
- `"coston"`
30+
- `"coston2"`
31+
- `"songbird"`
32+
- `"flare"`
33+
34+
```typescript
35+
import { nameToAbi } from "@flarenetwork/flare-periphery-contract";
36+
37+
const abi = nameToAbi("FtsoManager", "flare");
38+
```
39+
40+
#### Address Resolution
41+
42+
- `nameToAddress(name: string, provider: ethers.JsonRpcApiProvider): Promise<string>`
43+
- `namesToAddresses(names: string[], provider: ethers.JsonRpcApiProvider): Promise<string[]>`
44+
45+
These functions fetch contract addresses from the on-chain FlareContractRegistryLibrary.
46+
47+
```typescript
48+
import { nameToAddress } from "@flarenetwork/flare-periphery-contract";
49+
import { ethers } from "ethers";
50+
51+
const provider = new ethers.JsonRpcProvider("https://flare-api.flare.network/ext/C/rpc");
52+
const address = await nameToAddress("FtsoManager", provider);
53+
```
54+
55+
#### Constants
56+
57+
- `FlareContractRegistryAddress`: Hardcoded registry address (same for all chains)
58+
59+
### Network-Specific Namespaces
60+
61+
Each network (`coston`, `coston2`, `flare`, `songbird`) exports:
62+
63+
#### 1. Products
64+
65+
Access contract information through `.ContractName` syntax:
66+
67+
```typescript
68+
import { flare } from "@flarenetwork/flare-periphery-contract";
69+
70+
const ftsoManager = flare.products.FtsoManager;
71+
console.log(ftsoManager.name); // Contract name
72+
console.log(ftsoManager.interface); // Interface name
73+
console.log(ftsoManager.abi); // Contract ABI
74+
75+
// Get deployed address
76+
const address = await ftsoManager.getAddress(provider);
77+
```
78+
79+
#### 2. Interface ABIs
80+
81+
Access interface ABIs using `.InterfaceName` syntax:
82+
83+
```typescript
84+
import { flare } from "@flarenetwork/flare-periphery-contract";
85+
86+
const abi = flare.interfaceAbis.IFtsoManager;
87+
```
88+
89+
#### 3. Network-Specific ABI Functions
90+
91+
It is same as top-level functions but with the pre-set network:
92+
93+
```typescript
94+
import { flare } from "@flarenetwork/flare-periphery-contract";
95+
96+
const abi = flare.nameToAbi("FtsoManager"); // Network already known
97+
const iAbi = flare.interfaceToAbi("IFtsoManager");
98+
```
99+
100+
## Support
101+
102+
For issues and feature requests, please visit our [GitHub repository](https://github.com/flare-foundation/flare-smart-contracts-periphery).

coston/abis.ts

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,52 +32,52 @@ import IFdcVerification from "./artifacts/contracts/IFdcVerification.sol/IFdcVer
3232
import IFeeCalculator from "./artifacts/contracts/IFeeCalculator.sol/IFeeCalculator.json";
3333
import IFlareAssetRegistry from "./artifacts/contracts/IFlareAssetRegistry.sol/IFlareAssetRegistry.json";
3434
import IFlareContractRegistry from "./artifacts/contracts/IFlareContractRegistry.sol/IFlareContractRegistry.json";
35-
import IFlareDaemonize from "./artifacts/contracts/genesis/interface/IFlareDaemonize.sol/IFlareDaemonize.json";
35+
import IFlareDaemonize from "./artifacts/contracts/genesis/interfaces/IFlareDaemonize.sol/IFlareDaemonize.json";
3636
import IFlareSystemsCalculator from "./artifacts/contracts/IFlareSystemsCalculator.sol/IFlareSystemsCalculator.json";
3737
import IFlareSystemsManager from "./artifacts/contracts/IFlareSystemsManager.sol/IFlareSystemsManager.json";
3838
import IFtso from "./artifacts/contracts/IFtso.sol/IFtso.json";
3939
import IFtsoFeedDecimals from "./artifacts/contracts/IFtsoFeedDecimals.sol/IFtsoFeedDecimals.json";
4040
import IFtsoFeedIdConverter from "./artifacts/contracts/IFtsoFeedIdConverter.sol/IFtsoFeedIdConverter.json";
4141
import IFtsoFeedPublisher from "./artifacts/contracts/IFtsoFeedPublisher.sol/IFtsoFeedPublisher.json";
42-
import IFtsoGenesis from "./artifacts/contracts/genesis/interface/IFtsoGenesis.sol/IFtsoGenesis.json";
42+
import IFtsoGenesis from "./artifacts/contracts/genesis/interfaces/IFtsoGenesis.sol/IFtsoGenesis.json";
4343
import IFtsoInflationConfigurations from "./artifacts/contracts/IFtsoInflationConfigurations.sol/IFtsoInflationConfigurations.json";
4444
import IFtsoManager from "./artifacts/contracts/IFtsoManager.sol/IFtsoManager.json";
45-
import IFtsoManagerGenesis from "./artifacts/contracts/genesis/interface/IFtsoManagerGenesis.sol/IFtsoManagerGenesis.json";
45+
import IFtsoManagerGenesis from "./artifacts/contracts/genesis/interfaces/IFtsoManagerGenesis.sol/IFtsoManagerGenesis.json";
4646
import IFtsoRegistry from "./artifacts/contracts/IFtsoRegistry.sol/IFtsoRegistry.json";
47-
import IFtsoRegistryGenesis from "./artifacts/contracts/genesis/interface/IFtsoRegistryGenesis.sol/IFtsoRegistryGenesis.json";
47+
import IFtsoRegistryGenesis from "./artifacts/contracts/genesis/interfaces/IFtsoRegistryGenesis.sol/IFtsoRegistryGenesis.json";
4848
import IFtsoRewardManager from "./artifacts/contracts/IFtsoRewardManager.sol/IFtsoRewardManager.json";
4949
import IFtsoRewardOffersManager from "./artifacts/contracts/IFtsoRewardOffersManager.sol/IFtsoRewardOffersManager.json";
5050
import IGenericRewardManager from "./artifacts/contracts/IGenericRewardManager.sol/IGenericRewardManager.json";
5151
import IGovernanceSettings from "./artifacts/contracts/IGovernanceSettings.sol/IGovernanceSettings.json";
5252
import IGovernanceVotePower from "./artifacts/contracts/IGovernanceVotePower.sol/IGovernanceVotePower.json";
5353
import IGovernor from "./artifacts/contracts/IGovernor.sol/IGovernor.json";
54-
import IIClaimSetupManager from "./artifacts/contracts/protocol/interface/IIClaimSetupManager.sol/IIClaimSetupManager.json";
55-
import IICleanable from "./artifacts/contracts/token/interface/IICleanable.sol/IICleanable.json";
56-
import IICleanupBlockNumberManager from "./artifacts/contracts/protocol/interface/IICleanupBlockNumberManager.sol/IICleanupBlockNumberManager.json";
57-
import IICustomFeed from "./artifacts/contracts/customFeeds/interface/IICustomFeed.sol/IICustomFeed.json";
58-
import IIEntityManager from "./artifacts/contracts/protocol/interface/IIEntityManager.sol/IIEntityManager.json";
59-
import IIFastUpdaterView from "./artifacts/contracts/fscV1/interface/IIFastUpdaterView.sol/IIFastUpdaterView.json";
60-
import IIFlareSystemsCalculator from "./artifacts/contracts/protocol/interface/IIFlareSystemsCalculator.sol/IIFlareSystemsCalculator.json";
61-
import IIFlareSystemsManager from "./artifacts/contracts/protocol/interface/IIFlareSystemsManager.sol/IIFlareSystemsManager.json";
62-
import IIFtso from "./artifacts/contracts/ftso/interface/IIFtso.sol/IIFtso.json";
63-
import IIFtsoFeedPublisher from "./artifacts/contracts/ftso/interface/IIFtsoFeedPublisher.sol/IIFtsoFeedPublisher.json";
64-
import IIFtsoManagerProxy from "./artifacts/contracts/fscV1/interface/IIFtsoManagerProxy.sol/IIFtsoManagerProxy.json";
65-
import IIGovernanceVotePower from "./artifacts/contracts/token/interface/IIGovernanceVotePower.sol/IIGovernanceVotePower.json";
66-
import IIGovernorProposer from "./artifacts/contracts/governance/interface/IIGovernorProposer.sol/IIGovernorProposer.json";
67-
import IINodePossessionVerifier from "./artifacts/contracts/protocol/interface/IINodePossessionVerifier.sol/IINodePossessionVerifier.json";
68-
import IIPollingFoundation from "./artifacts/contracts/governance/interface/IIPollingFoundation.sol/IIPollingFoundation.json";
69-
import IIPollingManagementGroup from "./artifacts/contracts/governance/interface/IIPollingManagementGroup.sol/IIPollingManagementGroup.json";
70-
import IIPublicKeyVerifier from "./artifacts/contracts/protocol/interface/IIPublicKeyVerifier.sol/IIPublicKeyVerifier.json";
71-
import IIRNat from "./artifacts/contracts/rNat/interface/IIRNat.sol/IIRNat.json";
72-
import IIRNatAccount from "./artifacts/contracts/rNat/interface/IIRNatAccount.sol/IIRNatAccount.json";
73-
import IIRelay from "./artifacts/contracts/protocol/interface/IIRelay.sol/IIRelay.json";
74-
import IIRewardEpochSwitchoverTrigger from "./artifacts/contracts/protocol/interface/IIRewardEpochSwitchoverTrigger.sol/IIRewardEpochSwitchoverTrigger.json";
75-
import IIRewardManager from "./artifacts/contracts/protocol/interface/IIRewardManager.sol/IIRewardManager.json";
76-
import IISubmission from "./artifacts/contracts/protocol/interface/IISubmission.sol/IISubmission.json";
77-
import IIVPContract from "./artifacts/contracts/token/interface/IIVPContract.sol/IIVPContract.json";
78-
import IIVPToken from "./artifacts/contracts/token/interface/IIVPToken.sol/IIVPToken.json";
79-
import IIVoterRegistrationTrigger from "./artifacts/contracts/protocol/interface/IIVoterRegistrationTrigger.sol/IIVoterRegistrationTrigger.json";
80-
import IIVoterRegistry from "./artifacts/contracts/protocol/interface/IIVoterRegistry.sol/IIVoterRegistry.json";
54+
import IIClaimSetupManager from "./artifacts/contracts/protocol/interfaces/IIClaimSetupManager.sol/IIClaimSetupManager.json";
55+
import IICleanable from "./artifacts/contracts/token/interfaces/IICleanable.sol/IICleanable.json";
56+
import IICleanupBlockNumberManager from "./artifacts/contracts/protocol/interfaces/IICleanupBlockNumberManager.sol/IICleanupBlockNumberManager.json";
57+
import IICustomFeed from "./artifacts/contracts/customFeeds/interfaces/IICustomFeed.sol/IICustomFeed.json";
58+
import IIEntityManager from "./artifacts/contracts/protocol/interfaces/IIEntityManager.sol/IIEntityManager.json";
59+
import IIFastUpdaterView from "./artifacts/contracts/fscV1/interfaces/IIFastUpdaterView.sol/IIFastUpdaterView.json";
60+
import IIFlareSystemsCalculator from "./artifacts/contracts/protocol/interfaces/IIFlareSystemsCalculator.sol/IIFlareSystemsCalculator.json";
61+
import IIFlareSystemsManager from "./artifacts/contracts/protocol/interfaces/IIFlareSystemsManager.sol/IIFlareSystemsManager.json";
62+
import IIFtso from "./artifacts/contracts/ftso/interfaces/IIFtso.sol/IIFtso.json";
63+
import IIFtsoFeedPublisher from "./artifacts/contracts/ftso/interfaces/IIFtsoFeedPublisher.sol/IIFtsoFeedPublisher.json";
64+
import IIFtsoManagerProxy from "./artifacts/contracts/fscV1/interfaces/IIFtsoManagerProxy.sol/IIFtsoManagerProxy.json";
65+
import IIGovernanceVotePower from "./artifacts/contracts/token/interfaces/IIGovernanceVotePower.sol/IIGovernanceVotePower.json";
66+
import IIGovernorProposer from "./artifacts/contracts/governance/interfaces/IIGovernorProposer.sol/IIGovernorProposer.json";
67+
import IINodePossessionVerifier from "./artifacts/contracts/protocol/interfaces/IINodePossessionVerifier.sol/IINodePossessionVerifier.json";
68+
import IIPollingFoundation from "./artifacts/contracts/governance/interfaces/IIPollingFoundation.sol/IIPollingFoundation.json";
69+
import IIPollingManagementGroup from "./artifacts/contracts/governance/interfaces/IIPollingManagementGroup.sol/IIPollingManagementGroup.json";
70+
import IIPublicKeyVerifier from "./artifacts/contracts/protocol/interfaces/IIPublicKeyVerifier.sol/IIPublicKeyVerifier.json";
71+
import IIRNat from "./artifacts/contracts/rNat/interfaces/IIRNat.sol/IIRNat.json";
72+
import IIRNatAccount from "./artifacts/contracts/rNat/interfaces/IIRNatAccount.sol/IIRNatAccount.json";
73+
import IIRelay from "./artifacts/contracts/protocol/interfaces/IIRelay.sol/IIRelay.json";
74+
import IIRewardEpochSwitchoverTrigger from "./artifacts/contracts/protocol/interfaces/IIRewardEpochSwitchoverTrigger.sol/IIRewardEpochSwitchoverTrigger.json";
75+
import IIRewardManager from "./artifacts/contracts/protocol/interfaces/IIRewardManager.sol/IIRewardManager.json";
76+
import IISubmission from "./artifacts/contracts/protocol/interfaces/IISubmission.sol/IISubmission.json";
77+
import IIVPContract from "./artifacts/contracts/token/interfaces/IIVPContract.sol/IIVPContract.json";
78+
import IIVPToken from "./artifacts/contracts/token/interfaces/IIVPToken.sol/IIVPToken.json";
79+
import IIVoterRegistrationTrigger from "./artifacts/contracts/protocol/interfaces/IIVoterRegistrationTrigger.sol/IIVoterRegistrationTrigger.json";
80+
import IIVoterRegistry from "./artifacts/contracts/protocol/interfaces/IIVoterRegistry.sol/IIVoterRegistry.json";
8181
import IIncreaseManager from "./artifacts/contracts/IIncreaseManager.sol/IIncreaseManager.json";
8282
import IPayment from "./artifacts/contracts/IPayment.sol/IPayment.json";
8383
import IPaymentVerification from "./artifacts/contracts/IPaymentVerification.sol/IPaymentVerification.json";
@@ -93,8 +93,8 @@ import IRelay from "./artifacts/contracts/IRelay.sol/IRelay.json";
9393
import IRewardManager from "./artifacts/contracts/IRewardManager.sol/IRewardManager.json";
9494
import ISubmission from "./artifacts/contracts/ISubmission.sol/ISubmission.json";
9595
import ITransferFees from "./artifacts/contracts/ITransferFees.sol/ITransferFees.json";
96-
import ITypeTemplate from "./artifacts/contracts/fdc/interface/ITypeTemplate.sol/ITypeTemplate.json";
97-
import ITypeTemplateVerification from "./artifacts/contracts/fdc/interface/ITypeTemplateVerification.sol/ITypeTemplateVerification.json";
96+
import ITypeTemplate from "./artifacts/contracts/fdc/interfaces/ITypeTemplate.sol/ITypeTemplate.json";
97+
import ITypeTemplateVerification from "./artifacts/contracts/fdc/interfaces/ITypeTemplateVerification.sol/ITypeTemplateVerification.json";
9898
import IVPContractEvents from "./artifacts/contracts/IVPContractEvents.sol/IVPContractEvents.json";
9999
import IVPToken from "./artifacts/contracts/IVPToken.sol/IVPToken.json";
100100
import IValidatorRewardOffersManager from "./artifacts/contracts/IValidatorRewardOffersManager.sol/IValidatorRewardOffersManager.json";

coston/artifacts/contracts/customFeeds/interface/IICustomFeed.sol/IICustomFeed.json renamed to coston/artifacts/contracts/customFeeds/interfaces/IICustomFeed.sol/IICustomFeed.json

File renamed without changes.

coston/artifacts/contracts/fdc/interface/ITypeTemplate.sol/ITypeTemplate.json renamed to coston/artifacts/contracts/fdc/interfaces/ITypeTemplate.sol/ITypeTemplate.json

File renamed without changes.

coston/artifacts/contracts/fdc/interface/ITypeTemplateVerification.sol/ITypeTemplateVerification.json renamed to coston/artifacts/contracts/fdc/interfaces/ITypeTemplateVerification.sol/ITypeTemplateVerification.json

File renamed without changes.

coston/artifacts/contracts/fscV1/interface/IIFastUpdaterView.sol/IIFastUpdaterView.json renamed to coston/artifacts/contracts/fscV1/interfaces/IIFastUpdaterView.sol/IIFastUpdaterView.json

File renamed without changes.

coston/artifacts/contracts/fscV1/interface/IIFtsoManagerProxy.sol/IIFtsoManagerProxy.json renamed to coston/artifacts/contracts/fscV1/interfaces/IIFtsoManagerProxy.sol/IIFtsoManagerProxy.json

File renamed without changes.

coston/artifacts/contracts/ftso/interface/IIFtso.sol/IIFtso.json renamed to coston/artifacts/contracts/ftso/interfaces/IIFtso.sol/IIFtso.json

File renamed without changes.

coston/artifacts/contracts/ftso/interface/IIFtsoFeedPublisher.sol/IIFtsoFeedPublisher.json renamed to coston/artifacts/contracts/ftso/interfaces/IIFtsoFeedPublisher.sol/IIFtsoFeedPublisher.json

File renamed without changes.

coston/artifacts/contracts/genesis/interface/IFlareDaemonize.sol/IFlareDaemonize.json renamed to coston/artifacts/contracts/genesis/interfaces/IFlareDaemonize.sol/IFlareDaemonize.json

File renamed without changes.

0 commit comments

Comments
 (0)