Resolver
This helper contract makes it easy to find the contract addresses for the protocol
const sf = await Framework.create({
networkName: "goerli",
provider
});sf.settings.config.cfaV1Address
sf.settings.config.idaV1AddressAccessing Contracts In Solidity with the Host and Resolver
pragma solidity 0.8.13;
import { IResolver } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/utils/IResolver.sol";
import { ISuperfluid } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
contract ResolverExample {
IResolver public resolver;
ISuperfluid public host;
constructor(IResolver _resolver, ISuperfluid _host) {
resolver = _resolver;
host = _host;
}
function getContractFromResolver(string calldata name) external view returns (address) {
address addr = resolver.get(name);
return addr;
}
function getCFAContract() external view returns (address) {
bytes32 agreement;
agreement = keccak256("org.superfluid-finance.agreements.ConstantFlowAgreement.v1");
address agreementAddress = address(host.getAgreementClass(agreement));
return agreementAddress;
}
function getIDAContract() external view returns (address) {
bytes32 agreement;
agreement = keccak256("org.superfluid-finance.agreements.InstantDistributionAgreement.v1");
address aggrementAddress = address(host.getAgreementClass(agreement));
return agreementAddress;
}
}Last updated