relevant tag icon
HQ20 Dividendable ERC20
copy icon
HQ20
• version 1.0.0
Token
ERC20
Dividend
Rewards

HQ20 Dividendable ERC20

Implements an ERC20Mintable token with a dividend distribution procedure for ethereum received. This contract was implemented from algorithms proposed by Nick Johnson here: https://medium.com/@weka/dividend-bearing-tokens-on-ethereum-42d01c710657

*Visit desktop site to download or deploy

Version

1.0.0

Creator

HQ20

Recent Use

🍞 0x77CA saved
🥐 0xbb00 downloaded

Last Publish

10/17/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
releaseDividends() :
This function is used to release dividends to the shareholders of a company. It works by taking the amount of money sent to the contract (msg.value) and passing it to the _releaseDividends() function, which is responsible for distributing the dividends to the shareholders. (autogenerated documentation)
claimDividends() :
This function allows a user to claim any dividends that have been accrued to their account. It works by calling the _claimDividends() function, passing in the address of the user who is claiming the dividends as an argument. The function then returns the amount of dividends that have been claimed. (autogenerated documentation)
_releaseDividends(uint256) :
This function releases dividends to all token holders. It takes in an amount of Ether as an argument and divides it by the total supply of tokens. The resulting amount is then added to the dividendsPerToken variable, which is a mapping of addresses to the amount of dividends they have. The address of 0 is then set to the total amount of dividends per token. This allows all token holders to access the amount of dividends they have. (autogenerated documentation)
_claimDividends(address) :
This function allows a user to claim any dividends that are owed to them. It takes an address payable account as an argument and returns the amount of dividends that are owed to the account. It first checks to make sure that the account has dividends owing, and then transfers the amount to the account. It then updates the claimedDPT mapping with the amount of dividends per token. (autogenerated documentation)
_dividendsOwing(address) :
This function calculates the amount of dividends that are owed to a given account. It does this by subtracting the amount of dividends that have already been claimed by the account from the total amount of dividends per token, and then multiplying this difference by the account's token balance. The result is returned as a uint256. (autogenerated documentation)
_beforeTokenTransfer(address,address,uint256) :
This function is used to transfer tokens between two addresses. It works by calculating the weight of the transfer, which is the amount of tokens being transferred divided by the total balance of the receiving address. It then calculates the differential DPT, which is the difference between the DPT of the sending address and the DPT of the receiving address. Finally, it calculates the weighted DPT, which is the differential DPT multiplied by the weight of the transfer. The weighted DPT is then added to the DPT of the receiving address. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i HQ20-ERC20-Dividendable-Eth
copy icon

Recent Use

🍞 0x77CA saved
🥐 0xbb00 downloaded

Last Publish

10/17/2022

Version

1.0.0

Creator

HQ20

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.