https://github.com/la-bomba-studio/hesty-contract/tree/29596447b9a06d4ad53360d4a15f349ebf9fa0d8
This is a combination of two issue.
During the creation of a property to be split into PropertyToken, amount inputted in TokenFactory::createProperty(amount, ..) will be stored in TokenFactory.property mapping and used for accounting and distribution of PropertyToken to investor when a raise is complete. The issue is that constructor of PropertyToken multiply this value by 1e18 and mint everything to TokenFactory. Instruction from HestyAssetIssuance to mint to TokenFactory
TokenFactory will end up with amount * 1e18 PropertyTokens. There is no way to retrieve or burn those tokens. It will dilute totally all investor as the difference factor is huge.
Once completeRaise() is called, investor will be able to retrieve their tokens, but a large part will be stuck in TokenFactory
Time pass and the owner will try to call TokenFactory::distributeRevenue() or HestyRouter::adminDistribution()
Those functions will send EURC in PropertyToken, and user can collect their rewards with PropertyToken::claimDividensExternal().
Though dividend are calculated per token and take into account totalSupply
Share of investor will be insignificant and because of Solidity rounding down, will always be equal to 0.
All EURC distributed will end up stuck into TokenProperty, or TokenFactory as it's possible to call claimDividend for someone else
There is no way to either retrieved stucked EURC revenue in TokenProperty nor TokenFactory.
This issue will happen for every house raises done using the protocol and all rewards distributed will be stuck forever.
TokenFactory::createProperty, with 1000 amount of wanted PropertyToken and total price of 100_000 EURC, tokenPrice = 100.TokenFactory property data, all of them have been soldTokenFactory::closeRaise(), owner get back his investment minus fees.TokenFactory::getInvestmentTokens()HestyRouter::adminDistribution()TokenFactory::claimInvestmentReturns(), and got nothingPropertyToken or in TokenFactory if someone calls TokenFactory::claimInvestmentReturns(address(tokenFactory), id)PropertyToken//PropertyToken.sol
constructor(
address tokenManagerContract_,
uint256 initialSupply_,
string memory name_,
string memory symbol_,
address rewardAsset_,
address ctrHestyControl_,
address owner
) ERC20(name_, symbol_) AccessControlDefaultAdminRules(
3 days,
owner // Explicit initial `DEFAULT_ADMIN_ROLE` holder
){
// Supplies higher than TEN_POWER_FIFTEEN ether will result in precision lost
require(initialSupply_ < TEN_POWER_FIFTEEN, "Precision lost");
// Property Token Supply Issuance
- _mint(address(tokenManagerContract_), initialSupply_ * 1 ether);
+ _mint(address(tokenManagerContract_), initialSupply_);
rewardAsset = IERC20(rewardAsset_);
ctrHestyControl = IHestyAccessControl(ctrHestyControl_);
}
TokenFactory, so half revenue locked as well.
Leftover PropertyToken in TokenFactory needs to be burned at finalization or sent back to owner? This is up to the protocol to decide.Install forge in the repo :
forge init
forge update
Update foundry.toml with those value
[profile.default]
src = "contracts"
out = "out"
libs = ["lib"]
via_ir = true
Install openzeppelin lib :
forge soldeer init #with foundry-toml
forge soldeer install @openzeppelin-contracts~4.9.6
You should have in foundry.toml :
[profile.default]
src = "contracts"
out = "out"
libs = ["lib", "dependencies"]
via_ir = true
[dependencies]
forge-std = "1.9.6"
"@openzeppelin-contracts" = "4.9.6"
Change in remappings.txt :
@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-4.9.6/
forge-std-1.9.6/=dependencies/forge-std-1.9.6/
Add Poc into contracts/Test.t.sol
Run forge, if stack too deep error add --via-ir, in case not set in foundry.toml :
forge build --via-ir
forge test -vvv --via-ir #OR
forge test --mt testCompleteRaiseAndDistributeDividends -vvv
File is sent along with the report under the name Test.sol, otherwise it was not working as Test.t.sol
Attachments are hidden
This information is not publicly available.
Comments are hidden
This information is not publicly available.