-
Notifications
You must be signed in to change notification settings - Fork 466
Conversation
157e03a
to
bb46f18
Compare
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.
Just some small changes then g2g! 💯
/** | ||
* Generates a random address. | ||
*/ | ||
export function randomAddress(): string { |
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.
I don't know why it took us so long. 🙃
'InitAddresses', | ||
); | ||
for (const args of logsArgs) { | ||
expect(args.wethProxyAddress).to.eq(wethProxyAddress); |
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.
Why are we just asserting wethProxyAddress
and not the others?
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.
Whoops, forgot to add those in 😅
'InitAddresses', | ||
); | ||
for (const args of logsArgs) { | ||
expect(args.wethProxyAddress).to.eq(wethProxyAddress); |
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.
Ditto
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.
Looks good to me! Just a couple of nits and thoughts
@@ -13,7 +13,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); | |||
describe('Libs tests', () => { | |||
let coordinatorContract: CoordinatorContract; | |||
let chainId: number; | |||
const exchangeAddress = addressUtils.generatePseudoRandomAddress(); | |||
const exchangeAddress = randomAddress(); |
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.
🙏
@@ -4,11 +4,15 @@ import { constants } from './constants'; | |||
|
|||
export interface StakingParams { | |||
epochDurationInSeconds: BigNumber; | |||
rewardDelegatedStakeWeight: BigNumber; | |||
rewardDelegatedStakeWeight: number | BigNumber; |
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.
Nit: Let's just use Numberish
here, unless there is a reason why Strings shouldn't be allowed. I feel like we should just make this change everywhere that accepts BigNumber
.
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.
I was using Numberish
, but some of the contract wrapper functions don't accept strings as inputs and had to revert back to this.
/// @dev Assert param values before initializing them. | ||
/// This must be updated for each migration. | ||
function _assertMixinParamsBeforeInit() | ||
/// @dev Initialzize storage belonging to this mixin. |
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.
small nit: Initialzize
=> Initialize
// Set up defaults. | ||
// These cannot be set to variables, or we go over the stack variable limit. | ||
_setParams( | ||
2 weeks, // epochDurationInSeconds |
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.
Nit: Rather than setting these to variables, it would probably be good to make these constants, in case we ever want to change them. Additionally, if they are constants, we can use the internal function pattern to stub out these values, if necessary.
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.
Had to do this to get around stack limitations unfortunately.
/// @param _ethVaultAddress Address of the EthVault contract. | ||
/// @param _rewardVaultAddress Address of the StakingPoolRewardVault contract. | ||
/// @param _zrxVaultAddress Address of the ZrxVault contract. | ||
function _assertValidAddresses( |
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.
Since these addresses should all be contracts and this function will be called extremely infrequently, I think it might be worth checking that these accounts are in fact deployed contracts. I think this could be good for trustlessness and as a sanity check on the addresses that are registered.
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.
Is it really trustless if it's just a contract that allows someone to arbitrarily withdraw funds? 🤷♂
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.
looks good to me, just some small nits
@@ -20,29 +23,9 @@ blockchainTests('Configurable Parameters', env => { | |||
}); | |||
|
|||
blockchainTests.resets('setParams()', () => { | |||
interface Params { |
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.
🙏
{ | ||
zrxVault = IZrxVault(zrxVaultAddress); | ||
} | ||
|
||
/// @dev Deposits Zrx Tokens from the `owner` into the vault. | ||
/// @param owner of Zrx Tokens | ||
/// @param amount of tokens to deposit. | ||
function _depositFromOwnerIntoZrxVault(address owner, uint256 amount) | ||
internal | ||
{ | ||
IZrxVault _zrxVault = zrxVault; |
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 no longer need to cache this
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.
I'm probably going to just delete this mixin in a separate PR. It doesn't really do anything at the moment.
@@ -57,10 +44,6 @@ contract MixinZrxVault is | |||
internal | |||
{ | |||
IZrxVault _zrxVault = zrxVault; |
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.
ditto
@@ -72,10 +55,6 @@ contract MixinZrxVault is | |||
returns (uint256) | |||
{ | |||
IZrxVault _zrxVault = zrxVault; |
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.
ditto
contracts/staking/test/migration.ts
Outdated
from: notOwnerAddress, | ||
}); | ||
const tx = proxyContract.attachStakingContract.awaitTransactionSuccessAsync( | ||
attachedAddress, |
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.
nit: initTargetContract.address
for consistency
Description
This PR:
wethAssetProxy
,ethVault
,rewardVault
, andzrxVault
are all now initialized ininit
and upgradable viasetParams
. Their old setter methods have been removed.attachStakingContract
now also requires these params to be passed in. However, they will be ignored in favor of the already stored params if null addresses are passed in.Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.