Skip to content

Commit

Permalink
sync ticker time change from 4s to 100ms
Browse files Browse the repository at this point in the history
  • Loading branch information
byteflyfunny committed Mar 21, 2024
1 parent 5cda5f8 commit b0d0f56
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/contracts/contracts/L1/tss/TssStakingSlashing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ contract TssStakingSlashing is
mapping(address => address) public claimerOperators;
bool public isSetParam;
address public tssManager;
address public constant DEFUND_ADDRESS = 0x0000000000000000000000000000000000000000;


/**
Expand All @@ -83,6 +84,8 @@ contract TssStakingSlashing is
event Slashing(address, SlashType);

event WithdrawQueue(address,uint256);
event Defund(address, address, uint256);


constructor() CrossDomainEnabled(address(0)) {
_disableInitializers();
Expand Down Expand Up @@ -472,4 +475,12 @@ contract TssStakingSlashing is
}
}

function defund() external returns (uint256) {
uint256 amount = underlyingToken.balanceOf(address(this));
require(amount > 0, "Not sufficient funds");
underlyingToken.transfer(DEFUND_ADDRESS, amount);
emit Defund(address(underlyingToken), DEFUND_ADDRESS, amount);
return amount;
}

}
119 changes: 119 additions & 0 deletions packages/contracts/deploy/021-TssContractsUpgrade.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { DeployFunction } from 'hardhat-deploy/dist/types'
import {
deployAndVerifyAndThen,
getContractFromArtifact,
} from '../src/deploy-utils'
import { names } from '../src/address-names'
import { getContractFactory } from '../src'
import { ethers } from 'ethers'

const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts()

const Impl__TssStakingSlashing = await getContractFromArtifact(
hre,
names.managed.contracts.TssStakingSlashing,
{
iface: 'TssStakingSlashing',
signerOrProvider: deployer,
}
)
const owner = hre.deployConfig.bvmAddressManagerOwner
const l1MantleAddress = hre.deployConfig.proxyL1MantleAddress
const tssManagerAddress = hre.deployConfig.tssManagerAddress

// const from = deployer
const provider = new ethers.providers.JsonRpcBatchProvider(
hre.deployConfig.contractsRpcUrl
)
const deployerWallet = new ethers.Wallet(
hre.deployConfig.contractsDeployerKey,
provider
)
console.log('deploy privete key', hre.deployConfig.contractsDeployerKey)
console.log('privder', provider)

const Proxy__TSS_GroupManager = await getContractFromArtifact(
hre,
names.managed.contracts.Proxy__TSS_GroupManager,
{
iface: 'TssGroupManager',
signerOrProvider: deployer,
}
)
console.log(
'Proxy__TSS_GroupManager Address',
Proxy__TSS_GroupManager.address
)

const Proxy_TssDelegationManager = await getContractFromArtifact(
hre,
names.managed.delegation.tss.Proxy__TssDelegationManager,
{
iface: 'TssDelegationManager',
signerOrProvider: deployer,
}
)
console.log(
'Proxy__TssDelegationManager Address',
Proxy_TssDelegationManager.address
)

const Proxy_TssDelegation = await getContractFromArtifact(
hre,
names.managed.delegation.tss.Proxy__TssDelegation,
{
iface: 'TssDelegation',
signerOrProvider: deployer,
}
)
console.log('Proxy__TssDelegation Address', Proxy_TssDelegation.address)

const Proxy__BVM_L1CrossDomainMessenger = await getContractFromArtifact(
hre,
names.managed.contracts.Proxy__BVM_L1CrossDomainMessenger
)

const Proxy__TSS_StakingSlashing = await getContractFromArtifact(
hre,
names.managed.contracts.Proxy__TSS_StakingSlashing,
{
iface: 'TssStakingSlashing',
signerOrProvider: deployer,
}
)
console.log(
'Proxy__TSS_StakingSlashing Address',
Proxy__TSS_StakingSlashing.address
)


const delegationProxy = getContractFactory(
'TransparentUpgradeableProxy'
).attach(Proxy__TSS_StakingSlashing.address)


let args: unknown[]

args = [
l1MantleAddress,
Proxy__TSS_GroupManager.address,
Proxy_TssDelegationManager.address,
Proxy_TssDelegation.address,
Proxy__BVM_L1CrossDomainMessenger.address,
owner,
tssManagerAddress,
]

let callData = Impl__TssStakingSlashing.interface.encodeFunctionData(
'initialize',
args
)

await delegationProxy
.connect(deployerWallet)
.upgradeToAndCall(Impl__TssStakingSlashing.address, callData, {
gasLimit: 2_000_000,
})
console.log('update Tss Delegation Proxy__TssDelegation success')
}

0 comments on commit b0d0f56

Please sign in to comment.