tokamak-network / tokyo

tokyo monorepo
Apache License 2.0
4 stars 5 forks source link

Suggestions in BaseCrowdsale.sol #2

Closed shingonu closed 6 years ago

shingonu commented 6 years ago

I am auditing this: https://github.com/Onther-Tech/tokyo/blob/f7007f39d1868910f0f262163416b4492be9d98b/packages/tokyo-reusable-crowdsale/audit/full-features/contracts/base/crowdsale/BaseCrowdsale.sol

I just wonder how you(@4000D) think about these suggestions.

variable name:

unused parameter:

logic:

4000D commented 6 years ago
variable name

cap is hard cap of crowdsale. goal is soft cap. these name for Zeppelin's implementation(cap, goal)

unused parameter

calculateToFund function is expected to override like here and here. Even though _beneficiary parameter is not used in BaseCrowdsale contract, other contracts inherit BaseCrowdsale can override calculateToFund function with using _beneficiary parameter.

It is more intuitive to provide variable name for other inheriting contract to override function even it is not used in base contract

logic

1 and 2. We use Zeppelin's Crowdsale contract. buyTokens function you said is fallback function and buyTokensAndGenerateToBeneficiary function you said is buyTokens function in Zeppelin's Crowdsale contract. Transferring ETH to Crowdsale contract itself is absolutely explicit investment process. Nobody send ether to Crowdsale contract in order not to invest.

  1. BaseCrowdsale is abstract contract, neither contract or interface. init function is overrided tokyo generated crowdsale contract like here