@knine-sdk/contracts
Version:
Contracts for Knine projects. Part of Knine JS SDK
74 lines (69 loc) • 4.75 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var AggregatorAbi__factory = require('./generated/factories/AggregatorAbi__factory.js');
var WithdrawalQueueAbi__factory = require('./generated/factories/WithdrawalQueueAbi__factory.js');
var Erc20Abi__factory = require('./generated/factories/Erc20Abi__factory.js');
var NodeOperatorRegistryAbi__factory = require('./generated/factories/NodeOperatorRegistryAbi__factory.js');
var UnstBoneAbi__factory = require('./generated/factories/UnstBoneAbi__factory.js');
var InstantPoolAbi__factory = require('./generated/factories/InstantPoolAbi__factory.js');
var KnboneAbi__factory = require('./generated/factories/KnboneAbi__factory.js');
var ShibariumKnBoneAbi__factory = require('./generated/factories/ShibariumKnBoneAbi__factory.js');
var StakeManagerAbi__factory = require('./generated/factories/StakeManagerAbi__factory.js');
var RealYieldStakingAbi__factory = require('./generated/factories/RealYieldStakingAbi__factory.js');
var VestingAbi__factory = require('./generated/factories/VestingAbi__factory.js');
var FarmingPoolAbi__factory = require('./generated/factories/FarmingPoolAbi__factory.js');
var LpTokenAbi__factory = require('./generated/factories/LpTokenAbi__factory.js');
var FarmingFactoryAbi__factory = require('./generated/factories/FarmingFactoryAbi__factory.js');
var KnineMintableAbi__factory = require('./generated/factories/KnineMintableAbi__factory.js');
const createContractGetter = (factory) => {
const providerCache = new WeakMap();
return (address, signerOrProvider, cacheSeed = 0) => {
const cacheByAddressKey = `${address}-${cacheSeed}`;
let cacheByAddress = providerCache.get(signerOrProvider);
let contract = cacheByAddress === null || cacheByAddress === void 0 ? void 0 : cacheByAddress[cacheByAddressKey];
if (!cacheByAddress) {
cacheByAddress = {};
providerCache.set(signerOrProvider, cacheByAddress);
}
if (!contract) {
contract = factory.connect(address, signerOrProvider);
cacheByAddress[cacheByAddressKey] = contract;
}
return contract;
};
};
// TODO: remove unused contracts
// lido
const getAggregatorContract = createContractGetter(AggregatorAbi__factory.AggregatorAbi__factory);
const getWithdrawalQueueContract = createContractGetter(WithdrawalQueueAbi__factory.WithdrawalQueueAbi__factory);
// BASE
const getERC20Contract = createContractGetter(Erc20Abi__factory.Erc20Abi__factory);
// KNINE contracts
const getNodeOperatorRegistryContract = createContractGetter(NodeOperatorRegistryAbi__factory.NodeOperatorRegistryAbi__factory);
const getUstBoneContract = createContractGetter(UnstBoneAbi__factory.UnstBoneAbi__factory);
const getInstantPoolContract = createContractGetter(InstantPoolAbi__factory.InstantPoolAbi__factory);
const getKnBoneContract = createContractGetter(KnboneAbi__factory.KnboneAbi__factory);
const getShibariumKnBoneContract = createContractGetter(ShibariumKnBoneAbi__factory.ShibariumKnBoneAbi__factory);
const getStakeManagerContract = createContractGetter(StakeManagerAbi__factory.StakeManagerAbi__factory);
const getRealYieldStakingContract = createContractGetter(RealYieldStakingAbi__factory.RealYieldStakingAbi__factory);
const getVestingContract = createContractGetter(VestingAbi__factory.VestingAbi__factory);
const getFarmingPoolContract = createContractGetter(FarmingPoolAbi__factory.FarmingPoolAbi__factory);
const getLpTokenContract = createContractGetter(LpTokenAbi__factory.LpTokenAbi__factory);
const getFarmingFactoryContract = createContractGetter(FarmingFactoryAbi__factory.FarmingFactoryAbi__factory);
const getKnineMintableContract = createContractGetter(KnineMintableAbi__factory.KnineMintableAbi__factory);
exports.createContractGetter = createContractGetter;
exports.getAggregatorContract = getAggregatorContract;
exports.getERC20Contract = getERC20Contract;
exports.getFarmingFactoryContract = getFarmingFactoryContract;
exports.getFarmingPoolContract = getFarmingPoolContract;
exports.getInstantPoolContract = getInstantPoolContract;
exports.getKnBoneContract = getKnBoneContract;
exports.getKnineMintableContract = getKnineMintableContract;
exports.getLpTokenContract = getLpTokenContract;
exports.getNodeOperatorRegistryContract = getNodeOperatorRegistryContract;
exports.getRealYieldStakingContract = getRealYieldStakingContract;
exports.getShibariumKnBoneContract = getShibariumKnBoneContract;
exports.getStakeManagerContract = getStakeManagerContract;
exports.getUstBoneContract = getUstBoneContract;
exports.getVestingContract = getVestingContract;
exports.getWithdrawalQueueContract = getWithdrawalQueueContract;