XI. Appendix

Code Snippets

Sigmoid Function

The sigmoid function is used to model the reward distribution over time. It is represented as:

S(x) = 1 / (1 + e^-x)

Create Fountain

The createFountain function in the $NFAiUserStakes contract is used to create a new fountain.

const tx2 = await nFAiUserStakes.createFountain(
  bucketId,
  rewardContractsAddresses,
  eligibleTokensAddresses,
  withdrawalFee,
  usesReceiptToken
);

Create Reward Contract for Fountain

The createRewardContractForFountain function in the NFAiRewardManager contract is used to create a reward contract for a fountain.

const tx1 = await nFAiRewardManager.createRewardContractForFountain(
  bucketId,
  epochDuration,
  epochStartTime,
  rewardsTokenAddress,
  proportions
);

Diagrams

Sigmoid Function

The sigmoid function is used to model the reward distribution over time. The function is represented graphically as an S-shaped curve.

1.00 ┤          ╭────
     │         ╭╯
     │        ╭╯
0.75 ┤       ╭╯
     │      ╭╯
     │     ╭╯
0.50 ┤    ╭╯
     │   ╭╯
     │  ╭╯
0.25 ┤ ╭╯
     │╭╯
0.00 ┼╯

System Architecture

The system architecture diagram shows the interaction between the NFAiUserStakes, NFAiRewardManager, and AssetRewardContract contracts.

NFAiUserStakes

     ├─────> AssetRewardContract (Fountain 1)

     ├─────> AssetRewardContract (Fountain 2)

     └─────> AssetRewardContract (Fountain x)

NFAiRewardManager

     ├─────> AssetRewardContract (Fountain 1)

     ├─────> AssetRewardContract (Fountain 2)

     └─────> AssetRewardContract (Fountain x)

Glossary

  • Fountains: A category of stakes, each with its own reward contract.

  • Epoch: A period of time used for reward distribution.

  • Proportions: An array representing the output of the sigmoid function at different points.

  • Receipt Token: A token issued as proof of stake in certain fountains.

  • Reward Contract: A contract that calculates and distributes rewards based on the stake's duration and the sigmoid function.

  • Sigmoid Function: A mathematical function used to model the reward distribution over time.

References

Last updated

Was this helpful?