Resolver
This helper contract makes it easy to find the contract addresses for the protocol
The Resolver is a helper contract which allows you to quickly find all the contract addresses for the Superfluid Framework. You can think of it as on-chain Superfluid directory.
The resolver is always deployed when the protocol is deployed. You've probably used it already and didn't know it, as this is what the @superfluid-finance/sdk-core uses each time you call Framework.create().
If you’re using the SDK Core, it’s unlikely that you need the resolver, because the SDK exposes various methods which call the resolver behind the scenes to access specific contract addresses. For example, if you need to access a Super Token, you can do so by symbol using:
await sf.loadSuperToken(”USDCx”);
Similarly, if you need the address of any specific agreement, you can access these addresses from the Framework object itself. For example, if the Framework object is instantiated for the Goerli network like so:
1
const sf = await Framework.create({
2
networkName: "goerli",
3
provider
4
});
Copied!
You can access the address of the host contract using the Framework object:
sf.settings.config.hostAddress
And the addresses of the constant flow agreement or instant distribution agreement contracts like so:
1
sf.settings.config.cfaV1Address
2
sf.settings.config.idaV1Address
Copied!
These addresses are also accessible in the Network Directory and with the Superfluid Console.

Accessing Contracts In Solidity with the Host and Resolver

Accessing these contracts in solidity is a bit different. However, it can be just as easy if you know how to use the Superfluid Resolver and/or the Superfluid Host contract to get these addresses. In the below contract, you’ll see 3 sample functions which demonstrate how to access the addresses of already deployed contracts:
1
pragma solidity 0.8.13;
2
​
3
import { IResolver } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/utils/IResolver.sol";
4
import { ISuperfluid } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
5
​
6
contract ResolverExample {
7
IResolver public resolver;
8
ISuperfluid public host;
9
​
10
constructor(IResolver _resolver, ISuperfluid _host) {
11
resolver = _resolver;
12
host = _host;
13
}
14
​
15
function getContractFromResolver(string calldata name) external view returns (address) {
16
address addr = resolver.get(name);
17
return addr;
18
}
19
​
20
function getCFAContract() external view returns (address) {
21
bytes32 agreement;
22
agreement = keccak256("org.superfluid-finance.agreements.ConstantFlowAgreement.v1");
23
​
24
address agreementAddress = address(host.getAgreementClass(agreement));
25
return agreementAddress;
26
}
27
​
28
function getIDAContract() external view returns (address) {
29
bytes32 agreement;
30
agreement = keccak256("org.superfluid-finance.agreements.InstantDistributionAgreement.v1");
31
​
32
address aggrementAddress = address(host.getAgreementClass(agreement));
33
return agreementAddress;
34
}
35
}
Copied!
To get the address of a Superfluid agreement like the Constant Flow Agreement or Instant Distribution agreement, you can use the Superfluid Host contract’s getAgreementClass method. You can see this being done in both the getCFAContract() and getIDAContract() examples in the above contract. You need to hash the following string:
1
`org.superfluid-finance.agreements.${agreementName}.v1`
Copied!
Then pass it as an argument to the host.getAgreementClass method. From here, you need to get the address of the returned contract using the same syntax seen in the above contract on lines 24 and 32.
In the case of other contracts, you can use the Resolver. If you look deep into the Superfluid SDK Core, you’ll see that the resolver makes use of the Superfluid Loader contract to load in the entire Framework.
To get a specific token address using the Resolver, you can use the resolver.get() method as seen in the above contract with the following schema:
1
//for Super Tokens
2
resolver.get(`supertokens.${protocolReleaseVersion}.superTokenSymbol`);
3
​
4
//example
5
resolver.get('supertokens.v1.DAIx');
Copied!
1
//for ERC20 tokens listed with the protocol
2
resolver.get(`tokens.tokensymbol`);
3
​
4
//example
5
resolver.get('tokens.DAI');
Copied!
If you'd like, you can also use the Resolver to get the entirety of the framework with the Superfluid Loader. You need to pass in the following argument to the resolver.get() function to make this happen:
1
resolver.get('SuperfluidLoader-v1');
Copied!
The above line of code will return the address of the Superfluid Loader contract on your current network. This method will return an array which contains 4 of the key addresses used within the protocol: the host, super token factory, CFA, and IDA contract. The function needed to do this is the loadFramework function, with the current protocol version passed in as a lone string parameter:
1
superfluidLoader.loadFramework("v1");
Copied!