Developer Quickstart

To integrate the reveel protocol into your code via ABIs directly, you can use libraries like ethers.js or web3JS.
In this section we will demonstrate some of the core operations and how to use them with examples, utilizing ethers.js.

Creating Revenue Path

// instantiate the factory (reveelMain)
const mainnetFactoryAddress = "0xae4EfaEB758f149f9C780268986537E45Bd57d7C";
const factoryABI = [...]; // get this from etherscan: https://etherscan.io/address/0xae4EfaEB758f149f9C780268986537E45Bd57d7C#code
const reveelMain = new ethers.Contract(
mainnetFactoryAddress,
factoryABI,
signer, // instantiating a signer using your desired wallet library (wagmi, web3Modal, etc)
);
​
// create a path
//
// 1. setting your tier vars, read below for an explanation of each
const ETH = ethers.constants.AddressZero; // addressZero is the network gas token
const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const tokenList = [ETH, WETH, DAI, USDC];
​
const tierOneAddressList = ["0xD6d0c9fC8F1f6cbCa3472052df3678E5b29b2DcA", "0xa8fa3Dd927C938E137b91C3C46EbDF7CC0A86942"];
const tierOneFeeDistribution = [5000000, 5000000]; // both wallets split the tier 50%
​
const tierTwoAddressList = ["0xD6d0c9fC8F1f6cbCa3472052df3678E5b29b2DcA", "0xa8fa3Dd927C938E137b91C3C46EbDF7CC0A86942", "0xfd5D88F326f4F8C497E1AD1E218fCA38F12A3F0D"];
const tierTwoFeeDistribution = [3300000, 3300000, 3400000]; // each wallet getting 33-34%
​
const tierThreeAddressList = ["0xD6d0c9fC8F1f6cbCa3472052df3678E5b29b2DcA"];
const tierThreeFeeDistribution = [10000000]; // one wallet getting 100%
​
// 2.1 - compiling your address list. Each tier's address list should be in sub array
const addressList = [tierOneAddressList, tierTwoAddressList, tierThreeAddressList];
​
// 2.2 - compiling your distribution list. Each tier requires a distribution list sub array.
// - Each distribution list array must be the same length as that tier's address list array
// - The elements in each distribution list array must sum to 10000
const distList = [tierOneFeeDistribution, tierTwoFeeDistribution, tierThreeFeeDistribution];
​
// 2.3 - compiling the tier limits. All tiers except the Final Tier require a tier limit.
// - the Final tier's limit is infinite by default & should not be included
const limitSequence: BigNumberish[][] = [
// tier 1 has 1 ETH limit, tier 2 has a 0.5 ETH limit, tier 3 is infinite (blank)
[_ethers.utils.parseEther("1"), _ethers.utils.parseEther("0.5")],
// tier 1 has 1 WETH limit, tier 2 has a 0.5 WETH limit, tier 3 is infinite (blank)
[_ethers.utils.parseEther("1"), _ethers.utils.parseEther("0.5")],
// tier 1 has a 10 DAI limit, tier 2 has a 1000 DAI limit, tier 3 is infinite (blank)
[_ethers.utils.parseUnits("10", 18), _ethers.utils.parseUnits("1000", 18)],
// tier 1 has a 10 USDC limit, tier 2 has a 1000 USDC limit, tier 3 is infinite (blank)
[_ethers.utils.parseUnits("10", 6), _ethers.utils.parseUnits("1000", 6)]
];
​
// 3 - Set your path name
const pathName = "Super Successful Mega Path"
​
// 4 - set your mutability
// true = no edits allowed after path creation
// false = mutable, allow edits after path creation
const isImmutable = false
​
// 5 - create your path & profit
const tx = await reveelMain.createRevenuePath(
addressList,
distList,
tokenList,
limitSequence,
pathName,
isImmutable,
)
​
const receipt = await tx.wait();
​
console.log("tx: ", tx.hash);
const events = receipt.events as Event[];
const pathCreatedEvents = events.filter((e) => e.event === "RevenuePathCreated");
const address = pathCreatedEvents[0].args?.path
console.log("pathAddress: ", address);

Instantiate Revenue Path object

// release bob's currently available revenue for the network gasToken
const revenuePathAddress = "..."; // yours from above
const pathABI = [...]; // get this from etherscan: https://etherscan.io/address/0xC177B59a78d2C7d0c5A4FC6dB22b4D65d55e6E0b#code
const revenuePath = new ethers.Contract(
revenuePathAddress,
factoryABI,
signer, // instantiating a signer using your desired wallet library (wagmi, web3Modal, etc)
);

Adding Revenue Tier

coming soon

Updating Revenue Tier

coming soon

Withdrawing From Revenue Path

// release bob's currently available revenue for the network gasToken
await revenuePath.release(constants.AddressZero, bob.address);
​
// release alice's currently available revenue for the network gasToken
await revenuePath.release(constants.AddressZero, alice.address);
​
const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
// release bob's currently available revenue for DAI
await revenuePath.release(DAI, bob.address);
​
// release alice's currently available revenue for DAI
await revenuePath.release(DAI, alice.address);