-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Base version #1
Base version #1
Conversation
contracts/L1/CorePropertiesL1.sol
Outdated
address public arbitrumGateway; | ||
address public treasuryAddress; | ||
|
||
address public lZEnpointAddress; // L1 | ||
uint256 public destinationChainId; // arbitrum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to move it to the Factory
contracts/L1/CorePropertiesL1.sol
Outdated
} | ||
|
||
function setFee(address token_, uint256 fee_) external onlyOwner { | ||
_fees[token_] = fee_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check that fee less then 100%
contracts/L1/CorePropertiesL1.sol
Outdated
_fees[token_] = fee_; | ||
} | ||
|
||
function setTreasuryAddress(address treasuryAddress_) external onlyOwner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setTreasury, remove Address at the end
contracts/L1/CorePropertiesL1.sol
Outdated
function setDeployParams( | ||
address arbitrumGateway_, | ||
address lZEnpointAddress_, | ||
uint256 destinationChainId_ | ||
) external onlyOwner { | ||
arbitrumGateway = arbitrumGateway_; | ||
lZEnpointAddress = lZEnpointAddress_; | ||
destinationChainId = destinationChainId_; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to factory
contracts/L1/Distribution.sol
Outdated
Pool storage pool = pools[poolId_]; | ||
require(pool.isPublic == pool_.isPublic, "DS: invalid pool type"); | ||
if (pool_.payoutStart > block.timestamp) { | ||
require(pool.payoutStart != pool_.payoutStart, "DS: invalid payout start value"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pool.payoutStart == pool_.payoutStart
contracts/L1/Distribution.sol
Outdated
@@ -327,6 +335,12 @@ contract Distribution is IDistribution, OwnableUpgradeable, UUPSUpgradeable { | |||
uint256 overplus_ = overplus(); | |||
require(overplus_ > 0, "DS: overplus is zero"); | |||
|
|||
(uint256 feePercent_, address treasuryAddress_) = coreProperties.getFeeAndTreasury(address(this)); | |||
uint256 fee_ = _feeAmount(overplus_, feePercent_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint256 fee_ = (amount_ * feePercent_) / PRECISION
contracts/L1/Distribution.sol
Outdated
uint256 public totalDepositedInPublicPools; | ||
|
||
CorePropertiesL1 public coreProperties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address public feeProperties;
Add it to initialize
contracts/L1/CorePropertiesL1.sol
Outdated
address public lZEnpointAddress; // L1 | ||
uint256 public destinationChainId; // arbitrum | ||
|
||
mapping(address => uint256) private _fees; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baseFee
customFee
contracts/L1/CorePropertiesL1.sol
Outdated
destinationChainId = destinationChainId_; | ||
} | ||
|
||
function getFeeAndTreasury(address distributionAddress_) external view returns (uint256, address) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Check custom fee.
- If not exist, return base fee
contracts/L1/BaseFactoryL1.sol
Outdated
address zroPaymentAddress; | ||
uint16 l2EndpointId; | ||
bytes adapterParams; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To DeployConfig
contracts/L1/BaseFactoryL1.sol
Outdated
|
||
abstract contract BaseFactoryL1 is BaseFactory { | ||
using EnumerableSet for EnumerableSet.AddressSet; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mapping(deployer=>bytes name=>DeployedAddresses)
DeployedAddresses {
distribution: 0x
l1Sender: 0x
}
Noticed a typo throughout the codebase - Occurs in at least 8 places so won't list them all, Ctrl + F should do it! |
contracts/L2/Mor20FactoryL2.sol
Outdated
coreProperties = CorePropertiesL2(coreProperties_); | ||
} | ||
|
||
function deployMor20OnL1(Mor20DeployParams calldata parameters_) external onlyOwner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this method be called deployMor20OnL2?
* @param poolType_ the type of the pool. | ||
* @param implementation_ the implementation the pool will point to. | ||
*/ | ||
function setImplementation(uint8 poolType_, address implementation_) public onlyOwner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should implementation_
be a beacon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided to do it with ERC1967Proxy to have the chance to remove the upgradability
contracts/L2/L2Factory.sol
Outdated
|
||
IL2MessageReceiver(l2MessageReceiver).L2MessageReceiver__init( | ||
mor20, | ||
IL2MessageReceiver.Config(lzExternalDeps.endpoint, address(0), lzExternalDeps.senderChainId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we calculate L1Sender in advance?
contracts/L1/L1Factory.sol
Outdated
lzExternalDeps.adapterParams | ||
); | ||
|
||
IL1Sender.DepositTokenConfig memory arbConfig = IL1Sender.DepositTokenConfig( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IL1Sender.DepositTokenConfig memory arbConfig = IL1Sender.DepositTokenConfig( | |
IL1Sender.DepositTokenConfig memory arbConfig_ = IL1Sender.DepositTokenConfig( |
|
||
import {IFactory} from "./interfaces/IFactory.sol"; | ||
|
||
abstract contract Factory is IFactory, OwnableUpgradeable, PausableUpgradeable, UUPSUpgradeable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add method to precalculate address. It should take deployer as a parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
* initial version * Base version (#1) * Base version * Added BaseFactory * Refactored code * Set CoreProperties upgradeable * fixes * refactor logic * updated * removed scripts * Updated package.json * fixes * added more tests * added config * changed swap params * changed package-lock.json * changed package-lock.json * changed ci * changed package-lock.json --------- Co-authored-by: Oleksandr Fedorenko <[email protected]> * added beacon & refactored (#4) * added beacon & refactored * fix event * typo * context * upd enum * tiny adjustments & cov 100% * factories dir & isUpgradeable for all pools * fixed lint * factory ifaces folder --------- Co-authored-by: Ruslan Kasheparov <[email protected]> Co-authored-by: Ruslan Kasheparov <[email protected]> Co-authored-by: Oleksandr Fedorenko <[email protected]>
No description provided.