Net worth

Access net worth and historical net worth data either for an address or FID.

Imagine building a dApp that offers exclusive opportunities to users with a net worth exceeding a certain threshold.

Note: The networth data is not live yet. We plan to make it live as soon as enough projects interested in. The API are stable though.Note: Net worth value is represented in USD without decimals. Example 100 for USD 100

Access user's net worth data of an address

Fetch net worth details for an address and source.
function getNetworthByAddress(address _address, uint256 _source) external view returns (TimestampedValue memory)
YourContract.sol
1import "./IFaracle.sol";
2import "./FaracleHelper.sol";
3
4contract MintIfMillionaire {
5  
6  IFaracle public faracle = IFaracle(0x687d65ce04abbca3dac57cda6c358e497bfd320e);
7
8  struct TimestampedValue {
9    uint32 timestampChain;
10    uint32 timestampSource;
11    uint192 value;
12  }
13
14  constructor() {}
15
16
17  function mintIfMillionaire() public {
18    
19    // Get networth data for the sender's address from source 1 (e.g., Faracle)
20    TimestampedValue memory networthData = faracle.getNetworthByAddress(msg.sender, NetworthSource.Debank);
21
22    require(networthData.value >= 1_000_000, "Net worth below 1 million USD");
23
24    // Proceed with minting logic
25
26  }
27
28}

Access user's net worth data of a FID

Fetch net worth details for a FID and source. An Fid can have multiple addresses associated with it.
function getNetworthByFid(uint256 _fid, uint256 _source) external view returns (TimestampedValue[] memory)
YourContract.sol
1import "./IFaracle.sol";
2import "./FaracleHelper.sol";
3
4contract InviteRichDudes {
5  
6  IFaracle public faracle = IFaracle(0x687d65ce04abbca3dac57cda6c358e497bfd320e);
7
8  struct TimestampedValue {
9    uint32 timestampChain;
10    uint32 timestampSource;
11    uint192 value;
12  }
13
14  constructor() {}
15
16
17  function inviteRichDudes(uint256 _fidToInvite) public {
18
19    require(_fidToInvite != 0, "Invalid FID");
20    
21    TimestampedValue[] memory networthData = faracle.getNetworthByAddress(_fidToInvite, NetworthSource.Debank);
22
23    uint256 totalNetWorth = 0;
24
25    for (uint i = 0; i < networthData.length; i++) {
26      totalNetWorth += networthData[i].value;
27    }
28
29    require(totalNetWorth >= 1_000_000, "Net worth below 1 million USD");
30
31    // Proceed with invite logic
32
33  }
34
35}

Access user's net worth data of a FID (address version)

Fetch net worth details for a fid (using address) and source. An address can have multiple addresses associated with it.
function getNetworthByFid(address _address, uint256 _source) external view returns (TimestampedValue[] memory)
YourContract.sol
1import "./IFaracle.sol";
2import "./FaracleHelper.sol";
3
4contract MintIfMillionaire {
5  
6  IFaracle public faracle = IFaracle(0x687d65ce04abbca3dac57cda6c358e497bfd320e);
7
8  struct TimestampedValue {
9    uint32 timestampChain;
10    uint32 timestampSource;
11    uint192 value;
12  }
13
14  constructor() {}
15
16
17  function mintIfMillionaire() public {
18    
19    TimestampedValue[] memory networthData = faracle.getNetworthByFid(msg.sender, NetworthSource.Debank);
20
21    uint256 totalNetWorth = 0; 
22    
23    for (uint i = 0; i < networthData.length; i++) {
24      totalNetWorth += networthData[i].value;
25    }    
26
27    require(totalNetWorth >= 1_000_000, "Net worth below 1 million USD");
28
29    // Proceed with minting logic
30
31  }
32
33}