Skip to content
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

Enforce consistent block times + Default undelegate lockup duration update #612

Merged
merged 5 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions eth-contracts/contracts/DelegateManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ contract DelegateManager is InitializableV2 {
*/
function initialize (
address _tokenAddress,
address _governanceAddress
address _governanceAddress,
uint256 _undelegateLockupDuration
) public initializer
{
_updateGovernanceAddress(_governanceAddress);
audiusToken = ERC20Mintable(_tokenAddress);
undelegateLockupDuration = 10;
undelegateLockupDuration = _undelegateLockupDuration;
maxDelegators = 175;
// Default minimum delegation amount set to 100AUD
minDelegationAmount = 100 * 10**uint256(18);
Expand Down
8 changes: 6 additions & 2 deletions eth-contracts/migrations/8_delegate_manager_migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const serviceProviderFactoryKey = web3.utils.utf8ToHex('ServiceProviderFactory')
const governanceKey = web3.utils.utf8ToHex('Governance')
const delegateManagerKey = web3.utils.utf8ToHex('DelegateManager')

// stake lockup duration = 1 wk in blocks
// - 1/13 block/s * 604800 s/wk ~= 46523 block/wk
const decreaseStakeLockupDuration = 46523

module.exports = (deployer, network, accounts) => {
deployer.then(async () => {
const config = contractConfig[network]
Expand All @@ -38,8 +42,8 @@ module.exports = (deployer, network, accounts) => {
const delegateManager0 = await deployer.deploy(DelegateManager, { from: proxyDeployerAddress })
const initializeCallData = _lib.encodeCall(
'initialize',
['address', 'address'],
[token.address, governanceAddress]
['address', 'address', 'uint256'],
[token.address, governanceAddress, decreaseStakeLockupDuration]
)
const delegateManagerProxy = await deployer.deploy(
AudiusAdminUpgradeabilityProxy,
Expand Down
4 changes: 2 additions & 2 deletions eth-contracts/test/delegateManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ contract('DelegateManager', async (accounts) => {

const delegateManagerInitializeData = _lib.encodeCall(
'initialize',
['address', 'address'],
[token.address, governance.address]
['address', 'address', 'uint256'],
[token.address, governance.address, 10]
)
let delegateManager0 = await DelegateManager.new({ from: proxyDeployerAddress })
let delegateManagerProxy = await AudiusAdminUpgradeabilityProxy.new(
Expand Down
4 changes: 2 additions & 2 deletions eth-contracts/test/governance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ contract('Governance.sol', async (accounts) => {
// Deploy + register DelegateManager contract
const delegateManagerInitializeData = _lib.encodeCall(
'initialize',
['address', 'address'],
[token.address, governance.address]
['address', 'address', 'uint256'],
[token.address, governance.address, 10]
)
let delegateManager0 = await DelegateManager.new({ from: proxyDeployerAddress })
let delegateManagerProxy = await AudiusAdminUpgradeabilityProxy.new(
Expand Down