Skip to content

Commit

Permalink
Remove debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Aug 14, 2023
1 parent f0a1a53 commit c449a68
Show file tree
Hide file tree
Showing 7 changed files with 563 additions and 497 deletions.
7 changes: 2 additions & 5 deletions apps/web/src/composables/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ref } from 'vue'
import { BigNumberish, ethers } from 'ethers'
import { CasimirManager, CasimirRegistry, CasimirViews, ISSVNetworkViews } from '@casimir/ethereum/build/@types'
import { CasimirManager, CasimirRegistry, CasimirViews } from '@casimir/ethereum/build/@types'
import ICasimirManagerAbi from '@casimir/ethereum/build/abi/ICasimirManager.json'
import ICasimirRegistryAbi from '@casimir/ethereum/build/abi/ICasimirRegistry.json'
import ICasimirViewsAbi from '@casimir/ethereum/build/abi/ICasimirViews.json'
import ISSVNetworkViewsAbi from '@casimir/ethereum/build/abi/ISSVNetworkViews.json'
import useEnvironment from './environment'
import useEthers from '@/composables/ethers'
import useLedger from '@/composables/ledger'
Expand All @@ -15,7 +14,6 @@ import useFormat from '@/composables/format'
import useWalletConnect from './walletConnect'
import { Account, BreakdownAmount, BreakdownString, ContractEventsByAddress, Pool, ProviderString, RegisteredOperator, UserWithAccountsAndOperators } from '@casimir/types'
import { Operator, Scanner } from '@casimir/ssv'
// import { operatorStore } from '@casimir/data'

