Skip to main content

Smart Contract Integration

Filedgr vaults, streams and data attachments are represented on-chain by an upgradeable ERC-1155 contract.

Contract addresses

Contract addresses are resolved dynamically per environment rather than being fixed constants, so there is no static address table here. Retrieve the address for your environment from Filedgr before integrating directly.

Supported networks

The platform's ledger identifiers are XRPL, POLYGON_ZKEVM, POLYGON_POS and ETHEREUM.

warning

Only one EVM network is wired up in practice. The POLYGON_ZKEVM identifier resolves to Polygon Amoy in development and test, and to Polygon PoS mainnet in production. POLYGON_POS and ETHEREUM are defined but have no endpoint configured. Treat the identifiers as opaque and confirm the target network with Filedgr rather than inferring it from the name.

Contract interface

The functions most relevant to an integrator:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IFiledgr {
function createVault(uint256 vaultId, string calldata metadataURI, address creator)
external returns (uint256);

function createStream(uint256 streamId, uint256 vaultId, string calldata metadataURI, address creator)
external returns (uint256);

function setVaultPermission(uint256 vaultId, address user, uint8 permission) external;

function transferVaultOwnership(uint256 vaultId, address newOwner) external;

function updateVaultMetadata(uint256 vaultId, string calldata metadataURI) external;
}

Note that createVault and createStream both take a trailing address creator.

Batch equivalents exist for bulk work — createVaultWithStreams, batchCreateStreams, batchSetVaultPermissions, batchSetStreamPermissions and batchCreateDataAttachments — and are considerably cheaper than issuing the calls individually.

Fees

createVault and createStream are non-payable. Creation costs are charged through a separate holding contract with its own deposit flow, not by attaching value to the call.

Events

event VaultCreated(uint256 vaultId, address owner, string metadataURI);

Using the API instead

Most integrations should go through the REST API rather than calling the contract directly — it handles minting, IPFS pinning, permission settlement and credit accounting for you. See the Quick Start.