const currentStaked = ref<BreakdownAmount>({
usd: '$0.00',
Expand All @@ -37,7 +35,6 @@ const provider = new ethers.providers.JsonRpcProvider(ethereumUrl)
const manager: CasimirManager & ethers.Contract = new ethers.Contract(managerAddress, ICasimirManagerAbi, provider) as CasimirManager
const views: CasimirViews & ethers.Contract = new ethers.Contract(viewsAddress, ICasimirViewsAbi, provider) as CasimirViews
const registry: CasimirRegistry & ethers.Contract = new ethers.Contract(registryAddress, ICasimirRegistryAbi, provider) as CasimirRegistry
const ssvViews: ISSVNetworkViews & ethers.Contract = new ethers.Contract(ssvNetworkViewsAddress, ISSVNetworkViewsAbi, provider) as ISSVNetworkViews

const operators = ref<Operator[]>([])
const registeredOperators = ref<Operator[]>([])
Expand Down Expand Up @@ -390,7 +387,7 @@ export default function useContracts() {
const signerCreator = signerCreators[signerType as keyof typeof signerCreators]
let signer = signerCreator(walletProvider)
if (isWalletConnectSigner(signer)) signer = await signer
const result = await registry.connect(signer as ethers.Signer).register(operatorId, { from: address, value: ethers.utils.parseEther(value)})
const result = await registry.connect(signer as ethers.Signer).registerOperator(operatorId, { from: address, value: ethers.utils.parseEther(value)})
await result.wait()
return true
} catch (err) {
Expand Down
11 changes: 6 additions & 5 deletions contracts/ethereum/scripts/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ void async function () {
if (pendingPoolIds.length + stakedPoolIds.length) {
console.log('🧾 Submitting report')
const activatedBalance = pendingPoolIds.length * 32
const sweptRewardBalance = rewardPerValidator * lastStakedPoolIds.length
const exitingPoolCount = await manager.requestedExits()
const sweptExitedBalance = exitingPoolCount.toNumber() * 32
const sweptRewardBalance = rewardPerValidator * lastStakedPoolIds.length
const rewardBalance = rewardPerValidator * stakedPoolIds.length
const latestActiveBalance = await manager.latestActiveBalance()
const nextActiveBalance = round(parseFloat(ethers.utils.formatEther(latestActiveBalance)) + activatedBalance + rewardBalance - sweptRewardBalance - sweptExitedBalance, 10)
Expand All @@ -111,20 +111,21 @@ void async function () {
await setBalance(poolAddress, nextBalance)
}
const startIndex = ethers.BigNumber.from(0)
const endIndex = ethers.BigNumber.from(pendingPoolIds.length + stakedPoolIds.length)
const endIndex = ethers.BigNumber.from(stakedPoolIds.length)
const compoundablePoolIds = await views.getCompoundablePoolIds(startIndex, endIndex)
const nextValues = {
const reportValues = {
activeBalance: nextActiveBalance,
sweptBalance: sweptExitedBalance,
sweptBalance: sweptExitedBalance + sweptRewardBalance,
activatedDeposits: nextActivatedDeposits,
forcedExits: 0,
completedExits: exitingPoolCount.toNumber(),
compoundablePoolIds
}
console.log('🧾 Report values', reportValues)
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
let remaining = exitingPoolCount.toNumber()
Expand Down
52 changes: 26 additions & 26 deletions contracts/ethereum/test/fixtures/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function secondUserDepositFixture() {
let requestId = 0
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: 32,
sweptBalance: 0,
activatedDeposits: 1,
Expand All @@ -109,7 +109,7 @@ export async function secondUserDepositFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -124,7 +124,7 @@ export async function rewardsPostSecondUserDepositFixture() {
let requestId = latestRequestId
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: 32.105,
sweptBalance: 0,
activatedDeposits: 0,
Expand All @@ -135,7 +135,7 @@ export async function rewardsPostSecondUserDepositFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -160,7 +160,7 @@ export async function sweepPostSecondUserDepositFixture() {
await setBalance(poolAddress, nextBalance)
}
const compoundablePoolIds = [1, 0, 0, 0, 0]
const nextValues = {
const reportValues = {
activeBalance: 32,
sweptBalance: sweptRewards,
activatedDeposits: 0,
Expand All @@ -171,7 +171,7 @@ export async function sweepPostSecondUserDepositFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -193,7 +193,7 @@ export async function thirdUserDepositFixture() {
let requestId = latestRequestId
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: 64,
sweptBalance: 0,
activatedDeposits: 1,
Expand All @@ -204,7 +204,7 @@ export async function thirdUserDepositFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -219,7 +219,7 @@ export async function rewardsPostThirdUserDepositFixture() {
let requestId = latestRequestId
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: 64.21,
sweptBalance: 0,
activatedDeposits: 0,
Expand All @@ -230,7 +230,7 @@ export async function rewardsPostThirdUserDepositFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -255,7 +255,7 @@ export async function sweepPostThirdUserDepositFixture() {
await setBalance(poolAddress, nextBalance)
}
const compoundablePoolIds = [1, 2, 0, 0, 0]
const nextValues = {
const reportValues = {
activeBalance: 64,
sweptBalance: sweptRewards,
activatedDeposits: 0,
Expand All @@ -266,7 +266,7 @@ export async function sweepPostThirdUserDepositFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -284,7 +284,7 @@ export async function firstUserPartialWithdrawalFixture() {
let requestId = latestRequestId
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: 64,
sweptBalance: 0,
activatedDeposits: 0,
Expand All @@ -295,7 +295,7 @@ export async function firstUserPartialWithdrawalFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -319,7 +319,7 @@ export async function fourthUserDepositFixture() {
let requestId = latestRequestId
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: 128,
sweptBalance: 0,
activatedDeposits: 2,
Expand All @@ -330,7 +330,7 @@ export async function fourthUserDepositFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -345,7 +345,7 @@ export async function activeBalanceLossFixture() {
let requestId = latestRequestId
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: 126,
sweptBalance: 0,
activatedDeposits: 0,
Expand All @@ -356,7 +356,7 @@ export async function activeBalanceLossFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -373,7 +373,7 @@ export async function activeBalanceRecoveryFixture() {
for (let i = 0; i < 2; i++) {
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: nextActiveBalance,
sweptBalance: 0,
activatedDeposits: 0,
Expand All @@ -384,7 +384,7 @@ export async function activeBalanceRecoveryFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -406,7 +406,7 @@ export async function thirdUserFullWithdrawalFixture() {
await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const sweptExitedBalance = 32
const nextValues = {
const reportValues = {
activeBalance: 96,
sweptBalance: sweptExitedBalance,
activatedDeposits: 0,
Expand All @@ -417,7 +417,7 @@ export async function thirdUserFullWithdrawalFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
const exitedPoolId = (await manager.getStakedPoolIds())[0]
Expand Down Expand Up @@ -448,7 +448,7 @@ export async function simulationFixture() {
const rewardsAmount = rewardsPerValidator * stakedPoolIds.length
totalRewards += round(rewardsAmount, 10)
nextActiveBalance = round(nextActiveBalance + rewardsAmount, 10)
const nextValues = {
const reportValues = {
activeBalance: nextActiveBalance,
sweptBalance: 0,
activatedDeposits: 0,
Expand All @@ -459,7 +459,7 @@ export async function simulationFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand All @@ -477,7 +477,7 @@ export async function simulationFixture() {
await setBalance(poolAddress, nextBalance)
}
const compoundablePoolIds = [2, 3, 4, 0, 0]
const nextValues = {
const reportValues = {
activeBalance: 96,
sweptBalance: sweptRewards,
activatedDeposits: 0,
Expand All @@ -488,7 +488,7 @@ export async function simulationFixture() {
requestId = await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await runUpkeep({ upkeep, keeper })
Expand Down
4 changes: 2 additions & 2 deletions contracts/ethereum/test/operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('Operators', async function () {

await time.increase(time.duration.days(1))
await runUpkeep({ upkeep, keeper })
const nextValues = {
const reportValues = {
activeBalance: 0,
sweptBalance: sweptExitedBalance,
activatedDeposits: 0,
Expand All @@ -131,7 +131,7 @@ describe('Operators', async function () {
await fulfillReport({
upkeep,
keeper,
values: nextValues,
values: reportValues,
requestId
})
await reportCompletedExitsHandler({ manager, views, signer: oracle, args: { count: 1 } })
Expand Down
Loading

0 comments on commit c449a68

Please sign in to comment.